Browse Source

Merge branch 'feature_sync_button' of github.com:Ultimaker/Cura into feature_sync_button

Diego Prado Gesto 7 years ago
parent
commit
867e6388f2

+ 21 - 19
resources/qml/MachineSelection.qml

@@ -10,35 +10,28 @@ import UM 1.2 as UM
 import Cura 1.0 as Cura
 import "Menus"
 
-ToolButton
-{
+ToolButton {
+    property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
     text: Cura.MachineManager.activeMachineName
 
     tooltip: Cura.MachineManager.activeMachineName
 
-    style: ButtonStyle
-    {
-        background: Rectangle
-        {
-            color:
-            {
-                if(control.pressed)
-                {
+    style: ButtonStyle {
+        background: Rectangle {
+            color: {
+                if (control.pressed) {
                     return UM.Theme.getColor("sidebar_header_active");
                 }
-                else if(control.hovered)
-                {
+                else if (control.hovered) {
                     return UM.Theme.getColor("sidebar_header_hover");
                 }
-                else
-                {
+                else {
                     return UM.Theme.getColor("sidebar_header_bar");
                 }
             }
             Behavior on color { ColorAnimation { duration: 50; } }
 
-            UM.RecolorImage
-            {
+            UM.RecolorImage {
                 id: downArrow
                 anchors.verticalCenter: parent.verticalCenter
                 anchors.right: parent.right
@@ -50,14 +43,23 @@ ToolButton
                 color: UM.Theme.getColor("text_emphasis")
                 source: UM.Theme.getIcon("arrow_bottom")
             }
-            Label
-            {
+
+            PrinterStatusIcon {
+                visible: printerConnected
+                anchors {
+                    verticalCenter: parent.verticalCenter
+                    left: parent.left
+                    leftMargin: UM.Theme.getSize("default_margin").width
+                }
+            }
+
+            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.leftMargin: printerConnected ? UM.Theme.getSize("default_margin").width * 3 : UM.Theme.getSize("default_margin").width * 2
                 anchors.right: downArrow.left;
                 anchors.rightMargin: control.rightMargin;
                 anchors.verticalCenter: parent.verticalCenter;

+ 27 - 0
resources/qml/Menus/PrinterStatusIcon.qml

@@ -0,0 +1,27 @@
+// Copyright (c) 2017 Ultimaker B.V.
+// Cura is released under the terms of the LGPLv3 or higher.
+
+import QtQuick 2.2
+import QtQuick.Controls 1.1
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Layouts 1.1
+
+import UM 1.2 as UM
+import Cura 1.0 as Cura
+
+Item {
+    property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
+    width: childrenRect.width
+    height: childrenRect.height
+    Image {
+        id: statusIcon
+        width: UM.Theme.getSize("status_icon").width
+        height: UM.Theme.getSize("status_icon").height
+        sourceSize.width: width
+        sourceSize.height: width
+        source: printerConnected ? UM.Theme.getIcon("tab_status_connected") : UM.Theme.getIcon("tab_status_busy")
+    }
+}
+
+
+

+ 2 - 0
resources/themes/cura-light/theme.json

@@ -360,6 +360,8 @@
         "small_button": [2, 2],
         "small_button_icon": [1.5, 1.5],
 
+        "status_icon": [1.0, 1.0],
+
         "topbar_logo_right_margin": [3, 0],
         "topbar_button": [8, 4],
         "topbar_button_icon": [1.2, 1.2],