| | 1517 | |
| | 1518 | // Hebrew specific program finder |
| | 1519 | |
| | 1520 | // Hebrew alphabet list and more |
| | 1521 | const char* HeProgFinder::searchChars[] = { |
| | 1522 | "×", "×", "×", "×", "×", "×", "×", "×", "×", "×", "×", "×", "×", "× ", "ס", "×¢", "×€", "׊", |
| | 1523 | "ק", "ך", "ש", "ת", |
| | 1524 | "E", "#", 0, |
| | 1525 | }; |
| | 1526 | |
| | 1527 | HeProgFinder::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 | |
| | 1538 | void 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 |
| | 1551 | void 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 | |
| | 1578 | bool HeProgFinder::formatSelectedData(QString& data) |
| | 1579 | { |
| | 1580 | (void)data; |
| | 1581 | return true; |
| | 1582 | } |
| | 1583 | |
| | 1584 | bool HeProgFinder::formatSelectedData(QString& data, int charNum) |
| | 1585 | { |
| | 1586 | (void)data; |
| | 1587 | (void)charNum; |
| | 1588 | return true; |
| | 1589 | } |
| | 1590 | |
| | 1591 | void HeProgFinder::restoreSelectedData(QString& data) |
| | 1592 | { |
| | 1593 | (void)data; |
| | 1594 | } |
| | 1595 | |
| | 1596 | void HeProgFinder::getAllProgramData() |
| | 1597 | { |
| | 1598 | for (int charNum = 0; charNum < searchCount; charNum++) |
| | 1599 | { |
| | 1600 | getSearchData(charNum); |
| | 1601 | } |
| | 1602 | } |