Merge pull request #2045 from demmm/calamares

[localeq] move to using Drawer for fine tuning options
This commit is contained in:
Adriaan de Groot 2022-09-03 01:34:49 +02:00 committed by GitHub
commit f9f4c6f36e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 224 additions and 264 deletions

View File

@ -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
}
}

View File

@ -1,204 +0,0 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2020 - 2021 Anke Boersma <demm@kaosx.us>
* 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("<h1>Languages</h1> </br>
The system locale setting affects the language and character set for some command line user interface elements. The current setting is <strong>%1</strong>.").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("<h1>Locales</h1> </br>
The system locale setting affects the numbers and dates format. The current setting is <strong>%1</strong>.").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
}
}
}
}

View File

@ -1 +0,0 @@
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="chevron-left" class="svg-inline--fa fa-chevron-left fa-w-10" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"></path></svg>

Before

Width:  |  Height:  |  Size: 482 B

View File

@ -1,2 +0,0 @@
SPDX-FileCopyrightText: 2020 https://github.com/FortAwesome/Font-Awesome
SPDX-License-Identifier: CC-BY-4.0

View File

@ -1,7 +1,7 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
* SPDX-FileCopyrightText: 2020 Anke Boersma <demm@kaosx.us>
* SPDX-FileCopyrightText: 2020 - 2022 Anke Boersma <demm@kaosx.us>
* 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("<h3>Languages</h3> </br>
The system locale setting affects the language and character set for some command line user interface elements. The current setting is <strong>%1</strong>.").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("<h3>Locales</h3> </br>
The system locale setting affects the numbers and dates format. The current setting is <strong>%1</strong>.").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

View File

@ -1,6 +1,5 @@
<RCC>
<qresource>
<file>i18n.qml</file>
<file>localeq.qml</file>
<file>Map.qml</file>
<file>Offline.qml</file>
@ -8,6 +7,5 @@
<file>img/minus.png</file>
<file>img/pin.svg</file>
<file>img/plus.png</file>
<file>img/chevron-left-solid.svg</file>
</qresource>
</RCC>