Warning, /plasma-bigscreen/calamares-bigscreen-branding/bigscreen/welcomeq.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 Adriaan de Groot <groot@kde.org> 0004 * SPDX-FileCopyrightText: 2020 Anke Boersma <demm@kaosx.us> 0005 * SPDX-License-Identifier: GPL-3.0-or-later 0006 * 0007 * Calamares is Free Software: see the License-Identifier above. 0008 * 0009 */ 0010 import io.calamares.core 1.0 0011 import io.calamares.ui 1.0 0012 0013 import QtQuick 2.10 0014 import QtQuick.Controls 2.10 0015 import QtQuick.Layouts 1.3 0016 import org.kde.kirigami 2.7 as Kirigami 0017 import org.kde.kitemmodels 1.0 as KItemModels 0018 import QtQml.Models 2.10 0019 import QtGraphicalEffects 1.0 0020 import QtQuick.Window 2.3 0021 0022 import Libfakeqevents 1.0 as LQ 0023 0024 Page { 0025 id: welcomePage 0026 readonly property color backgroundColor: Branding.styleString(Branding.SidebarBackground) 0027 readonly property color listBackgroundColor: Branding.styleString(Branding.SidebarBackground) 0028 readonly property color textFieldColor: Branding.styleString(Branding.SidebarText) 0029 readonly property color textFieldBackgroundColor: Branding.styleString(Branding.SidebarBackground) 0030 readonly property color textColor: Branding.styleString(Branding.SidebarText) 0031 readonly property color highlightedTextColor: Branding.styleString(Branding.SidebarText) 0032 readonly property color highlightColor: Kirigami.Theme.highlightColor 0033 readonly property color accentColor: Branding.styleString(Branding.SidebarTextHighlight) 0034 0035 function onActivate(){ 0036 navigationHelper.activePage = "welcomePage" 0037 if (!requirementsPopup.satisfiedRequirements) { 0038 requirementsPopup.open() 0039 } else { 0040 requirementsPopup.close() 0041 } 0042 fakeCursor.moveMouseEvent(mainContentArea.x + 10, 400) 0043 delay(1000, function() { 0044 console.log("WelcomeQ: I'm printed after 1 second!") 0045 fakeCursor.mouseClickEvent() 0046 }) 0047 } 0048 0049 LQ.EmulatedMouse { 0050 id: fakeCursor 0051 } 0052 0053 Timer { 0054 id: timer 0055 } 0056 0057 KItemModels.KSortFilterProxyModel { 0058 id: languageProxyModel 0059 sourceModel: config.languagesModel 0060 filterString: searchText.text.trim().toLowerCase() 0061 filterRowCallback: (source_row, source_parent) => { 0062 if (filterString.length > 0) { 0063 var index = sourceModel.index(source_row, 0, source_parent); 0064 return sourceModel.data(index, Qt.UserRole + 1).toLowerCase().includes(filterString) 0065 } 0066 return true; 0067 } 0068 } 0069 0070 function delay(delayTime, cb) { 0071 timer.interval = delayTime; 0072 timer.repeat = false; 0073 timer.triggered.connect(cb); 0074 timer.start(); 0075 } 0076 0077 Item { 0078 id: leftSideBar 0079 width: parent.width * 0.15 0080 anchors.top: parent.top 0081 anchors.bottom: navigationBarArea.top 0082 0083 Kirigami.Separator { 0084 id: leftSideBarLine 0085 anchors.right: parent.right 0086 height: parent.height 0087 width: 1 0088 } 0089 0090 ProgressionBarVertical { 0091 id: installProgressBar 0092 anchors.left: parent.left 0093 anchors.right: leftSideBarLine.left 0094 anchors.top: parent.top 0095 anchors.bottom: parent.bottom 0096 } 0097 } 0098 0099 MouseArea { 0100 id: mainContentArea 0101 anchors.left: leftSideBar.right 0102 anchors.right: rightSideBar.left 0103 anchors.leftMargin: Kirigami.Units.smallSpacing 0104 anchors.rightMargin: Kirigami.Units.smallSpacing 0105 0106 anchors.top: parent.top 0107 anchors.bottom: navigationBarArea.top 0108 0109 onClicked: { 0110 tzContainer.forceActiveFocus() 0111 } 0112 0113 ColumnLayout { 0114 id: mainContentColumnLayout 0115 width: parent.width 0116 height: parent.height 0117 0118 Rectangle { 0119 Layout.fillWidth: true 0120 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0121 0122 color: "#ff212121" 0123 radius: 4 0124 ColumnLayout { 0125 anchors.fill: parent 0126 anchors.margins: Kirigami.Units.largeSpacing 0127 0128 Text { 0129 Layout.fillWidth: true 0130 Layout.fillHeight: true 0131 id: welcomeTopText 0132 horizontalAlignment: Text.AlignHCenter 0133 verticalAlignment: Text.AlignVCenter 0134 // In QML, QString::arg() only takes one argument 0135 color: Branding.styleString(Branding.SidebarText) 0136 font.pixelSize: 75 0137 fontSizeMode: Text.Fit 0138 minimumPixelSize: 10 0139 font.bold: true 0140 text: qsTr("Welcome to the %1 %2 installer").arg(Branding.string(Branding.ProductName)).arg(Branding.string(Branding.Version)) 0141 } 0142 0143 Text { 0144 Layout.fillWidth: true 0145 Layout.fillHeight: true 0146 id: welcomeTopTextTwo 0147 horizontalAlignment: Text.AlignHCenter 0148 verticalAlignment: Text.AlignVCenter 0149 // In QML, QString::arg() only takes one argument 0150 color: Branding.styleString(Branding.SidebarText) 0151 font.pixelSize: 45 0152 fontSizeMode: Text.Fit 0153 minimumPixelSize: 10 0154 text: qsTr("This program will ask you some questions and set up %1 on your computer.").arg(Branding.string(Branding.ProductName)).arg(Branding.string(Branding.Version)) 0155 } 0156 } 0157 } 0158 0159 Rectangle { 0160 Layout.fillWidth: true 0161 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0162 0163 color: "#ff212121" 0164 radius: 4 0165 0166 Label { 0167 anchors.fill: parent 0168 horizontalAlignment: Text.AlignHCenter 0169 verticalAlignment: Text.AlignVCenter 0170 minimumPixelSize: 10 0171 font.pixelSize: parent.height * 0.40 0172 maximumLineCount: 3 0173 fontSizeMode: Text.Fit 0174 wrapMode: Text.WordWrap 0175 text: qsTr("Setting Up Your Language") 0176 color: Branding.styleString(Branding.SidebarText) 0177 } 0178 } 0179 0180 Rectangle { 0181 id: tzContainer 0182 objectName: "tzContainer" 0183 Layout.fillWidth: true 0184 Layout.fillHeight: true 0185 0186 radius: 4 0187 border.width: tzContainer.activeFocus ? 3 : 1 0188 border.color: tzContainer.activeFocus ? accentColor : Qt.lighter(Kirigami.Theme.backgroundColor, 1.5) 0189 color: Kirigami.Theme.backgroundColor 0190 0191 KeyNavigation.down: searchFieldFocusBox 0192 Keys.onReturnPressed: { 0193 tzListView.forceActiveFocus() 0194 } 0195 0196 onActiveFocusChanged: { 0197 if(activeFocus) { 0198 navigationHelper.activeFocusedElement = objectName 0199 } 0200 } 0201 0202 Kirigami.CardsListView { 0203 id: tzListView 0204 objectName: "tzListView" 0205 anchors.fill: parent 0206 anchors.margins: 8 0207 0208 spacing: 4 0209 currentIndex: config.localeIndex 0210 model: languageProxyModel 0211 clip: true 0212 highlight: Rectangle { 0213 color: accentColor 0214 radius: 4 0215 } 0216 0217 ScrollBar.vertical: ScrollBar { 0218 active: true 0219 } 0220 0221 delegate: Kirigami.BasicListItem { 0222 width: parent.width 0223 height: 40 0224 label: model.label 0225 0226 Keys.onReturnPressed: { 0227 clicked() 0228 } 0229 0230 Keys.onBackPressed: { 0231 clicked() 0232 tzContainer.forceActiveFocus() 0233 } 0234 0235 Keys.onEscapePressed: { 0236 clicked() 0237 tzContainer.forceActiveFocus() 0238 } 0239 0240 Keys.onSelectPressed: { 0241 clicked() 0242 } 0243 0244 onClicked: { 0245 tzListView.currentIndex = index 0246 nextButton.forceActiveFocus() 0247 } 0248 } 0249 0250 onActiveFocusChanged: { 0251 if(activeFocus) { 0252 navigationHelper.activeFocusedElement = objectName 0253 } 0254 } 0255 0256 onCurrentIndexChanged: { 0257 config.localeIndex = tzListView.currentIndex 0258 selectedZoneDisplayLabel.text = "Selected Language: " + tzListView.itemAtIndex(tzListView.currentIndex).text 0259 } 0260 } 0261 } 0262 0263 RowLayout { 0264 Layout.fillWidth: true 0265 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0266 0267 Rectangle { 0268 id: searchFieldFocusBox 0269 objectName: "searchFieldFocusBox" 0270 Layout.fillWidth: true 0271 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0272 0273 color: "transparent" 0274 border.color: searchFieldFocusBox.activeFocus ? accentColor : "transparent" 0275 border.width: searchFieldFocusBox.activeFocus ? 3 : 0 0276 0277 KeyNavigation.down: aboutButtonWelcomeQ 0278 0279 Keys.onReturnPressed: { 0280 searchText.forceActiveFocus() 0281 } 0282 0283 onActiveFocusChanged: { 0284 if(activeFocus) { 0285 navigationHelper.activeFocusedElement = objectName 0286 } 0287 } 0288 0289 TextField { 0290 id: searchText 0291 anchors.fill: parent 0292 anchors.margins: 5 0293 topPadding: 16 0294 bottomPadding: 16 0295 placeholderText: qsTr("Search & Filter Language From List") 0296 0297 onTextChanged: { 0298 console.log(languageProxyModel.count) 0299 //selectedZoneDisplayLabel.text = "Selected Language: " + tzListView.itemAtIndex(tzListView.currentIndex).text 0300 } 0301 } 0302 } 0303 0304 Rectangle { 0305 color: "#ff212121" 0306 Layout.fillWidth: true 0307 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0308 0309 0310 Label { 0311 id: selectedZoneDisplayLabel 0312 anchors.fill: parent 0313 anchors.margins: Kirigami.Units.largeSpacing 0314 horizontalAlignment: Text.AlignHCenter 0315 verticalAlignment: Text.AlignVCenter 0316 wrapMode: Text.WordWrap 0317 text: "Selected Language: " + tzListView.currentItem.label //"Africa/Abidjan" 0318 color: Kirigami.Theme.textColor 0319 } 0320 } 0321 } 0322 0323 RowLayout { 0324 Layout.fillWidth: true 0325 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0326 0327 Rectangle { 0328 color: aboutButtonWelcomeQ.activeFocus ? accentColor : "#ff212121" 0329 Layout.fillWidth: true 0330 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0331 0332 Button { 0333 id: aboutButtonWelcomeQ 0334 anchors.fill: parent 0335 anchors.margins: 3 0336 text: qsTr("About") 0337 icon.name: "dialog-information" 0338 highlighted: aboutButtonWelcomeQ.activeFocus ? 1 : 0 0339 0340 KeyNavigation.up: searchFieldFocusBox 0341 KeyNavigation.right: bugsButtonWelcomeQ.enabled ? bugsButtonWelcomeQ : (releaseNotesButtonWelcomeQ.enabled ? releaseNotesButtonWelcomeQ : (donateButtonWelcomeQ.enabled ? donateButtonWelcomeQ : aboutButtonWelcomeQ)) 0342 0343 Keys.onDownPressed: { 0344 customNavBar.forceActiveFocus() 0345 } 0346 0347 Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4) 0348 Kirigami.Theme.textColor: Kirigami.Theme.textColor 0349 0350 visible: true 0351 0352 Keys.onReturnPressed: { 0353 clicked() 0354 } 0355 0356 onClicked: { 0357 load.source = "about.qml" 0358 load.open() 0359 } 0360 } 0361 } 0362 0363 Rectangle { 0364 color: bugsButtonWelcomeQ.activeFocus ? accentColor : "#ff212121" 0365 Layout.fillWidth: true 0366 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0367 visible: bugsButtonWelcomeQ.visible 0368 enabled: bugsButtonWelcomeQ.visible 0369 0370 Button { 0371 id: bugsButtonWelcomeQ 0372 anchors.fill: parent 0373 anchors.margins: 3 0374 text: qsTr("Known issues") 0375 icon.name: "tools-report-bug" 0376 highlighted: bugsButtonWelcomeQ.activeFocus ? 1 : 0 0377 0378 KeyNavigation.up: searchFieldFocusBox 0379 KeyNavigation.down: nextButtonNavBar 0380 KeyNavigation.left: aboutButtonWelcomeQ 0381 KeyNavigation.right: releaseNotesButtonWelcomeQ.enabled ? releaseNotesButtonWelcomeQ : (donateButtonWelcomeQ.enabled ? donateButtonWelcomeQ : bugsButtonWelcomeQ) 0382 0383 Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4) 0384 Kirigami.Theme.textColor: Kirigami.Theme.textColor 0385 0386 visible: config.knownIssuesUrl !== "" 0387 0388 Keys.onReturnPressed: { 0389 clicked() 0390 } 0391 0392 onClicked: Qt.openUrlExternally(config.knownIssuesUrl) 0393 } 0394 } 0395 0396 Rectangle { 0397 color: releaseNotesButtonWelcomeQ.activeFocus ? accentColor : "#ff212121" 0398 Layout.fillWidth: true 0399 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0400 visible: releaseNotesButtonWelcomeQ.visible 0401 enabled: releaseNotesButtonWelcomeQ.visible 0402 0403 Button { 0404 id: releaseNotesButtonWelcomeQ 0405 anchors.fill: parent 0406 anchors.margins: 3 0407 text: qsTr("Release notes") 0408 icon.name: "folder-text" 0409 highlighted: releaseNotesButtonWelcomeQ.activeFocus ? 1 : 0 0410 0411 KeyNavigation.up: searchFieldFocusBox 0412 KeyNavigation.down: nextButtonNavBar 0413 KeyNavigation.left: aboutButtonWelcomeQ 0414 KeyNavigation.right: releaseNotesButtonWelcomeQ.enabled ? releaseNotesButtonWelcomeQ : (donateButtonWelcomeQ.enabled ? donateButtonWelcomeQ : releaseNotesButtonWelcomeQ) 0415 0416 Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4) 0417 Kirigami.Theme.textColor: Kirigami.Theme.textColor 0418 0419 visible: config.releaseNotesUrl !== "" 0420 0421 Keys.onReturnPressed: { 0422 clicked() 0423 } 0424 0425 onClicked: { 0426 load.source = "release_notes.qml" 0427 load.open() 0428 } 0429 } 0430 } 0431 0432 Rectangle { 0433 color: donateButtonWelcomeQ.activeFocus ? accentColor : "#ff212121" 0434 Layout.fillWidth: true 0435 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0436 visible: donateButtonWelcomeQ.visible 0437 enabled: donateButtonWelcomeQ.visible 0438 radius: 3 0439 0440 Button { 0441 id: donateButtonWelcomeQ 0442 anchors.fill: parent 0443 anchors.margins: 3 0444 text: qsTr("Donate") 0445 icon.name: "taxes-finances" 0446 highlighted: donateButtonWelcomeQ.activeFocus ? 1 : 0 0447 0448 KeyNavigation.up: searchFieldFocusBox 0449 KeyNavigation.down: nextButtonNavBar 0450 KeyNavigation.left: releaseNotesButtonWelcomeQ.enabled ? releaseNotesButtonWelcomeQ : (bugsButtonWelcomeQ.enabled ? bugsButtonWelcomeQ : aboutButtonWelcomeQ) 0451 0452 Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4) 0453 Kirigami.Theme.textColor: Kirigami.Theme.textColor 0454 0455 visible: config.donateUrl !== "" 0456 0457 Keys.onReturnPressed: { 0458 clicked() 0459 } 0460 0461 onClicked: Qt.openUrlExternally(config.donateUrl) 0462 } 0463 } 0464 } 0465 } 0466 } 0467 0468 Item { 0469 id: rightSideBar 0470 width: parent.width * 0.15 0471 anchors.top: parent.top 0472 anchors.bottom: navigationBarArea.top 0473 anchors.right: parent.right 0474 0475 Kirigami.Separator { 0476 id: rightSideBarLine 0477 anchors.left: parent.left 0478 height: parent.height 0479 width: 1 0480 } 0481 0482 NavigationHelper { 0483 id: navigationHelper 0484 anchors.top: parent.top 0485 anchors.bottom: parent.bottom 0486 anchors.left: rightSideBarLine.right 0487 anchors.leftMargin: 1 0488 anchors.right: parent.right 0489 } 0490 } 0491 0492 Item { 0493 id: navigationBarArea 0494 width: parent.width 0495 height: Kirigami.Units.gridUnit * 3 0496 anchors.bottom: parent.bottom 0497 0498 Kirigami.Separator { 0499 id: navigationBarAreaLine 0500 anchors.top: parent.top 0501 width: parent.width 0502 height: 1 0503 } 0504 0505 CustomNavigationBar { 0506 id: customNavBar 0507 width: parent.width 0508 anchors.top: navigationBarAreaLine.bottom 0509 anchors.bottom: parent.bottom 0510 navigationReturnComponent: aboutButtonWelcomeQ 0511 navHelper: navigationHelper 0512 } 0513 } 0514 0515 Popup { 0516 id: requirementsPopup 0517 width: parent.width / 2 0518 height: parent.height / 2 0519 x: parent.width / 2 - width / 2 0520 y: parent.height / 2 - height / 2 0521 property bool satisfiedRequirements: config.requirementsModel.satisfiedRequirements 0522 0523 onClosed: { 0524 tzContainer.forceActiveFocus() 0525 } 0526 0527 background: Rectangle { 0528 color: "#212121" 0529 } 0530 0531 contentItem: Item { 0532 Requirements { 0533 visible: !config.requirementsModel.satisfiedRequirements 0534 } 0535 } 0536 } 0537 0538 Popup { 0539 id: load 0540 width: parent.width / 2 0541 height: parent.height / 2 0542 x: parent.width / 2 - width / 2 0543 y: parent.height / 2 - height / 2 0544 property alias source: messageLoader.source 0545 0546 background: Rectangle { 0547 color: "#ff212121" 0548 } 0549 0550 contentItem: Item { 0551 Loader { 0552 id: messageLoader 0553 anchors.fill: parent 0554 } 0555 } 0556 } 0557 }