From 8ffb19b4cb4bc5417b3458341b977c968aee89ee Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 14 Mar 2017 17:51:35 +0200 Subject: [PATCH] fix #259,user can set distance between applets --- containment/contents/config/main.xml | 5 +++ containment/contents/ui/DebugWindow.qml | 10 +++++- containment/contents/ui/main.qml | 9 +++-- .../configuration/AppearanceConfig.qml | 35 +++++++++++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/containment/contents/config/main.xml b/containment/contents/config/main.xml index 36e8b60ae..3c2ec56fe 100644 --- a/containment/contents/config/main.xml +++ b/containment/contents/config/main.xml @@ -28,9 +28,14 @@ 64 + + + 0 + false + -1 diff --git a/containment/contents/ui/DebugWindow.qml b/containment/contents/ui/DebugWindow.qml index 89fa1cf43..ee857991b 100644 --- a/containment/contents/ui/DebugWindow.qml +++ b/containment/contents/ui/DebugWindow.qml @@ -331,13 +331,21 @@ Window{ } Text{ - text: "Icon Margin"+space + text: "Icon Margin (pixels)"+space } Text{ text: root.iconMargin } + Text{ + text: "Icon Margin (user set)"+space + } + + Text{ + text: plasmoid.configuration.iconMargin+"%" + } + Text{ text: "Thick Margin Base"+space } diff --git a/containment/contents/ui/main.qml b/containment/contents/ui/main.qml index a7741a43a..47dafbca1 100644 --- a/containment/contents/ui/main.qml +++ b/containment/contents/ui/main.qml @@ -118,15 +118,18 @@ DragDrop.DropArea { //decouple iconMargin which now is used only for length calculations with thickMargins //which are used for thickness calculations - property int thickMarginBase: shrinkThickMargins ? 1 : Math.ceil(iconMargin/2) - property int thickMarginHigh: shrinkThickMargins ? 1 : Math.ceil(iconMargin/2) + property int thickMarginBase: shrinkThickMargins ? 1 : Math.ceil(0.06 * iconSize) + property int thickMarginHigh: shrinkThickMargins ? 1 : Math.ceil(0.06 * iconSize) property int thickMargin: thickMarginBase + thickMarginHigh //it is used in order to not break the calculations for the thickness placement //especially in automatic icon sizes calculations property int thickMarginOriginal: Math.ceil(0.12 * maxIconSize) - property int iconMargin: Math.ceil(0.12 * iconSize) + //! iconMargin from configuration is a percentage. The calculation provides a length + //! for that value between 0.12 - 0.5 of iconSize, this way 100% iconMargin means + //! equal to the iconSize + property int iconMargin: Math.ceil( (0.12 + (0.38 * (plasmoid.configuration.iconMargin)/100)) * iconSize) property int statesLineSize: latteApplet ? Math.ceil( root.iconSize/13 ) : 0 diff --git a/shell/contents/configuration/AppearanceConfig.qml b/shell/contents/configuration/AppearanceConfig.qml index 696124fe6..d1e2ad2a3 100644 --- a/shell/contents/configuration/AppearanceConfig.qml +++ b/shell/contents/configuration/AppearanceConfig.qml @@ -145,6 +145,41 @@ PlasmaComponents.Page { enabled: proportionSizeSlider.value >= proportionSizeSlider.realMinimum } } + + RowLayout { + Layout.fillWidth: true + Layout.leftMargin: units.smallSpacing * 2 + Layout.rightMargin: units.smallSpacing * 2 + spacing: units.smallSpacing + + PlasmaComponents.Label { + text: i18n("Applets Distance:") + horizontalAlignment: Text.AlignLeft + enabled: iconMarginSlider.value > 0 + } + + PlasmaComponents.Slider { + id: iconMarginSlider + Layout.fillWidth: true + value: plasmoid.configuration.iconMargin + minimumValue: 0 + maximumValue: 100 + stepSize: 5 + + onPressedChanged: { + if (!pressed) { + plasmoid.configuration.iconMargin = value; + } + } + } + + PlasmaComponents.Label { + text: iconMarginSlider.value.toFixed(1) + "%" + horizontalAlignment: Text.AlignRight + Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 + enabled: iconMarginSlider.value > 0 + } + } } //! END: Applet Size