From fd300ec9cfa447d7be3ea655e99eb17a833973ec Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 9 Feb 2019 16:49:54 +0200 Subject: [PATCH] simplify colorize properties & active new options --- containment/package/contents/ui/PanelBox.qml | 8 +--- .../package/contents/ui/applet/AppletItem.qml | 1 + .../package/contents/ui/colorizer/Manager.qml | 43 ++++++++++--------- containment/package/contents/ui/main.qml | 16 +------ 4 files changed, 28 insertions(+), 40 deletions(-) diff --git a/containment/package/contents/ui/PanelBox.qml b/containment/package/contents/ui/PanelBox.qml index 852797170..b91fcf2fe 100644 --- a/containment/package/contents/ui/PanelBox.qml +++ b/containment/package/contents/ui/PanelBox.qml @@ -522,7 +522,7 @@ Item{ return plasmoid.configuration.panelTransparency / 100; } - if (root.forceColorizeFromActiveWindowScheme) { + if (colorizerManager.mustBeShown && colorizerManager.applyTheme !== theme) { return solidBackground.opacity; } @@ -530,14 +530,10 @@ Item{ } backgroundColor: { - if (root.forcePanelForBusyBackground) { + if (colorizerManager.mustBeShown && colorizerManager.applyTheme !== theme) { return colorizerManager.backgroundColor; } - if (root.forceColorizeFromActiveWindowScheme) { - return latteView.windowsTracker.touchingWindowScheme.backgroundColor - } - return "transparent"; } diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index 1508de316..bad081c46 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -516,6 +516,7 @@ Item { readonly property bool mustBeShown: colorizerManager.mustBeShown && !appletItem.userBlocksColorizing && !appletItem.appletBlocksColorizing + && !appletItem.isInternalViewSplitter Behavior on opacity { NumberAnimation { diff --git a/containment/package/contents/ui/colorizer/Manager.qml b/containment/package/contents/ui/colorizer/Manager.qml index a5369d5a9..0e17161dd 100644 --- a/containment/package/contents/ui/colorizer/Manager.qml +++ b/containment/package/contents/ui/colorizer/Manager.qml @@ -29,40 +29,43 @@ import "../../code/ColorizerTools.js" as ColorizerTools Loader{ id: manager - active: root.colorizerEnabled || forceSolidnessAndColorize - - readonly property bool forceSolidness: (root.solidStylePanel && !plasmoid.configuration.solidBackgroundForMaximized) - || root.forceSolidPanel - || !Latte.WindowSystem.compositingActive - readonly property bool forceSolidnessAndColorize: forceSolidness && forceColorizeFromActiveWindowScheme + //! the loader loads the backgroundTracker component + active: root.themeColors === Latte.Types.SmartThemeColors readonly property bool backgroundIsBusy: item ? item.isBusy : false - readonly property real themeBackgroundColorBrightness: ColorizerTools.colorBrightness(theme.backgroundColor) readonly property real themeTextColorBrightness: ColorizerTools.colorBrightness(theme.textColor) - readonly property color minimizedDotColor: themeTextColorBrightness > 127.5 ? Qt.darker(theme.textColor, 1.7) : Qt.lighter(theme.textColor, 7) - property bool mustBeShown: active && (!root.forceSolidPanel || forceSolidnessAndColorize) - //! when forceSemiTransparentPanel is enabled because of touching 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 + readonly property bool mustBeShown: (applyTheme && applyTheme !== theme) + + onMustBeShownChanged: console.log(mustBeShown); readonly property real currentBackgroundBrightness: item ? item.currentBrightness : -1000 + readonly property bool applyingWindowColors: (root.windowColors === Latte.Types.ActiveWindowColors && latteView.windowsTracker.activeWindowScheme) + || (root.windowColors === Latte.Types.TouchingWindowColors && latteView.windowsTracker.touchingWindowScheme) + property QtObject applyTheme: { - if (forceSolidnessAndColorize && latteView.windowsTracker.touchingWindowScheme) { + if (root.windowColors === Latte.Types.ActiveWindowColors && latteView.windowsTracker.activeWindowScheme) { + return latteView.windowsTracker.activeWindowScheme; + } + + if (root.windowColors === Latte.Types.TouchingWindowColors && latteView.windowsTracker.touchingWindowScheme) { return latteView.windowsTracker.touchingWindowScheme; } if (themeExtended) { - if (currentBackgroundBrightness > 127.5) { - return themeExtended.lightTheme; - } else { - return themeExtended.darkTheme; + if (root.themeColors === Latte.Types.ReverseThemeColors) { + return themeExtended.isLightTheme ? themeExtended.darkTheme : themeExtended.lightTheme; + } + + if (root.themeColors === Latte.Types.SmartThemeColors && !root.editMode) { + if (currentBackgroundBrightness > 127.5) { + return themeExtended.lightTheme; + } else { + return themeExtended.darkTheme; + } } } diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index 5c646b839..ac514ab63 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -90,10 +90,6 @@ DragDrop.DropArea { property bool windowIsTouching: latteView && latteView.windowsTracker && (latteView.windowsTracker.existsWindowMaximized|| latteView.windowsTracker.activeWindowTouching || hasExpandedApplet) - property bool forceSemiTransparentPanel: Latte.WindowSystem.compositingActive && !root.editMode - && ((!plasmoid.configuration.solidBackgroundForMaximized && plasmoid.configuration.backgroundOnlyOnMaximized && windowIsTouching) - || (plasmoid.configuration.solidBackgroundForMaximized && !plasmoid.configuration.backgroundOnlyOnMaximized && !windowIsTouching)) - property bool forceSolidPanel: (latteView && latteView.visibility && Latte.WindowSystem.compositingActive && !root.editMode @@ -111,21 +107,13 @@ DragDrop.DropArea { property bool forcePanelForBusyBackground: root.forceTransparentPanel && colorizerManager.mustBeShown && colorizerManager.backgroundIsBusy - - property bool themeColors: plasmoid.configuration.themeColors - property bool windowColors: plasmoid.configuration.windowColors + property int themeColors: plasmoid.configuration.themeColors + property int windowColors: plasmoid.configuration.windowColors property bool colorizerEnabled: themeColors !== Latte.Types.PlasmaThemeColors || windowColors !== Latte.Types.NoneWindowColors property bool plasmaBackgroundForPopups: plasmoid.configuration.plasmaBackgroundForPopups - property bool maximizedWindowTitleBarBehavesAsPanelBackground: latteView && latteView.visibility - && (!plasmoid.configuration.solidBackgroundForMaximized && plasmoid.configuration.backgroundOnlyOnMaximized) - && (latteView.visibility.mode === Latte.Types.WindowsGoBelow) - && (plasmoid.location === PlasmaCore.Types.TopEdge) - && (!useThemePanel || panelTransparency<40) - && latteView.windowsTracker.existsWindowMaximized - readonly property bool hasExpandedApplet: plasmoid.applets.some(function (item) { return (item.status >= PlasmaCore.Types.NeedsAttentionStatus && item.status !== PlasmaCore.Types.HiddenStatus && item.pluginName !== root.plasmoidName