Warning, /plasma/latte-dock/declarativeimports/abilities/items/basicitem/IndicatorLevel.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 import QtQuick 2.7
0007 
0008 import org.kde.plasma.plasmoid 2.0
0009 import org.kde.plasma.core 2.0 as PlasmaCore
0010 
0011 import org.kde.latte.abilities.items 0.1 as AbilityItem
0012 
0013 AbilityItem.IndicatorLevel {
0014     id: indicatorLevel
0015     anchors.bottom: (abilityItem.location === PlasmaCore.Types.BottomEdge) ? parent.bottom : undefined
0016     anchors.top: (abilityItem.location === PlasmaCore.Types.TopEdge) ? parent.top : undefined
0017     anchors.left: (abilityItem.location === PlasmaCore.Types.LeftEdge) ? parent.left : undefined
0018     anchors.right: (abilityItem.location === PlasmaCore.Types.RightEdge) ? parent.right : undefined
0019 
0020     anchors.horizontalCenter: abilityItem.isHorizontal ? parent.horizontalCenter : undefined
0021     anchors.verticalCenter: abilityItem.isHorizontal ? undefined : parent.verticalCenter
0022 
0023     width: abilityItem.isHorizontal ? length : thickness
0024     height: abilityItem.isHorizontal ? thickness : length
0025 
0026     level.isDrawn: level.indicator && level.indicator.host && level.indicator.host.isEnabled && !abilityItem.isSeparator && !abilityItem.isHidden
0027 
0028     readonly property real length: abilityItem.preserveIndicatorInInitialPosition ?
0029                                        abilityItem.abilities.metrics.iconSize + abilityItem.abilities.metrics.totals.lengthPaddings :
0030                                        abilityItem.parabolicItem.length - 2*abilityItem.parabolicItem.zoom*abilityItem.abilities.metrics.margin.length
0031     readonly property real thickness: abilityItem.preserveIndicatorInInitialPosition ?
0032                                           abilityItem.abilities.metrics.thickness :
0033                                           abilityItem.parabolicItem.thickness
0034 
0035     Connections {
0036         target: abilityItem
0037         enabled: indicatorLevel.level.indicator.host ? indicatorLevel.level.indicator.host.info.needsMouseEventCoordinates : false
0038         onMousePressed: {
0039             var fixedPos = indicatorLevel.mapFromItem(abilityItem, x, y);
0040             level.mousePressed(Math.round(fixedPos.x), Math.round(fixedPos.y), button);
0041         }
0042         onMouseReleased: {
0043             var fixedPos = indicatorLevel.mapFromItem(abilityItem, x, y);
0044             level.mouseReleased(Math.round(fixedPos.x), Math.round(fixedPos.y), button);
0045         }
0046     }
0047 
0048     Connections {
0049         target: abilityItem
0050         onTaskLauncherActivated: level.taskLauncherActivated();
0051         onTaskGroupedWindowAdded: level.taskGroupedWindowAdded();
0052         onTaskGroupedWindowRemoved: level.taskGroupedWindowRemoved();
0053     }
0054 }