Warning, /utilities/kirogi/src/ui/components/PillBox.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright 2019 Eike Hein <hein@kde.org>
0003 *
0004 * This program is free software; you can redistribute it and/or
0005 * modify it under the terms of the GNU General Public License as
0006 * published by the Free Software Foundation; either version 2 of
0007 * the License or (at your option) version 3 or any later version
0008 * accepted by the membership of KDE e.V. (or its successor approved
0009 * by the membership of KDE e.V.), which shall act as a proxy
0010 * defined in Section 14 of version 3 of the license.
0011 *
0012 * This program is distributed in the hope that it will be useful,
0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0015 * GNU General Public License for more details.
0016 *
0017 * You should have received a copy of the GNU General Public License
0018 * along with this program. If not, see <http://www.gnu.org/licenses/>.
0019 */
0020
0021 import QtQuick 2.12
0022 import QtGraphicalEffects 1.12
0023 import QtQuick.Window 2.12
0024
0025 import org.kde.kirigami 2.6 as Kirigami
0026
0027 Item {
0028 id: pillBox
0029
0030 LayoutMirroring.enabled: false
0031 LayoutMirroring.childrenInherit: true
0032
0033 property Item background: null
0034 property var backgroundColor: "black"
0035 property real backgroundOpacity: 0.31
0036 property var borderColor: "white"
0037 property var borderWidth: 2
0038 property var borderRadius: height / 2
0039
0040 Item {
0041 id: pillShapeMask
0042
0043 visible: false
0044
0045 anchors.fill: parent
0046
0047 Rectangle {
0048 visible: true
0049
0050 anchors.left: parent.left
0051
0052 width: parent.height
0053 height: width
0054
0055 radius: borderRadius
0056
0057 color: "black"
0058 }
0059
0060 Rectangle {
0061 visible: true
0062
0063 anchors.right: parent.right
0064
0065 width: parent.height
0066 height: width
0067
0068 radius: borderRadius
0069
0070 color: "black"
0071 }
0072
0073 Rectangle {
0074 visible: true
0075
0076 anchors.left: parent.left
0077 anchors.leftMargin: parent.height / 2
0078 anchors.right: parent.right
0079 anchors.rightMargin: parent.height / 2
0080
0081 height: parent.height
0082
0083 color: "black"
0084 }
0085 }
0086
0087 BlurredBackground {
0088 sourceItem: background
0089 mask: pillShapeMask
0090 }
0091
0092 Rectangle {
0093 id: plate
0094
0095 anchors.fill: parent
0096
0097 color: backgroundColor
0098 opacity: backgroundOpacity
0099
0100 layer.enabled: true
0101 layer.effect: OpacityMask {
0102 anchors.fill: parent
0103 maskSource: pillShapeMask
0104 }
0105 }
0106
0107 Item {
0108 id: leftBorderMask
0109
0110 visible: false
0111
0112 anchors.fill: leftBorder
0113
0114 Rectangle {
0115 visible: true
0116
0117 anchors.fill: parent
0118 anchors.rightMargin: leftBorder.width - leftBorder.radius
0119
0120 color: "black"
0121 }
0122 }
0123
0124 Rectangle {
0125 id: leftBorder
0126
0127 anchors.left: parent.left
0128
0129 width: parent.height
0130 height: width
0131
0132 radius: borderRadius
0133
0134 color: "transparent"
0135 opacity: 0.69
0136
0137 border.width: borderWidth
0138 border.color: borderColor
0139
0140 layer.enabled: true
0141 layer.effect: OpacityMask {
0142 anchors.fill: leftBorder
0143
0144 maskSource: leftBorderMask
0145 }
0146 }
0147
0148 Item {
0149 id: rightBorderMask
0150
0151 visible: false
0152
0153 anchors.fill: rightBorder
0154
0155 Rectangle {
0156 visible: true
0157
0158 anchors.fill: parent
0159 anchors.leftMargin: rightBorder.width - rightBorder.radius
0160
0161 color: "black"
0162 }
0163 }
0164
0165 Rectangle {
0166 id: rightBorder
0167
0168 anchors.right: parent.right
0169
0170 width: parent.height
0171 height: width
0172
0173 radius: borderRadius
0174
0175 color: "transparent"
0176 opacity: leftBorder.opacity
0177 border.width: borderWidth
0178 border.color: borderColor
0179
0180 layer.enabled: true
0181 layer.effect: OpacityMask {
0182 anchors.fill: rightBorder
0183
0184 maskSource: rightBorderMask
0185 }
0186 }
0187
0188 Item {
0189 id: middleBorderMask
0190
0191 visible: false
0192
0193 anchors.fill: middleBorder
0194
0195 Rectangle {
0196 visible: true
0197
0198 width: leftBorder.radius
0199 height: parent.height
0200
0201 color: "black"
0202 }
0203
0204 Rectangle {
0205 visible: true
0206
0207 anchors.fill: parent
0208 anchors.leftMargin: leftBorder.radius
0209 anchors.rightMargin: rightBorder.radius
0210 anchors.topMargin: borderWidth
0211 anchors.bottomMargin: borderWidth
0212
0213 color: "black"
0214 }
0215
0216 Rectangle {
0217 visible: true
0218
0219 anchors.right: parent.right
0220
0221 width: rightBorder.radius
0222 height: parent.height
0223
0224 color: "black"
0225 }
0226 }
0227
0228 Rectangle {
0229 id: middleBorder
0230
0231 anchors.fill: parent
0232
0233 color: "transparent"
0234 opacity: 0.7
0235
0236 border.width: borderWidth
0237 border.color: borderColor
0238
0239 layer.enabled: true
0240 layer.effect: OpacityMask {
0241 anchors.fill: middleBorder
0242
0243 maskSource: middleBorderMask
0244 invert: true
0245 }
0246 }
0247 }
0248