Merge pull request #11460 from Ultimaker/CURA-8687_dialogs

Replace Dialogs in preparation for Qt 6.x upgrade
This commit is contained in:
Jaime van Kessel 2022-02-11 15:04:01 +01:00 committed by GitHub
commit b9feac9816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 299 additions and 445 deletions

View File

@ -675,22 +675,6 @@ class CuraApplication(QtApplication):
self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing Active Machine...")) self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing Active Machine..."))
super().setGlobalContainerStack(stack) super().setGlobalContainerStack(stack)
showMessageBox = pyqtSignal(str,str, str, str, int, int,
arguments = ["title", "text", "informativeText", "detailedText","buttons", "icon"])
"""A reusable dialogbox"""
def messageBox(self, title, text,
informativeText = "",
detailedText = "",
buttons = QMessageBox.Ok,
icon = QMessageBox.NoIcon,
callback = None,
callback_arguments = []
):
self._message_box_callback = callback
self._message_box_callback_arguments = callback_arguments
self.showMessageBox.emit(title, text, informativeText, detailedText, buttons, icon)
showDiscardOrKeepProfileChanges = pyqtSignal() showDiscardOrKeepProfileChanges = pyqtSignal()
def discardOrKeepProfileChanges(self) -> bool: def discardOrKeepProfileChanges(self) -> bool:

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

@ -5,7 +5,6 @@ import QtQuick 2.2
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQml.Models 2.15 as Models import QtQml.Models 2.15 as Models
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import UM 1.5 as UM import UM 1.5 as UM

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,18 +280,15 @@ 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 Dialog
{ {
id: manualPrinterDialog id: manualPrinterDialog
property string printerKey property string printerKey
@ -300,17 +296,18 @@ Cura.MachineAction
title: catalog.i18nc("@title:window", "Printer Address") title: catalog.i18nc("@title:window", "Printer Address")
minimumWidth: 400 * screenScaleFactor width: UM.Theme.getSize("small_popup_dialog").width
minimumHeight: 130 * screenScaleFactor
width: minimumWidth anchors.centerIn: Overlay.overlay
height: minimumHeight
standardButtons: Dialog.Yes | Dialog.No
signal showDialog(string key, string address) signal showDialog(string key, string address)
onShowDialog: onShowDialog:
{ {
printerKey = key; printerKey = key;
addressText = address; addressText = address;
manualPrinterDialog.show(); manualPrinterDialog.open();
addressField.selectAll(); addressField.selectAll();
addressField.focus = true; addressField.focus = true;
} }
@ -331,28 +328,17 @@ Cura.MachineAction
{ {
id: addressField id: addressField
width: parent.width width: parent.width
validator: RegExpValidator validator: RegExpValidator { regExp: /[a-zA-Z0-9\.\-\_]*/ }
{
regExp: /[a-zA-Z0-9\.\-\_]*/
}
onAccepted: btnOk.clicked() onAccepted: btnOk.clicked()
} }
} }
rightButtons: [ onRejected:
Button {
text: catalog.i18nc("@action:button","Cancel")
onClicked:
{ {
manualPrinterDialog.reject() manualPrinterDialog.reject()
manualPrinterDialog.hide() manualPrinterDialog.hide()
} }
}, onAccepted:
Button {
id: btnOk
text: catalog.i18nc("@action:button", "OK")
onClicked:
{ {
// Validate the input first // Validate the input first
if (!networkingUtil.isValidIP(manualPrinterDialog.addressText)) if (!networkingUtil.isValidIP(manualPrinterDialog.addressText))
@ -377,8 +363,5 @@ Cura.MachineAction
manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText)
manualPrinterDialog.hide() manualPrinterDialog.hide()
} }
enabled: manualPrinterDialog.addressText.trim() != ""
}
]
} }
} }

View File

@ -3,7 +3,6 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.1
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import UM 1.3 as UM import UM 1.3 as UM

View File

@ -4,7 +4,6 @@
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.5 as UM import UM 1.5 as UM
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

@ -3,7 +3,6 @@
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
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

View File

@ -82,7 +82,8 @@ Row // Sync state icon + message
id: stateLabel id: stateLabel
// text is determined by State // text is determined by State
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
width: contentWidth + UM.Theme.getSize("default_margin").height anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.rightMargin: UM.Theme.getSize("default_margin").width
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
height: contentHeight height: contentHeight
visible: !Cura.API.account.manualSyncEnabled && !Cura.API.account.updatePackagesEnabled visible: !Cura.API.account.manualSyncEnabled && !Cura.API.account.updatePackagesEnabled

View File

@ -0,0 +1,77 @@
import QtQuick 2.10
import QtQuick.Controls 2.2
import QtQuick.Window 2.1
import QtQuick.Layouts 1.1
import UM 1.5 as UM
import Cura 1.1 as Cura
/*
* A dialog that provides the option to pick a color. Currently it only asks for a hex code and shows the color
* in a color swath
*/
UM.Dialog
{
id: base
property variant catalog: UM.I18nCatalog { name: "cura" }
minimumHeight: UM.Theme.getSize("small_popup_dialog").height
minimumWidth: UM.Theme.getSize("small_popup_dialog").width / 1.5
height: minimumHeight
width: minimumWidth
property alias color: colorInput.text
margin: UM.Theme.getSize("default_margin").width
buttonSpacing: UM.Theme.getSize("default_margin").width
UM.Label
{
id: colorLabel
font: UM.Theme.getFont("large")
text: catalog.i18nc("@label", "Color Code (HEX)")
}
TextField
{
id: colorInput
text: "#FFFFFF"
selectByMouse: true
anchors.top: colorLabel.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height
onTextChanged: {
if (!text.startsWith("#"))
{
text = `#${text}`;
}
}
validator: RegExpValidator { regExp: /^#([a-fA-F0-9]{0,6})$/ }
}
Rectangle
{
id: swatch
color: base.color
anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors {
left: colorInput.right
top: colorInput.top
bottom: colorInput.bottom
}
width: height
}
rightButtons:
[
Cura.PrimaryButton {
text: catalog.i18nc("@action:button", "OK")
onClicked: base.accept()
},
Cura.SecondaryButton {
text: catalog.i18nc("@action:button", "Cancel")
onClicked: base.close()
}
]
}

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
@ -253,7 +253,6 @@ UM.MainWindow
// Try to install plugin & close. // Try to install plugin & close.
CuraApplication.installPackageViaDragAndDrop(filename); CuraApplication.installPackageViaDragAndDrop(filename);
packageInstallDialog.text = catalog.i18nc("@label", "This package will be installed after restarting."); packageInstallDialog.text = catalog.i18nc("@label", "This package will be installed after restarting.");
packageInstallDialog.icon = StandardIcon.Information;
packageInstallDialog.open(); packageInstallDialog.open();
} }
else else
@ -586,18 +585,15 @@ UM.MainWindow
} }
} }
MessageDialog UM.MessageDialog
{ {
id: exitConfirmationDialog id: exitConfirmationDialog
title: catalog.i18nc("@title:window %1 is the application name", "Closing %1").arg(CuraApplication.applicationDisplayName) title: catalog.i18nc("@title:window %1 is the application name", "Closing %1").arg(CuraApplication.applicationDisplayName)
text: catalog.i18nc("@label %1 is the application name", "Are you sure you want to exit %1?").arg(CuraApplication.applicationDisplayName) text: catalog.i18nc("@label %1 is the application name", "Are you sure you want to exit %1?").arg(CuraApplication.applicationDisplayName)
icon: StandardIcon.Question standardButtons: Dialog.Yes | Dialog.No
modality: Qt.ApplicationModal onAccepted: CuraApplication.callConfirmExitDialogCallback(true)
standardButtons: StandardButton.Yes | StandardButton.No
onYes: CuraApplication.callConfirmExitDialogCallback(true)
onNo: CuraApplication.callConfirmExitDialogCallback(false)
onRejected: CuraApplication.callConfirmExitDialogCallback(false) onRejected: CuraApplication.callConfirmExitDialogCallback(false)
onVisibilityChanged: onClosed:
{ {
if (!visible) if (!visible)
{ {
@ -747,20 +743,18 @@ UM.MainWindow
} }
} }
MessageDialog UM.MessageDialog
{ {
id: packageInstallDialog id: packageInstallDialog
title: catalog.i18nc("@window:title", "Install Package"); title: catalog.i18nc("@window:title", "Install Package")
standardButtons: StandardButton.Ok standardButtons: StandardButton.Ok
modality: Qt.ApplicationModal
} }
MessageDialog UM.MessageDialog
{ {
id: infoMultipleFilesWithGcodeDialog id: infoMultipleFilesWithGcodeDialog
title: catalog.i18nc("@title:window", "Open File(s)") title: catalog.i18nc("@title:window", "Open File(s)")
icon: StandardIcon.Information standardButtons: Dialog.Ok
standardButtons: StandardButton.Ok
text: catalog.i18nc("@text:window", "We have found one or more G-Code files within the files you have selected. You can only open one G-Code file at a time. If you want to open a G-Code file, please just select only one.") text: catalog.i18nc("@text:window", "We have found one or more G-Code files within the files you have selected. You can only open one G-Code file at a time. If you want to open a G-Code file, please just select only one.")
property var selectedMultipleFiles property var selectedMultipleFiles
@ -819,35 +813,6 @@ UM.MainWindow
} }
} }
MessageDialog
{
id: messageDialog
modality: Qt.ApplicationModal
onAccepted: CuraApplication.messageBoxClosed(clickedButton)
onApply: CuraApplication.messageBoxClosed(clickedButton)
onDiscard: CuraApplication.messageBoxClosed(clickedButton)
onHelp: CuraApplication.messageBoxClosed(clickedButton)
onNo: CuraApplication.messageBoxClosed(clickedButton)
onRejected: CuraApplication.messageBoxClosed(clickedButton)
onReset: CuraApplication.messageBoxClosed(clickedButton)
onYes: CuraApplication.messageBoxClosed(clickedButton)
}
Connections
{
target: CuraApplication
function onShowMessageBox(title, text, informativeText, detailedText, buttons, icon)
{
messageDialog.title = title
messageDialog.text = text
messageDialog.informativeText = informativeText
messageDialog.detailedText = detailedText
messageDialog.standardButtons = buttons
messageDialog.icon = icon
messageDialog.visible = true
}
}
Component Component
{ {
id: discardOrKeepProfileChangesDialogComponent id: discardOrKeepProfileChangesDialogComponent

View File

@ -1,11 +1,11 @@
// 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.2 import QtQuick 2.2
import QtQuick.Controls 2.9 import QtQuick.Controls 2.9
import QtQuick.Window 2.1
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.5 as Cura
UM.Dialog UM.Dialog
{ {
@ -165,11 +165,11 @@ UM.Dialog
} }
} }
rightButtons: Button rightButtons: Cura.SecondaryButton
{ {
//: Close about dialog button //: Close about dialog button
id: closeButton id: closeButton
text: catalog.i18nc("@action:button","Close"); text: catalog.i18nc("@action:button", "Close")
onClicked: base.visible = false; onClicked: base.visible = false;
} }

View File

@ -4,12 +4,9 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.1
import UM 1.3 as UM import UM 1.3 as UM
import Cura 1.0 as Cura import Cura 1.5 as Cura
UM.Dialog UM.Dialog
{ {
@ -76,17 +73,13 @@ UM.Dialog
Column Column
{ {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: 20 * screenScaleFactor spacing: UM.Theme.getSize("default_margin").height
anchors.rightMargin: 20 * screenScaleFactor
anchors.bottomMargin: 10 * screenScaleFactor
spacing: 10 * screenScaleFactor
Label Label
{ {
id: questionText id: questionText
width: parent.width
text: catalog.i18nc("@text:window", "This is a Cura project file. Would you like to open it as a project or import the models from it?") text: catalog.i18nc("@text:window", "This is a Cura project file. Would you like to open it as a project or import the models from it?")
anchors.left: parent.left
anchors.right: parent.right
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }
@ -99,28 +92,20 @@ UM.Dialog
} }
} }
Item
{
ButtonGroup
{
buttons: [openAsProjectButton, importModelsButton]
checkedButton: openAsProjectButton
}
}
onAccepted: loadProjectFile() onAccepted: loadProjectFile()
onRejected: loadModelFiles() onRejected: loadModelFiles()
rightButtons: [ buttonSpacing: UM.Theme.getSize("thin_margin").width
Button
rightButtons:
[
Cura.PrimaryButton
{ {
id: openAsProjectButton
text: catalog.i18nc("@action:button", "Open as project") text: catalog.i18nc("@action:button", "Open as project")
onClicked: loadProjectFile() onClicked: loadProjectFile()
}, },
Button Cura.SecondaryButton
{ {
id: importModelsButton
text: catalog.i18nc("@action:button", "Import models") text: catalog.i18nc("@action:button", "Import models")
onClicked: loadModelFiles() onClicked: loadModelFiles()
} }

View File

@ -4,10 +4,8 @@
import Qt.labs.qmlmodels 1.0 import Qt.labs.qmlmodels 1.0
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Dialogs 1.2
import QtQuick.Window 2.1
import UM 1.2 as UM import UM 1.5 as UM
import Cura 1.6 as Cura import Cura 1.6 as Cura
UM.Dialog UM.Dialog
@ -22,7 +20,9 @@ UM.Dialog
minimumHeight: UM.Theme.getSize("popup_dialog").height minimumHeight: UM.Theme.getSize("popup_dialog").height
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
property var changesModel: Cura.UserChangesModel{ id: userChangesModel}
property var changesModel: Cura.UserChangesModel { id: userChangesModel }
onVisibilityChanged: onVisibilityChanged:
{ {
if(visible) if(visible)
@ -42,47 +42,33 @@ UM.Dialog
} }
} }
Row UM.Label
{ {
id: infoTextRow id: infoText
height: childrenRect.height text: catalog.i18nc("@text:window, %1 is a profile name", "You have customized some profile settings. Would you like to Keep these changed settings after switching profiles? Alternatively, you can discard the changes to load the defaults from '%1'.").arg(Cura.MachineManager.activeQualityDisplayNameMap["main"])
anchors.margins: UM.Theme.getSize("default_margin").width
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: UM.Theme.getSize("default_margin").width wrapMode: Text.WordWrap
UM.I18nCatalog UM.I18nCatalog
{ {
id: catalog; id: catalog
name: "cura" name: "cura"
} }
Label
{
text: catalog.i18nc("@text:window, %1 is a profile name", "You have customized some profile settings.\nWould you like to Keep these changed settings after switching profiles?\nAlternatively, you can discard the changes to load the defaults from '%1'.").arg(Cura.MachineManager.activeQualityDisplayNameMap["main"])
anchors.margins: UM.Theme.getSize("default_margin").width
wrapMode: Text.WordWrap
}
} }
Item Item
{ {
anchors.margins: UM.Theme.getSize("default_margin").width anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.top: infoTextRow.bottom anchors.top: infoText.bottom
anchors.bottom: optionRow.top anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
Cura.TableView Cura.TableView
{ {
id: tableView id: tableView
anchors anchors.fill: parent
{
top: parent.top
left: parent.left
right: parent.right
}
height: base.height - 150
columnHeaders: [ columnHeaders: [
catalog.i18nc("@title:column", "Profile settings"), catalog.i18nc("@title:column", "Profile settings"),
@ -100,15 +86,9 @@ UM.Dialog
} }
} }
Item buttonSpacing: UM.Theme.getSize("thin_margin").width
{
id: optionRow
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.margins: UM.Theme.getSize("default_margin").width
height: childrenRect.height
leftButtons: [
ComboBox ComboBox
{ {
id: discardOrKeepProfileChangesDropDownButton id: discardOrKeepProfileChangesDropDownButton
@ -145,37 +125,21 @@ UM.Dialog
} }
} }
} }
} ]
Item rightButtons:
{ [
ButtonGroup Cura.PrimaryButton
{
buttons: [discardButton, keepButton]
checkedButton: discardButton
}
}
rightButtons: [
Button
{ {
id: discardButton id: discardButton
text: catalog.i18nc("@action:button", "Discard changes"); text: catalog.i18nc("@action:button", "Discard changes")
onClicked: onClicked: base.accept()
{
CuraApplication.discardOrKeepProfileChangesClosed("discard")
base.hide()
}
}, },
Button Cura.SecondaryButton
{ {
id: keepButton id: keepButton
text: catalog.i18nc("@action:button", "Keep changes"); text: catalog.i18nc("@action:button", "Keep changes")
onClicked: onClicked: base.reject()
{
CuraApplication.discardOrKeepProfileChangesClosed("keep")
base.hide()
}
} }
] ]
} }

View File

@ -4,11 +4,9 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.1
import UM 1.3 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.5 as Cura
UM.Dialog UM.Dialog
{ {
@ -16,9 +14,9 @@ UM.Dialog
id: base id: base
title: catalog.i18nc("@title:window", "Open file(s)") title: catalog.i18nc("@title:window", "Open file(s)")
width: 420 * screenScaleFactor
height: 170 * screenScaleFactor
width: UM.Theme.getSize("small_popup_dialog").width
height: UM.Theme.getSize("small_popup_dialog").height
maximumHeight: height maximumHeight: height
maximumWidth: width maximumWidth: width
minimumHeight: height minimumHeight: height
@ -28,12 +26,6 @@ UM.Dialog
property var fileUrls: [] property var fileUrls: []
property var addToRecent: true property var addToRecent: true
property int spacerHeight: 10 * screenScaleFactor
function loadProjectFile(projectFile)
{
UM.WorkspaceFileHandler.readLocalFile(projectFile, base.addToRecent);
}
function loadModelFiles(fileUrls) function loadModelFiles(fileUrls)
{ {
@ -43,69 +35,29 @@ UM.Dialog
} }
} }
Column onAccepted: loadModelFiles(base.fileUrls)
{
anchors.fill: parent
anchors.leftMargin: 20 * screenScaleFactor
anchors.rightMargin: 20 * screenScaleFactor
anchors.bottomMargin: 20 * screenScaleFactor
anchors.left: parent.left
anchors.right: parent.right
spacing: 10 * screenScaleFactor
Label UM.Label
{ {
text: catalog.i18nc("@text:window", "We have found one or more project file(s) within the files you have selected. You can open only one project file at a time. We suggest to only import models from those files. Would you like to proceed?") text: catalog.i18nc("@text:window", "We have found one or more project file(s) within the files you have selected. You can open only one project file at a time. We suggest to only import models from those files. Would you like to proceed?")
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
font: UM.Theme.getFont("default")
wrapMode: Text.WordWrap
} }
Item // Spacer buttonSpacing: UM.Theme.getSize("thin_margin").width
{
height: base.spacerHeight
width: height
}
UM.I18nCatalog
{
id: catalog
name: "cura"
}
ButtonGroup
{
buttons: [cancelButton, importAllAsModelsButton]
checkedButton: importAllAsModelsButton
}
}
onAccepted: loadModelFiles(base.fileUrls)
// Buttons // Buttons
rightButtons: rightButtons:
[ [
Button Cura.SecondaryButton
{ {
id: cancelButton
text: catalog.i18nc("@action:button", "Cancel"); text: catalog.i18nc("@action:button", "Cancel");
onClicked: onClicked: base.reject()
{
// cancel
base.hide();
}
}, },
Button Cura.PrimaryButton
{ {
id: importAllAsModelsButton
text: catalog.i18nc("@action:button", "Import all as models"); text: catalog.i18nc("@action:button", "Import all as models");
onClicked: onClicked: base.accept()
{
// load models from all selected file
loadModelFiles(base.fileUrls);
base.hide();
}
} }
] ]
} }

View File

@ -4,7 +4,6 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.9 import QtQuick.Controls 2.9
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
@ -14,26 +13,14 @@ UM.Dialog
id: base id: base
title: catalog.i18nc("@title:window", "Save Project") title: catalog.i18nc("@title:window", "Save Project")
minimumWidth: 500 * screenScaleFactor minimumWidth: UM.Theme.getSize("popup_dialog").width
minimumHeight: 400 * screenScaleFactor minimumHeight: UM.Theme.getSize("popup_dialog").height
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
property int spacerHeight: 10 * screenScaleFactor
property bool dontShowAgain: true property bool dontShowAgain: true
signal yes(); onClosing: UM.Preferences.setValue("cura/dialog_on_project_save", !dontShowAgainCheckbox.checked)
function accept() { // pressing enter will call this function
close();
yes();
}
onClosing:
{
UM.Preferences.setValue("cura/dialog_on_project_save", !dontShowAgainCheckbox.checked)
}
onVisibleChanged: onVisibleChanged:
{ {
@ -78,7 +65,7 @@ UM.Dialog
{ {
top: mainHeading.bottom top: mainHeading.bottom
topMargin: UM.Theme.getSize("default_margin").height topMargin: UM.Theme.getSize("default_margin").height
bottom: controls.top bottom: parent.bottom
bottomMargin: UM.Theme.getSize("default_margin").height bottomMargin: UM.Theme.getSize("default_margin").height
} }
@ -280,12 +267,12 @@ UM.Dialog
} }
} }
} }
Item }
{
id: controls buttonSpacing: UM.Theme.getSize("thin_margin").width
width: parent.width
height: childrenRect.height leftButtons:
anchors.bottom: parent.bottom [
CheckBox CheckBox
{ {
id: dontShowAgainCheckbox id: dontShowAgainCheckbox
@ -293,30 +280,19 @@ UM.Dialog
text: catalog.i18nc("@action:label", "Don't show project summary on save again") text: catalog.i18nc("@action:label", "Don't show project summary on save again")
checked: dontShowAgain checked: dontShowAgain
} }
Button ]
rightButtons:
[
Cura.SecondaryButton
{ {
id: cancel_button text: catalog.i18nc("@action:button", "Cancel")
anchors onClicked: base.reject()
},
Cura.PrimaryButton
{ {
right: ok_button.left text: catalog.i18nc("@action:button", "Save")
rightMargin: UM.Theme.getSize("default_margin").width onClicked: base.accept()
}
text: catalog.i18nc("@action:button","Cancel");
enabled: true
onClicked: close()
}
Button
{
id: ok_button
anchors.right: parent.right
text: catalog.i18nc("@action:button","Save");
enabled: true
onClicked:
{
close()
yes()
}
}
}
} }
]
} }

View File

@ -1,9 +1,8 @@
// 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
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Dialogs 1.2
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.1 as Cura import Cura 1.1 as Cura
@ -58,18 +57,17 @@ Item
{ {
id: saveWorkspaceDialog id: saveWorkspaceDialog
property var args property var args
onYes: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) onAccepted: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args)
} }
MessageDialog UM.MessageDialog
{ {
id: newProjectDialog id: newProjectDialog
modality: Qt.ApplicationModal
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

@ -3,7 +3,6 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
import QtQuick.Dialogs 1.2
import QtQuick.Window 2.1 import QtQuick.Window 2.1
import UM 1.5 as UM import UM 1.5 as UM
@ -86,29 +85,34 @@ Menu
watchedProperties: [ "value" ] watchedProperties: [ "value" ]
} }
Dialog UM.Dialog
{ {
id: multiplyDialog id: multiplyDialog
modality: Qt.ApplicationModal
title: catalog.i18ncp("@title:window", "Multiply Selected Model", "Multiply Selected Models", UM.Selection.selectionCount) title: catalog.i18ncp("@title:window", "Multiply Selected Model", "Multiply Selected Models", UM.Selection.selectionCount)
width: UM.Theme.getSize("small_popup_dialog").width
height: UM.Theme.getSize("small_popup_dialog").height
minimumWidth: UM.Theme.getSize("small_popup_dialog").width
minimumHeight: UM.Theme.getSize("small_popup_dialog").height
onAccepted: CuraActions.multiplySelection(copiesField.value) onAccepted: CuraActions.multiplySelection(copiesField.value)
signal reset() buttonSpacing: UM.Theme.getSize("thin_margin").width
onReset:
{
copiesField.value = 1;
copiesField.focus = true;
}
onVisibleChanged: rightButtons:
[
Cura.SecondaryButton
{ {
copiesField.forceActiveFocus(); text: "Cancel"
onClicked: multiplyDialog.reject()
},
Cura.PrimaryButton
{
text: "Ok"
onClicked: multiplyDialog.accept()
} }
]
standardButtons: StandardButton.Ok | StandardButton.Cancel
Row Row
{ {

View File

@ -52,6 +52,6 @@ Cura.Menu
id: saveWorkspaceDialog id: saveWorkspaceDialog
property var args property var args
property var deviceId property var deviceId
onYes: UM.OutputDeviceManager.requestWriteToDevice(deviceId, PrintInformation.jobName, args) onAccepted: UM.OutputDeviceManager.requestWriteToDevice(deviceId, PrintInformation.jobName, args)
} }
} }

View File

@ -1,13 +1,12 @@
//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
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 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 +324,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

@ -136,8 +136,9 @@ UM.ManagementPage
{ {
id: confirmDialog id: confirmDialog
object: base.currentItem && base.currentItem.name ? base.currentItem.name : "" object: base.currentItem && base.currentItem.name ? base.currentItem.name : ""
text: base.currentItem ? base.currentItem.removalWarning : ""; text: base.currentItem ? base.currentItem.removalWarning : ""
onYes:
onAccepted:
{ {
Cura.MachineManager.removeMachine(base.currentItem.id) Cura.MachineManager.removeMachine(base.currentItem.id)
if(!base.currentItem) if(!base.currentItem)

View File

@ -5,7 +5,6 @@ import QtQuick 2.7
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura

View File

@ -4,7 +4,6 @@
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura

View File

@ -4,7 +4,6 @@
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura

View File

@ -310,17 +310,15 @@ Item
} }
// Dialogs // Dialogs
MessageDialog UM.MessageDialog
{ {
id: confirmRemoveMaterialDialog id: confirmRemoveMaterialDialog
icon: StandardIcon.Question;
title: catalog.i18nc("@title:window", "Confirm Remove") title: catalog.i18nc("@title:window", "Confirm Remove")
property string materialName: base.currentItem !== null ? base.currentItem.name : "" property string materialName: base.currentItem !== null ? base.currentItem.name : ""
text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(materialName) text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(materialName)
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: Dialog.Yes | Dialog.No
modality: Qt.ApplicationModal onAccepted:
onYes:
{ {
// Set the active material as the fallback. It will be selected when the current material is deleted // Set the active material as the fallback. It will be selected when the current material is deleted
base.newRootMaterialIdToSwitchTo = base.active_root_material_id base.newRootMaterialIdToSwitchTo = base.active_root_material_id
@ -340,19 +338,13 @@ Item
var result = Cura.ContainerManager.importMaterialContainer(fileUrl); var result = Cura.ContainerManager.importMaterialContainer(fileUrl);
messageDialog.title = catalog.i18nc("@title:window", "Import Material"); messageDialog.title = catalog.i18nc("@title:window", "Import Material");
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "Could not import material <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message); if(result.status == "success")
if (result.status == "success")
{ {
messageDialog.icon = StandardIcon.Information;
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully imported material <filename>%1</filename>").arg(fileUrl); messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully imported material <filename>%1</filename>").arg(fileUrl);
} }
else if (result.status == "duplicate")
{
messageDialog.icon = StandardIcon.Warning;
}
else else
{ {
messageDialog.icon = StandardIcon.Critical; messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "Could not import material <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
} }
messageDialog.open(); messageDialog.open();
CuraApplication.setDefaultPath("dialog_material_path", folder); CuraApplication.setDefaultPath("dialog_material_path", folder);
@ -371,15 +363,13 @@ Item
var result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, fileUrl); var result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, fileUrl);
messageDialog.title = catalog.i18nc("@title:window", "Export Material"); messageDialog.title = catalog.i18nc("@title:window", "Export Material");
if (result.status == "error") if(result.status == "error")
{ {
messageDialog.icon = StandardIcon.Critical;
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> and <message>!", "Failed to export material to <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message); messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> and <message>!", "Failed to export material to <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
messageDialog.open(); messageDialog.open();
} }
else if (result.status == "success") else if(result.status == "success")
{ {
messageDialog.icon = StandardIcon.Information;
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully exported material to <filename>%1</filename>").arg(result.path); messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully exported material to <filename>%1</filename>").arg(result.path);
messageDialog.open(); messageDialog.open();
} }
@ -387,7 +377,7 @@ Item
} }
} }
MessageDialog UM.MessageDialog
{ {
id: messageDialog id: messageDialog
} }

View File

@ -4,7 +4,6 @@
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.2
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura

View File

@ -5,7 +5,6 @@ import QtQuick 2.7
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura

View File

@ -119,21 +119,19 @@ 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
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 +140,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") }
@ -221,9 +217,10 @@ Item
// popup dialog to select a new color // popup dialog to select a new color
// if successful it sets the properties.color_code value to the new color // if successful it sets the properties.color_code value to the new color
ColorDialog Cura.ColorDialog
{ {
id: colorDialog id: colorDialog
title: catalog.i18nc("@title", "Material color picker")
color: properties.color_code color: properties.color_code
onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color) onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color)
} }
@ -480,6 +477,12 @@ Item
} }
} }
function updateCostPerMeter()
{
base.spoolLength = calculateSpoolLength(diameterSpinBox.value, densitySpinBox.value, spoolWeightSpinBox.value);
base.costPerMeter = calculateCostPerMeter(spoolCostSpinBox.value);
}
function calculateSpoolLength(diameter, density, spoolWeight) function calculateSpoolLength(diameter, density, spoolWeight)
{ {
if(!diameter) if(!diameter)
@ -600,10 +603,4 @@ Item
base.setMetaDataEntry("brand", old_brand, new_brand) base.setMetaDataEntry("brand", old_brand, new_brand)
properties.brand = new_brand properties.brand = new_brand
} }
function updateCostPerMeter()
{
base.spoolLength = calculateSpoolLength(diameterSpinBox.value, densitySpinBox.value, spoolWeightSpinBox.value);
base.costPerMeter = calculateCostPerMeter(spoolCostSpinBox.value);
}
} }

View File

@ -269,17 +269,16 @@ Item
} }
// Confirmation dialog for removing a profile // Confirmation dialog for removing a profile
MessageDialog UM.MessageDialog
{ {
id: confirmRemoveQualityDialog id: confirmRemoveQualityDialog
icon: StandardIcon.Question;
title: catalog.i18nc("@title:window", "Confirm Remove") title: catalog.i18nc("@title:window", "Confirm Remove")
text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItemName) text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItemName)
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: StandardButton.Yes | StandardButton.No
modality: Qt.ApplicationModal modal: true
onYes: onAccepted:
{ {
base.qualityManagementModel.removeQualityChangesGroup(base.currentItem.quality_changes_group); base.qualityManagementModel.removeQualityChangesGroup(base.currentItem.quality_changes_group);
// reset current item to the first if available // reset current item to the first if available
@ -311,19 +310,8 @@ Item
onAccepted: onAccepted:
{ {
var result = Cura.ContainerManager.importProfile(fileUrl); var result = Cura.ContainerManager.importProfile(fileUrl);
messageDialog.title = catalog.i18nc("@title:window", "Import Profile")
messageDialog.text = result.message; messageDialog.text = result.message;
if (result.status == "ok")
{
messageDialog.icon = StandardIcon.Information;
}
else if (result.status == "warning" || result.status == "duplicate")
{
messageDialog.icon = StandardIcon.Warning;
}
else
{
messageDialog.icon = StandardIcon.Critical;
}
messageDialog.open(); messageDialog.open();
CuraApplication.setDefaultPath("dialog_profile_path", folder); CuraApplication.setDefaultPath("dialog_profile_path", folder);
} }
@ -344,7 +332,7 @@ Item
if (result && result.status == "error") if (result && result.status == "error")
{ {
messageDialog.icon = StandardIcon.Critical; messageDialog.title = catalog.i18nc("@title:window", "Export Profile")
messageDialog.text = result.message; messageDialog.text = result.message;
messageDialog.open(); messageDialog.open();
} }
@ -354,6 +342,13 @@ Item
} }
} }
//Dialogue box for showing the result of importing or exporting profiles.
UM.MessageDialog
{
id: messageDialog
standardButtons: Dialog.Ok
}
Item Item
{ {
id: contentsItem id: contentsItem

View File

@ -4,7 +4,6 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.2
Item Item
{ {