Added status icon

This commit is contained in:
Ian Paschal 2018-03-08 10:55:29 +01:00
parent 4c7ec3920d
commit ffccdd99c0
4 changed files with 26 additions and 10 deletions

View file

@ -11,7 +11,8 @@ import Cura 1.0 as Cura
import "Menus"
ToolButton {
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property var isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey ? true : false
property var printerStatus: Cura.MachineManager.printerOutputDevices.length != 0 ? "connected" : "unknown"
text: Cura.MachineManager.activeMachineName
tooltip: Cura.MachineManager.activeMachineName
@ -45,7 +46,8 @@ ToolButton {
}
PrinterStatusIcon {
visible: printerConnected
visible: isNetworkPrinter
status: printerStatus
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
@ -59,7 +61,7 @@ ToolButton {
text: control.text;
elide: Text.ElideRight;
anchors.left: parent.left;
anchors.leftMargin: printerConnected ? UM.Theme.getSize("default_margin").width * 3 : UM.Theme.getSize("default_margin").width * 2
anchors.leftMargin: isNetworkPrinter ? 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;

View file

@ -10,16 +10,17 @@ import UM 1.2 as UM
import Cura 1.0 as Cura
Item {
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property var status: "unknown"
width: childrenRect.width
height: childrenRect.height
Image {
UM.RecolorImage {
id: statusIcon
width: UM.Theme.getSize("status_icon").width
height: UM.Theme.getSize("status_icon").height
width: UM.Theme.getSize("printer_status_icon").width
height: UM.Theme.getSize("printer_status_icon").height
sourceSize.width: width
sourceSize.height: width
source: printerConnected ? UM.Theme.getIcon("tab_status_connected") : UM.Theme.getIcon("tab_status_busy")
color: UM.Theme.getColor("tab_status_" + parent.status )
source: UM.Theme.getIcon("tab_status_" + parent.status )
}
}