From 00e945434453841c09269e0384bffe7b1d047ef1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 23 Jul 2020 23:26:15 +0200 Subject: [PATCH] [localeq] Hook up to Config object - get network status from the global Network object; document that - get the strings describing the language and LC settings from the config-object instead of roll-our-own - use the model of supported locales from Config to populate listboxes - connect selection of language or LC to the Config object --- src/modules/localeq/i18n.qml | 20 +++++++------------- src/modules/localeq/localeq.qml | 7 ++++--- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/modules/localeq/i18n.qml b/src/modules/localeq/i18n.qml index a806d0174..eea9864a3 100644 --- a/src/modules/localeq/i18n.qml +++ b/src/modules/localeq/i18n.qml @@ -32,10 +32,6 @@ Item { anchors.fill: parent } - //Needs to come from Locale config - property var confLang: "en_US.UTF8" - property var confLocale: "nl_NL.UTF8" - Rectangle { id: textArea x: 28 @@ -57,7 +53,7 @@ Item { width: 240 wrapMode: Text.WordWrap text: qsTr("

Languages


- The system locale setting affects the language and character set for some command line user interface elements. The current setting is %1.").arg(confLang) + The system locale setting affects the language and character set for some command line user interface elements. The current setting is %1.").arg(config.currentLanguageCode) font.pointSize: 10 } } @@ -76,8 +72,7 @@ Item { id: list1 focus: true - // bogus entries, need to come from Locale config - model: ["en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8"] + model: config.supportedLocales currentIndex: 1 highlight: Rectangle { @@ -95,17 +90,17 @@ Item { } onClicked: { list1.currentIndex = index - confLang = list1.currentIndex } } } + onCurrentItemChanged: { config.currentLanguageCode = model[currentIndex] } /* This works because model is a stringlist */ } } } } Column { - id: i18n + id: lc_numeric x: 430 y: 40 @@ -118,7 +113,7 @@ Item { width: 240 wrapMode: Text.WordWrap text: qsTr("

Locales


- The system locale setting affects the language and character set for some command line user interface elements. The current setting is %1.").arg(confLocale) + The system locale setting affects the numbers and dates format. The current setting is %1.").arg(config.currentLCCode) font.pointSize: 10 } } @@ -139,7 +134,7 @@ Item { focus: true // bogus entries, need to come from Locale config - model: ["en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8", "en_GB.UTF-8 UTF-8", "en_US.UTF-8 UTF-8 ", "nl_NL.UTF-8 UTF-8"] + model: config.supportedLocales currentIndex: 2 highlight: Rectangle { @@ -154,11 +149,10 @@ Item { cursorShape: Qt.PointingHandCursor onClicked: { list2.currentIndex = index - confLocale = list1.currentIndex } } } - onCurrentItemChanged: console.debug(currentIndex) + onCurrentItemChanged: { config.currentLCCode = model[currentIndex]; } /* This works because model is a stringlist */ } } } diff --git a/src/modules/localeq/localeq.qml b/src/modules/localeq/localeq.qml index df82b1f9b..c48140d12 100644 --- a/src/modules/localeq/localeq.qml +++ b/src/modules/localeq/localeq.qml @@ -37,7 +37,8 @@ Page { anchors.horizontalCenter: parent.horizontalCenter width: parent.width height: parent.height / 1.28 - source: (Network.hasInternet) ? "Map.qml" : "Offline.qml" + // Network is in io.calamares.core + source: Network.hasInternet ? "Map.qml" : "Offline.qml" } RowLayout { @@ -67,7 +68,7 @@ Page { Label { Layout.fillWidth: true wrapMode: Text.WordWrap - text: qsTr("System language set to %1").arg(confLang) + text: config.currentLanguageStatus } Kirigami.Separator { Layout.fillWidth: true @@ -75,7 +76,7 @@ Page { Label { Layout.fillWidth: true wrapMode: Text.WordWrap - text: qsTr("Numbers and dates locale set to %1").arg(confLocale) + text: config.currentLCStatus } } Button {