Warning, /plasma/plasma-bigscreen/kcms/bigscreen-settings/ui/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2020 Aditya Mehra <aix.m@outlook.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 
0006 */
0007 
0008 import QtQuick.Layouts 1.14
0009 import QtQuick 2.14
0010 import QtQuick.Window 2.14
0011 import QtQuick.Controls 2.14
0012 import org.kde.plasma.core 2.0 as PlasmaCore
0013 import org.kde.kirigami as Kirigami
0014 import org.kde.kcmutils as KCM
0015 import org.kde.mycroft.bigscreen 1.0 as BigScreen
0016 import "delegates" as Delegates
0017 
0018 KCM.SimpleKCM {
0019     id: root
0020 
0021     title: i18n("Appearance")
0022     background: null
0023     leftPadding: Kirigami.Units.smallSpacing
0024     topPadding: 0
0025     rightPadding: Kirigami.Units.smallSpacing
0026     bottomPadding: 0
0027 
0028     Component.onCompleted: {
0029         desktopThemeView.forceActiveFocus();
0030     }
0031 
0032     function setTheme(packageName){
0033         kcm.themeName = packageName
0034     }
0035 
0036     function setOption(type, result){
0037         if(type == "coloredTile"){
0038             kcm.setUseColoredTiles(result);
0039         }
0040         if(type == "exapandableTile"){
0041             kcm.setUseExpandingTiles(result);
0042         }
0043         if(type == "mycroftIntegration"){
0044             kcm.setMycroftIntegrationActive(result);
0045         }
0046         if(type == "pmInhibition"){
0047             kcm.setPmInhibitionActive(result);
0048         }
0049     }
0050 
0051     contentItem: FocusScope {
0052 
0053         Rectangle {
0054             id: headerAreaTop
0055             anchors.left: parent.left
0056             anchors.right: parent.right
0057             anchors.leftMargin: -Kirigami.Units.largeSpacing
0058             anchors.rightMargin: -Kirigami.Units.largeSpacing
0059             height: parent.height * 0.075
0060             z: 10
0061             gradient: Gradient {
0062                 GradientStop { position: 0.1; color: Qt.rgba(0, 0, 0, 0.5) }
0063                 GradientStop { position: 0.9; color: Qt.rgba(0, 0, 0, 0.25) }
0064             }
0065 
0066             Kirigami.Heading {
0067                 level: 1
0068                 anchors.fill: parent
0069                 anchors.topMargin: Kirigami.Units.largeSpacing
0070                 anchors.leftMargin: Kirigami.Units.largeSpacing * 2
0071                 anchors.bottomMargin: Kirigami.Units.largeSpacing
0072                 color: Kirigami.Theme.textColor
0073                 text: "Bigscreen Settings"
0074             }
0075         }
0076 
0077         Item {
0078             id: footerMain
0079             anchors.left: parent.left
0080             anchors.right: parent.right
0081             anchors.leftMargin: -Kirigami.Units.largeSpacing
0082             anchors.bottom: parent.bottom
0083             implicitHeight: Kirigami.Units.gridUnit * 2
0084 
0085             Button {
0086                 id: kcmcloseButton
0087                 implicitHeight: Kirigami.Units.gridUnit * 2
0088                 width: deviceTimeSettingsArea.opened ? (root.width + Kirigami.Units.largeSpacing) - deviceTimeSettingsArea.width : root.width + Kirigami.Units.largeSpacing
0089                 KeyNavigation.up: desktopThemeView
0090                 KeyNavigation.down: mycroftIntegrationDelegate
0091 
0092                 background: Rectangle {
0093                     color: kcmcloseButton.activeFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
0094                 }
0095 
0096                 contentItem: Item {
0097                     RowLayout {
0098                         anchors.centerIn: parent
0099                         Kirigami.Icon {
0100                             Layout.preferredWidth: Kirigami.Units.iconSizes.small
0101                             Layout.preferredHeight: Kirigami.Units.iconSizes.small
0102                             source: "window-close"
0103                         }
0104                         Label {
0105                             text: i18n("Exit")
0106                         }
0107                     }
0108                 }
0109 
0110                 onClicked: {
0111                     Window.window.close()
0112                 }
0113 
0114                 Keys.onReturnPressed: {
0115                     Window.window.close()
0116                 }
0117             }
0118         }
0119 
0120         Item {
0121             anchors.left: parent.left
0122             anchors.leftMargin: Kirigami.Units.largeSpacing
0123             anchors.top: headerAreaTop.bottom
0124             anchors.topMargin: Kirigami.Units.largeSpacing * 2
0125             anchors.bottom: footerMain.top
0126             width: deviceTimeSettingsArea.opened ? parent.width - deviceTimeSettingsArea.width : parent.width
0127             clip: true
0128 
0129             ColumnLayout {
0130                 id: contentLayout
0131                 width: parent.width
0132                 property Item currentSection
0133                 y: currentSection ? (currentSection.y > parent.height / 2 ? -currentSection.y + Kirigami.Units.gridUnit * 3 : 0) : 0
0134                 anchors.left: parent.left
0135                 anchors.leftMargin: Kirigami.Units.largeSpacing
0136 
0137                 Behavior on y {
0138                     NumberAnimation {
0139                         duration: Kirigami.Units.longDuration * 2
0140                         easing.type: Easing.InOutQuad
0141                     }
0142                 }
0143 
0144                 Kirigami.Heading {
0145                     id: launcherLookHeader
0146                     text: i18n("Launcher Appearance")
0147                     layer.enabled: true
0148                     color: Kirigami.Theme.textColor
0149                 }
0150 
0151                 Flickable {
0152                     id: topContentAreaLayout
0153                     Layout.fillWidth: true
0154                     Layout.preferredHeight: topContentArea.implicitHeight
0155                     contentWidth: topContentArea.implicitWidth
0156                     contentHeight: height
0157 
0158                     Behavior on contentX {
0159                         NumberAnimation {
0160                             duration: Kirigami.Units.longDuration * 2
0161                             easing.type: Easing.InOutQuad
0162                         }
0163                     }
0164 
0165                     RowLayout {
0166                         id: topContentArea
0167                         height: parent.height
0168 
0169                         Delegates.LocalSettingDelegate {
0170                             id: mycroftIntegrationDelegate
0171                             implicitWidth: desktopThemeView.view.cellWidth * 3
0172                             implicitHeight: desktopThemeView.view.cellHeight
0173                             isChecked: kcm.mycroftIntegrationActive() ? 1 : 0
0174                             name: "Mycroft Integration"
0175                             customType: "mycroftIntegration"
0176                             KeyNavigation.up: kcmcloseButton
0177                             KeyNavigation.right: pmInhibitionDelegate
0178                             KeyNavigation.down: desktopThemeView
0179                             onActiveFocusChanged: {
0180                                 if(activeFocus){
0181                                     contentLayout.currentSection = topContentArea
0182                                     topContentAreaLayout.contentX = mycroftIntegrationDelegate.x
0183                                 }
0184                             }
0185                         }
0186 
0187                         Delegates.LocalSettingDelegate {
0188                             id: pmInhibitionDelegate
0189                             implicitWidth: desktopThemeView.view.cellWidth * 3
0190                             implicitHeight: desktopThemeView.view.cellHeight
0191                             isChecked: kcm.pmInhibitionActive() ? 1 : 0
0192                             name: i18n("Power Inhibition")
0193                             customType: "pmInhibition"
0194                             KeyNavigation.up: kcmcloseButton
0195                             KeyNavigation.right: coloredTileDelegate
0196                             KeyNavigation.left: mycroftIntegrationDelegate
0197                             KeyNavigation.down: desktopThemeView
0198                             onActiveFocusChanged: {
0199                                 if(activeFocus){
0200                                     contentLayout.currentSection = topContentArea
0201                                     topContentAreaLayout.contentX = pmInhibitionDelegate.x
0202                                 }
0203                             }
0204                         }
0205 
0206                         Delegates.LocalSettingDelegate {
0207                             id: coloredTileDelegate
0208                             implicitWidth: desktopThemeView.view.cellWidth * 3
0209                             implicitHeight: desktopThemeView.view.cellHeight
0210                             isChecked: kcm.useColoredTiles() ? 1 : 0
0211                             name: i18n("Colored Tiles")
0212                             customType: "coloredTile"
0213                             KeyNavigation.up: kcmcloseButton
0214                             KeyNavigation.left: pmInhibitionDelegate
0215                             KeyNavigation.right: expandableTileDelegate
0216                             KeyNavigation.down: desktopThemeView
0217                             onActiveFocusChanged: {
0218                                 if(activeFocus){
0219                                     contentLayout.currentSection = topContentArea
0220                                     topContentAreaLayout.contentX = coloredTileDelegate.x
0221                                 }
0222                             }
0223                         }
0224 
0225                         Delegates.LocalSettingDelegate {
0226                             id: expandableTileDelegate
0227                             implicitWidth: desktopThemeView.cellWidth * 3
0228                             implicitHeight: desktopThemeView.cellHeight
0229                             isChecked: kcm.useExpandingTiles() ? 1 : 0
0230                             name: i18n("Expanding Tiles")
0231                             customType: "exapandableTile"
0232                             KeyNavigation.up: kcmcloseButton
0233                             KeyNavigation.left: coloredTileDelegate
0234                             KeyNavigation.right: timeDateSettingsDelegate
0235                             KeyNavigation.down: desktopThemeView
0236                             onActiveFocusChanged: {
0237                                 if(activeFocus){
0238                                     contentLayout.currentSection = topContentArea
0239                                     topContentAreaLayout.contentX = expandableTileDelegate.x
0240                                 }
0241                             }
0242                         }
0243 
0244                         Delegates.TimeDelegate {
0245                             id: timeDateSettingsDelegate
0246                             implicitWidth: desktopThemeView.cellWidth * 3
0247                             implicitHeight: desktopThemeView.cellHeight
0248                             name: i18n("Adjust Date & Time")
0249                             KeyNavigation.up: kcmcloseButton
0250                             KeyNavigation.left: expandableTileDelegate
0251                             KeyNavigation.down: desktopThemeView
0252                             onActiveFocusChanged: {
0253                                 if(activeFocus){
0254                                     contentLayout.currentSection = topContentArea
0255                                     topContentAreaLayout.contentX = timeDateSettingsDelegate.x
0256                                 }
0257                             }
0258                         }
0259                     }
0260                 }
0261 
0262                 Item {
0263                     Layout.fillWidth: true
0264                     Layout.preferredHeight: Kirigami.Units.largeSpacing * 2
0265                 }
0266 
0267                 BigScreen.TileView {
0268                     id: desktopThemeView
0269                     Layout.fillWidth: true
0270                     Layout.fillHeight: true
0271                     Layout.alignment: Qt.AlignTop
0272                     focus: true
0273                     model: kcm.themeListModel
0274                     view.cacheBuffer: parent.width * 2
0275                     title: i18n("General Appearance")
0276                     navigationUp: mycroftIntegrationDelegate
0277                     navigationDown: kcmcloseButton
0278                     enabled: !deviceTimeSettingsArea.opened
0279                     delegate: Delegates.ThemeDelegate {
0280                         text: model.display
0281                     }
0282 
0283                     onActiveFocusChanged: {
0284                         if(activeFocus){
0285                             contentLayout.currentSection = desktopThemeView
0286                         }
0287                     }
0288 
0289                     Behavior on x {
0290                         NumberAnimation {
0291                             duration: Kirigami.Units.longDuration * 2
0292                             easing.type: Easing.InOutQuad
0293                         }
0294                     }
0295                 }
0296             }
0297         }
0298 
0299         DeviceTimeSettings {
0300             id: deviceTimeSettingsArea
0301             anchors.top: parent.top
0302             anchors.bottom: parent.bottom
0303             anchors.right: parent.right
0304             anchors.rightMargin: -Kirigami.Units.smallSpacing
0305 
0306             property bool opened: false
0307 
0308             width: parent.width / 3.5
0309             visible: opened
0310             enabled: opened
0311         }
0312     }
0313 }
0314