Warning, /plasma/plasma-sdk/themeexplorer/package/contents/ui/delegates/panel.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
0003 *
0004 * SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006
0007 import QtQuick 2.0
0008 import QtQuick.Layouts 1.1
0009
0010 import org.kde.ksvg 1.0 as KSvg
0011 import org.kde.plasma.components 3.0 as PlasmaComponents
0012 import org.kde.kirigami 2.20 as Kirigami
0013
0014 Item {
0015 KSvg.Svg {
0016 imagePath: model.imagePath
0017 onRepaintNeeded: {
0018 bottomPanelShadow.visible = bottomPanelShadow.hasElementPrefix("shadow")
0019 topPanelShadow.visible = topPanelShadow.hasElementPrefix("shadow")
0020 leftPanelShadow.visible = leftPanelShadow.hasElementPrefix("shadow")
0021 rightPanelShadow.visible = rightPanelShadow.hasElementPrefix("shadow")
0022 }
0023 }
0024 Rectangle {
0025 id: background
0026 anchors {
0027 fill: parent
0028 margins: Kirigami.Units.gridUnit
0029 }
0030 radius: 3
0031 color: Kirigami.Theme.backgroundColor
0032 opacity: 0.6
0033 }
0034
0035 KSvg.FrameSvgItem {
0036 id: bottomPanelShadow
0037 anchors {
0038 horizontalCenter: background.horizontalCenter
0039 bottom: background.bottom
0040 }
0041 width: background.width * 0.7
0042 height: background.width * 0.2
0043 enabledBorders: KSvg.FrameSvgItem.TopBorder | KSvg.FrameSvgItem.LeftBorder | KSvg.FrameSvgItem.RightBorder
0044 imagePath: model.imagePath
0045 onImagePathChanged: visible = hasElementPrefix("shadow")
0046 prefix: "shadow"
0047 }
0048
0049 KSvg.FrameSvgItem {
0050 anchors {
0051 fill: bottomPanelShadow
0052 leftMargin: bottomPanelShadow.margins.left
0053 topMargin: bottomPanelShadow.margins.top
0054 rightMargin: bottomPanelShadow.margins.right
0055 bottomMargin: bottomPanelShadow.margins.bottom
0056 }
0057 imagePath: model.imagePath
0058 enabledBorders: bottomPanelShadow.enabledBorders
0059
0060 Rectangle {
0061 id: marginsRectangle
0062 anchors {
0063 fill: parent
0064 leftMargin: parent.margins.left
0065 topMargin: parent.margins.top
0066 rightMargin: parent.margins.right
0067 bottomMargin: parent.margins.bottom
0068 }
0069 color: "green"
0070 opacity: 0.5
0071 visible: root.showMargins
0072 }
0073 }
0074
0075 KSvg.FrameSvgItem {
0076 id: leftPanelShadow
0077 anchors {
0078 verticalCenter: background.verticalCenter
0079 left: background.left
0080 }
0081 height: background.height - background.width * 0.2
0082 width: background.width * 0.2
0083 enabledBorders: KSvg.FrameSvgItem.TopBorder | KSvg.FrameSvgItem.BottomBorder | KSvg.FrameSvgItem.RightBorder
0084 imagePath: model.imagePath
0085 onImagePathChanged: visible = hasElementPrefix("shadow")
0086 prefix: "shadow"
0087 }
0088
0089 KSvg.FrameSvgItem {
0090 anchors {
0091 fill: leftPanelShadow
0092 leftMargin: leftPanelShadow.margins.left
0093 topMargin: leftPanelShadow.margins.top
0094 rightMargin: leftPanelShadow.margins.right
0095 bottomMargin: leftPanelShadow.margins.bottom
0096 }
0097 imagePath: model.imagePath
0098 enabledBorders: leftPanelShadow.enabledBorders
0099
0100 Rectangle {
0101 anchors {
0102 fill: parent
0103 leftMargin: parent.margins.left
0104 topMargin: parent.margins.top
0105 rightMargin: parent.margins.right
0106 bottomMargin: parent.margins.bottom
0107 }
0108 color: "green"
0109 opacity: 0.5
0110 visible: root.showMargins
0111 }
0112 }
0113
0114 KSvg.FrameSvgItem {
0115 id: topPanelShadow
0116 anchors {
0117 horizontalCenter: background.horizontalCenter
0118 top: background.top
0119 }
0120 width: background.width * 0.7
0121 height: background.width * 0.2
0122 enabledBorders: KSvg.FrameSvgItem.BottomBorder | KSvg.FrameSvgItem.LeftBorder | KSvg.FrameSvgItem.RightBorder
0123 imagePath: model.imagePath
0124 onImagePathChanged: visible = hasElementPrefix("shadow")
0125 prefix: "shadow"
0126 }
0127
0128 KSvg.FrameSvgItem {
0129 anchors {
0130 fill: topPanelShadow
0131 leftMargin: topPanelShadow.margins.left
0132 topMargin: topPanelShadow.margins.top
0133 rightMargin: topPanelShadow.margins.right
0134 bottomMargin: topPanelShadow.margins.bottom
0135 }
0136 imagePath: model.imagePath
0137 enabledBorders: topPanelShadow.enabledBorders
0138
0139 Rectangle {
0140 anchors {
0141 fill: parent
0142 leftMargin: parent.margins.left
0143 topMargin: parent.margins.top
0144 rightMargin: parent.margins.right
0145 bottomMargin: parent.margins.bottom
0146 }
0147 color: "green"
0148 opacity: 0.5
0149 visible: root.showMargins
0150 }
0151 }
0152
0153 KSvg.FrameSvgItem {
0154 id: rightPanelShadow
0155 anchors {
0156 verticalCenter: background.verticalCenter
0157 right: background.right
0158 }
0159 height: background.height - background.width * 0.2
0160 width: background.width * 0.2
0161 enabledBorders: KSvg.FrameSvgItem.TopBorder | KSvg.FrameSvgItem.BottomBorder | KSvg.FrameSvgItem.LeftBorder
0162 imagePath: model.imagePath
0163 onImagePathChanged: visible = hasElementPrefix("shadow")
0164 prefix: "shadow"
0165 }
0166
0167 KSvg.FrameSvgItem {
0168 anchors {
0169 fill: rightPanelShadow
0170 leftMargin: rightPanelShadow.margins.left
0171 topMargin: rightPanelShadow.margins.top
0172 rightMargin: rightPanelShadow.margins.right
0173 bottomMargin: rightPanelShadow.margins.bottom
0174 }
0175 imagePath: model.imagePath
0176 enabledBorders: rightPanelShadow.enabledBorders
0177
0178 Rectangle {
0179 anchors {
0180 fill: parent
0181 leftMargin: parent.margins.left
0182 topMargin: parent.margins.top
0183 rightMargin: parent.margins.right
0184 bottomMargin: parent.margins.bottom
0185 }
0186 color: "green"
0187 opacity: 0.5
0188 visible: root.showMargins
0189 }
0190 }
0191
0192 PlasmaComponents.Label {
0193 anchors.centerIn: parent
0194 text: model.imagePath
0195 visible: width < marginsRectangle.width
0196 }
0197 }