From 1d84bd735660cc8c8b98157854fc15b46d5cd55e Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 22 Nov 2018 17:37:10 +0100 Subject: [PATCH] Improve the machine selector header to show an icon in case it is a network printer. Contributes to CURA-5942. --- .../qml/ActionPanel/OutputProcessWidget.qml | 2 ++ .../qml/ActionPanel/SliceProcessWidget.qml | 1 + resources/qml/IconLabel.qml | 13 ++++++----- .../qml/PrinterSelector/MachineSelector.qml | 22 ++++++++++++++----- ...us_connected.svg => printer_connected.svg} | 0 .../themes/cura-light/icons/printer_group.svg | 22 +++++++++++++------ .../cura-light/icons/printer_single.svg | 15 ++++++------- .../cura-light/icons/tab_status_busy.svg | 13 ----------- .../cura-light/icons/tab_status_finished.svg | 13 ----------- .../cura-light/icons/tab_status_paused.svg | 13 ----------- .../cura-light/icons/tab_status_stopped.svg | 13 ----------- .../cura-light/icons/tab_status_unknown.svg | 13 ----------- resources/themes/cura-light/theme.json | 1 + 13 files changed, 50 insertions(+), 91 deletions(-) rename resources/themes/cura-light/icons/{tab_status_connected.svg => printer_connected.svg} (100%) delete mode 100644 resources/themes/cura-light/icons/tab_status_busy.svg delete mode 100644 resources/themes/cura-light/icons/tab_status_finished.svg delete mode 100644 resources/themes/cura-light/icons/tab_status_paused.svg delete mode 100644 resources/themes/cura-light/icons/tab_status_stopped.svg delete mode 100644 resources/themes/cura-light/icons/tab_status_unknown.svg diff --git a/resources/qml/ActionPanel/OutputProcessWidget.qml b/resources/qml/ActionPanel/OutputProcessWidget.qml index 3c4386f079..87f9d2015d 100644 --- a/resources/qml/ActionPanel/OutputProcessWidget.qml +++ b/resources/qml/ActionPanel/OutputProcessWidget.qml @@ -47,6 +47,7 @@ Column { id: estimatedTime width: parent.width + height: childrenRect.height text: PrintInformation.currentPrintTime.getDisplayString(UM.DurationFormat.Long) source: UM.Theme.getIcon("clock") @@ -57,6 +58,7 @@ Column { id: estimatedCosts width: parent.width + height: childrenRect.height property var printMaterialLengths: PrintInformation.materialLengths property var printMaterialWeights: PrintInformation.materialWeights diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 2d4a7b6b89..9c46539220 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -44,6 +44,7 @@ Column { id: message width: parent.width + height: childrenRect.height visible: widget.backendState == UM.Backend.Error text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice") diff --git a/resources/qml/IconLabel.qml b/resources/qml/IconLabel.qml index 7c90382892..90930e91c7 100644 --- a/resources/qml/IconLabel.qml +++ b/resources/qml/IconLabel.qml @@ -16,32 +16,35 @@ Item property alias source: icon.source property alias color: label.color property alias font: label.font - - height: childrenRect.height + property alias iconSize: icon.width UM.RecolorImage { id: icon anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter - source: UM.Theme.getIcon("dot") + source: "" width: UM.Theme.getSize("section_icon").width - height: UM.Theme.getSize("section_icon").height + height: width sourceSize.width: width sourceSize.height: height color: label.color + visible: source != "" } Label { id: label - anchors.left: icon.right + anchors.left: icon.visible ? icon.right : parent.left + anchors.right: parent.right anchors.leftMargin: UM.Theme.getSize("thin_margin").width anchors.verticalCenter: icon.verticalCenter text: "Empty label" + elide: Text.ElideRight color: UM.Theme.getColor("text") font: UM.Theme.getFont("very_small") renderType: Text.NativeRendering diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 66ed4d4a2c..d10478227a 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -14,6 +14,7 @@ Cura.ExpandableComponent id: machineSelector property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" + property var outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null popupPadding: 0 popupAlignment: Cura.ExpandableComponent.PopupAlignment.AlignLeft @@ -25,15 +26,24 @@ Cura.ExpandableComponent name: "cura" } - headerItem: Label + headerItem: Cura.IconLabel { text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName - verticalAlignment: Text.AlignVCenter - height: parent.height - elide: Text.ElideRight - renderType: Text.NativeRendering - font: UM.Theme.getFont("default") + source: + { + if (isNetworkPrinter && machineSelector.outputDevice != null) + { + if (machineSelector.outputDevice.clusterSize > 1) + { + return UM.Theme.getIcon("printer_group") + } + return UM.Theme.getIcon("printer_single") + } + return "" + } + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text") + iconSize: UM.Theme.getSize("machine_selector_icon").width } popupItem: Item diff --git a/resources/themes/cura-light/icons/tab_status_connected.svg b/resources/themes/cura-light/icons/printer_connected.svg similarity index 100% rename from resources/themes/cura-light/icons/tab_status_connected.svg rename to resources/themes/cura-light/icons/printer_connected.svg diff --git a/resources/themes/cura-light/icons/printer_group.svg b/resources/themes/cura-light/icons/printer_group.svg index 614bea90b8..5e439faca4 100644 --- a/resources/themes/cura-light/icons/printer_group.svg +++ b/resources/themes/cura-light/icons/printer_group.svg @@ -1,12 +1,20 @@ - - - icn_groupPrinters + + + Icon/ group printer/ disconnected Created with Sketch. - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/themes/cura-light/icons/printer_single.svg b/resources/themes/cura-light/icons/printer_single.svg index f7dc83987d..69c4e212bc 100644 --- a/resources/themes/cura-light/icons/printer_single.svg +++ b/resources/themes/cura-light/icons/printer_single.svg @@ -1,13 +1,12 @@ - - - icn_singlePrinter + + + Icon/ single printer/ disconnected Created with Sketch. - - - - - + + + + diff --git a/resources/themes/cura-light/icons/tab_status_busy.svg b/resources/themes/cura-light/icons/tab_status_busy.svg deleted file mode 100644 index debe4f6360..0000000000 --- a/resources/themes/cura-light/icons/tab_status_busy.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Busy - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_finished.svg b/resources/themes/cura-light/icons/tab_status_finished.svg deleted file mode 100644 index 2519f2f862..0000000000 --- a/resources/themes/cura-light/icons/tab_status_finished.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Wait cleanup - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_paused.svg b/resources/themes/cura-light/icons/tab_status_paused.svg deleted file mode 100644 index bab6c9ca6b..0000000000 --- a/resources/themes/cura-light/icons/tab_status_paused.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - paused - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_stopped.svg b/resources/themes/cura-light/icons/tab_status_stopped.svg deleted file mode 100644 index c9b150db3a..0000000000 --- a/resources/themes/cura-light/icons/tab_status_stopped.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Aborted - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/icons/tab_status_unknown.svg b/resources/themes/cura-light/icons/tab_status_unknown.svg deleted file mode 100644 index 9f413baffc..0000000000 --- a/resources/themes/cura-light/icons/tab_status_unknown.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Unknown - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 61b7600384..8f110db65d 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -396,6 +396,7 @@ "machine_selector_widget": [20.0, 4.0], "machine_selector_widget_content": [25.0, 32.0], + "machine_selector_icon": [2.66, 2.66], "views_selector": [16.0, 4.5],