Display warning icon
...and account for that there can be multiple reasons
This commit is contained in:
parent
0da94cc3b3
commit
ded0d4a2cb
4 changed files with 29 additions and 3 deletions
|
@ -44,8 +44,12 @@ Page {
|
||||||
text: Utils.ippName("printer-state", printer.attrs["printer-state"].value)
|
text: Utils.ippName("printer-state", printer.attrs["printer-state"].value)
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Repeater
|
||||||
text: Utils.ippName("printer-state-reasons", printer.attrs["printer-state-reasons"].value)
|
{
|
||||||
|
model: printer.attrs["printer-state-reasons"].value
|
||||||
|
Label {
|
||||||
|
text: Utils.ippName("printer-state-reasons", printer.attrs["printer-state-reasons"].value[index])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
|
|
@ -202,6 +202,14 @@ Page {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: warningIcon
|
||||||
|
source: "image://theme/icon-lock-warning"
|
||||||
|
anchors.bottom: icon.bottom
|
||||||
|
anchors.right: icon.right
|
||||||
|
visible: Utils.isWaringState(printer)
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: column
|
id: column
|
||||||
anchors.left: icon.right
|
anchors.left: icon.right
|
||||||
|
|
|
@ -318,6 +318,19 @@ function selectIcon(icons)
|
||||||
return icons[0];
|
return icons[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isWaringState(printer)
|
||||||
|
{
|
||||||
|
if(printer.attrs["printer-state"].value > 4)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(!has(printer.attrs["printer-state-reasons"].value, "none"))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var media =
|
var media =
|
||||||
{"asme_f_28x40in": "28 x 40″",
|
{"asme_f_28x40in": "28 x 40″",
|
||||||
"choice_iso_a4_210x297mm_na_letter_8.5x11in": "A4 or US Letter",
|
"choice_iso_a4_210x297mm_na_letter_8.5x11in": "A4 or US Letter",
|
||||||
|
|
|
@ -276,7 +276,8 @@ QString IppMsg::consume_attribute(QJsonObject& attrs, Bytestream& data)
|
||||||
bool forceArray = (!noList && (name.startsWith("marker-")
|
bool forceArray = (!noList && (name.startsWith("marker-")
|
||||||
|| name.startsWith("printer-firmware")
|
|| name.startsWith("printer-firmware")
|
||||||
|| name.endsWith("-supported")
|
|| name.endsWith("-supported")
|
||||||
|| name == "printer-icons"));
|
|| name == "printer-icons"
|
||||||
|
|| name.endsWith("-reasons")));
|
||||||
|
|
||||||
if(!unnamed.empty() || forceArray)
|
if(!unnamed.empty() || forceArray)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue