From a7a022eca0a9163d89a332a4211c3b80dd5617b3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Sep 2018 11:24:30 +0200 Subject: [PATCH 1/4] Add confirmation dialogue before aborting a print It's a destructive operation so we should ask first. Contributes to issue CL-1053 and CURA-5729. --- .../resources/qml/ClusterControlItem.qml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml index 1164e383db..a7061b76e5 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/ClusterControlItem.qml @@ -1,4 +1,5 @@ import QtQuick 2.3 +import QtQuick.Dialogs 1.1 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.3 import QtGraphicalEffects 1.0 @@ -443,8 +444,8 @@ Component text: catalog.i18nc("@label", "Abort") onClicked: { - modelData.activePrintJob.setState("abort") - popup.close() + abortConfirmationDialog.visible = true; + popup.close(); } width: parent.width anchors.top: pauseButton.bottom @@ -456,6 +457,17 @@ Component color: UM.Theme.getColor("viewport_background") } } + + MessageDialog + { + id: abortConfirmationDialog + title: catalog.i18nc("@window:title", "Abort print") + icon: StandardIcon.Warning + text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(modelData.activePrintJob.name) + standardButtons: StandardButton.Yes | StandardButton.No + Component.onCompleted: visible = false + onYes: modelData.activePrintJob.setState("abort") + } } background: Item From ac4ee8c4283335e8c439ef12e7e1416fa7538c7c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Sep 2018 11:25:35 +0200 Subject: [PATCH 2/4] Fix context of pause, resume and abort labels More in line with what we have in the rest of our code base. Discovered during work on CL-1053 and CURA-5729. --- resources/qml/MonitorButton.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 0bae22e164..aa40de11e4 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -1,5 +1,5 @@ -// Copyright (c) 2017 Ultimaker B.V. -// Cura is released under the terms of the LGPLv3 or higher. +//Copyright (c) 2018 Ultimaker B.V. +//Cura is released under the terms of the LGPLv3 or higher. import QtQuick 2.2 import QtQuick.Controls 1.1 @@ -281,16 +281,16 @@ Item text: { if (!printerConnected || activePrintJob == null) { - return catalog.i18nc("@label:", "Pause"); + return catalog.i18nc("@label", "Pause"); } if (activePrintJob.state == "paused") { - return catalog.i18nc("@label:", "Resume"); + return catalog.i18nc("@label", "Resume"); } else { - return catalog.i18nc("@label:", "Pause"); + return catalog.i18nc("@label", "Pause"); } } onClicked: @@ -322,7 +322,7 @@ Item height: UM.Theme.getSize("save_button_save_to_button").height - text: catalog.i18nc("@label:", "Abort Print") + text: catalog.i18nc("@label", "Abort Print") onClicked: confirmationDialog.visible = true style: UM.Theme.styles.sidebar_action_button From 83528ffb488f96bb0be7385f8a55f08fe1f54f2f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Sep 2018 11:41:51 +0200 Subject: [PATCH 3/4] Add confirmation dialogue for sending prints to top of queue Very simple. Just re-use the MessageDialog component. Contributes to issues CL-1053 and CURA-5729. --- .../resources/qml/PrintJobInfoBlock.qml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml index f39b430e19..be1874ff91 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml @@ -1,4 +1,5 @@ import QtQuick 2.2 +import QtQuick.Dialogs 1.1 import QtQuick.Controls 2.0 import QtQuick.Controls.Styles 1.4 import QtGraphicalEffects 1.0 @@ -212,8 +213,8 @@ Item text: catalog.i18nc("@label", "Move to top") onClicked: { - OutputDevice.sendJobToTop(printJob.key) - popup.close() + sendToTopConfirmationDialog.visible = true; + popup.close(); } width: parent.width enabled: OutputDevice.queuedPrintJobs[0].key != printJob.key @@ -227,6 +228,17 @@ Item } } + MessageDialog + { + id: sendToTopConfirmationDialog + title: catalog.i18nc("@window:title", "Move print job to top") + icon: StandardIcon.Warning + text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to move %1 to the top of the queue?").arg(printJob.name) + standardButtons: StandardButton.Yes | StandardButton.No + Component.onCompleted: visible = false + onYes: OutputDevice.sendJobToTop(printJob.key) + } + Button { id: deleteButton From 3a096cdb23c3d6c5bd65d9f8cedf9338d5318487 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 18 Sep 2018 11:42:34 +0200 Subject: [PATCH 4/4] Add confirmation dialogue for deleting jobs Re-using MessageDialog again. Contributes to issues CL-1053 and CURA-5729. --- .../resources/qml/PrintJobInfoBlock.qml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml index be1874ff91..dd8eb27fca 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/PrintJobInfoBlock.qml @@ -245,8 +245,8 @@ Item text: catalog.i18nc("@label", "Delete") onClicked: { - OutputDevice.deleteJobFromQueue(printJob.key) - popup.close() + deleteConfirmationDialog.visible = true; + popup.close(); } width: parent.width anchors.top: sendToTopButton.bottom @@ -257,6 +257,17 @@ Item color: UM.Theme.getColor("viewport_background") } } + + MessageDialog + { + id: deleteConfirmationDialog + title: catalog.i18nc("@window:title", "Delete print job") + icon: StandardIcon.Warning + text: catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) + standardButtons: StandardButton.Yes | StandardButton.No + Component.onCompleted: visible = false + onYes: OutputDevice.deleteJobFromQueue(printJob.key) + } } background: Item