REAL maxOpacity from plasma panel backgrounds

--Plasma::ExtendedTheme class now provides maximum
opacity provided by panel backgrounds
pull/6/head
Michail Vourlakos 6 years ago
parent ffd0bef611
commit 4535ee03c2

@ -144,9 +144,24 @@ void Theme::setOutlineWidth(int width)
emit outlineWidthChanged(); emit outlineWidthChanged();
} }
float Theme::backgroundMaxOpacity() const float Theme::bottomEdgeMaxOpacity() const
{ {
return m_backgroundMaxOpacity; return m_bottomEdgeMaxOpacity;
}
float Theme::leftEdgeMaxOpacity() const
{
return m_leftEdgeMaxOpacity;
}
float Theme::topEdgeMaxOpacity() const
{
return m_topEdgeMaxOpacity;
}
float Theme::rightEdgeMaxOpacity() const
{
return m_rightEdgeMaxOpacity;
} }
WindowSystem::SchemeColors *Theme::defaultTheme() const WindowSystem::SchemeColors *Theme::defaultTheme() const
@ -315,6 +330,16 @@ int Theme::roundness(const QImage &svgImage, Plasma::Types::Location edge)
int maxOpacity = qMin(qAlpha(svgImage.pixel(49,0)), 200); int maxOpacity = qMin(qAlpha(svgImage.pixel(49,0)), 200);
if (edge == Plasma::Types::BottomEdge) {
m_bottomEdgeMaxOpacity = (float)maxOpacity / (float)255;
} else if (edge == Plasma::Types::LeftEdge) {
m_leftEdgeMaxOpacity = (float)maxOpacity / (float)255;
} else if (edge == Plasma::Types::TopEdge) {
m_topEdgeMaxOpacity = (float)maxOpacity / (float)255;
} else if (edge == Plasma::Types::RightEdge) {
m_rightEdgeMaxOpacity = (float)maxOpacity / (float)255;
}
if (edge == Plasma::Types::BottomEdge || edge == Plasma::Types::RightEdge || edge == Plasma::Types::TopEdge) { if (edge == Plasma::Types::BottomEdge || edge == Plasma::Types::RightEdge || edge == Plasma::Types::TopEdge) {
//! TOPLEFT corner //! TOPLEFT corner
//! first LEFT pixel found //! first LEFT pixel found
@ -412,6 +437,7 @@ void Theme::loadRoundness()
{ {
loadCompositingRoundness(); loadCompositingRoundness();
emit maxOpacityChanged();
emit roundnessChanged(); emit roundnessChanged();
} }
@ -564,12 +590,12 @@ void Theme::parseThemeSvgFiles()
} }
} }
m_backgroundMaxOpacity = opacity * fillOpacity; // m_backgroundMaxOpacity = opacity * fillOpacity;
qDebug() << "plasma theme opacity :: " << m_backgroundMaxOpacity << " from : " << opacity << " * " << fillOpacity; // qDebug() << "plasma theme opacity :: " << m_backgroundMaxOpacity << " from : " << opacity << " * " << fillOpacity;
} }
emit backgroundMaxOpacityChanged(); // emit backgroundMaxOpacityChanged();
} }
void Theme::loadThemeLightness() void Theme::loadThemeLightness()

@ -60,7 +60,10 @@ class Theme: public QObject
Q_PROPERTY(int outlineWidth READ outlineWidth NOTIFY outlineWidthChanged) Q_PROPERTY(int outlineWidth READ outlineWidth NOTIFY outlineWidthChanged)
Q_PROPERTY(float backgroundMaxOpacity READ backgroundMaxOpacity NOTIFY backgroundMaxOpacityChanged) Q_PROPERTY(float bottomEdgeMaxOpacity READ bottomEdgeMaxOpacity NOTIFY maxOpacityChanged)
Q_PROPERTY(float leftEdgeMaxOpacity READ leftEdgeMaxOpacity NOTIFY maxOpacityChanged)
Q_PROPERTY(float topEdgeMaxOpacity READ topEdgeMaxOpacity NOTIFY maxOpacityChanged)
Q_PROPERTY(float rightEdgeMaxOpacity READ rightEdgeMaxOpacity NOTIFY maxOpacityChanged)
Q_PROPERTY(Latte::WindowSystem::SchemeColors *defaultTheme READ defaultTheme NOTIFY themeChanged) Q_PROPERTY(Latte::WindowSystem::SchemeColors *defaultTheme READ defaultTheme NOTIFY themeChanged)
Q_PROPERTY(Latte::WindowSystem::SchemeColors *lightTheme READ lightTheme NOTIFY themeChanged) Q_PROPERTY(Latte::WindowSystem::SchemeColors *lightTheme READ lightTheme NOTIFY themeChanged)
@ -82,7 +85,10 @@ public:
int outlineWidth() const; int outlineWidth() const;
void setOutlineWidth(int width); void setOutlineWidth(int width);
float backgroundMaxOpacity() const; float bottomEdgeMaxOpacity() const;
float leftEdgeMaxOpacity() const;
float topEdgeMaxOpacity() const;
float rightEdgeMaxOpacity() const;
WindowSystem::SchemeColors *defaultTheme() const; WindowSystem::SchemeColors *defaultTheme() const;
WindowSystem::SchemeColors *lightTheme() const; WindowSystem::SchemeColors *lightTheme() const;
@ -91,9 +97,9 @@ public:
void load(); void load();
signals: signals:
void backgroundMaxOpacityChanged();
void compositingChanged(); void compositingChanged();
void hasShadowChanged(); void hasShadowChanged();
void maxOpacityChanged();
void outlineWidthChanged(); void outlineWidthChanged();
void roundnessChanged(); void roundnessChanged();
void themeChanged(); void themeChanged();
@ -128,7 +134,10 @@ private:
int m_outlineWidth{1}; int m_outlineWidth{1};
float m_backgroundMaxOpacity{1}; float m_bottomEdgeMaxOpacity{1};
float m_leftEdgeMaxOpacity{1};
float m_topEdgeMaxOpacity{1};
float m_rightEdgeMaxOpacity{1};
QString m_themePath; QString m_themePath;
QString m_themeWidgetsPath; QString m_themeWidgetsPath;

Loading…
Cancel
Save