1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-26 02:04:12 +03:00

add group indicator for Plasma style

This commit is contained in:
Michail Vourlakos 2019-03-17 01:52:45 +02:00
parent 10fbf41081
commit c39f0b4c8c
2 changed files with 197 additions and 98 deletions

View File

@ -23,10 +23,20 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.latte 0.2 as Latte
PlasmaCore.FrameSvgItem {
id: frame
Item {
readonly property Item parentItem: parent.manager
readonly property Item rootItem: parent
readonly property bool providesFrontLayer: true
//! Background Layer
Loader{
id: backLayer
anchors.fill: parent
active: rootItem.isBackLayer
sourceComponent: PlasmaCore.FrameSvgItem {
id: frame
property string basePrefix: "normal"
imagePath: parentItem.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks"
@ -136,4 +146,93 @@ PlasmaCore.FrameSvgItem {
}
}
]
}
}
//! Foreground Layer to draw arrows
Loader{
id: frontLayer
anchors.fill: parent
active: !rootItem.isBackLayer && !parentItem.isApplet && parentItem.isGroup
sourceComponent: Item {
anchors.fill: parent
PlasmaCore.Svg {
id: taskSvg
imagePath: "widgets/tasks"
}
Item {
id: iconBox
anchors.centerIn: parent
width: parentItem.currentIconSize
height: width
}
PlasmaCore.SvgItem {
id: arrow
implicitWidth: 0.25 * iconBox.width
implicitHeight: implicitWidth
svg: taskSvg
elementId: elementForLocation(plasmoid.location)
function elementForLocation(location) {
switch (location) {
case PlasmaCore.Types.LeftEdge:
return "group-expander-left";
case PlasmaCore.Types.TopEdge:
return "group-expander-top";
case PlasmaCore.Types.RightEdge:
return "group-expander-right";
case PlasmaCore.Types.BottomEdge:
default:
return "group-expander-bottom";
}
}
}
states: [
State {
name: "bottom"
when: plasmoid.location == PlasmaCore.Types.BottomEdge
AnchorChanges {
target: arrow
anchors.top: undefined; anchors.left: undefined; anchors.right: undefined; anchors.bottom: arrow.parent.bottom;
anchors.horizontalCenter: iconBox.horizontalCenter; anchors.verticalCenter: undefined;
}
},
State {
name: "top"
when: plasmoid.location == PlasmaCore.Types.TopEdge
AnchorChanges {
target: arrow
anchors.top: arrow.parent.top; anchors.left: undefined; anchors.right: undefined; anchors.bottom: undefined;
anchors.horizontalCenter: iconBox.horizontalCenter; anchors.verticalCenter: undefined;
}
},
State {
name: "left"
when: plasmoid.location == PlasmaCore.Types.LeftEdge
AnchorChanges {
target: arrow
anchors.top: undefined; anchors.left: arrow.parent.left; anchors.right: undefined; anchors.bottom: undefined;
anchors.horizontalCenter: undefined; anchors.verticalCenter: iconBox.verticalCenter;
}
},
State {
name: "right"
when: plasmoid.location == PlasmaCore.Types.RightEdge
AnchorChanges {
target: arrow
anchors.top: undefined; anchors.left: undefined; anchors.right: arrow.parent.right; anchors.bottom: undefined;
anchors.horizontalCenter: undefined; anchors.verticalCenter: iconBox.verticalCenter;
}
}
]
}
}
}

View File

@ -29,8 +29,8 @@ import "../code/ColorizerTools.js" as ColorizerTools
Item{
id: indicatorItem
property Item parentItem: parent.manager
property Item rootItem: parent
readonly property Item parentItem: parent.manager
readonly property Item rootItem: parent
readonly property bool needsIconColors: true
readonly property bool providesFrontLayer: true