[localeq] rewrite Offline.qml
once completed, this can be a fully functional (offline) locale selection option worldmap.png no longer needed/in use working is the stackview of the region & zones models Timezone text bar shows correct timezone currentIndex see comments on lines 65 & 139, not working update of timezone text bar can't be tested if working as long no index is connected (see lines 93 & 168) Still, already committing, since it does more then old Offline.qml, which had no function for timezone
This commit is contained in:
parent
ae14059e8b
commit
9bdb05d4ea
@ -7,6 +7,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import io.calamares.core 1.0
|
||||
import io.calamares.ui 1.0
|
||||
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.10
|
||||
import QtQuick.Window 2.14
|
||||
@ -14,43 +17,200 @@ import QtQuick.Layouts 1.3
|
||||
|
||||
import org.kde.kirigami 2.7 as Kirigami
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
Page {
|
||||
width: 800 //parent.width
|
||||
height: 500
|
||||
|
||||
//Needs to come from localeq.conf
|
||||
property var configTimezone: "America/New York"
|
||||
StackView {
|
||||
id: stack
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height / 1.28
|
||||
initialItem: Item {
|
||||
|
||||
Image {
|
||||
id: image
|
||||
anchors.fill: parent
|
||||
source: "img/worldmap.png"
|
||||
width: parent.width
|
||||
Label {
|
||||
|
||||
id: region
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: Kirigami.Theme.textColor
|
||||
horizontalAlignment: Text.AlignCenter
|
||||
text: qsTr("Select your preferred Region, or use the default one based on your current location.")
|
||||
}
|
||||
|
||||
ListView {
|
||||
|
||||
id: list
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
active: true
|
||||
}
|
||||
|
||||
width: parent.width / 2
|
||||
height: 250
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: -30
|
||||
focus: true
|
||||
clip: true
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
spacing: 2
|
||||
|
||||
Rectangle {
|
||||
|
||||
z: parent.z - 1
|
||||
anchors.fill: parent
|
||||
color: "#BDC3C7"
|
||||
radius: 5
|
||||
opacity: 0.7
|
||||
}
|
||||
|
||||
// model loads, dozens of variations tried for currentIndex all fail
|
||||
model: config.regionModel
|
||||
currentIndex: config.currentIndex
|
||||
delegate: ItemDelegate {
|
||||
|
||||
hoverEnabled: true
|
||||
width: parent.width
|
||||
highlighted: ListView.isCurrentItem
|
||||
|
||||
Label {
|
||||
|
||||
text: name
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
width: parent.width
|
||||
height: 30
|
||||
color: highlighted ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
|
||||
|
||||
background: Rectangle {
|
||||
|
||||
color: highlighted || hovered ? Kirigami.Theme.highlightColor : "white" //Kirigami.Theme.backgroundColor
|
||||
opacity: highlighted || hovered ? 0.5 : 0.3
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
|
||||
list.model.currentIndex = index
|
||||
// correct to use config.currentTimezoneName when index is updated?
|
||||
tztext.text = qsTr("Timezone: %1").arg(config.currentTimezoneName)
|
||||
stack.push(zoneView)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: zoneView
|
||||
|
||||
Item {
|
||||
|
||||
Label {
|
||||
|
||||
id: zone
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: Kirigami.Theme.textColor
|
||||
text: qsTr("Select your preferred Zone within your Region.")
|
||||
}
|
||||
|
||||
ListView {
|
||||
|
||||
id: list2
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
active: true
|
||||
}
|
||||
|
||||
width: parent.width / 2
|
||||
height: 250
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: -30
|
||||
focus: true
|
||||
clip: true
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
spacing: 2
|
||||
|
||||
Rectangle {
|
||||
|
||||
z: parent.z - 1
|
||||
anchors.fill: parent
|
||||
color: "#BDC3C7"
|
||||
radius: 5
|
||||
opacity: 0.7
|
||||
}
|
||||
|
||||
// model loads, dozens of variations tried for currentIndex all fail
|
||||
model: config.regionalZonesModel
|
||||
currentIndex: config.currentIndex
|
||||
delegate: ItemDelegate {
|
||||
|
||||
hoverEnabled: true
|
||||
width: parent.width
|
||||
highlighted: ListView.isCurrentItem
|
||||
|
||||
Label {
|
||||
|
||||
text: name
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
width: parent.width
|
||||
height: 30
|
||||
color: highlighted ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
|
||||
|
||||
background: Rectangle {
|
||||
|
||||
color: highlighted || hovered ? Kirigami.Theme.highlightColor : "white" //Kirigami.Theme.backgroundColor
|
||||
opacity: highlighted || hovered ? 0.5 : 0.3
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
|
||||
list2.model.currentIndex = index
|
||||
list2.positionViewAtIndex(index, ListView.Center)
|
||||
// correct to use config.currentTimezoneName when index is updated?
|
||||
tztext.text = qsTr("Timezone: %1").arg(config.currentTimezoneName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
|
||||
Layout.fillWidth: true
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.verticalCenterOffset: -30
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: parent.width / 15
|
||||
icon.name: "go-previous"
|
||||
text: qsTr("Zones")
|
||||
onClicked: stack.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
||||
width: parent.width
|
||||
height: 100
|
||||
height: 60
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
Item {
|
||||
|
||||
id: location
|
||||
Kirigami.Theme.inherit: false
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
Rectangle {
|
||||
|
||||
anchors.centerIn: parent
|
||||
width: 300
|
||||
height: 30
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
|
||||
Text {
|
||||
text: qsTr("Timezone: %1").arg(configTimezone)
|
||||
|
||||
id: tztext
|
||||
text: qsTr("Timezone: %1").arg(config.currentTimezoneName)
|
||||
color: Kirigami.Theme.textColor
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
@ -58,6 +218,7 @@ Column {
|
||||
}
|
||||
|
||||
Text {
|
||||
|
||||
anchors.top: location.bottom
|
||||
anchors.topMargin: 20
|
||||
padding: 10
|
||||
@ -65,7 +226,7 @@ Column {
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
Kirigami.Theme.backgroundColor: Kirigami.Theme.backgroundColor
|
||||
text: qsTr("To be able to select a timezone, make sure you are connected to the internet. Restart the installer after connecting. You can fine-tune Language and Locale settings below.")
|
||||
text: qsTr("You can fine-tune Language and Locale settings below.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 100 KiB |
@ -1,2 +0,0 @@
|
||||
SPDX-FileCopyrightText: 2020 demmm <anke62@gmail.com>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
@ -9,6 +9,5 @@
|
||||
<file>img/pin.svg</file>
|
||||
<file>img/plus.png</file>
|
||||
<file>img/chevron-left-solid.svg</file>
|
||||
<file>img/worldmap.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
Reference in New Issue
Block a user