| 19 | namespace IconUtils{ |
| 20 | |
| 21 | QString findBestIconIn(const QString &folder, const QString & iconKey) { |
| 22 | int best_found = validIconExtensions.size(); |
| 23 | QString best_filename; |
| 24 | |
| 25 | QDirIterator it(folder, QDir::NoDotAndDotDot | QDir::Files, QDirIterator::NoIteratorFlags); |
| 26 | while (it.hasNext()) { |
| 27 | it.next(); |
| 28 | auto fileInfo = it.fileInfo(); |
| 29 | |
| 30 | if(fileInfo.completeBaseName() != iconKey) |
| 31 | continue; |
| 32 | |
| 33 | auto extension = fileInfo.suffix(); |
| 34 | |
| 35 | for(int i = 0; i < best_found; i++) { |
| 36 | if(extension == validIconExtensions[i]) { |
| 37 | best_found = i; |
| 38 | qDebug() << i << " : " << fileInfo.fileName(); |
| 39 | best_filename = fileInfo.fileName(); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | return FS::PathCombine(folder, best_filename); |
| 44 | } |
| 45 | |
| 46 | QString getIconFilter() { |
| 47 | QString out; |
no test coverage detected