From 0da1783c5193b7c0227834ecd5b6b69be2e12ec3 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sat, 1 Jan 2022 20:03:37 +0100 Subject: [PATCH] Improve icon heuristics --- qml/pages/utils.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/qml/pages/utils.js b/qml/pages/utils.js index 9b7ca96..b804b33 100644 --- a/qml/pages/utils.js +++ b/qml/pages/utils.js @@ -461,12 +461,20 @@ function selectIcon(icons) { for(var i=0; i < icons.length; i++) { - if(endsWith("M.png", icons[i]) || endsWith("128x128.png", icons[i])) + if(endsWith("M.png", icons[i]) || endsWith("128.png", icons[i]) || endsWith("128.PNG", icons[i])) { return icons[i]; } } - return icons[0]; + // Icons must be 48, 128 or 256px and sorted by size, so if all 3 are provided we want the middle one + if(icons.length == 3) + { + return icons[1]; + } + else + { + return icons[0]; + } } function isWaringState(printer)