1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-13 16:58:17 +03:00

latte indicator:thickness margin option

This commit is contained in:
Michail Vourlakos 2021-03-06 19:41:08 +02:00
parent f50d01fa90
commit f9e277a9a5
4 changed files with 48 additions and 5 deletions

View File

@ -32,5 +32,6 @@ Item{
readonly property bool glow3D: true
readonly property real glowOpacity: 0.35
readonly property real lengthPadding: 0.08
readonly property real thickMargin: 0.0
readonly property bool reversed: false
}

View File

@ -123,7 +123,6 @@ ColumnLayout {
}
}
RowLayout {
Layout.fillWidth: true
spacing: units.smallSpacing
@ -162,6 +161,43 @@ ColumnLayout {
}
}
RowLayout {
Layout.fillWidth: true
spacing: units.smallSpacing
PlasmaComponents.Label {
text: i18n("Margin")
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 %","%0 %").arg(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
}
}
LatteComponents.HeaderSwitch {
id: glowEnabled
Layout.fillWidth: true

View File

@ -46,6 +46,9 @@
<entry name="lengthPadding" type="Double">
<default>0.08</default>
</entry>
<entry name="thickMargin" type="Double">
<default>0.0</default>
</entry>
<entry name="reversed" type="Bool">
<default>false</default>
</entry>

View File

@ -37,9 +37,12 @@ LatteComponents.IndicatorItem{
readonly property real factor: indicator.configuration.size
readonly property int size: factor * indicator.currentIconSize
readonly property int thickLocalMargin: indicator.configuration.thickMargin * indicator.currentIconSize
readonly property int screenEdgeMargin: plasmoid.location === PlasmaCore.Types.Floating || reversedEnabled ? 0 : indicator.screenEdgeMargin
readonly property int thicknessMargin: screenEdgeMargin + thickLocalMargin + 1
property real textColorBrightness: colorBrightness(theme.textColor)
property color isActiveColor: theme.buttonFocusColor
@ -264,7 +267,7 @@ LatteComponents.IndicatorItem{
}
PropertyChanges{
target: grid
anchors.leftMargin: root.screenEdgeMargin + 1; anchors.rightMargin: 0; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.leftMargin: root.thicknessMargin; anchors.rightMargin: 0; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
@ -281,7 +284,7 @@ LatteComponents.IndicatorItem{
}
PropertyChanges{
target: grid
anchors.leftMargin: 0; anchors.rightMargin: 0; anchors.topMargin:0; anchors.bottomMargin: root.screenEdgeMargin + 1;
anchors.leftMargin: 0; anchors.rightMargin: 0; anchors.topMargin:0; anchors.bottomMargin: root.thicknessMargin;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
@ -297,7 +300,7 @@ LatteComponents.IndicatorItem{
}
PropertyChanges{
target: grid
anchors.leftMargin: 0; anchors.rightMargin: 0; anchors.topMargin: root.screenEdgeMargin + 1; anchors.bottomMargin:0;
anchors.leftMargin: 0; anchors.rightMargin: 0; anchors.topMargin: root.thicknessMargin; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
@ -313,7 +316,7 @@ LatteComponents.IndicatorItem{
}
PropertyChanges{
target: grid
anchors.leftMargin: 0; anchors.rightMargin: root.screenEdgeMargin + 1; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.leftMargin: 0; anchors.rightMargin: root.thicknessMargin; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
}