From 47625938a50607dc30b384c95fec81ad1619c67b Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sun, 17 Mar 2019 09:43:01 +0200 Subject: [PATCH] move Latte Indicator Options in each one file --- .../configuration/pages/EffectsConfig.qml | 184 +-------------- .../pages/indicator/LatteOptions.qml | 217 ++++++++++++++++++ 2 files changed, 220 insertions(+), 181 deletions(-) create mode 100644 shell/package/contents/configuration/pages/indicator/LatteOptions.qml diff --git a/shell/package/contents/configuration/pages/EffectsConfig.qml b/shell/package/contents/configuration/pages/EffectsConfig.qml index 8e96c02e0..4d32d5c47 100644 --- a/shell/package/contents/configuration/pages/EffectsConfig.qml +++ b/shell/package/contents/configuration/pages/EffectsConfig.qml @@ -605,189 +605,11 @@ PlasmaComponents.Page { text: i18n("%0 Indicator Options").arg(indicatorStyleGroup.current.text) } - ColumnLayout { + Loader{ Layout.fillWidth: true Layout.leftMargin: units.smallSpacing * 2 - - LatteExtraControls.SubHeader { - text: i18nc("active indicator style","Style For Active") - } - - RowLayout { - Layout.fillWidth: true - spacing: 2 - - property int indicatorType: plasmoid.configuration.activeIndicatorType - - ExclusiveGroup { - id: activeIndicatorTypeGroup - onCurrentChanged: { - if (current.checked) { - plasmoid.configuration.activeIndicatorType = current.indicatorType; - } - } - } - - PlasmaComponents.Button { - Layout.fillWidth: true - - text: i18nc("line indicator","Line") - checked: parent.indicatorType === indicatorType - checkable: true - exclusiveGroup: activeIndicatorTypeGroup - tooltip: i18n("Show a line indicator for active items") - - readonly property int indicatorType: Latte.Types.LineIndicator - } - - PlasmaComponents.Button { - Layout.fillWidth: true - - text: i18nc("dot indicator", "Dot") - checked: parent.indicatorType === indicatorType - checkable: true - exclusiveGroup: activeIndicatorTypeGroup - tooltip: i18n("Show a dot indicator for active items") - - readonly property int indicatorType: Latte.Types.DotIndicator - } - } - - LatteExtraControls.HeaderSwitch { - id: showGlow - Layout.fillWidth: true - Layout.minimumHeight: implicitHeight - Layout.bottomMargin: units.smallSpacing - - checked: plasmoid.configuration.showGlow - level: 2 - text: i18n("Glow") - tooltip: i18n("Enable/disable indicator glow") - - onPressed: { - plasmoid.configuration.showGlow = !plasmoid.configuration.showGlow; - } - } - - RowLayout { - Layout.fillWidth: true - spacing: 2 - enabled: plasmoid.configuration.showGlow - - property int option: plasmoid.configuration.glowOption - - ExclusiveGroup { - id: glowGroup - onCurrentChanged: { - if (current.checked) - plasmoid.configuration.glowOption = current.option - } - } - - PlasmaComponents.Button { - Layout.fillWidth: true - text: i18nc("glow only to active task/applet indicators","On Active") - checked: parent.option === option - checkable: true - exclusiveGroup: glowGroup - tooltip: i18n("Add glow only to active task/applet indicator") - - readonly property int option: Latte.Types.GlowOnlyOnActive - } - - PlasmaComponents.Button { - Layout.fillWidth: true - text: i18nc("glow to all task/applet indicators","All") - checked: parent.option === option - checkable: true - exclusiveGroup: glowGroup - tooltip: i18n("Add glow to all task/applet indicators") - - readonly property int option: Latte.Types.GlowAll - } - } - - RowLayout { - Layout.fillWidth: true - spacing: 2 - - enabled: plasmoid.configuration.showGlow - - PlasmaComponents.Label { - Layout.minimumWidth: implicitWidth - horizontalAlignment: Text.AlignLeft - Layout.rightMargin: units.smallSpacing - text: i18n("Opacity") - } - - LatteExtraControls.Slider { - id: glowOpacitySlider - Layout.fillWidth: true - - leftPadding: 0 - value: plasmoid.configuration.glowOpacity - from: 0 - to: 100 - stepSize: 5 - wheelEnabled: false - - function updateGlowOpacity() { - if (!pressed) - plasmoid.configuration.glowOpacity = value; - } - - onPressedChanged: { - updateGlowOpacity(); - } - - Component.onCompleted: { - valueChanged.connect(updateGlowOpacity); - } - - Component.onDestruction: { - valueChanged.disconnect(updateGlowOpacity); - } - } - - PlasmaComponents.Label { - text: glowOpacitySlider.value + " %" - horizontalAlignment: Text.AlignRight - Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 - Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4 - } - } - - ColumnLayout { - spacing: 0 - visible: latteView.latteTasksPresent() - - LatteExtraControls.SubHeader { - enabled: plasmoid.configuration.glowOption!==Latte.Types.GlowNone - text: i18n("Tasks") - } - - PlasmaComponents.CheckBox { - id: threeColorsWindows - text: i18n("Different color for minimized windows") - checked: plasmoid.configuration.threeColorsWindows - - onClicked: { - plasmoid.configuration.threeColorsWindows = checked - } - } - - PlasmaComponents.CheckBox { - id: dotsOnActive - text: i18n("Show an extra dot for grouped windows when active") - checked: plasmoid.configuration.dotsOnActive - tooltip: i18n("Grouped windows show both a line and a dot when one of them is active and the Line Active Indicator is enabled") - enabled: plasmoid.configuration.activeIndicatorType === Latte.Types.LineIndicator - - onClicked: { - plasmoid.configuration.dotsOnActive = checked - } - } - } + active: plasmoid.configuration.indicatorStyle === Latte.Types.LatteIndicator + source: "indicator/LatteOptions.qml" } } //! END: Indicator specific sub-options diff --git a/shell/package/contents/configuration/pages/indicator/LatteOptions.qml b/shell/package/contents/configuration/pages/indicator/LatteOptions.qml new file mode 100644 index 000000000..8c86d5427 --- /dev/null +++ b/shell/package/contents/configuration/pages/indicator/LatteOptions.qml @@ -0,0 +1,217 @@ +/* +* Copyright 2018 Michail Vourlakos +* +* This file is part of Latte-Dock +* +* Latte-Dock is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* Latte-Dock is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Layouts 1.3 +import QtGraphicalEffects 1.0 + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.components 3.0 as PlasmaComponents3 +import org.kde.plasma.plasmoid 2.0 + +import QtQuick.Controls.Styles.Plasma 2.0 as Styles + +import org.kde.latte 0.2 as Latte + +import "../../../controls" as LatteExtraControls + + +ColumnLayout { + LatteExtraControls.SubHeader { + text: i18nc("active indicator style","Style For Active") + } + + RowLayout { + Layout.fillWidth: true + spacing: 2 + + property int indicatorType: plasmoid.configuration.activeIndicatorType + + ExclusiveGroup { + id: activeIndicatorTypeGroup + onCurrentChanged: { + if (current.checked) { + plasmoid.configuration.activeIndicatorType = current.indicatorType; + } + } + } + + PlasmaComponents.Button { + Layout.fillWidth: true + + text: i18nc("line indicator","Line") + checked: parent.indicatorType === indicatorType + checkable: true + exclusiveGroup: activeIndicatorTypeGroup + tooltip: i18n("Show a line indicator for active items") + + readonly property int indicatorType: Latte.Types.LineIndicator + } + + PlasmaComponents.Button { + Layout.fillWidth: true + + text: i18nc("dot indicator", "Dot") + checked: parent.indicatorType === indicatorType + checkable: true + exclusiveGroup: activeIndicatorTypeGroup + tooltip: i18n("Show a dot indicator for active items") + + readonly property int indicatorType: Latte.Types.DotIndicator + } + } + + LatteExtraControls.HeaderSwitch { + id: showGlow + Layout.fillWidth: true + Layout.minimumHeight: implicitHeight + Layout.bottomMargin: units.smallSpacing + + checked: plasmoid.configuration.showGlow + level: 2 + text: i18n("Glow") + tooltip: i18n("Enable/disable indicator glow") + + onPressed: { + plasmoid.configuration.showGlow = !plasmoid.configuration.showGlow; + } + } + + RowLayout { + Layout.fillWidth: true + spacing: 2 + enabled: plasmoid.configuration.showGlow + + property int option: plasmoid.configuration.glowOption + + ExclusiveGroup { + id: glowGroup + onCurrentChanged: { + if (current.checked) + plasmoid.configuration.glowOption = current.option + } + } + + PlasmaComponents.Button { + Layout.fillWidth: true + text: i18nc("glow only to active task/applet indicators","On Active") + checked: parent.option === option + checkable: true + exclusiveGroup: glowGroup + tooltip: i18n("Add glow only to active task/applet indicator") + + readonly property int option: Latte.Types.GlowOnlyOnActive + } + + PlasmaComponents.Button { + Layout.fillWidth: true + text: i18nc("glow to all task/applet indicators","All") + checked: parent.option === option + checkable: true + exclusiveGroup: glowGroup + tooltip: i18n("Add glow to all task/applet indicators") + + readonly property int option: Latte.Types.GlowAll + } + } + + RowLayout { + Layout.fillWidth: true + spacing: 2 + + enabled: plasmoid.configuration.showGlow + + PlasmaComponents.Label { + Layout.minimumWidth: implicitWidth + horizontalAlignment: Text.AlignLeft + Layout.rightMargin: units.smallSpacing + text: i18n("Opacity") + } + + LatteExtraControls.Slider { + id: glowOpacitySlider + Layout.fillWidth: true + + leftPadding: 0 + value: plasmoid.configuration.glowOpacity + from: 0 + to: 100 + stepSize: 5 + wheelEnabled: false + + function updateGlowOpacity() { + if (!pressed) + plasmoid.configuration.glowOpacity = value; + } + + onPressedChanged: { + updateGlowOpacity(); + } + + Component.onCompleted: { + valueChanged.connect(updateGlowOpacity); + } + + Component.onDestruction: { + valueChanged.disconnect(updateGlowOpacity); + } + } + + PlasmaComponents.Label { + text: glowOpacitySlider.value + " %" + horizontalAlignment: Text.AlignRight + Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4 + Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4 + } + } + + ColumnLayout { + spacing: 0 + visible: latteView.latteTasksPresent() + + LatteExtraControls.SubHeader { + enabled: plasmoid.configuration.glowOption!==Latte.Types.GlowNone + text: i18n("Tasks") + } + + PlasmaComponents.CheckBox { + id: threeColorsWindows + text: i18n("Different color for minimized windows") + checked: plasmoid.configuration.threeColorsWindows + + onClicked: { + plasmoid.configuration.threeColorsWindows = checked + } + } + + PlasmaComponents.CheckBox { + id: dotsOnActive + text: i18n("Show an extra dot for grouped windows when active") + checked: plasmoid.configuration.dotsOnActive + tooltip: i18n("Grouped windows show both a line and a dot when one of them is active and the Line Active Indicator is enabled") + enabled: plasmoid.configuration.activeIndicatorType === Latte.Types.LineIndicator + + onClicked: { + plasmoid.configuration.dotsOnActive = checked + } + } + } +}