Warning, /plasma-bigscreen/calamares-bigscreen-branding/bigscreen/Offline.qml is written in an unsupported language. File is not indexed.
0001 /* === This file is part of Calamares - <https://calamares.io> ===
0002 *
0003 * SPDX-FileCopyrightText: 2020-2021 Anke Boersma <demm@kaosx.us>
0004 * SPDX-FileCopyrightText: 2022 Aditya Mehra <aix.m@outlook.com>
0005 * SPDX-License-Identifier: GPL-3.0-or-later
0006 *
0007 * Calamares is Free Software: see the License-Identifier above.
0008 *
0009 */
0010
0011 import io.calamares.core 1.0
0012 import io.calamares.ui 1.0
0013
0014 import QtQuick 2.10
0015 import QtQuick.Controls 2.10
0016 import QtQuick.Window 2.14
0017 import QtQuick.Layouts 1.3
0018
0019 import org.kde.kirigami 2.7 as Kirigami
0020
0021 Item {
0022 id: control
0023 property string currentRegion
0024 property string currentZone
0025 property color accentColor: Branding.styleString(Branding.SidebarTextHighlight)
0026 property alias stackIndex: stack.currentIndex
0027
0028 onActiveFocusChanged: {
0029 if(activeFocus) {
0030 if(stackIndex == 0){
0031 listOneButton.forceActiveFocus()
0032 }
0033 if(stackIndex == 1){
0034 listTwoButton.forceActiveFocus()
0035 }
0036 }
0037 }
0038
0039 Rectangle {
0040 id: controlBar
0041 anchors.top: parent.top
0042 anchors.left: parent.left
0043 anchors.right: parent.right
0044 height: Kirigami.Units.gridUnit * 3
0045 color: "#ff212121"
0046
0047 RowLayout {
0048 id: controlBarLayout
0049 anchors.fill: parent
0050
0051 Rectangle {
0052 color: listOneButton.activeFocus ? control.accentColor : "#ff212121"
0053 Layout.fillWidth: true
0054 Layout.preferredHeight: Kirigami.Units.gridUnit * 3
0055 radius: 3
0056 border.color: Branding.styleString(Branding.SidebarText)
0057 border.width: stack.currentIndex == 0 ? 1 : 0
0058
0059 Button {
0060 id: listOneButton
0061 objectName: "listOneButton"
0062 text: "Region Selection"
0063 anchors.fill: parent
0064 anchors.margins: 3
0065 highlighted: listOneButton.activeFocus ? 1 : 0
0066 flat: stack.currentIndex == 0
0067
0068 Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4)
0069 Kirigami.Theme.textColor: Kirigami.Theme.textColor
0070
0071 KeyNavigation.right: listTwoButton
0072 KeyNavigation.down: list
0073
0074 onActiveFocusChanged: {
0075 if(activeFocus) {
0076 navigationHelper.activeFocusedElement = objectName
0077 }
0078 }
0079
0080 Keys.onBackPressed: {
0081 localStackContainer.forceActiveFocus()
0082 }
0083
0084 onClicked: {
0085 stack.currentIndex = 0
0086 }
0087 }
0088 }
0089
0090 Rectangle {
0091 color: listTwoButton.activeFocus ? control.accentColor : "#ff212121"
0092 Layout.fillWidth: true
0093 Layout.preferredHeight: Kirigami.Units.gridUnit * 3
0094 radius: 3
0095 border.color: Branding.styleString(Branding.SidebarText)
0096 border.width: stack.currentIndex == 1 ? 1 : 0
0097
0098 Button {
0099 id: listTwoButton
0100 objectName: "listTwoButton"
0101 text: "Zone Selection"
0102 anchors.fill: parent
0103 anchors.margins: 3
0104 highlighted: listTwoButton.activeFocus ? 1 : 0
0105 flat: stack.currentIndex == 1
0106
0107 Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4)
0108 Kirigami.Theme.textColor: Kirigami.Theme.textColor
0109
0110
0111 KeyNavigation.left: listOneButton
0112 KeyNavigation.down: list2
0113
0114 onActiveFocusChanged: {
0115 if(activeFocus) {
0116 navigationHelper.activeFocusedElement = objectName
0117 }
0118 }
0119
0120 Keys.onBackPressed: {
0121 localStackContainer.forceActiveFocus()
0122 }
0123
0124 onClicked: {
0125 stack.currentIndex = 1
0126 }
0127 }
0128 }
0129 }
0130 }
0131
0132 StackLayout {
0133 id: stack
0134 anchors.top: controlBar.bottom
0135 anchors.left: parent.left
0136 anchors.right: parent.right
0137 anchors.bottom: parent.bottom
0138 clip: true
0139 currentIndex: 0
0140
0141 ColumnLayout {
0142 implicitWidth: parent.width
0143 implicitHeight: parent.height
0144
0145 Rectangle {
0146 Layout.fillWidth: true
0147 Layout.preferredHeight: Kirigami.Units.gridUnit * 2
0148 color: "#ff212121"
0149
0150 Label {
0151 id: region
0152 anchors.fill: parent
0153 anchors.margins: Kirigami.Units.largeSpacing
0154 verticalAlignment: Text.AlignVCenter
0155 horizontalAlignment: Text.AlignCenter
0156 color: Branding.styleString(Branding.SidebarText)
0157 font.pixelSize: parent.height * 0.45
0158 text: qsTr("Select your preferred Region, or use the default settings.")
0159 maximumLineCount: 1
0160 elide: Text.ElideRight
0161 }
0162 }
0163
0164 Kirigami.CardsListView {
0165 id: list
0166 objectName: "list"
0167 Layout.fillWidth: true
0168 Layout.fillHeight: true
0169 boundsBehavior: Flickable.StopAtBounds
0170 spacing: 4
0171 model: config.regionModel
0172 currentIndex: -1
0173 clip: true
0174 highlight: Rectangle {
0175 color: control.accentColor
0176 radius: 4
0177 }
0178 ScrollBar.vertical: ScrollBar {
0179 active: true
0180 }
0181
0182 KeyNavigation.up: listOneButton
0183 KeyNavigation.down: adjustSettingsButton
0184
0185 onActiveFocusChanged: {
0186 if(activeFocus) {
0187 navigationHelper.activeFocusedElement = objectName
0188 }
0189 }
0190
0191 Keys.onRightPressed: {
0192 localStackContainer.forceActiveFocus()
0193 }
0194
0195 Keys.onLeftPressed: {
0196 localStackContainer.forceActiveFocus()
0197 }
0198
0199 Keys.onBackPressed: {
0200 localStackContainer.forceActiveFocus()
0201 }
0202
0203 delegate: Kirigami.BasicListItem {
0204 width: parent.width
0205 height: 40
0206 label: model.name
0207
0208 onClicked: {
0209 list.currentIndex = index
0210 control.currentRegion = model.name
0211 config.regionalZonesModel.region = control.currentRegion
0212 tztext.text = qsTr("Timezone: %1").arg(config.currentTimezoneName)
0213 stack.currentIndex = 1
0214 list2.forceActiveFocus()
0215 }
0216 }
0217 }
0218 }
0219
0220 ColumnLayout {
0221 id: zoneView
0222 implicitWidth: parent.width
0223 implicitHeight: parent.height
0224
0225 Rectangle {
0226 Layout.fillWidth: true
0227 Layout.preferredHeight: Kirigami.Units.gridUnit * 2
0228 color: "#ff212121"
0229
0230 Label {
0231 id: zone
0232 anchors.fill: parent
0233 anchors.margins: Kirigami.Units.largeSpacing
0234 verticalAlignment: Text.AlignVCenter
0235 horizontalAlignment: Text.AlignCenter
0236 color: Branding.styleString(Branding.SidebarText)
0237 font.pixelSize: parent.height * 0.45
0238 text: qsTr("Select your preferred Zone within your Region.")
0239 maximumLineCount: 1
0240 elide: Text.ElideRight
0241 }
0242 }
0243
0244 Kirigami.CardsListView {
0245 id: list2
0246 objectName: "list2"
0247 Layout.fillWidth: true
0248 Layout.fillHeight: true
0249 boundsBehavior: Flickable.StopAtBounds
0250 spacing: 4
0251 model: config.regionalZonesModel
0252 currentIndex: -1
0253 clip: true
0254 highlight: Rectangle {
0255 color: control.accentColor
0256 radius: 4
0257 }
0258 ScrollBar.vertical: ScrollBar {
0259 active: true
0260 }
0261
0262 KeyNavigation.up: listOneButton
0263 KeyNavigation.down: adjustSettingsButton
0264
0265 onActiveFocusChanged: {
0266 if(activeFocus) {
0267 navigationHelper.activeFocusedElement = objectName
0268 }
0269 }
0270
0271 Keys.onRightPressed: {
0272 localStackContainer.forceActiveFocus()
0273 }
0274
0275 Keys.onLeftPressed: {
0276 localStackContainer.forceActiveFocus()
0277 }
0278
0279 Keys.onBackPressed: {
0280 localStackContainer.forceActiveFocus()
0281 }
0282
0283 delegate: Kirigami.BasicListItem {
0284 width: parent.width
0285 height: 40
0286 label: model.name
0287
0288 onClicked: {
0289 list2.currentIndex = index
0290 list2.positionViewAtIndex(index, ListView.Center)
0291 control.currentZone = model.name
0292 config.setCurrentLocation(control.currentRegion, control.currentZone)
0293 tztext.text = qsTr("Timezone: %1").arg(config.currentTimezoneName)
0294 adjustSettingsButton.forceActiveFocus()
0295 }
0296 }
0297 }
0298 }
0299 }
0300 }