diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a5ae286b1e..7925a63038 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -384,6 +384,8 @@ class CuraApplication(QtApplication): self._plugin_registry.addSupportedPluginExtension("curaplugin", "Cura Plugin") + preferences.addPreference("general/sidebar_collapse", False) + def _onEngineCreated(self): self._engine.addImageProvider("camera", CameraImageProvider.CameraImageProvider()) diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index cf3581ca0c..aa185f8615 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -394,7 +394,7 @@ Item Action { id: expandSidebarAction; - text: catalog.i18nc("@action:inmenu menubar:view","Expand/Collapse sidebar"); + text: catalog.i18nc("@action:inmenu menubar:view","Expand/Collapse Sidebar"); shortcut: "Ctrl+E"; } } diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 62968d66f0..ccd89eb916 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -401,12 +401,12 @@ UM.MainWindow collapsSidebarAnimation.start(); } collapsed = !collapsed; - UM.Preferences.setValue("general/sidebar_collaps", collapsed); + UM.Preferences.setValue("general/sidebar_collapse", collapsed); } anchors { - top: topbar.top + top: topbar.bottom bottom: parent.bottom } @@ -419,7 +419,7 @@ UM.MainWindow target: sidebar properties: "x" to: base.width - duration: 500 + duration: 100 } NumberAnimation { @@ -427,12 +427,12 @@ UM.MainWindow target: sidebar properties: "x" to: base.width - sidebar.width - duration: 500 + duration: 100 } Component.onCompleted: { - var sidebarCollaps = UM.Preferences.getValue("general/sidebar_collaps") + var sidebarCollaps = UM.Preferences.getValue("general/sidebar_collapse") if (sidebarCollaps == true){ sidebar.collapsed = true; diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index a45303aab8..ea66aca50f 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -87,77 +87,10 @@ Rectangle } } - ToolButton - { - id: machineSelection - text: Cura.MachineManager.activeMachineName - - width: base.width - height: UM.Theme.getSize("sidebar_header").height - tooltip: Cura.MachineManager.activeMachineName - - anchors.top: base.top - //anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - style: ButtonStyle - { - background: Rectangle - { - color: - { - if(control.pressed) - { - return UM.Theme.getColor("sidebar_header_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("sidebar_header_hover"); - } - else - { - return UM.Theme.getColor("sidebar_header_bar"); - } - } - Behavior on color { ColorAnimation { duration: 50; } } - - UM.RecolorImage - { - id: downArrow - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("text_emphasis") - source: UM.Theme.getIcon("arrow_bottom") - } - Label - { - id: sidebarComboBoxLabel - color: UM.Theme.getColor("sidebar_header_text_active") - text: control.text; - elide: Text.ElideRight; - anchors.left: parent.left; - anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2 - anchors.right: downArrow.left; - anchors.rightMargin: control.rightMargin; - anchors.verticalCenter: parent.verticalCenter; - font: UM.Theme.getFont("large") - } - } - label: Label {} - } - - menu: PrinterMenu { } - } - SidebarHeader { id: header width: parent.width visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants - anchors.top: machineSelection.bottom onShowTooltip: base.showTooltip(item, location, text) onHideTooltip: base.hideTooltip() diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index 865cd287c3..99910b24a2 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -76,6 +76,70 @@ Rectangle ExclusiveGroup { id: topbarMenuGroup } } + ToolButton + { + id: machineSelection + text: Cura.MachineManager.activeMachineName + + width: UM.Theme.getSize("sidebar").width + height: UM.Theme.getSize("sidebar_header").height + tooltip: Cura.MachineManager.activeMachineName + + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + style: ButtonStyle + { + background: Rectangle + { + color: + { + if(control.pressed) + { + return UM.Theme.getColor("sidebar_header_active"); + } + else if(control.hovered) + { + return UM.Theme.getColor("sidebar_header_hover"); + } + else + { + return UM.Theme.getColor("sidebar_header_bar"); + } + } + Behavior on color { ColorAnimation { duration: 50; } } + + UM.RecolorImage + { + id: downArrow + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.width: width + sourceSize.height: width + color: UM.Theme.getColor("text_emphasis") + source: UM.Theme.getIcon("arrow_bottom") + } + Label + { + id: sidebarComboBoxLabel + color: UM.Theme.getColor("sidebar_header_text_active") + text: control.text; + elide: Text.ElideRight; + anchors.left: parent.left; + anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2 + anchors.right: downArrow.left; + anchors.rightMargin: control.rightMargin; + anchors.verticalCenter: parent.verticalCenter; + font: UM.Theme.getFont("large") + } + } + label: Label {} + } + + menu: PrinterMenu { } + } // View orientation Item Row