[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    [PATCH] BUG 189643 Taskbar should be animated while program is
From:       <wppan () redflag-linux ! com>
Date:       2009-07-18 14:05:02
Message-ID: 4A61D68E.3020508 () redflag-linux ! com
[Download RAW message or body]

Hi, all

"In KDE3, when I start a programm, the taskbar-panel shows a
turning-sand-clock while the programm starts. I would like that back in
KDE4."

I try to make a patch to fix this BUG, but I don't known how to realize
a turning-sand-clock effect, so I choose icons like go-up, go-next,
go-down and go-previous to test my code.

I really want to realize a turning-sand-clock effect, but I don't known
how to do it. Maybe some icons should be added?

Any comments are warmly welcomed!

Regards

-- 
ÅËÎÀƽ(Peter Pan)
Red Flag Software Co., Ltd

["kdebase-plasma-tasks-startup-animator.patch" (text/x-patch)]

Index: windowtaskitem.cpp
===================================================================
--- windowtaskitem.cpp	(revision 998718)
+++ windowtaskitem.cpp	(working copy)
@@ -60,7 +60,8 @@
 
 WindowTaskItem::WindowTaskItem(QGraphicsWidget *parent, Tasks *applet)
     : AbstractTaskItem(parent, applet),
-      m_task(0)
+      m_task(0),
+      m_startupTimerId(0)
 {
 }
 
@@ -219,6 +220,7 @@
     connect(task, SIGNAL(gotTaskPointer()), this, SLOT(gotTaskPointer()));
     setText(task->startup()->text());
     setIcon(KIcon(task->startup()->icon()));
+    startStartupAnimation(5000);
 }
 
 void WindowTaskItem::gotTaskPointer()
@@ -226,6 +228,7 @@
     //kDebug();
     TaskManager::TaskItem *item = qobject_cast<TaskManager::TaskItem*>(sender());
     if (item) {
+        stopStartupAnimation();
         setWindowTask(item);
     }
 }
@@ -322,5 +325,35 @@
     }
 }
 
+void WindowTaskItem::startStartupAnimation(int duration)
+{
+    m_startupTimerId = Plasma::Animator::self()->customAnimation(100, duration, \
Plasma::Animator::EaseInCurve, this, "startupAnimationUpdate"); +}
+
+void WindowTaskItem::startupAnimationUpdate(qreal progress)
+{
+    // choose some icons to test 
+    static int n = 0;
+    if (n % 4 == 0) {   
+        n = 0;
+        m_icon = KIcon("go-up");
+    } else if (n % 4 == 1){
+        m_icon = KIcon("go-next");
+    } else if (n % 4 == 2){
+        m_icon = KIcon("go-down");
+    } else if (n % 4 == 3){
+        m_icon = KIcon("go-previous");
+    }
+
+    n++;
+    update();
+}
+
+void WindowTaskItem::stopStartupAnimation()
+{
+    if (m_startupTimerId) {
+        Plasma::Animator::self()->stopCustomAnimation(m_startupTimerId);
+    }
+}
 #include "windowtaskitem.moc"
 
Index: windowtaskitem.h
===================================================================
--- windowtaskitem.h	(revision 998718)
+++ windowtaskitem.h	(working copy)
@@ -71,6 +71,7 @@
 private slots:
     void updateTask(::TaskManager::TaskChanges changes);
     void gotTaskPointer();
+    void startupAnimationUpdate(qreal progress);
 
 private:
     /** Sets the starting task represented by this item. */
@@ -79,7 +80,11 @@
     /** Sets the window represented by this task. */
     void setWindowTask(TaskManager::TaskItem* taskItem);
 
+    void startStartupAnimation(int duration);
+    void stopStartupAnimation();
+
     TaskManager::TaskItem *m_task;
+    int m_startupTimerId;
 };
 
 #endif



_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic