Ticket #3852: progfind.diff

File progfind.diff, 3.2 KB (added by ido roseman <ido_roseman@…>, 17 years ago)

hebrew aleph-bet program find screen

  • libs/libmythtv/progfind.cpp

    old new  
    4242    gContext->addCurrentLocation("ProgFinder");
    4343
    4444    // Language specific progfinder, if needed
     45    cerr << "selecting ProgFinder : lang = " << gContext->GetLanguage() << endl;
    4546
    4647    ProgFinder *programFind = NULL;
    4748    if (gContext->GetLanguage() == "ja")
    4849        programFind = new JaProgFinder(gContext->GetMainWindow(),
    4950                                       "program finder", ggActive);
    50     else
     51    else if (gContext->GetLanguage() == "he")         
     52        programFind = new HeProgFinder(gContext->GetMainWindow(),
     53                                     "program finder", ggActive);
     54    else // default
    5155        programFind = new ProgFinder(gContext->GetMainWindow(),
    5256                                     "program finder", ggActive);
    5357
     
    966970    update(infoRect);
    967971    update(listRect);
    968972}
    969 
     973 
    970974void ProgFinder::selectSearchData()
    971975{
    972976    if (running == false)
     
    15101514        getSearchData(charNum);
    15111515    }
    15121516}
     1517
     1518// Hebrew specific program finder
     1519
     1520// Hebrew alphabet list and more
     1521const char* HeProgFinder::searchChars[] = {
     1522"א", "ב", "ג", "ד", "ה", "ו", "ז", "ח", "ט", "י", "כ", "ל", "מ", "× ", "ס", "×¢", "×€", "׊",
     1523 "ק", "ך", "ש", "ת",
     1524 "E", "#", 0,
     1525};
     1526
     1527HeProgFinder::HeProgFinder(MythMainWindow *parent, const char *name, bool gg)
     1528            : ProgFinder(parent, name, gg)
     1529{
     1530    for (numberOfSearchChars = 0; searchChars[numberOfSearchChars];
     1531         numberOfSearchChars++)
     1532         ;
     1533
     1534    searchCount = numberOfSearchChars;
     1535    curSearch = 0;
     1536}
     1537
     1538void HeProgFinder::fillSearchData()
     1539{
     1540    int curLabel = 0;
     1541    for (int charNum = 0; charNum < searchCount; charNum++)
     1542    {
     1543        gotInitData[curLabel] = 0;
     1544        searchData[curLabel] = QString::fromUtf8(searchChars[charNum]);
     1545        curLabel++;
     1546    }
     1547}
     1548
     1549// search by hebrew aleph-bet
     1550// # for all numbers, E for all latin
     1551void HeProgFinder::whereClauseGetSearchData(int charNum, QString &where,
     1552                                            MSqlBindings &bindings)
     1553{
     1554    QDateTime progStart = QDateTime::currentDateTime();
     1555
     1556    where = "SELECT DISTINCT title FROM program ";
     1557
     1558    if (searchData[charNum].contains('E'))
     1559    {
     1560        where += "WHERE ( title REGEXP '^[A-Z]') ";
     1561    }
     1562    else if (searchData[charNum].contains('#'))
     1563    {
     1564        where += "WHERE ( title REGEXP '^[0-9]') ";
     1565    }
     1566    else
     1567    {
     1568        QString one = searchData[charNum] + "%";
     1569        bindings[":ONE"] = one.local8Bit();
     1570        where += "WHERE ( title LIKE :ONE ) ";
     1571    }
     1572
     1573    where += "AND starttime > :STARTTIME ORDER BY title;";
     1574    bindings[":STARTTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50");
     1575}
     1576
     1577
     1578bool HeProgFinder::formatSelectedData(QString& data)
     1579{
     1580    (void)data;
     1581    return true;
     1582}
     1583
     1584bool HeProgFinder::formatSelectedData(QString& data, int charNum)
     1585{
     1586    (void)data;
     1587    (void)charNum;
     1588    return true;
     1589}
     1590
     1591void HeProgFinder::restoreSelectedData(QString& data)
     1592{
     1593    (void)data;
     1594}
     1595
     1596void HeProgFinder::getAllProgramData()
     1597{
     1598    for (int charNum = 0; charNum < searchCount; charNum++)
     1599    {
     1600        getSearchData(charNum);
     1601    }
     1602}