apply Colorizer at per applet bases

pull/3/head
Michail Vourlakos 6 years ago
parent 89b86c4b3e
commit 1192760f28

@ -30,6 +30,7 @@ import org.kde.kquickcontrolsaddons 2.0
import org.kde.latte 0.1 as Latte
import "../colorizer" as Colorizer
import "../../code/AppletIdentifier.js" as AppletIndetifier
Item {
@ -504,11 +505,12 @@ Item {
}
}
//! Main Applet Shown Area
Flow{
id: appletFlow
width: container.computeWidth
height: container.computeHeight
opacity: appletColorizer.mustBeShown ? 0 : 1
anchors.rightMargin: (latteApplet || (showZoomed && root.editMode)) ||
(plasmoid.location !== PlasmaCore.Types.RightEdge) ? 0 : shownAppletMargin
@ -519,6 +521,12 @@ Item {
anchors.bottomMargin: (latteApplet || (showZoomed && root.editMode)) ||
(plasmoid.location !== PlasmaCore.Types.BottomEdge) ? 0 : shownAppletMargin
Behavior on opacity {
NumberAnimation {
duration: 0.8 * root.animationTime
easing.type: Easing.OutCubic
}
}
// a hidden spacer for the first element to add stability
// IMPORTANT: hidden spacers must be tested on vertical !!!
@ -534,7 +542,6 @@ Item {
// a hidden spacer on the right for the last item to add stability
AppletHiddenSpacer{id: hiddenSpacerRight; rightSpacer: true}
}// Flow with hidden spacers inside
//Busy Indicator
@ -573,7 +580,7 @@ Item {
wrapMode: Text.WordWrap
elide: Text.ElideRight
fontSizeMode: Text.Fit
color: colorizerLoader.themeBrightColor
color: colorizerManagerLoader.themeBrightColor
rotation: {
if (root.isHorizontal)
@ -586,6 +593,21 @@ Item {
}
}
//! The Applet Colorizer
Colorizer.Applet {
id: appletColorizer
anchors.fill: parent
opacity: mustBeShown ? 1 : 0
readonly property bool mustBeShown: colorizerManagerLoader.mustBeShown
Behavior on opacity {
NumberAnimation {
duration: 1.2 * root.animationTime
easing.type: Easing.OutCubic
}
}
}
MouseArea{
id: appletMouseArea

@ -553,7 +553,7 @@ Item{
id: appletShadow
anchors.fill: container.appletWrapper
active: container.applet && !colorizerLoader.isShown
active: container.applet && !appletColorizer.mustBeShown
&& (((plasmoid.configuration.shadows === 1 /*Locked Applets*/
&& (!container.canBeHovered || (container.lockZoom && (applet.pluginName !== root.plasmoidName))) )
|| (plasmoid.configuration.shadows === 2 /*All Applets*/

@ -0,0 +1,56 @@
/*
* Copyright 2018 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.7
import QtGraphicalEffects 1.0
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
ColorOverlay {
id: colorizer
anchors.fill: parent
color: colorizerManagerLoader.applyColor
source: appletFlow
}
///Shadow in applets
Loader{
id: colorizedAppletShadow
anchors.fill: colorizer
active: (plasmoid.configuration.shadows >= 1) && (appletColorizer.opacity>0)
sourceComponent: DropShadow{
anchors.fill: parent
color: root.appShadowColor
fast: true
samples: 2 * radius
source: colorizer
radius: shadowSize
verticalOffset: forcedShadow ? 0 : 2
readonly property int shadowSize : root.appShadowSize
readonly property bool forcedShadow: root.forceTransparentPanel && plasmoid.configuration.shadows>0
&& applet && applet.pluginName !== root.plasmoidName ? true : false
}
}
}

@ -28,9 +28,9 @@ Item{
ColorOverlay {
id: colorizer
anchors.fill: parent
color: colorizerLoader.applyColor
color: colorizerManagerLoader.applyColor
source: layoutsContainer
opacity: colorizerLoader.isShown ? 1 : 0
opacity: colorizerManagerLoader.mustBeShown ? 1 : 0
Behavior on opacity {
NumberAnimation {
@ -66,7 +66,7 @@ Item{
Connections{
target: plasmoid
onLocationChanged:{
colorizerLoader.currentBackgroundLuminas = universalSettings.luminasFromFile(activitiesList.currentLayoutBackground, plasmoid.location);
colorizerManagerLoader.currentBackgroundLuminas = universalSettings.luminasFromFile(activitiesList.currentLayoutBackground, plasmoid.location);
}
}
@ -77,7 +77,7 @@ Item{
property string currentLayoutBackground: ""
onCurrentLayoutBackgroundChanged: {
colorizerLoader.currentBackgroundLuminas = universalSettings.luminasFromFile(currentLayoutBackground, plasmoid.location);
colorizerManagerLoader.currentBackgroundLuminas = universalSettings.luminasFromFile(currentLayoutBackground, plasmoid.location);
}
Item {

@ -407,7 +407,7 @@ DragDrop.DropArea {
property rect screenGeometry: dock ? dock.screenGeometry : plasmoid.screenGeometry
readonly property color minimizedDotColor: colorizerLoader.minimizedDotColor
readonly property color minimizedDotColor: colorizerManagerLoader.minimizedDotColor
///END properties from latteApplet
/* Layout.preferredWidth: plasmoid.immutable ?
@ -1728,22 +1728,12 @@ DragDrop.DropArea {
LayoutsContainer {
id: layoutsContainer
opacity: colorizerLoader.isShown ? 0 : 1
Behavior on opacity {
NumberAnimation {
duration: 0.8 * root.animationTime
easing.type: Easing.OutCubic
}
}
}
Loader{
id: colorizerLoader
id: colorizerManagerLoader
active: forceColorizer || forceSolidnessAndColorize
anchors.fill: layoutsContainer
z: layoutsContainer.z + 1
readonly property bool forceSolidness: (root.solidPanel && !plasmoid.configuration.solidBackgroundForMaximized) || root.forceSolidPanel
|| !Latte.WindowSystem.compositingActive
@ -1810,13 +1800,13 @@ DragDrop.DropArea {
readonly property real themeTextColorLuma: 0.2126*textColorRs + 0.7152*textColorGs + 0.0722*textColorBs
readonly property color minimizedDotColor: themeTextColorLuma > 0.6 ? Qt.darker(theme.textColor, 1.7) : Qt.lighter(theme.textColor, 7)
property bool isShown: active && (!forceSolidPanel || forceSolidnessAndColorize)
property bool mustBeShown: active && (!forceSolidPanel || forceSolidnessAndColorize)
//! when forceSemiTransparentPanel is enabled because of snapped or maximized etc. windows
//! then the colorizer could be enabled for low panel transparency levels (<40%)
&& (!userShowPanelBackground || !forceSemiTransparentPanel || (forceSemiTransparentPanel && root.panelTransparency<40))
&& !maximizedWindowTitleBarBehavesAsPanelBackground
&& (plasmoid.configuration.solidBackgroundForMaximized || plasmoid.configuration.backgroundOnlyOnMaximized)
&& !root.editMode && Latte.WindowSystem.compositingActive
&& (!userShowPanelBackground || !forceSemiTransparentPanel || (forceSemiTransparentPanel && root.panelTransparency<40))
&& !maximizedWindowTitleBarBehavesAsPanelBackground
&& (plasmoid.configuration.solidBackgroundForMaximized || plasmoid.configuration.backgroundOnlyOnMaximized)
&& !root.editMode && Latte.WindowSystem.compositingActive
property real currentBackgroundLuminas: -1000

Loading…
Cancel
Save