2021-08-24 13:42:11 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
|
|
|
|
* Copyright 2015 Marco Martin <mart@kde.org> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Library General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 2 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Library General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Library General Public *
|
|
|
|
* License along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
import QtQuick 2.0
|
|
|
|
import QtQuick.Layouts 1.1
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
|
|
|
|
|
|
PlasmaCore.ToolTipArea {
|
|
|
|
id: tooltip
|
|
|
|
|
|
|
|
property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
|
|
|
|
implicitWidth: PlasmaCore.Units.iconSizes.smallMedium
|
|
|
|
implicitHeight: implicitWidth
|
|
|
|
|
2022-04-19 20:04:22 +00:00
|
|
|
subText: systemTrayState.expanded ? i18n("Hide") : i18n("Show hidden icons")
|
2021-08-24 13:42:11 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: arrowMouseArea
|
|
|
|
anchors.fill: parent
|
2022-04-19 20:04:22 +00:00
|
|
|
anchors.leftMargin: 2
|
2021-08-24 13:42:11 +00:00
|
|
|
onClicked: systemTrayState.expanded = !systemTrayState.expanded
|
2022-04-19 20:04:22 +00:00
|
|
|
hoverEnabled: true
|
2021-08-24 13:42:11 +00:00
|
|
|
|
|
|
|
readonly property int arrowAnimationDuration: PlasmaCore.Units.shortDuration
|
|
|
|
|
|
|
|
PlasmaCore.Svg {
|
|
|
|
id: arrowSvg
|
|
|
|
imagePath: "widgets/arrows"
|
|
|
|
}
|
|
|
|
|
|
|
|
PlasmaCore.SvgItem {
|
|
|
|
id: arrow
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
2022-04-19 20:04:22 +00:00
|
|
|
width: Math.min(parent.width, parent.height)+1
|
|
|
|
height: width-1
|
2021-08-24 13:42:11 +00:00
|
|
|
|
2022-04-19 20:04:22 +00:00
|
|
|
/*rotation: systemTrayState.expanded ? 180 : 0
|
2021-08-24 13:42:11 +00:00
|
|
|
Behavior on rotation {
|
|
|
|
RotationAnimation {
|
|
|
|
duration: arrowMouseArea.arrowAnimationDuration
|
|
|
|
}
|
2022-04-19 20:04:22 +00:00
|
|
|
}*/
|
|
|
|
/*opacity: systemTrayState.expanded ? 0 : 1
|
2021-08-24 13:42:11 +00:00
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: arrowMouseArea.arrowAnimationDuration
|
|
|
|
}
|
2022-04-19 20:04:22 +00:00
|
|
|
}*/
|
|
|
|
PlasmaCore.FrameSvgItem {
|
|
|
|
id: hoverButton
|
|
|
|
z: -1
|
|
|
|
anchors.fill: parent
|
|
|
|
//anchors.leftMargin: 1
|
|
|
|
//anchors.rightMargin: 1
|
|
|
|
//anchors.topMargin: 2
|
|
|
|
imagePath: "widgets/systray"
|
|
|
|
//opacity: arrowMouseArea.containsMouse ? 1 : 0
|
|
|
|
prefix: {
|
|
|
|
if(arrowMouseArea.containsPress || systemTrayState.expanded) return "pressed";
|
|
|
|
if(arrowMouseArea.containsMouse) return "hover";
|
|
|
|
return "normal";
|
|
|
|
}
|
2021-08-24 13:42:11 +00:00
|
|
|
}
|
|
|
|
svg: arrowSvg
|
|
|
|
elementId: {
|
|
|
|
if (plasmoid.location === PlasmaCore.Types.TopEdge) {
|
|
|
|
return "down-arrow";
|
|
|
|
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
|
|
|
|
return "right-arrow";
|
|
|
|
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
|
|
|
|
return "left-arrow";
|
|
|
|
} else {
|
|
|
|
return "up-arrow";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-19 20:04:22 +00:00
|
|
|
/*PlasmaCore.SvgItem {
|
2021-08-24 13:42:11 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
width: arrow.width
|
|
|
|
height: arrow.height
|
|
|
|
|
|
|
|
rotation: systemTrayState.expanded ? 0 : -180
|
|
|
|
Behavior on rotation {
|
|
|
|
RotationAnimation {
|
|
|
|
duration: arrowMouseArea.arrowAnimationDuration
|
|
|
|
}
|
|
|
|
}
|
|
|
|
opacity: systemTrayState.expanded ? 1 : 0
|
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: arrowMouseArea.arrowAnimationDuration
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
svg: arrowSvg
|
|
|
|
elementId: {
|
|
|
|
if (plasmoid.location === PlasmaCore.Types.TopEdge) {
|
|
|
|
return "up-arrow";
|
|
|
|
} else if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
|
|
|
|
return "left-arrow";
|
|
|
|
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
|
|
|
|
return "right-arrow";
|
|
|
|
} else {
|
|
|
|
return "down-arrow";
|
|
|
|
}
|
|
|
|
}
|
2022-04-19 20:04:22 +00:00
|
|
|
}*/
|
2021-08-24 13:42:11 +00:00
|
|
|
}
|
|
|
|
}
|