diff --git a/src/modules/localeq/Offline.qml b/src/modules/localeq/Offline.qml index 8823a388a..5a0d4eb3f 100644 --- a/src/modules/localeq/Offline.qml +++ b/src/modules/localeq/Offline.qml @@ -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.") } } } diff --git a/src/modules/localeq/img/worldmap.png b/src/modules/localeq/img/worldmap.png deleted file mode 100644 index c5c181985..000000000 Binary files a/src/modules/localeq/img/worldmap.png and /dev/null differ diff --git a/src/modules/localeq/img/worldmap.png.license b/src/modules/localeq/img/worldmap.png.license deleted file mode 100644 index 5f43e650d..000000000 --- a/src/modules/localeq/img/worldmap.png.license +++ /dev/null @@ -1,2 +0,0 @@ -SPDX-FileCopyrightText: 2020 demmm -SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/localeq/localeq.qrc b/src/modules/localeq/localeq.qrc index 3f7c9b5e5..a3f8dec9d 100644 --- a/src/modules/localeq/localeq.qrc +++ b/src/modules/localeq/localeq.qrc @@ -9,6 +9,5 @@ img/pin.svg img/plus.png img/chevron-left-solid.svg - img/worldmap.png