Warning, /plasma/latte-dock/containment/package/contents/ui/applet/HiddenSpacer.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2016 Smith AR <audoban@openmailbox.org>
0003 SPDX-FileCopyrightText: 2016 Michail Vourlakos <mvourlakos@gmail.com>
0004 SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006
0007 import QtQuick 2.1
0008
0009 import org.kde.latte.core 0.2 as LatteCore
0010
0011 Item{
0012 id: hiddenSpacer
0013
0014 //we add one missing pixel from calculations
0015 width: root.isHorizontal ? nHiddenSize : wrapper.width
0016 height: root.isHorizontal ? wrapper.height : nHiddenSize
0017
0018 ///check also if this is the first/last plasmoid in anylayout
0019 visible: (isRightSpacer ? appletItem.lastAppletInContainer : appletItem.firstAppletInContainer) || separatorSpace>0
0020
0021 property bool hasNeighbourSeparator: isRightSpacer ? appletItem.headAppletIsSeparator : appletItem.tailAppletIsSeparator
0022
0023 property int separatorSpace: hasNeighbourSeparator && appletItem.parabolic.isEnabled ? LatteCore.Environment.separatorLength / 2 : 0
0024
0025 property real nHiddenSize: {
0026 if (isSeparator || !communicator.requires.lengthMarginsEnabled) {
0027 return 0;
0028 }
0029
0030 return (nScale > 0) ? (appletItem.spacersMaxSize * nScale) + separatorSpace : separatorSpace
0031 }
0032
0033 property bool isRightSpacer: false
0034
0035 property real nScale: 0
0036
0037 Behavior on nHiddenSize {
0038 id: animatedBehavior
0039 enabled: !appletItem.parabolic.directRenderingEnabled || restoreAnimation.running
0040 NumberAnimation { duration: 3 * appletItem.animationTime }
0041 }
0042
0043 Behavior on nHiddenSize {
0044 id: directBehavior
0045 enabled: !animatedBehavior.enabled
0046 NumberAnimation { duration: 0 }
0047 }
0048
0049 Connections{
0050 target: appletItem
0051 onContainsMouseChanged: {
0052 if (!appletItem.containsMouse) {
0053 hiddenSpacer.nScale = 0;
0054 }
0055 }
0056 }
0057
0058 Loader{
0059 active: appletItem.debug.spacersEnabled
0060
0061 sourceComponent: Rectangle{
0062 width: !root.isVertical ? hiddenSpacer.width : 1
0063 height: !root.isVertical ? 1 : hiddenSpacer.height
0064 x: root.isVertical ? hiddenSpacer.width/2 : 0
0065 y: !root.isVertical ? hiddenSpacer.height/2 : 0
0066
0067 border.width: 1
0068 border.color: "red"
0069 color: "transparent"
0070 }
0071 }
0072 }