Warning, /plasma/plasma-bigscreen/kcms/plasma-settings-shell/+mediacenter/ModulesListPage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002 
0003     SPDX-FileCopyrightText: 2011-2014 Sebastian Kügler <sebas@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 import QtQuick 2.14
0009 import QtQuick.Layouts 1.14
0010 import QtQuick.Controls 2.14 as Controls
0011 import org.kde.kirigami 2.12 as Kirigami
0012 import org.kde.plasma.core 2.0 as PlasmaCore
0013 import org.kde.plasma.settings 0.1
0014 
0015 Kirigami.Page {
0016     id: settingsRoot
0017 
0018     property alias currentIndex: listView.currentIndex
0019 
0020     Kirigami.Theme.colorSet: Kirigami.Theme.View
0021     background: Rectangle {
0022         color: Kirigami.Theme.backgroundColor
0023     }
0024 
0025     Component {
0026         id: settingsModuleDelegate
0027         Controls.ItemDelegate {
0028             id: delegateItem
0029 
0030             height: listView.height
0031             width: settingsRoot.width > Kirigami.Units.gridUnit * 20 ? settingsRoot.width/4 : settingsRoot.width
0032             enabled: true
0033             checked: listView.currentIndex == index
0034             leftPadding: Kirigami.Units.largeSpacing
0035             background: null
0036             Keys.onReturnPressed: clicked()
0037             contentItem: Item {
0038                 ColumnLayout {
0039                     anchors.centerIn: parent
0040                     spacing: Kirigami.Units.largeSpacing
0041                     Kirigami.Icon {
0042                         id: iconItem
0043                         Layout.alignment: Qt.AlignCenter
0044                         selected: delegateItem.down
0045                         Layout.maximumWidth: Layout.preferredWidth
0046                         Layout.preferredWidth: listView.currentIndex == index ? PlasmaCore.Units.iconSizes.enormous : PlasmaCore.Units.iconSizes.huge
0047                         Layout.preferredHeight: Layout.preferredWidth
0048                         Behavior on Layout.preferredWidth {
0049                             NumberAnimation {
0050                                 duration: Kirigami.Units.longDuration
0051                                 easing.type: Easing.InOutQuad
0052                             }
0053                         }
0054                         source: iconName
0055                     }
0056 
0057                     Controls.Label {
0058                         Layout.fillWidth: true
0059                         text: name
0060                         horizontalAlignment: Text.AlignHCenter
0061                     }
0062                     Controls.Label {
0063                         text: description
0064                         Layout.fillWidth: true
0065                         horizontalAlignment: Text.AlignHCenter
0066                         font.pointSize: Kirigami.Theme.defaultFont.pointSize -1
0067                         opacity: 0.6
0068                         elide: Text.ElideRight
0069                     }
0070                 }
0071             }
0072 
0073             onClicked: {
0074                 print("Clicked index: " + index + " current: " + listView.currentIndex + " " + name + " curr: " + rootItem.currentModule);
0075                 // Only the first main page has a kcm property
0076                 var container = kcmContainer.createObject(pageStack, {"kcm": model.kcm, "internalPage": model.kcm.mainUi});
0077                 pageStack.push(container);
0078             }
0079         }
0080     }
0081 
0082     // This is pretty much a placeholder of what will be the sandboxing mechanism: this element will be a wayland compositor that will contain off-process kcm pages
0083     Component {
0084         id: kcmContainer
0085 
0086         KCMContainer {}
0087     }
0088 
0089     contentItem: ListView {
0090         id: listView
0091         focus: true
0092         spacing: 0
0093         orientation: ListView.Horizontal
0094         activeFocusOnTab: true
0095         keyNavigationEnabled: true
0096         highlightFollowsCurrentItem: true
0097         highlightMoveDuration: Kirigami.Units.longDuration
0098         snapMode: ListView.SnapToItem
0099         model: ModulesProxyModel{}
0100         delegate: settingsModuleDelegate
0101     }
0102 }