From 1bd0d65e0a7093c4e3a21e2ad66c4e668e269f8f Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Mon, 8 Aug 2016 16:25:01 +0200 Subject: [PATCH] Added user feedback after pressing Pause / Resume in network printer. The button displays Pausing... or Resuming... until a new status update. CURA-2060 --- resources/qml/MonitorButton.qml | 37 ++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 8aefe52f9f..0b0167a6ab 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -134,9 +134,8 @@ Rectangle anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width - text: catalog.i18nc("@label:", "Abort Print") - onClicked: Cura.MachineManager.printerOutputDevices[0].setJobState("abort") - + text: catalog.i18nc("@label:", "Abort Print"); + onClicked: Cura.MachineManager.printerOutputDevices[0].setJobState("abort"); style: ButtonStyle { @@ -206,8 +205,36 @@ Rectangle enabled: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands && (Cura.MachineManager.printerOutputDevices[0].jobState == "paused" || Cura.MachineManager.printerOutputDevices[0].jobState == "printing") - text: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? catalog.i18nc("@label:", "Resume") : catalog.i18nc("@label:", "Pause") : "" - onClicked: Cura.MachineManager.printerOutputDevices[0].setJobState(Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "print" : "pause") + property bool userClicked: false + + text: { + var result = ""; + if (!printerConnected) { + return ""; + } + + if (Cura.MachineManager.printerOutputDevices[0].jobState == "paused") + { + if (userClicked) { + result = catalog.i18nc("@label:", "Resuming..."); + } else { + result = catalog.i18nc("@label:", "Resume"); + } + } else { + if (userClicked) { + result = catalog.i18nc("@label:", "Pausing..."); + } else { + result = catalog.i18nc("@label:", "Pause"); + } + } + userClicked = false; + return result; + } + onClicked: { + var newJobState = Cura.MachineManager.printerOutputDevices[0].jobState == "paused" ? "print" : "pause"; + Cura.MachineManager.printerOutputDevices[0].setJobState(newJobState); + userClicked = true; + } style: ButtonStyle {