mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 16:59:01 +08:00
Build correct states for safe profiles flow (except actual safe).
Re-use Discard Or Keep dialogue, but have different buttons. (Safe to New/Override instead of Keep/Discard.) The actual safa action is still the old one though (for either new button, it still goes to the old 'make a new profile' action). Besides that, some cosmetics have to be done to the texts as well still. part of CURA-9347
This commit is contained in:
parent
79629e477d
commit
c13deba1ea
@ -709,8 +709,8 @@ class CuraApplication(QtApplication):
|
|||||||
self.showMessageBox.emit(title, text, informativeText, detailedText, buttons, icon)
|
self.showMessageBox.emit(title, text, informativeText, detailedText, buttons, icon)
|
||||||
|
|
||||||
showDiscardOrKeepProfileChanges = pyqtSignal()
|
showDiscardOrKeepProfileChanges = pyqtSignal()
|
||||||
|
showCompareAndSaveProfileChanges = pyqtSignal(str)
|
||||||
|
|
||||||
@pyqtSlot()
|
|
||||||
def discardOrKeepProfileChanges(self) -> bool:
|
def discardOrKeepProfileChanges(self) -> bool:
|
||||||
has_user_interaction = False
|
has_user_interaction = False
|
||||||
choice = self.getPreferences().getValue("cura/choice_on_profile_override")
|
choice = self.getPreferences().getValue("cura/choice_on_profile_override")
|
||||||
|
@ -816,11 +816,13 @@ UM.MainWindow
|
|||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
target: CuraApplication
|
target: CuraApplication
|
||||||
function onShowDiscardOrKeepProfileChanges()
|
function onShowCompareAndSaveProfileChanges(profileState)
|
||||||
{
|
{
|
||||||
discardOrKeepProfileChangesDialogLoader.sourceComponent = discardOrKeepProfileChangesDialogComponent
|
discardOrKeepProfileChangesDialogLoader.sourceComponent = discardOrKeepProfileChangesDialogComponent
|
||||||
|
discardOrKeepProfileChangesDialogLoader.item.state = profileState
|
||||||
discardOrKeepProfileChangesDialogLoader.item.show()
|
discardOrKeepProfileChangesDialogLoader.item.show()
|
||||||
}
|
}
|
||||||
|
function onShowDiscardOrKeepProfileChanges() { onShowCompareAndSaveProfileChanges("") }
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.WizardDialog
|
Cura.WizardDialog
|
||||||
|
@ -12,8 +12,10 @@ UM.Dialog
|
|||||||
id: base
|
id: base
|
||||||
title: catalog.i18nc("@title:window", "Discard or Keep changes")
|
title: catalog.i18nc("@title:window", "Discard or Keep changes")
|
||||||
|
|
||||||
onAccepted: CuraApplication.discardOrKeepProfileChangesClosed("discard")
|
property alias state: alternateStates.state
|
||||||
onRejected: CuraApplication.discardOrKeepProfileChangesClosed("keep")
|
|
||||||
|
onAccepted: alternateStates.state == "" ? CuraApplication.discardOrKeepProfileChangesClosed("discard") : Cura.Actions.addProfile.trigger()
|
||||||
|
onRejected: alternateStates.state == "" ? CuraApplication.discardOrKeepProfileChangesClosed("keep") : Cura.Actions.addProfile.trigger()
|
||||||
|
|
||||||
minimumWidth: UM.Theme.getSize("popup_dialog").width
|
minimumWidth: UM.Theme.getSize("popup_dialog").width
|
||||||
minimumHeight: UM.Theme.getSize("popup_dialog").height
|
minimumHeight: UM.Theme.getSize("popup_dialog").height
|
||||||
@ -98,9 +100,26 @@ UM.Dialog
|
|||||||
|
|
||||||
buttonSpacing: UM.Theme.getSize("thin_margin").width
|
buttonSpacing: UM.Theme.getSize("thin_margin").width
|
||||||
|
|
||||||
leftButtons: [
|
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
|
Cura.ComboBox
|
||||||
{
|
{
|
||||||
|
visible: alternateStates.state == ""
|
||||||
|
|
||||||
implicitHeight: UM.Theme.getSize("combobox").height
|
implicitHeight: UM.Theme.getSize("combobox").height
|
||||||
implicitWidth: UM.Theme.getSize("combobox").width
|
implicitWidth: UM.Theme.getSize("combobox").width
|
||||||
|
|
||||||
@ -136,6 +155,13 @@ UM.Dialog
|
|||||||
discardButton.enabled = true;
|
discardButton.enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
// Workaround: If this placeholder isn't in here, then on repeated state-changes of the window, the rightButtons will be in the center (despite initially showing up right).
|
||||||
|
visible: alternateStates.state != ""
|
||||||
|
implicitHeight: UM.Theme.getSize("combobox").height
|
||||||
|
implicitWidth: UM.Theme.getSize("combobox").width
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -146,12 +172,28 @@ UM.Dialog
|
|||||||
id: discardButton
|
id: discardButton
|
||||||
text: catalog.i18nc("@action:button", "Discard changes")
|
text: catalog.i18nc("@action:button", "Discard changes")
|
||||||
onClicked: base.accept()
|
onClicked: base.accept()
|
||||||
|
visible: alternateStates.state == ""
|
||||||
},
|
},
|
||||||
Cura.SecondaryButton
|
Cura.SecondaryButton
|
||||||
{
|
{
|
||||||
id: keepButton
|
id: keepButton
|
||||||
text: catalog.i18nc("@action:button", "Keep changes")
|
text: catalog.i18nc("@action:button", "Keep changes")
|
||||||
onClicked: base.reject()
|
onClicked: base.reject()
|
||||||
|
visible: alternateStates.state == ""
|
||||||
|
},
|
||||||
|
Cura.SecondaryButton
|
||||||
|
{
|
||||||
|
id: overwriteButton
|
||||||
|
text: catalog.i18nc("@action:button", "Save as new custom profile")
|
||||||
|
onClicked: base.accept()
|
||||||
|
visible: alternateStates.state != ""
|
||||||
|
},
|
||||||
|
Cura.PrimaryButton
|
||||||
|
{
|
||||||
|
id: saveButton
|
||||||
|
text: catalog.i18nc("@action:button", "Save changes")
|
||||||
|
onClicked: base.reject()
|
||||||
|
visible: alternateStates.state == "saveFromCustom"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ Item
|
|||||||
hoverColor: UM.Theme.getColor("primary_hover")
|
hoverColor: UM.Theme.getColor("primary_hover")
|
||||||
|
|
||||||
enabled: Cura.SimpleModeSettingsManager.isProfileCustomized
|
enabled: Cura.SimpleModeSettingsManager.isProfileCustomized
|
||||||
onClicked: Cura.MachineManager.hasCustomQuality ? CuraApplication.discardOrKeepProfileChanges() : Cura.Actions.addProfile.trigger()
|
onClicked: CuraApplication.showCompareAndSaveProfileChanges(Cura.MachineManager.hasCustomQuality ? "saveFromCustom" : "saveFromBuiltIn")
|
||||||
|
|
||||||
UM.ToolTip
|
UM.ToolTip
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user