Warning, /plasma/plasma-bigscreen/shell/contents/configuration/ConfigCategoryDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.0 0008 import QtQuick.Layouts 1.1 0009 import QtQuick.Controls 2.3 as QtControls 0010 import QtQuick.Window 2.2 0011 0012 import org.kde.kquickcontrolsaddons 2.0 0013 import org.kde.kirigami 2.5 as Kirigami 0014 0015 MouseArea { 0016 id: delegate 0017 0018 //BEGIN properties 0019 implicitWidth: delegateContents.implicitWidth + 4 * units.smallSpacing 0020 implicitHeight: delegateContents.height + units.smallSpacing * 4 0021 Layout.fillWidth: true 0022 hoverEnabled: true 0023 0024 property bool current: (model.kcm && pageStack.currentItem.kcm && model.kcm == pageStack.currentItem.kcm) || (model.source == pageStack.sourceFile) 0025 //END properties 0026 0027 //BEGIN functions 0028 function openCategory() { 0029 if (current) { 0030 return; 0031 } 0032 if (typeof(categories.currentItem) !== "undefined") { 0033 pageStack.invertAnimations = (categories.currentItem.x > delegate.x); 0034 categories.currentItem = delegate; 0035 } 0036 0037 if (model.source) { 0038 pageStack.sourceFile = model.source; 0039 } else if (model.kcm) { 0040 pageStack.sourceFile = ""; 0041 pageStack.sourceFile = Qt.resolvedUrl("ConfigurationKcmPage.qml"); 0042 pageStack.currentItem.kcm = model.kcm; 0043 } else { 0044 pageStack.sourceFile = ""; 0045 } 0046 pageStack.title = model.name 0047 } 0048 //END functions 0049 0050 //BEGIN connections 0051 onPressed: { 0052 categoriesScroll.forceActiveFocus() 0053 0054 if (current) { 0055 return; 0056 } 0057 0058 openCategory(); 0059 } 0060 onCurrentChanged: { 0061 if (current) { 0062 categories.currentItem = delegate; 0063 } 0064 } 0065 //END connections 0066 0067 //BEGIN UI components 0068 Rectangle { 0069 anchors.fill: parent 0070 color: Kirigami.Theme.highlightColor 0071 opacity: { // try to match Breeze style hover handling 0072 var active = categoriesScroll.activeFocus && Window.active 0073 if (current) { 0074 if (active) { 0075 return 1 0076 } else if (delegate.containsMouse) { 0077 return 0.6 0078 } else { 0079 return 0.3 0080 } 0081 } else if (delegate.containsMouse) { 0082 if (active) { 0083 return 0.3 0084 } else { 0085 return 0.1 0086 } 0087 } 0088 return 0 0089 } 0090 Behavior on opacity { 0091 NumberAnimation { 0092 duration: units.longDuration 0093 easing.type: Easing.InOutQuad 0094 } 0095 } 0096 } 0097 0098 ColumnLayout { 0099 id: delegateContents 0100 spacing: units.smallSpacing 0101 width: parent.width 0102 anchors.verticalCenter: parent.verticalCenter 0103 0104 QIconItem { 0105 id: iconItem 0106 Layout.alignment: Qt.AlignHCenter 0107 width: units.iconSizes.medium 0108 height: width 0109 icon: model.icon 0110 state: current && categoriesScroll.activeFocus ? QIconItem.SelectedState : QIconItem.DefaultState 0111 } 0112 0113 QtControls.Label { 0114 id: nameLabel 0115 Layout.fillWidth: true 0116 text: model.name 0117 wrapMode: Text.Wrap 0118 horizontalAlignment: Text.AlignHCenter 0119 color: current && categoriesScroll.activeFocus ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor 0120 Behavior on color { 0121 ColorAnimation { 0122 duration: units.longDuration 0123 easing.type: Easing.InOutQuad 0124 } 0125 } 0126 } 0127 } 0128 //END UI components 0129 }