2019-12-01 22:27:00 +03:00
|
|
|
import QtQuick 2.0
|
|
|
|
import Sailfish.Silica 1.0
|
2020-06-07 13:18:10 +03:00
|
|
|
import seaprint.convertchecker 1.0
|
2021-03-04 23:49:27 +03:00
|
|
|
import seaprint.mimer 1.0
|
2020-01-03 15:37:51 +03:00
|
|
|
import "../pages/utils.js" as Utils
|
2019-12-01 22:27:00 +03:00
|
|
|
|
|
|
|
Setting {
|
2021-03-21 16:01:19 +03:00
|
|
|
property var choices: parent.getChoices(name)
|
2021-06-21 22:31:36 +03:00
|
|
|
property var preferred_choices: []
|
|
|
|
property string preferred_choice_suffix: ""
|
2020-06-04 22:31:46 +03:00
|
|
|
|
2021-07-09 20:17:45 +03:00
|
|
|
property var limited_choices: Utils.limitChoices(name, choices, parent.selectedFileType, ConvertChecker)
|
2019-12-01 22:27:00 +03:00
|
|
|
|
2020-06-07 12:06:14 +03:00
|
|
|
property int num_large_choices: 8
|
|
|
|
|
2020-11-23 22:57:02 +03:00
|
|
|
displayValue: Utils.ippName(name, choice ? choice : default_choice)
|
2019-12-01 22:27:00 +03:00
|
|
|
|
2020-06-07 12:06:14 +03:00
|
|
|
onClicked: {
|
|
|
|
if(limited_choices.length>num_large_choices)
|
|
|
|
{
|
|
|
|
var dialog = pageStack.push("LargeChoiceDialog.qml",
|
2021-06-21 22:31:36 +03:00
|
|
|
{name:name, choice: choice ? choice : default_choice, choices: limited_choices,
|
|
|
|
preferred_choices: preferred_choices, preferred_choice_suffix: preferred_choice_suffix})
|
2020-06-07 12:06:14 +03:00
|
|
|
dialog.accepted.connect(function() {
|
|
|
|
choice = dialog.choice
|
|
|
|
})
|
|
|
|
}
|
2020-11-23 21:00:26 +03:00
|
|
|
else
|
|
|
|
{
|
2020-11-23 22:29:59 +03:00
|
|
|
menu.open(this)
|
2020-11-23 21:00:26 +03:00
|
|
|
}
|
2020-06-07 12:06:14 +03:00
|
|
|
}
|
|
|
|
|
2020-11-23 22:29:59 +03:00
|
|
|
menu: ContextMenu {
|
2019-12-01 22:27:00 +03:00
|
|
|
Repeater {
|
2020-11-23 23:52:53 +03:00
|
|
|
model: limited_choices.length>num_large_choices ? 0 : limited_choices
|
2019-12-01 22:27:00 +03:00
|
|
|
MenuItem {
|
2020-06-04 22:31:46 +03:00
|
|
|
text: Utils.ippName(name, limited_choices[index])
|
2021-06-21 22:31:36 +03:00
|
|
|
+ (Utils.has(preferred_choices, limited_choices[index]) ? " "+preferred_choice_suffix : "")
|
2019-12-01 22:27:00 +03:00
|
|
|
onClicked:
|
|
|
|
{
|
2020-06-04 22:31:46 +03:00
|
|
|
choice = limited_choices[index];
|
2019-12-01 22:27:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-01-02 19:39:06 +03:00
|
|
|
hasMenu: !limited_choices.length>num_large_choices
|
|
|
|
|
2019-12-01 22:27:00 +03:00
|
|
|
|
|
|
|
}
|