Change remaining MessageDialogs to our version

Contributes to issue CURA-8687.
This commit is contained in:
Ghostkeeper 2022-02-04 15:49:06 +01:00
parent a03988d146
commit 2606a3b847
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
7 changed files with 41 additions and 55 deletions

View file

@ -1,10 +1,9 @@
// Copyright (c) 2018 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.1
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -88,21 +87,21 @@ Item
anchors.top: dataRow.bottom anchors.top: dataRow.bottom
} }
MessageDialog UM.MessageDialog
{ {
id: confirmDeleteDialog id: confirmDeleteDialog
title: catalog.i18nc("@dialog:title", "Delete Backup") title: catalog.i18nc("@dialog:title", "Delete Backup")
text: catalog.i18nc("@dialog:info", "Are you sure you want to delete this backup? This cannot be undone.") text: catalog.i18nc("@dialog:info", "Are you sure you want to delete this backup? This cannot be undone.")
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: Dialog.Yes | Dialog.No
onYes: CuraDrive.deleteBackup(modelData.backup_id) onAccepted: CuraDrive.deleteBackup(modelData.backup_id)
} }
MessageDialog UM.MessageDialog
{ {
id: confirmRestoreDialog id: confirmRestoreDialog
title: catalog.i18nc("@dialog:title", "Restore Backup") title: catalog.i18nc("@dialog:title", "Restore Backup")
text: catalog.i18nc("@dialog:info", "You will need to restart Cura before your backup is restored. Do you want to close Cura now?") text: catalog.i18nc("@dialog:info", "You will need to restart Cura before your backup is restored. Do you want to close Cura now?")
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: Dialog.Yes | Dialog.No
onYes: CuraDrive.restoreBackup(modelData.backup_id) onAccepted: CuraDrive.restoreBackup(modelData.backup_id)
} }
} }

View file

@ -8,7 +8,6 @@ import QtQuick 2.2
import QtQuick.Controls 2.9 import QtQuick.Controls 2.9
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.1 import QtQuick.Window 2.1
import QtQuick.Dialogs 1.2
Cura.MachineAction Cura.MachineAction
{ {
@ -281,15 +280,12 @@ Cura.MachineAction
} }
} }
MessageDialog UM.MessageDialog
{ {
id: invalidIPAddressMessageDialog id: invalidIPAddressMessageDialog
x: parent ? (parent.x + (parent.width) / 2) : 0
y: parent ? (parent.y + (parent.height) / 2) : 0
title: catalog.i18nc("@title:window", "Invalid IP address") title: catalog.i18nc("@title:window", "Invalid IP address")
text: catalog.i18nc("@text", "Please enter a valid IP address.") text: catalog.i18nc("@text", "Please enter a valid IP address.")
icon: StandardIcon.Warning standardButtons: Dialog.Ok
standardButtons: StandardButton.Ok
} }
UM.Dialog UM.Dialog

View file

@ -1,10 +1,9 @@
// Copyright (c) 2019 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 2.0 import QtQuick.Controls 2.15
import QtQuick.Dialogs 1.1 import UM 1.5 as UM
import UM 1.3 as UM
/** /**
* A MonitorInfoBlurb is an extension of the GenericPopUp used to show static information (vs. interactive context * A MonitorInfoBlurb is an extension of the GenericPopUp used to show static information (vs. interactive context
@ -134,32 +133,29 @@ Item
} }
} }
MessageDialog { UM.MessageDialog
{
id: sendToTopConfirmationDialog id: sendToTopConfirmationDialog
Component.onCompleted: visible = false onAccepted: OutputDevice.sendJobToTop(printJob.key)
icon: StandardIcon.Warning standardButtons: Dialog.Yes | Dialog.No
onYes: OutputDevice.sendJobToTop(printJob.key)
standardButtons: StandardButton.Yes | StandardButton.No
text: printJob && printJob.name ? 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) : "" text: printJob && printJob.name ? 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) : ""
title: catalog.i18nc("@window:title", "Move print job to top") title: catalog.i18nc("@window:title", "Move print job to top")
} }
MessageDialog { UM.MessageDialog
{
id: deleteConfirmationDialog id: deleteConfirmationDialog
Component.onCompleted: visible = false onAccepted: OutputDevice.deleteJobFromQueue(printJob.key)
icon: StandardIcon.Warning standardButtons: Dialog.Yes | Dialog.No
onYes: OutputDevice.deleteJobFromQueue(printJob.key)
standardButtons: StandardButton.Yes | StandardButton.No
text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : "" text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to delete %1?").arg(printJob.name) : ""
title: catalog.i18nc("@window:title", "Delete print job") title: catalog.i18nc("@window:title", "Delete print job")
} }
MessageDialog { UM.MessageDialog
{
id: abortConfirmationDialog id: abortConfirmationDialog
Component.onCompleted: visible = false onAccepted: printJob.setState("abort")
icon: StandardIcon.Warning standardButtons: Dialog.Yes | Dialog.No
onYes: printJob.setState("abort")
standardButtons: StandardButton.Yes | StandardButton.No
text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : "" text: printJob && printJob.name ? catalog.i18nc("@label %1 is the name of a print job.", "Are you sure you want to abort %1?").arg(printJob.name) : ""
title: catalog.i18nc("@window:title", "Abort print") title: catalog.i18nc("@window:title", "Abort print")
} }

View file

@ -1,4 +1,4 @@
// Copyright (c) 2021 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7 import QtQuick 2.7
@ -61,15 +61,15 @@ Item
onYes: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) onYes: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args)
} }
MessageDialog UM.MessageDialog
{ {
id: newProjectDialog id: newProjectDialog
modality: Qt.ApplicationModal anchors.centerIn: base
title: catalog.i18nc("@title:window", "New project") title: catalog.i18nc("@title:window", "New project")
text: catalog.i18nc("@info:question", "Are you sure you want to start a new project? This will clear the build plate and any unsaved settings.") text: catalog.i18nc("@info:question", "Are you sure you want to start a new project? This will clear the build plate and any unsaved settings.")
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: Dialog.Yes | Dialog.No
icon: StandardIcon.Question onAccepted:
onYes:
{ {
CuraApplication.resetWorkspace() CuraApplication.resetWorkspace()
Cura.Actions.resetProfile.trigger() Cura.Actions.resetProfile.trigger()

View file

@ -1,4 +1,4 @@
//Copyright (c) 2018 Ultimaker B.V. //Copyright (c) 2022 Ultimaker B.V.
//Cura is released under the terms of the LGPLv3 or higher. //Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2 import QtQuick 2.2
@ -7,7 +7,7 @@ import QtQuick.Controls.Styles 1.1
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import UM 1.1 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Item Item
@ -325,16 +325,14 @@ Item
onClicked: confirmationDialog.visible = true onClicked: confirmationDialog.visible = true
} }
MessageDialog UM.MessageDialog
{ {
id: confirmationDialog id: confirmationDialog
title: catalog.i18nc("@window:title", "Abort print") title: catalog.i18nc("@window:title", "Abort print")
icon: StandardIcon.Warning
text: catalog.i18nc("@label", "Are you sure you want to abort the print?") text: catalog.i18nc("@label", "Are you sure you want to abort the print?")
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: Dialog.Yes | Dialog.No
Component.onCompleted: visible = false onAccepted: activePrintJob.setState("abort")
onYes: activePrintJob.setState("abort")
} }
} }
} }

View file

@ -119,21 +119,20 @@ Item
width: base.width width: base.width
property real rowHeight: brandTextField.height + UM.Theme.getSize("default_lining").height property real rowHeight: brandTextField.height + UM.Theme.getSize("default_lining").height
MessageDialog UM.MessageDialog
{ {
id: confirmDiameterChangeDialog id: confirmDiameterChangeDialog
anchors.centerIn: base
icon: StandardIcon.Question;
title: catalog.i18nc("@title:window", "Confirm Diameter Change") title: catalog.i18nc("@title:window", "Confirm Diameter Change")
text: catalog.i18nc("@label (%1 is a number)", "The new filament diameter is set to %1 mm, which is not compatible with the current extruder. Do you wish to continue?".arg(new_diameter_value)) text: catalog.i18nc("@label (%1 is a number)", "The new filament diameter is set to %1 mm, which is not compatible with the current extruder. Do you wish to continue?".arg(new_diameter_value))
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: Dialog.Yes | Dialog.No
modality: Qt.ApplicationModal
property var new_diameter_value: null; property var new_diameter_value: null;
property var old_diameter_value: null; property var old_diameter_value: null;
property var old_approximate_diameter_value: null; property var old_approximate_diameter_value: null;
onYes: onAccepted:
{ {
base.setMetaDataEntry("approximate_diameter", old_approximate_diameter_value, getApproximateDiameter(new_diameter_value).toString()); base.setMetaDataEntry("approximate_diameter", old_approximate_diameter_value, getApproximateDiameter(new_diameter_value).toString());
base.setMetaDataEntry("properties/diameter", properties.diameter, new_diameter_value); base.setMetaDataEntry("properties/diameter", properties.diameter, new_diameter_value);
@ -142,13 +141,11 @@ Item
base.resetSelectedMaterial() base.resetSelectedMaterial()
} }
onNo: onRejected:
{ {
base.properties.diameter = old_diameter_value; base.properties.diameter = old_diameter_value;
diameterSpinBox.value = Qt.binding(function() { return base.properties.diameter }) diameterSpinBox.value = Qt.binding(function() { return base.properties.diameter })
} }
onRejected: no()
} }
Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Display Name") } Label { width: informationPage.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Display Name") }

View file

@ -269,7 +269,7 @@ Item
} }
// Confirmation dialog for removing a profile // Confirmation dialog for removing a profile
MessageDialog UM.MessageDialog
{ {
id: confirmRemoveQualityDialog id: confirmRemoveQualityDialog