Warning, /plasma-bigscreen/calamares-bigscreen-branding/bigscreen/CustomNavigationBar.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: 2022 Aditya Mehra <aix.m@outlook.com>
0004  *   SPDX-License-Identifier: GPL-3.0-or-later
0005  *
0006  *   Calamares is Free Software: see the License-Identifier above.
0007  *
0008  */
0009 
0010 import io.calamares.ui 1.0
0011 import io.calamares.core 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 
0018 RowLayout {
0019     id: buttonBar
0020     property color accentColor: Branding.styleString(Branding.SidebarTextHighlight)
0021     property var navigationReturnComponent
0022     property var navHelper
0023 
0024     onFocusChanged: {
0025         if(focus){
0026             if(nextButtonNavBar.enabled) {
0027                 nextButtonNavBar.forceActiveFocus()
0028             } else if(backButtonNavBar.enabled) {
0029                 backButtonNavBar.forceActiveFocus()
0030             } else if(quitButtonNavBar.enabled) {
0031                 quitButtonNavBar.forceActiveFocus()
0032             }
0033         }
0034     }
0035 
0036     Rectangle {
0037         color: backButtonNavBar.activeFocus ? buttonBar.accentColor : "#ff212121"
0038         Layout.fillWidth: true
0039         Layout.preferredHeight: Kirigami.Units.gridUnit * 3
0040         radius: 3
0041 
0042         Button {
0043             id: backButtonNavBar
0044             objectName: "backButtonNavBar"
0045             anchors.fill: parent                        
0046             anchors.margins: 3                                                
0047             text: ViewManager.backLabel;
0048             icon.name: ViewManager.backIcon;
0049             highlighted: backButtonNavBar.activeFocus ? 1 : 0
0050 
0051             KeyNavigation.right: nextButtonNavBar.enabled ? nextButtonNavBar : (quitButtonNavBar.enabled ? quitButtonNavBar : null)
0052             Keys.onUpPressed: { navigationReturnComponent.forceActiveFocus() }
0053             Keys.onReturnPressed: { ViewManager.back() }
0054 
0055             Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4)
0056             Kirigami.Theme.textColor: Kirigami.Theme.textColor
0057 
0058             enabled: ViewManager.backEnabled;
0059             visible: ViewManager.backAndNextVisible;
0060             onClicked: { ViewManager.back() }
0061 
0062             onActiveFocusChanged: {
0063                 if(activeFocus) {
0064                     buttonBar.parent.parent.navHelper.activeFocusedElement = objectName
0065                 }
0066             }
0067         }
0068     }
0069     
0070     Rectangle {
0071         color: nextButtonNavBar.activeFocus ? buttonBar.accentColor : "#ff212121"
0072         Layout.fillWidth: true
0073         Layout.preferredHeight: Kirigami.Units.gridUnit * 3
0074         radius: 3
0075 
0076         Button {
0077             id: nextButtonNavBar
0078             objectName: "nextButtonNavBar"
0079             anchors.fill: parent                        
0080             anchors.margins: 3      
0081             text: ViewManager.nextLabel;
0082             icon.name: ViewManager.nextIcon;
0083             highlighted: nextButtonNavBar.activeFocus ? 1 : 0
0084 
0085             Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4)
0086             Kirigami.Theme.textColor: Kirigami.Theme.textColor
0087 
0088             enabled: ViewManager.nextEnabled;
0089             visible: ViewManager.backAndNextVisible;
0090 
0091             KeyNavigation.right: quitButtonNavBar.enabled ? quitButtonNavBar : null
0092             KeyNavigation.left: backButtonNavBar.enabled ? backButtonNavBar : null
0093             Keys.onUpPressed: { navigationReturnComponent.forceActiveFocus() }
0094             Keys.onReturnPressed: { ViewManager.next() }
0095             onClicked: { ViewManager.next() }
0096 
0097             onActiveFocusChanged: {
0098                 if(activeFocus) {
0099                     buttonBar.parent.parent.navHelper.activeFocusedElement = objectName
0100                 }
0101             }
0102         }
0103     }
0104 
0105     Rectangle {
0106         color: quitButtonNavBar.activeFocus ? buttonBar.accentColor : "#ff212121"
0107         Layout.fillWidth: true
0108         Layout.preferredHeight: Kirigami.Units.gridUnit * 3
0109         radius: 3
0110 
0111         Button {
0112             id: quitButtonNavBar
0113             objectName: "quitButtonNavBar"
0114             anchors.fill: parent                        
0115             anchors.margins: 3 
0116             text: ViewManager.quitLabel;
0117             icon.name: ViewManager.quitIcon;
0118             highlighted: quitButtonNavBar.activeFocus ? 1 :0
0119 
0120             Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4)
0121             Kirigami.Theme.textColor: Kirigami.Theme.textColor
0122 
0123             KeyNavigation.left: nextButtonNavBar.enabled ? nextButtonNavBar : (backButtonNavBar.enabled ? backButtonNavBar : null)
0124             Keys.onUpPressed: { navigationReturnComponent.forceActiveFocus() }
0125             Keys.onReturnPressed: { ViewManager.quit() }
0126 
0127             enabled: ViewManager.quitEnabled;
0128             visible: ViewManager.quitVisible;
0129             onClicked: { ViewManager.quit() }
0130 
0131             onActiveFocusChanged: {
0132                 if(activeFocus) {
0133                     buttonBar.parent.parent.navHelper.activeFocusedElement = objectName
0134                 }
0135             }
0136         }
0137     }
0138 }