Merge pull request #4385 from Ultimaker/monitor_confirmation_dialogues

Add confirmation dialogues before making destructive changes in UM3/S5 monitor
This commit is contained in:
Ian Paschal 2018-09-19 13:14:39 +02:00 committed by GitHub
commit 7ad6fc4cad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 12 deletions

View file

@ -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

View file

@ -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,14 +228,25 @@ 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
text: catalog.i18nc("@label", "Delete")
onClicked:
{
OutputDevice.deleteJobFromQueue(printJob.key)
popup.close()
deleteConfirmationDialog.visible = true;
popup.close();
}
width: parent.width
anchors.top: sendToTopButton.bottom
@ -245,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

View file

@ -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