Warning, /plasma/latte-dock/declarativeimports/components/AddingArea.qml is written in an unsupported language. File is not indexed.

0001 /*
0002 *  Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
0003 *
0004 *  This file is part of Latte-Dock
0005 *
0006 *  Latte-Dock is free software; you can redistribute it and/or
0007 *  modify it under the terms of the GNU General Public License as
0008 *  published by the Free Software Foundation; either version 2 of
0009 *  the License, or (at your option) any later version.
0010 *
0011 *  Latte-Dock is distributed in the hope that it will be useful,
0012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 *  GNU General Public License for more details.
0015 *
0016 *  You should have received a copy of the GNU General Public License
0017 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 import QtQuick 2.7
0021 
0022 import org.kde.plasma.plasmoid 2.0
0023 import org.kde.plasma.core 2.0 as PlasmaCore
0024 import org.kde.plasma.extras 2.0 as PlasmaExtras
0025 
0026 import "code/ColorizerTools.js" as ColorizerTools
0027 
0028 Rectangle{
0029     id: addingArea
0030     color: Qt.rgba(theme.backgroundColor.r, theme.backgroundColor.g, theme.backgroundColor.b, backgroundOpacity)
0031     border.width: 1
0032     border.color: outlineColor
0033 
0034     readonly property color outlineColorBase: theme.backgroundColor
0035     readonly property real outlineColorBaseBrightness: ColorizerTools.colorBrightness(outlineColorBase)
0036     readonly property color outlineColor: {
0037         if (outlineColorBaseBrightness > 127.5) {
0038             return Qt.darker(outlineColorBase, 1.5);
0039         } else {
0040             return Qt.lighter(outlineColorBase, 2.2);
0041         }
0042     }
0043 
0044     property real backgroundOpacity: 0.75
0045     property real duration: 2
0046     property string title: ""
0047 
0048 
0049     Behavior on opacity{
0050         NumberAnimation { duration: 2*addingArea.duration*appletItem.animationTime }
0051     }
0052 
0053     PlasmaExtras.Heading {
0054         id: heading
0055         width: parent.width
0056         height: parent.height * 0.4
0057 
0058         text: title
0059         horizontalAlignment: Text.AlignHCenter
0060         verticalAlignment: Text.AlignVCenter
0061         wrapMode: Text.WordWrap
0062         elide: Text.ElideRight
0063         fontSizeMode: Text.Fit
0064         color: theme.textColor
0065 
0066         rotation: {
0067             if (plasmoid.formFactor === PlasmaCore.Types.Horizontal)
0068                 return 0;
0069             else if (plasmoid.location === PlasmaCore.Types.LeftEdge)
0070                 return -90;
0071             else if (plasmoid.location === PlasmaCore.Types.RightEdge)
0072                 return 90;
0073         }
0074     }
0075 
0076     AddItem {
0077         anchors.horizontalCenter: parent.horizontalCenter
0078         anchors.top: heading.bottom
0079         anchors.topMargin: units.smallSpacing
0080 
0081         width: height
0082         height: (parent.height * 0.5) - 2 * units.smallSpacing
0083     }
0084 }