From 960a20652afdc2ee136a9fc93a5df346cce7273f Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 6 Jun 2019 12:30:05 +0200 Subject: [PATCH] Add warning state for prime blob and CheckBox CURA-6414 --- resources/definitions/fdmprinter.def.json | 3 +- resources/qml/Settings/SettingCheckBox.qml | 52 ++++++++++++++++------ 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 0c05fd45b8..f9ff188bb8 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -4626,7 +4626,8 @@ "default_value": false, "settable_per_mesh": false, "settable_per_extruder": true, - "enabled": false + "enabled": false, + "warning_value": "True if resolveOrValue('print_sequence') == 'one_at_a_time' else None" }, "extruder_prime_pos_x": { diff --git a/resources/qml/Settings/SettingCheckBox.qml b/resources/qml/Settings/SettingCheckBox.qml index 8c0c58f371..694c4125ea 100644 --- a/resources/qml/Settings/SettingCheckBox.qml +++ b/resources/qml/Settings/SettingCheckBox.qml @@ -91,27 +91,27 @@ SettingItem } width: height - color: - { - if (!enabled) - { - return UM.Theme.getColor("setting_control_disabled") - } - if (control.containsMouse || control.activeFocus) - { - return UM.Theme.getColor("setting_control_highlight") - } - return UM.Theme.getColor("setting_control") - } - radius: UM.Theme.getSize("setting_control_radius").width border.width: UM.Theme.getSize("default_lining").width + border.color: { - if (!enabled) + if(!enabled) { return UM.Theme.getColor("setting_control_disabled_border") } + switch (propertyProvider.properties.validationState) + { + case "ValidatorState.Invalid": + case "ValidatorState.Exception": + case "ValidatorState.MinimumError": + case "ValidatorState.MaximumError": + return UM.Theme.getColor("setting_validation_error"); + case "ValidatorState.MinimumWarning": + case "ValidatorState.MaximumWarning": + return UM.Theme.getColor("setting_validation_warning"); + } + // Validation is OK. if (control.containsMouse || control.activeFocus) { return UM.Theme.getColor("setting_control_border_highlight") @@ -119,6 +119,30 @@ SettingItem return UM.Theme.getColor("setting_control_border") } + color: { + if (!enabled) + { + return UM.Theme.getColor("setting_control_disabled") + } + switch (propertyProvider.properties.validationState) + { + case "ValidatorState.Invalid": + case "ValidatorState.Exception": + case "ValidatorState.MinimumError": + case "ValidatorState.MaximumError": + return UM.Theme.getColor("setting_validation_error_background") + case "ValidatorState.MinimumWarning": + case "ValidatorState.MaximumWarning": + return UM.Theme.getColor("setting_validation_warning_background") + } + // Validation is OK. + if (control.containsMouse || control.activeFocus) + { + return UM.Theme.getColor("setting_control_highlight") + } + return UM.Theme.getColor("setting_control") + } + UM.RecolorImage { anchors.verticalCenter: parent.verticalCenter