| 950 | // Cyrrilic specific program finder |
| 951 | // Cyrrilic alphabet list and more |
| 952 | const char* RuProgFinder::searchChars[] = { |
| 953 | "Ð", "Ð", "Ð", "Ð", "Ð", "Ð", "Ð", "Ð", "Ð", "Ð", |
| 954 | "Ð", "Ð", "Ð", "Ð", "Ð", "Ð", "Ð", "Ð ", "С", "Т", |
| 955 | "У", "Ѐ", "Ð¥", "Њ", "Ч", "К", "Щ", "Ъ", "Ы", "Ñ", |
| 956 | "Ð", "Ю", "Я", "0", "1", "2", "3", "4", "5", "6", |
| 957 | "7", "8", "9", "@", "A", "B", "C", "D", "E", "F", |
| 958 | "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", |
| 959 | "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", 0 }; |
| 960 | |
| 961 | RuProgFinder::RuProgFinder(MythScreenStack *parentStack, bool gg, |
| 962 | TV *player, bool embedVideo) |
| 963 | : ProgFinder(parentStack, gg, player, embedVideo) |
| 964 | { |
| 965 | for (numberOfSearchChars = 0; searchChars[numberOfSearchChars]; |
| 966 | ++numberOfSearchChars) |
| 967 | ; |
| 968 | } |
| 969 | |
| 970 | void RuProgFinder::initAlphabetList() |
| 971 | { |
| 972 | for (int charNum = 0; charNum < numberOfSearchChars; ++charNum) |
| 973 | { |
| 974 | new MythUIButtonListItem(m_alphabetList, QString::fromUtf8(searchChars[charNum])); |
| 975 | } |
| 976 | } |
| 977 | |
| 978 | // search by cyrillic and latin alphabet |
| 979 | // @ all programm |
| 980 | void RuProgFinder::whereClauseGetSearchData(QString &where, MSqlBindings |
| 981 | &bindings) |
| 982 | { |
| 983 | QDateTime progStart = QDateTime::currentDateTime(); |
| 984 | QString searchChar = m_alphabetList->GetValue(); |
| 985 | |
| 986 | if (searchChar.isEmpty()) |
| 987 | searchChar = searchChars[0]; |
| 988 | |
| 989 | |
| 990 | if (searchChar.contains('@')) |
| 991 | { |
| 992 | where = "SELECT DISTINCT title FROM program WHERE ( " |
| 993 | "title NOT REGEXP '^[A-Z0-9]' AND " |
| 994 | "title NOT REGEXP '^The [A-Z0-9]' AND " |
| 995 | "title NOT REGEXP '^A [A-Z0-9]' AND " |
| 996 | "title NOT REGEXP '^[0-9]' AND " |
| 997 | "starttime > :STARTTIME ) "; |
| 998 | if (!m_searchStr.isEmpty()) |
| 999 | { |
| 1000 | where += "AND title LIKE :SEARCH "; |
| 1001 | bindings[":SEARCH"] = '%' + m_searchStr + '%'; |
| 1002 | } |
| 1003 | |
| 1004 | where += "ORDER BY title;"; |
| 1005 | |
| 1006 | bindings[":STARTTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50"); |
| 1007 | } |
| 1008 | else |
| 1009 | { |
| 1010 | QString one = searchChar + '%'; |
| 1011 | QString two = QString("The ") + one; |
| 1012 | QString three = QString("A ") + one; |
| 1013 | QString four = QString("An ") + one; |
| 1014 | QString five = QString("\"") + one; |
| 1015 | |
| 1016 | where = "SELECT DISTINCT title " |
| 1017 | "FROM program " |
| 1018 | "WHERE ( title LIKE :ONE OR title LIKE :TWO " |
| 1019 | " OR title LIKE :THREE " |
| 1020 | " OR title LIKE :FOUR " |
| 1021 | " OR title LIKE :FIVE )" |
| 1022 | "AND starttime > :STARTTIME "; |
| 1023 | if (!m_searchStr.isEmpty()) |
| 1024 | where += "AND title LIKE :SEARCH "; |
| 1025 | |
| 1026 | where += "ORDER BY title;"; |
| 1027 | |
| 1028 | bindings[":ONE"] = one; |
| 1029 | bindings[":TWO"] = two; |
| 1030 | bindings[":THREE"] = three; |
| 1031 | bindings[":FOUR"] = four; |
| 1032 | bindings[":FIVE"] = five; |
| 1033 | bindings[":STARTTIME"] = progStart.toString("yyyy-MM-ddThh:mm:50"); |
| 1034 | |
| 1035 | if (!m_searchStr.isEmpty()) |
| 1036 | bindings[":SEARCH"] = '%' + m_searchStr + '%'; |
| 1037 | } |
| 1038 | } |
| 1039 | |
| 1040 | bool RuProgFinder::formatSelectedData(QString& data) |
| 1041 | { |
| 1042 | (void)data; |
| 1043 | return true; |
| 1044 | } |
| 1045 | |
| 1046 | bool RuProgFinder::formatSelectedData(QString& data, int charNum) |
| 1047 | { |
| 1048 | (void)data; |
| 1049 | (void)charNum; |
| 1050 | return true; |
| 1051 | } |
| 1052 | |
| 1053 | void RuProgFinder::restoreSelectedData(QString& data) |
| 1054 | { |
| 1055 | (void)data; |
| 1056 | } |
| 1057 | ////////////////////////////////////////////////////////////////////////////// |
| 1058 | |