mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 13:34:01 -06:00
Fix codestyle issues
Boyscouting
This commit is contained in:
parent
352bfb15ce
commit
4fab546425
1 changed files with 109 additions and 90 deletions
|
@ -15,23 +15,31 @@ Button
|
|||
anchors.leftMargin: UM.Theme.getSize("thick_margin").width
|
||||
anchors.rightMargin: UM.Theme.getSize("thick_margin").width
|
||||
hoverEnabled: true
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
id: backgroundRectangle
|
||||
implicitHeight: UM.Theme.getSize("section").height
|
||||
color: {
|
||||
if (base.color) {
|
||||
return base.color;
|
||||
} else if (!base.enabled) {
|
||||
return UM.Theme.getColor("setting_category_disabled");
|
||||
} else if (base.hovered && base.checkable && base.checked) {
|
||||
return UM.Theme.getColor("setting_category_active_hover");
|
||||
} else if (base.pressed || (base.checkable && base.checked)) {
|
||||
return UM.Theme.getColor("setting_category_active");
|
||||
} else if (base.hovered) {
|
||||
return UM.Theme.getColor("setting_category_hover");
|
||||
} else {
|
||||
return UM.Theme.getColor("setting_category");
|
||||
color:
|
||||
{
|
||||
if (base.color)
|
||||
{
|
||||
return base.color
|
||||
} else if (!base.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_disabled")
|
||||
} else if (base.hovered && base.checkable && base.checked)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_hover")
|
||||
} else if (base.pressed || (base.checkable && base.checked))
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active")
|
||||
} else if (base.hovered)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_hover")
|
||||
} else
|
||||
{
|
||||
return UM.Theme.getColor("setting_category")
|
||||
}
|
||||
}
|
||||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
|
@ -41,17 +49,23 @@ Button
|
|||
height: UM.Theme.getSize("default_lining").height
|
||||
width: parent.width
|
||||
anchors.bottom: parent.bottom
|
||||
color: {
|
||||
if (!base.enabled) {
|
||||
return UM.Theme.getColor("setting_category_disabled_border");
|
||||
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
|
||||
return UM.Theme.getColor("setting_category_active_hover_border");
|
||||
} else if (base.pressed || (base.checkable && base.checked)) {
|
||||
return UM.Theme.getColor("setting_category_active_border");
|
||||
} else if (base.hovered || base.activeFocus) {
|
||||
return UM.Theme.getColor("setting_category_hover_border");
|
||||
} else {
|
||||
return UM.Theme.getColor("setting_category_border");
|
||||
color:
|
||||
{
|
||||
if (!base.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_disabled_border")
|
||||
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_hover_border")
|
||||
} else if (base.pressed || (base.checkable && base.checked))
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_border")
|
||||
} else if (base.hovered || base.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_hover_border")
|
||||
} else
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_border")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,18 +80,19 @@ Button
|
|||
|
||||
property var focusItem: base
|
||||
|
||||
contentItem: Item {
|
||||
contentItem: Item
|
||||
{
|
||||
anchors.fill: parent
|
||||
anchors.left: parent.left
|
||||
|
||||
Label {
|
||||
Label
|
||||
{
|
||||
id: settingNameLabel
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
leftMargin: 2 * UM.Theme.getSize("default_margin").width + UM.Theme.getSize("section_icon").width
|
||||
right: parent.right;
|
||||
verticalCenter: parent.verticalCenter;
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: definition.label
|
||||
textFormat: Text.PlainText
|
||||
|
@ -85,21 +100,27 @@ Button
|
|||
font: UM.Theme.getFont("setting_category")
|
||||
color:
|
||||
{
|
||||
if (!base.enabled) {
|
||||
return UM.Theme.getColor("setting_category_disabled_text");
|
||||
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
|
||||
return UM.Theme.getColor("setting_category_active_hover_text");
|
||||
} else if (base.pressed || (base.checkable && base.checked)) {
|
||||
return UM.Theme.getColor("setting_category_active_text");
|
||||
} else if (base.hovered || base.activeFocus) {
|
||||
return UM.Theme.getColor("setting_category_hover_text");
|
||||
} else {
|
||||
return UM.Theme.getColor("setting_category_text");
|
||||
if (!base.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_disabled_text")
|
||||
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_hover_text")
|
||||
} else if (base.pressed || (base.checkable && base.checked))
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_text")
|
||||
} else if (base.hovered || base.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_hover_text")
|
||||
} else
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_text")
|
||||
}
|
||||
}
|
||||
fontSizeMode: Text.HorizontalFit
|
||||
minimumPointSize: 8
|
||||
}
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: category_arrow
|
||||
|
@ -112,16 +133,21 @@ Button
|
|||
sourceSize.height: width
|
||||
color:
|
||||
{
|
||||
if (!base.enabled) {
|
||||
return UM.Theme.getColor("setting_category_disabled_text");
|
||||
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
|
||||
return UM.Theme.getColor("setting_category_active_hover_text");
|
||||
} else if (base.pressed || (base.checkable && base.checked)) {
|
||||
return UM.Theme.getColor("setting_category_active_text");
|
||||
} else if (base.hovered || base.activeFocus) {
|
||||
return UM.Theme.getColor("setting_category_hover_text");
|
||||
} else {
|
||||
return UM.Theme.getColor("setting_category_text");
|
||||
if (!base.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_disabled_text")
|
||||
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_hover_text")
|
||||
} else if (base.pressed || (base.checkable && base.checked))
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_text")
|
||||
} else if (base.hovered || base.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_hover_text")
|
||||
} else
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_text")
|
||||
}
|
||||
}
|
||||
source: base.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||
|
@ -136,21 +162,26 @@ Button
|
|||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
color:
|
||||
{
|
||||
if (!base.enabled) {
|
||||
return UM.Theme.getColor("setting_category_disabled_text");
|
||||
} else if((base.hovered || base.activeFocus) && base.checkable && base.checked) {
|
||||
return UM.Theme.getColor("setting_category_active_hover_text");
|
||||
} else if(base.pressed || (base.checkable && base.checked)) {
|
||||
return UM.Theme.getColor("setting_category_active_text");
|
||||
} else if(base.hovered || base.activeFocus) {
|
||||
return UM.Theme.getColor("setting_category_hover_text");
|
||||
} else {
|
||||
return UM.Theme.getColor("setting_category_text");
|
||||
if (!base.enabled)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_disabled_text")
|
||||
} else if((base.hovered || base.activeFocus) && base.checkable && base.checked)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_hover_text")
|
||||
} else if(base.pressed || (base.checkable && base.checked))
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_active_text")
|
||||
} else if(base.hovered || base.activeFocus)
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_hover_text")
|
||||
} else
|
||||
{
|
||||
return UM.Theme.getColor("setting_category_text")
|
||||
}
|
||||
}
|
||||
source: UM.Theme.getIcon(definition.icon)
|
||||
width: UM.Theme.getSize("section_icon").width;
|
||||
height: UM.Theme.getSize("section_icon").height;
|
||||
width: UM.Theme.getSize("section_icon").width
|
||||
height: UM.Theme.getSize("section_icon").height
|
||||
sourceSize.width: width + 15 * screenScaleFactor
|
||||
sourceSize.height: width + 15 * screenScaleFactor
|
||||
}
|
||||
|
@ -160,31 +191,26 @@ Button
|
|||
|
||||
onClicked:
|
||||
{
|
||||
if (definition.expanded) {
|
||||
settingDefinitionsModel.collapse(definition.key);
|
||||
if (definition.expanded)
|
||||
{
|
||||
settingDefinitionsModel.collapse(definition.key)
|
||||
} else {
|
||||
settingDefinitionsModel.expandRecursive(definition.key);
|
||||
settingDefinitionsModel.expandRecursive(definition.key)
|
||||
}
|
||||
//Set focus so that tab navigation continues from this point on.
|
||||
//NB: This must be set AFTER collapsing/expanding the category so that the scroll position is correct.
|
||||
forceActiveFocus();
|
||||
forceActiveFocus()
|
||||
}
|
||||
onActiveFocusChanged:
|
||||
{
|
||||
if(activeFocus)
|
||||
{
|
||||
base.focusReceived();
|
||||
base.focusReceived()
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onTabPressed:
|
||||
{
|
||||
base.setActiveFocusToNextSetting(true)
|
||||
}
|
||||
Keys.onBacktabPressed:
|
||||
{
|
||||
base.setActiveFocusToNextSetting(false)
|
||||
}
|
||||
Keys.onTabPressed: base.setActiveFocusToNextSetting(true)
|
||||
Keys.onBacktabPressed: base.setActiveFocusToNextSetting(false)
|
||||
|
||||
UM.SimpleButton
|
||||
{
|
||||
|
@ -194,9 +220,10 @@ Button
|
|||
height: Math.round(base.height * 0.6)
|
||||
width: Math.round(base.height * 0.6)
|
||||
|
||||
anchors {
|
||||
anchors
|
||||
{
|
||||
right: inheritButton.visible ? inheritButton.left : parent.right
|
||||
// use 1.9 as the factor because there is a 0.1 difference between the settings and inheritance warning icons
|
||||
// Use 1.9 as the factor because there is a 0.1 difference between the settings and inheritance warning icons
|
||||
rightMargin: inheritButton.visible ? Math.round(UM.Theme.getSize("default_margin").width / 2) : category_arrow.width + Math.round(UM.Theme.getSize("default_margin").width * 1.9)
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
@ -205,9 +232,7 @@ Button
|
|||
hoverColor: UM.Theme.getColor("setting_control_button_hover")
|
||||
iconSource: UM.Theme.getIcon("settings")
|
||||
|
||||
onClicked: {
|
||||
Cura.Actions.configureSettingVisibility.trigger(definition)
|
||||
}
|
||||
onClicked: Cura.Actions.configureSettingVisibility.trigger(definition)
|
||||
}
|
||||
|
||||
UM.SimpleButton
|
||||
|
@ -240,24 +265,18 @@ Button
|
|||
|
||||
onClicked:
|
||||
{
|
||||
settingDefinitionsModel.expandRecursive(definition.key);
|
||||
base.checked = true;
|
||||
base.showAllHiddenInheritedSettings(definition.key);
|
||||
settingDefinitionsModel.expandRecursive(definition.key)
|
||||
base.checked = true
|
||||
base.showAllHiddenInheritedSettings(definition.key)
|
||||
}
|
||||
|
||||
color: UM.Theme.getColor("setting_control_button")
|
||||
hoverColor: UM.Theme.getColor("setting_control_button_hover")
|
||||
iconSource: UM.Theme.getIcon("notice")
|
||||
|
||||
onEntered:
|
||||
{
|
||||
base.showTooltip(catalog.i18nc("@label","Some hidden settings use values different from their normal calculated value.\n\nClick to make these settings visible."))
|
||||
}
|
||||
onEntered: base.showTooltip(catalog.i18nc("@label","Some hidden settings use values different from their normal calculated value.\n\nClick to make these settings visible."))
|
||||
|
||||
onExited:
|
||||
{
|
||||
base.hideTooltip();
|
||||
}
|
||||
onExited: base.hideTooltip()
|
||||
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue