remove common global indicators options

--enabledForApplets and lengthPadding for indicators
has now moved to indicators responsibility to handle
--as a consequence usesPlasmaStyle has been removed
from indicators API. The corner cases that indicators
conflict with plasma theme applets should be handled
differently and in a different way
pull/11/head
Michail Vourlakos 5 years ago
parent 9aa1aacb7a
commit 4809703e9f

@ -48,8 +48,6 @@ Indicator::Indicator(Latte::View *parent)
loadConfig();
connect(this, &Indicator::enabledChanged, this, &Indicator::saveConfig);
connect(this, &Indicator::enabledForAppletsChanged, this, &Indicator::saveConfig);
connect(this, &Indicator::paddingChanged, this, &Indicator::saveConfig);
connect(this, &Indicator::pluginChanged, this, &Indicator::saveConfig);
connect(m_view, &Latte::View::latteTasksArePresentChanged, this, &Indicator::latteTasksArePresentChanged);
@ -144,21 +142,6 @@ void Indicator::setProvidesConfigUi(bool provides)
emit providesConfigUiChanged();
}
float Indicator::padding() const
{
return m_padding;
}
void Indicator::setPadding(float padding)
{
if (m_padding == padding) {
return;
}
m_padding = padding;
emit paddingChanged();
}
bool Indicator::pluginIsReady()
{
return m_pluginIsReady;
@ -439,8 +422,6 @@ void Indicator::loadConfig()
auto config = m_view->containment()->config().group("Indicator");
m_customType = config.readEntry("customType", QString());
m_enabled = config.readEntry("enabled", true);
m_enabledForApplets = config.readEntry("enabledForApplets", true);
m_padding = config.readEntry("padding", (float)0.08);
m_type = config.readEntry("type", "org.kde.latte.default");
}
@ -449,8 +430,6 @@ void Indicator::saveConfig()
auto config = m_view->containment()->config().group("Indicator");
config.writeEntry("customType", m_customType);
config.writeEntry("enabled", m_enabled);
config.writeEntry("enabledForApplets", m_enabledForApplets);
config.writeEntry("padding", m_padding);
config.writeEntry("type", m_type);
config.sync();

@ -58,8 +58,6 @@ class Indicator: public QObject
Q_PROPERTY(bool pluginIsReady READ pluginIsReady NOTIFY pluginIsReadyChanged)
Q_PROPERTY(bool providesConfigUi READ providesConfigUi NOTIFY providesConfigUiChanged)
Q_PROPERTY(float padding READ padding WRITE setPadding NOTIFY paddingChanged)
Q_PROPERTY(QString type READ type WRITE setType NOTIFY pluginChanged)
Q_PROPERTY(QString customType READ customType NOTIFY customPluginChanged)
@ -103,9 +101,6 @@ public:
bool pluginIsReady();
float padding() const;
void setPadding(float padding);
QString type() const;
void setType(QString type);
@ -141,7 +136,6 @@ signals:
void customPluginChanged();
void infoChanged();
void latteTasksArePresentChanged();
void paddingChanged();
void plasmaComponentChanged();
void pluginChanged();
void pluginIsReadyChanged();
@ -167,8 +161,6 @@ private:
bool m_pluginIsReady{false};
bool m_providesConfigUi{true};
float m_padding{0.08};
QString m_pluginPath;
QString m_type{"org.kde.latte.default"};
QString m_customType;

@ -30,8 +30,8 @@ Item{
readonly property bool active: appletIsValid &&
((indicators.isEnabled
&& appletItem.communicatorAlias.activeIndicatorEnabled
&& indicators.enabledForApplets)
|| (!indicators.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive))
&& indicators.info.enabledForApplets)
|| (!indicators.info.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive))
/* Indicators Properties in order use them*/
readonly property bool isTask: false
@ -72,8 +72,6 @@ Item{
readonly property int screenEdgeMargin: root.localScreenEdgeMargin /*since 0.10*/
readonly property bool usePlasmaTabsStyle: !indicators.enabledForApplets
readonly property QtObject palette: colorizerManager.applyTheme
//!icon colors

@ -35,7 +35,7 @@ Loader {
active: level.bridge && level.bridge.active && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer))
sourceComponent: {
if (!indicators.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive) {
if (!indicators.info.enabledForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive) {
return indicators.plasmaStyleComponent;
}

@ -33,8 +33,7 @@ Item{
readonly property QtObject resources: latteView && latteView.indicator ? latteView.indicator.resources : null
readonly property bool isEnabled: latteView && latteView.indicator ? (latteView.indicator.enabled && latteView.indicator.pluginIsReady) : false
readonly property bool enabledForApplets: latteView && latteView.indicator ? latteView.indicator.enabledForApplets : true
readonly property real padding: Math.max(info.minLengthPadding, latteView && latteView.indicator ? latteView.indicator.padding : 0.08)
readonly property real padding: Math.max(info.minLengthPadding, info.lengthPadding)
readonly property string type: latteView && latteView.indicator ? latteView.indicator.type : "org.kde.latte.default"
readonly property bool infoLoaded: metricsLoader.active && metricsLoader.item
@ -43,6 +42,9 @@ Item{
readonly property Component indicatorComponent: latteView && latteView.indicator ? latteView.indicator.component : null
readonly property Item info: Item{
readonly property bool enabledForApplets: infoLoaded && metricsLoader.item.hasOwnProperty("enabledForApplets")
&& metricsLoader.item.enabledForApplets
readonly property bool needsIconColors: infoLoaded && metricsLoader.item.hasOwnProperty("needsIconColors")
&& metricsLoader.item.needsIconColors
@ -82,6 +84,14 @@ Item{
return 0;
}
readonly property real lengthPadding: {
if (infoLoaded && metricsLoader.item.hasOwnProperty("lengthPadding")) {
return metricsLoader.item.lengthPadding;
}
return 0.08;
}
readonly property real appletLengthPadding: {
if (infoLoaded && metricsLoader.item.hasOwnProperty("appletLengthPadding")) {
return metricsLoader.item.appletLengthPadding;
@ -113,7 +123,15 @@ Item{
sourceComponent: managerIndicator.indicatorComponent
}
//! Bindings in order to inform View::Indicator::Info
//! Bindings in order to inform View::Indicator
Binding{
target: latteView && latteView.indicator ? latteView.indicator : null
property:"enabledForApplets"
when: latteView && latteView.indicator
value: managerIndicator.info.enabledForApplets
}
//! Bindings in order to inform View::Indicator::Info
Binding{
target: latteView && latteView.indicator ? latteView.indicator.info : null
property:"needsIconColors"

@ -66,8 +66,6 @@ Item{
readonly property int screenEdgeMargin: 0 /*since 0.10*/
readonly property bool usePlasmaTabsStyle: !indicators.enabledForApplets
readonly property QtObject palette: colorizerManager.applyTheme
//!icon colors

@ -36,6 +36,10 @@ Item {
//! any clicked animation in that case
property bool providesClickedAnimation: false
//! this indicator will draw its own indicators for applets
//! [since v0.10.0]
property bool enabledForApplets: true
//! this indicator visuals go out of the regular mask thickness and this variable sets
//! the pixels needed outside of the mask thickness e.g. a glow
property int extraMaskThickness: 0
@ -50,11 +54,19 @@ Item {
property real minLengthPadding: 0
//! this indicator specifies a different padding value for applets. This value is a percentage,
//! -1, means disabled and the regular padding is used
//! -1, means disabled and the regular length padding is used
//! 0.06 -> 6%
//! [since v0.9.2]
property real appletLengthPadding: -1
//! this indicator specifies how much is going to be the items regular length padding
//! as long as other more specialized paddings such as appletLengthPadding are not
//! applied. This value is a percentage,
//! e.g 0.06 -> 6%
//! [since v0.10.0]
property real lengthPadding: 0.08
//! svg image paths either from plasma theme or local files relevant to indicator "ui" directory
//! in order to reduce resources usage
property var svgImagePaths: []

@ -190,6 +190,48 @@ ColumnLayout {
}
}
LatteComponents.SubHeader {
text: i18n("Padding")
}
RowLayout {
Layout.fillWidth: true
spacing: units.smallSpacing
PlasmaComponents.Label {
text: i18n("Length")
horizontalAlignment: Text.AlignLeft
}
LatteComponents.Slider {
id: lengthIntMarginSlider
Layout.fillWidth: true
value: Math.round(indicator.configuration.lengthPadding * 100)
from: 0
to: maxMargin
stepSize: 1
wheelEnabled: false
readonly property int maxMargin: 80
onPressedChanged: {
if (!pressed) {
indicator.configuration.lengthPadding = 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: lengthIntMarginSlider.value
}
}
ColumnLayout {
spacing: 0
visible: indicator.latteTasksArePresent
@ -229,6 +271,17 @@ ColumnLayout {
text: i18n("Options")
}
LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Show indicators for applets")
checked: indicator.configuration.enabledForApplets
tooltip: i18n("Indicators are shown for applets")
onClicked: {
indicator.configuration.enabledForApplets = !indicator.configuration.enabledForApplets;
}
}
LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Reverse indicator style")

@ -22,6 +22,9 @@
<entry name="glowEnabled" type="Bool">
<default>false</default>
</entry>
<entry name="enabledForApplets" type="Bool">
<default>true</default>
</entry>
<entry name="glowApplyTo" type="Enum">
<label>Glow for active indicators</label>
<choices>
@ -37,6 +40,9 @@
<entry name="glowOpacity" type="Double">
<default>0.35</default>
</entry>
<entry name="lengthPadding" type="Double">
<default>0.08</default>
</entry>
<entry name="reversed" type="Bool">
<default>false</default>
</entry>

@ -32,6 +32,9 @@ LatteComponents.IndicatorItem{
id: root
extraMaskThickness: reversedEnabled && glowEnabled ? 1.7 * (factor * indicator.maxIconSize) : 0
enabledForApplets: indicator && indicator.configuration ? indicator.configuration.enabledForApplets : true
lengthPadding: indicator && indicator.configuration ? indicator.configuration.lengthPadding : 0.08
readonly property real factor: 0.08
readonly property int size: factor * indicator.currentIconSize

@ -23,6 +23,7 @@ import QtQuick.Layouts 1.3
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.latte 0.2 as Latte
import org.kde.latte.components 1.0 as LatteComponents
@ -31,6 +32,52 @@ ColumnLayout {
id: root
Layout.fillWidth: true
LatteComponents.SubHeader {
text: i18n("Padding")
}
RowLayout {
Layout.fillWidth: true
spacing: units.smallSpacing
PlasmaComponents.Label {
text: i18n("Length")
horizontalAlignment: Text.AlignLeft
}
LatteComponents.Slider {
id: lengthIntMarginSlider
Layout.fillWidth: true
value: Math.round(indicator.configuration.lengthPadding * 100)
from: 0
to: maxMargin
stepSize: 1
wheelEnabled: false
readonly property int maxMargin: 80
onPressedChanged: {
if (!pressed) {
indicator.configuration.lengthPadding = 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: lengthIntMarginSlider.value
}
}
LatteComponents.SubHeader {
text: i18n("Options")
}
LatteComponents.CheckBoxesColumn {
Layout.topMargin: 1.5 * units.smallSpacing
@ -53,5 +100,16 @@ ColumnLayout {
indicator.configuration.clickedAnimationEnabled = !indicator.configuration.clickedAnimationEnabled;
}
}
LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Show indicators for applets")
checked: indicator.configuration.enabledForApplets
tooltip: i18n("Indicators are shown for applets")
onClicked: {
indicator.configuration.enabledForApplets = !indicator.configuration.enabledForApplets;
}
}
}
}

@ -10,7 +10,13 @@
</entry>
<entry name="clickedAnimationEnabled" type="Bool">
<default>false</default>
</entry>
</entry>
<entry name="enabledForApplets" type="Bool">
<default>true</default>
</entry>
<entry name="lengthPadding" type="Double">
<default>0.08</default>
</entry>
</group>
</kcfg>

@ -27,13 +27,13 @@ PlasmaCore.FrameSvgItem {
id: frame
property string basePrefix: "normal"
imagePath: indicator.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks"
imagePath: root.usePlasmaTabsStyle ? "widgets/tabbar" : "widgets/tasks"
rotation: root.reversedEnabled ? 180 : 0
opacity: 1 //state === "hovered" ? 0.9 : 1
prefix: {
if (indicator.usePlasmaTabsStyle) {
if (root.usePlasmaTabsStyle) {
if (!indicator.isActive) {
return "";
}

@ -33,16 +33,24 @@ LatteComponents.IndicatorItem {
providesFrontLayer: true
svgImagePaths: ["widgets/tasks"]
enabledForApplets: configurationIsReady && indicator.configuration.clickedAnimationEnabled !== undefined ?
indicator.configuration.enabledForApplets : true
lengthPadding: configurationIsReady && indicator.configuration.clickedAnimationEnabled !== undefined ?
indicator.configuration.lengthPadding : 0.08
//! config options
readonly property bool clickedAnimationEnabled: indicator && indicator.configuration
readonly property bool clickedAnimationEnabled: configurationIsReady
&& indicator.configuration.clickedAnimationEnabled !== undefined
&& indicator.configuration.clickedAnimationEnabled
readonly property bool reversedEnabled: indicator && indicator.configuration
readonly property bool reversedEnabled: configurationIsReady
&& indicator.configuration.reversed !== undefined
&& indicator.configuration.reversed
readonly property bool usePlasmaTabsStyle: false
readonly property bool configurationIsReady: indicator && indicator.configuration
//! Background Layer
Loader{
id: backLayer

@ -47,6 +47,7 @@ Item{
readonly property bool providesHoveredAnimation: false
readonly property bool providesClickedAnimation: false
readonly property int extraMaskThickness: 0
readonly property real lengthPadding: 0.08
readonly property real minThicknessPadding: 0
readonly property real minLengthPadding:0
}

@ -75,8 +75,6 @@ Item {
readonly property int screenEdgeMargin: root.screenEdgeMargin /*since 0.10*/
readonly property bool usePlasmaTabsStyle: false
readonly property variant svgs: indicators ? indicators.svgs : []
readonly property QtObject palette: enforceLattePalette ? latteBridge.palette.applyTheme : theme

@ -470,103 +470,29 @@ PlasmaComponents.Page {
}
}
LatteComponents.SubHeader {
Layout.topMargin: units.smallSpacing
isFirstSubCategory: true
text: i18n("Paddings")
}
RowLayout {
//! BEGIN: Indicator specific sub-options
ColumnLayout {
id: indicatorSpecificOptions
Layout.fillWidth: true
spacing: units.smallSpacing
PlasmaComponents.Label {
text: i18n("Length")
horizontalAlignment: Text.AlignLeft
}
LatteComponents.Slider {
id: lengthIntMarginSlider
Layout.fillWidth: true
value: Math.round(latteView.indicator.padding * 100)
from: 0
to: maxMargin
stepSize: 1
wheelEnabled: false
minimumInternalValue: latteView.indicator.info.minLengthPadding * 100
Layout.topMargin: units.smallSpacing * 2
spacing: 0
visible: latteView.indicator.providesConfigUi
enabled: latteView.indicator.enabled
readonly property int maxMargin: 80
readonly property int optionsWidth: dialog.optionsWidth
onPressedChanged: {
if (!pressed) {
latteView.indicator.padding = value / 100;
}
}
Component.onCompleted: {
latteView.indicator.configUiFor(latteView.indicator.type, indicatorSpecificOptions);
}
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: Math.max(lengthIntMarginSlider.minimumInternalValue, lengthIntMarginSlider.value)
Connections {
target: latteView.indicator
onPluginChanged: latteView.indicator.configUiFor(latteView.indicator.type, indicatorSpecificOptions);
}
}
LatteComponents.SubHeader {
Layout.topMargin: units.smallSpacing
isFirstSubCategory: true
text: i18n("Options")
}
LatteComponents.CheckBoxesColumn {
LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Show indicators for applets")
checked: latteView.indicator.enabledForApplets
tooltip: i18n("Indicators are shown for applets")
onClicked: {
latteView.indicator.enabledForApplets = !latteView.indicator.enabledForApplets;
}
}
}
}
}
//! END: Active Indicator General Settings
//! BEGIN: Indicator specific sub-options
ColumnLayout {
Layout.fillWidth: true
Layout.topMargin: units.smallSpacing
spacing: units.smallSpacing
visible: latteView.indicator.providesConfigUi
enabled: latteView.indicator.enabled
LatteComponents.Header {
text: i18n("%0 Indicator Options").arg(indicatorStyleGroup.current === customIndicator.button ? customIndicator.buttonText : indicatorStyleGroup.current.text)
}
ColumnLayout {
id: indicatorSpecificOptions
Layout.fillWidth: true
Layout.leftMargin: units.smallSpacing * 2
Layout.rightMargin: units.smallSpacing * 2
spacing: 0
readonly property int optionsWidth: dialog.optionsWidth
Component.onCompleted: {
latteView.indicator.configUiFor(latteView.indicator.type, indicatorSpecificOptions);
}
Connections {
target: latteView.indicator
onPluginChanged: latteView.indicator.configUiFor(latteView.indicator.type, indicatorSpecificOptions);
}
//! END: Indicator specific sub-options
}
}
//! END: Indicator specific sub-options
//! END: Active Indicator General Settings
}
}

Loading…
Cancel
Save