From 50eb9ec27720c98f55e145993257724b79728d76 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 5 Jan 2019 12:22:06 +0200 Subject: [PATCH] change distorted to busy background --simplify semantics by updating distorted term to busy background --- containment/package/contents/ui/PanelBox.qml | 8 +++--- .../package/contents/ui/colorizer/Manager.qml | 2 +- containment/package/contents/ui/main.qml | 6 ++--- liblatte2/backgroundtracker.cpp | 8 +++--- liblatte2/backgroundtracker.h | 8 +++--- liblatte2/plasma/extended/backgroundcache.cpp | 26 +++++++++---------- liblatte2/plasma/extended/backgroundcache.h | 8 +++--- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/containment/package/contents/ui/PanelBox.qml b/containment/package/contents/ui/PanelBox.qml index 718ccce38..81b2102bd 100644 --- a/containment/package/contents/ui/PanelBox.qml +++ b/containment/package/contents/ui/PanelBox.qml @@ -147,7 +147,7 @@ Item{ visible: (opacity == 0) ? false : true opacity: { - if ((root.forceTransparentPanel && !root.forcePanelForDistortedBackground) + if ((root.forceTransparentPanel && !root.forcePanelForBusyBackground) || !root.useThemePanel) return 0; else @@ -297,7 +297,7 @@ Item{ opacity: { if (forceSolidness) { return 1; - } else if (root.forcePanelForDistortedBackground + } else if (root.forcePanelForBusyBackground || (!plasmoid.configuration.useThemePanel && plasmoid.configuration.solidBackgroundForMaximized)) { return 0; @@ -483,7 +483,7 @@ Item{ Colorizer.CustomBackground { anchors.fill: solidBackground opacity: { - if (root.forcePanelForDistortedBackground + if (root.forcePanelForBusyBackground && solidBackground.opacity === 0 && solidBackgroundRectangle.opacity === 0) { return plasmoid.configuration.panelTransparency / 100; @@ -497,7 +497,7 @@ Item{ } backgroundColor: { - if (root.forcePanelForDistortedBackground) { + if (root.forcePanelForBusyBackground) { return colorizerManager.backgroundColor; } diff --git a/containment/package/contents/ui/colorizer/Manager.qml b/containment/package/contents/ui/colorizer/Manager.qml index 075040f52..7f5073b82 100644 --- a/containment/package/contents/ui/colorizer/Manager.qml +++ b/containment/package/contents/ui/colorizer/Manager.qml @@ -35,7 +35,7 @@ Loader{ || !Latte.WindowSystem.compositingActive readonly property bool forceSolidnessAndColorize: forceSolidness && forceColorizeFromActiveWindowScheme - readonly property bool isDistorted: item ? item.isDistorted : false + readonly property bool backgroundIsBusy: item ? item.isBusy : false readonly property real themeBackgroundColorBrightness: ColorizerTools.colorBrightness(theme.backgroundColor) readonly property real themeTextColorBrightness: ColorizerTools.colorBrightness(theme.textColor) diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index 9da183582..63db4f267 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -77,7 +77,7 @@ DragDrop.DropArea { && (plasmoid.configuration.panelPosition === Latte.Types.Justify) && !(root.solidPanel && panelShadowsActive)); } - property bool blurEnabled: plasmoid.configuration.blurEnabled && (!root.forceTransparentPanel || root.forcePanelForDistortedBackground) + property bool blurEnabled: plasmoid.configuration.blurEnabled && (!root.forceTransparentPanel || root.forcePanelForBusyBackground) || (hasExpandedApplet && zoomFactor===1 && plasmoid.configuration.panelSize===100) property bool confirmedDragEntered: false @@ -104,7 +104,7 @@ DragDrop.DropArea { && Latte.WindowSystem.compositingActive && !(hasExpandedApplet && zoomFactor===1 && plasmoid.configuration.panelSize===100) - property bool forcePanelForDistortedBackground: root.forceTransparentPanel && colorizerManager.mustBeShown && colorizerManager.isDistorted + property bool forcePanelForBusyBackground: root.forceTransparentPanel && colorizerManager.mustBeShown && colorizerManager.backgroundIsBusy property bool forceColorizer: Latte.WindowSystem.compositingActive && plasmoid.configuration.colorizeTransparentPanels @@ -212,7 +212,7 @@ DragDrop.DropArea { return false; } - if (plasmoid.configuration.panelShadows && root.forcePanelForDistortedBackground) { + if (plasmoid.configuration.panelShadows && root.forcePanelForBusyBackground) { return true; } diff --git a/liblatte2/backgroundtracker.cpp b/liblatte2/backgroundtracker.cpp index 7fa1ed722..1b2621b7f 100644 --- a/liblatte2/backgroundtracker.cpp +++ b/liblatte2/backgroundtracker.cpp @@ -40,9 +40,9 @@ BackgroundTracker::~BackgroundTracker() { } -bool BackgroundTracker::isDistorted() const +bool BackgroundTracker::isBusy() const { - return m_distorted; + return m_busy; } int BackgroundTracker::location() const @@ -114,10 +114,10 @@ void BackgroundTracker::update() } m_brightness = m_cache->brightnessFor(m_activity, m_screenName, m_location); - m_distorted = m_cache->distortedFor(m_activity, m_screenName, m_location); + m_busy = m_cache->busyFor(m_activity, m_screenName, m_location); emit currentBrightnessChanged(); - emit isDistortedChanged(); + emit isBusyChanged(); } } diff --git a/liblatte2/backgroundtracker.h b/liblatte2/backgroundtracker.h index 37f38b50a..a010d0f13 100644 --- a/liblatte2/backgroundtracker.h +++ b/liblatte2/backgroundtracker.h @@ -33,7 +33,7 @@ class BackgroundTracker: public QObject { Q_OBJECT - Q_PROPERTY(bool isDistorted READ isDistorted NOTIFY isDistortedChanged) + Q_PROPERTY(bool isBusy READ isBusy NOTIFY isBusyChanged) Q_PROPERTY(int location READ location WRITE setLocation NOTIFY locationChanged) @@ -46,7 +46,7 @@ public: BackgroundTracker(QObject *parent = nullptr); virtual ~BackgroundTracker(); - bool isDistorted() const; + bool isBusy() const; int location() const; void setLocation(int location); @@ -62,7 +62,7 @@ public: signals: void activityChanged(); void currentBrightnessChanged(); - void isDistortedChanged(); + void isBusyChanged(); void locationChanged(); void screenNameChanged(); @@ -72,7 +72,7 @@ private slots: private: // local - bool m_distorted{false}; + bool m_busy{false}; float m_brightness{-1000}; PlasmaExtended::BackgroundCache *m_cache{nullptr}; diff --git a/liblatte2/plasma/extended/backgroundcache.cpp b/liblatte2/plasma/extended/backgroundcache.cpp index 231fa2031..6399d55e0 100644 --- a/liblatte2/plasma/extended/backgroundcache.cpp +++ b/liblatte2/plasma/extended/backgroundcache.cpp @@ -176,12 +176,12 @@ QString BackgroundCache::background(QString activity, QString screen) } } -bool BackgroundCache::distortedFor(QString activity, QString screen, Plasma::Types::Location location) +bool BackgroundCache::busyFor(QString activity, QString screen, Plasma::Types::Location location) { QString assignedBackground = background(activity, screen); if (!assignedBackground.isEmpty()) { - return distortedForFile(assignedBackground, location); + return busyForFile(assignedBackground, location); } return false; @@ -221,13 +221,13 @@ float BackgroundCache::brightnessFromArea(QImage &image, int firstRow, int first return areaBrightness; } -bool BackgroundCache::areaIsDistorted(float bright1, float bright2, float bright3) +bool BackgroundCache::areaIsBusy(float bright1, float bright2, float bright3) { - int distortedStep{30}; + int brightDifference{30}; - return (qFabs(bright1-bright2)>=distortedStep - || qFabs(bright2-bright3)>=distortedStep - || qFabs(bright1-bright3)>=distortedStep); + return (qFabs(bright1-bright2)>=brightDifference + || qFabs(bright2-bright3)>=brightDifference + || qFabs(bright1-bright3)>=brightDifference); } void BackgroundCache::updateImageCalculations(QString imageFile, Plasma::Types::Location location) @@ -284,7 +284,7 @@ void BackgroundCache::updateImageCalculations(QString imageFile, Plasma::Types:: //! compute total brightness for this area areaBrightness = (area1Brightness + area2Brightness + area3Brightness) / 3; - bool areaDistorted = areaIsDistorted(area1Brightness, area2Brightness, area3Brightness); + bool areaBusy = areaIsBusy(area1Brightness, area2Brightness, area3Brightness); if (!m_hintsCache.keys().contains(imageFile)) { m_hintsCache[imageFile] = EdgesHash(); @@ -293,11 +293,11 @@ void BackgroundCache::updateImageCalculations(QString imageFile, Plasma::Types:: if (!m_hintsCache[imageFile].contains(location)) { imageHints iHints; iHints.brightness = areaBrightness; - iHints.distorted =areaDistorted; + iHints.busy =areaBusy; m_hintsCache[imageFile].insert(location, iHints); } else { m_hintsCache[imageFile][location].brightness = areaBrightness; - m_hintsCache[imageFile][location].distorted = areaDistorted; + m_hintsCache[imageFile][location].busy = areaBusy; } } } @@ -324,11 +324,11 @@ float BackgroundCache::brightnessForFile(QString imageFile, Plasma::Types::Locat return -1000; } -bool BackgroundCache::distortedForFile(QString imageFile, Plasma::Types::Location location) +bool BackgroundCache::busyForFile(QString imageFile, Plasma::Types::Location location) { if (m_hintsCache.keys().contains(imageFile)) { if (m_hintsCache[imageFile].keys().contains(location)) { - return m_hintsCache[imageFile][location].distorted; + return m_hintsCache[imageFile][location].busy; } } @@ -340,7 +340,7 @@ bool BackgroundCache::distortedForFile(QString imageFile, Plasma::Types::Locatio updateImageCalculations(imageFile, location); if (m_hintsCache.keys().contains(imageFile)) { - return m_hintsCache[imageFile][location].distorted; + return m_hintsCache[imageFile][location].busy; } return false; diff --git a/liblatte2/plasma/extended/backgroundcache.h b/liblatte2/plasma/extended/backgroundcache.h index 652f71101..674b3f1d1 100644 --- a/liblatte2/plasma/extended/backgroundcache.h +++ b/liblatte2/plasma/extended/backgroundcache.h @@ -35,7 +35,7 @@ #include struct imageHints { - bool distorted{false}; + bool busy{false}; float brightness{-1000}; }; @@ -52,7 +52,7 @@ public: static BackgroundCache *self(); ~BackgroundCache() override; - bool distortedFor(QString activity, QString screen, Plasma::Types::Location location); + bool busyFor(QString activity, QString screen, Plasma::Types::Location location); float brightnessFor(QString activity, QString screen, Plasma::Types::Location location); QString background(QString activity, QString screen); @@ -67,8 +67,8 @@ private slots: private: BackgroundCache(QObject *parent = nullptr); - bool areaIsDistorted(float bright1, float bright2, float bright3); - bool distortedForFile(QString imageFile, Plasma::Types::Location location); + bool areaIsBusy(float bright1, float bright2, float bright3); + bool busyForFile(QString imageFile, Plasma::Types::Location location); bool isDesktopContainment(const KConfigGroup &containment) const; float brightnessForFile(QString imageFile, Plasma::Types::Location location);