Warning, /plasma/plasma-desktop/desktoppackage/contents/configuration/panelconfiguration/PanelRepresentation.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.15 0002 import QtQuick.Layouts 1.0 0003 import QtQuick.Window 2.15 0004 0005 import org.kde.plasma.components 3.0 as PC3 0006 import org.kde.plasma.core as PlasmaCore 0007 import org.kde.plasma.extras as PlasmaExtras 0008 import org.kde.ksvg 1.0 as KSvg 0009 import org.kde.plasma.shell.panel 0.1 as Panel 0010 import org.kde.kirigami 2.20 as Kirigami 0011 0012 Item { 0013 id: panelRepresentation 0014 0015 property string text: "" 0016 property var alignment: Qt.AlignHCenter | Qt.AlignBottom 0017 property string tooltip 0018 0019 property bool isVertical: false 0020 property bool checked: false 0021 property bool windowVisible: false 0022 property bool panelVisible: true 0023 property bool translucentPanel: false 0024 property bool sunkenPanel: false 0025 property bool adaptivePanel: false 0026 property bool fillAvailable: false 0027 property int floatingGap: 0 0028 property int windowZ: 0 0029 property var mainIconSource: null 0030 property int screenHeight: Math.round(screenRect.height / 2) 0031 0032 readonly property bool iconAndLabelsShouldlookSelected: checked || mouseArea.pressed 0033 0034 signal clicked() 0035 0036 implicitHeight: mainItem.height 0037 implicitWidth: mainItem.width 0038 0039 PC3.ToolTip { 0040 text: parent.tooltip 0041 visible: mouseArea.containsMouse && text.length > 0 0042 } 0043 0044 PlasmaExtras.Highlight { 0045 anchors.fill: parent 0046 anchors.margins: -Kirigami.Units.smallSpacing 0047 hovered: mouseArea.containsMouse 0048 pressed: panelRepresentation.iconAndLabelsShouldlookSelected 0049 } 0050 0051 MouseArea { 0052 id: mouseArea 0053 anchors.fill: parent 0054 hoverEnabled: true 0055 onClicked: parent.clicked() 0056 } 0057 0058 ColumnLayout { 0059 id: mainItem 0060 spacing: Kirigami.Units.smallSpacing 0061 Rectangle { 0062 id: screenRect 0063 0064 readonly property double margin: Kirigami.Units.smallSpacing * 2 0065 readonly property int floatingGap: panelRepresentation.floatingGap > -1 ? panelRepresentation.floatingGap : (panel.floating ? Kirigami.Units.smallSpacing : 0) 0066 0067 Layout.alignment: Qt.AlignHCenter 0068 implicitWidth: Math.round(Math.min(Kirigami.Units.gridUnit * 6, Screen.width * 0.1)) 0069 implicitHeight: Math.round(Math.min(Kirigami.Units.gridUnit * 4, Screen.width * 0.1)) 0070 color: Qt.tint(Kirigami.Theme.backgroundColor, Qt.rgba(1, 1, 1, 0.3)) 0071 border.color: Kirigami.Theme.highlightColor 0072 radius: 5 0073 clip: sunkenPanel 0074 0075 RowLayout { 0076 anchors.fill: parent 0077 Rectangle { 0078 id: panelImage 0079 0080 width: isVertical ? Math.round(parent.width / 6) : Math.round(parent.width * (fillAvailable ? 1 : 0.8)) 0081 height: isVertical ? Math.round(parent.height * (fillAvailable ? 1 : 0.8)) : Math.round(parent.height / 4) 0082 implicitWidth: width 0083 implicitHeight: height 0084 Layout.alignment: alignment 0085 Layout.bottomMargin: sunkenPanel * -Math.round(height / 2) + floatingGap 0086 color: panelRepresentation.translucentPanel ? screenRect.color : Kirigami.Theme.backgroundColor 0087 opacity: panelRepresentation.translucentPanel ? 0.8 : 1.0 0088 border.color: "transparent" 0089 visible: panelRepresentation.panelVisible 0090 clip: panelRepresentation.adaptivePanel 0091 radius: 5 0092 0093 z: 1 0094 0095 Loader { 0096 id: horizontalAdaptivePanelLoader 0097 active: panelRepresentation.adaptivePanel && !isVertical 0098 sourceComponent: Rectangle { 0099 anchors.verticalCenter: parent.verticalCenter 0100 anchors.left: parent.left 0101 anchors.leftMargin: Math.round(panelImage.width / 3) 0102 color: Qt.lighter(screenRect.color) 0103 border.color: Kirigami.Theme.highlightColor 0104 width: panelImage.width 0105 height: Math.round(panelImage.height * 4) 0106 radius: Math.round(height / 2) 0107 rotation: 45 0108 } 0109 } 0110 0111 Loader { 0112 id: verticalAdaptivePanelLoader 0113 active: panelRepresentation.adaptivePanel && isVertical 0114 sourceComponent: Rectangle { 0115 anchors.horizontalCenter: parent.horizontalCenter 0116 anchors.top: parent.top 0117 anchors.topMargin: Math.round(panelImage.height / 4) 0118 color: Qt.lighter(screenRect.color) 0119 border.color: Kirigami.Theme.highlightColor 0120 width: Math.round(panelImage.width * 2) 0121 height: panelImage.height 0122 radius: Math.round(height / 2) 0123 rotation: 45 0124 } 0125 } 0126 0127 Rectangle { 0128 id: panelBorder 0129 anchors.fill: parent 0130 color: "transparent" 0131 border.color: Kirigami.Theme.highlightColor 0132 radius: parent.radius 0133 } 0134 } 0135 } 0136 0137 Rectangle { 0138 id: window 0139 width: Math.round(parent.width / 2) 0140 height: Math.round(parent.height / 2) 0141 visible: panelRepresentation.windowVisible 0142 radius: 5 0143 color: Kirigami.Theme.highlightColor 0144 border.color: "transparent" 0145 0146 x: isVertical ? Math.round(panelImage.x + panelImage.width / 2) : Math.round(screenRect.width / 2 - width / 2) + Kirigami.Units.gridUnit 0147 y: isVertical ? Math.round(screenRect.height / 2 - height / 2) : Math.round(panelImage.y - height + panelImage.height / 2) 0148 z: panelRepresentation.windowZ 0149 0150 Row { 0151 anchors.top: parent.top 0152 anchors.right: parent.right 0153 anchors.margins: Kirigami.Units.smallSpacing 0154 spacing: Kirigami.Units.smallSpacing 0155 Repeater { 0156 model: 3 0157 delegate: Rectangle { 0158 width: Math.round(Kirigami.Units.gridUnit / 6) 0159 height: width 0160 radius: Math.round(height / 2) 0161 color: Kirigami.Theme.textColor 0162 } 0163 } 0164 } 0165 } 0166 0167 Kirigami.Icon { 0168 id: mainIcon 0169 visible: panelRepresentation.mainIconSource 0170 anchors.centerIn: parent 0171 transform: Translate { 0172 y: isVertical ? 0 : Math.round((mainIcon.y - panelImage.y) / 4) 0173 x: isVertical ? Math.round((mainIcon.x - panelImage.x) / 4) : 0 0174 } 0175 height: parent.height / 2 0176 source: panelRepresentation.mainIconSource 0177 } 0178 } 0179 } 0180 } 0181 0182