diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index ca708709aa..9145cd771e 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -675,22 +675,6 @@ class CuraApplication(QtApplication): self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing Active Machine...")) 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() def discardOrKeepProfileChanges(self) -> bool: diff --git a/plugins/CuraDrive/src/qml/components/BackupListItem.qml b/plugins/CuraDrive/src/qml/components/BackupListItem.qml index ced85d53bd..41e3fb0bf6 100644 --- a/plugins/CuraDrive/src/qml/components/BackupListItem.qml +++ b/plugins/CuraDrive/src/qml/components/BackupListItem.qml @@ -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. import QtQuick 2.7 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.1 import UM 1.5 as UM import Cura 1.0 as Cura @@ -88,21 +87,21 @@ Item anchors.top: dataRow.bottom } - MessageDialog + UM.MessageDialog { id: confirmDeleteDialog 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.") - standardButtons: StandardButton.Yes | StandardButton.No - onYes: CuraDrive.deleteBackup(modelData.backup_id) + standardButtons: Dialog.Yes | Dialog.No + onAccepted: CuraDrive.deleteBackup(modelData.backup_id) } - MessageDialog + UM.MessageDialog { id: confirmRestoreDialog 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?") - standardButtons: StandardButton.Yes | StandardButton.No - onYes: CuraDrive.restoreBackup(modelData.backup_id) + standardButtons: Dialog.Yes | Dialog.No + onAccepted: CuraDrive.restoreBackup(modelData.backup_id) } } diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml index d4ed30dea6..cee80f288e 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.qml +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.qml @@ -5,7 +5,6 @@ import QtQuick 2.2 import QtQuick.Controls 2.15 import QtQml.Models 2.15 as Models import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 import QtQuick.Window 2.2 import UM 1.5 as UM diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index 30d3db0715..94e265e4b8 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -8,7 +8,6 @@ import QtQuick 2.2 import QtQuick.Controls 2.9 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 -import QtQuick.Dialogs 1.2 Cura.MachineAction { @@ -281,18 +280,15 @@ Cura.MachineAction } } - MessageDialog + UM.MessageDialog { 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") text: catalog.i18nc("@text", "Please enter a valid IP address.") - icon: StandardIcon.Warning - standardButtons: StandardButton.Ok + standardButtons: Dialog.Ok } - UM.Dialog + Dialog { id: manualPrinterDialog property string printerKey @@ -300,17 +296,18 @@ Cura.MachineAction title: catalog.i18nc("@title:window", "Printer Address") - minimumWidth: 400 * screenScaleFactor - minimumHeight: 130 * screenScaleFactor - width: minimumWidth - height: minimumHeight + width: UM.Theme.getSize("small_popup_dialog").width + + anchors.centerIn: Overlay.overlay + + standardButtons: Dialog.Yes | Dialog.No signal showDialog(string key, string address) onShowDialog: { printerKey = key; addressText = address; - manualPrinterDialog.show(); + manualPrinterDialog.open(); addressField.selectAll(); addressField.focus = true; } @@ -331,54 +328,40 @@ Cura.MachineAction { id: addressField width: parent.width - validator: RegExpValidator - { - regExp: /[a-zA-Z0-9\.\-\_]*/ - } - + validator: RegExpValidator { regExp: /[a-zA-Z0-9\.\-\_]*/ } onAccepted: btnOk.clicked() } } - rightButtons: [ - Button { - text: catalog.i18nc("@action:button","Cancel") - onClicked: - { - manualPrinterDialog.reject() - manualPrinterDialog.hide() - } - }, - Button { - id: btnOk - text: catalog.i18nc("@action:button", "OK") - onClicked: - { - // Validate the input first - if (!networkingUtil.isValidIP(manualPrinterDialog.addressText)) - { - invalidIPAddressMessageDialog.open() - return - } - - // if the entered IP address has already been discovered, switch the current item to that item - // and do nothing else. - for (var i = 0; i < manager.foundDevices.length; i++) - { - var device = manager.foundDevices[i] - if (device.address == manualPrinterDialog.addressText) - { - currentItemIndex = i - manualPrinterDialog.hide() - return - } - } - - manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) - manualPrinterDialog.hide() - } - enabled: manualPrinterDialog.addressText.trim() != "" + onRejected: + { + manualPrinterDialog.reject() + manualPrinterDialog.hide() + } + onAccepted: + { + // Validate the input first + if (!networkingUtil.isValidIP(manualPrinterDialog.addressText)) + { + invalidIPAddressMessageDialog.open() + return } - ] + + // if the entered IP address has already been discovered, switch the current item to that item + // and do nothing else. + for (var i = 0; i < manager.foundDevices.length; i++) + { + var device = manager.foundDevices[i] + if (device.address == manualPrinterDialog.addressText) + { + currentItemIndex = i + manualPrinterDialog.hide() + return + } + } + + manager.setManualDevice(manualPrinterDialog.printerKey, manualPrinterDialog.addressText) + manualPrinterDialog.hide() + } } } diff --git a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml index 6b03072e04..580338ae0c 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml @@ -3,7 +3,6 @@ import QtQuick 2.2 import QtQuick.Controls 2.0 -import QtQuick.Dialogs 1.1 import QtGraphicalEffects 1.0 import UM 1.3 as UM diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml index 690c50c275..343e3f79e1 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorConfigOverrideDialog.qml @@ -4,7 +4,6 @@ import QtQuick 2.3 import QtQuick.Controls 2.4 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 import UM 1.5 as UM UM.Dialog diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml index 34ca3c6df2..d95ca8a88e 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorContextMenu.qml @@ -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. import QtQuick 2.3 -import QtQuick.Controls 2.0 -import QtQuick.Dialogs 1.1 -import UM 1.3 as UM +import QtQuick.Controls 2.15 +import UM 1.5 as UM /** * 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 - Component.onCompleted: visible = false - icon: StandardIcon.Warning - onYes: OutputDevice.sendJobToTop(printJob.key) - standardButtons: StandardButton.Yes | StandardButton.No + onAccepted: OutputDevice.sendJobToTop(printJob.key) + standardButtons: Dialog.Yes | Dialog.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) : "" title: catalog.i18nc("@window:title", "Move print job to top") } - MessageDialog { + UM.MessageDialog + { id: deleteConfirmationDialog - Component.onCompleted: visible = false - icon: StandardIcon.Warning - onYes: OutputDevice.deleteJobFromQueue(printJob.key) - standardButtons: StandardButton.Yes | StandardButton.No + onAccepted: OutputDevice.deleteJobFromQueue(printJob.key) + standardButtons: Dialog.Yes | Dialog.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) : "" title: catalog.i18nc("@window:title", "Delete print job") } - MessageDialog { + UM.MessageDialog + { id: abortConfirmationDialog - Component.onCompleted: visible = false - icon: StandardIcon.Warning - onYes: printJob.setState("abort") - standardButtons: StandardButton.Yes | StandardButton.No + onAccepted: printJob.setState("abort") + standardButtons: Dialog.Yes | Dialog.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) : "" title: catalog.i18nc("@window:title", "Abort print") } diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index e115cb14ee..3297b16beb 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -3,7 +3,6 @@ import QtQuick 2.3 import QtQuick.Controls 2.0 -import QtQuick.Dialogs 1.1 import UM 1.5 as UM import Cura 1.0 as Cura diff --git a/resources/qml/Account/SyncState.qml b/resources/qml/Account/SyncState.qml index dedb0d597c..e5731ff9d7 100644 --- a/resources/qml/Account/SyncState.qml +++ b/resources/qml/Account/SyncState.qml @@ -82,7 +82,8 @@ Row // Sync state icon + message id: stateLabel // text is determined by State 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 height: contentHeight visible: !Cura.API.account.manualSyncEnabled && !Cura.API.account.updatePackagesEnabled diff --git a/resources/qml/ColorDialog.qml b/resources/qml/ColorDialog.qml new file mode 100644 index 0000000000..358e8b9ef5 --- /dev/null +++ b/resources/qml/ColorDialog.qml @@ -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() + } + ] +} \ No newline at end of file diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index f959e62977..67a3617033 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -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. import QtQuick 2.7 @@ -253,7 +253,6 @@ UM.MainWindow // Try to install plugin & close. CuraApplication.installPackageViaDragAndDrop(filename); packageInstallDialog.text = catalog.i18nc("@label", "This package will be installed after restarting."); - packageInstallDialog.icon = StandardIcon.Information; packageInstallDialog.open(); } else @@ -586,18 +585,15 @@ UM.MainWindow } } - MessageDialog + UM.MessageDialog { id: exitConfirmationDialog 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) - icon: StandardIcon.Question - modality: Qt.ApplicationModal - standardButtons: StandardButton.Yes | StandardButton.No - onYes: CuraApplication.callConfirmExitDialogCallback(true) - onNo: CuraApplication.callConfirmExitDialogCallback(false) + standardButtons: Dialog.Yes | Dialog.No + onAccepted: CuraApplication.callConfirmExitDialogCallback(true) onRejected: CuraApplication.callConfirmExitDialogCallback(false) - onVisibilityChanged: + onClosed: { if (!visible) { @@ -747,20 +743,18 @@ UM.MainWindow } } - MessageDialog + UM.MessageDialog { id: packageInstallDialog - title: catalog.i18nc("@window:title", "Install Package"); + title: catalog.i18nc("@window:title", "Install Package") standardButtons: StandardButton.Ok - modality: Qt.ApplicationModal } - MessageDialog + UM.MessageDialog { id: infoMultipleFilesWithGcodeDialog title: catalog.i18nc("@title:window", "Open File(s)") - icon: StandardIcon.Information - standardButtons: StandardButton.Ok + standardButtons: Dialog.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.") 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 { id: discardOrKeepProfileChangesDialogComponent diff --git a/resources/qml/Dialogs/AboutDialog.qml b/resources/qml/Dialogs/AboutDialog.qml index e2a89ece59..d917656c9f 100644 --- a/resources/qml/Dialogs/AboutDialog.qml +++ b/resources/qml/Dialogs/AboutDialog.qml @@ -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. import QtQuick 2.2 import QtQuick.Controls 2.9 -import QtQuick.Window 2.1 import UM 1.5 as UM +import Cura 1.5 as Cura UM.Dialog { @@ -165,11 +165,11 @@ UM.Dialog } } - rightButtons: Button + rightButtons: Cura.SecondaryButton { //: Close about dialog button id: closeButton - text: catalog.i18nc("@action:button","Close"); + text: catalog.i18nc("@action:button", "Close") onClicked: base.visible = false; } diff --git a/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml b/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml index 725b25e1e1..b398f2e584 100644 --- a/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml +++ b/resources/qml/Dialogs/AskOpenAsProjectOrModelsDialog.qml @@ -4,12 +4,9 @@ import QtQuick 2.2 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 -import QtQuick.Window 2.1 import UM 1.3 as UM -import Cura 1.0 as Cura - +import Cura 1.5 as Cura UM.Dialog { @@ -76,17 +73,13 @@ UM.Dialog Column { anchors.fill: parent - anchors.leftMargin: 20 * screenScaleFactor - anchors.rightMargin: 20 * screenScaleFactor - anchors.bottomMargin: 10 * screenScaleFactor - spacing: 10 * screenScaleFactor + spacing: UM.Theme.getSize("default_margin").height Label { 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?") - anchors.left: parent.left - anchors.right: parent.right font: UM.Theme.getFont("default") wrapMode: Text.WordWrap } @@ -99,28 +92,20 @@ UM.Dialog } } - Item - { - ButtonGroup - { - buttons: [openAsProjectButton, importModelsButton] - checkedButton: openAsProjectButton - } - } - onAccepted: loadProjectFile() onRejected: loadModelFiles() - rightButtons: [ - Button + buttonSpacing: UM.Theme.getSize("thin_margin").width + + rightButtons: + [ + Cura.PrimaryButton { - id: openAsProjectButton text: catalog.i18nc("@action:button", "Open as project") onClicked: loadProjectFile() }, - Button + Cura.SecondaryButton { - id: importModelsButton text: catalog.i18nc("@action:button", "Import models") onClicked: loadModelFiles() } diff --git a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml index 506dd85fac..18517d5e96 100644 --- a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml +++ b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml @@ -4,10 +4,8 @@ import Qt.labs.qmlmodels 1.0 import QtQuick 2.1 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 UM.Dialog @@ -22,7 +20,9 @@ UM.Dialog minimumHeight: UM.Theme.getSize("popup_dialog").height width: minimumWidth height: minimumHeight - property var changesModel: Cura.UserChangesModel{ id: userChangesModel} + + property var changesModel: Cura.UserChangesModel { id: userChangesModel } + onVisibilityChanged: { if(visible) @@ -42,47 +42,33 @@ UM.Dialog } } - Row + UM.Label { - id: infoTextRow - height: childrenRect.height - anchors.margins: UM.Theme.getSize("default_margin").width + id: infoText + 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.left: parent.left anchors.right: parent.right - spacing: UM.Theme.getSize("default_margin").width + wrapMode: Text.WordWrap UM.I18nCatalog { - id: catalog; + id: catalog 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 { - anchors.margins: UM.Theme.getSize("default_margin").width - anchors.top: infoTextRow.bottom - anchors.bottom: optionRow.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.top: infoText.bottom + anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right Cura.TableView { id: tableView - anchors - { - top: parent.top - left: parent.left - right: parent.right - } - height: base.height - 150 + anchors.fill: parent columnHeaders: [ catalog.i18nc("@title:column", "Profile settings"), @@ -100,15 +86,9 @@ UM.Dialog } } - Item - { - 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 + buttonSpacing: UM.Theme.getSize("thin_margin").width + leftButtons: [ ComboBox { id: discardOrKeepProfileChangesDropDownButton @@ -145,37 +125,21 @@ UM.Dialog } } } - } + ] - Item - { - ButtonGroup - { - buttons: [discardButton, keepButton] - checkedButton: discardButton - } - } - - rightButtons: [ - Button + rightButtons: + [ + Cura.PrimaryButton { id: discardButton - text: catalog.i18nc("@action:button", "Discard changes"); - onClicked: - { - CuraApplication.discardOrKeepProfileChangesClosed("discard") - base.hide() - } + text: catalog.i18nc("@action:button", "Discard changes") + onClicked: base.accept() }, - Button + Cura.SecondaryButton { id: keepButton - text: catalog.i18nc("@action:button", "Keep changes"); - onClicked: - { - CuraApplication.discardOrKeepProfileChangesClosed("keep") - base.hide() - } + text: catalog.i18nc("@action:button", "Keep changes") + onClicked: base.reject() } ] } diff --git a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml index b739ad0436..8e4cea1bdd 100644 --- a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml +++ b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml @@ -4,11 +4,9 @@ import QtQuick 2.2 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.1 -import QtQuick.Window 2.1 -import UM 1.3 as UM -import Cura 1.0 as Cura +import UM 1.5 as UM +import Cura 1.5 as Cura UM.Dialog { @@ -16,9 +14,9 @@ UM.Dialog id: base 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 maximumWidth: width minimumHeight: height @@ -28,12 +26,6 @@ UM.Dialog property var fileUrls: [] property var addToRecent: true - property int spacerHeight: 10 * screenScaleFactor - - function loadProjectFile(projectFile) - { - UM.WorkspaceFileHandler.readLocalFile(projectFile, base.addToRecent); - } function loadModelFiles(fileUrls) { @@ -43,69 +35,29 @@ UM.Dialog } } - Column + onAccepted: loadModelFiles(base.fileUrls) + + UM.Label { - anchors.fill: parent - anchors.leftMargin: 20 * screenScaleFactor - anchors.rightMargin: 20 * screenScaleFactor - anchors.bottomMargin: 20 * screenScaleFactor + 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.right: parent.right - spacing: 10 * screenScaleFactor - - 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?") - anchors.left: parent.left - anchors.right: parent.right - font: UM.Theme.getFont("default") - wrapMode: Text.WordWrap - } - - Item // Spacer - { - height: base.spacerHeight - width: height - } - - UM.I18nCatalog - { - id: catalog - name: "cura" - } - - ButtonGroup - { - buttons: [cancelButton, importAllAsModelsButton] - checkedButton: importAllAsModelsButton - } } - onAccepted: loadModelFiles(base.fileUrls) + buttonSpacing: UM.Theme.getSize("thin_margin").width // Buttons rightButtons: [ - Button + Cura.SecondaryButton { - id: cancelButton text: catalog.i18nc("@action:button", "Cancel"); - onClicked: - { - // cancel - base.hide(); - } + onClicked: base.reject() }, - Button + Cura.PrimaryButton { - id: importAllAsModelsButton text: catalog.i18nc("@action:button", "Import all as models"); - onClicked: - { - // load models from all selected file - loadModelFiles(base.fileUrls); - base.hide(); - } + onClicked: base.accept() } ] } \ No newline at end of file diff --git a/resources/qml/Dialogs/WorkspaceSummaryDialog.qml b/resources/qml/Dialogs/WorkspaceSummaryDialog.qml index 5278168a77..27a7fd734f 100644 --- a/resources/qml/Dialogs/WorkspaceSummaryDialog.qml +++ b/resources/qml/Dialogs/WorkspaceSummaryDialog.qml @@ -4,7 +4,6 @@ import QtQuick 2.10 import QtQuick.Controls 2.9 import QtQuick.Layouts 1.3 -import QtQuick.Window 2.2 import UM 1.5 as UM import Cura 1.0 as Cura @@ -14,26 +13,14 @@ UM.Dialog id: base title: catalog.i18nc("@title:window", "Save Project") - minimumWidth: 500 * screenScaleFactor - minimumHeight: 400 * screenScaleFactor + minimumWidth: UM.Theme.getSize("popup_dialog").width + minimumHeight: UM.Theme.getSize("popup_dialog").height width: minimumWidth height: minimumHeight - property int spacerHeight: 10 * screenScaleFactor - property bool dontShowAgain: true - signal yes(); - - function accept() { // pressing enter will call this function - close(); - yes(); - } - - onClosing: - { - UM.Preferences.setValue("cura/dialog_on_project_save", !dontShowAgainCheckbox.checked) - } + onClosing: UM.Preferences.setValue("cura/dialog_on_project_save", !dontShowAgainCheckbox.checked) onVisibleChanged: { @@ -78,7 +65,7 @@ UM.Dialog { top: mainHeading.bottom topMargin: UM.Theme.getSize("default_margin").height - bottom: controls.top + bottom: parent.bottom bottomMargin: UM.Theme.getSize("default_margin").height } @@ -280,43 +267,32 @@ UM.Dialog } } } - Item - { - id: controls - width: parent.width - height: childrenRect.height - anchors.bottom: parent.bottom - CheckBox - { - id: dontShowAgainCheckbox - anchors.left: parent.left - text: catalog.i18nc("@action:label", "Don't show project summary on save again") - checked: dontShowAgain - } - Button - { - id: cancel_button - anchors - { - right: ok_button.left - rightMargin: UM.Theme.getSize("default_margin").width - } - 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() - } - } - } } + + buttonSpacing: UM.Theme.getSize("thin_margin").width + + leftButtons: + [ + CheckBox + { + id: dontShowAgainCheckbox + anchors.left: parent.left + text: catalog.i18nc("@action:label", "Don't show project summary on save again") + checked: dontShowAgain + } + ] + + rightButtons: + [ + Cura.SecondaryButton + { + text: catalog.i18nc("@action:button", "Cancel") + onClicked: base.reject() + }, + Cura.PrimaryButton + { + text: catalog.i18nc("@action:button", "Save") + onClicked: base.accept() + } + ] } diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 269f918ad2..707111309c 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -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. import QtQuick 2.7 import QtQuick.Controls 2.4 -import QtQuick.Dialogs 1.2 import UM 1.5 as UM import Cura 1.1 as Cura @@ -58,18 +57,17 @@ Item { id: saveWorkspaceDialog 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 - modality: Qt.ApplicationModal + 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.") - standardButtons: StandardButton.Yes | StandardButton.No - icon: StandardIcon.Question - onYes: + standardButtons: Dialog.Yes | Dialog.No + onAccepted: { CuraApplication.resetWorkspace() Cura.Actions.resetProfile.trigger() diff --git a/resources/qml/Menus/ContextMenu.qml b/resources/qml/Menus/ContextMenu.qml index 16ce00fa05..30e1d206f7 100644 --- a/resources/qml/Menus/ContextMenu.qml +++ b/resources/qml/Menus/ContextMenu.qml @@ -3,7 +3,6 @@ import QtQuick 2.2 import QtQuick.Controls 2.1 -import QtQuick.Dialogs 1.2 import QtQuick.Window 2.1 import UM 1.5 as UM @@ -86,29 +85,34 @@ Menu watchedProperties: [ "value" ] } - Dialog + UM.Dialog { id: multiplyDialog - modality: Qt.ApplicationModal 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) - signal reset() - onReset: - { - copiesField.value = 1; - copiesField.focus = true; - } + buttonSpacing: UM.Theme.getSize("thin_margin").width - onVisibleChanged: - { - copiesField.forceActiveFocus(); - } - - standardButtons: StandardButton.Ok | StandardButton.Cancel + rightButtons: + [ + Cura.SecondaryButton + { + text: "Cancel" + onClicked: multiplyDialog.reject() + }, + Cura.PrimaryButton + { + text: "Ok" + onClicked: multiplyDialog.accept() + } + ] Row { diff --git a/resources/qml/Menus/SaveProjectMenu.qml b/resources/qml/Menus/SaveProjectMenu.qml index 3f43289993..16d54382d1 100644 --- a/resources/qml/Menus/SaveProjectMenu.qml +++ b/resources/qml/Menus/SaveProjectMenu.qml @@ -52,6 +52,6 @@ Cura.Menu id: saveWorkspaceDialog property var args property var deviceId - onYes: UM.OutputDeviceManager.requestWriteToDevice(deviceId, PrintInformation.jobName, args) + onAccepted: UM.OutputDeviceManager.requestWriteToDevice(deviceId, PrintInformation.jobName, args) } } diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index db10b2b2bc..16c0ae086f 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -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. import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 -import QtQuick.Dialogs 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 Item @@ -325,16 +324,14 @@ Item onClicked: confirmationDialog.visible = true } - MessageDialog + UM.MessageDialog { id: confirmationDialog title: catalog.i18nc("@window:title", "Abort print") - icon: StandardIcon.Warning text: catalog.i18nc("@label", "Are you sure you want to abort the print?") - standardButtons: StandardButton.Yes | StandardButton.No - Component.onCompleted: visible = false - onYes: activePrintJob.setState("abort") + standardButtons: Dialog.Yes | Dialog.No + onAccepted: activePrintJob.setState("abort") } } } diff --git a/resources/qml/Preferences/MachinesPage.qml b/resources/qml/Preferences/MachinesPage.qml index 166e6c4346..48f53169f3 100644 --- a/resources/qml/Preferences/MachinesPage.qml +++ b/resources/qml/Preferences/MachinesPage.qml @@ -136,8 +136,9 @@ UM.ManagementPage { id: confirmDialog object: base.currentItem && base.currentItem.name ? base.currentItem.name : "" - text: base.currentItem ? base.currentItem.removalWarning : ""; - onYes: + text: base.currentItem ? base.currentItem.removalWarning : "" + + onAccepted: { Cura.MachineManager.removeMachine(base.currentItem.id) if(!base.currentItem) diff --git a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml index f0747e697c..1e1ae088e8 100644 --- a/resources/qml/Preferences/Materials/MaterialsBrandSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsBrandSection.qml @@ -5,7 +5,6 @@ import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 import UM 1.5 as UM import Cura 1.0 as Cura diff --git a/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml b/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml index e821dfb955..04c722cd40 100644 --- a/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml +++ b/resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml @@ -4,7 +4,6 @@ import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 import UM 1.2 as UM import Cura 1.0 as Cura diff --git a/resources/qml/Preferences/Materials/MaterialsList.qml b/resources/qml/Preferences/Materials/MaterialsList.qml index 2e09ad58d9..6cbb42ad15 100644 --- a/resources/qml/Preferences/Materials/MaterialsList.qml +++ b/resources/qml/Preferences/Materials/MaterialsList.qml @@ -4,7 +4,6 @@ import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 import UM 1.2 as UM import Cura 1.0 as Cura diff --git a/resources/qml/Preferences/Materials/MaterialsPage.qml b/resources/qml/Preferences/Materials/MaterialsPage.qml index 819e3a4f8c..dbcef6c573 100644 --- a/resources/qml/Preferences/Materials/MaterialsPage.qml +++ b/resources/qml/Preferences/Materials/MaterialsPage.qml @@ -310,17 +310,15 @@ Item } // Dialogs - MessageDialog + UM.MessageDialog { id: confirmRemoveMaterialDialog - icon: StandardIcon.Question; title: catalog.i18nc("@title:window", "Confirm Remove") 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) - standardButtons: StandardButton.Yes | StandardButton.No - modality: Qt.ApplicationModal - onYes: + standardButtons: Dialog.Yes | Dialog.No + onAccepted: { // Set the active material as the fallback. It will be selected when the current material is deleted base.newRootMaterialIdToSwitchTo = base.active_root_material_id @@ -340,19 +338,13 @@ Item var result = Cura.ContainerManager.importMaterialContainer(fileUrl); messageDialog.title = catalog.i18nc("@title:window", "Import Material"); - messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags or !", "Could not import material %1: %2").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 !", "Successfully imported material %1").arg(fileUrl); } - else if (result.status == "duplicate") - { - messageDialog.icon = StandardIcon.Warning; - } else { - messageDialog.icon = StandardIcon.Critical; + messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags or !", "Could not import material %1: %2").arg(fileUrl).arg(result.message); } messageDialog.open(); CuraApplication.setDefaultPath("dialog_material_path", folder); @@ -371,15 +363,13 @@ Item var result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, fileUrl); 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 and !", "Failed to export material to %1: %2").arg(fileUrl).arg(result.message); 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 !", "Successfully exported material to %1").arg(result.path); messageDialog.open(); } @@ -387,7 +377,7 @@ Item } } - MessageDialog + UM.MessageDialog { id: messageDialog } diff --git a/resources/qml/Preferences/Materials/MaterialsSlot.qml b/resources/qml/Preferences/Materials/MaterialsSlot.qml index 52728181b6..cd8c05fbf9 100644 --- a/resources/qml/Preferences/Materials/MaterialsSlot.qml +++ b/resources/qml/Preferences/Materials/MaterialsSlot.qml @@ -4,7 +4,6 @@ import QtQuick 2.7 import QtQuick.Controls 2.1 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 import UM 1.2 as UM import Cura 1.0 as Cura diff --git a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml index d1d424b290..0f438cf7e7 100644 --- a/resources/qml/Preferences/Materials/MaterialsTypeSection.qml +++ b/resources/qml/Preferences/Materials/MaterialsTypeSection.qml @@ -5,7 +5,6 @@ import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.2 import UM 1.5 as UM import Cura 1.0 as Cura diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index 6511812057..6d153f5960 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -119,21 +119,19 @@ Item width: base.width property real rowHeight: brandTextField.height + UM.Theme.getSize("default_lining").height - MessageDialog + UM.MessageDialog { id: confirmDiameterChangeDialog - icon: StandardIcon.Question; 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)) - standardButtons: StandardButton.Yes | StandardButton.No - modality: Qt.ApplicationModal + standardButtons: Dialog.Yes | Dialog.No - property var new_diameter_value: null; - property var old_diameter_value: null; - property var old_approximate_diameter_value: null; + property var new_diameter_value: null + property var old_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("properties/diameter", properties.diameter, new_diameter_value); @@ -142,13 +140,11 @@ Item base.resetSelectedMaterial() } - onNo: + onRejected: { base.properties.diameter = old_diameter_value; 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") } @@ -221,9 +217,10 @@ Item // popup dialog to select a new color // if successful it sets the properties.color_code value to the new color - ColorDialog + Cura.ColorDialog { id: colorDialog + title: catalog.i18nc("@title", "Material color picker") color: properties.color_code 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) { if(!diameter) @@ -600,10 +603,4 @@ Item base.setMetaDataEntry("brand", old_brand, new_brand) properties.brand = new_brand } - - function updateCostPerMeter() - { - base.spoolLength = calculateSpoolLength(diameterSpinBox.value, densitySpinBox.value, spoolWeightSpinBox.value); - base.costPerMeter = calculateCostPerMeter(spoolCostSpinBox.value); - } } diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 3d7ceeda5e..a1a88a4c0b 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -269,17 +269,16 @@ Item } // Confirmation dialog for removing a profile - MessageDialog + UM.MessageDialog { id: confirmRemoveQualityDialog - icon: StandardIcon.Question; 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) standardButtons: StandardButton.Yes | StandardButton.No - modality: Qt.ApplicationModal + modal: true - onYes: + onAccepted: { base.qualityManagementModel.removeQualityChangesGroup(base.currentItem.quality_changes_group); // reset current item to the first if available @@ -311,19 +310,8 @@ Item onAccepted: { var result = Cura.ContainerManager.importProfile(fileUrl); + messageDialog.title = catalog.i18nc("@title:window", "Import Profile") 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(); CuraApplication.setDefaultPath("dialog_profile_path", folder); } @@ -344,7 +332,7 @@ Item if (result && result.status == "error") { - messageDialog.icon = StandardIcon.Critical; + messageDialog.title = catalog.i18nc("@title:window", "Export Profile") messageDialog.text = result.message; 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 { id: contentsItem diff --git a/resources/qml/Preferences/ReadOnlyTextField.qml b/resources/qml/Preferences/ReadOnlyTextField.qml index 38d07d7d6a..6f5a66d2a9 100644 --- a/resources/qml/Preferences/ReadOnlyTextField.qml +++ b/resources/qml/Preferences/ReadOnlyTextField.qml @@ -4,7 +4,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 -import QtQuick.Dialogs 1.2 Item {