improvements for task progress

--unload task progress properly
--improbe the shadow appearance
--repaint progress only when it is needed
pull/1/head
Michail Vourlakos 8 years ago
parent 20fc60c59d
commit 09268b53ff

@ -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 {

@ -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: {

@ -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 {

Loading…
Cancel
Save