mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 03:59:04 +08:00
Fix code style
CURA-4758
This commit is contained in:
parent
84adbc5f41
commit
d20895a055
@ -9,24 +9,24 @@ import Cura 1.0 as Cura
|
|||||||
|
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
id: base;
|
id: base
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
|
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
|
||||||
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
|
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
{
|
{
|
||||||
implicitHeight: UM.Theme.getSize("section").height;
|
implicitHeight: UM.Theme.getSize("section").height
|
||||||
color: {
|
color: {
|
||||||
if(base.color) {
|
if (base.color) {
|
||||||
return base.color;
|
return base.color;
|
||||||
} else if(!base.enabled) {
|
} else if (!base.enabled) {
|
||||||
return UM.Theme.getColor("setting_category_disabled");
|
return UM.Theme.getColor("setting_category_disabled");
|
||||||
} else if(base.hovered && base.checkable && base.checked) {
|
} else if (base.hovered && base.checkable && base.checked) {
|
||||||
return UM.Theme.getColor("setting_category_active_hover");
|
return UM.Theme.getColor("setting_category_active_hover");
|
||||||
} else if(base.pressed || (base.checkable && base.checked)) {
|
} else if (base.pressed || (base.checkable && base.checked)) {
|
||||||
return UM.Theme.getColor("setting_category_active");
|
return UM.Theme.getColor("setting_category_active");
|
||||||
} else if(base.hovered) {
|
} else if (base.hovered) {
|
||||||
return UM.Theme.getColor("setting_category_hover");
|
return UM.Theme.getColor("setting_category_hover");
|
||||||
} else {
|
} else {
|
||||||
return UM.Theme.getColor("setting_category");
|
return UM.Theme.getColor("setting_category");
|
||||||
@ -39,13 +39,13 @@ Button
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
color: {
|
color: {
|
||||||
if(!base.enabled) {
|
if (!base.enabled) {
|
||||||
return UM.Theme.getColor("setting_category_disabled_border");
|
return UM.Theme.getColor("setting_category_disabled_border");
|
||||||
} else if((base.hovered || base.activeFocus) && base.checkable && base.checked) {
|
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
|
||||||
return UM.Theme.getColor("setting_category_active_hover_border");
|
return UM.Theme.getColor("setting_category_active_hover_border");
|
||||||
} else if(base.pressed || (base.checkable && base.checked)) {
|
} else if (base.pressed || (base.checkable && base.checked)) {
|
||||||
return UM.Theme.getColor("setting_category_active_border");
|
return UM.Theme.getColor("setting_category_active_border");
|
||||||
} else if(base.hovered || base.activeFocus) {
|
} else if (base.hovered || base.activeFocus) {
|
||||||
return UM.Theme.getColor("setting_category_hover_border");
|
return UM.Theme.getColor("setting_category_hover_border");
|
||||||
} else {
|
} else {
|
||||||
return UM.Theme.getColor("setting_category_border");
|
return UM.Theme.getColor("setting_category_border");
|
||||||
@ -66,7 +66,7 @@ Button
|
|||||||
//text: definition.label
|
//text: definition.label
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
@ -78,31 +78,22 @@ Button
|
|||||||
verticalCenter: parent.verticalCenter;
|
verticalCenter: parent.verticalCenter;
|
||||||
}
|
}
|
||||||
text: definition.label
|
text: definition.label
|
||||||
font: UM.Theme.getFont("setting_category");
|
font: UM.Theme.getFont("setting_category")
|
||||||
color:
|
color:
|
||||||
{
|
{
|
||||||
if(!base.enabled)
|
if (!base.enabled) {
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_disabled_text");
|
return UM.Theme.getColor("setting_category_disabled_text");
|
||||||
}
|
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
|
||||||
else if((base.hovered || base.activeFocus) && base.checkable && base.checked)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_active_hover_text");
|
return UM.Theme.getColor("setting_category_active_hover_text");
|
||||||
}
|
} else if (base.pressed || (base.checkable && base.checked)) {
|
||||||
else if(base.pressed || (base.checkable && base.checked))
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_active_text");
|
return UM.Theme.getColor("setting_category_active_text");
|
||||||
}
|
} else if (base.hovered || base.activeFocus) {
|
||||||
else if(base.hovered || base.activeFocus)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_hover_text");
|
return UM.Theme.getColor("setting_category_hover_text");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_text");
|
return UM.Theme.getColor("setting_category_text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fontSizeMode: Text.HorizontalFit;
|
fontSizeMode: Text.HorizontalFit
|
||||||
minimumPointSize: 8
|
minimumPointSize: 8
|
||||||
}
|
}
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
@ -117,24 +108,15 @@ Button
|
|||||||
sourceSize.height: width
|
sourceSize.height: width
|
||||||
color:
|
color:
|
||||||
{
|
{
|
||||||
if(!base.enabled)
|
if (!base.enabled) {
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_disabled_text");
|
return UM.Theme.getColor("setting_category_disabled_text");
|
||||||
}
|
} else if ((base.hovered || base.activeFocus) && base.checkable && base.checked) {
|
||||||
else if((base.hovered || base.activeFocus) && base.checkable && base.checked)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_active_hover_text");
|
return UM.Theme.getColor("setting_category_active_hover_text");
|
||||||
}
|
} else if (base.pressed || (base.checkable && base.checked)) {
|
||||||
else if(base.pressed || (base.checkable && base.checked))
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_active_text");
|
return UM.Theme.getColor("setting_category_active_text");
|
||||||
}
|
} else if (base.hovered || base.activeFocus) {
|
||||||
else if(base.hovered || base.activeFocus)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_hover_text");
|
return UM.Theme.getColor("setting_category_hover_text");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_text");
|
return UM.Theme.getColor("setting_category_text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,24 +132,15 @@ Button
|
|||||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
color:
|
color:
|
||||||
{
|
{
|
||||||
if(!base.enabled)
|
if (!base.enabled) {
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_disabled_text");
|
return UM.Theme.getColor("setting_category_disabled_text");
|
||||||
}
|
} else if((base.hovered || base.activeFocus) && base.checkable && base.checked) {
|
||||||
else if((base.hovered || base.activeFocus) && base.checkable && base.checked)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_active_hover_text");
|
return UM.Theme.getColor("setting_category_active_hover_text");
|
||||||
}
|
} else if(base.pressed || (base.checkable && base.checked)) {
|
||||||
else if(base.pressed || (base.checkable && base.checked))
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_active_text");
|
return UM.Theme.getColor("setting_category_active_text");
|
||||||
}
|
} else if(base.hovered || base.activeFocus) {
|
||||||
else if(base.hovered || base.activeFocus)
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_hover_text");
|
return UM.Theme.getColor("setting_category_hover_text");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return UM.Theme.getColor("setting_category_text");
|
return UM.Theme.getColor("setting_category_text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,18 +151,14 @@ Button
|
|||||||
sourceSize.height: width + 15 * screenScaleFactor
|
sourceSize.height: width + 15 * screenScaleFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: definition.expanded
|
checked: definition.expanded
|
||||||
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
if(definition.expanded)
|
if (definition.expanded) {
|
||||||
{
|
|
||||||
settingDefinitionsModel.collapse(definition.key);
|
settingDefinitionsModel.collapse(definition.key);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
settingDefinitionsModel.expandAll(definition.key);
|
settingDefinitionsModel.expandAll(definition.key);
|
||||||
}
|
}
|
||||||
//Set focus so that tab navigation continues from this point on.
|
//Set focus so that tab navigation continues from this point on.
|
||||||
@ -223,13 +192,14 @@ Button
|
|||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
right: inheritButton.visible ? inheritButton.left : parent.right
|
right: inheritButton.visible ? inheritButton.left : parent.right
|
||||||
rightMargin: inheritButton.visible ? UM.Theme.getSize("default_margin").width / 2 : category_arrow.width + UM.Theme.getSize("default_margin").width * 1.9 // 1.9 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
|
||||||
verticalCenter: parent.verticalCenter;
|
rightMargin: inheritButton.visible ? UM.Theme.getSize("default_margin").width / 2 : category_arrow.width + UM.Theme.getSize("default_margin").width * 1.9
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
color: UM.Theme.getColor("setting_control_button");
|
color: UM.Theme.getColor("setting_control_button")
|
||||||
hoverColor: UM.Theme.getColor("setting_control_button_hover")
|
hoverColor: UM.Theme.getColor("setting_control_button_hover")
|
||||||
iconSource: UM.Theme.getIcon("settings");
|
iconSource: UM.Theme.getIcon("settings")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Cura.Actions.configureSettingVisibility.trigger(definition)
|
Cura.Actions.configureSettingVisibility.trigger(definition)
|
||||||
@ -238,7 +208,7 @@ Button
|
|||||||
|
|
||||||
UM.SimpleButton
|
UM.SimpleButton
|
||||||
{
|
{
|
||||||
id: inheritButton;
|
id: inheritButton
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
@ -246,12 +216,12 @@ Button
|
|||||||
|
|
||||||
visible:
|
visible:
|
||||||
{
|
{
|
||||||
if(Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0)
|
if (Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0)
|
||||||
{
|
{
|
||||||
var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(definition.key)
|
var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(definition.key)
|
||||||
for(var i = 0; i < children_with_override.length; i++)
|
for (var i = 0; i < children_with_override.length; i++)
|
||||||
{
|
{
|
||||||
if(!settingDefinitionsModel.getVisible(children_with_override[i]))
|
if (!settingDefinitionsModel.getVisible(children_with_override[i]))
|
||||||
{
|
{
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -83,11 +83,11 @@ SettingItem
|
|||||||
{
|
{
|
||||||
color:
|
color:
|
||||||
{
|
{
|
||||||
if(!enabled)
|
if (!enabled)
|
||||||
{
|
{
|
||||||
return UM.Theme.getColor("setting_control_disabled");
|
return UM.Theme.getColor("setting_control_disabled");
|
||||||
}
|
}
|
||||||
if(control.hovered || base.activeFocus)
|
if (control.hovered || base.activeFocus)
|
||||||
{
|
{
|
||||||
return UM.Theme.getColor("setting_control_highlight");
|
return UM.Theme.getColor("setting_control_highlight");
|
||||||
}
|
}
|
||||||
@ -96,11 +96,11 @@ 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")
|
||||||
}
|
}
|
||||||
|
@ -102,11 +102,11 @@ 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");
|
||||||
}
|
}
|
||||||
@ -115,11 +115,11 @@ 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")
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ import "Menus"
|
|||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: base;
|
id: base
|
||||||
|
|
||||||
property int currentModeIndex;
|
property int currentModeIndex
|
||||||
property bool hideSettings: PrintInformation.preSliced
|
property bool hideSettings: PrintInformation.preSliced
|
||||||
property bool hideView: Cura.MachineManager.activeMachineName == ""
|
property bool hideView: Cura.MachineManager.activeMachineName == ""
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ Rectangle
|
|||||||
MouseArea
|
MouseArea
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.AllButtons;
|
acceptedButtons: Qt.AllButtons
|
||||||
|
|
||||||
onWheel:
|
onWheel:
|
||||||
{
|
{
|
||||||
@ -125,7 +125,7 @@ Rectangle
|
|||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
id: settingsModeLabel
|
id: settingsModeLabel
|
||||||
text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox","Print Setup disabled\nG-code files cannot be modified");
|
text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox", "Print Setup disabled\nG-code files cannot be modified")
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
|
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
|
||||||
anchors.top: headerSeparator.bottom
|
anchors.top: headerSeparator.bottom
|
||||||
@ -557,19 +557,19 @@ Rectangle
|
|||||||
|
|
||||||
SidebarTooltip
|
SidebarTooltip
|
||||||
{
|
{
|
||||||
id: tooltip;
|
id: tooltip
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setting mode: Recommended or Custom
|
// Setting mode: Recommended or Custom
|
||||||
ListModel
|
ListModel
|
||||||
{
|
{
|
||||||
id: modesListModel;
|
id: modesListModel
|
||||||
}
|
}
|
||||||
|
|
||||||
SidebarSimple
|
SidebarSimple
|
||||||
{
|
{
|
||||||
id: sidebarSimple;
|
id: sidebarSimple
|
||||||
visible: false;
|
visible: false
|
||||||
|
|
||||||
onShowTooltip: base.showTooltip(item, location, text)
|
onShowTooltip: base.showTooltip(item, location, text)
|
||||||
onHideTooltip: base.hideTooltip()
|
onHideTooltip: base.hideTooltip()
|
||||||
@ -577,8 +577,8 @@ Rectangle
|
|||||||
|
|
||||||
SidebarAdvanced
|
SidebarAdvanced
|
||||||
{
|
{
|
||||||
id: sidebarAdvanced;
|
id: sidebarAdvanced
|
||||||
visible: false;
|
visible: false
|
||||||
|
|
||||||
onShowTooltip: base.showTooltip(item, location, text)
|
onShowTooltip: base.showTooltip(item, location, text)
|
||||||
onHideTooltip: base.hideTooltip()
|
onHideTooltip: base.hideTooltip()
|
||||||
@ -596,7 +596,7 @@ Rectangle
|
|||||||
tooltipText: catalog.i18nc("@tooltip", "<b>Custom Print Setup</b><br/><br/>Print with finegrained control over every last bit of the slicing process."),
|
tooltipText: catalog.i18nc("@tooltip", "<b>Custom Print Setup</b><br/><br/>Print with finegrained control over every last bit of the slicing process."),
|
||||||
item: sidebarAdvanced
|
item: sidebarAdvanced
|
||||||
})
|
})
|
||||||
sidebarContents.replace( modesListModel.get(base.currentModeIndex).item, { "immediate": true })
|
sidebarContents.replace(modesListModel.get(base.currentModeIndex).item, { "immediate": true })
|
||||||
|
|
||||||
var index = Math.floor(UM.Preferences.getValue("cura/active_mode"))
|
var index = Math.floor(UM.Preferences.getValue("cura/active_mode"))
|
||||||
if(index)
|
if(index)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user