From 84e390c312ae841b203d8575891591fcd744a0b7 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 19 May 2017 16:59:48 +0300 Subject: [PATCH] reduce warnings --- .../package/contents/ui/DebugWindow.qml | 55 +++++++-- .../package/contents/ui/LayoutsContainer.qml | 114 ++++++++++-------- containment/package/contents/ui/main.qml | 13 +- .../package/contents/ui/ToolTipInstance.qml | 2 +- plasmoid/package/contents/ui/main.qml | 2 +- 5 files changed, 121 insertions(+), 65 deletions(-) diff --git a/containment/package/contents/ui/DebugWindow.qml b/containment/package/contents/ui/DebugWindow.qml index 047e4a796..caa0c73d5 100644 --- a/containment/package/contents/ui/DebugWindow.qml +++ b/containment/package/contents/ui/DebugWindow.qml @@ -51,7 +51,7 @@ Window{ } Text{ - text: dock.currentScreen + text: dock && dock.currentScreen ? dock.currentScreen : "___" } Text{ @@ -59,7 +59,13 @@ Window{ } Text{ - text: dock.screenGeometry.x+","+dock.screenGeometry.y+ " "+dock.screenGeometry.width+"x"+dock.screenGeometry.height + text: { + if (dock && dock.screenGeometry){ + return dock.screenGeometry.x+","+dock.screenGeometry.y+ " "+dock.screenGeometry.width+"x"+dock.screenGeometry.height; + } else { + return "_,_ _x_"; + } + } } Text{ @@ -67,7 +73,13 @@ Window{ } Text{ - text: dock.x + "," + dock.y + " "+dock.width+ "x"+dock.height + text: { + if (dock) { + return dock.x + "," + dock.y + " "+dock.width+ "x"+dock.height; + } else { + return "_,_ _x_"; + } + } } Text{ @@ -76,7 +88,7 @@ Window{ Text{ text: { - if (dock.onPrimary) + if (dock && dock.onPrimary) return "Yes"; else return "No"; @@ -136,7 +148,13 @@ Window{ } Text{ - text: dock.maskArea.x +", "+ dock.maskArea.y+" "+dock.maskArea.width+"x"+dock.maskArea.height + text: { + if (dock && dock.maskArea) { + return dock.maskArea.x +", "+ dock.maskArea.y+" "+dock.maskArea.width+"x"+dock.maskArea.height; + } else { + return "_,_ _x_"; + } + } } Text{ @@ -144,8 +162,13 @@ Window{ } Text{ - text: dock.localGeometry.x + ", " + dock.localGeometry.y + " " + - dock.localGeometry.width + "x" + dock.localGeometry.height + text: { + if (dock && dock.localGeometry) { + return dock.localGeometry.x + ", " + dock.localGeometry.y + " " + dock.localGeometry.width + "x" + dock.localGeometry.height; + } else { + return "_,_ _x_"; + } + } } Text{ @@ -154,7 +177,7 @@ Window{ Text{ text: { - if (dock.drawEffects) + if (dock && dock.drawEffects) return "Yes"; else return "No"; @@ -166,8 +189,13 @@ Window{ } Text{ - text: dock.effectsArea.x + ", " + dock.effectsArea.y + " " + - dock.effectsArea.width + "x" + dock.effectsArea.height + text: { + if (dock && dock.effectsArea) { + return dock.effectsArea.x + ", " + dock.effectsArea.y + " " +dock.effectsArea.width + "x" + dock.effectsArea.height; + } else { + return "_,_ _x_"; + } + } } Text{ @@ -184,7 +212,7 @@ Window{ Text{ text: { - if (dock.visibility.isHidden) + if (dock && dock.visibility && dock.visibility.isHidden) return "Yes"; else return "No"; @@ -205,7 +233,7 @@ Window{ Text{ text: { - if (dock.visibility.containsMouse) + if (dock && dock.visibility && dock.visibility.containsMouse) return "Yes"; else return "No"; @@ -295,6 +323,9 @@ Window{ Text{ text: { + if (!dock || !dock.visibility) + return ""; + switch(dock.visibility.mode){ case Latte.Dock.AlwaysVisible: return "Always Visible"; diff --git a/containment/package/contents/ui/LayoutsContainer.qml b/containment/package/contents/ui/LayoutsContainer.qml index e29f99065..603610edd 100644 --- a/containment/package/contents/ui/LayoutsContainer.qml +++ b/containment/package/contents/ui/LayoutsContainer.qml @@ -48,7 +48,7 @@ Item{ return; } - if (dock.visibility.isHidden && root.isVertical) { + if (dock && dock.visibility && dock.visibility.isHidden && root.isVertical) { if (Latte.WindowSystem.compositingActive) { return visibilityManager.slidingOutToPos; } else { @@ -73,7 +73,7 @@ Item{ return; } - if (dock.visibility.isHidden && root.isHorizontal) { + if (dock && dock.visibility && dock.visibility.isHidden && root.isHorizontal) { if (Latte.WindowSystem.compositingActive) { return visibilityManager.slidingOutToPos; } else { @@ -169,6 +169,28 @@ Item{ property int beginIndex: 0 property int count: children.length + //it is used in calculations for fillWidth,fillHeight applets + property int sizeWithNoFillApplets: 0 + + Binding{ + target: _startLayout + property:"sizeWithNoFillApplets" + when: _startLayout + value: { + if (!visibilityManager || !visibilityManager.normalState) + return; + + var space = 0; + for (var i=0; i<_startLayout.children.length; ++i){ + if (_startLayout.children[i] && !_startLayout.children[i].needsFillSpace) { + space = root.isHorizontal ? space + _startLayout.children[i].width : space + _startLayout.children[i].height; + } + } + + return space; + } + } + property int shownApplets: { var res = 0; @@ -184,21 +206,6 @@ Item{ return res; } - //it is used in calculations for fillWidth,fillHeight applets - property int sizeWithNoFillApplets: { - if (!visibilityManager || !visibilityManager.normalState) - return; - - var space = 0; - for (var i=0; i