provide all background corners option

--provide an option to force showing of all background
corners
pull/19/head
Michail Vourlakos 5 years ago
parent af37c31f36
commit 5e78a0a3c7

@ -67,6 +67,8 @@ void Effects::init()
}
});
connect(this, &Effects::backgroundAllCornersChanged, this, &Effects::updateEnabledBorders);
connect(m_view, &Latte::View::alignmentChanged, this, &Effects::updateEnabledBorders);
connect(m_view, &Latte::View::maxLengthChanged, this, &Effects::updateEnabledBorders);
connect(m_view, &Latte::View::offsetChanged, this, &Effects::updateEnabledBorders);
@ -108,6 +110,21 @@ void Effects::setAnimationsBlocked(bool blocked)
emit animationsBlockedChanged();
}
bool Effects::backgroundAllCorners() const
{
return m_backgroundAllCorners;
}
void Effects::setBackgroundAllCorners(bool allcorners)
{
if (m_backgroundAllCorners == allcorners) {
return;
}
m_backgroundAllCorners = allcorners;
emit backgroundAllCornersChanged();
}
bool Effects::drawShadows() const
{
return m_drawShadows;
@ -422,11 +439,11 @@ void Effects::updateEffects()
//! windows that use GtkFrameExtents and apply Effects on them they take GtkFrameExtents
//! as granted
if (KWindowSystem::isPlatformX11()) {
if (m_view->location() == Plasma::Types::BottomEdge) {
fY = qMax(0, fY - m_view->headThicknessGap());
} else if (m_view->location() == Plasma::Types::RightEdge) {
fX = qMax(0, fX - m_view->headThicknessGap());
}
if (m_view->location() == Plasma::Types::BottomEdge) {
fY = qMax(0, fY - m_view->headThicknessGap());
} else if (m_view->location() == Plasma::Types::RightEdge) {
fX = qMax(0, fX - m_view->headThicknessGap());
}
}
#endif
@ -514,7 +531,7 @@ void Effects::updateEnabledBorders()
Plasma::FrameSvg::EnabledBorders borders = Plasma::FrameSvg::AllBorders;
if (!m_view->screenEdgeMarginEnabled()) {
if (!m_view->screenEdgeMarginEnabled() && !m_backgroundAllCorners) {
switch (m_view->location()) {
case Plasma::Types::TopEdge:
borders &= ~Plasma::FrameSvg::TopBorder;
@ -537,38 +554,40 @@ void Effects::updateEnabledBorders()
}
}
if ((m_view->location() == Plasma::Types::LeftEdge || m_view->location() == Plasma::Types::RightEdge)) {
if (m_view->maxLength() == 1 && m_view->alignment() == Latte::Types::Justify) {
if (!m_forceTopBorder) {
if (!m_backgroundAllCorners) {
if ((m_view->location() == Plasma::Types::LeftEdge || m_view->location() == Plasma::Types::RightEdge)) {
if (m_view->maxLength() == 1 && m_view->alignment() == Latte::Types::Justify) {
if (!m_forceTopBorder) {
borders &= ~Plasma::FrameSvg::TopBorder;
}
if (!m_forceBottomBorder) {
borders &= ~Plasma::FrameSvg::BottomBorder;
}
}
if (m_view->alignment() == Latte::Types::Top && !m_forceTopBorder && m_view->offset() == 0) {
borders &= ~Plasma::FrameSvg::TopBorder;
}
if (!m_forceBottomBorder) {
if (m_view->alignment() == Latte::Types::Bottom && !m_forceBottomBorder && m_view->offset() == 0) {
borders &= ~Plasma::FrameSvg::BottomBorder;
}
}
if (m_view->alignment() == Latte::Types::Top && !m_forceTopBorder && m_view->offset() == 0) {
borders &= ~Plasma::FrameSvg::TopBorder;
}
if (m_view->alignment() == Latte::Types::Bottom && !m_forceBottomBorder && m_view->offset() == 0) {
borders &= ~Plasma::FrameSvg::BottomBorder;
}
}
if (m_view->location() == Plasma::Types::TopEdge || m_view->location() == Plasma::Types::BottomEdge) {
if (m_view->maxLength() == 1 && m_view->alignment() == Latte::Types::Justify) {
borders &= ~Plasma::FrameSvg::LeftBorder;
borders &= ~Plasma::FrameSvg::RightBorder;
}
if (m_view->location() == Plasma::Types::TopEdge || m_view->location() == Plasma::Types::BottomEdge) {
if (m_view->maxLength() == 1 && m_view->alignment() == Latte::Types::Justify) {
borders &= ~Plasma::FrameSvg::LeftBorder;
borders &= ~Plasma::FrameSvg::RightBorder;
}
if (m_view->alignment() == Latte::Types::Left && m_view->offset() == 0) {
borders &= ~Plasma::FrameSvg::LeftBorder;
}
if (m_view->alignment() == Latte::Types::Left && m_view->offset() == 0) {
borders &= ~Plasma::FrameSvg::LeftBorder;
}
if (m_view->alignment() == Latte::Types::Right && m_view->offset() == 0) {
borders &= ~Plasma::FrameSvg::RightBorder;
if (m_view->alignment() == Latte::Types::Right && m_view->offset() == 0) {
borders &= ~Plasma::FrameSvg::RightBorder;
}
}
}

@ -49,6 +49,7 @@ class Effects: public QObject
Q_PROPERTY(int editShadow READ editShadow WRITE setEditShadow NOTIFY editShadowChanged)
Q_PROPERTY(int innerShadow READ innerShadow WRITE setInnerShadow NOTIFY innerShadowChanged)
Q_PROPERTY(bool backgroundAllCorners READ backgroundAllCorners WRITE setBackgroundAllCorners NOTIFY backgroundAllCornersChanged)
Q_PROPERTY(float backgroundOpacity READ backgroundOpacity WRITE setBackgroundOpacity NOTIFY backgroundOpacityChanged)
Q_PROPERTY(QRect mask READ mask WRITE setMask NOTIFY maskChanged)
@ -64,6 +65,9 @@ public:
bool animationsBlocked() const;
void setAnimationsBlocked(bool blocked);
bool backgroundAllCorners() const;
void setBackgroundAllCorners(bool allcorners);
bool drawShadows() const;
void setDrawShadows(bool draw);
@ -108,6 +112,7 @@ public slots:
signals:
void animationsBlockedChanged();
void backgroundAllCornersChanged();
void backgroundOpacityChanged();
void drawShadowsChanged();
void drawEffectsChanged();
@ -132,6 +137,7 @@ private:
private:
bool m_animationsBlocked{false};
bool m_backgroundAllCorners{false};
bool m_drawShadows{true};
bool m_drawEffects{false};
bool m_forceTopBorder{false};

@ -95,6 +95,9 @@
<entry name="panelOutline" type="Bool">
<default>false</default>
</entry>
<entry name="backgroundAllCorners" type="Bool">
<default>false</default>
</entry>
<entry name="blurEnabled" type="Bool">
<default>true</default>
</entry>

@ -276,6 +276,15 @@ Item{
}
//! View::Effects bindings
Binding{
target: latteView && latteView.effects ? latteView.effects : null
property: "backgroundAllCorners"
when: latteView && latteView.effects
value: plasmoid.configuration.backgroundAllCorners
&& (!root.screenEdgeMarginEnabled
|| (root.screenEdgeMarginEnabled && plasmoid.configuration.maxLength===100 && !root.hideLengthScreenGaps))
}
Binding{
target: latteView && latteView.effects ? latteView.effects : null
property: "backgroundOpacity"

@ -58,7 +58,7 @@ BackgroundProperties{
shadows.bottom: hasBottomBorder ? shadowsSvgItem.margins.bottom : 0
//! it can accept negative values in DockMode
screenEdgeMargin: root.screenEdgeMarginEnabled ? metrics.margin.screenEdge - shadows.tailThickness : 0
screenEdgeMargin: root.screenEdgeMarginEnabled ? metrics.margin.screenEdge - shadows.tailThickness : -shadows.tailThickness
paddings.top: {
if (hasTopBorder) {

@ -1011,7 +1011,7 @@ PlasmaComponents.Page {
spacing: 2
visible: dialog.advancedLevel
readonly property int buttonSize: (dialog.optionsWidth - (spacing*2)) / 3
readonly property int buttonSize: (dialog.optionsWidth - (spacing * (children.length-1))) / children.length
PlasmaComponents.Button {
id: panelBlur
@ -1057,6 +1057,23 @@ PlasmaComponents.Page {
plasmoid.configuration.panelOutline = !plasmoid.configuration.panelOutline;
}
}
PlasmaComponents.Button {
id: allCorners
Layout.minimumWidth: parent.buttonSize
Layout.maximumWidth: Layout.minimumWidth
text: i18n("All Corners")
checked: plasmoid.configuration.backgroundAllCorners
checkable: true
enabled: showBackground.checked
&& ((plasmoid.configuration.screenEdgeMargin===-1)
|| (plasmoid.configuration.screenEdgeMargin>-1 && plasmoid.configuration.maxLength===100))
tooltip: i18n("Background draws all corners at all cases.")
onClicked: {
plasmoid.configuration.backgroundAllCorners = !plasmoid.configuration.backgroundAllCorners;
}
}
}
LatteComponents.SubHeader {

Loading…
Cancel
Save