Rename limit(ed) choices

This commit is contained in:
Anton Thomasson 2021-07-31 12:18:41 +02:00
parent 83ec5d8040
commit dd5cf63368
3 changed files with 10 additions and 10 deletions

View file

@ -7,17 +7,17 @@ Setting {
property var preferred_choices: [] property var preferred_choices: []
property string preferred_choice_suffix: "" property string preferred_choice_suffix: ""
property var limited_choices: Utils.limitChoices(name, choices, parent.selectedFileType) property var actual_choices: Utils.fixupChoices(name, choices, parent.selectedFileType)
property int num_large_choices: 8 property int num_large_choices: 8
displayValue: Utils.ippName(name, choice != undefined ? choice : default_choice) displayValue: Utils.ippName(name, choice != undefined ? choice : default_choice)
onClicked: { onClicked: {
if(limited_choices.length>num_large_choices) if(actual_choices.length>num_large_choices)
{ {
var dialog = pageStack.push("LargeChoiceDialog.qml", var dialog = pageStack.push("LargeChoiceDialog.qml",
{name:name, choice: choice != undefined ? choice : default_choice, choices: limited_choices, {name:name, choice: choice != undefined ? choice : default_choice, choices: actual_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
@ -31,20 +31,20 @@ Setting {
menu: ContextMenu { menu: ContextMenu {
Repeater { Repeater {
model: limited_choices.length>num_large_choices ? 0 : limited_choices model: actual_choices.length>num_large_choices ? 0 : actual_choices
MenuItem { MenuItem {
text: Utils.ippName(name, limited_choices[index]) text: Utils.ippName(name, actual_choices[index])
+ (Utils.has(preferred_choices, limited_choices[index]) ? " "+preferred_choice_suffix : "") + (Utils.has(preferred_choices, actual_choices[index]) ? " "+preferred_choice_suffix : "")
onClicked: onClicked:
{ {
choice = limited_choices[index]; choice = actual_choices[index];
} }
} }
} }
} }
hasMenu: !limited_choices.length>num_large_choices hasMenu: !actual_choices.length>num_large_choices
} }

View file

@ -9,7 +9,7 @@ Item {
{ {
for(var i in values) for(var i in values)
{ {
if(target.limited_choices.indexOf(values[i]) != -1) if(target.actual_choices.indexOf(values[i]) != -1)
{ {
overlap.push(values[i]) overlap.push(values[i])
} }

View file

@ -403,7 +403,7 @@ function unitsIsDpi(resolution)
} }
function limitChoices(name, choices, mimeType) function fixupChoices(name, choices, mimeType)
{ {
switch(name) { switch(name) {
case "document-format": case "document-format":