mirror of
https://github.com/KDE/latte-dock.git
synced 2025-08-21 13:49:29 +03:00
update all indicators to new architecture
--Latte/Plasma indicators were updated to new Indicators architecture that supports Back and Front Layers
This commit is contained in:
@ -34,21 +34,21 @@ Item{
|
||||
id: indicatorRoot
|
||||
|
||||
readonly property real factor: 0.08
|
||||
readonly property int size: factor * rootItem.currentIconSize
|
||||
readonly property int extraMaskThickness: rootItem.reversedEnabled && rootItem.glowEnabled ? 1.7 * (factor * rootItem.maxIconSize) : 0
|
||||
readonly property Item rootItem: parent
|
||||
readonly property int size: factor * parentItem.currentIconSize
|
||||
readonly property int extraMaskThickness: parentItem.reversedEnabled && parentItem.glowEnabled ? 1.7 * (factor * parentItem.maxIconSize) : 0
|
||||
readonly property Item parentItem: parent.manager
|
||||
|
||||
property real textColorBrightness: ColorizerTools.colorBrightness(theme.textColor)
|
||||
|
||||
property color isActiveColor: theme.buttonFocusColor
|
||||
property color minimizedColor: {
|
||||
if (rootItem.multiColorEnabled) {
|
||||
if (parentItem.multiColorEnabled) {
|
||||
return (textColorBrightness > 127.5 ? Qt.darker(theme.textColor, 1.7) : Qt.lighter(theme.textColor, 7));
|
||||
}
|
||||
|
||||
return isActiveColor;
|
||||
}
|
||||
property color notActiveColor: rootItem.isMinimized ? minimizedColor : isActiveColor
|
||||
property color notActiveColor: parentItem.isMinimized ? minimizedColor : isActiveColor
|
||||
|
||||
/*Rectangle{
|
||||
anchors.fill: parent
|
||||
@ -71,47 +71,47 @@ Item{
|
||||
Latte.GlowPoint{
|
||||
id:firstPoint
|
||||
opacity: {
|
||||
if (rootItem.isTask) {
|
||||
return rootItem.isLauncher || (rootItem.inRemoving && !activeAndReverseAnimation.running) ? 0 : 1
|
||||
if (parentItem.isTask) {
|
||||
return parentItem.isLauncher || (parentItem.inRemoving && !activeAndReverseAnimation.running) ? 0 : 1
|
||||
}
|
||||
|
||||
if (rootItem.isApplet) {
|
||||
return (rootItem.isActive || activeAndReverseAnimation.running) ? 1 : 0
|
||||
if (parentItem.isApplet) {
|
||||
return (parentItem.isActive || activeAndReverseAnimation.running) ? 1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
basicColor: rootItem.isActive || (rootItem.isGroup && rootItem.hasShown) ? indicatorRoot.isActiveColor : indicatorRoot.notActiveColor
|
||||
basicColor: parentItem.isActive || (parentItem.isGroup && parentItem.hasShown) ? indicatorRoot.isActiveColor : indicatorRoot.notActiveColor
|
||||
|
||||
size: indicatorRoot.size
|
||||
glow3D: rootItem.glow3D
|
||||
animation: Math.max(1.65*3*units.longDuration,rootItem.durationTime*3*units.longDuration)
|
||||
glow3D: parentItem.glow3D
|
||||
animation: Math.max(1.65*3*units.longDuration,parentItem.durationTime*3*units.longDuration)
|
||||
location: plasmoid.location
|
||||
glowOpacity: rootItem.glowOpacity
|
||||
contrastColor: rootItem.shadowColor
|
||||
glowOpacity: parentItem.glowOpacity
|
||||
contrastColor: parentItem.shadowColor
|
||||
attentionColor: theme.negativeTextColor
|
||||
|
||||
roundCorners: true
|
||||
showAttention: rootItem.inAttention
|
||||
showAttention: parentItem.inAttention
|
||||
showGlow: {
|
||||
if (rootItem.glowEnabled && (rootItem.glowOption === Latte.Types.GlowAll || showAttention ))
|
||||
if (parentItem.glowEnabled && (parentItem.glowOption === Latte.Types.GlowAll || showAttention ))
|
||||
return true;
|
||||
else if (rootItem.glowEnabled && rootItem.glowOption === Latte.Types.GlowOnlyOnActive && rootItem.hasActive)
|
||||
else if (parentItem.glowEnabled && parentItem.glowOption === Latte.Types.GlowOnlyOnActive && parentItem.hasActive)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
showBorder: rootItem.glowEnabled && rootItem.glow3D
|
||||
showBorder: parentItem.glowEnabled && parentItem.glow3D
|
||||
|
||||
property int stateWidth: rootItem.isGroup ? indicatorRoot.width - secondPoint.width : indicatorRoot.width - spacer.width
|
||||
property int stateHeight: rootItem.isGroup ? indicatorRoot.height - secondPoint.height : indicatorRoot.width - spacer.height
|
||||
property int stateWidth: parentItem.isGroup ? indicatorRoot.width - secondPoint.width : indicatorRoot.width - spacer.width
|
||||
property int stateHeight: parentItem.isGroup ? indicatorRoot.height - secondPoint.height : indicatorRoot.width - spacer.height
|
||||
|
||||
property int animationTime: rootItem.durationTime* (0.7*units.longDuration)
|
||||
property int animationTime: parentItem.durationTime* (0.7*units.longDuration)
|
||||
|
||||
property bool isActive: rootItem.hasActive || rootItem.isActive
|
||||
property bool isActive: parentItem.hasActive || parentItem.isActive
|
||||
|
||||
property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
|
||||
|
||||
property real scaleFactor: rootItem.scaleFactor
|
||||
property real scaleFactor: parentItem.scaleFactor
|
||||
|
||||
function updateInitialSizes(){
|
||||
if(indicatorRoot){
|
||||
@ -120,12 +120,12 @@ Item{
|
||||
else
|
||||
height = indicatorRoot.size;
|
||||
|
||||
if(vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
if(vertical && isActive && parentItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
height = stateHeight;
|
||||
else
|
||||
height = indicatorRoot.size;
|
||||
|
||||
if(!vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
if(!vertical && isActive && parentItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
width = stateWidth;
|
||||
else
|
||||
width = indicatorRoot.size;
|
||||
@ -134,26 +134,26 @@ Item{
|
||||
|
||||
|
||||
onIsActiveChanged: {
|
||||
if (rootItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
if (parentItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
activeAndReverseAnimation.start();
|
||||
}
|
||||
|
||||
onScaleFactorChanged: {
|
||||
if(!activeAndReverseAnimation.running && !vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator){
|
||||
if(!activeAndReverseAnimation.running && !vertical && isActive && parentItem.activeIndicatorType === Latte.Types.LineIndicator){
|
||||
width = stateWidth;
|
||||
}
|
||||
else if (!activeAndReverseAnimation.running && vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator){
|
||||
else if (!activeAndReverseAnimation.running && vertical && isActive && parentItem.activeIndicatorType === Latte.Types.LineIndicator){
|
||||
height = stateHeight;
|
||||
}
|
||||
}
|
||||
|
||||
onStateWidthChanged:{
|
||||
if(!activeAndReverseAnimation.running && !vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
if(!activeAndReverseAnimation.running && !vertical && isActive && parentItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
width = stateWidth;
|
||||
}
|
||||
|
||||
onStateHeightChanged:{
|
||||
if(!activeAndReverseAnimation.running && vertical && isActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
if(!activeAndReverseAnimation.running && vertical && isActive && parentItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
height = stateHeight;
|
||||
}
|
||||
|
||||
@ -162,18 +162,18 @@ Item{
|
||||
Component.onCompleted: {
|
||||
updateInitialSizes();
|
||||
|
||||
rootItem.onCurrentIconSizeChanged.connect(updateInitialSizes);
|
||||
parentItem.onCurrentIconSizeChanged.connect(updateInitialSizes);
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
rootItem.onCurrentIconSizeChanged.disconnect(updateInitialSizes);
|
||||
parentItem.onCurrentIconSizeChanged.disconnect(updateInitialSizes);
|
||||
}
|
||||
|
||||
NumberAnimation{
|
||||
id: activeAndReverseAnimation
|
||||
target: firstPoint
|
||||
property: plasmoid.formFactor === PlasmaCore.Types.Vertical ? "height" : "width"
|
||||
to: rootItem.hasActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator
|
||||
to: parentItem.hasActive && parentItem.activeIndicatorType === Latte.Types.LineIndicator
|
||||
? (plasmoid.formFactor === PlasmaCore.Types.Vertical ? firstPoint.stateHeight : firstPoint.stateWidth) : indicatorRoot.size
|
||||
duration: firstPoint.animationTime
|
||||
easing.type: Easing.InQuad
|
||||
@ -194,32 +194,32 @@ Item{
|
||||
height: width
|
||||
|
||||
size: indicatorRoot.size
|
||||
glow3D: rootItem.glow3D
|
||||
animation: Math.max(1.65*3*units.longDuration,rootItem.durationTime*3*units.longDuration)
|
||||
glow3D: parentItem.glow3D
|
||||
animation: Math.max(1.65*3*units.longDuration,parentItem.durationTime*3*units.longDuration)
|
||||
location: plasmoid.location
|
||||
glowOpacity: rootItem.glowOpacity
|
||||
contrastColor: rootItem.shadowColor
|
||||
showBorder: rootItem.glowEnabled && rootItem.glow3D
|
||||
glowOpacity: parentItem.glowOpacity
|
||||
contrastColor: parentItem.shadowColor
|
||||
showBorder: parentItem.glowEnabled && parentItem.glow3D
|
||||
|
||||
basicColor: state2Color
|
||||
roundCorners: true
|
||||
showGlow: rootItem.glowEnabled && rootItem.glowOption === Latte.Types.GlowAll
|
||||
visible: ( rootItem.isGroup && ((rootItem.dotsOnActive && rootItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
|| rootItem.activeIndicatorType === Latte.Types.DotIndicator
|
||||
|| !rootItem.hasActive) )? true: false
|
||||
showGlow: parentItem.glowEnabled && parentItem.glowOption === Latte.Types.GlowAll
|
||||
visible: ( parentItem.isGroup && ((parentItem.dotsOnActive && parentItem.activeIndicatorType === Latte.Types.LineIndicator)
|
||||
|| parentItem.activeIndicatorType === Latte.Types.DotIndicator
|
||||
|| !parentItem.hasActive) )? true: false
|
||||
|
||||
//when there is no active window
|
||||
property color state1Color: rootItem.hasShown ? indicatorRoot.isActiveColor : indicatorRoot.minimizedColor
|
||||
property color state1Color: parentItem.hasShown ? indicatorRoot.isActiveColor : indicatorRoot.minimizedColor
|
||||
//when there is active window
|
||||
property color state2Color: rootItem.hasMinimized ? indicatorRoot.minimizedColor : indicatorRoot.isActiveColor
|
||||
property color state2Color: parentItem.hasMinimized ? indicatorRoot.minimizedColor : indicatorRoot.isActiveColor
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "left"
|
||||
when: ((plasmoid.location === PlasmaCore.Types.LeftEdge && !rootItem.reversedEnabled) ||
|
||||
(plasmoid.location === PlasmaCore.Types.RightEdge && rootItem.reversedEnabled))
|
||||
when: ((plasmoid.location === PlasmaCore.Types.LeftEdge && !parentItem.reversedEnabled) ||
|
||||
(plasmoid.location === PlasmaCore.Types.RightEdge && parentItem.reversedEnabled))
|
||||
|
||||
AnchorChanges {
|
||||
target: mainIndicatorElement
|
||||
@ -229,8 +229,8 @@ Item{
|
||||
},
|
||||
State {
|
||||
name: "bottom"
|
||||
when: ((plasmoid.location === PlasmaCore.Types.BottomEdge && !rootItem.reversedEnabled) ||
|
||||
(plasmoid.location === PlasmaCore.Types.TopEdge && rootItem.reversedEnabled))
|
||||
when: ((plasmoid.location === PlasmaCore.Types.BottomEdge && !parentItem.reversedEnabled) ||
|
||||
(plasmoid.location === PlasmaCore.Types.TopEdge && parentItem.reversedEnabled))
|
||||
|
||||
AnchorChanges {
|
||||
target: mainIndicatorElement
|
||||
@ -240,8 +240,8 @@ Item{
|
||||
},
|
||||
State {
|
||||
name: "top"
|
||||
when: ((plasmoid.location === PlasmaCore.Types.TopEdge && !rootItem.reversedEnabled) ||
|
||||
(plasmoid.location === PlasmaCore.Types.BottomEdge && rootItem.reversedEnabled))
|
||||
when: ((plasmoid.location === PlasmaCore.Types.TopEdge && !parentItem.reversedEnabled) ||
|
||||
(plasmoid.location === PlasmaCore.Types.BottomEdge && parentItem.reversedEnabled))
|
||||
|
||||
AnchorChanges {
|
||||
target: mainIndicatorElement
|
||||
@ -251,8 +251,8 @@ Item{
|
||||
},
|
||||
State {
|
||||
name: "right"
|
||||
when: ((plasmoid.location === PlasmaCore.Types.RightEdge && !rootItem.reversedEnabled) ||
|
||||
(plasmoid.location === PlasmaCore.Types.LeftEdge && rootItem.reversedEnabled))
|
||||
when: ((plasmoid.location === PlasmaCore.Types.RightEdge && !parentItem.reversedEnabled) ||
|
||||
(plasmoid.location === PlasmaCore.Types.LeftEdge && parentItem.reversedEnabled))
|
||||
|
||||
AnchorChanges {
|
||||
target: mainIndicatorElement
|
||||
|
@ -26,34 +26,34 @@ import org.kde.latte 0.2 as Latte
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: frame
|
||||
|
||||
readonly property Item rootItem: parent
|
||||
readonly property Item parentItem: parent.manager
|
||||
property string basePrefix: "normal"
|
||||
|
||||
imagePath: rootItem.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks"
|
||||
imagePath: parentItem.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks"
|
||||
|
||||
prefix: {
|
||||
if (rootItem.usePlasmaTabsStyle) {
|
||||
if (!rootItem.isActive) {
|
||||
if (parentItem.usePlasmaTabsStyle) {
|
||||
if (!parentItem.isActive) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if ((plasmoid.location === PlasmaCore.Types.LeftEdge && !rootItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.RightEdge && rootItem.reversedEnabled)) {
|
||||
if ((plasmoid.location === PlasmaCore.Types.LeftEdge && !parentItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.RightEdge && parentItem.reversedEnabled)) {
|
||||
return "west-active-tab";
|
||||
}
|
||||
|
||||
if ((plasmoid.location === PlasmaCore.Types.TopEdge && !rootItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.BottomEdge && rootItem.reversedEnabled)) {
|
||||
if ((plasmoid.location === PlasmaCore.Types.TopEdge && !parentItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.BottomEdge && parentItem.reversedEnabled)) {
|
||||
return "north-active-tab";
|
||||
}
|
||||
|
||||
if ((plasmoid.location === PlasmaCore.Types.RightEdge && !rootItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.LeftEdge && rootItem.reversedEnabled)) {
|
||||
if ((plasmoid.location === PlasmaCore.Types.RightEdge && !parentItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.LeftEdge && parentItem.reversedEnabled)) {
|
||||
return "east-active-tab";
|
||||
}
|
||||
|
||||
if ((plasmoid.location === PlasmaCore.Types.BottomEdge && !rootItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.TopEdge && rootItem.reversedEnabled)) {
|
||||
if ((plasmoid.location === PlasmaCore.Types.BottomEdge && !parentItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.TopEdge && parentItem.reversedEnabled)) {
|
||||
return "south-active-tab";
|
||||
}
|
||||
|
||||
@ -66,23 +66,23 @@ PlasmaCore.FrameSvgItem {
|
||||
function taskPrefix(prefix) {
|
||||
var effectivePrefix;
|
||||
|
||||
if ((plasmoid.location === PlasmaCore.Types.LeftEdge && !rootItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.RightEdge && rootItem.reversedEnabled)) {
|
||||
if ((plasmoid.location === PlasmaCore.Types.LeftEdge && !parentItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.RightEdge && parentItem.reversedEnabled)) {
|
||||
effectivePrefix = "west-" + prefix;
|
||||
}
|
||||
|
||||
if ((plasmoid.location === PlasmaCore.Types.TopEdge && !rootItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.BottomEdge && rootItem.reversedEnabled)) {
|
||||
if ((plasmoid.location === PlasmaCore.Types.TopEdge && !parentItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.BottomEdge && parentItem.reversedEnabled)) {
|
||||
effectivePrefix = "north-" + prefix;
|
||||
}
|
||||
|
||||
if ((plasmoid.location === PlasmaCore.Types.RightEdge && !rootItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.LeftEdge && rootItem.reversedEnabled)) {
|
||||
if ((plasmoid.location === PlasmaCore.Types.RightEdge && !parentItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.LeftEdge && parentItem.reversedEnabled)) {
|
||||
effectivePrefix = "east-" + prefix;
|
||||
}
|
||||
|
||||
if ((plasmoid.location === PlasmaCore.Types.BottomEdge && !rootItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.TopEdge && rootItem.reversedEnabled)) {
|
||||
if ((plasmoid.location === PlasmaCore.Types.BottomEdge && !parentItem.reversedEnabled)
|
||||
|| (plasmoid.location === PlasmaCore.Types.TopEdge && parentItem.reversedEnabled)) {
|
||||
effectivePrefix = "south-" + prefix;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ PlasmaCore.FrameSvgItem {
|
||||
states: [
|
||||
State {
|
||||
name: "launcher"
|
||||
when: rootItem.isLauncher || (rootItem.isApplet && !rootItem.isActive)
|
||||
when: parentItem.isLauncher || (parentItem.isApplet && !parentItem.isActive)
|
||||
|
||||
PropertyChanges {
|
||||
target: frame
|
||||
@ -101,7 +101,7 @@ PlasmaCore.FrameSvgItem {
|
||||
},
|
||||
State {
|
||||
name: "attention"
|
||||
when: rootItem.inAttention
|
||||
when: parentItem.inAttention
|
||||
|
||||
PropertyChanges {
|
||||
target: frame
|
||||
@ -110,7 +110,7 @@ PlasmaCore.FrameSvgItem {
|
||||
},
|
||||
State {
|
||||
name: "minimized"
|
||||
when: rootItem.isMinimized
|
||||
when: parentItem.isMinimized
|
||||
|
||||
PropertyChanges {
|
||||
target: frame
|
||||
@ -119,7 +119,7 @@ PlasmaCore.FrameSvgItem {
|
||||
},
|
||||
State {
|
||||
name: "active"
|
||||
when: rootItem.isActive
|
||||
when: parentItem.isActive
|
||||
|
||||
PropertyChanges {
|
||||
target: frame
|
||||
|
Reference in New Issue
Block a user