add Colorizing properties in Communicator

--add properties in order for the Communicator
to inform applet when to use the LatteColorScheme
pull/3/head
Michail Vourlakos 6 years ago
parent 1f51524d42
commit 9dae7f7170

@ -106,6 +106,7 @@ Item {
property string title: isInternalViewSplitter ? "Now Dock Splitter" : ""
property Item applet: null
property Item appletRootItem: applet && applet.children && applet.children.length>0 ? applet.children[0] : null
property Item latteApplet: applet && (applet.pluginName === root.plasmoidName) ?
(applet.children[0] ? applet.children[0] : null) : null
property Item latteSpacer: applet && (applet.pluginName === "org.kde.latte.spacer") ?
@ -570,6 +571,7 @@ Item {
opacity: mustBeShown ? 1 : 0
readonly property bool mustBeShown: colorizerManagerLoader.mustBeShown
&& !communicator.disableLatteSideColoring
Behavior on opacity {
NumberAnimation {

@ -35,48 +35,78 @@ Item{
// -------------------------------------
// INGOING FROM LATTE TO APPLET
// -------------------------------------
// USE: property bool isInLatte: false
// NAME: isInLatte
// USAGE: property bool isInLatte: false
// EXPLANATION: Latte sets it to true when this applet is in a Latte containment
property bool supportsIsInLatte: applet && applet.isInLatte !== undefined ? true : false
property bool appletContainsIsInLatte: appletRootItem && appletRootItem.hasOwnProperty("isInLatte") ? true : false
// NAME: lattePalette
// USAGE: property QtObject lattePalette: null
// EXPLANATION: Latte updates it to its coloring palette in order for the applet
// to take resposibility of its coloring.
// USE CASE: when Latte is transparent and applets colors need to be adjusted in order
// to look consistent with the underlying desktop background
property bool appletContainsLattePalette: appletRootItem && appletRootItem.hasOwnProperty("lattePalette") ? true : false
// NAME: applyLattePalette
// USAGE: property bool applyLattePalette: false
// EXPLANATION: Latte updates it to TRUE when the applet must use the provided
// Latte palette through "lattePalette" and FALSE otherwise
// USE CASE: when Latte is transparent and applets colors need to be adjusted in order
// to look consistent with the underlying desktop background
property bool appletContainsApplyLattePalette: appletRootItem && appletRootItem.hasOwnProperty("applyLattePalette") ? true : false
// -------------------------------------
// OUTGOING FROM APPLET TO LATTE
// -------------------------------------
// USE: property bool disableLatteParabolicIcon
// DEPRECATED FROM: disableLatteOverlay
// NAME: disableLatteParabolicIcon
// USE: property bool disableLatteParabolicIcon : false
// DEPRECATED FROM: disableLatteIconOverlay
// EXPLANATION: when is TRUE, Latte is not overlaying any icons above
// the applet or alters the applet visual in any sense.
// That means that the applet is responsible to provide a conherent
// parabolic effect experience.
property bool disableLatteParabolicIconHeuristics: applet && applet.disableLatteParabolicIcon !== undefined ?
applet.disableLatteParabolicIcon : false
// USE: property bool disableLatteOverlay
property bool disableLatteParabolicIconHeuristics: appletRootItem && appletRootItem.disableLatteParabolicIcon !== undefined ?
appletRootItem.disableLatteParabolicIcon : false
// NAME: disableLatteSideColoring
// USE: property bool disableLatteSideColoring : false
// EXPLANATION: when is TRUE, Latte is not painting/colorizing this applet
// in any case. In such case the applet can use lattePalette property
// in order to access to color palette used at all cases from Latte
// USE CASE: when Latte is transparent and applets colors need to be adjusted in order
// to look consistent with the underlying desktop background OR the applet
// is not using monochromatic icons but rather colorful ones.
property bool disableLatteSideColoring: appletRootItem && appletRootItem.disableLatteSideColoring !== undefined ?
appletRootItem.disableLatteSideColoring : false
// NAME: disableLatteIconOverlay
// USE: property bool disableLatteIconOverlay : false
// EXPLANATION: when is TRUE, Latte is not overlaying any icons above
// the applet or alters the applet visual in any sense.
// That means that the applet is responsible to provide a conherent
// parabolic effect experience.
property bool disableLatteOverlay: applet && applet.disableLatteOverlay !== undefined ?
applet.disableLatteOverlay : false
property bool disableLatteIconOverlay: appletRootItem && appletRootItem.disableLatteIconOverlay !== undefined ?
appletRootItem.disableLatteIconOverlay : false
//! END OF INTERNAL APPLET PROPERTIES
//! BEGIN OF PROPERTIES
//this is used for folderView and icon widgets to fake their visual icons
readonly property bool canShowOverlaiedLatteIcon: applet && communicator.appletIconItem //(applet.pluginName === "org.kde.plasma.folder" || applet.pluginName === "org.kde.plasma.icon")
readonly property bool appletCanUseLattePalette: appletContainsApplyLattePalette && appletContainsLattePalette
readonly property bool canShowOverlaiedLatteIcon: appletRootItem && communicator.appletIconItem //(applet.pluginName === "org.kde.plasma.folder" || applet.pluginName === "org.kde.plasma.icon")
readonly property bool overlayLatteIconIsActive: canShowOverlaiedLatteIcon
&& !(disableLatteParabolicIconHeuristics || disableLatteOverlay)
&& !(disableLatteParabolicIconHeuristics || disableLatteIconOverlay)
property Item appletIconItem; //first applet's IconItem to be used by Latte
property Item appletImageItem; //first applet's ImageItem to be used by Latte
//! END OF PROPERTIES
//! BEGIN OF PROPERTY CHANGES
onSupportsIsInLatteChanged: {
if (supportsIsInLatte) {
applet.isInLatte = true;
onAppletContainsIsInLatteChanged: {
if (appletContainsIsInLatte) {
appletRootItem.isInLatte = true;
}
}
//! END OF PROPERTY CHANGES
@ -114,6 +144,22 @@ Item{
}
//! END OF CONNECTIONS
//! BEGIN OF BINDINGS
Binding{
target: appletRootItem
property: "applyLattePalette"
when: disableLatteSideColoring && appletCanUseLattePalette
value: colorizerManagerLoader.mustBeShown
}
Binding{
target: appletRootItem
property: "lattePalette"
when: disableLatteSideColoring && appletCanUseLattePalette
value: dock && dock.visibility ? dock.visibility.touchingWindowScheme : null
}
//! END OF BINDINGS
//! BEGIN OF TIMERS
//a timer that is used in order to init some Communicator values
Timer {

@ -25,44 +25,6 @@ import org.kde.plasma.core 2.0 as PlasmaCore
Item{
ColorOverlay {
id: colorizer
anchors.fill: parent
color: colorizerManagerLoader.applyColor
source: layoutsContainer
opacity: colorizerManagerLoader.mustBeShown ? 1 : 0
Behavior on opacity {
NumberAnimation {
duration: 1.2 * root.animationTime
easing.type: Easing.OutCubic
}
}
}
///Shadow in applets
Loader{
id: colorizedAppletShadow
anchors.fill: colorizer
active: (plasmoid.configuration.shadows >= 1) && (colorizer.opacity>0)
opacity: colorizer.opacity
sourceComponent: DropShadow{
anchors.fill: parent
color: root.appShadowColor
fast: true
samples: 2 * radius
source: colorizer
radius: shadowSize
verticalOffset: forcedShadow ? 0 : 2
property int shadowSize : root.appShadowSize
property bool forcedShadow: root.forceTransparentPanel && plasmoid.configuration.shadows>0 && applet && applet.pluginName !== root.plasmoidName ? true : false
}
}
Connections{
target: plasmoid
onLocationChanged:{

@ -99,6 +99,7 @@ DragDrop.DropArea {
|| showAppletsNumbers || showMetaBadge)
property bool forceTransparentPanel: root.backgroundOnlyOnMaximized
&& dock && dock.visibility
&& !(dock.visibility.existsWindowMaximized || dock.visibility.existsWindowSnapped)
&& Latte.WindowSystem.compositingActive
&& !(hasExpandedApplet && zoomFactor===1 && plasmoid.configuration.panelSize===100)

@ -249,7 +249,12 @@ Item {
property var managedLayoutName: currentLayout ? currentLayout.name : ""
property Item latteDock: null
//END Now Dock Panel properties
//END Latte Dock Panel properties
//BEGIN Latte Dock Communicator
property bool disableLatteSideColoring : true
//END Latte Dock Communicator
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation

Loading…
Cancel
Save