[FrameSvg*] Rename shadowMargins to inset

This commit is contained in:
Mikel Johnson 2020-11-25 20:39:12 +03:00 committed by Marco Martin
parent 2f7563d6eb
commit c8e563efa7
5 changed files with 63 additions and 63 deletions

View File

@ -168,7 +168,7 @@ FrameSvgItemMargins::FrameSvgItemMargins(Plasma::FrameSvg *frameSvg, QObject *pa
: QObject(parent),
m_frameSvg(frameSvg),
m_fixed(false),
m_shadow(false)
m_inset(false)
{
//qDebug() << "margins at: " << left() << top() << right() << bottom();
}
@ -177,8 +177,8 @@ qreal FrameSvgItemMargins::left() const
{
if (m_fixed) {
return m_frameSvg->fixedMarginSize(Types::LeftMargin);
} else if(m_shadow){
return m_frameSvg->shadowMarginSize(Types::LeftMargin);
} else if(m_inset){
return m_frameSvg->insetMarginSize(Types::LeftMargin);
} else {
return m_frameSvg->marginSize(Types::LeftMargin);
}
@ -188,8 +188,8 @@ qreal FrameSvgItemMargins::top() const
{
if (m_fixed) {
return m_frameSvg->fixedMarginSize(Types::TopMargin);
} else if(m_shadow){
return m_frameSvg->shadowMarginSize(Types::TopMargin);
} else if(m_inset){
return m_frameSvg->insetMarginSize(Types::TopMargin);
} else {
return m_frameSvg->marginSize(Types::TopMargin);
}
@ -199,8 +199,8 @@ qreal FrameSvgItemMargins::right() const
{
if (m_fixed) {
return m_frameSvg->fixedMarginSize(Types::RightMargin);
} else if(m_shadow){
return m_frameSvg->shadowMarginSize(Types::RightMargin);
} else if(m_inset){
return m_frameSvg->insetMarginSize(Types::RightMargin);
} else {
return m_frameSvg->marginSize(Types::RightMargin);
}
@ -210,8 +210,8 @@ qreal FrameSvgItemMargins::bottom() const
{
if (m_fixed) {
return m_frameSvg->fixedMarginSize(Types::BottomMargin);
} else if(m_shadow){
return m_frameSvg->shadowMarginSize(Types::BottomMargin);
} else if(m_inset){
return m_frameSvg->insetMarginSize(Types::BottomMargin);
} else {
return m_frameSvg->marginSize(Types::BottomMargin);
}
@ -254,26 +254,26 @@ bool FrameSvgItemMargins::isFixed() const
return m_fixed;
}
void FrameSvgItemMargins::setShadow(bool shadow)
void FrameSvgItemMargins::setInset(bool inset)
{
if (shadow == m_shadow) {
if (inset == m_inset) {
return;
}
m_shadow = shadow;
m_inset = inset;
emit marginsChanged();
}
bool FrameSvgItemMargins::isShadow() const
bool FrameSvgItemMargins::isInset() const
{
return m_shadow;
return m_inset;
}
FrameSvgItem::FrameSvgItem(QQuickItem *parent)
: QQuickItem(parent),
m_margins(nullptr),
m_fixedMargins(nullptr),
m_shadowMargins(nullptr),
m_insetMargins(nullptr),
m_textureChanged(false),
m_sizeChanged(false),
m_fastPath(true)
@ -320,7 +320,7 @@ void FrameSvgItem::setImagePath(const QString &path)
CheckMarginsChange checkMargins(m_oldMargins, m_margins);
CheckMarginsChange checkFixedMargins(m_oldFixedMargins, m_fixedMargins);
CheckMarginsChange checkShadowMargins(m_oldShadowMargins, m_shadowMargins);
CheckMarginsChange checkInsetMargins(m_oldInsetMargins, m_insetMargins);
updateDevicePixelRatio();
m_frameSvg->setImagePath(path);
@ -365,7 +365,7 @@ void FrameSvgItem::setPrefix(const QVariant &prefixes)
CheckMarginsChange checkMargins(m_oldMargins, m_margins);
CheckMarginsChange checkFixedMargins(m_oldFixedMargins, m_fixedMargins);
CheckMarginsChange checkShadowMargins(m_oldShadowMargins, m_shadowMargins);
CheckMarginsChange checkInsetMargins(m_oldInsetMargins, m_insetMargins);
m_prefixes = prefixList;
applyPrefixes();
@ -414,13 +414,13 @@ FrameSvgItemMargins *FrameSvgItem::fixedMargins()
return m_fixedMargins;
}
FrameSvgItemMargins *FrameSvgItem::shadowMargins()
FrameSvgItemMargins *FrameSvgItem::inset()
{
if (!m_shadowMargins) {
m_shadowMargins = new FrameSvgItemMargins(m_frameSvg, this);
m_shadowMargins->setShadow(true);
if (!m_insetMargins) {
m_insetMargins = new FrameSvgItemMargins(m_frameSvg, this);
m_insetMargins->setInset(true);
}
return m_shadowMargins;
return m_insetMargins;
}
void FrameSvgItem::setColorGroup(Plasma::Theme::ColorGroup group)
@ -510,7 +510,7 @@ void FrameSvgItem::doUpdate()
CheckMarginsChange checkMargins(m_oldMargins, m_margins);
CheckMarginsChange checkFixedMargins(m_oldFixedMargins, m_fixedMargins);
CheckMarginsChange checkShadowMargins(m_oldShadowMargins, m_shadowMargins);
CheckMarginsChange checkInsetMargins(m_oldInsetMargins, m_insetMargins);
//if the theme changed, the available prefix may have changed as well
applyPrefixes();
@ -655,7 +655,7 @@ void FrameSvgItem::componentComplete()
{
CheckMarginsChange checkMargins(m_oldMargins, m_margins);
CheckMarginsChange checkFixedMargins(m_oldFixedMargins, m_fixedMargins);
CheckMarginsChange checkShadowMargins(m_oldShadowMargins, m_shadowMargins);
CheckMarginsChange checkInsetMargins(m_oldInsetMargins, m_insetMargins);
QQuickItem::componentComplete();
m_frameSvg->resizeFrame(QSize(width(), height()));

View File

@ -75,8 +75,8 @@ public:
void setFixed(bool fixed);
bool isFixed() const;
void setShadow(bool shadow);
bool isShadow() const;
void setInset(bool inset);
bool isInset() const;
public Q_SLOTS:
void update();
@ -87,7 +87,7 @@ Q_SIGNALS:
private:
FrameSvg *m_frameSvg;
bool m_fixed;
bool m_shadow;
bool m_inset;
};
@ -139,12 +139,12 @@ class FrameSvgItem : public QQuickItem
Q_PROPERTY(QObject *fixedMargins READ fixedMargins CONSTANT)
/**
* The margins of the shadow
* The margins of the inset
* read only
* @see FrameSvgItemMargins
* @since 5.77
*/
Q_PROPERTY(QObject *shadowMargins READ shadowMargins CONSTANT)
Q_PROPERTY(QObject *inset READ inset CONSTANT)
/**
* The borders that will be rendered, it's a flag combination of:
@ -212,7 +212,7 @@ public:
FrameSvgItemMargins *margins();
FrameSvgItemMargins *fixedMargins();
FrameSvgItemMargins *shadowMargins();
FrameSvgItemMargins *inset();
void setColorGroup(Plasma::Theme::ColorGroup group);
Plasma::Theme::ColorGroup colorGroup() const;
@ -263,11 +263,11 @@ private:
Plasma::FrameSvg *m_frameSvg;
FrameSvgItemMargins *m_margins;
FrameSvgItemMargins *m_fixedMargins;
FrameSvgItemMargins *m_shadowMargins;
FrameSvgItemMargins *m_insetMargins;
// logged margins to check for changes
QVector<qreal> m_oldMargins;
QVector<qreal> m_oldFixedMargins;
QVector<qreal> m_oldShadowMargins;
QVector<qreal> m_oldInsetMargins;
QStringList m_prefixes;
bool m_textureChanged;
bool m_sizeChanged;

View File

@ -218,7 +218,7 @@ qreal FrameSvg::marginSize(const Plasma::Types::MarginEdge edge) const
}
}
qreal FrameSvg::shadowMarginSize(const Plasma::Types::MarginEdge edge) const
qreal FrameSvg::insetMarginSize(const Plasma::Types::MarginEdge edge) const
{
if (!d->frame) {
return .0;
@ -230,17 +230,17 @@ qreal FrameSvg::shadowMarginSize(const Plasma::Types::MarginEdge edge) const
switch (edge) {
case Plasma::Types::TopMargin:
return d->frame->shadowTopMargin;
return d->frame->insetTopMargin;
case Plasma::Types::LeftMargin:
return d->frame->shadowLeftMargin;
return d->frame->insetLeftMargin;
case Plasma::Types::RightMargin:
return d->frame->shadowRightMargin;
return d->frame->insetRightMargin;
//Plasma::BottomMargin
default:
return d->frame->shadowBottomMargin;
return d->frame->insetBottomMargin;
}
}
@ -296,17 +296,17 @@ void FrameSvg::getFixedMargins(qreal &left, qreal &top, qreal &right, qreal &bot
bottom = d->frame->fixedBottomMargin;
}
void FrameSvg::getShadowMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const
void FrameSvg::getInsetMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const
{
if (!d->frame || d->frame->noBorderPadding) {
left = top = right = bottom = 0;
return;
}
top = d->frame->shadowTopMargin;
left = d->frame->shadowLeftMargin;
right = d->frame->shadowRightMargin;
bottom = d->frame->shadowBottomMargin;
top = d->frame->insetTopMargin;
left = d->frame->insetLeftMargin;
right = d->frame->insetRightMargin;
bottom = d->frame->insetBottomMargin;
}
QRectF FrameSvg::contentsRect() const
@ -810,10 +810,10 @@ void FrameSvgPrivate::updateSizes(FrameData *frame) const
frame->topMargin = frame->topHeight = 0;
}
if (q->hasElement(frame->prefix % QLatin1String("hint-shadow-top-margin"))) {
frame->shadowTopMargin = q->elementSize(frame->prefix % QLatin1String("hint-shadow-top-margin")).height();
if (q->hasElement(frame->prefix % QLatin1String("hint-inset-top-margin"))) {
frame->insetTopMargin = q->elementSize(frame->prefix % QLatin1String("hint-inset-top-margin")).height();
} else {
frame->shadowTopMargin = 0;
frame->insetTopMargin = -1;
}
frame->fixedLeftWidth = q->elementSize(frame->prefix % QLatin1String("left")).width();
@ -831,10 +831,10 @@ void FrameSvgPrivate::updateSizes(FrameData *frame) const
frame->leftMargin = frame->leftWidth = 0;
}
if (q->hasElement(frame->prefix % QLatin1String("hint-shadow-left-margin"))) {
frame->shadowLeftMargin = q->elementSize(frame->prefix % QLatin1String("hint-shadow-left-margin")).width();
if (q->hasElement(frame->prefix % QLatin1String("hint-inset-left-margin"))) {
frame->insetLeftMargin = q->elementSize(frame->prefix % QLatin1String("hint-inset-left-margin")).width();
} else {
frame->shadowLeftMargin = 0;
frame->insetLeftMargin = -1;
}
frame->fixedRightWidth = q->elementSize(frame->prefix % QLatin1String("right")).width();
@ -852,10 +852,10 @@ void FrameSvgPrivate::updateSizes(FrameData *frame) const
frame->rightMargin = frame->rightWidth = 0;
}
if (q->hasElement(frame->prefix % QLatin1String("hint-shadow-right-margin"))) {
frame->shadowRightMargin = q->elementSize(frame->prefix % QLatin1String("hint-shadow-right-margin")).width();
if (q->hasElement(frame->prefix % QLatin1String("hint-inset-right-margin"))) {
frame->insetRightMargin = q->elementSize(frame->prefix % QLatin1String("hint-inset-right-margin")).width();
} else {
frame->shadowRightMargin = 0;
frame->insetRightMargin = -1;
}
frame->fixedBottomHeight = q->elementSize(frame->prefix % QLatin1String("bottom")).height();
@ -873,10 +873,10 @@ void FrameSvgPrivate::updateSizes(FrameData *frame) const
frame->bottomMargin = frame->bottomHeight = 0;
}
if (q->hasElement(frame->prefix % QLatin1String("hint-shadow-bottom-margin"))) {
frame->shadowBottomMargin = q->elementSize(frame->prefix % QLatin1String("hint-shadow-bottom-margin")).height();
if (q->hasElement(frame->prefix % QLatin1String("hint-inset-bottom-margin"))) {
frame->insetBottomMargin = q->elementSize(frame->prefix % QLatin1String("hint-inset-bottom-margin")).height();
} else {
frame->shadowBottomMargin = 0;
frame->insetBottomMargin = -1;
}
frame->composeOverBorder = (q->hasElement(frame->prefix % QLatin1String("hint-compose-over-border")) &&

View File

@ -163,15 +163,15 @@ public:
Q_INVOKABLE void getFixedMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const;
/**
* Returns the shadows margin size given the margin edge we want.
* Returns the insets margin size given the margin edge we want.
* @param edge the margin edge we want, top, bottom, left or right
* @return the margin size
* @since 5.77
*/
Q_INVOKABLE qreal shadowMarginSize(const Plasma::Types::MarginEdge edge) const;
Q_INVOKABLE qreal insetMarginSize(const Plasma::Types::MarginEdge edge) const;
/**
* Convenience method that extracts the size of the four shadow margins
* Convenience method that extracts the size of the four inset margins
* in the four output parameters
* @param left left margin size
* @param top top margin size
@ -179,7 +179,7 @@ public:
* @param bottom bottom margin size
* @since 5.77
*/
Q_INVOKABLE void getShadowMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const;
Q_INVOKABLE void getInsetMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const;
/**
* @return the rectangle of the center element, taking the margins into account.

View File

@ -104,11 +104,11 @@ public:
int fixedRightMargin;
int fixedBottomMargin;
//margins, we only have the hint for shadows
int shadowTopMargin;
int shadowLeftMargin;
int shadowRightMargin;
int shadowBottomMargin;
//margins, we only have the hint for insets
int insetTopMargin;
int insetLeftMargin;
int insetRightMargin;
int insetBottomMargin;
qreal devicePixelRatio;