1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-26 11:21:40 +03:00

activate Unity indicator style

--this is just initial work and not even close
to the final result but it is the ground in order
to build upon.
This commit is contained in:
Michail Vourlakos 2019-02-13 20:58:44 +02:00
parent c893ab3d22
commit c2dc637a46
7 changed files with 210 additions and 49 deletions

View File

@ -64,6 +64,11 @@ Item {
property bool appletBlocksParabolicEffect: !communicator.parabolicEffectEnabled
property bool showZoomed: false
property bool lockZoom: false
property bool isActive: (isExpanded && !isSystray
&& applet.pluginName !== root.plasmoidName
&& applet.pluginName !== "org.kde.activeWindowControl"
&& applet.pluginName !== "org.kde.plasma.appmenu")
property bool isExpanded: applet && applet.status >= PlasmaCore.Types.NeedsAttentionStatus
&& applet.status !== PlasmaCore.Types.HiddenStatus
@ -502,6 +507,45 @@ Item {
width: wrapper.width
height: wrapper.height
//! Active Indicator loader
Loader{
anchors.fill: parent
active: (root.activeIndicator === Latte.Types.AllIndicator
|| (root.activeIndicator === Latte.Types.InternalsIndicator && communicator.overlayLatteIconIsActive))
&& communicator.activeIndicatorEnabled
&& !(root.indicatorStyle === Latte.Types.UnityIndicator && !communicator.overlayLatteIconIsActive)
sourceComponent: root.indicatorStyle===Latte.Types.LatteIndicator ?
latteStyleIndicator : (root.indicatorStyle===Latte.Types.PlasmaIndicator ? plasmaStyleIndicator : unityStyleIndicator)
Component {
id: latteStyleIndicator
Item{
anchors.fill: parent
Indicators.LatteIndicator{}
}
}
Component {
id: plasmaStyleIndicator
Indicators.PlasmaIndicator {
anchors.fill: parent
}
}
Component{
id:unityStyleIndicator
Indicators.UnityIndicator{
anchors.fill: parent
backgroundColor: wrapper.overlayIconLoader.backgroundColor
glowColor: wrapper.overlayIconLoader.glowColor
}
}
}
ItemWrapper{
id: wrapper
@ -529,32 +573,6 @@ Item {
}
}
//! Active Indicator loader
Loader{
anchors.fill: parent
active: (root.activeIndicator === Latte.Types.AllIndicator
|| (root.activeIndicator === Latte.Types.InternalsIndicator && communicator.overlayLatteIconIsActive))
&& communicator.activeIndicatorEnabled
sourceComponent: root.indicatorStyle===Latte.Types.PlasmaIndicator ? plasmaStyleIndicator : latteStyleIndicator
Component {
id: latteStyleIndicator
Item{
anchors.fill: parent
Indicators.LatteIndicator{}
}
}
Component {
id: plasmaStyleIndicator
Item{
anchors.fill: parent
Indicators.PlasmaIndicator {}
}
}
}
//! Applet Shortcut Visual Badge
ShortcutBadge{
anchors.fill: wrapper

View File

@ -168,6 +168,7 @@ Item{
property Item wrapperContainer: _wrapperContainer
property Item clickedEffect: _clickedEffect
property Item containerForOverlayIcon: _containerForOverlayIcon
property Item overlayIconLoader: _overlayIconLoader
Behavior on opacity {
NumberAnimation {
@ -487,8 +488,13 @@ Item{
}
Loader{
id: _overlayIconLoader
anchors.fill: parent
active: communicator.overlayLatteIconIsActive
property color backgroundColor: "black"
property color glowColor: "white"
sourceComponent: Latte.IconItem{
id: overlayIconItem
anchors.fill: parent
@ -497,10 +503,27 @@ Item{
return communicator.appletIconItem.source;
else if (communicator.appletImageItemIsShown())
return communicator.appletImageItem.source;
return "";
}
providesColors: root.indicatorStyle === Latte.Types.UnityIndicator && source != ""
usesPlasmaTheme: communicator.appletIconItemIsShown() ? communicator.appletIconItem.usesPlasmaTheme : false
Binding{
target: _overlayIconLoader
property: "backgroundColor"
when: overlayIconItem.providesColors
value: overlayIconItem.backgroundColor
}
Binding{
target: _overlayIconLoader
property: "glowColor"
when: overlayIconItem.providesColors
value: overlayIconItem.glowColor
}
Loader{
anchors.centerIn: parent
active: root.debugModeOverloadedIcons
@ -511,8 +534,6 @@ Item{
opacity: 0.65
}
}
//ActiveIndicator{}
}
}
}

View File

@ -59,18 +59,13 @@ Item{
contrastColor: root.appShadowColorSolid
opacity:{
if ( (!vertical && width <= glowFrame.size && !isActive)
|| (vertical && height <= glowFrame.size && !isActive))
if ( (!vertical && width <= glowFrame.size && !appletItem.isActive)
|| (vertical && height <= glowFrame.size && !appletItem.isActive))
return 0;
return 1;
}
property bool isActive: (appletItem.isExpanded && !appletItem.isSystray
&& applet.pluginName !== root.plasmoidName
&& applet.pluginName !== "org.kde.activeWindowControl"
&& applet.pluginName !== "org.kde.plasma.appmenu")
property bool vertical: root.isVertical
property int animationTime: root.durationTime * (1.2*units.longDuration)
@ -86,42 +81,41 @@ Item{
else
height = glowFrame.size;
if(vertical && isActive)
if(vertical && appletItem.isActive)
height = stateHeight;
else
height = glowFrame.size;
if(!vertical && isActive)
if(!vertical && appletItem.isActive)
width = stateWidth;
else
width = glowFrame.size;
}
}
onIsActiveChanged: {
// if(mainItemContainer.hasActive || windowsPreviewDlg.visible)
activeAndReverseAnimation.start();
Connections{
target: appletItem
onIsActiveChanged: activeAndReverseAnimation.start();
}
onScaleFactorChanged: {
if ( root.activeIndicatorType === Latte.Types.LineIndicator ) {
if(!activeAndReverseAnimation.running && !root.vertical && isActive){
if(!activeAndReverseAnimation.running && !root.vertical && appletItem.isActive){
width = stateWidth;
}
else if (!activeAndReverseAnimation.running && root.vertical && isActive){
else if (!activeAndReverseAnimation.running && root.vertical && appletItem.isActive){
height = stateHeight;
}
}
}
onStateWidthChanged:{
if(!activeAndReverseAnimation.running && !vertical && isActive && root.activeIndicatorType === Latte.Types.LineIndicator)
if(!activeAndReverseAnimation.running && !vertical && appletItem.isActive && root.activeIndicatorType === Latte.Types.LineIndicator)
width = stateWidth;
}
onStateHeightChanged:{
if(!activeAndReverseAnimation.running && vertical && isActive && root.activeIndicatorType === Latte.Types.LineIndicator)
if(!activeAndReverseAnimation.running && vertical && appletItem.isActive && root.activeIndicatorType === Latte.Types.LineIndicator)
height = stateHeight;
}
@ -141,7 +135,7 @@ Item{
id: activeAndReverseAnimation
target: activePoint
property: root.isVertical ? "height" : "width"
to: !activePoint.isActive ? (root.isVertical ? activePoint.stateHeight : activePoint.stateWidth) : glowFrame.size
to: !appletItem.isActive ? (root.isVertical ? activePoint.stateHeight : activePoint.stateWidth) : glowFrame.size
duration: activePoint.animationTime
easing.type: Easing.InQuad

View File

@ -0,0 +1,56 @@
/*
* 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
}

View File

@ -86,10 +86,11 @@ void IconItem::setSource(const QVariant &source)
// If the QIcon was created with QIcon::fromTheme(), try to load it as svg
if (source.canConvert<QIcon>() && !source.value<QIcon>().name().isEmpty()) {
sourceString = source.value<QIcon>().name();
setLastValidSourceName(sourceString);
}
if (!sourceString.isEmpty()) {
setLastValidSourceName(sourceString);
//If a url in the form file:// is passed, take the image pointed by that from disk
QUrl url(sourceString);

View File

@ -110,8 +110,22 @@ Item{
Loader {
anchors.fill: parent
active: root.activeIndicator !== Latte.Types.NoneIndicator && root.indicatorStyle === Latte.Types.PlasmaIndicator
sourceComponent: Indicators.PlasmaIndicator{}
active: root.activeIndicator !== Latte.Types.NoneIndicator
&& (root.indicatorStyle === Latte.Types.PlasmaIndicator || root.indicatorStyle === Latte.Types.UnityIndicator)
sourceComponent: root.indicatorStyle === Latte.Types.PlasmaIndicator ? plasmaIndicatorComponent : unityIndicatorComponent
Component{
id: plasmaIndicatorComponent
Indicators.PlasmaIndicator{}
}
Component{
id:unityIndicatorComponent
Indicators.UnityIndicator{
backgroundColor: iconImageBuffer.backgroundColor
glowColor: iconImageBuffer.glowColor
}
}
}
TitleTooltipParent{
@ -187,6 +201,7 @@ Item{
width: Math.round(newTempSize) //+ 2*taskIcon.shadowSize
height: Math.round(width)
source: decoration
providesColors: root.indicatorStyle === Latte.Types.UnityIndicator
opacity: root.enableShadows ? 0 : 1
visible: !taskItem.isSeparator && !badgesLoader.active

View File

@ -0,0 +1,56 @@
/*
* 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: isWindow
}