[indicators api] - new background corner margin

--introducing in Indicators API a new option to
specify the indicator preference for the distance
between the indicator and panel background roundness.
By altering the option the indicator can get into
the panel background roundness.

BUG:442675
work/m_layershell
Michail Vourlakos 3 years ago
parent fc4dc6dacc
commit c86878f6c7

@ -82,6 +82,14 @@ Ability.IndicatorsPrivate {
return -1;
}
backgroundCornerMargin: {
if (indicatorLevel.isLoaded && indicatorLevel.item.hasOwnProperty("backgroundCornerMargin")) {
return indicatorLevel.item.backgroundCornerMargin;
}
return 1.00;
}
svgPaths: indicatorLevel.isLoaded && indicatorLevel.item.hasOwnProperty("svgImagePaths") ?
indicatorLevel.item.svgImagePaths : []
}

@ -60,7 +60,7 @@ BackgroundProperties{
if (root.isVertical) {
var expected = customRadiusIsEnabled ? customAppliedRadius : Math.max(themePadding, solidBackgroundPadding);
expected = Math.max(0, expected - metrics.margin.length); //! remove from roundness padding the applied margins
return expected;
return expected * indicators.info.backgroundCornerMargin;
} else {
return Math.max(themePadding, solidBackgroundPadding);
}
@ -77,7 +77,7 @@ BackgroundProperties{
if (root.isVertical) {
var expected = customRadiusIsEnabled ? customAppliedRadius : Math.max(themePadding, solidBackgroundPadding);
expected = Math.max(0, expected - metrics.margin.length); //! remove from roundness padding the applied margins
return expected;
return expected * indicators.info.backgroundCornerMargin;
} else {
return Math.max(themePadding, solidBackgroundPadding);
}
@ -95,7 +95,7 @@ BackgroundProperties{
if (root.isHorizontal) {
var expected = customRadiusIsEnabled ? customAppliedRadius : Math.max(themePadding, solidBackgroundPadding);
expected = Math.max(0, expected - metrics.margin.length); //! remove from roundness padding the applied margins
return expected;
return expected * indicators.info.backgroundCornerMargin;
} else {
return Math.max(themePadding, solidBackgroundPadding);
}
@ -113,7 +113,7 @@ BackgroundProperties{
if (root.isHorizontal) {
var expected = customRadiusIsEnabled ? customAppliedRadius : Math.max(themePadding, solidBackgroundPadding);
expected = Math.max(0, expected - metrics.margin.length); //! remove from roundness padding the applied margins
return expected;
return expected * indicators.info.backgroundCornerMargin;
} else {
return Math.max(themePadding, solidBackgroundPadding);
}

@ -34,6 +34,7 @@ AbilityDefinition.Indicators {
info.providesHoveredAnimation: false
info.providesClickedAnimation: false
info.extraMaskThickness: 0
info.backgroundCornerMargin: 1.00
info.lengthPadding: 0.08
info.minThicknessPadding: 0
info.minLengthPadding:0

@ -33,6 +33,7 @@ Item{
minThicknessPadding: 0
minLengthPadding: 0
backgroundCornerMargin: 1.00
lengthPadding: 0.08
appletLengthPadding: -1

@ -21,6 +21,7 @@ Item{
property real lengthPadding: 0.08
property real appletLengthPadding: -1
property real backgroundCornerMargin: 1.00
property variant svgPaths: []
}

@ -64,6 +64,12 @@ Item {
//! [since v0.10.0]
property real lengthPadding: 0.08
//! this indicator specifies how far would like to be from panel background edge
//! it is totally panel background roundness related. By altering that value, indicators
//! can get inside panel background big roundnesses. This value is a percentage,
//! e.g 0.06 -> 6%
//! [since v0.10.3]
property real backgroundCornerMargin: 1.00
//! svg image paths either from plasma theme or local files relevant to indicator "ui" directory
//! in order to reduce resources usage

@ -109,6 +109,42 @@ ColumnLayout {
}
}
RowLayout {
Layout.fillWidth: true
spacing: units.smallSpacing
PlasmaComponents.Label {
text: i18n("Position")
horizontalAlignment: Text.AlignLeft
}
LatteComponents.Slider {
id: thickMarginSlider
Layout.fillWidth: true
value: Math.round(indicator.configuration.thickMargin * 100)
from: 0
to: 30
stepSize: 1
wheelEnabled: false
onPressedChanged: {
if (!pressed) {
indicator.configuration.thickMargin = value / 100;
}
}
}
PlasmaComponents.Label {
text: i18nc("number in percentage, e.g. 85 %","%1 %", currentValue)
horizontalAlignment: Text.AlignRight
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
readonly property int currentValue: thickMarginSlider.value
}
}
RowLayout {
Layout.fillWidth: true
spacing: units.smallSpacing
@ -152,23 +188,23 @@ ColumnLayout {
spacing: units.smallSpacing
PlasmaComponents.Label {
text: i18n("Position")
text: i18n("Corner Margin")
horizontalAlignment: Text.AlignLeft
}
LatteComponents.Slider {
id: thickMarginSlider
id: backgroundCornerMarginSlider
Layout.fillWidth: true
value: Math.round(indicator.configuration.thickMargin * 100)
value: Math.round(indicator.configuration.backgroundCornerMargin * 100)
from: 0
to: 30
stepSize: 1
to: 100
stepSize: 2
wheelEnabled: false
onPressedChanged: {
if (!pressed) {
indicator.configuration.thickMargin = value / 100;
indicator.configuration.backgroundCornerMargin = value / 100;
}
}
}
@ -179,11 +215,10 @@ ColumnLayout {
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
readonly property int currentValue: thickMarginSlider.value
readonly property int currentValue: backgroundCornerMarginSlider.value
}
}
LatteComponents.HeaderSwitch {
id: glowEnabled
Layout.fillWidth: true

@ -49,6 +49,9 @@
<entry name="thickMargin" type="Double">
<default>0.0</default>
</entry>
<entry name="backgroundCornerMargin" type="Double">
<default>1.00</default>
</entry>
<entry name="reversed" type="Bool">
<default>false</default>
</entry>

@ -20,6 +20,7 @@ LatteComponents.IndicatorItem{
enabledForApplets: indicator && indicator.configuration ? indicator.configuration.enabledForApplets : true
lengthPadding: indicator && indicator.configuration ? indicator.configuration.lengthPadding : 0.08
backgroundCornerMargin: indicator && indicator.configuration ? indicator.configuration.backgroundCornerMargin : 1.00
readonly property real factor: indicator.configuration.size
readonly property int size: factor * indicator.currentIconSize

@ -18,7 +18,7 @@ ColumnLayout {
Layout.fillWidth: true
LatteComponents.SubHeader {
text: i18n("Padding")
text: i18n("Style")
}
RowLayout {
@ -26,7 +26,7 @@ ColumnLayout {
spacing: units.smallSpacing
PlasmaComponents.Label {
text: i18n("Length")
text: i18n("Padding")
horizontalAlignment: Text.AlignLeft
}
@ -59,6 +59,42 @@ ColumnLayout {
}
}
RowLayout {
Layout.fillWidth: true
spacing: units.smallSpacing
PlasmaComponents.Label {
text: i18n("Corner Margin")
horizontalAlignment: Text.AlignLeft
}
LatteComponents.Slider {
id: backgroundCornerMarginSlider
Layout.fillWidth: true
value: Math.round(indicator.configuration.backgroundCornerMargin * 100)
from: 0
to: 100
stepSize: 1
wheelEnabled: false
onPressedChanged: {
if (!pressed) {
indicator.configuration.backgroundCornerMargin = value / 100;
}
}
}
PlasmaComponents.Label {
text: i18nc("number in percentage, e.g. 85 %","%1 %", currentValue)
horizontalAlignment: Text.AlignRight
Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
readonly property int currentValue: backgroundCornerMarginSlider.value
}
}
LatteComponents.SubHeader {
text: i18n("Options")
}

@ -17,6 +17,9 @@
<entry name="lengthPadding" type="Double">
<default>0.08</default>
</entry>
<entry name="backgroundCornerMargin" type="Double">
<default>1.00</default>
</entry>
</group>
</kcfg>

@ -23,6 +23,9 @@ LatteComponents.IndicatorItem {
lengthPadding: configurationIsReady && indicator.configuration.clickedAnimationEnabled !== undefined ?
indicator.configuration.lengthPadding : 0.08
backgroundCornerMargin: configurationIsReady && indicator.configuration.backgroundCornerMargin !== undefined ?
indicator.configuration.backgroundCornerMargin : 1.00
//! config options
readonly property bool clickedAnimationEnabled: configurationIsReady
&& indicator.configuration.clickedAnimationEnabled !== undefined

Loading…
Cancel
Save