From 1abd0b3499a1a6d666f67dab25fb2ed865062c44 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Mon, 5 Nov 2018 15:45:17 +0100 Subject: [PATCH] Show "Pausing...", "Aborting...", and "Resuming..." texts Contributes to CL-1126 --- .../resources/qml/PrintJobContextMenu.qml | 56 +++++++++++++------ .../resources/qml/PrintJobContextMenuItem.qml | 3 +- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml index 473fd87a34..695b69f822 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenu.qml @@ -11,7 +11,7 @@ import UM 1.3 as UM Item { id: root; property var printJob: null; - property var running: isRunning(printJob); + property var started: isStarted(printJob); property var assigned: isAssigned(printJob); Button { @@ -34,7 +34,7 @@ Item { hoverEnabled: true; onClicked: parent.switchPopupState(); text: "\u22EE"; //Unicode; Three stacked points. - visible: printJob.state == "queued" || running ? true : false; + visible: printJob.state == "queued" || printJob.state == "aborted" || started ? true : false; width: 35 * screenScaleFactor; // TODO: Theme! } @@ -102,7 +102,12 @@ Item { width: parent.width; PrintJobContextMenuItem { - enabled: { + onClicked: { + sendToTopConfirmationDialog.visible = true; + popup.close(); + } + text: catalog.i18nc("@label", "Move to top"); + visible: { if (printJob && printJob.state == "queued" && !assigned) { if (OutputDevice && OutputDevice.queuedPrintJobs[0]) { return OutputDevice.queuedPrintJobs[0].key != printJob.key; @@ -110,42 +115,57 @@ Item { } return false; } - onClicked: { - sendToTopConfirmationDialog.visible = true; - popup.close(); - } - text: catalog.i18nc("@label", "Move to top"); } PrintJobContextMenuItem { - enabled: printJob && !running; onClicked: { deleteConfirmationDialog.visible = true; popup.close(); } text: catalog.i18nc("@label", "Delete"); + visible: printJob && !started && printJob.state !== "aborted" && printJob.state !== "finished"; } PrintJobContextMenuItem { - enabled: printJob && running; + enabled: !(printJob.state == "pausing" || printJob.state == "resuming"); onClicked: { if (printJob.state == "paused") { printJob.setState("print"); - } else if(printJob.state == "printing") { - printJob.setState("pause"); + popup.close(); + return; + } + if (printJob.state == "printing") { + printJob.setState("pause"); + popup.close(); + return; } - popup.close(); } - text: printJob && printJob.state == "paused" ? catalog.i18nc("@label", "Resume") : catalog.i18nc("@label", "Pause"); + text: { + if (!printJob) { + return ""; + } + switch(printJob.state) { + case "paused": + return catalog.i18nc("@label", "Resume"); + case "pausing": + return catalog.i18nc("@label", "Pausing..."); + case "resuming": + return catalog.i18nc("@label", "Resuming..."); + default: + catalog.i18nc("@label", "Pause"); + } + } + visible: printJob && started && printJob.state; } PrintJobContextMenuItem { - enabled: printJob && running; + enabled: printJob.state !== "aborting"; onClicked: { abortConfirmationDialog.visible = true; popup.close(); } - text: catalog.i18nc("@label", "Abort"); + text: printJob.state == "aborting" ? catalog.i18nc("@label", "Aborting...") : catalog.i18nc("@label", "Abort"); + visible: printJob && started; } } enter: Transition { @@ -205,11 +225,11 @@ Item { function switchPopupState() { popup.visible ? popup.close() : popup.open(); } - function isRunning(job) { + function isStarted(job) { if (!job) { return false; } - return ["paused", "printing", "pre_print"].indexOf(job.state) !== -1; + return ["pre_print", "printing", "pausing", "paused", "resuming", "aborting"].indexOf(job.state) !== -1; } function isAssigned(job) { if (!job) { diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml index 1b0777a8c0..18f5e3b305 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobContextMenuItem.qml @@ -12,13 +12,12 @@ Button { color: UM.Theme.getColor("monitor_context_menu_highlight"); } contentItem: Label { - color: UM.Theme.getColor("text"); + color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("text_inactive"); text: parent.text horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter; } height: 39 * screenScaleFactor; // TODO: Theme! hoverEnabled: true; - visible: enabled; width: parent.width; } \ No newline at end of file