From f866ecdd6391c14c36174ad57c4c98b4460961f3 Mon Sep 17 00:00:00 2001 From: Tamara Hogenhout Date: Mon, 21 Sep 2015 16:03:53 +0200 Subject: [PATCH] Restyling of the sidebar header and and profile setup commits to: issue CURA-177 --- resources/qml/ProfileSetup.qml | 86 +++++++++++++++----------------- resources/qml/Sidebar.qml | 1 + resources/qml/SidebarHeader.qml | 6 +-- resources/themes/cura/styles.qml | 8 +-- resources/themes/cura/theme.json | 4 +- 5 files changed, 48 insertions(+), 57 deletions(-) diff --git a/resources/qml/ProfileSetup.qml b/resources/qml/ProfileSetup.qml index 104abe9a7d..ce1d2bc160 100644 --- a/resources/qml/ProfileSetup.qml +++ b/resources/qml/ProfileSetup.qml @@ -8,69 +8,65 @@ import QtQuick.Layouts 1.1 import UM 1.1 as UM -Column{ +Item{ id: base; UM.I18nCatalog { id: catalog; name:"cura"} property int totalHeightProfileSetup: childrenRect.height property Action manageProfilesAction - spacing: 0 - Rectangle{ - id: variantItem; - height: UM.Theme.sizes.sidebar_setup.height + Rectangle { + id: variantRow + anchors.top: base.top width: base.width + height: UM.Theme.sizes.sidebar_setup.height visible: UM.MachineManager.hasVariants; - Rectangle { - id: variantRow - width: base.width - height: parent.heigth + Label{ + id: variantLabel + text: catalog.i18nc("@label","Variant:"); + anchors.left: parent.left + anchors.leftMargin: UM.Theme.sizes.default_margin.width; + anchors.verticalCenter: parent.verticalCenter + width: parent.width/100*45 + font: UM.Theme.fonts.default; + } - Label{ - id: variantLabel - text: catalog.i18nc("@label","Variant:"); - anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width; - anchors.verticalCenter: parent.verticalCenter - width: parent.width/100*45 - font: UM.Theme.fonts.default; - } + ToolButton { + id: variantSelection + text: UM.MachineManager.activeMachineVariant + width: parent.width/100*55 + height: UM.Theme.sizes.setting_control.height + tooltip: UM.MachineManager.activeMachineInstance; + anchors.right: parent.right + anchors.rightMargin: UM.Theme.sizes.default_margin.width + anchors.verticalCenter: parent.verticalCenter + style: UM.Theme.styles.sidebar_header_button - ToolButton { - id: variantSelection - text: UM.MachineManager.activeMachineVariant - width: parent.width/100*55 - height: UM.Theme.sizes.setting_control.height - tooltip: UM.MachineManager.activeMachineInstance; - anchors.right: parent.right - anchors.rightMargin: UM.Theme.sizes.default_margin.width - anchors.verticalCenter: parent.verticalCenter - style: UM.Theme.styles.sidebar_header_button - - menu: Menu + menu: Menu + { + id: variantsSelectionMenu + Instantiator { - id: variantsSelectionMenu - Instantiator + model: UM.MachineVariantsModel { } + MenuItem { - model: UM.MachineVariantsModel { } - MenuItem - { - text: model.name; - checkable: true; - checked: model.active; - exclusiveGroup: variantSelectionMenuGroup; - onTriggered: UM.MachineManager.setActiveMachineVariant(model.getItem(index).name) - } + text: model.name; + checkable: true; + checked: model.active; + exclusiveGroup: variantSelectionMenuGroup; + onTriggered: UM.MachineManager.setActiveMachineVariant(model.getItem(index).name) } - - ExclusiveGroup { id: variantSelectionMenuGroup; } } + + ExclusiveGroup { id: variantSelectionMenuGroup; } } } } Rectangle{ id: globalProfileRow; + anchors.top: UM.MachineManager.hasVariants ? variantRow.bottom : base.top + //anchors.top: variantRow.bottom height: UM.Theme.sizes.sidebar_setup.height width: base.width @@ -148,8 +144,4 @@ Column{ // } } } - Rectangle{ - width: base.width - height: UM.Theme.sizes.default_margin.width/2 - } } \ No newline at end of file diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index ffdce05fda..e434492600 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -76,6 +76,7 @@ Rectangle id: sidebarContents; anchors.bottom: saveButton.top anchors.top: profileItem.bottom + anchors.topMargin: UM.Theme.sizes.default_margin.height anchors.left: base.left anchors.right: base.right diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 0c3fd7bc52..322b9b7a5a 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -80,8 +80,6 @@ Item anchors.top: parent.top anchors.left: parent.left width: parent.width - height: UM.Theme.sizes.sidebar_header.height - currentIndex: base.currentIndex; } } } @@ -89,8 +87,9 @@ Item Rectangle { id: machineSelectionRow width: base.width - height: UM.Theme.sizes.sidebar_header.height + height: UM.Theme.sizes.sidebar_setup.height anchors.top: settingsModeRow.bottom + anchors.topMargin: UM.Theme.sizes.default_margin.height anchors.horizontalCenter: parent.horizontalCenter Label{ @@ -109,7 +108,6 @@ Item width: parent.width/100*55 height: UM.Theme.sizes.setting_control.height tooltip: UM.MachineManager.activeMachineInstance; - //style: UM.Theme.styles.sidebar_header_button; anchors.right: parent.right anchors.rightMargin: UM.Theme.sizes.default_margin.width anchors.verticalCenter: parent.verticalCenter diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index aa01182aaa..f0eb0dd1e8 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -34,17 +34,17 @@ QtObject { elide: Text.ElideRight; anchors.left: parent.left; anchors.leftMargin: UM.Theme.sizes.setting_unit_margin.width - anchors.right: downArrow.left; - anchors.rightMargin: UM.Theme.sizes.setting_unit_margin.width + anchors.right: separationLine.left; anchors.verticalCenter: parent.verticalCenter; font: UM.Theme.fonts.default } Rectangle{ + id: separationLine width: 1 height: UM.Theme.sizes.setting_control.height color: UM.Theme.colors.setting_control_border - anchors.right: sidebarComboBoxLabel.right - anchors.rightMargin: UM.Theme.sizes.setting_unit_margin.width + anchors.right: downArrow.left + anchors.rightMargin: UM.Theme.sizes.setting_unit_margin.width + downArrow.width/2 anchors.top: parent.top z: parent.z + 1 } diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index 24fcdfe8c5..d1c0c628f9 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -155,7 +155,7 @@ "sidebar": [26.0, 10.0], "sidebar_header": [0.0, 3.8], "sidebar_header_mode_toggle": [0.0, 2.4], - "sidebar_setup": [0.0, 2.8], + "sidebar_setup": [0.0, 2.6], "sidebar_subParts": [0.0, 2.4], "sidebar_specs_bar": [0.0, 2.2], "sidebar_inputFields": [0.0, 1.9], @@ -166,7 +166,7 @@ "section_icon_column": [2.8, 0.0], "setting": [21.0, 1.8], - "setting_control": [6.0, 2.0], + "setting_control": [7.5, 2.0], "setting_control_margin": [3.0, 3.0], "setting_unit_margin": [0.5, 0.5], "setting_text_maxwidth": [40.0, 0.0],