From kde-panel-devel Sat Jul 18 14:05:02 2009 From: =?GB2312?B?IsXLzsDGvShQZXRlciBQYW4pIg==?= Date: Sat, 18 Jul 2009 14:05:02 +0000 To: kde-panel-devel Subject: [PATCH] BUG 189643 Taskbar should be animated while program is Message-Id: <4A61D68E.3020508 () redflag-linux ! com> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=124792627223329 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--------------040308090609030801030506" This is a multi-part message in MIME format. --------------040308090609030801030506 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 8bit 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 --------------040308090609030801030506 Content-Type: text/x-patch; name="kdebase-plasma-tasks-startup-animator.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="kdebase-plasma-tasks-startup-animator.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(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 --------------040308090609030801030506 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --------------040308090609030801030506--