1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 13:33:50 +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();
updateBackgrounds();
updateSeperatorAreaMarginsValues();
updateMarginsAreaValues();
}
Theme::~Theme()
@ -132,24 +132,24 @@ void Theme::setOutlineWidth(int width)
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];
}
void Theme::updateSeperatorAreaMarginsValues()
void Theme::updateMarginsAreaValues()
{
m_separatorAreaMarginTop = 0;
m_separatorAreaMarginLeft = 0;
m_separatorAreaMarginBottom = 0;
m_separatorAreaMarginRight = 0;
m_marginsAreaTop = 0;
m_marginsAreaLeft = 0;
m_marginsAreaBottom = 0;
m_marginsAreaRight = 0;
Plasma::Svg *svg = new Plasma::Svg(this);
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 thickRightMargin = svg->hasElement("thick-hint-right-margin") ? svg->elementSize("thick-hint-right-margin").width() : 0;
m_separatorAreaMarginTop = qMax(0, thickTopMargin - topMargin);
m_separatorAreaMarginLeft = qMax(0, thickLeftMargin - leftMargin);
m_separatorAreaMarginBottom = qMax(0, thickBottomMargin - bottomMargin);
m_separatorAreaMarginRight = qMax(0, thickRightMargin - rightMargin);
m_marginsAreaTop = qMax(0, thickTopMargin - topMargin);
m_marginsAreaLeft = qMax(0, thickLeftMargin - leftMargin);
m_marginsAreaBottom = qMax(0, thickBottomMargin - bottomMargin);
m_marginsAreaRight = qMax(0, thickRightMargin - rightMargin);
}
qDebug() << "PLASMA THEME SEPARATOR AREA MARGINS ::" <<
m_separatorAreaMarginTop << m_separatorAreaMarginLeft <<
m_separatorAreaMarginBottom << m_separatorAreaMarginRight;
qDebug() << "PLASMA THEME MARGINS AREA ::" <<
m_marginsAreaTop << m_marginsAreaLeft <<
m_marginsAreaBottom << m_marginsAreaRight;
svg->deleteLater();
emit separatorAreaMarginsChanged();
emit marginsAreaChanged();
}
void Theme::loadConfig()

View File

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

View File

@ -56,6 +56,7 @@ Item {
&& !isSpacer && !isInternalViewSplitter
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