mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
containment: more improvements for indicators api
This commit is contained in:
parent
3e2c59b5bb
commit
e9ecec47dc
@ -343,6 +343,8 @@ void Indicator::updateScheme()
|
||||
if (prevConfiguration) {
|
||||
prevConfiguration->deleteLater();
|
||||
}
|
||||
|
||||
emit configurationChanged();
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
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 *plasmaComponent READ plasmaComponent NOTIFY plasmaComponentChanged)
|
||||
@ -129,6 +129,7 @@ signals:
|
||||
void customPluginsChanged();
|
||||
void enabledChanged();
|
||||
void enabledForAppletsChanged();
|
||||
void configurationChanged();
|
||||
void customPluginChanged();
|
||||
void infoChanged();
|
||||
void latteTasksArePresentChanged();
|
||||
|
@ -795,7 +795,7 @@ Item {
|
||||
visualParent: appletItem
|
||||
indicatorsHost: indicators
|
||||
level.isBackground: true
|
||||
level.bridge: appletIndicatorObj
|
||||
level.indicator: appletIndicatorObj
|
||||
|
||||
Loader{
|
||||
anchors.fill: parent
|
||||
@ -844,7 +844,7 @@ Item {
|
||||
visualParent: appletItem
|
||||
indicatorsHost: indicators
|
||||
level.isForeground: true
|
||||
level.bridge: appletIndicatorObj
|
||||
level.indicator: appletIndicatorObj
|
||||
}
|
||||
|
||||
//! Applet Shortcut Visual Badge
|
||||
|
@ -27,8 +27,8 @@ import org.kde.latte.abilities.items 0.1 as AbilityItem
|
||||
Item{
|
||||
id: managerIndicator
|
||||
|
||||
readonly property QtObject configuration: latteView && latteView.indicator ? latteView.indicator.configuration : null
|
||||
readonly property QtObject resources: latteView && latteView.indicator ? latteView.indicator.resources : 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 ? latteView.indicator.resources : null
|
||||
|
||||
readonly property bool isEnabled: latteView && latteView.indicator ? (latteView.indicator.enabled
|
||||
&& latteView.indicator.pluginIsReady
|
||||
@ -128,7 +128,7 @@ Item{
|
||||
indicatorsHost: managerIndicator
|
||||
level.isDrawn: true
|
||||
level.isBackground: true
|
||||
level.bridge: AbilityItem.IndicatorObject{}
|
||||
level.indicator: AbilityItem.IndicatorObject{}
|
||||
}
|
||||
|
||||
//! Bindings in order to inform View::Indicator
|
||||
|
@ -212,15 +212,15 @@ Loader {
|
||||
onTriggered: mainArea.wheelIsBlocked = false;
|
||||
}
|
||||
|
||||
//! Background Indicator
|
||||
AbilityItem.IndicatorLevel{
|
||||
//! Background Indicator
|
||||
AbilityItem.IndicatorLevel {
|
||||
id: indicatorBackLayer
|
||||
anchors.fill: parent
|
||||
indicatorsHost: root.indicators
|
||||
|
||||
level.isDrawn: true
|
||||
level.isBackground: true
|
||||
level.bridge: AbilityItem.IndicatorObject{
|
||||
level.indicator: AbilityItem.IndicatorObject{
|
||||
animations: root.animations
|
||||
metrics: root.metrics
|
||||
indicatorsHost: root.indicators
|
||||
|
@ -25,7 +25,7 @@ import "./indicators" as IndicatorItem
|
||||
|
||||
Loader {
|
||||
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
|
||||
|
||||
property Item visualParent: null
|
||||
|
@ -34,7 +34,7 @@ Item {
|
||||
property int iconOffsetY: 0
|
||||
}
|
||||
|
||||
property Item bridge: null
|
||||
property Item indicator: null
|
||||
|
||||
onIsBackgroundChanged: {
|
||||
isForeground = !isBackground;
|
||||
|
@ -21,7 +21,19 @@ import QtQuick 2.7
|
||||
|
||||
Item {
|
||||
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
|
||||
property bool needsIconColors: false
|
||||
|
@ -32,7 +32,7 @@ Loader {
|
||||
anchors.horizontalCenter: !root.vertical ? parent.horizontalCenter : 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: {
|
||||
if (!indicators) {
|
||||
return;
|
||||
|
@ -565,6 +565,7 @@ PlasmaComponents.Page {
|
||||
|
||||
//! Manager / Handler of loading/showing/hiding indicator config uis
|
||||
LatteExtraControls.IndicatorConfigUiManager {
|
||||
id: indicatorUiManager
|
||||
visible: false
|
||||
stackView: indicatorsStackView
|
||||
}
|
||||
|
@ -23,10 +23,16 @@ import QtQuick.Layouts 1.3
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
Item {
|
||||
id: uiManager
|
||||
visible: false
|
||||
|
||||
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 {
|
||||
id: hiddenIndicatorPage
|
||||
anchors.fill: parent
|
||||
@ -37,11 +43,6 @@ Item {
|
||||
readonly property Item nextPage: stackView.currentItem === 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() {
|
||||
var nextIndicator;
|
||||
|
||||
@ -95,7 +96,7 @@ Item {
|
||||
tabBar.selectTab(latteView.indicator.type);
|
||||
|
||||
if (latteView.indicator.type !== latteBtn.type) {
|
||||
typeDuringCreation = latteView.indicator.type;
|
||||
uiManager.typeDuringCreation = latteView.indicator.type;
|
||||
}
|
||||
|
||||
viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView);
|
||||
@ -105,15 +106,15 @@ Item {
|
||||
target: latteView.indicator
|
||||
onPluginChanged: {
|
||||
if (viewConfig.isReady) {
|
||||
if (hiddenIndicatorPage.typeDuringCreation === "") {
|
||||
if (uiManager.typeDuringCreation === "") {
|
||||
tabBar.selectTab(latteView.indicator.type);
|
||||
viewConfig.indicatorUiManager.ui(latteView.indicator.type, latteView);
|
||||
} else {
|
||||
//! restore the first assigned indicator after first window creation. This way we avoid
|
||||
//! 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);
|
||||
hiddenIndicatorPage.typeDuringCreation = "";
|
||||
uiManager.typeDuringCreation = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user