move Plasma/UnityIndicators into liblatte2

pull/5/head
Michail Vourlakos 6 years ago
parent 529c6f0bab
commit d9fe9d438d

@ -496,6 +496,7 @@ Item {
//! Active Indicator loader
Loader{
id: indicatorLoader
anchors.fill: parent
active: (root.activeIndicator === Latte.Types.AllIndicator
@ -504,8 +505,18 @@ Item {
&& !(root.indicatorStyle === Latte.Types.UnityIndicator && !communicator.overlayLatteIconIsActive)
sourceComponent: root.indicatorStyle===Latte.Types.LatteIndicator ?
latteStyleIndicator : (root.indicatorStyle===Latte.Types.PlasmaIndicator ? plasmaStyleIndicator : unityStyleIndicator)
sourceComponent: {
switch (root.indicatorStyle) {
case Latte.Types.LatteIndicator:
return latteStyleIndicator;
case Latte.Types.PlasmaIndicator:
return plasmaStyleIndicator;
case Latte.Types.UnityIndicator:
return unityStyleIndicator;
default:
return latteStyleIndicator;
};
}
/* Indicators Properties in order use them*/
readonly property bool isTask: false
@ -540,6 +551,10 @@ Item {
readonly property real glowOpacity: root.glowOpacity
readonly property bool glow3D: root.glow3D
//!icon colors
property color backgroundColor: wrapper.overlayIconLoader.backgroundColor
property color glowColor: wrapper.overlayIconLoader.glowColor
Component {
id: latteStyleIndicator
Latte.LatteIndicator{}
@ -547,19 +562,12 @@ Item {
Component {
id: plasmaStyleIndicator
Indicators.PlasmaIndicator {
anchors.fill: parent
}
Latte.PlasmaIndicator{}
}
Component{
id:unityStyleIndicator
Indicators.UnityIndicator{
anchors.fill: parent
backgroundColor: wrapper.overlayIconLoader.backgroundColor
glowColor: wrapper.overlayIconLoader.glowColor
}
Latte.UnityIndicator{}
}
}

@ -1,5 +1,3 @@
/*
* Copyright 2016 Smith AR <audoban@openmailbox.org>
* Michail Vourlakos <mvourlakos@gmail.com>

@ -1,194 +0,0 @@
/*
* Copyright 2016 Smith AR <audoban@openmailbox.org>
* Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.latte 0.2 as Latte
Item{
id:indicatorRoot
width: !root.isVertical ? parent.width : size
height: root.isVertical ? parent.height : size
property int size: mimicPlasmaPanel ? 4 : 0.075*root.iconSize
property bool mimicPlasmaPanel: !root.latteApplet && plasmoid.configuration.panelSize===100 ?
!plasmoid.configuration.reverseLinesPosition : false
/*Rectangle{
anchors.fill: parent
border.width: 1
border.color: "yellow"
color: "transparent"
opacity:0.6
}*/
Latte.GlowPoint{
id:activePoint
anchors.centerIn: parent
size: indicatorRoot.size
basicColor: theme.buttonFocusColor
roundCorners: true
showGlow: root.showGlow
glow3D: root.glow3D
animation: Math.max(1.65*3*units.longDuration,root.durationTime*3*units.longDuration)
location: plasmoid.location
glowOpacity: root.glowOpacity
contrastColor: root.appShadowColorSolid
opacity:{
if ( (!vertical && width <= indicatorRoot.size && !appletItem.isActive)
|| (vertical && height <= indicatorRoot.size && !appletItem.isActive))
return 0;
return 1;
}
property bool vertical: root.isVertical
property int animationTime: root.durationTime * (1.2*units.longDuration)
property int stateWidth: root.activeIndicatorType === Latte.Types.DotIndicator ? indicatorRoot.size : indicatorRoot.width
property int stateHeight: root.activeIndicatorType === Latte.Types.DotIndicator ? indicatorRoot.size : indicatorRoot.height
property real scaleFactor: wrapper.zoomScale
function updateInitialSizes(){
if(indicatorRoot){
if(vertical)
width = indicatorRoot.size;
else
height = indicatorRoot.size;
if(vertical && appletItem.isActive)
height = stateHeight;
else
height = indicatorRoot.size;
if(!vertical && appletItem.isActive)
width = stateWidth;
else
width = indicatorRoot.size;
}
}
Connections{
target: appletItem
onIsActiveChanged: activeAndReverseAnimation.start();
}
onScaleFactorChanged: {
if ( root.activeIndicatorType === Latte.Types.LineIndicator ) {
if(!activeAndReverseAnimation.running && !root.vertical && appletItem.isActive){
width = stateWidth;
}
else if (!activeAndReverseAnimation.running && root.vertical && appletItem.isActive){
height = stateHeight;
}
}
}
onStateWidthChanged:{
if(!activeAndReverseAnimation.running && !vertical && appletItem.isActive && root.activeIndicatorType === Latte.Types.LineIndicator)
width = stateWidth;
}
onStateHeightChanged:{
if(!activeAndReverseAnimation.running && vertical && appletItem.isActive && root.activeIndicatorType === Latte.Types.LineIndicator)
height = stateHeight;
}
onVerticalChanged: updateInitialSizes();
Component.onCompleted: {
updateInitialSizes();
root.onIconSizeChanged.connect(updateInitialSizes);
}
Component.onDestruction: {
root.onIconSizeChanged.disconnect(updateInitialSizes);
}
NumberAnimation{
id: activeAndReverseAnimation
target: activePoint
property: root.isVertical ? "height" : "width"
to: !appletItem.isActive ? (root.isVertical ? activePoint.stateHeight : activePoint.stateWidth) : indicatorRoot.size
duration: activePoint.animationTime
easing.type: Easing.InQuad
onStopped: activePoint.updateInitialSizes()
}
}
states: [
State {
name: "left"
when: ((plasmoid.location === PlasmaCore.Types.LeftEdge && !root.reverseLinesPosition) ||
(plasmoid.location === PlasmaCore.Types.RightEdge && root.reverseLinesPosition))
AnchorChanges {
target: indicatorRoot
anchors{ verticalCenter:undefined; horizontalCenter:parent.horizontalCenter;
top:undefined; bottom:undefined; left:parent.left; right:undefined;}
}
},
State {
name: "bottom"
when: ((plasmoid.location === PlasmaCore.Types.BottomEdge && !root.reverseLinesPosition) ||
(plasmoid.location === PlasmaCore.Types.TopEdge && root.reverseLinesPosition))
AnchorChanges {
target: indicatorRoot
anchors{ verticalCenter:undefined; horizontalCenter:parent.horizontalCenter;
top:undefined; bottom:parent.bottom; left:undefined; right:undefined;}
}
},
State {
name: "top"
when: ((plasmoid.location === PlasmaCore.Types.TopEdge && !root.reverseLinesPosition) ||
(plasmoid.location === PlasmaCore.Types.BottomEdge && root.reverseLinesPosition))
AnchorChanges {
target: indicatorRoot
anchors{ verticalCenter:undefined; horizontalCenter:parent.horizontalCenter;
top:parent.top; bottom:undefined; left:undefined; right:undefined;}
}
},
State {
name: "right"
when: ((plasmoid.location === PlasmaCore.Types.RightEdge && !root.reverseLinesPosition) ||
(plasmoid.location === PlasmaCore.Types.LeftEdge && root.reverseLinesPosition))
AnchorChanges {
target: indicatorRoot
anchors{ verticalCenter:undefined; horizontalCenter:parent.horizontalCenter;
top:undefined; bottom:undefined; left:undefined; right:parent.right;}
}
}
]
}

@ -1,67 +0,0 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.latte 0.2 as Latte
PlasmaCore.FrameSvgItem {
id: expandedItem
anchors.fill: parent
imagePath: "widgets/tabbar"
visible: opacity > 0
prefix: {
var prefix;
switch (plasmoid.location) {
case PlasmaCore.Types.LeftEdge:
prefix = "west-active-tab";
break;
case PlasmaCore.Types.TopEdge:
prefix = "north-active-tab";
break;
case PlasmaCore.Types.RightEdge:
prefix = "east-active-tab";
break;
default:
prefix = "south-active-tab";
}
if (!hasElementPrefix(prefix)) {
prefix = "active-tab";
}
return prefix;
}
opacity: isActive ? 1 : 0
property bool isActive: (appletItem.isExpanded
&& communicator.overlayLatteIconIsActive
&& !appletItem.isSystray
&& applet.pluginName !== root.plasmoidName
&& applet.pluginName !== "org.kde.activeWindowControl"
&& applet.pluginName !== "org.kde.plasma.appmenu")
Behavior on opacity {
NumberAnimation {
duration: units.shortDuration
easing.type: Easing.InOutQuad
}
}
}

@ -1,56 +0,0 @@
/*
* Copyright 2019 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import QtGraphicalEffects 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.latte 0.2 as Latte
Rectangle {
id: unityRect
anchors.bottom: parent.bottom
anchors.bottomMargin: 2
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 4
height: parent.height - 4
radius: 4
//height: (root.iconSize + root.thickMargin)/6 - 4
//radius: height/2
color: backgroundColor
clip: true
property color backgroundColor
property color glowColor
RadialGradient{
anchors.verticalCenter: parent.top
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
height: width
gradient: Gradient {
GradientStop { position: 0.0; color: glowColor }
GradientStop { position: 0.6; color: "transparent" }
}
}
visible: isActive
}

@ -25,14 +25,14 @@ import org.kde.latte 0.2 as Latte
PlasmaCore.FrameSvgItem {
id: frame
anchors.fill: parent
imagePath: "widgets/tasks"
property string basePrefix: "normal"
prefix: taskPrefix(basePrefix)
property Item rootItem: parent
function taskPrefix(prefix) {
var effectivePrefix;
@ -55,7 +55,7 @@ PlasmaCore.FrameSvgItem {
states: [
State {
name: "launcher"
when: taskItem.isLauncher
when: rootItem.isLauncher || (rootItem.isApplet && !rootItem.isActive)
PropertyChanges {
target: frame
@ -64,7 +64,7 @@ PlasmaCore.FrameSvgItem {
},
State {
name: "attention"
when: taskItem.isDemandingAttention
when: rootItem.inAttention
PropertyChanges {
target: frame
@ -73,7 +73,7 @@ PlasmaCore.FrameSvgItem {
},
State {
name: "minimized"
when: taskItem.isMinimized
when: rootItem.isMinimized
PropertyChanges {
target: frame
@ -82,7 +82,7 @@ PlasmaCore.FrameSvgItem {
},
State {
name: "active"
when: taskItem.isActive
when: rootItem.isActive
PropertyChanges {
target: frame

@ -34,11 +34,10 @@ Rectangle {
radius: 4
//height: (root.iconSize + root.thickMargin)/6 - 4
//radius: height/2
color: backgroundColor
color: rootItem.backgroundColor
clip: true
property color backgroundColor
property color glowColor
property Item rootItem: parent
RadialGradient{
anchors.verticalCenter: parent.top
@ -47,10 +46,10 @@ Rectangle {
height: width
gradient: Gradient {
GradientStop { position: 0.0; color: glowColor }
GradientStop { position: 0.0; color: rootItem.glowColor }
GradientStop { position: 0.6; color: "transparent" }
}
}
visible: isWindow
visible: rootItem.isActive || rootItem.hasShown
}

@ -4,3 +4,5 @@ plugin latte2plugin
GlowPoint 0.2 GlowPoint.qml
BadgeText 0.2 BadgeText.qml
LatteIndicator 0.2 indicators/LatteIndicator.qml
PlasmaIndicator 0.2 indicators/PlasmaIndicator.qml
UnityIndicator 0.2 indicators/UnityIndicator.qml

@ -471,6 +471,10 @@ MouseArea{
readonly property real glowOpacity: root.glowOpacity
readonly property bool glow3D: root.glow3D
//!icon colors
property color backgroundColor: wrapper.backgroundColor
property color glowColor: wrapper.glowColor
sourceComponent: {
switch (root.indicatorStyle) {
case Latte.Types.LatteIndicator:
@ -491,15 +495,12 @@ MouseArea{
Component{
id: plasmaIndicatorComponent
Indicators.PlasmaIndicator{}
Latte.PlasmaIndicator{}
}
Component{
id:unityIndicatorComponent
Indicators.UnityIndicator{
// backgroundColor: taskIconItem.backgroundColor
// glowColor: taskIconItem.glowColor
}
Latte.UnityIndicator{}
}
}

@ -100,6 +100,9 @@ Item{
//property real center: (width + hiddenSpacerLeft.separatorSpace + hiddenSpacerRight.separatorSpace) / 2
property real center: (width + hiddenSpacerLeft.nHiddenSize + hiddenSpacerRight.nHiddenSize) / 2
property color backgroundColor: taskIconItem.backgroundColor
property color glowColor: taskIconItem.glowColor
property Item titleTooltipVisualParent: taskIconItem.titleTooltipVisualParent
property Item previewsTooltipVisualParent: taskIconItem.previewsTootipVisualParent

Loading…
Cancel
Save