Skip to content

Commit deebf70

Browse files
kefir500probonopd
andauthored
Fix inconsistent main icon detection, closes #496 (#498)
Co-authored-by: probonopd <probonopd@users.noreply.github.com>
1 parent 5fa79fa commit deebf70

File tree

1 file changed

+6
-36
lines changed

1 file changed

+6
-36
lines changed

tools/linuxdeployqt/main.cpp

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -425,42 +425,12 @@ int main(int argc, char **argv)
425425
if(candidates.length() == 1){
426426
iconToBeUsed = candidates.at(0); // The only choice
427427
} 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;
464434
}
465435
}
466436
}

0 commit comments

Comments
 (0)