From abdfeaa96c1feae02551c12aa2037fb8ffc3b2aa Mon Sep 17 00:00:00 2001 From: demmm Date: Fri, 26 Aug 2022 15:43:47 +0200 Subject: [PATCH] [localeq] move to using Drawer for fine tuning options i18n.qml no longer needed add color setting options to localeq.qml Offline.qml updated to be inline with keyboardq UI, set index number according to default America/New York --- src/modules/localeq/Offline.qml | 45 ++-- src/modules/localeq/i18n.qml | 204 --------------- .../localeq/img/chevron-left-solid.svg | 1 - .../img/chevron-left-solid.svg.license | 2 - src/modules/localeq/localeq.qml | 234 +++++++++++++++--- src/modules/localeq/localeq.qrc | 2 - 6 files changed, 224 insertions(+), 264 deletions(-) delete mode 100644 src/modules/localeq/i18n.qml delete mode 100644 src/modules/localeq/img/chevron-left-solid.svg delete mode 100644 src/modules/localeq/img/chevron-left-solid.svg.license diff --git a/src/modules/localeq/Offline.qml b/src/modules/localeq/Offline.qml index 937554cf6..4683dfbc3 100644 --- a/src/modules/localeq/Offline.qml +++ b/src/modules/localeq/Offline.qml @@ -25,6 +25,12 @@ Page { property string currentRegion property string currentZone + readonly property color backgroundColor: Kirigami.Theme.backgroundColor //"#F5F5F5" + readonly property color backgroundLighterColor: "#ffffff" + readonly property color highlightColor: Kirigami.Theme.highlightColor //"#3498DB" + readonly property color textColor: Kirigami.Theme.textColor + readonly property color highlightedTextColor: Kirigami.Theme.highlightedTextColor + StackView { id: stack anchors.fill: parent @@ -36,7 +42,7 @@ Page { id: region anchors.horizontalCenter: parent.horizontalCenter - color: Kirigami.Theme.textColor + color: textColor horizontalAlignment: Text.AlignCenter text: qsTr("Select your preferred Region, or use the default settings.") } @@ -61,18 +67,16 @@ Page { z: parent.z - 1 anchors.fill: parent - color: "#BDC3C7" - radius: 5 - opacity: 0.7 + color: backgroundLighterColor } model: config.regionModel - currentIndex: -1 + currentIndex: 1 // offline install, means locale from config delegate: ItemDelegate { hoverEnabled: true width: parent.width - height: 30 + height: 28 highlighted: ListView.isCurrentItem Label { @@ -81,13 +85,13 @@ Page { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter width: parent.width - height: 30 - color: highlighted ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor + height: 28 + color: highlighted ? highlightedTextColor : textColor background: Rectangle { - color: highlighted || hovered ? Kirigami.Theme.highlightColor : "white" //Kirigami.Theme.backgroundColor - opacity: highlighted || hovered ? 0.5 : 0.3 + color: highlighted || hovered ? highlightColor : backgroundLighterColor + opacity: highlighted || hovered ? 0.5 : 1 } } @@ -112,7 +116,7 @@ Page { id: zone anchors.horizontalCenter: parent.horizontalCenter - color: Kirigami.Theme.textColor + color: textColor text: qsTr("Select your preferred Zone within your Region.") } @@ -136,18 +140,19 @@ Page { z: parent.z - 1 anchors.fill: parent - color: "#BDC3C7" - radius: 5 - opacity: 0.7 + color: backgroundLighterColor + //radius: 5 + //opacity: 0.7 } model: config.regionalZonesModel - currentIndex : -1 + currentIndex : 99 // index of New York + Component.onCompleted: positionViewAtIndex(currentIndex, ListView.Center) delegate: ItemDelegate { hoverEnabled: true width: parent.width - height: 30 + height: 24 highlighted: ListView.isCurrentItem Label { @@ -156,13 +161,13 @@ Page { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter width: parent.width - height: 30 - color: highlighted ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor + height: 24 + color: highlighted ? highlightedTextColor : textColor background: Rectangle { - color: highlighted || hovered ? Kirigami.Theme.highlightColor : "white" //Kirigami.Theme.backgroundColor - opacity: highlighted || hovered ? 0.5 : 0.3 + color: highlighted || hovered ? highlightColor : backgroundLighterColor + opacity: highlighted || hovered ? 0.5 : 1 } } diff --git a/src/modules/localeq/i18n.qml b/src/modules/localeq/i18n.qml deleted file mode 100644 index 3ceae2ab8..000000000 --- a/src/modules/localeq/i18n.qml +++ /dev/null @@ -1,204 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2020 - 2021 Anke Boersma - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -import io.calamares.ui 1.0 - -import QtQuick 2.7 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 - -import org.kde.kirigami 2.7 as Kirigami - -Item { - readonly property color backgroundColor: Kirigami.Theme.backgroundColor //"#F5F5F5" - readonly property color headerBackgroundColor: Kirigami.Theme.alternateBackgroundColor //"#d3d3d3" - readonly property color backgroundLighterColor: "#ffffff" - readonly property color highlightColor: Kirigami.Theme.highlightColor //"#3498DB" - readonly property color textColor: Kirigami.Theme.textColor - readonly property color highlightedTextColor: Kirigami.Theme.highlightedTextColor - - width: parent.width - height: parent.height - focus: true - - Rectangle { - id: textArea - x: 28 - y: 14 - anchors.fill: parent - color: backgroundColor - - Column { - id: languages - x: 130 - y: 40 - - Rectangle { - width: 250 - height: 140 - color: headerBackgroundColor - Text { - anchors.top: parent.top - 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(config.currentLanguageCode) - font.pointSize: 10 - } - } - - Rectangle { - width: 250 - height: 300 - - ScrollView { - id: scroll1 - anchors.fill: parent - contentHeight: 800 - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - - ListView { - id: list1 - focus: true - clip: true - width: parent.width - - model: config.supportedLocales - - currentIndex: -1 //model.currentLanguageCodeIndex - delegate: ItemDelegate { - - hoverEnabled: true - width: parent.width - implicitHeight: 18 - highlighted: ListView.isCurrentItem - Label { - Layout.fillHeight: true - Layout.fillWidth: true - width: parent.width - height: 18 - color: highlighted ? highlightedTextColor : textColor - text: modelData - background: Rectangle { - - color: highlighted || hovered ? highlightColor : backgroundLighterColor - opacity: highlighted || hovered ? 0.5 : 0.9 - } - - MouseArea { - hoverEnabled: true - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: { - list1.currentIndex = index - } - } - } - } - onCurrentItemChanged: { config.currentLanguageCode = model[currentIndex] } /* This works because model is a stringlist */ - } - } - } - } - - Column { - id: lc_numeric - x: 430 - y: 40 - - Rectangle { - width: 250 - height: 140 - color: headerBackgroundColor - Text { - anchors.top: parent.top - width: 240 - wrapMode: Text.WordWrap - text: qsTr("

Locales


- The system locale setting affects the numbers and dates format. The current setting is %1.").arg(config.currentLCCode) - font.pointSize: 10 - } - } - - Rectangle { - width: 250 - height: 300 - - ScrollView { - id: scroll2 - anchors.fill: parent - contentHeight: 800 - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - - ListView { - id: list2 - focus: true - clip: true - - model: config.supportedLocales - - currentIndex: -1 //model.currentLCCodeIndex - delegate: ItemDelegate { - - hoverEnabled: true - width: parent.width - implicitHeight: 18 - highlighted: ListView.isCurrentItem - Label { - Layout.fillHeight: true - Layout.fillWidth: true - width: parent.width - height: 18 - color: highlighted ? highlightedTextColor : textColor - text: modelData - background: Rectangle { - - color: highlighted || hovered ? highlightColor : backgroundLighterColor - opacity: highlighted || hovered ? 0.5 : 0.9 - } - - MouseArea { - hoverEnabled: true - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: { - list2.currentIndex = index - } - } - } - } - onCurrentItemChanged: { config.currentLCCode = model[currentIndex]; } /* This works because model is a stringlist */ - } - } - } - - } - - ToolButton { - id: toolButton - x: 19 - y: 29 - width: 105 - height: 48 - text: qsTr("Back") - hoverEnabled: true - onClicked: load.source = "" - - Image { - id: image1 - x: 0 - y: 13 - width: 22 - height: 22 - source: "img/chevron-left-solid.svg" - fillMode: Image.PreserveAspectFit - } - } - } -} diff --git a/src/modules/localeq/img/chevron-left-solid.svg b/src/modules/localeq/img/chevron-left-solid.svg deleted file mode 100644 index 41061c287..000000000 --- a/src/modules/localeq/img/chevron-left-solid.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/modules/localeq/img/chevron-left-solid.svg.license b/src/modules/localeq/img/chevron-left-solid.svg.license deleted file mode 100644 index 5a578a8a2..000000000 --- a/src/modules/localeq/img/chevron-left-solid.svg.license +++ /dev/null @@ -1,2 +0,0 @@ -SPDX-FileCopyrightText: 2020 https://github.com/FortAwesome/Font-Awesome -SPDX-License-Identifier: CC-BY-4.0 diff --git a/src/modules/localeq/localeq.qml b/src/modules/localeq/localeq.qml index dbaa09034..c109adbb7 100644 --- a/src/modules/localeq/localeq.qml +++ b/src/modules/localeq/localeq.qml @@ -1,7 +1,7 @@ /* === This file is part of Calamares - === * * SPDX-FileCopyrightText: 2020 Adriaan de Groot - * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-FileCopyrightText: 2020 - 2022 Anke Boersma * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is Free Software: see the License-Identifier above. @@ -17,8 +17,15 @@ import QtQuick.Layouts 1.3 import org.kde.kirigami 2.7 as Kirigami Page { - width: 800 - height: 550 + id: root + width: parent.width + height: parent.height + + readonly property color headerBackgroundColor: Kirigami.Theme.alternateBackgroundColor //"#eff0f1" + readonly property color backgroundLighterColor: "#ffffff" + readonly property color highlightColor: Kirigami.Theme.highlightColor //"#3498DB" + readonly property color textColor: Kirigami.Theme.textColor //"#1F1F1F" + readonly property color highlightedTextColor: Kirigami.Theme.highlightedTextColor function onActivate() { /* If you want the map to follow Calamares's GeoIP @@ -41,52 +48,209 @@ Page { anchors.bottom: parent.bottom anchors.bottomMargin : 20 width: parent.width + spacing: 50 - Kirigami.FormLayout { - id: lang + GridLayout { + rowSpacing: Kirigami.Units.largeSpacing + columnSpacing: Kirigami.Units.largeSpacing - GridLayout { - anchors { - left: parent.left - top: parent.top - right: parent.right + Kirigami.Icon { + source: "qrc:/img/locale.svg" + Layout.fillHeight: true + Layout.maximumHeight: Kirigami.Units.iconSizes.large + Layout.preferredWidth: height + } + + ColumnLayout { + Label { + Layout.fillWidth: true + wrapMode: Text.WordWrap + text: config.currentLanguageStatus } - rowSpacing: Kirigami.Units.largeSpacing - columnSpacing: Kirigami.Units.largeSpacing - - Image { - source: "img/locale.svg" - Layout.fillHeight: true - Layout.maximumHeight: Kirigami.Units.iconSizes.medium - Layout.preferredWidth: height - } - ColumnLayout { - Label { - Layout.fillWidth: true - wrapMode: Text.WordWrap - text: config.currentLanguageStatus - } - Kirigami.Separator { - Layout.fillWidth: true - } - Label { - Layout.fillWidth: true - wrapMode: Text.WordWrap - text: config.currentLCStatus - } + Kirigami.Separator { + Layout.fillWidth: true } Button { Layout.alignment: Qt.AlignRight|Qt.AlignVCenter Layout.columnSpan: 2 text: qsTr("Change") - //onClicked: console.log("Adjust Language clicked"); onClicked: { - onClicked: load.source = "i18n.qml" + drawerLanguage.open() } } } } + GridLayout { + rowSpacing: Kirigami.Units.largeSpacing + columnSpacing: Kirigami.Units.largeSpacing + + Kirigami.Icon { + source: "qrc:/img/locale.svg" + Layout.fillHeight: true + Layout.maximumHeight: Kirigami.Units.iconSizes.large + Layout.preferredWidth: height + } + ColumnLayout { + Label { + Layout.fillWidth: true + wrapMode: Text.WordWrap + text: config.currentLCStatus + } + Kirigami.Separator { + Layout.fillWidth: true + } + Button { + Layout.alignment: Qt.AlignRight|Qt.AlignVCenter + Layout.columnSpan: 2 + text: qsTr("Change") + onClicked: { + drawerLocale.open() + } + } + } + } + + Drawer { + id: drawerLanguage + width: 0.33 * root.width + height: root.height + edge: Qt.LeftEdge + + ScrollView { + id: scroll1 + anchors.fill: parent + contentHeight: 800 + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + + ListView { + id: list1 + focus: true + clip: true + width: parent.width + + model: config.supportedLocales + currentIndex: -1 //config.localeIndex + + header: Rectangle { + width: parent.width + height: 100 + color: "#eff0f1" //headerBackgroundColor + Text { + anchors.fill: parent + 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(config.currentLanguageCode) + font.pointSize: 10 + } + } + + delegate: ItemDelegate { + + property variant myData: model + hoverEnabled: true + width: drawerLanguage.width + implicitHeight: 24 + highlighted: ListView.isCurrentItem + Label { + Layout.fillHeight: true + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + width: parent.width + height: 24 + color: highlighted ? "#eff0f1" : "#1F1F1F" // headerBackgroundColor : textColor + text: modelData + background: Rectangle { + + color: highlighted || hovered ? highlightColor : backgroundLighterColor + opacity: highlighted || hovered ? 0.5 : 0.9 + } + + MouseArea { + hoverEnabled: true + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + list1.currentIndex = index + drawerLanguage.close() + } + } + } + } + onCurrentItemChanged: { config.currentLanguageCode = model[currentIndex] } /* This works because model is a stringlist */ + } + } + } + + Drawer { + id: drawerLocale + width: 0.33 * root.width + height: root.height + edge: Qt.RightEdge + + ScrollView { + id: scroll2 + anchors.fill: parent + contentHeight: 800 + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + + ListView { + id: list2 + focus: true + clip: true + width: parent.width + + model: config.supportedLocales + currentIndex: -1 //model.currentLCCodeIndex + + header: Rectangle { + width: parent.width + height: 100 + color: "#eff0f1" // headerBackgroundColor + Text { + anchors.fill: parent + wrapMode: Text.WordWrap + text: qsTr("

Locales


+ The system locale setting affects the numbers and dates format. The current setting is %1.").arg(config.currentLCCode) + font.pointSize: 10 + } + } + + delegate: ItemDelegate { + + hoverEnabled: true + width: drawerLocale.width + implicitHeight: 24 + highlighted: ListView.isCurrentItem + Label { + Layout.fillHeight: true + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + width: parent.width + height: 24 + color: highlighted ? "#eff0f1" : "#1F1F1F" // headerBackgroundColor : textColor + text: modelData + background: Rectangle { + + color: highlighted || hovered ? highlightColor : backgroundLighterColor + opacity: highlighted || hovered ? 0.5 : 0.9 + } + + MouseArea { + hoverEnabled: true + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + list2.currentIndex = index + drawerLocale.close() + } + } + } + } + onCurrentItemChanged: { config.currentLCCode = model[currentIndex]; } /* This works because model is a stringlist */ + } + } + } } Loader { id:load diff --git a/src/modules/localeq/localeq.qrc b/src/modules/localeq/localeq.qrc index a3f8dec9d..af6f7e911 100644 --- a/src/modules/localeq/localeq.qrc +++ b/src/modules/localeq/localeq.qrc @@ -1,6 +1,5 @@ - i18n.qml localeq.qml Map.qml Offline.qml @@ -8,6 +7,5 @@ img/minus.png img/pin.svg img/plus.png - img/chevron-left-solid.svg