Fix code style

CURA-4758
This commit is contained in:
Lipu Fei 2018-01-04 13:51:45 +01:00
parent 84adbc5f41
commit d20895a055
4 changed files with 59 additions and 89 deletions

View File

@ -9,14 +9,14 @@ import Cura 1.0 as Cura
Button
{
id: base;
id: base
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
background: Rectangle
{
implicitHeight: UM.Theme.getSize("section").height;
implicitHeight: UM.Theme.getSize("section").height
color: {
if (base.color) {
return base.color;
@ -66,7 +66,7 @@ Button
//text: definition.label
contentItem: Item {
anchors.fill: parent;
anchors.fill: parent
anchors.left: parent.left
Label {
@ -78,31 +78,22 @@ Button
verticalCenter: parent.verticalCenter;
}
text: definition.label
font: UM.Theme.getFont("setting_category");
font: UM.Theme.getFont("setting_category")
color:
{
if(!base.enabled)
{
if (!base.enabled) {
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");
}
else if(base.pressed || (base.checkable && base.checked))
{
} else if (base.pressed || (base.checkable && base.checked)) {
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");
}
else
{
} else {
return UM.Theme.getColor("setting_category_text");
}
}
fontSizeMode: Text.HorizontalFit;
fontSizeMode: Text.HorizontalFit
minimumPointSize: 8
}
UM.RecolorImage
@ -117,24 +108,15 @@ Button
sourceSize.height: width
color:
{
if(!base.enabled)
{
if (!base.enabled) {
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");
}
else if(base.pressed || (base.checkable && base.checked))
{
} else if (base.pressed || (base.checkable && base.checked)) {
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");
}
else
{
} else {
return UM.Theme.getColor("setting_category_text");
}
}
@ -150,24 +132,15 @@ Button
anchors.leftMargin: UM.Theme.getSize("default_margin").width
color:
{
if(!base.enabled)
{
if (!base.enabled) {
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");
}
else if(base.pressed || (base.checkable && base.checked))
{
} else if(base.pressed || (base.checkable && base.checked)) {
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");
}
else
{
} else {
return UM.Theme.getColor("setting_category_text");
}
}
@ -178,18 +151,14 @@ Button
sourceSize.height: width + 15 * screenScaleFactor
}
checkable: true
checked: definition.expanded
onClicked:
{
if(definition.expanded)
{
if (definition.expanded) {
settingDefinitionsModel.collapse(definition.key);
}
else
{
} else {
settingDefinitionsModel.expandAll(definition.key);
}
//Set focus so that tab navigation continues from this point on.
@ -223,13 +192,14 @@ Button
anchors {
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
verticalCenter: parent.verticalCenter;
// use 1.9 as the factor because there is a 0.1 difference between the settings and inheritance warning icons
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")
iconSource: UM.Theme.getIcon("settings");
iconSource: UM.Theme.getIcon("settings")
onClicked: {
Cura.Actions.configureSettingVisibility.trigger(definition)
@ -238,7 +208,7 @@ Button
UM.SimpleButton
{
id: inheritButton;
id: inheritButton
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right

View File

@ -11,9 +11,9 @@ import "Menus"
Rectangle
{
id: base;
id: base
property int currentModeIndex;
property int currentModeIndex
property bool hideSettings: PrintInformation.preSliced
property bool hideView: Cura.MachineManager.activeMachineName == ""
@ -77,7 +77,7 @@ Rectangle
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.AllButtons;
acceptedButtons: Qt.AllButtons
onWheel:
{
@ -125,7 +125,7 @@ Rectangle
Label
{
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.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.top: headerSeparator.bottom
@ -557,19 +557,19 @@ Rectangle
SidebarTooltip
{
id: tooltip;
id: tooltip
}
// Setting mode: Recommended or Custom
ListModel
{
id: modesListModel;
id: modesListModel
}
SidebarSimple
{
id: sidebarSimple;
visible: false;
id: sidebarSimple
visible: false
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
@ -577,8 +577,8 @@ Rectangle
SidebarAdvanced
{
id: sidebarAdvanced;
visible: false;
id: sidebarAdvanced
visible: false
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()