1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-08-30 09:49:25 +03:00

identify applet isMarginAreaSeparator

This commit is contained in:
Michail Vourlakos
2021-02-26 17:04:49 +02:00
parent 674b6ea754
commit 9e487b613b
3 changed files with 37 additions and 36 deletions

View File

@ -91,7 +91,7 @@ void Theme::load()
{ {
loadThemePaths(); loadThemePaths();
updateBackgrounds(); updateBackgrounds();
updateSeperatorAreaMarginsValues(); updateMarginsAreaValues();
} }
Theme::~Theme() Theme::~Theme()
@ -132,24 +132,24 @@ void Theme::setOutlineWidth(int width)
emit outlineWidthChanged(); emit outlineWidthChanged();
} }
int Theme::separatorAreaMarginTop() const int Theme::marginsAreaTop() const
{ {
return m_separatorAreaMarginTop; return m_marginsAreaTop;
} }
int Theme::separatorAreaMarginLeft() const int Theme::marginsAreaLeft() const
{ {
return m_separatorAreaMarginLeft; return m_marginsAreaLeft;
} }
int Theme::separatorAreaMarginBottom() const int Theme::marginsAreaBottom() const
{ {
return m_separatorAreaMarginBottom; return m_marginsAreaBottom;
} }
int Theme::separatorAreaMarginRight() const int Theme::marginsAreaRight() const
{ {
return m_separatorAreaMarginRight; return m_marginsAreaRight;
} }
@ -507,12 +507,12 @@ const CornerRegions &Theme::cornersMask(const int &radius)
return m_cornerRegions[radius]; return m_cornerRegions[radius];
} }
void Theme::updateSeperatorAreaMarginsValues() void Theme::updateMarginsAreaValues()
{ {
m_separatorAreaMarginTop = 0; m_marginsAreaTop = 0;
m_separatorAreaMarginLeft = 0; m_marginsAreaLeft = 0;
m_separatorAreaMarginBottom = 0; m_marginsAreaBottom = 0;
m_separatorAreaMarginRight = 0; m_marginsAreaRight = 0;
Plasma::Svg *svg = new Plasma::Svg(this); Plasma::Svg *svg = new Plasma::Svg(this);
svg->setImagePath(QStringLiteral("widgets/panel-background")); svg->setImagePath(QStringLiteral("widgets/panel-background"));
@ -530,19 +530,19 @@ void Theme::updateSeperatorAreaMarginsValues()
int thickBottomMargin = svg->hasElement("thick-hint-bottom-margin") ? svg->elementSize("thick-hint-bottom-margin").height() : 0; int thickBottomMargin = svg->hasElement("thick-hint-bottom-margin") ? svg->elementSize("thick-hint-bottom-margin").height() : 0;
int thickRightMargin = svg->hasElement("thick-hint-right-margin") ? svg->elementSize("thick-hint-right-margin").width() : 0; int thickRightMargin = svg->hasElement("thick-hint-right-margin") ? svg->elementSize("thick-hint-right-margin").width() : 0;
m_separatorAreaMarginTop = qMax(0, thickTopMargin - topMargin); m_marginsAreaTop = qMax(0, thickTopMargin - topMargin);
m_separatorAreaMarginLeft = qMax(0, thickLeftMargin - leftMargin); m_marginsAreaLeft = qMax(0, thickLeftMargin - leftMargin);
m_separatorAreaMarginBottom = qMax(0, thickBottomMargin - bottomMargin); m_marginsAreaBottom = qMax(0, thickBottomMargin - bottomMargin);
m_separatorAreaMarginRight = qMax(0, thickRightMargin - rightMargin); m_marginsAreaRight = qMax(0, thickRightMargin - rightMargin);
} }
qDebug() << "PLASMA THEME SEPARATOR AREA MARGINS ::" << qDebug() << "PLASMA THEME MARGINS AREA ::" <<
m_separatorAreaMarginTop << m_separatorAreaMarginLeft << m_marginsAreaTop << m_marginsAreaLeft <<
m_separatorAreaMarginBottom << m_separatorAreaMarginRight; m_marginsAreaBottom << m_marginsAreaRight;
svg->deleteLater(); svg->deleteLater();
emit separatorAreaMarginsChanged(); emit marginsAreaChanged();
} }
void Theme::loadConfig() void Theme::loadConfig()

View File

@ -69,10 +69,10 @@ class Theme: public QObject
Q_PROPERTY(int outlineWidth READ outlineWidth NOTIFY outlineWidthChanged) Q_PROPERTY(int outlineWidth READ outlineWidth NOTIFY outlineWidthChanged)
Q_PROPERTY(int separatorAreaMarginTop READ separatorAreaMarginTop NOTIFY separatorAreaMarginsChanged) Q_PROPERTY(int marginsAreaTop READ marginsAreaTop NOTIFY marginsAreaChanged)
Q_PROPERTY(int separatorAreaMarginLeft READ separatorAreaMarginLeft NOTIFY separatorAreaMarginsChanged) Q_PROPERTY(int marginsAreaLeft READ marginsAreaLeft NOTIFY marginsAreaChanged)
Q_PROPERTY(int separatorAreaMarginBottom READ separatorAreaMarginBottom NOTIFY separatorAreaMarginsChanged) Q_PROPERTY(int marginsAreaBottom READ marginsAreaBottom NOTIFY marginsAreaChanged)
Q_PROPERTY(int separatorAreaMarginRight READ separatorAreaMarginRight NOTIFY separatorAreaMarginsChanged) Q_PROPERTY(int marginsAreaRight READ marginsAreaRight NOTIFY marginsAreaChanged)
Q_PROPERTY(Latte::PlasmaExtended::PanelBackground *backgroundTopEdge READ backgroundTopEdge NOTIFY backgroundsChanged) Q_PROPERTY(Latte::PlasmaExtended::PanelBackground *backgroundTopEdge READ backgroundTopEdge NOTIFY backgroundsChanged)
Q_PROPERTY(Latte::PlasmaExtended::PanelBackground *backgroundLeftEdge READ backgroundLeftEdge NOTIFY backgroundsChanged) Q_PROPERTY(Latte::PlasmaExtended::PanelBackground *backgroundLeftEdge READ backgroundLeftEdge NOTIFY backgroundsChanged)
@ -94,10 +94,10 @@ public:
int outlineWidth() const; int outlineWidth() const;
void setOutlineWidth(int width); void setOutlineWidth(int width);
int separatorAreaMarginTop() const; int marginsAreaTop() const;
int separatorAreaMarginLeft() const; int marginsAreaLeft() const;
int separatorAreaMarginBottom() const; int marginsAreaBottom() const;
int separatorAreaMarginRight() const; int marginsAreaRight() const;
PanelBackground *backgroundTopEdge() const; PanelBackground *backgroundTopEdge() const;
PanelBackground *backgroundLeftEdge() const; PanelBackground *backgroundLeftEdge() const;
@ -117,7 +117,7 @@ signals:
void compositingChanged(); void compositingChanged();
void hasShadowChanged(); void hasShadowChanged();
void outlineWidthChanged(); void outlineWidthChanged();
void separatorAreaMarginsChanged(); void marginsAreaChanged();
void themeChanged(); void themeChanged();
private slots: private slots:
@ -134,9 +134,9 @@ private:
void updateHasShadow(); void updateHasShadow();
void updateDefaultScheme(); void updateDefaultScheme();
void updateDefaultSchemeValues(); void updateDefaultSchemeValues();
void updateMarginsAreaValues();
void updateReversedScheme(); void updateReversedScheme();
void updateReversedSchemeValues(); void updateReversedSchemeValues();
void updateSeperatorAreaMarginsValues();
void qmlRegisterTypes(); void qmlRegisterTypes();
@ -147,10 +147,10 @@ private:
int m_outlineWidth{1}; int m_outlineWidth{1};
int m_separatorAreaMarginTop{0}; int m_marginsAreaTop{0};
int m_separatorAreaMarginLeft{0}; int m_marginsAreaLeft{0};
int m_separatorAreaMarginBottom{0}; int m_marginsAreaBottom{0};
int m_separatorAreaMarginRight{0}; int m_marginsAreaRight{0};
QString m_themePath; QString m_themePath;
QString m_themeWidgetsPath; QString m_themeWidgetsPath;

View File

@ -56,6 +56,7 @@ Item {
&& !isSpacer && !isInternalViewSplitter && !isSpacer && !isInternalViewSplitter
readonly property bool canFillThickness: applet && applet.hasOwnProperty("constraintHints") && (applet.constraintHints & PlasmaCore.Types.CanFillArea); readonly property bool canFillThickness: applet && applet.hasOwnProperty("constraintHints") && (applet.constraintHints & PlasmaCore.Types.CanFillArea);
readonly property bool isMarginAreaSeparator: applet && applet.hasOwnProperty("constraintHints") && (applet.constraintHints & PlasmaCore.Types.MarginAreasSeparator);
readonly property color highlightColor: theme.buttonFocusColor readonly property color highlightColor: theme.buttonFocusColor