containment: more improvements for indicators api

work/spdx
Michail Vourlakos 4 years ago
parent 3e2c59b5bb
commit e9ecec47dc

@ -343,6 +343,8 @@ void Indicator::updateScheme()
if (prevConfiguration) { if (prevConfiguration) {
prevConfiguration->deleteLater(); prevConfiguration->deleteLater();
} }
emit configurationChanged();
} }
void Indicator::loadConfig() void Indicator::loadConfig()

@ -69,7 +69,7 @@ class Indicator: public QObject
/** /**
* Configuration object: each config key will be a writable property of this object. property bindings work. * Configuration object: each config key will be a writable property of this object. property bindings work.
*/ */
Q_PROPERTY(QObject *configuration READ configuration NOTIFY pluginChanged) Q_PROPERTY(QObject *configuration READ configuration NOTIFY configurationChanged)
Q_PROPERTY(QQmlComponent *component READ component NOTIFY pluginChanged) Q_PROPERTY(QQmlComponent *component READ component NOTIFY pluginChanged)
Q_PROPERTY(QQmlComponent *plasmaComponent READ plasmaComponent NOTIFY plasmaComponentChanged) Q_PROPERTY(QQmlComponent *plasmaComponent READ plasmaComponent NOTIFY plasmaComponentChanged)
@ -129,6 +129,7 @@ signals:
void customPluginsChanged(); void customPluginsChanged();
void enabledChanged(); void enabledChanged();
void enabledForAppletsChanged(); void enabledForAppletsChanged();
void configurationChanged();
void customPluginChanged(); void customPluginChanged();
void infoChanged(); void infoChanged();
void latteTasksArePresentChanged(); void latteTasksArePresentChanged();

@ -795,7 +795,7 @@ Item {
visualParent: appletItem visualParent: appletItem
indicatorsHost: indicators indicatorsHost: indicators
level.isBackground: true level.isBackground: true
level.bridge: appletIndicatorObj level.indicator: appletIndicatorObj
Loader{ Loader{
anchors.fill: parent anchors.fill: parent
@ -844,7 +844,7 @@ Item {
visualParent: appletItem visualParent: appletItem
indicatorsHost: indicators indicatorsHost: indicators
level.isForeground: true level.isForeground: true
level.bridge: appletIndicatorObj level.indicator: appletIndicatorObj
} }
//! Applet Shortcut Visual Badge //! Applet Shortcut Visual Badge

@ -27,8 +27,8 @@ import org.kde.latte.abilities.items 0.1 as AbilityItem
Item{ Item{
id: managerIndicator id: managerIndicator
readonly property QtObject configuration: latteView && latteView.indicator ? latteView.indicator.configuration : null readonly property QtObject configuration: latteView && latteView.indicator && latteView.indicator.configuration ? latteView.indicator.configuration : null
readonly property QtObject resources: latteView && latteView.indicator ? latteView.indicator.resources : null readonly property QtObject resources: latteView && latteView.indicator && latteView.indicator.resources ? latteView.indicator.resources : null
readonly property bool isEnabled: latteView && latteView.indicator ? (latteView.indicator.enabled readonly property bool isEnabled: latteView && latteView.indicator ? (latteView.indicator.enabled
&& latteView.indicator.pluginIsReady && latteView.indicator.pluginIsReady
@ -128,7 +128,7 @@ Item{
indicatorsHost: managerIndicator indicatorsHost: managerIndicator
level.isDrawn: true level.isDrawn: true
level.isBackground: true level.isBackground: true
level.bridge: AbilityItem.IndicatorObject{} level.indicator: AbilityItem.IndicatorObject{}
} }
//! Bindings in order to inform View::Indicator //! Bindings in order to inform View::Indicator

@ -212,15 +212,15 @@ Loader {
onTriggered: mainArea.wheelIsBlocked = false; onTriggered: mainArea.wheelIsBlocked = false;
} }
//! Background Indicator //! Background Indicator
AbilityItem.IndicatorLevel{ AbilityItem.IndicatorLevel {
id: indicatorBackLayer id: indicatorBackLayer
anchors.fill: parent anchors.fill: parent
indicatorsHost: root.indicators indicatorsHost: root.indicators
level.isDrawn: true level.isDrawn: true
level.isBackground: true level.isBackground: true
level.bridge: AbilityItem.IndicatorObject{ level.indicator: AbilityItem.IndicatorObject{
animations: root.animations animations: root.animations
metrics: root.metrics metrics: root.metrics
indicatorsHost: root.indicators indicatorsHost: root.indicators

@ -25,7 +25,7 @@ import "./indicators" as IndicatorItem
Loader { Loader {
id: indicatorLevelLoader id: indicatorLevelLoader
active: level.isDrawn && indicatorsHost.isReady && (level.isBackground || (level.isForeground && indicatorsHost.info.providesFrontLayer)) active: level.isDrawn && indicatorsHost.isEnabled && (level.isBackground || (level.isForeground && indicatorsHost.info.providesFrontLayer))
sourceComponent: indicatorsHost.indicatorComponent sourceComponent: indicatorsHost.indicatorComponent
property Item visualParent: null property Item visualParent: null

@ -34,7 +34,7 @@ Item {
property int iconOffsetY: 0 property int iconOffsetY: 0
} }
property Item bridge: null property Item indicator: null
onIsBackgroundChanged: { onIsBackgroundChanged: {
isForeground = !isBackground; isForeground = !isBackground;

@ -21,7 +21,19 @@ import QtQuick 2.7
Item { Item {
readonly property Item level: parent && parent.hasOwnProperty("level") ? parent.level : null readonly property Item level: parent && parent.hasOwnProperty("level") ? parent.level : null
readonly property Item indicator: parent && parent.hasOwnProperty("level") ? parent.level.bridge : null readonly property Item indicator: {
if (!level) {
return null;
}
if (level.hasOwnProperty("bridge")) {
return level.bridge;
} else if (level.hasOwnProperty("indicator")) {
return level.indicator.publicApi;
}
return null;
}
//! indicator is using main colors from icon e.g. unity style //! indicator is using main colors from icon e.g. unity style
property bool needsIconColors: false property bool needsIconColors: false

@ -32,7 +32,7 @@ Loader {
anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : undefined
anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined anchors.verticalCenter: root.vertical ? parent.verticalCenter : undefined
active: level.bridge && level.bridge.active && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer)) active: level.bridge && level.bridge.active && indicators.isEnabled && (level.isBackground || (level.isForeground && indicators.info.providesFrontLayer))
sourceComponent: { sourceComponent: {
if (!indicators) { if (!indicators) {
return; return;

@ -565,6 +565,7 @@ PlasmaComponents.Page {
//! Manager / Handler of loading/showing/hiding indicator config uis //! Manager / Handler of loading/showing/hiding indicator config uis
LatteExtraControls.IndicatorConfigUiManager { LatteExtraControls.IndicatorConfigUiManager {
id: indicatorUiManager
visible: false visible: false
stackView: indicatorsStackView stackView: indicatorsStackView
} }

@ -23,10 +23,16 @@ import QtQuick.Layouts 1.3
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
Item { Item {
id: uiManager
visible: false visible: false
property Item stackView: null property Item stackView: null
//! it is used during first window creation in order to avoid clearing custom indicators from its views
//! when the window is created the current view indicator type is stored and restored after
//! the tabBar of indicators has completed its creation/initialization
property string typeDuringCreation: ""
Item { Item {
id: hiddenIndicatorPage id: hiddenIndicatorPage
anchors.fill: parent anchors.fill: parent
@ -37,11 +43,6 @@ Item {
readonly property Item nextPage: stackView.currentItem === page1 ? page2 : page1 readonly property Item nextPage: stackView.currentItem === page1 ? page2 : page1
readonly property Item previousPage: nextPage === page1 ? page2 : page1 readonly property Item previousPage: nextPage === page1 ? page2 : page1
//! it is used during first window creation in order to avoid clearing custom indicators from its views
//! when the window is created the current view indicator type is stored and restored after
//! the tabBar of indicators has completed its creation/initialization
property string typeDuringCreation: ""
function showNextIndicator() { function showNextIndicator() {
var nextIndicator; var nextIndicator;
@ -95,7 +96,7 @@ Item {
tabBar.selectTab(latteView.indicator.type); tabBar.selectTab(latteView.indicator.type);
if (latteView.indicator.type !== latteBtn.type) { if (latteView.indicator.type !== latteBtn.type) {
typeDuringCreation = latteView.indicator.type; uiManager.typeDuringCreation = latteView.indicator.type;
} }
viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView); viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView);
@ -105,15 +106,15 @@ Item {
target: latteView.indicator target: latteView.indicator
onPluginChanged: { onPluginChanged: {
if (viewConfig.isReady) { if (viewConfig.isReady) {
if (hiddenIndicatorPage.typeDuringCreation === "") { if (uiManager.typeDuringCreation === "") {
tabBar.selectTab(latteView.indicator.type); tabBar.selectTab(latteView.indicator.type);
viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView); viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView);
} else { } else {
//! restore the first assigned indicator after first window creation. This way we avoid //! restore the first assigned indicator after first window creation. This way we avoid
//! unsetting custom indicators from views during first settings window creation. //! unsetting custom indicators from views during first settings window creation.
latteView.indicator.type = hiddenIndicatorPage.typeDuringCreation; latteView.indicator.type = uiManager.typeDuringCreation;
tabBar.selectTab(latteView.indicator.type); tabBar.selectTab(latteView.indicator.type);
hiddenIndicatorPage.typeDuringCreation = ""; uiManager.typeDuringCreation = "";
} }
} }
} }

Loading…
Cancel
Save