@@ -425,42 +425,12 @@ int main(int argc, char **argv)
425
425
if (candidates.length () == 1 ){
426
426
iconToBeUsed = candidates.at (0 ); // The only choice
427
427
} else if (candidates.length () > 1 ){
428
- foreach (QString current, candidates) {
429
- if (current.contains (" 256" )){
430
- iconToBeUsed = current;
431
- continue ;
432
- }
433
- if (current.contains (" 128" )){
434
- iconToBeUsed = current;
435
- continue ;
436
- }
437
- if (current.contains (" svg" )){
438
- iconToBeUsed = current;
439
- continue ;
440
- }
441
- if (current.contains (" svgz" )){
442
- iconToBeUsed = current;
443
- continue ;
444
- }
445
- if (current.contains (" 512" )){
446
- iconToBeUsed = current;
447
- continue ;
448
- }
449
- if (current.contains (" 1024" )){
450
- iconToBeUsed = current;
451
- continue ;
452
- }
453
- if (current.contains (" 64" )){
454
- iconToBeUsed = current;
455
- continue ;
456
- }
457
- if (current.contains (" 48" )){
458
- iconToBeUsed = current;
459
- continue ;
460
- }
461
- if (current.contains (" xpm" )){
462
- iconToBeUsed = current;
463
- continue ;
428
+ const QStringList iconPriorities{" 256" , " 128" , " svg" , " svgz" , " 512" , " 1024" , " 64" , " 48" , " xpm" };
429
+ foreach (const QString &iconPriority, iconPriorities) {
430
+ const auto filteredCandidates = candidates.filter (iconPriority);
431
+ if (!filteredCandidates.isEmpty ()) {
432
+ iconToBeUsed = filteredCandidates.first ();
433
+ break ;
464
434
}
465
435
}
466
436
}
0 commit comments