Add zero margin setting
This commit is contained in:
parent
c58ed1e67d
commit
d3ff426946
8 changed files with 134 additions and 5 deletions
|
@ -24,7 +24,7 @@ Setting {
|
|||
maximumValue: high < 100 ? high : 100
|
||||
width: parent.width
|
||||
stepSize: 1
|
||||
value: choice
|
||||
value: choice ? choice : default_choice
|
||||
onValueChanged:
|
||||
{
|
||||
choice = value;
|
||||
|
|
52
qml/components/MediaColSetting.qml
Normal file
52
qml/components/MediaColSetting.qml
Normal file
|
@ -0,0 +1,52 @@
|
|||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import seaprint.convertchecker 1.0
|
||||
import seaprint.ippmsg 1.0
|
||||
import "../pages/utils.js" as Utils
|
||||
|
||||
Setting {
|
||||
property var printer
|
||||
|
||||
Component.onCompleted: {
|
||||
if((printer.attrs["media-left-margin-supported"].value.indexOf(0) != -1) &&
|
||||
(printer.attrs["media-right-margin-supported"].value.indexOf(0) != -1) &&
|
||||
(printer.attrs["media-top-margin-supported"].value.indexOf(0) != -1) &&
|
||||
(printer.attrs["media-bottom-margin-supported"].value.indexOf(0) != -1))
|
||||
{
|
||||
valid = true
|
||||
}
|
||||
}
|
||||
|
||||
ValueButton {
|
||||
enabled: valid
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
label: prettyName
|
||||
value: choice ? qsTr("true") : qsTr("false")
|
||||
onClicked: parent.clicked()
|
||||
}
|
||||
|
||||
property var menu: ContextMenu {
|
||||
id: menu
|
||||
enabled: true
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -7,7 +7,7 @@ Item {
|
|||
property string name
|
||||
property string prettyName
|
||||
property int tag
|
||||
property bool valid: true
|
||||
property bool valid: false
|
||||
|
||||
property var choice
|
||||
property var default_choice
|
||||
|
|
|
@ -45,6 +45,7 @@ Page {
|
|||
ListElement {name: "printer-resolution"; prettyName: qsTr("Resolution"); tag: IppMsg.Resolution}
|
||||
ListElement {name: "document-format"; prettyName: qsTr("Transfer format"); tag: IppMsg.MimeMediaType}
|
||||
ListElement {name: "media-source"; prettyName: qsTr("Media source"); tag: IppMsg.Keyword}
|
||||
ListElement {name: "media-col"; prettyName: qsTr("Zero margins"); tag: IppMsg.BeginCollection}
|
||||
}
|
||||
|
||||
SilicaListView {
|
||||
|
@ -74,6 +75,7 @@ Page {
|
|||
anchors.fill: parent
|
||||
|
||||
onLoaded: {
|
||||
delegate.visible = true
|
||||
if(loaderItem.menu.enabled)
|
||||
{
|
||||
menu = loaderItem.menu
|
||||
|
@ -81,7 +83,14 @@ Page {
|
|||
}
|
||||
loaderItem.choiceMade.connect(function(tag, choice) {
|
||||
console.log("choice changed", tag, JSON.stringify(choice))
|
||||
if(choice != undefined)
|
||||
{
|
||||
jobParams[name] = {tag: tag, value: choice};
|
||||
}
|
||||
else
|
||||
{
|
||||
jobParams[name] = undefined
|
||||
}
|
||||
console.log(JSON.stringify(jobParams));
|
||||
})
|
||||
}
|
||||
|
@ -97,7 +106,7 @@ Page {
|
|||
valid: printer.attrs.hasOwnProperty(name+"-supported"),
|
||||
low: printer.attrs[name+"-supported"].value.low,
|
||||
high: printer.attrs[name+"-supported"].value.high,
|
||||
default_choice: printer.attrs[name+"-default"].value
|
||||
default_choice: printer.attrs.hasOwnProperty(name+"-default") ? printer.attrs[name+"-default"].value : undefined
|
||||
})
|
||||
break
|
||||
case IppMsg.IntegerRange:
|
||||
|
@ -118,10 +127,18 @@ Page {
|
|||
tag: tag,
|
||||
valid: printer.attrs.hasOwnProperty(name+"-supported"),
|
||||
choices: printer.attrs[name+"-supported"].value,
|
||||
default_choice: printer.attrs[name+"-default"].value,
|
||||
default_choice: printer.attrs.hasOwnProperty(name+"-default") ? printer.attrs[name+"-default"].value : "",
|
||||
mime_type: Mimer.get_type(selectedFile)
|
||||
})
|
||||
break
|
||||
case IppMsg.BeginCollection:
|
||||
loader.setSource("../components/MediaColSetting.qml",
|
||||
{name: name,
|
||||
prettyName: prettyName,
|
||||
tag: tag,
|
||||
valid: false,
|
||||
printer: printer
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -257,6 +257,17 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MediaColSetting</name>
|
||||
<message>
|
||||
<source>true</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>false</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NagScreen</name>
|
||||
<message>
|
||||
|
@ -326,6 +337,10 @@
|
|||
<source>Media source</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsPage</name>
|
||||
|
|
|
@ -257,6 +257,17 @@
|
|||
<translation>Cancelando trabajo fallido</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MediaColSetting</name>
|
||||
<message>
|
||||
<source>true</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>false</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NagScreen</name>
|
||||
<message>
|
||||
|
@ -326,6 +337,10 @@
|
|||
<source>Media source</source>
|
||||
<translation>Fuente de medios</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsPage</name>
|
||||
|
|
|
@ -257,6 +257,17 @@
|
|||
<translation>Échec de l'annulation de la tâche d'impression</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MediaColSetting</name>
|
||||
<message>
|
||||
<source>true</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>false</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NagScreen</name>
|
||||
<message>
|
||||
|
@ -326,6 +337,10 @@
|
|||
<source>Media source</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsPage</name>
|
||||
|
|
|
@ -257,6 +257,17 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>MediaColSetting</name>
|
||||
<message>
|
||||
<source>true</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>false</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NagScreen</name>
|
||||
<message>
|
||||
|
@ -326,6 +337,10 @@
|
|||
<source>Media source</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Zero margins</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsPage</name>
|
||||
|
|
Loading…
Reference in a new issue