diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 8939aec07a..7f9f0ef68d 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -709,7 +709,7 @@ class CuraApplication(QtApplication): self.showMessageBox.emit(title, text, informativeText, detailedText, buttons, icon) showDiscardOrKeepProfileChanges = pyqtSignal() - showCompareAndSaveProfileChanges = pyqtSignal(str) + showCompareAndSaveProfileChanges = pyqtSignal(int) def discardOrKeepProfileChanges(self) -> bool: has_user_interaction = False diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index b70fc087ed..8ae3c01c71 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -804,10 +804,13 @@ UM.MainWindow function onShowCompareAndSaveProfileChanges(profileState) { discardOrKeepProfileChangesDialogLoader.sourceComponent = discardOrKeepProfileChangesDialogComponent - discardOrKeepProfileChangesDialogLoader.item.state = profileState + discardOrKeepProfileChangesDialogLoader.item.buttonState = profileState discardOrKeepProfileChangesDialogLoader.item.show() } - function onShowDiscardOrKeepProfileChanges() { onShowCompareAndSaveProfileChanges("") } + function onShowDiscardOrKeepProfileChanges() + { + onShowCompareAndSaveProfileChanges(DiscardOrKeepProfileChangesDialog.ButtonsType.DiscardOrKeep) + } } Cura.WizardDialog diff --git a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml index 1876f926a7..8dbe18ccff 100644 --- a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml +++ b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml @@ -12,10 +12,13 @@ UM.Dialog id: base title: catalog.i18nc("@title:window", "Discard or Keep changes") - property alias state: alternateStates.state + enum ButtonsType { DiscardOrKeep, SaveFromBuiltIn, SaveFromCustom} + property int buttonState: DiscardOrKeepProfileChangesDialog.ButtonsType.DiscardOrKeep - onAccepted: alternateStates.state == "" ? CuraApplication.discardOrKeepProfileChangesClosed("discard") : Cura.Actions.addProfile.trigger() - onRejected: alternateStates.state == "" ? CuraApplication.discardOrKeepProfileChangesClosed("keep") : Cura.Actions.updateProfile.trigger() + onAccepted: buttonState == DiscardOrKeepProfileChangesDialog.ButtonsType.DiscardOrKeep ? + CuraApplication.discardOrKeepProfileChangesClosed("discard") : Cura.Actions.addProfile.trigger() + onRejected: buttonState == DiscardOrKeepProfileChangesDialog.ButtonsType.DiscardOrKeep ? + CuraApplication.discardOrKeepProfileChangesClosed("keep") : Cura.Actions.updateProfile.trigger() minimumWidth: UM.Theme.getSize("popup_dialog").width minimumHeight: UM.Theme.getSize("popup_dialog").height @@ -100,25 +103,11 @@ UM.Dialog buttonSpacing: UM.Theme.getSize("thin_margin").width - Rectangle - { - // Use a rectangle to get access to states. For some reason top-levels like Dialog/Window ect. don't have them. - // NOTE: The default state is 'switch profiles', alternate states are used for 'save from [built-in|custom]'. - id: alternateStates - width: 0 - height: 0 - states: - [ - State { name: "saveFromBuiltIn" }, - State { name: "saveFromCustom" } - ] - } - leftButtons: [ Cura.ComboBox { - visible: alternateStates.state == "" + visible: buttonState == DiscardOrKeepProfileChangesDialog.ButtonsType.DiscardOrKeep implicitHeight: UM.Theme.getSize("combobox").height implicitWidth: UM.Theme.getSize("combobox").width @@ -165,27 +154,27 @@ UM.Dialog id: discardButton text: catalog.i18nc("@action:button", "Discard changes") onClicked: base.accept() - visible: alternateStates.state == "" + visible: buttonState == DiscardOrKeepProfileChangesDialog.ButtonsType.DiscardOrKeep }, Cura.SecondaryButton { id: keepButton text: catalog.i18nc("@action:button", "Keep changes") onClicked: base.reject() - visible: alternateStates.state == "" + visible: buttonState == DiscardOrKeepProfileChangesDialog.ButtonsType.DiscardOrKeep }, Cura.SecondaryButton { id: overwriteButton text: catalog.i18nc("@action:button", "Save as new custom profile") - visible: alternateStates.state != "" + visible: buttonState != DiscardOrKeepProfileChangesDialog.ButtonsType.DiscardOrKeep onClicked: base.accept() }, Cura.PrimaryButton { id: saveButton text: catalog.i18nc("@action:button", "Save changes") - visible: alternateStates.state == "saveFromCustom" + visible: buttonState == DiscardOrKeepProfileChangesDialog.ButtonsType.SaveFromCustom onClicked: base.reject() } ] diff --git a/resources/qml/Dialogs/RenameDialog.qml b/resources/qml/Dialogs/RenameDialog.qml index eae3bff098..52cfe3a26e 100644 --- a/resources/qml/Dialogs/RenameDialog.qml +++ b/resources/qml/Dialogs/RenameDialog.qml @@ -24,6 +24,8 @@ UM.Dialog property string explanation: catalog.i18nc("@info", "Please provide a new name.") property string okButtonText: catalog.i18nc("@action:button", "OK") + // Extra Information for the user about the current rename can go here, can be left alone if not needed. + // For example; An icon and a text-field and a tertiary button providing a link. property list extraInfo title: dialogTitle diff --git a/resources/qml/PrintSetupSelector/ProfileWarningReset.qml b/resources/qml/PrintSetupSelector/ProfileWarningReset.qml index bd85f2dac6..6c498cbb3c 100644 --- a/resources/qml/PrintSetupSelector/ProfileWarningReset.qml +++ b/resources/qml/PrintSetupSelector/ProfileWarningReset.qml @@ -6,6 +6,8 @@ import QtQuick 2.10 import UM 1.6 as UM import Cura 1.6 as Cura +import "../Dialogs" + Item { property bool fullWarning: true // <- Can you see the warning icon and the text, or is it just the buttons? @@ -144,7 +146,12 @@ Item hoverColor: UM.Theme.getColor("primary_hover") enabled: Cura.SimpleModeSettingsManager.isProfileCustomized - onClicked: CuraApplication.showCompareAndSaveProfileChanges(Cura.MachineManager.hasCustomQuality ? "saveFromCustom" : "saveFromBuiltIn") + onClicked: CuraApplication.showCompareAndSaveProfileChanges + ( + Cura.MachineManager.hasCustomQuality ? + DiscardOrKeepProfileChangesDialog.ButtonsType.SaveFromCustom : + DiscardOrKeepProfileChangesDialog.ButtonsType.SaveFromBuiltIn + ) UM.ToolTip {