2019-12-01 22:27:00 +03:00
|
|
|
import QtQuick 2.0
|
|
|
|
import Sailfish.Silica 1.0
|
|
|
|
|
|
|
|
Setting {
|
2021-03-21 16:01:19 +03:00
|
|
|
property int low: valid ? parent.printer.attrs[name+"-supported"].value.low : 0
|
|
|
|
property int high: valid ? parent.printer.attrs[name+"-supported"].value.high : 0
|
2019-12-01 22:27:00 +03:00
|
|
|
|
2021-03-20 21:45:30 +03:00
|
|
|
property bool suppressChange: false
|
|
|
|
|
2020-11-23 22:57:02 +03:00
|
|
|
displayValue: choice ? choice : default_choice
|
2019-12-01 22:27:00 +03:00
|
|
|
|
2021-03-20 21:45:30 +03:00
|
|
|
onChoiceChanged: {
|
|
|
|
if(choice == undefined)
|
|
|
|
{
|
|
|
|
console.log("choice unset");
|
|
|
|
suppressChange = true;
|
|
|
|
slider.value = slider.minimumValue;
|
|
|
|
suppressChange = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-23 22:29:59 +03:00
|
|
|
menu: ContextMenu {
|
2019-12-01 22:27:00 +03:00
|
|
|
MenuItem {
|
|
|
|
Slider
|
|
|
|
{
|
2021-03-20 21:45:30 +03:00
|
|
|
id: slider
|
2019-12-01 22:27:00 +03:00
|
|
|
minimumValue: low
|
|
|
|
maximumValue: high < 100 ? high : 100
|
|
|
|
width: parent.width
|
|
|
|
stepSize: 1
|
|
|
|
onValueChanged:
|
|
|
|
{
|
2021-03-20 21:45:30 +03:00
|
|
|
if(!suppressChange)
|
|
|
|
{
|
|
|
|
choice = value;
|
|
|
|
}
|
2019-12-01 22:27:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
IconButton
|
|
|
|
{
|
|
|
|
anchors.right: parent.right
|
|
|
|
icon.source: "image://theme/icon-s-edit"
|
|
|
|
onClicked: {var dialog = pageStack.push(Qt.resolvedUrl("IntegerInputDialog.qml"),
|
|
|
|
{value: choice, title: prettyName,
|
|
|
|
min: low, max: high});
|
|
|
|
dialog.accepted.connect(function() {
|
|
|
|
choice = dialog.value;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|