Add number-up and print-scaling format-dependent settings

This commit is contained in:
Anton Thomasson 2021-07-09 22:13:49 +02:00
parent 68b7afff5e
commit c0fdb31483
13 changed files with 281 additions and 2 deletions

View file

@ -50,6 +50,7 @@ SOURCES += src/harbour-seaprint.cpp \
src/svgprovider.cpp src/svgprovider.cpp
DISTFILES += qml/harbour-seaprint.qml \ DISTFILES += qml/harbour-seaprint.qml \
qml/components/DependentOn.qml \
qml/cover/CoverPage.qml \ qml/cover/CoverPage.qml \
qml/components/*qml \ qml/components/*qml \
qml/pages/*.qml \ qml/pages/*.qml \

View file

@ -19,7 +19,7 @@ Setting {
if(limited_choices.length>num_large_choices) if(limited_choices.length>num_large_choices)
{ {
var dialog = pageStack.push("LargeChoiceDialog.qml", var dialog = pageStack.push("LargeChoiceDialog.qml",
{name:name, choice: choice ? choice : default_choice, choices: limited_choices, {name:name, choice: choice != undefined ? choice : default_choice, choices: limited_choices,
preferred_choices: preferred_choices, preferred_choice_suffix: preferred_choice_suffix}) preferred_choices: preferred_choices, preferred_choice_suffix: preferred_choice_suffix})
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
choice = dialog.choice choice = dialog.choice

View file

@ -0,0 +1,40 @@
import QtQuick 2.6
Item {
property alias target: targetConnection.target
property var values
property var overlap: []
Component.onCompleted:
{
for(var i in values)
{
if(target.limited_choices.indexOf(values[i]) != -1)
{
overlap.push(values[i])
}
}
parent.valid = parent.valid && overlap != []
}
Connections {
id: targetConnection
onChoiceChanged:
{
if(overlap.indexOf(target.choice) == -1)
{
parent.reset()
}
}
}
Connections {
target: parent
onChoiceChanged:
{
if(parent.choice != undefined)
{
targetConnection.target.choice = overlap[0]
}
}
}
}

View file

@ -46,12 +46,17 @@ Item {
property var menu property var menu
property bool hasMenu: true property bool hasMenu: true
function reset()
{
choice = undefined
}
ContextMenu { ContextMenu {
id: resetMenu id: resetMenu
MenuItem { MenuItem {
text: qsTr("Reset") text: qsTr("Reset")
onClicked: choice = undefined onClicked: reset()
} }
} }

View file

@ -121,6 +121,16 @@ Page {
property var pdfpages: ConvertChecker.pdfPages(selectedFile) property var pdfpages: ConvertChecker.pdfPages(selectedFile)
high: pdfpages == 0 ? 65535 : pdfpages high: pdfpages == 0 ? 65535 : pdfpages
} }
ChoiceSetting {
tag: IppMsg.Integer
name: "number-up"
prettyName: qsTr("Pages per page")
valid: !Mimer.isImage(selectedFileType)
DependentOn {
target: transferFormatSetting
values: [Mimer.PDF, Mimer.Postscript]
}
}
ChoiceSetting { ChoiceSetting {
tag: IppMsg.Keyword tag: IppMsg.Keyword
name: "print-color-mode" name: "print-color-mode"
@ -137,6 +147,17 @@ Page {
prettyName: qsTr("Resolution") prettyName: qsTr("Resolution")
} }
ChoiceSetting { ChoiceSetting {
tag: IppMsg.Keyword
name: "print-scaling"
prettyName: qsTr("Scaling")
valid: _valid && selectedFileType == Mimer.JPEG
DependentOn {
target: transferFormatSetting
values: [Mimer.JPEG]
}
}
ChoiceSetting {
id: transferFormatSetting
tag: IppMsg.MimeMediaType tag: IppMsg.MimeMediaType
name: "document-format" name: "document-format"
prettyName: qsTr("Transfer format") prettyName: qsTr("Transfer format")

View file

@ -211,6 +211,22 @@ function ippName(name, value)
default: default:
return value return value
} }
case "print-scaling":
switch(value) {
case "auto":
return qsTr("auto");
case "auto-fit":
return qsTr("auto (fit)");
case "fill":
return qsTr("fill");
case "fit":
return qsTr("fit");
case "none":
return qsTr("none");
default:
return value;
}
case "document-format": case "document-format":
switch(value) { switch(value) {
case Mimer.OctetStream: case Mimer.OctetStream:

View file

@ -503,6 +503,14 @@
<source>Margins</source> <source>Margins</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pages per page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scaling</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>
@ -873,5 +881,25 @@
<source>my mailbox</source> <source>my mailbox</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>auto</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>auto (fit)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fill</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>none</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View file

@ -503,6 +503,14 @@
<source>Margins</source> <source>Margins</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pages per page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scaling</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>
@ -873,5 +881,25 @@
<source>my mailbox</source> <source>my mailbox</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>auto</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>auto (fit)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fill</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>none</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View file

@ -503,6 +503,14 @@
<source>Margins</source> <source>Margins</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pages per page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scaling</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>
@ -873,5 +881,25 @@
<source>my mailbox</source> <source>my mailbox</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>auto</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>auto (fit)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fill</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>none</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View file

@ -503,6 +503,14 @@
<source>Margins</source> <source>Margins</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pages per page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scaling</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>
@ -873,5 +881,25 @@
<source>my mailbox</source> <source>my mailbox</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>auto</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>auto (fit)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fill</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>none</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View file

@ -503,6 +503,14 @@
<source>Margins</source> <source>Margins</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pages per page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scaling</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>
@ -873,5 +881,25 @@
<source>my mailbox</source> <source>my mailbox</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>auto</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>auto (fit)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fill</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>none</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View file

@ -503,6 +503,14 @@
<source>Margins</source> <source>Margins</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pages per page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scaling</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>
@ -873,5 +881,25 @@
<source>my mailbox</source> <source>my mailbox</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>auto</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>auto (fit)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fill</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>none</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>

View file

@ -503,6 +503,14 @@
<source>Margins</source> <source>Margins</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Pages per page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scaling</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>
@ -873,5 +881,25 @@
<source>my mailbox</source> <source>my mailbox</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>auto</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>auto (fit)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fill</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>fit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>none</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
</TS> </TS>