From 9a3cab1ec2c71ec1a16370015664326324197c16 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 4 Feb 2022 13:24:14 +0100 Subject: [PATCH 01/32] Change easy dialogs to UM.MessageDialog A few fields have changed. There's also a harder one, a generic one that is re-usable. I want to do that one in a separate commit since it'll need to be checked all over the code for its usage. Contributes to issue CURA-8687. --- resources/qml/Cura.qml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index f959e62977..7e347df4ee 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"); 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 From 7f8591718db7189c8879746502e8eba8f8732d88 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 4 Feb 2022 14:31:27 +0100 Subject: [PATCH 02/32] Remove central messageBox in favour of local box The profile import/export was the only place where it was used, in our code base. Contributes to issue CURA-8687. --- cura/CuraApplication.py | 16 ------------ resources/qml/Cura.qml | 29 ---------------------- resources/qml/Preferences/ProfilesPage.qml | 22 +++++++--------- 3 files changed, 9 insertions(+), 58 deletions(-) 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/resources/qml/Cura.qml b/resources/qml/Cura.qml index 7e347df4ee..2a5f733dfb 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -813,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/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index 3d7ceeda5e..cf380b33cd 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -311,19 +311,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 +333,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 +343,13 @@ Item } } + //Dialogue box for showing the result of importing or exporting profiles. + UM.MessageDialog + { + id: messageDialog + standardButtons: Dialog.Ok + } + Item { id: contentsItem From a03988d146589c52a483fd323b73e2f1ab1a6932 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 4 Feb 2022 14:38:25 +0100 Subject: [PATCH 03/32] Replace MessageDialogs with new custom version Changing a few fields. Contributes to issue CURA-8687. --- .../Preferences/Materials/MaterialsPage.qml | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) 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 } From 2606a3b847e3a1ef96c60d20785ca56287dd541a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 4 Feb 2022 15:49:06 +0100 Subject: [PATCH 04/32] Change remaining MessageDialogs to our version Contributes to issue CURA-8687. --- .../src/qml/components/BackupListItem.qml | 15 ++++---- .../resources/qml/DiscoverUM3Action.qml | 8 ++--- .../resources/qml/MonitorContextMenu.qml | 34 ++++++++----------- resources/qml/MainWindow/ApplicationMenu.qml | 12 +++---- resources/qml/MonitorButton.qml | 12 +++---- .../Preferences/Materials/MaterialsView.qml | 13 +++---- resources/qml/Preferences/ProfilesPage.qml | 2 +- 7 files changed, 41 insertions(+), 55 deletions(-) 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/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index 30d3db0715..9c06388f4b 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,15 +280,12 @@ 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 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/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 269f918ad2..81cf25faa6 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.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 @@ -61,15 +61,15 @@ Item onYes: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) } - MessageDialog + UM.MessageDialog { id: newProjectDialog - modality: Qt.ApplicationModal + anchors.centerIn: base + 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/MonitorButton.qml b/resources/qml/MonitorButton.qml index db10b2b2bc..02c8c18f7a 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -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. import QtQuick 2.2 @@ -7,7 +7,7 @@ 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 +325,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/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index d1ea251ab8..39997659e1 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -119,21 +119,20 @@ Item width: base.width property real rowHeight: brandTextField.height + UM.Theme.getSize("default_lining").height - MessageDialog + UM.MessageDialog { id: confirmDiameterChangeDialog + anchors.centerIn: base - 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; - 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 +141,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") } diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index cf380b33cd..fb186dabf1 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -269,7 +269,7 @@ Item } // Confirmation dialog for removing a profile - MessageDialog + UM.MessageDialog { id: confirmRemoveQualityDialog From 7b8e73ae3495d85df74ea5309c54c839ba7c249d Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 7 Feb 2022 21:23:17 +0100 Subject: [PATCH 05/32] Update UM.ConfirmRemoveDialog Cura 8687 --- resources/qml/Preferences/MachinesPage.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) From f957cc289e591b7514e70dbc9816522a4179baef Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 7 Feb 2022 22:01:45 +0100 Subject: [PATCH 06/32] Fix Qt warnings resolve binding loo in `SyncState` move `updateCostPerMeter` function to root of `MaterialView` such that it is available of all sub components Cura 8687 --- resources/qml/Account/SyncState.qml | 4 ++-- .../qml/Preferences/Materials/MaterialsView.qml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/resources/qml/Account/SyncState.qml b/resources/qml/Account/SyncState.qml index f09759f845..e370c653f7 100644 --- a/resources/qml/Account/SyncState.qml +++ b/resources/qml/Account/SyncState.qml @@ -82,8 +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 - height: contentHeight + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.rightMargin: UM.Theme.getSize("default_margin").width visible: !Cura.API.account.manualSyncEnabled && !Cura.API.account.updatePackagesEnabled } diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index 39997659e1..c43b31bbcb 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -420,12 +420,6 @@ Item Item { width: parent.width; height: UM.Theme.getSize("default_margin").height } } - - function updateCostPerMeter() - { - base.spoolLength = calculateSpoolLength(diameterSpinBox.value, densitySpinBox.value, spoolWeightSpinBox.value); - base.costPerMeter = calculateCostPerMeter(spoolCostSpinBox.value); - } } ListView @@ -518,6 +512,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) From c10d7d7537a10495c7c5e1416b1b82af97420c2d Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 7 Feb 2022 22:03:37 +0100 Subject: [PATCH 07/32] Fix ProfilesPage The properties were not (fully) updated to the updated properties Cura 8687 --- resources/qml/Preferences/ProfilesPage.qml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/qml/Preferences/ProfilesPage.qml b/resources/qml/Preferences/ProfilesPage.qml index fb186dabf1..a1a88a4c0b 100644 --- a/resources/qml/Preferences/ProfilesPage.qml +++ b/resources/qml/Preferences/ProfilesPage.qml @@ -273,13 +273,12 @@ Item { 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 From 30bd9e7d6788cd11e543f46f841128421ca8ef32 Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 9 Feb 2022 11:17:19 +0100 Subject: [PATCH 08/32] Update Dialog in context menu CURA 8687 --- resources/qml/Menus/ContextMenu.qml | 34 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/resources/qml/Menus/ContextMenu.qml b/resources/qml/Menus/ContextMenu.qml index 4ca51c0974..41309ec82f 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 { From 6b85423948fdc4e749fb051685cd91526ad9324f Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 9 Feb 2022 12:31:26 +0100 Subject: [PATCH 09/32] Update `WorkSpaceSummaryDialog` CURA 8687 --- .../qml/Dialogs/WorkspaceSummaryDialog.qml | 86 +++++++------------ resources/qml/MainWindow/ApplicationMenu.qml | 2 +- resources/qml/Menus/SaveProjectMenu.qml | 2 +- 3 files changed, 33 insertions(+), 57 deletions(-) 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 81cf25faa6..7280d0b22f 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -58,7 +58,7 @@ Item { id: saveWorkspaceDialog property var args - onYes: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) + onAccepted: UM.OutputDeviceManager.requestWriteToDevice("local_file", PrintInformation.jobName, args) } UM.MessageDialog 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) } } From 8fc0fb2737c5139efa630769ec156af97861ab6e Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 9 Feb 2022 12:34:18 +0100 Subject: [PATCH 10/32] Update `AboutDialog` CURA 8687 --- resources/qml/Dialogs/AboutDialog.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/Dialogs/AboutDialog.qml b/resources/qml/Dialogs/AboutDialog.qml index e2a89ece59..95b46eeaf8 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; } From f59a23fd8269e747b87db7a185e0117b0e23aadd Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 9 Feb 2022 12:36:00 +0100 Subject: [PATCH 11/32] Update OpenFiles Dialog CURA 8687 --- .../OpenFilesIncludingProjectsDialog.qml | 76 ++++--------------- 1 file changed, 15 insertions(+), 61 deletions(-) diff --git a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml index b739ad0436..31e3b46599 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,31 @@ 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 - } + font: UM.Theme.getFont("default") + wrapMode: Text.WordWrap } - 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 From 72c038a8b118018e14ce12d8ffe82767efc12670 Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 9 Feb 2022 12:36:56 +0100 Subject: [PATCH 12/32] Update `AskOpenAsProjectOrModelsDialog` CURA 8687 --- .../AskOpenAsProjectOrModelsDialog.qml | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 deletions(-) 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() } From 6ca14ecbaea195c1d2d2cc4a13ee7abecc953ad4 Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 9 Feb 2022 13:05:48 +0100 Subject: [PATCH 13/32] Update `DiscardOrKeepProfileChangesDialog` CURA 8687 --- .../DiscardOrKeepProfileChangesDialog.qml | 70 ++++++------------- 1 file changed, 21 insertions(+), 49 deletions(-) diff --git a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml index 506dd85fac..568c84b063 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) @@ -46,7 +46,6 @@ UM.Dialog { id: infoTextRow height: childrenRect.height - anchors.margins: UM.Theme.getSize("default_margin").width anchors.left: parent.left anchors.right: parent.right spacing: UM.Theme.getSize("default_margin").width @@ -57,32 +56,27 @@ UM.Dialog name: "cura" } - Label + UM.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 + anchors.left: parent.left + anchors.right: parent.right wrapMode: Text.WordWrap } } Item { - anchors.margins: UM.Theme.getSize("default_margin").width + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.top: infoTextRow.bottom - anchors.bottom: optionRow.top + 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 +94,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 +133,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() } ] } From adcf312de741cbfc719e01f1344bde0095ec79cb Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 9 Feb 2022 13:11:17 +0100 Subject: [PATCH 14/32] Resolve Qt warnings CURA 8687 --- .../DiscardOrKeepProfileChangesDialog.qml | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml index 568c84b063..18517d5e96 100644 --- a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml +++ b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml @@ -42,33 +42,25 @@ UM.Dialog } } - Row + UM.Label { - id: infoTextRow - height: childrenRect.height + 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" } - - UM.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.left: parent.left - anchors.right: parent.right - wrapMode: Text.WordWrap - } } Item { anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.top: infoTextRow.bottom + anchors.top: infoText.bottom anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right From 1375b1c65743831e0ed6cf560afbec68fa9163be Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Wed, 9 Feb 2022 14:56:06 +0100 Subject: [PATCH 15/32] Remove unused QtQuick.Dialogs imports Cura-8687 --- plugins/PostProcessingPlugin/PostProcessingPlugin.qml | 1 - plugins/UM3NetworkPrinting/resources/qml/GenericPopUp.qml | 1 - .../resources/qml/MonitorConfigOverrideDialog.qml | 1 - resources/qml/Preferences/Materials/MaterialsBrandSection.qml | 1 - resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml | 1 - resources/qml/Preferences/Materials/MaterialsList.qml | 1 - resources/qml/Preferences/Materials/MaterialsTypeSection.qml | 1 - resources/qml/Preferences/ReadOnlySpinBox.qml | 1 - resources/qml/Preferences/ReadOnlyTextField.qml | 1 - 9 files changed, 9 deletions(-) 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/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/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/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/ReadOnlySpinBox.qml b/resources/qml/Preferences/ReadOnlySpinBox.qml index 11e47b38b2..df066ef3ab 100644 --- a/resources/qml/Preferences/ReadOnlySpinBox.qml +++ b/resources/qml/Preferences/ReadOnlySpinBox.qml @@ -3,7 +3,6 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 -import QtQuick.Dialogs 1.2 Item { 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 { From 84ecc8d16859bf4f6365d44be0d35968d76beb4f Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 9 Feb 2022 15:50:05 +0100 Subject: [PATCH 16/32] Remove unused imports CURA 8687 --- plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml | 1 - resources/qml/MainWindow/ApplicationMenu.qml | 1 - resources/qml/MonitorButton.qml | 1 - resources/qml/Preferences/Materials/MaterialsSlot.qml | 1 - 4 files changed, 4 deletions(-) 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/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 7280d0b22f..1298b6bdf1 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -3,7 +3,6 @@ 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 diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 02c8c18f7a..16c0ae086f 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -4,7 +4,6 @@ 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.5 as UM 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 From 2e1f2a37a3fafaec9557812342ed135c96f97818 Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 9 Feb 2022 16:45:34 +0100 Subject: [PATCH 17/32] Fix centering of `MessageDialog` Instead of centering in the parent the dialog is now center within the `Overlay.overlay`. This is the window container. CURA 8687 --- resources/qml/MainWindow/ApplicationMenu.qml | 1 - resources/qml/Preferences/Materials/MaterialsView.qml | 1 - 2 files changed, 2 deletions(-) diff --git a/resources/qml/MainWindow/ApplicationMenu.qml b/resources/qml/MainWindow/ApplicationMenu.qml index 1298b6bdf1..707111309c 100644 --- a/resources/qml/MainWindow/ApplicationMenu.qml +++ b/resources/qml/MainWindow/ApplicationMenu.qml @@ -63,7 +63,6 @@ Item UM.MessageDialog { id: newProjectDialog - anchors.centerIn: base 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.") diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index c43b31bbcb..14890b2d9f 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -122,7 +122,6 @@ Item UM.MessageDialog { id: confirmDiameterChangeDialog - anchors.centerIn: base 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)) From 9bad66b6ce5ed226aad3f8aa00cbc80848423a9e Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Thu, 10 Feb 2022 17:28:29 +0100 Subject: [PATCH 18/32] Add custom ColorDialog.qml with simple hex value selector. Cura-8681 --- resources/qml/Preferences/Materials/MaterialsView.qml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index 14890b2d9f..1706487bd0 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -217,7 +217,7 @@ Item // popup dialog to select a new color // if successful it sets the properties.color_code value to the new color - ColorDialog + UM.ColorDialog { id: colorDialog color: properties.color_code @@ -569,6 +569,11 @@ Item } } + function getMetaDataEntry(entry_name) + { + return + } + function setMaterialPreferenceValue(material_guid, entry_name, new_value) { if(!(material_guid in materialPreferenceValues)) From fca6ef29aead485a5cebd19f47ac876e33c07dc9 Mon Sep 17 00:00:00 2001 From: casper Date: Thu, 10 Feb 2022 18:06:43 +0100 Subject: [PATCH 19/32] Move `ColorDialog` to Cura repo Move component to the Cura repo as `Cura.SecondaryButton` and `Cura.PrimaryButton` are used. CURA 8687 --- resources/qml/ColorDialog.qml | 63 +++++++++++++++++++ .../Preferences/Materials/MaterialsView.qml | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 resources/qml/ColorDialog.qml diff --git a/resources/qml/ColorDialog.qml b/resources/qml/ColorDialog.qml new file mode 100644 index 0000000000..a7f05c4a0b --- /dev/null +++ b/resources/qml/ColorDialog.qml @@ -0,0 +1,63 @@ +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 + +UM.Dialog +{ + id: base + + 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: "Color Code (HEX)" + } + + TextField + { + id: colorInput + text: "#FFFFFF" + anchors.top: colorLabel.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height + validator: RegExpValidator { regExp: /^#([a-fA-F0-9]{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/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index 1706487bd0..4e88dbc9bd 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -217,7 +217,7 @@ Item // popup dialog to select a new color // if successful it sets the properties.color_code value to the new color - UM.ColorDialog + Cura.ColorDialog { id: colorDialog color: properties.color_code From 1eabf251f4034f799b6e65b26093ec57f24396ee Mon Sep 17 00:00:00 2001 From: casper Date: Thu, 10 Feb 2022 18:07:42 +0100 Subject: [PATCH 20/32] Remove unused function CURA 8687 --- resources/qml/Preferences/Materials/MaterialsView.qml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index 4e88dbc9bd..72a78fe03b 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -569,11 +569,6 @@ Item } } - function getMetaDataEntry(entry_name) - { - return - } - function setMaterialPreferenceValue(material_guid, entry_name, new_value) { if(!(material_guid in materialPreferenceValues)) From 91c95a0ed62c0ea7eb64d715327c2a4fe05f2f01 Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 11 Feb 2022 10:47:37 +0100 Subject: [PATCH 21/32] Remove duplicate function CURA 8687 --- resources/qml/Preferences/Materials/MaterialsView.qml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index cbbe5828bb..560c88ce4d 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -602,10 +602,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); - } } From c1d55265379987e011a2de93106a9a80863362cc Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 11 Feb 2022 11:07:51 +0100 Subject: [PATCH 22/32] Add some documentation to ColorDialog CURA-8687 --- resources/qml/ColorDialog.qml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/qml/ColorDialog.qml b/resources/qml/ColorDialog.qml index a7f05c4a0b..2b5669db5f 100644 --- a/resources/qml/ColorDialog.qml +++ b/resources/qml/ColorDialog.qml @@ -6,6 +6,11 @@ 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 From b2f3b365c958802be3a021c9ba0a6725544b8ba0 Mon Sep 17 00:00:00 2001 From: Casper Lamboo Date: Fri, 11 Feb 2022 11:31:30 +0100 Subject: [PATCH 23/32] Remove setting duplicate properties of `UM.Label` default settings Co-authored-by: Jaime van Kessel --- resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml index 31e3b46599..8e4cea1bdd 100644 --- a/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml +++ b/resources/qml/Dialogs/OpenFilesIncludingProjectsDialog.qml @@ -42,8 +42,6 @@ UM.Dialog 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 } buttonSpacing: UM.Theme.getSize("thin_margin").width From 02f648d40a13775f075e01673fdeb35ffb82ca79 Mon Sep 17 00:00:00 2001 From: Casper Lamboo Date: Fri, 11 Feb 2022 11:31:54 +0100 Subject: [PATCH 24/32] Remove superfluous semicolumn Co-authored-by: Jaime van Kessel --- resources/qml/Cura.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 2a5f733dfb..67a3617033 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -746,7 +746,7 @@ UM.MainWindow UM.MessageDialog { id: packageInstallDialog - title: catalog.i18nc("@window:title", "Install Package"); + title: catalog.i18nc("@window:title", "Install Package") standardButtons: StandardButton.Ok } From 8c0b0ddc5b67ef2525b9cfd59497ebfec838c37e Mon Sep 17 00:00:00 2001 From: Casper Lamboo Date: Fri, 11 Feb 2022 11:32:03 +0100 Subject: [PATCH 25/32] Remove superfluous semicolumn Co-authored-by: Jaime van Kessel --- resources/qml/Preferences/Materials/MaterialsView.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index 560c88ce4d..94fbe0be48 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -127,9 +127,9 @@ Item 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: 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 onAccepted: { From 5063b84c9a61ef9d24b835fcbd0c13826d7fbc8e Mon Sep 17 00:00:00 2001 From: Casper Lamboo Date: Fri, 11 Feb 2022 11:32:12 +0100 Subject: [PATCH 26/32] Remove superfluous semicolumn Co-authored-by: Jaime van Kessel --- resources/qml/Dialogs/AboutDialog.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Dialogs/AboutDialog.qml b/resources/qml/Dialogs/AboutDialog.qml index 95b46eeaf8..d917656c9f 100644 --- a/resources/qml/Dialogs/AboutDialog.qml +++ b/resources/qml/Dialogs/AboutDialog.qml @@ -169,7 +169,7 @@ UM.Dialog { //: Close about dialog button id: closeButton - text: catalog.i18nc("@action:button", "Close"); + text: catalog.i18nc("@action:button", "Close") onClicked: base.visible = false; } From 7f95dc98e6ac820adcb1d005c63e6e4007e6ad23 Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 11 Feb 2022 13:27:29 +0100 Subject: [PATCH 27/32] Translate text within the color picker CURA 8687 --- resources/qml/ColorDialog.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/qml/ColorDialog.qml b/resources/qml/ColorDialog.qml index 2b5669db5f..4f86168f7d 100644 --- a/resources/qml/ColorDialog.qml +++ b/resources/qml/ColorDialog.qml @@ -15,6 +15,8 @@ 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 @@ -29,7 +31,7 @@ UM.Dialog { id: colorLabel font: UM.Theme.getFont("large") - text: "Color Code (HEX)" + text: catalog.i18nc("@label", "Color Code (HEX)") } TextField From 2edd6349095ded52f50a0430f55b501b5ac03770 Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 11 Feb 2022 13:27:41 +0100 Subject: [PATCH 28/32] Provide a title with the color picker CURA 8687 --- resources/qml/Preferences/Materials/MaterialsView.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Preferences/Materials/MaterialsView.qml b/resources/qml/Preferences/Materials/MaterialsView.qml index 94fbe0be48..6d153f5960 100644 --- a/resources/qml/Preferences/Materials/MaterialsView.qml +++ b/resources/qml/Preferences/Materials/MaterialsView.qml @@ -220,6 +220,7 @@ Item Cura.ColorDialog { id: colorDialog + title: catalog.i18nc("@title", "Material color picker") color: properties.color_code onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color) } From 86392ab471676bde486f26662bd3e2be1e9c4e17 Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 11 Feb 2022 13:31:19 +0100 Subject: [PATCH 29/32] Remove empty file CURA 8687 --- resources/qml/Preferences/ReadOnlySpinBox.qml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 resources/qml/Preferences/ReadOnlySpinBox.qml diff --git a/resources/qml/Preferences/ReadOnlySpinBox.qml b/resources/qml/Preferences/ReadOnlySpinBox.qml deleted file mode 100644 index e69de29bb2..0000000000 From 959caece9084bce6f0ccd62f90111a3c14ed9acc Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 11 Feb 2022 13:45:03 +0100 Subject: [PATCH 30/32] Make input field in ColorDialog selectable by mouse CURA 8687 --- resources/qml/ColorDialog.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/ColorDialog.qml b/resources/qml/ColorDialog.qml index 4f86168f7d..fabd4caad3 100644 --- a/resources/qml/ColorDialog.qml +++ b/resources/qml/ColorDialog.qml @@ -38,6 +38,7 @@ UM.Dialog { id: colorInput text: "#FFFFFF" + selectByMouse: true anchors.top: colorLabel.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height validator: RegExpValidator { regExp: /^#([a-fA-F0-9]{6})$/ } From ca0d84dcaebcd19631844496e768818874ddc607 Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 11 Feb 2022 13:48:57 +0100 Subject: [PATCH 31/32] Always prefix text in ColorDialog with a hashtag CURA 8687 --- resources/qml/ColorDialog.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/qml/ColorDialog.qml b/resources/qml/ColorDialog.qml index fabd4caad3..358e8b9ef5 100644 --- a/resources/qml/ColorDialog.qml +++ b/resources/qml/ColorDialog.qml @@ -41,7 +41,13 @@ UM.Dialog selectByMouse: true anchors.top: colorLabel.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height - validator: RegExpValidator { regExp: /^#([a-fA-F0-9]{6})$/ } + onTextChanged: { + if (!text.startsWith("#")) + { + text = `#${text}`; + } + } + validator: RegExpValidator { regExp: /^#([a-fA-F0-9]{0,6})$/ } } Rectangle From 3f658a491486beece454e044ebc8d546075ba176 Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 11 Feb 2022 14:37:32 +0100 Subject: [PATCH 32/32] Change UM.Dialog to Controls.Dialog in connect to printer by ip window As `UM.Dialog` is opened using in a new window, the error-confirmation that was displayed in a `UM.Dialog` was displayed _behind_ the window object. CURA 8687 --- .../resources/qml/DiscoverUM3Action.qml | 87 ++++++++----------- 1 file changed, 37 insertions(+), 50 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml index 9c06388f4b..94e265e4b8 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/DiscoverUM3Action.qml @@ -288,7 +288,7 @@ Cura.MachineAction standardButtons: Dialog.Ok } - UM.Dialog + Dialog { id: manualPrinterDialog property string printerKey @@ -296,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; } @@ -327,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() + } } }