Code style

This commit is contained in:
Ghostkeeper 2019-01-23 11:11:40 +01:00
parent 7492122a54
commit 9a0a084339
No known key found for this signature in database
GPG Key ID: 86BEF881AE2CF276
2 changed files with 34 additions and 18 deletions

View File

@ -1,5 +1,5 @@
// Copyright (c) 2015 Ultimaker B.V. // Copyright (c) 2019 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
@ -24,11 +24,13 @@ SettingItem
{ {
color: color:
{ {
if (!enabled) { if (!enabled)
{
return UM.Theme.getColor("setting_control_disabled") return UM.Theme.getColor("setting_control_disabled")
} }
if (control.hovered || control.activeFocus) { if (control.hovered || control.activeFocus)
{
return UM.Theme.getColor("setting_control_highlight") return UM.Theme.getColor("setting_control_highlight")
} }
@ -39,11 +41,13 @@ SettingItem
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: border.color:
{ {
if (!enabled) { if (!enabled)
{
return UM.Theme.getColor("setting_control_disabled_border") return UM.Theme.getColor("setting_control_disabled_border")
} }
if (control.hovered || control.activeFocus) { if (control.hovered || control.activeFocus)
{
return UM.Theme.getColor("setting_control_border_highlight") return UM.Theme.getColor("setting_control_border_highlight")
} }
@ -82,13 +86,15 @@ SettingItem
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
popup: Popup { popup: Popup
{
y: control.height - UM.Theme.getSize("default_lining").height y: control.height - UM.Theme.getSize("default_lining").height
width: control.width width: control.width
implicitHeight: contentItem.implicitHeight + 2 * UM.Theme.getSize("default_lining").width implicitHeight: contentItem.implicitHeight + 2 * UM.Theme.getSize("default_lining").width
padding: UM.Theme.getSize("default_lining").width padding: UM.Theme.getSize("default_lining").width
contentItem: ListView { contentItem: ListView
{
clip: true clip: true
implicitHeight: contentHeight implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null model: control.popup.visible ? control.delegateModel : null
@ -97,7 +103,8 @@ SettingItem
ScrollIndicator.vertical: ScrollIndicator { } ScrollIndicator.vertical: ScrollIndicator { }
} }
background: Rectangle { background: Rectangle
{
color: UM.Theme.getColor("setting_control") color: UM.Theme.getColor("setting_control")
border.color: UM.Theme.getColor("setting_control_border") border.color: UM.Theme.getColor("setting_control_border")
} }
@ -164,19 +171,23 @@ SettingItem
{ {
// FIXME this needs to go away once 'resolve' is combined with 'value' in our data model. // FIXME this needs to go away once 'resolve' is combined with 'value' in our data model.
var value = undefined; var value = undefined;
if ((base.resolve != "None") && (base.stackLevel != 0) && (base.stackLevel != 1)) { if ((base.resolve != "None") && (base.stackLevel != 0) && (base.stackLevel != 1))
{
// We have a resolve function. Indicates that the setting is not settable per extruder and that // We have a resolve function. Indicates that the setting is not settable per extruder and that
// we have to choose between the resolved value (default) and the global value // we have to choose between the resolved value (default) and the global value
// (if user has explicitly set this). // (if user has explicitly set this).
value = base.resolve; value = base.resolve;
} }
if (value == undefined) { if (value == undefined)
{
value = propertyProvider.properties.value; value = propertyProvider.properties.value;
} }
for(var i = 0; i < control.model.length; ++i) { for(var i = 0; i < control.model.length; ++i)
if(control.model[i].key == value) { {
if(control.model[i].key == value)
{
return i; return i;
} }
} }

View File

@ -176,13 +176,15 @@ SettingItem
} }
} }
popup: Popup { popup: Popup
{
y: control.height - UM.Theme.getSize("default_lining").height y: control.height - UM.Theme.getSize("default_lining").height
width: control.width width: control.width
implicitHeight: contentItem.implicitHeight + 2 * UM.Theme.getSize("default_lining").width implicitHeight: contentItem.implicitHeight + 2 * UM.Theme.getSize("default_lining").width
padding: UM.Theme.getSize("default_lining").width padding: UM.Theme.getSize("default_lining").width
contentItem: ListView { contentItem: ListView
{
clip: true clip: true
implicitHeight: contentHeight implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null model: control.popup.visible ? control.delegateModel : null
@ -191,7 +193,8 @@ SettingItem
ScrollIndicator.vertical: ScrollIndicator { } ScrollIndicator.vertical: ScrollIndicator { }
} }
background: Rectangle { background: Rectangle
{
color: UM.Theme.getColor("setting_control") color: UM.Theme.getColor("setting_control")
border.color: UM.Theme.getColor("setting_control_border") border.color: UM.Theme.getColor("setting_control_border")
} }
@ -213,9 +216,11 @@ SettingItem
renderType: Text.NativeRendering renderType: Text.NativeRendering
color: color:
{ {
if (model.enabled) { if (model.enabled)
{
UM.Theme.getColor("setting_control_text") UM.Theme.getColor("setting_control_text")
} else { } else
{
UM.Theme.getColor("action_button_disabled_text"); UM.Theme.getColor("action_button_disabled_text");
} }
} }