Warning, /plasma/plasma-bigscreen/kcms/kdeconnect/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 2.12 as Kirigami
0014 import org.kde.kdeconnect 1.0
0015 import org.kde.kcmutils as KCM
0016 import org.kde.mycroft.bigscreen 1.0 as BigScreen
0017 import "delegates" as Delegates
0018 
0019 KCM.SimpleKCM {
0020     id: root
0021     
0022     title: i18n("KDE Connect")
0023     background: null
0024     leftPadding: Kirigami.Units.smallSpacing
0025     topPadding: 0
0026     rightPadding: Kirigami.Units.smallSpacing
0027     bottomPadding: 0
0028     
0029     Component.onCompleted: {
0030         connectionView.forceActiveFocus();
0031     }
0032 
0033     DevicesModel {
0034         id: allDevicesModel
0035     }
0036 
0037     contentItem: FocusScope {
0038 
0039         Rectangle {
0040             id: headerAreaTop
0041             anchors.left: parent.left
0042             anchors.right: parent.right
0043             anchors.leftMargin: -Kirigami.Units.largeSpacing
0044             anchors.rightMargin: -Kirigami.Units.largeSpacing
0045             height: parent.height * 0.075
0046             z: 10
0047             gradient: Gradient {
0048                 GradientStop { position: 0.1; color: Qt.rgba(0, 0, 0, 0.5) }
0049                 GradientStop { position: 0.9; color: Qt.rgba(0, 0, 0, 0.25) }
0050             }
0051 
0052             Kirigami.Heading {
0053                 level: 1
0054                 anchors.fill: parent
0055                 anchors.topMargin: Kirigami.Units.largeSpacing
0056                 anchors.leftMargin: Kirigami.Units.largeSpacing * 2
0057                 anchors.bottomMargin: Kirigami.Units.largeSpacing
0058                 color: Kirigami.Theme.textColor
0059                 text: "KDE Connect"
0060             }
0061         }
0062 
0063         Item {
0064             id: footerMain
0065             anchors.left: parent.left
0066             anchors.right: deviceConnectionView.left
0067             anchors.leftMargin: -Kirigami.Units.largeSpacing
0068             anchors.bottom: parent.bottom
0069             implicitHeight: Kirigami.Units.gridUnit * 2
0070 
0071             Button {
0072                 id: kcmcloseButton
0073                 implicitHeight: Kirigami.Units.gridUnit * 2
0074                 width: allDevicesModel.count > 0 ? parent.width : (root.width + Kirigami.Units.largeSpacing)
0075 
0076                 background: Rectangle {
0077                     color: kcmcloseButton.activeFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
0078                 }
0079 
0080                 contentItem: Item {
0081                     RowLayout {
0082                         anchors.centerIn: parent
0083                         Kirigami.Icon {
0084                             Layout.preferredWidth: PlasmaCore.Units.iconSizes.small
0085                             Layout.preferredHeight: PlasmaCore.Units.iconSizes.small
0086                             source: "window-close"
0087                         }
0088                         Label {
0089                             text: i18n("Exit")
0090                         }
0091                     }
0092                 }
0093 
0094                 Keys.onUpPressed: connectionView.forceActiveFocus()
0095 
0096                 onClicked: {
0097                     Window.window.close()
0098                 }
0099 
0100                 Keys.onReturnPressed: {
0101                     Window.window.close()
0102                 }
0103             }
0104         }
0105 
0106         Item {
0107             clip: true
0108             anchors.left: parent.left
0109             anchors.top: headerAreaTop.bottom
0110             anchors.bottom: footerMain.top
0111             width: parent.width - deviceConnectionView.width
0112 
0113             ColumnLayout {
0114                 anchors.fill: parent
0115                 anchors.leftMargin: Kirigami.Units.largeSpacing
0116                 anchors.topMargin: Kirigami.Units.largeSpacing * 2
0117 
0118                 BigScreen.TileView {
0119                     id: connectionView
0120                     focus: true
0121                     model:  allDevicesModel
0122                     Layout.alignment: Qt.AlignTop
0123                     title: allDevicesModel.count > 0 ? "Found Devices" : "No Devices Found"
0124                     currentIndex: 0
0125                     delegate: Delegates.DeviceDelegate{}
0126                     navigationDown: kcmcloseButton
0127                     Behavior on x {
0128                         NumberAnimation {
0129                             duration: Kirigami.Units.longDuration * 2
0130                             easing.type: Easing.InOutQuad
0131                         }
0132                     }
0133                     onCurrentItemChanged: {
0134                         deviceConnectionView.currentDevice = currentItem.deviceObj
0135                     }
0136                 }
0137             }
0138         }
0139 
0140         DeviceConnectionView {
0141             id: deviceConnectionView
0142             anchors.top: parent.top
0143             anchors.bottom: parent.bottom
0144             anchors.right: parent.right
0145             visible: allDevicesModel.count > 0 ? 1 : 0
0146             anchors.rightMargin: -Kirigami.Units.smallSpacing
0147             width: Kirigami.Units.gridUnit * 15
0148         }
0149     }
0150 }