Browse Source

Stop using SettingItemStyle

Since everything is now in Cura, using SettingItemStyle does not make a
lot of sense anymore
Arjen Hiemstra 8 years ago
parent
commit
2abb9a47c1

+ 8 - 7
resources/qml/Settings/SettingCheckBox.qml

@@ -46,19 +46,20 @@ SettingItem
             {
                 if (!enabled)
                 {
-                    return base.style.controlDisabledColor
+                    return UM.Theme.getColor("setting_control_disabled")
                 }
                 if(base.containsMouse || base.activeFocus)
                 {
-                    return base.style.controlHighlightColor
+                    return UM.Theme.getColor("setting_control_highlight")
                 }
                 else
                 {
-                    return base.style.controlColor
+                    return UM.Theme.getColor("setting_control")
                 }
             }
-            border.width: base.style.controlBorderWidth;
-            border.color: !enabled ? base.style.controlDisabledBorderColor : control.containsMouse ? base.style.controlBorderHighlightColor : base.style.controlBorderColor;
+
+            border.width: UM.Theme.getSize("default_lining").width
+            border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.containsMouse ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
 
             UM.RecolorImage {
                 anchors.verticalCenter: parent.verticalCenter
@@ -67,9 +68,9 @@ SettingItem
                 height: parent.height/2.5
                 sourceSize.width: width
                 sourceSize.height: width
-                color: !enabled ? base.style.controlDisabledTextColor : base.style.controlTextColor;
+                color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");
                 source: UM.Theme.getIcon("check")
-                opacity: control.checked
+                opacity: control.checked ? 1 : 0
                 Behavior on opacity { NumberAnimation { duration: 100; } }
             }
         }

+ 11 - 11
resources/qml/Settings/SettingComboBox.qml

@@ -33,33 +33,33 @@ SettingItem
                 {
                     if (!enabled)
                     {
-                        return base.style.controlDisabledColor
+                        return UM.Theme.getColor("setting_control_disabled")
                     }
                     if(control.hovered || base.activeFocus)
                     {
-                        return base.style.controlHighlightColor
+                        return UM.Theme.getColor("setting_control_highlight")
                     }
                     else
                     {
-                        return base.style.controlColor
+                        return UM.Theme.getColor("setting_control")
                     }
                 }
-                border.width: base.style.controlBorderWidth;
-                border.color: !enabled ? base.style.controlDisabledBorderColor : control.hovered ? base.style.controlBorderHighlightColor : base.style.controlBorderColor;
+                border.width: UM.Theme.getSize("default_lining").width;
+                border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border");
             }
             label: Item
             {
                 Label
                 {
                     anchors.left: parent.left;
-                    anchors.leftMargin: base.style.controlBorderWidth
+                    anchors.leftMargin: UM.Theme.getSize("default_lining").width
                     anchors.right: downArrow.left;
-                    anchors.rightMargin: base.style.controlBorderWidth;
+                    anchors.rightMargin: UM.Theme.getSize("default_lining").width;
                     anchors.verticalCenter: parent.verticalCenter;
 
                     text: control.currentText;
-                    font: base.style.controlFont;
-                    color: !enabled ? base.style.controlDisabledTextColor : base.style.controlTextColor;
+                    font: UM.Theme.getFont("default");
+                    color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");
 
                     elide: Text.ElideRight;
                     verticalAlignment: Text.AlignVCenter;
@@ -69,7 +69,7 @@ SettingItem
                 {
                     id: downArrow
                     anchors.right: parent.right;
-                    anchors.rightMargin: base.style.controlBorderWidth * 2;
+                    anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2;
                     anchors.verticalCenter: parent.verticalCenter;
 
                     source: UM.Theme.getIcon("arrow_bottom")
@@ -78,7 +78,7 @@ SettingItem
                     sourceSize.width: width + 5
                     sourceSize.height: width + 5
 
-                    color: base.style.controlTextColor;
+                    color: UM.Theme.getColor("setting_control_text");
 
                 }
             }

+ 34 - 34
resources/qml/Settings/SettingTextField.qml

@@ -18,44 +18,44 @@ SettingItem
 
         property alias hovered: mouseArea.containsMouse;
 
-        border.width: base.style.controlBorderWidth;
-        border.color: !enabled ? base.style.controlDisabledBorderColor : hovered ? base.style.controlBorderHighlightColor : base.style.controlBorderColor
+        border.width: UM.Theme.getSize("default_lining").width
+        border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
 
         property variant parentValue: value //From parent loader
         function notifyReset() {
             input.text = format(parentValue)
         }
 
-//         color: {
-//             if (!enabled)
-//             {
-//                 return base.style.controlDisabledColor
-//             }
-//             switch(definition.validationState) //From parent loader
-//             {
-//                 case 0:
-//                     return base.style.validationErrorColor;
-//                 case 1:
-//                     return base.style.validationErrorColor;
-//                 case 2:
-//                     return base.style.validationErrorColor;
-//                 case 3:
-//                     return base.style.validationWarningColor;
-//                 case 4:
-//                     return base.style.validationWarningColor;
-//                 case 5:
-//                     return base.style.validationOkColor;
-//
-//                 default:
-//                     return base.style.controlTextColor;
-//             }
-//         }
+        color: {
+            if (!enabled)
+            {
+                return UM.Theme.getColor("setting_control_disabled")
+            }
+            switch(definition.validationState)
+            {
+                case 0:
+                    return UM.Theme.getColor("setting_validation_error")
+                case 1:
+                    return UM.Theme.getColor("setting_validation_error")
+                case 2:
+                    return UM.Theme.getColor("setting_validation_error")
+                case 3:
+                    return UM.Theme.getColor("setting_validation_warning")
+                case 4:
+                    return UM.Theme.getColor("setting_validation_warning")
+                case 5:
+                    return UM.Theme.getColor("setting_validation_ok")
+
+                default:
+                    return UM.Theme.getColor("setting_control")
+            }
+        }
 
         Rectangle
         {
             anchors.fill: parent;
-            anchors.margins: base.style.controlBorderWidth;
-            color: base.style.controlHighlightColor;
+            anchors.margins: UM.Theme.getSize("default_lining").width;
+            color: UM.Theme.getColor("setting_control_highlight")
             opacity: 0.35
 //             opacity: !control.hovered ? 0 : valid == 5 ? 1.0 : 0.35;
         }
@@ -63,12 +63,12 @@ SettingItem
         Label
         {
             anchors.right: parent.right;
-            anchors.rightMargin: base.style.unitRightMargin;
+            anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
             anchors.verticalCenter: parent.verticalCenter;
 
             text: definition.unit;
-            color: base.style.unitColor
-            font: base.style.unitFont;
+            color: UM.Theme.getColor("setting_unit")
+            font: UM.Theme.getFont("default")
         }
 
         MouseArea
@@ -86,7 +86,7 @@ SettingItem
             anchors
             {
                 left: parent.left
-                leftMargin: base.style.unitRightMargin
+                leftMargin: UM.Theme.unitRightMargin
                 right: parent.right
                 verticalCenter: parent.verticalCenter
             }
@@ -108,8 +108,8 @@ SettingItem
                 }
             }
 
-            color: !enabled ? base.style.controlDisabledTextColor : base.style.controlTextColor;
-            font: base.style.controlFont;
+            color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
+            font: UM.Theme.getFont("default");
 
             selectByMouse: true;