Disable unsupported settings

Make the GUI reflect that even the most basic printer settings may be
unavailable
This commit is contained in:
Anton Thomasson 2020-02-17 19:58:46 +01:00
parent 3a5b5cdf59
commit 4526aedcc8
4 changed files with 8 additions and 3 deletions

View file

@ -15,6 +15,7 @@ Setting {
property var menu: ContextMenu {
id: menu
enabled: valid
Repeater {
model: choices
MenuItem {

View file

@ -16,6 +16,7 @@ Setting {
property var menu: ContextMenu {
id: menu
enabled: valid
MenuItem {
Slider
{

View file

@ -20,6 +20,7 @@ Setting {
property var menu: ContextMenu {
id: menu
enabled: valid
MenuItem {
}

View file

@ -82,13 +82,14 @@ Page {
}
Component.onCompleted: {
console.log("handling", tag, name, prettyName, JSON.stringify(printer.attrs[name+"-supported"]), JSON.stringify(printer.attrs[name+"-default"]))
console.log("handling", tag, name, prettyName, JSON.stringify(printer.attrs), JSON.stringify(printer.attrs[name+"-supported"]), JSON.stringify(printer.attrs[name+"-default"]))
switch(tag) {
case 0x21:
loader.setSource("../components/IntegerSetting.qml",
{name: name,
prettyName: prettyName,
tag: tag,
valid: printer.attrs.hasOwnProperty(name+"-supported"),
low: printer.attrs[name+"-supported"].value.low,
high: printer.attrs[name+"-supported"].value.high,
default_choice: printer.attrs[name+"-default"].value
@ -98,8 +99,8 @@ Page {
loader.setSource("../components/RangeSetting.qml",
{name: name,
prettyName: prettyName,
valid: false, //TODO
tag: 0x33 // integer-range
tag: tag,
valid: false //TODO printer.attrs.hasOwnProperty(name+"-supported"),
})
break
case 0x32:
@ -108,6 +109,7 @@ Page {
{name: name,
prettyName: prettyName,
tag: tag,
valid: printer.attrs.hasOwnProperty(name+"-supported"),
choices: printer.attrs[name+"-supported"].value,
default_choice: printer.attrs[name+"-default"].value
})