Warning, /plasma/latte-dock/declarativeimports/components/AddingArea.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2019 Michail Vourlakos <mvourlakos@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 import QtQuick 2.7 0007 import QtGraphicalEffects 1.0 0008 0009 import org.kde.plasma.plasmoid 2.0 0010 import org.kde.plasma.core 2.0 as PlasmaCore 0011 0012 import "code/ColorizerTools.js" as ColorizerTools 0013 0014 Rectangle{ 0015 id: addingArea 0016 color: Qt.rgba(theme.backgroundColor.r, theme.backgroundColor.g, theme.backgroundColor.b, backgroundOpacity) 0017 border.width: 1 0018 border.color: outlineColor 0019 0020 property bool drawAddCross: true 0021 0022 property int iconSize: 64 0023 0024 readonly property color outlineColorBase: theme.backgroundColor 0025 readonly property real outlineColorBaseBrightness: ColorizerTools.colorBrightness(outlineColorBase) 0026 readonly property color outlineColor: { 0027 if (outlineColorBaseBrightness > 127.5) { 0028 return Qt.darker(outlineColorBase, 1.5); 0029 } else { 0030 return Qt.lighter(outlineColorBase, 2.2); 0031 } 0032 } 0033 0034 property real backgroundOpacity: 0.75 0035 property real duration: 2 0036 property string title: "" 0037 0038 Behavior on opacity{ 0039 NumberAnimation { duration: 2*addingArea.duration*appletItem.animationTime } 0040 } 0041 0042 0043 Label { 0044 id: heading 0045 text: title 0046 color: theme.textColor 0047 font.bold: true 0048 0049 rotation: { 0050 if (plasmoid.location === PlasmaCore.Types.LeftEdge) { 0051 return 90; 0052 } else if (plasmoid.location === PlasmaCore.Types.RightEdge) { 0053 return -90; 0054 } 0055 0056 return 0; 0057 } 0058 0059 transformOrigin: { 0060 if (plasmoid.location === PlasmaCore.Types.LeftEdge) { 0061 return Item.TopLeft; 0062 } else if (plasmoid.location === PlasmaCore.Types.RightEdge) { 0063 return Item.TopRight; 0064 } 0065 0066 return Item.Center; 0067 } 0068 0069 readonly property int lengthEdge: addingArea.radius + units.smallSpacing 0070 0071 layer.enabled: true 0072 layer.effect: DropShadow { 0073 radius: 4 0074 fast: true 0075 samples: 2 * radius 0076 color: "#020202" 0077 } 0078 0079 states: [ 0080 ///Bottom Edge 0081 State { 0082 name: "left" 0083 when: plasmoid.location === PlasmaCore.Types.LeftEdge 0084 0085 AnchorChanges { 0086 target: heading 0087 anchors{ top:parent.top; bottom:undefined; left:parent.right; right:undefined;} 0088 } 0089 0090 PropertyChanges { 0091 target: heading 0092 anchors{ topMargin: heading.lengthEdge; bottomMargin:0; leftMargin:-units.smallSpacing; rightMargin:-0;} 0093 } 0094 }, 0095 State { 0096 name: "right" 0097 when: plasmoid.location === PlasmaCore.Types.RightEdge 0098 0099 AnchorChanges { 0100 target: heading 0101 anchors{ top:parent.top; bottom:undefined; left:undefined; right:parent.left;} 0102 } 0103 0104 PropertyChanges { 0105 target: heading 0106 anchors{ topMargin:heading.lengthEdge; bottomMargin:0; leftMargin: 0; rightMargin:-units.smallSpacing;} 0107 } 0108 }, 0109 State { 0110 name: "top" 0111 when: plasmoid.location === PlasmaCore.Types.TopEdge 0112 0113 AnchorChanges { 0114 target: heading 0115 anchors{ top:undefined; bottom:parent.bottom; left:parent.left; right:undefined;} 0116 } 0117 0118 PropertyChanges { 0119 target: heading 0120 anchors{ topMargin:0; bottomMargin:units.smallSpacing; leftMargin: heading.lengthEdge; rightMargin:0;} 0121 } 0122 }, 0123 State { 0124 name: "bottom" 0125 when: plasmoid.location !== PlasmaCore.Types.TopEdge 0126 && plasmoid.location !== PlasmaCore.Types.LeftEdge 0127 && plasmoid.location !== PlasmaCore.Types.RightEdge 0128 0129 AnchorChanges { 0130 target: heading 0131 anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined;} 0132 } 0133 0134 PropertyChanges { 0135 target: heading 0136 anchors{ topMargin:units.smallSpacing; bottomMargin:0; leftMargin: heading.lengthEdge; rightMargin:0;} 0137 } 0138 } 0139 ] 0140 } 0141 0142 AddItem { 0143 anchors.centerIn: parent 0144 visible: drawAddCross 0145 width: thickness 0146 height: thickness 0147 0148 readonly property int thickness: Math.min(addingArea.iconSize, 0149 plasmoid.formFactor === PlasmaCore.Types.Horizontal ? (parent.height - freeSpace):(parent.width - freeSpace)) 0150 0151 readonly property int freeSpace: Math.max(16, (heading.implicitHeight + units.smallSpacing*2)) 0152 } 0153 }