Add support for media-ready

This commit is contained in:
Anton Thomasson 2021-06-21 21:31:36 +02:00
parent 6ef84580f3
commit ab81e701fa
10 changed files with 38 additions and 1 deletions

View file

@ -7,6 +7,8 @@ import "../pages/utils.js" as Utils
Setting { Setting {
property var choices: parent.getChoices(name) property var choices: parent.getChoices(name)
property string mime_type 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, mime_type, ConvertChecker)
@ -18,7 +20,8 @@ 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 ? choice : default_choice, choices: limited_choices,
preferred_choices: preferred_choices, preferred_choice_suffix: preferred_choice_suffix})
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
choice = dialog.choice choice = dialog.choice
}) })
@ -34,6 +37,7 @@ Setting {
model: limited_choices.length>num_large_choices ? 0 : limited_choices model: limited_choices.length>num_large_choices ? 0 : limited_choices
MenuItem { MenuItem {
text: Utils.ippName(name, limited_choices[index]) text: Utils.ippName(name, limited_choices[index])
+ (Utils.has(preferred_choices, limited_choices[index]) ? " "+preferred_choice_suffix : "")
onClicked: onClicked:
{ {
choice = limited_choices[index]; choice = limited_choices[index];

View file

@ -11,6 +11,8 @@ Dialog {
property string choice property string choice
property string new_choice: choice property string new_choice: choice
property var choices property var choices
property var preferred_choices
property string preferred_choice_suffix
canAccept: false canAccept: false
SilicaListView SilicaListView
@ -30,6 +32,7 @@ Dialog {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
highlighted: choices[index]==new_choice highlighted: choices[index]==new_choice
text: Utils.ippName(name, choices[index]) text: Utils.ippName(name, choices[index])
+ (Utils.has(preferred_choices, choices[index]) ? " "+preferred_choice_suffix : "")
} }
} }
} }

View file

@ -91,6 +91,8 @@ Page {
name: "media" name: "media"
prettyName: qsTr("Print media") prettyName: qsTr("Print media")
mime_type: selectedFileType mime_type: selectedFileType
preferred_choices: printer.attrs.hasOwnProperty("media-ready") ? printer.attrs["media-ready"].value : []
preferred_choice_suffix: qsTr("(loaded)")
} }
IntegerSetting { IntegerSetting {
tag: IppMsg.Integer tag: IppMsg.Integer

View file

@ -470,6 +470,10 @@
<source>Default settings for %1 on this printer</source> <source>Default settings for %1 on this printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>(loaded)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>

View file

@ -470,6 +470,10 @@
<source>Default settings for %1 on this printer</source> <source>Default settings for %1 on this printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>(loaded)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>

View file

@ -470,6 +470,10 @@
<source>Default settings for %1 on this printer</source> <source>Default settings for %1 on this printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>(loaded)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>

View file

@ -470,6 +470,10 @@
<source>Default settings for %1 on this printer</source> <source>Default settings for %1 on this printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>(loaded)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>

View file

@ -470,6 +470,10 @@
<source>Default settings for %1 on this printer</source> <source>Default settings for %1 on this printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>(loaded)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>

View file

@ -470,6 +470,10 @@
<source>Default settings for %1 on this printer</source> <source>Default settings for %1 on this printer</source>
<translation> %1 </translation> <translation> %1 </translation>
</message> </message>
<message>
<source>(loaded)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>

View file

@ -470,6 +470,10 @@
<source>Default settings for %1 on this printer</source> <source>Default settings for %1 on this printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>(loaded)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>RangeSetting</name> <name>RangeSetting</name>