mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-20 18:50:15 +03:00
change distorted to busy background
--simplify semantics by updating distorted term to busy background
This commit is contained in:
parent
4702367296
commit
50eb9ec277
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <KSharedConfig>
|
||||
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user