Properly support (basic) media-col attributes
This commit is contained in:
parent
ec6224f777
commit
b98cc0e47a
12 changed files with 185 additions and 87 deletions
|
@ -6,11 +6,10 @@ import "../pages/utils.js" as Utils
|
|||
|
||||
Setting {
|
||||
property var choices: parent.getChoices(name)
|
||||
property string mime_type
|
||||
property var preferred_choices: []
|
||||
property string preferred_choice_suffix: ""
|
||||
|
||||
property var limited_choices: Utils.limitChoices(name, choices, mime_type, ConvertChecker)
|
||||
property var limited_choices: Utils.limitChoices(name, choices, parent.selectedFileType, ConvertChecker)
|
||||
|
||||
property int num_large_choices: 8
|
||||
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import seaprint.ippmsg 1.0
|
||||
|
||||
Setting {
|
||||
valid: ((parent.printer.attrs["media-left-margin-supported"].value.indexOf(0) != -1) &&
|
||||
(parent.printer.attrs["media-right-margin-supported"].value.indexOf(0) != -1) &&
|
||||
(parent.printer.attrs["media-top-margin-supported"].value.indexOf(0) != -1) &&
|
||||
(parent.printer.attrs["media-bottom-margin-supported"].value.indexOf(0) != -1))
|
||||
|
||||
displayValue: choice ? qsTr("true") : qsTr("false")
|
||||
|
||||
menu: ContextMenu {
|
||||
id: menu
|
||||
MenuItem {
|
||||
text: qsTr("true")
|
||||
onClicked:
|
||||
{
|
||||
choice = {"media-left-margin": {"tag": IppMsg.Integer, "value": 0},
|
||||
"media-right-margin": {"tag": IppMsg.Integer, "value": 0},
|
||||
"media-top-margin": {"tag": IppMsg.Integer, "value": 0},
|
||||
"media-bottom-margin": {"tag": IppMsg.Integer, "value": 0}}
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("false")
|
||||
onClicked:
|
||||
{
|
||||
choice = undefined
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@ Item {
|
|||
property string name
|
||||
property string prettyName
|
||||
property int tag
|
||||
property string subkey: ""
|
||||
property bool _valid: parent.isValid(name)
|
||||
property bool valid: _valid
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import QtQuick 2.6
|
|||
import Sailfish.Silica 1.0
|
||||
import seaprint.mimer 1.0
|
||||
import seaprint.ippprinter 1.0
|
||||
import seaprint.ippmsg 1.0
|
||||
|
||||
Column {
|
||||
id: settingsColumn
|
||||
|
@ -15,17 +16,28 @@ Column {
|
|||
return printer.attrs.hasOwnProperty(name+"-supported");
|
||||
}
|
||||
function setInitialChoice(setting) {
|
||||
if(jobParams.hasOwnProperty(setting.name))
|
||||
{
|
||||
if(setting.valid)
|
||||
{
|
||||
if(setting.subkey == "")
|
||||
{
|
||||
if(jobParams.hasOwnProperty(setting.name))
|
||||
{
|
||||
setting.choice = jobParams[setting.name].value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(jobParams.hasOwnProperty(setting.subkey) &&jobParams[setting.subkey].value.hasOwnProperty(setting.name))
|
||||
{
|
||||
setting.choice = jobParams[setting.subkey].value[setting.name].value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Clear jobParams of invalid settings
|
||||
jobParams[setting.name] = undefined;
|
||||
}
|
||||
delete jobParams[setting.name];
|
||||
}
|
||||
|
||||
}
|
||||
function getChoices(name) {
|
||||
return isValid(name) ? printer.attrs[name+"-supported"].value : [];
|
||||
|
@ -34,6 +46,8 @@ Column {
|
|||
return printer.attrs.hasOwnProperty(name+"-default") ? printer.attrs[name+"-default"].value : undefined;
|
||||
}
|
||||
function choiceMade(setting)
|
||||
{
|
||||
if(setting.subkey == "")
|
||||
{
|
||||
if(setting.choice != undefined)
|
||||
{
|
||||
|
@ -41,10 +55,35 @@ Column {
|
|||
}
|
||||
else
|
||||
{
|
||||
jobParams[setting.name] = undefined;
|
||||
delete jobParams[setting.name];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var tmpObj = Object();
|
||||
if(jobParams.hasOwnProperty(setting.subkey))
|
||||
{
|
||||
tmpObj = jobParams[setting.subkey].value;
|
||||
}
|
||||
|
||||
if(setting.choice != undefined)
|
||||
{
|
||||
tmpObj[setting.name] = {tag: setting.tag, value: setting.choice};
|
||||
}
|
||||
else
|
||||
{
|
||||
delete tmpObj[setting.name];
|
||||
}
|
||||
|
||||
if(Object.keys(tmpObj).length != 0)
|
||||
{
|
||||
jobParams[setting.subkey] = {tag: IppMsg.BeginCollection, value: tmpObj};
|
||||
}
|
||||
else
|
||||
{
|
||||
delete jobParams[setting.subkey];
|
||||
}
|
||||
}
|
||||
console.log(JSON.stringify(jobParams));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -93,13 +93,11 @@ Page {
|
|||
tag: IppMsg.Keyword
|
||||
name: "sides"
|
||||
prettyName: qsTr("Sides")
|
||||
mime_type: selectedFileType
|
||||
}
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.Keyword
|
||||
name: "media"
|
||||
prettyName: qsTr("Print media")
|
||||
mime_type: selectedFileType
|
||||
preferred_choices: printer.attrs.hasOwnProperty("media-ready") ? printer.attrs["media-ready"].value : []
|
||||
preferred_choice_suffix: qsTr("(loaded)")
|
||||
}
|
||||
|
@ -112,7 +110,6 @@ Page {
|
|||
tag: IppMsg.Keyword
|
||||
name: "multiple-document-handling"
|
||||
prettyName: qsTr("Collated copies")
|
||||
mime_type: selectedFileType
|
||||
}
|
||||
RangeSetting {
|
||||
tag: IppMsg.IntegerRange
|
||||
|
@ -128,48 +125,62 @@ Page {
|
|||
tag: IppMsg.Keyword
|
||||
name: "print-color-mode"
|
||||
prettyName: qsTr("Color mode")
|
||||
mime_type: selectedFileType
|
||||
}
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.Enum
|
||||
name: "print-quality"
|
||||
prettyName: qsTr("Quality")
|
||||
mime_type: selectedFileType
|
||||
}
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.Resolution
|
||||
name: "printer-resolution"
|
||||
prettyName: qsTr("Resolution")
|
||||
mime_type: selectedFileType
|
||||
}
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.MimeMediaType
|
||||
name: "document-format"
|
||||
prettyName: qsTr("Transfer format")
|
||||
mime_type: selectedFileType
|
||||
}
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.Keyword
|
||||
name: "media-type"
|
||||
subkey: "media-col"
|
||||
prettyName: qsTr("Media type")
|
||||
mime_type: selectedFileType
|
||||
}
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.Keyword
|
||||
name: "media-source"
|
||||
subkey: "media-col"
|
||||
prettyName: qsTr("Media source")
|
||||
mime_type: selectedFileType
|
||||
}
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.Keyword
|
||||
name: "output-bin"
|
||||
prettyName: qsTr("Output bin")
|
||||
mime_type: selectedFileType
|
||||
}
|
||||
MediaColSetting {
|
||||
tag: IppMsg.BeginCollection
|
||||
name: "media-col"
|
||||
prettyName: qsTr("Zero margins")
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.Integer
|
||||
name: "media-top-margin"
|
||||
subkey: "media-col"
|
||||
prettyName: qsTr("Top")
|
||||
}
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.Integer
|
||||
name: "media-bottom-margin"
|
||||
subkey: "media-col"
|
||||
prettyName: qsTr("Bottom")
|
||||
}
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.Integer
|
||||
name: "media-left-margin"
|
||||
subkey: "media-col"
|
||||
prettyName: qsTr("Left")
|
||||
}
|
||||
ChoiceSetting {
|
||||
tag: IppMsg.Integer
|
||||
name: "media-right-margin"
|
||||
subkey: "media-col"
|
||||
prettyName: qsTr("Right")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -462,10 +462,6 @@
|
|||
<source>Media source</source>
|
||||
<translation>Papierquelle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation>Keine Ränder</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page range</source>
|
||||
<translation>Seiten Auswählen</translation>
|
||||
|
@ -498,6 +494,22 @@
|
|||
<source>Media type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Top</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bottom</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Left</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Right</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RangeSetting</name>
|
||||
|
|
|
@ -462,10 +462,6 @@
|
|||
<source>Media source</source>
|
||||
<translation>Fuente de medios</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page range</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -498,6 +494,22 @@
|
|||
<source>Media type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Top</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bottom</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Left</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Right</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RangeSetting</name>
|
||||
|
|
|
@ -462,10 +462,6 @@
|
|||
<source>Media source</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page range</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -498,6 +494,22 @@
|
|||
<source>Media type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Top</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bottom</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Left</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Right</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RangeSetting</name>
|
||||
|
|
|
@ -462,10 +462,6 @@
|
|||
<source>Media source</source>
|
||||
<translation>Media bron</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation>Geen marges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page range</source>
|
||||
<translation>Paginabereik</translation>
|
||||
|
@ -498,6 +494,22 @@
|
|||
<source>Media type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Top</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bottom</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Left</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Right</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RangeSetting</name>
|
||||
|
|
|
@ -466,10 +466,6 @@
|
|||
<source>Media source</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Collated copies</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -498,6 +494,22 @@
|
|||
<source>Media type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Top</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bottom</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Left</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Right</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RangeSetting</name>
|
||||
|
|
|
@ -462,10 +462,6 @@
|
|||
<source>Media source</source>
|
||||
<translation>媒体源</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation>零页边距</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page range</source>
|
||||
<translation>页面范围</translation>
|
||||
|
@ -498,6 +494,22 @@
|
|||
<source>Media type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Top</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bottom</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Left</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Right</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RangeSetting</name>
|
||||
|
|
|
@ -462,10 +462,6 @@
|
|||
<source>Media source</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Page range</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
@ -498,6 +494,22 @@
|
|||
<source>Media type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Top</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Bottom</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Left</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Right</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RangeSetting</name>
|
||||
|
|
Loading…
Reference in a new issue