Browse Source

Add sidebar_collapse to the saved preferences, typos, move back machine selection to the top bar
CURA-4234

Aleksei S 7 years ago
parent
commit
6968c089db
5 changed files with 72 additions and 73 deletions
  1. 2 0
      cura/CuraApplication.py
  2. 1 1
      resources/qml/Actions.qml
  3. 5 5
      resources/qml/Cura.qml
  4. 0 67
      resources/qml/Sidebar.qml
  5. 64 0
      resources/qml/Topbar.qml

+ 2 - 0
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())
 

+ 1 - 1
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";
     }
 }

+ 5 - 5
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;

+ 0 - 67
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()

+ 64 - 0
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