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 { property var menu: ContextMenu {
id: menu id: menu
enabled: valid
Repeater { Repeater {
model: choices model: choices
MenuItem { MenuItem {

View file

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

View file

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

View file

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