Icon selection heuristics
This commit is contained in:
parent
16f1edd818
commit
35d3e44ffd
2 changed files with 14 additions and 1 deletions
|
@ -189,7 +189,8 @@ Page {
|
|||
|
||||
height: Theme.itemSizeLarge
|
||||
width: Theme.itemSizeLarge
|
||||
source: printer.attrs["printer-icons"] ? "image://ippdiscovery/"+printer.attrs["printer-icons"].value[0] : "icon-seaprint-nobg.svg"
|
||||
source: printer.attrs["printer-icons"] ? "image://ippdiscovery/"+Utils.selectIcon(printer.attrs["printer-icons"].value)
|
||||
: "icon-seaprint-nobg.svg"
|
||||
// Some printers serve their icons over https with invalid certs...
|
||||
onStatusChanged: if (status == Image.Error) source = "icon-seaprint-nobg.svg"
|
||||
|
||||
|
|
|
@ -254,6 +254,18 @@ function limitChoices(name, choices, mimeType, ConvertChecker)
|
|||
}
|
||||
}
|
||||
|
||||
function selectIcon(icons)
|
||||
{
|
||||
for(var i=0; i < icons.length; i++)
|
||||
{
|
||||
if(endsWith("M.png", icons[i]) || endsWith("128x128.png", icons[i]))
|
||||
{
|
||||
return icons[i];
|
||||
}
|
||||
}
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
var media =
|
||||
{"asme_f_28x40in": "28 x 40″",
|
||||
"choice_iso_a4_210x297mm_na_letter_8.5x11in": "A4 or US Letter",
|
||||
|
|
Loading…
Reference in a new issue