From 0bf3fe9f4c3fb53d206752d57c519630c6e25ca9 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 7 Feb 2017 20:53:44 +0200 Subject: [PATCH] improvements for task progress --unload task progress properly --improbe the shadow appearance --repaint progress only when it is needed --- plasmoid/contents/ui/CircleText.qml | 22 +++++++++++++---- plasmoid/contents/ui/TaskIconItem.qml | 26 ++++++++++++-------- plasmoid/contents/ui/TaskProgressOverlay.qml | 2 +- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/plasmoid/contents/ui/CircleText.qml b/plasmoid/contents/ui/CircleText.qml index 9f81d159a..4c2239cef 100644 --- a/plasmoid/contents/ui/CircleText.qml +++ b/plasmoid/contents/ui/CircleText.qml @@ -22,7 +22,9 @@ import QtQuick 2.2 import QtGraphicalEffects 1.0 Item { - property double proportion + property double proportion: 0 + + property double previousProportion: 0 property string valueLabel property string numberValue @@ -41,7 +43,12 @@ Item { property double pi2: Math.PI * 2 onProportionChanged: { - repaint() + console.log(previousProportion + " - "+proportion); + if ((proportion - 0.03 >= previousProportion) || (proportion===1)) { + console.log("request repaint..."); + previousProportion = proportion; + repaint(); + } } function repaint() { @@ -61,7 +68,6 @@ Item { width: parent.width height: parent.height - antialiasing: true opacity: 1.0 onPaint: { @@ -84,12 +90,15 @@ Item { DropShadow { anchors.fill: canvas - radius: 4 + radius: 2 samples: 8 spread: 0.5 fast: true + opacity: 0.65 color: theme.backgroundColor source: canvas + + enabled: root.enableShadows } Text { @@ -103,13 +112,16 @@ Item { DropShadow { anchors.fill: valueText - radius: 3 + radius: 2 samples: 8 spread: 0.6 fast: true + opacity: 0.65 color: theme.backgroundColor source: valueText visible: showNumber + + enabled: root.enableShadows } Text { diff --git a/plasmoid/contents/ui/TaskIconItem.qml b/plasmoid/contents/ui/TaskIconItem.qml index afb473000..ecccc36f1 100644 --- a/plasmoid/contents/ui/TaskIconItem.qml +++ b/plasmoid/contents/ui/TaskIconItem.qml @@ -81,6 +81,21 @@ Item{ updateImages(); } + onSmartLauncherEnabledChanged: { + if (smartLauncherEnabled && !smartLauncherItem) { + var smartLauncher = Qt.createQmlObject( + " import org.kde.plasma.private.taskmanager 0.1 as TaskManagerApplet; TaskManagerApplet.SmartLauncherItem { }", + centralItem); + + smartLauncher.launcherUrl = Qt.binding(function() { return model.LauncherUrlWithoutIcon; }); + + smartLauncherItem = smartLauncher; + } else if (!smartLauncherEnabled && smartLauncherItem) { + smartLauncherItem.destroy(); + smartLauncherItem = null; + } + } + Rectangle{ id: draggedRectangle width: iconImageBuffer.width+1 @@ -150,7 +165,7 @@ Item{ height: Math.round(width) //icon: decoration source: decoration - + onValidChanged: { if (!valid && (source === decoration || source === "unknown")) source = "application-x-executable" @@ -385,15 +400,6 @@ Item{ Component.onCompleted: { - if (smartLauncherEnabled && !smartLauncherItem) { - var smartLauncher = Qt.createQmlObject( - " import org.kde.plasma.private.taskmanager 0.1 as TaskManagerApplet; TaskManagerApplet.SmartLauncherItem { }", - centralItem); - - smartLauncher.launcherUrl = Qt.binding(function() { return model.LauncherUrlWithoutIcon; }); - - smartLauncherItem = smartLauncher; - } } Component.onDestruction: { diff --git a/plasmoid/contents/ui/TaskProgressOverlay.qml b/plasmoid/contents/ui/TaskProgressOverlay.qml index 196829bb1..e18e0f94e 100644 --- a/plasmoid/contents/ui/TaskProgressOverlay.qml +++ b/plasmoid/contents/ui/TaskProgressOverlay.qml @@ -33,7 +33,7 @@ Item { numberValue: centralItem.smartLauncherItem.count fullCircle: true showNumber: true - proportion: centralItem.smartLauncherItem.progress / 100 + proportion: centralItem.smartLauncherItem ? centralItem.smartLauncherItem.progress / 100 : 0 states: [ State {