102 | | { |
103 | | if (substringSearch) |
104 | | { |
105 | | whereClause = "WHERE filename LIKE '%" + searchText + "%'" |
106 | | " OR artist LIKE '%" + searchText + "%'" |
107 | | " OR album LIKE '%" + searchText + "%'" |
108 | | " OR title LIKE '%" + searchText + "%'" |
109 | | ";"; |
110 | | } |
111 | | else |
112 | | { |
113 | | // regexp search |
114 | | whereClause = "WHERE filename REGEXP '" + searchText + |
115 | | "' OR artist REGEXP '" + searchText + |
116 | | "' OR album REGEXP '" + searchText + |
117 | | "' OR title REGEXP '" + searchText + |
118 | | "';"; |
119 | | } |
120 | | } |
121 | | |
| 109 | { |
| 110 | if (substringSearch) //alphanumeric |
| 111 | { |
| 112 | QStringList list = QStringList::split(",", searchText); |
| 113 | whereClause=""; |
| 114 | for (uint x = 0; x < list.count(); x++) |
| 115 | { |
| 116 | testString = list[x].stripWhiteSpace(); |
| 117 | if ( x == 0 ) { |
| 118 | whereClause += "WHERE ("; |
| 119 | } |
| 120 | else // if (x > 0) |
| 121 | { |
| 122 | whereClause += " AND ( "; |
| 123 | } |
| 124 | whereClause += "artist LIKE '%" + testString + "%'" |
| 125 | " OR album LIKE '%" + testString + "%'" |
| 126 | " OR title LIKE '%" + testString + "%'" |
| 127 | " OR filename LIKE '%" + testString + "%'" |
| 128 | ")"; |
| 129 | } |
| 130 | whereClause += ";"; |
| 131 | VERBOSE(VB_ALL, QString("alpha whereClause " + whereClause )); |
| 132 | } |
| 133 | else //numbers |
| 134 | { |
| 135 | QStringList list = QStringList::split(">", searchText); |
| 136 | whereClause=""; |
| 137 | for (uint x = 0; x < list.count(); x++) |
| 138 | { |
| 139 | testString = list[x].stripWhiteSpace(); |
| 140 | if ( x == 0 ) { |
| 141 | whereClause += "WHERE ("; |
| 142 | } else { |
| 143 | whereClause += " AND ( "; |
| 144 | } |
| 145 | whereClause += " artist REGEXP '" + testString + |
| 146 | "' OR album REGEXP '" + testString + |
| 147 | "' OR title REGEXP '" + testString + |
| 148 | "' OR filename REGEXP '" + testString + |
| 149 | "')"; |
| 150 | } |
| 151 | whereClause += ";"; |
| 152 | VERBOSE(VB_ALL, QString("numeric whereClause " + whereClause )); |
| 153 | } |
| 154 | } |
138 | | // Append artist/title/album info... ok this is ugly :( |
139 | | QString text(fileName + " [ " + |
140 | | query.value(1).toString() + "/" + |
141 | | query.value(2).toString() + "/" + |
142 | | query.value(3).toString() + "]"); |
143 | | |
144 | | // Insert item into listbox, including song identifier |
145 | | listbox->insertItem( |
| 170 | QString aComposer(query.value(1).toString()); |
| 171 | // cut off composer's first name |
| 172 | aComposer.replace(QRegExp(",.*"),""); |
| 173 | |
| 174 | QString aTitle(query.value(2).toString()); |
| 175 | // truncate Title at 30, cut off any trailing whitespace or , |
| 176 | aTitle.truncate( 30 ); |
| 177 | aTitle.replace(QRegExp(",*\\s*$"),""); |
| 178 | |
| 179 | // Append artist/title/album info... ok this is ugly :( |
| 180 | QString text(aComposer + ": " + |
| 181 | aTitle + "; " + |
| 182 | query.value(3).toString() ); |
| 183 | |
| 184 | // Insert item into listbox, including song identifier |
| 185 | listbox->insertItem( |