Merge pull request #677 from tdewey-rpi/dev/shared/os-customization

OS customization rebrand, consistency
This commit is contained in:
Tom Dewey 2023-10-18 10:36:19 +01:00 committed by GitHub
commit 338b71112e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 193 additions and 144 deletions

View file

@ -197,8 +197,8 @@ On macOS, disable it by editing the property list for the application:
defaults write org.raspberrypi.Imager.plist telemetry -bool NO
```
### Advanced options
### OS Customization
When using the app, press <kbd>CTRL</kbd> + <kbd>SHIFT</kbd> + <kbd>X</kbd> to reveal the **Advanced options** dialog.
When using the app, press <kbd>CTRL</kbd> + <kbd>SHIFT</kbd> + <kbd>X</kbd> to reveal the **OS Customization** dialog.
In here, you can specify several things you would otherwise set in the boot configuration files. For example, you can enable SSH, set the Wi-Fi login, and specify your locale settings for the system image.

View file

@ -24,6 +24,6 @@ index 568d1cd..9e36607 100644
+ function raise() { }
+ /* */
+
title: qsTr("Advanced options")
title: qsTr("OS Customization")
property bool initialized: false

View file

@ -17,7 +17,7 @@ Window {
maximumWidth: width
minimumHeight: 125
height: Math.min(750, cl.implicitHeight)
title: qsTr("Advanced options")
title: qsTr("OS Customization")
property bool initialized: false
property bool hasSavedSettings: false
@ -29,6 +29,8 @@ Window {
property string cloudinitwrite
property string cloudinitnetwork
signal saveSettingsSignal(var settings)
ColumnLayout {
id: cl
spacing: 10
@ -46,23 +48,6 @@ Window {
//ScrollBar.vertical.policy: ScrollBar.AlwaysOn
ColumnLayout {
RowLayout {
Label {
text: qsTr("Image customization options")
}
ComboBox {
id: comboSaveSettings
model: {
[qsTr("for this session only"),
qsTr("to always use")]
}
Layout.minimumWidth: 250
Layout.maximumHeight: 40
enabled: !imageWriter.isEmbeddedMode()
}
}
TabBar {
id: bar
Layout.fillWidth: true
@ -453,7 +438,6 @@ Window {
fieldKeyboardLayout.model = imageWriter.getKeymapLayoutList()
if (Object.keys(settings).length) {
comboSaveSettings.currentIndex = 1
hasSavedSettings = true
}
if ('hostname' in settings) {
@ -539,7 +523,7 @@ Window {
/* Lacking an easy cross-platform to fetch keyboard layout
from host system, just default to "gb" for people in
UK time zone for now, and "us" for everyone else */
if (tz == "Europe/London") {
if (tz === "Europe/London") {
fieldKeyboardLayout.currentIndex = fieldKeyboardLayout.find("gb")
} else {
fieldKeyboardLayout.currentIndex = fieldKeyboardLayout.find("us")
@ -807,8 +791,6 @@ Window {
function saveSettings()
{
if (comboSaveSettings.currentIndex == 1) {
hasSavedSettings = true
var settings = { };
if (chkHostname.checked && fieldHostname.length) {
settings.hostname = fieldHostname.text
@ -835,15 +817,59 @@ Window {
settings.keyboardLayout = fieldKeyboardLayout.editText
}
imageWriter.setSavedCustomizationSettings(settings)
} else if (hasSavedSettings) {
imageWriter.clearSavedCustomizationSettings()
hasSavedSettings = false
}
imageWriter.setSetting("beep", chkBeep.checked)
imageWriter.setSetting("eject", chkEject.checked)
imageWriter.setSetting("telemetry", chkTelemtry.checked)
if (chkHostname.checked || chkSetUser.checked || chkSSH.checked || chkWifi.checked || chkLocale.checked) {
/* OS customization to be applied. */
hasSavedSettings = true
saveSettingsSignal(settings)
}
}
function clearCustomizationFields()
{
/* Bind copies of the lists */
fieldTimezone.model = imageWriter.getTimezoneList()
fieldKeyboardLayout.model = imageWriter.getKeymapLayoutList()
fieldWifiCountry.model = imageWriter.getCountryList()
fieldHostname.text = "raspberrypi"
fieldUserName.text = imageWriter.getCurrentUser()
fieldUserPassword.clear()
radioPubKeyAuthentication.checked = false
radioPasswordAuthentication.checked = false
fieldPublicKey.clear()
/* Timezone Settings*/
fieldTimezone.currentIndex = fieldTimezone.find(imageWriter.getTimezone())
/* Lacking an easy cross-platform to fetch keyboard layout
from host system, just default to "gb" for people in
UK time zone for now, and "us" for everyone else */
if (imageWriter.getTimezone() === "Europe/London") {
fieldKeyboardLayout.currentIndex = fieldKeyboardLayout.find("gb")
} else {
fieldKeyboardLayout.currentIndex = fieldKeyboardLayout.find("us")
}
chkSetUser.checked = false
chkSSH.checked = false
chkLocale.checked = false
chkWifiSSIDHidden.checked = false
chkHostname.checked = false
/* WiFi Settings */
fieldWifiSSID.text = imageWriter.getSSID()
if (fieldWifiSSID.text.length) {
fieldWifiPassword.text = imageWriter.getPSK()
if (fieldWifiPassword.text.length) {
chkShowPassword.checked = false
if (Qt.platform.os == "osx") {
/* User indicated wifi must be prefilled */
chkWifi.checked = true
}
}
}
}
}

View file

@ -18,6 +18,8 @@ Popup {
padding: 0
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
property bool hasSavedSettings: false
signal yes()
signal no()
signal noClearSettings()
@ -70,7 +72,7 @@ Popup {
Layout.topMargin: 10
font.family: roboto.name
font.bold: true
text: qsTr("Use image customisation?")
text: qsTr("Use OS customization?")
}
Text {
@ -85,7 +87,7 @@ Popup {
Layout.topMargin: 25
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Accessible.name: text.replace(/<\/?[^>]+(>|$)/g, "")
text: qsTr("Would you like to apply image customization settings?")
text: qsTr("Would you like to apply OS customization settings?")
}
RowLayout {
@ -94,38 +96,6 @@ Popup {
spacing: 20
id: buttons
ImButton {
text: qsTr("NO")
onClicked: {
msgpopup.close()
msgpopup.no()
}
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
}
ImButton {
text: qsTr("NO, CLEAR SETTINGS")
onClicked: {
msgpopup.close()
msgpopup.noClearSettings()
}
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
enabled: imageWriter.hasSavedCustomizationSettings() ? true : false
}
ImButton {
text: qsTr("YES")
onClicked: {
msgpopup.close()
msgpopup.yes()
}
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
enabled: imageWriter.hasSavedCustomizationSettings() ? true : false
}
ImButton {
text: qsTr("EDIT SETTINGS")
onClicked: {
@ -136,12 +106,56 @@ Popup {
Material.background: "#c51a4a"
}
ImButton {
id: noAndClearButton
text: qsTr("NO, CLEAR SETTINGS")
onClicked: {
msgpopup.close()
msgpopup.noClearSettings()
}
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
enabled: false
}
ImButton {
id: yesButton
text: qsTr("YES")
onClicked: {
msgpopup.close()
msgpopup.yes()
}
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
enabled: false
}
ImButton {
text: qsTr("NO")
onClicked: {
msgpopup.close()
msgpopup.no()
}
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
}
Text { text: " " }
}
}
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()
}

View file

@ -282,13 +282,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation>Opcions avançades</translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation>Opcions de personalització de les imatges</translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -319,13 +319,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation>Erweiterte Optionen</translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation>OS-Modifizierungen</translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -278,12 +278,12 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>

View file

@ -282,13 +282,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation>Opciones avanzadas</translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation>Opciones de personalización de imagen</translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -318,13 +318,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation>Réglages avancés</translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation>Options de personnalisation de l&apos;image</translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -319,13 +319,13 @@ Aggiungi sia &apos;rpi-imager.exe&apos; che &apos;fat32format.exe&apos; all&apos
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation>Opzioni avanzate</translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation>Opzioni personalizzazione immagine</translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -318,13 +318,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation></translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation></translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -318,13 +318,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation> </translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation> </translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -318,13 +318,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation>Geavanceerde instellingen</translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation>Image instellingen</translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -318,13 +318,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation>Дополнительные параметры</translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation>Параметры настройки образа</translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -318,13 +318,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation>Pokročilé možnosti</translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation>Možnosti úprav obrazu</translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -318,13 +318,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation>Napredne možnosti</translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation>Uporabi opcije prilagoditve slike diska</translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -290,12 +290,12 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>

View file

@ -282,13 +282,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation>Розширені налаштування</translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation>Налаштування образу</translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -306,13 +306,13 @@
<name>OptionsPopup</name>
<message>
<location filename="../OptionsPopup.qml" line="20"/>
<source>Advanced options</source>
<translation></translation>
<source>OS customization</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="52"/>
<source>Image customization options</source>
<translation></translation>
<source>OS customization options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../OptionsPopup.qml" line="57"/>

View file

@ -1039,6 +1039,7 @@ void ImageWriter::setSavedCustomizationSettings(const QVariantMap &map)
_settings.setValue(key, map.value(key));
}
_settings.endGroup();
_settings.sync();
}
QVariantMap ImageWriter::getSavedCustomizationSettings()
@ -1060,10 +1061,12 @@ void ImageWriter::clearSavedCustomizationSettings()
_settings.beginGroup("imagecustomization");
_settings.remove("");
_settings.endGroup();
_settings.sync();
}
bool ImageWriter::hasSavedCustomizationSettings()
{
_settings.sync();
_settings.beginGroup("imagecustomization");
bool result = !_settings.childKeys().isEmpty();
_settings.endGroup();

View file

@ -1183,6 +1183,10 @@ ApplicationWindow {
OptionsPopup {
id: optionspopup
onSaveSettingsSignal: {
imageWriter.setSavedCustomizationSettings(settings)
usesavedsettingspopup.hasSavedSettings = true
}
}
UseSavedSettingsPopup {
@ -1196,6 +1200,8 @@ ApplicationWindow {
confirmwritepopup.askForConfirmation()
}
onNoClearSettings: {
hasSavedSettings = false
optionspopup.clearCustomizationFields()
imageWriter.clearSavedCustomizationSettings()
confirmwritepopup.askForConfirmation()
}