From b89ef0e50be2e3310839b9d1d21326d0549ae340 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sun, 17 Mar 2019 16:00:52 +0200 Subject: [PATCH] fix warnings fron new indicators architecture --- .../contents/ui/applet/indicator/Manager.qml | 17 +++--- .../contents/ui/indicators/Manager.qml | 3 +- liblatte2/qml/indicators/LatteIndicator.qml | 3 +- .../contents/ui/indicators/Manager.qml | 5 +- .../contents/ui/task/indicator/Manager.qml | 53 +++++++++++-------- 5 files changed, 49 insertions(+), 32 deletions(-) diff --git a/containment/package/contents/ui/applet/indicator/Manager.qml b/containment/package/contents/ui/applet/indicator/Manager.qml index 35dc9f492..d00e4bf65 100644 --- a/containment/package/contents/ui/applet/indicator/Manager.qml +++ b/containment/package/contents/ui/applet/indicator/Manager.qml @@ -25,8 +25,11 @@ Item{ id: indicatorManager anchors.fill: parent - readonly property bool active: (indicators.common.indicatorsEnabled && appletItem.communicatorAlias.activeIndicatorEnabled && indicators.common.indicatorsForApplets) - || (!indicators.common.indicatorsForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive) + readonly property bool active: appletItem && + ((indicators.common.indicatorsEnabled + && appletItem.communicatorAlias.activeIndicatorEnabled + && indicators.common.indicatorsForApplets) + || (!indicators.common.indicatorsForApplets && appletItem.communicatorAlias.overlayLatteIconIsActive)) /* Indicators Properties in order use them*/ readonly property bool isTask: false @@ -36,9 +39,9 @@ Item{ readonly property bool isStartup: false readonly property bool isWindow: false - readonly property bool isActive: appletItem.isActive + readonly property bool isActive: appletItem ? appletItem.isActive : false readonly property bool isGroup: false - readonly property bool isHovered: appletMouseArea.containsMouse + readonly property bool isHovered: appletItem ? appletMouseArea.containsMouse : false readonly property bool isMinimized: false readonly property bool inAttention: false readonly property bool inRemoving: false @@ -52,12 +55,12 @@ Item{ readonly property int currentIconSize: root.iconSize readonly property int maxIconSize: root.maxIconSize readonly property int durationTime: root.durationTime - readonly property real scaleFactor: appletItem.wrapperAlias.zoomScale + readonly property real scaleFactor: appletItem ? appletItem.wrapperAlias.zoomScale : 1 readonly property color shadowColor: root.appShadowColorSolid //!icon colors - property color backgroundColor: appletItem.wrapperAlias.overlayIconLoader.backgroundColor - property color glowColor: appletItem.wrapperAlias.overlayIconLoader.glowColor + property color backgroundColor: appletItem ? appletItem.wrapperAlias.overlayIconLoader.backgroundColor : "black" + property color glowColor: appletItem ? appletItem.wrapperAlias.overlayIconLoader.glowColor : "white" //! grouped options readonly property Item common: indicators.common diff --git a/containment/package/contents/ui/indicators/Manager.qml b/containment/package/contents/ui/indicators/Manager.qml index 0b2bdcee1..835258359 100644 --- a/containment/package/contents/ui/indicators/Manager.qml +++ b/containment/package/contents/ui/indicators/Manager.qml @@ -25,6 +25,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.latte 0.2 as Latte import "options" as Options +import "../applet/indicator" as AppletIndicator Item{ id: managerIndicator @@ -103,7 +104,7 @@ Item{ opacity: 0 readonly property bool isBackLayer: true - readonly property Item manager: managerIndicator + readonly property Item manager: AppletIndicator.Manager{} sourceComponent: managerIndicator.indicatorComponent } diff --git a/liblatte2/qml/indicators/LatteIndicator.qml b/liblatte2/qml/indicators/LatteIndicator.qml index 8dbbcebac..d6d449dd3 100644 --- a/liblatte2/qml/indicators/LatteIndicator.qml +++ b/liblatte2/qml/indicators/LatteIndicator.qml @@ -51,7 +51,8 @@ Item{ property color notActiveColor: options.isMinimized ? minimizedColor : isActiveColor //! Common Options - readonly property bool reversedEnabled: options.common ? options.common.reversedEnabled : false + readonly property bool reversedEnabled: options && options.common && options.common.hasOwnProperty("reversedEnabled") ? + options.common.reversedEnabled : false //! Explicit Options readonly property bool explicitOptionsEnabled: options.explicit diff --git a/plasmoid/package/contents/ui/indicators/Manager.qml b/plasmoid/package/contents/ui/indicators/Manager.qml index 8df60dcab..3367e318a 100644 --- a/plasmoid/package/contents/ui/indicators/Manager.qml +++ b/plasmoid/package/contents/ui/indicators/Manager.qml @@ -25,6 +25,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.latte 0.2 as Latte import "options" as Options +import "../task/indicator" as TaskIndicator Item{ id: managerIndicator @@ -69,7 +70,9 @@ Item{ opacity: 0 readonly property bool isBackLayer: true - readonly property Item manager: managerIndicator + readonly property Item manager: TaskIndicator.Manager{ + taskIsValid: false + } sourceComponent: managerIndicator.indicatorComponent } diff --git a/plasmoid/package/contents/ui/task/indicator/Manager.qml b/plasmoid/package/contents/ui/task/indicator/Manager.qml index 035aaca29..bcf477744 100644 --- a/plasmoid/package/contents/ui/task/indicator/Manager.qml +++ b/plasmoid/package/contents/ui/task/indicator/Manager.qml @@ -23,44 +23,53 @@ import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.latte 0.2 as Latte +import "../../indicators/options" as TaskIndicator + Item { id: indicatorManager - readonly property bool active: indicators.common.indicatorsEnabled - readonly property bool locked: inAttentionAnimation || inNewWindowAnimation + property bool taskIsValid: true + + readonly property bool active: indicators && indicators.common ? indicators.common.indicatorsEnabled : true + readonly property bool locked: taskIsValid ? (inAttentionAnimation || inNewWindowAnimation) : false /* Indicators Properties in order for indicators to use them*/ readonly property bool isTask: true readonly property bool isApplet: false - readonly property bool isLauncher: taskItem.isLauncher - readonly property bool isStartup: taskItem.isStartup - readonly property bool isWindow: taskItem.isWindow + readonly property bool isLauncher: taskIsValid ? taskItem.isLauncher : true + readonly property bool isStartup: taskIsValid ? taskItem.isStartup : false + readonly property bool isWindow: taskIsValid ? taskItem.isWindow : false - readonly property bool isActive: taskItem.hasActive || (root.showPreviews && (taskItem.isWindow || taskItem.isGroupParent) - && windowsPreviewDlg.activeItem && (windowsPreviewDlg.activeItem === taskItem)) - readonly property bool isGroup: taskItem.isGroupParent - readonly property bool isHovered: taskItem.containsMouse - readonly property bool isMinimized: taskItem.isMinimized - readonly property bool inAttention: taskItem.inAttention - readonly property bool inRemoving: taskItem.inRemoveStage + readonly property bool isActive: taskIsValid ? (taskItem.hasActive || (root.showPreviews + && (taskItem.isWindow || taskItem.isGroupParent) + && windowsPreviewDlg.activeItem + && (windowsPreviewDlg.activeItem === taskItem)) ) : false - readonly property bool hasActive: taskItem.hasActive - readonly property bool hasMinimized: taskItem.hasMinimized - readonly property bool hasShown: taskItem.hasShown - readonly property int windowsCount: taskItem.windowsCount - readonly property int windowsMinimizedCount: taskItem.windowsMinimizedCount + readonly property bool isGroup: taskIsValid ? taskItem.isGroupParent : false + readonly property bool isHovered: taskIsValid ? taskItem.containsMouse : false + readonly property bool isMinimized: taskIsValid ? taskItem.isMinimized : false + readonly property bool inAttention: taskIsValid ? taskItem.inAttention : false + readonly property bool inRemoving: taskIsValid ? taskItem.inRemoveStage : false + + readonly property bool hasActive: taskIsValid ? taskItem.hasActive : false + readonly property bool hasMinimized: taskIsValid? taskItem.hasMinimized : false + readonly property bool hasShown: taskIsValid ? taskItem.hasShown : false + readonly property int windowsCount: taskIsValid ? taskItem.windowsCount : 0 + readonly property int windowsMinimizedCount: taskIsValid ? taskItem.windowsMinimizedCount : 0 readonly property int currentIconSize: root.iconSize readonly property int maxIconSize: root.maxIconSize readonly property int durationTime: root.durationTime - readonly property real scaleFactor: taskItem.wrapperAlias.mScale + readonly property real scaleFactor: taskIsValid ? taskItem.wrapperAlias.mScale : 1 readonly property color shadowColor: root.appShadowColorSolid //!icon colors - property color backgroundColor: taskItem.wrapperAlias.backgroundColor - property color glowColor: taskItem.wrapperAlias.glowColor + property color backgroundColor: taskIsValid ? taskItem.wrapperAlias.backgroundColor : "black" + property color glowColor: taskIsValid ? taskItem.wrapperAlias.glowColor : "white" //! grouped options - readonly property Item common: indicators.common - readonly property Item explicit: indicators.explicit + readonly property Item common: indicators ? indicators.common : emptyOptions + readonly property Item explicit: indicators ? indicators.explicit : emptyOptions + + Item{id: emptyOptions} }