Add job status
This commit is contained in:
parent
f586efd500
commit
0816f071f8
7 changed files with 311 additions and 186 deletions
|
@ -1,53 +1,15 @@
|
|||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import "../pages/utils.js" as Utils
|
||||
|
||||
Setting {
|
||||
property var choices
|
||||
|
||||
function prettifyChoice(name, value)
|
||||
{
|
||||
switch(name) {
|
||||
case "print-quality":
|
||||
switch(value) {
|
||||
case 3:
|
||||
return qsTr("draft");
|
||||
case 4:
|
||||
return qsTr("normal");
|
||||
case 5:
|
||||
return qsTr("high");
|
||||
default:
|
||||
return qsTr("unknown quality ")+value
|
||||
}
|
||||
case "orientation-requested":
|
||||
switch(value) {
|
||||
case 3:
|
||||
return qsTr("portrait");
|
||||
case 4:
|
||||
return qsTr("landscape");
|
||||
case 5:
|
||||
return qsTr("reverse landscape");
|
||||
case 6:
|
||||
return qsTr("reverse portrait");
|
||||
default:
|
||||
return qsTr("unknown orientation ")+value
|
||||
}
|
||||
case "printer-resolution":
|
||||
|
||||
var units = "";
|
||||
if(value.units==3) {
|
||||
units=qsTr("dpi");
|
||||
} else if (units==4){
|
||||
units=qsTr("dots/cm")
|
||||
}
|
||||
return ""+value.x+"x"+value.y+units;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
ValueButton {
|
||||
enabled: valid
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
label: prettyName
|
||||
value: prettifyChoice(name, choice ? choice : default_choice)
|
||||
value: Utils.ippName(name, choice ? choice : default_choice)
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
|
||||
|
@ -56,7 +18,7 @@ Setting {
|
|||
Repeater {
|
||||
model: choices
|
||||
MenuItem {
|
||||
text: prettifyChoice(name, choices[index])
|
||||
text: Utils.ippName(name, choices[index])
|
||||
onClicked:
|
||||
{
|
||||
choice = choices[index];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
import "utils.js" as Utils
|
||||
|
||||
Page {
|
||||
id: page
|
||||
|
@ -53,16 +53,24 @@ Page {
|
|||
id: idLabel
|
||||
leftPadding: Theme.horizontalPageMargin
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: Theme.highlightColor
|
||||
text: printer.jobs[index]["job-id"].value
|
||||
Component.onCompleted: console.log(JSON.stringify(printer.jobs))
|
||||
}
|
||||
|
||||
Label {
|
||||
Column {
|
||||
anchors.left: idLabel.right
|
||||
anchors.leftMargin: Theme.horizontalPageMargin
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: printer.jobs[index]["job-name"] ? printer.jobs[index]["job-name"].value : qsTr("Untitled job")
|
||||
Component.onCompleted: console.log(JSON.stringify(printer.jobs))
|
||||
Label {
|
||||
text: printer.jobs[index]["job-name"] ? printer.jobs[index]["job-name"].value : qsTr("Untitled job")
|
||||
Component.onCompleted: console.log(JSON.stringify(printer.jobs))
|
||||
}
|
||||
Label {
|
||||
font.pixelSize: Theme.fontSizeTiny
|
||||
color: Theme.secondaryColor
|
||||
text: Utils.ippName("job-state", printer.jobs[index]["job-state"].value)
|
||||
}
|
||||
}
|
||||
|
||||
RemorseItem {
|
||||
|
|
|
@ -28,3 +28,61 @@ function has(arrayish, what)
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function ippName(name, value)
|
||||
{
|
||||
switch(name) {
|
||||
case "job-state":
|
||||
switch(value) {
|
||||
case 3:
|
||||
return qsTr("pending");
|
||||
case 4:
|
||||
return qsTr("pending-held");
|
||||
case 5:
|
||||
return qsTr("processing");
|
||||
case 6:
|
||||
return qsTr("processing-stopped");
|
||||
case 7:
|
||||
return qsTr("canceled");
|
||||
case 8:
|
||||
return qsTr("aborted");
|
||||
case 9:
|
||||
return qsTr("completed");
|
||||
default:
|
||||
return qsTr("unknown state ")+value
|
||||
}
|
||||
case "print-quality":
|
||||
switch(value) {
|
||||
case 3:
|
||||
return qsTr("draft");
|
||||
case 4:
|
||||
return qsTr("normal");
|
||||
case 5:
|
||||
return qsTr("high");
|
||||
default:
|
||||
return qsTr("unknown quality ")+value
|
||||
}
|
||||
case "orientation-requested":
|
||||
switch(value) {
|
||||
case 3:
|
||||
return qsTr("portrait");
|
||||
case 4:
|
||||
return qsTr("landscape");
|
||||
case 5:
|
||||
return qsTr("reverse landscape");
|
||||
case 6:
|
||||
return qsTr("reverse portrait");
|
||||
default:
|
||||
return qsTr("unknown orientation ")+value
|
||||
}
|
||||
case "printer-resolution":
|
||||
var units = "";
|
||||
if(value.units==3) {
|
||||
units=qsTr("dpi");
|
||||
} else if (units==4){
|
||||
units=qsTr("dots/cm")
|
||||
}
|
||||
return ""+value.x+"x"+value.y+units;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -191,6 +191,7 @@ bool IppPrinter::getJobs() {
|
|||
qDebug() << "getting jobs";
|
||||
|
||||
QJsonObject o = opAttrs();
|
||||
o.insert("requested-attributes", QJsonObject {{"tag", IppMsg::Keyword}, {"value", "all"}});
|
||||
|
||||
IppMsg job = IppMsg(o, QJsonObject());
|
||||
|
||||
|
|
|
@ -83,53 +83,6 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChoiceSetting</name>
|
||||
<message>
|
||||
<source>draft</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>normal</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>high</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown quality </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>portrait</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>landscape</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse landscape</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse portrait</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown orientation </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dpi</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dots/cm</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
<message>
|
||||
|
@ -250,4 +203,83 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>utils</name>
|
||||
<message>
|
||||
<source>pending</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>pending-held</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>processing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>processing-stopped</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>canceled</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>aborted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>completed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown state </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>draft</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>normal</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>high</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown quality </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>portrait</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>landscape</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse landscape</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse portrait</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown orientation </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dpi</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dots/cm</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -83,53 +83,6 @@
|
|||
<translation type="unfinished">Inconnu</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChoiceSetting</name>
|
||||
<message>
|
||||
<source>draft</source>
|
||||
<translation>brouillon</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>normal</source>
|
||||
<translation>normale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>high</source>
|
||||
<translation>haute</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown quality </source>
|
||||
<translation>qualité inconnue</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>portrait</source>
|
||||
<translation>portrait</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>landscape</source>
|
||||
<translation>paysage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse landscape</source>
|
||||
<translation>paysage inversé</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse portrait</source>
|
||||
<translation>portrait inversé</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown orientation </source>
|
||||
<translation>orientation inconnue</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dpi</source>
|
||||
<translation>dpi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dots/cm</source>
|
||||
<translation>pts/cm</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
<message>
|
||||
|
@ -250,4 +203,83 @@
|
|||
<translation>Échec de l'impression :</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>utils</name>
|
||||
<message>
|
||||
<source>pending</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>pending-held</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>processing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>processing-stopped</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>canceled</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>aborted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>completed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown state </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>draft</source>
|
||||
<translation type="unfinished">brouillon</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>normal</source>
|
||||
<translation type="unfinished">normale</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>high</source>
|
||||
<translation type="unfinished">haute</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown quality </source>
|
||||
<translation type="unfinished">qualité inconnue</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>portrait</source>
|
||||
<translation type="unfinished">portrait</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>landscape</source>
|
||||
<translation type="unfinished">paysage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse landscape</source>
|
||||
<translation type="unfinished">paysage inversé</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse portrait</source>
|
||||
<translation type="unfinished">portrait inversé</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown orientation </source>
|
||||
<translation type="unfinished">orientation inconnue</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dpi</source>
|
||||
<translation type="unfinished">dpi</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dots/cm</source>
|
||||
<translation type="unfinished">pts/cm</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -83,53 +83,6 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChoiceSetting</name>
|
||||
<message>
|
||||
<source>draft</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>normal</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>high</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown quality </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>portrait</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>landscape</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse landscape</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse portrait</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown orientation </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dpi</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dots/cm</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CoverPage</name>
|
||||
<message>
|
||||
|
@ -250,4 +203,83 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>utils</name>
|
||||
<message>
|
||||
<source>pending</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>pending-held</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>processing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>processing-stopped</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>canceled</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>aborted</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>completed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown state </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>draft</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>normal</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>high</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown quality </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>portrait</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>landscape</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse landscape</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>reverse portrait</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>unknown orientation </source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dpi</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>dots/cm</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
Loading…
Reference in a new issue