Rework OS Customization

In the new flow, it doesn't make sense to _not_ save the OS
customization parameters, so remove the ComboBox.

Additionally, our data model was failing to notify the UI of changes to
the saved settings state. Due to time constraints, I'm not able to
resolve the binding in the 'correct' manner, but I can introduce a
makeshift status signalling mechanism to prevent UI inconsistency.
This commit is contained in:
Tom Dewey tom.dewey@raspberrypi.com 2023-10-17 15:21:49 +01:00
parent 50449158bc
commit ecf992cb62
4 changed files with 76 additions and 44 deletions

View file

@ -18,6 +18,8 @@ Popup {
padding: 0
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
property bool hasSavedSettings: false
signal yes()
signal no()
signal noClearSettings()
@ -105,6 +107,7 @@ Popup {
}
ImButton {
id: noAndClearButton
text: qsTr("NO, CLEAR SETTINGS")
onClicked: {
msgpopup.close()
@ -112,10 +115,11 @@ Popup {
}
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
enabled: imageWriter.hasSavedCustomizationSettings() ? true : false
enabled: false
}
ImButton {
id: yesButton
text: qsTr("YES")
onClicked: {
msgpopup.close()
@ -123,7 +127,7 @@ Popup {
}
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
enabled: imageWriter.hasSavedCustomizationSettings() ? true : false
enabled: false
}
ImButton {
@ -142,6 +146,16 @@ Popup {
function openPopup() {
open()
if (hasSavedSettings) {
/* HACK: Bizarrely, the button enabled characteristics are not re-evaluated on open.
* So, let's manually _force_ these buttons to be enabled */
yesButton.enabled = true
noAndClearButton.enabled = true
} else {
yesButton.enabled = false
noAndClearButton.enabled = false
}
// trigger screen reader to speak out message
msgpopupbody.forceActiveFocus()
}