[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-panel-devel
Subject: Re: [PATCH] BUG 189643 Taskbar should be animated while program is
From: "潘 <wppan () redflag-linux ! com>
Date: 2009-07-23 9:30:43
Message-ID: 4A682DC3.8030801 () redflag-linux ! com
[Download RAW message or body]
Aaron J. Seigo 写道:
> On Wednesday 22 July 2009, Aaron J. Seigo wrote:
>> On Tuesday 21 July 2009, 潘卫平(Peter Pan) wrote:
>>> Do you mean that I should use Plasma::BusyWidget ?
>> yes
>>
>>> I made a patch using Plasma::BusyWidget, It looks fine.
>> i wonder if it wouldn't make more sense to show it in place of the icon
>
> or perhaps over top of the icon...
>
Taht will cover the icon and looks mussy.
I prefer to let it over the text.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel@kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
I make the animation over the text and next to the icon.
Regards
--
潘卫平(Peter Pan)
Red Flag Software Co., Ltd
["kdebase-workspace-tasks-startup-animation.patch" (text/x-patch)]
Index: windowtaskitem.cpp
===================================================================
--- windowtaskitem.cpp (revision 1001421)
+++ windowtaskitem.cpp (working copy)
@@ -21,6 +21,7 @@
// Own
#include "windowtaskitem.h"
#include "taskgroupitem.h"
+#include "taskitemlayout.h"
// Qt
#include <QGraphicsSceneContextMenuEvent>
@@ -60,7 +61,9 @@
WindowTaskItem::WindowTaskItem(QGraphicsWidget *parent, Tasks *applet)
: AbstractTaskItem(parent, applet),
- m_task(0)
+ m_task(0),
+ m_startupTimer(0),
+ m_busyWidget(0)
{
}
@@ -219,6 +222,7 @@
connect(task, SIGNAL(gotTaskPointer()), this, SLOT(gotTaskPointer()));
setText(task->startup()->text());
setIcon(KIcon(task->startup()->icon()));
+ startStartupAnimation(8000);
}
void WindowTaskItem::gotTaskPointer()
@@ -226,6 +230,7 @@
//kDebug();
TaskManager::TaskItem *item = qobject_cast<TaskManager::TaskItem*>(sender());
if (item) {
+ stopStartupAnimation();
setWindowTask(item);
}
}
@@ -322,5 +327,35 @@
}
}
+void WindowTaskItem::startStartupAnimation(int duration)
+{
+ if (!m_startupTimer) {
+ m_startupTimer = new QTimer(this);
+ m_startupTimer->setSingleShot(true);
+ connect(m_startupTimer, SIGNAL(timeout()), this, SLOT(stopStartupAnimation()));
+ }
+
+ QRectF rect = parentGroup()->tasksLayout()->contentsRect();
+ int rowCount = parentGroup()->tasksLayout()->rowCount();
+ qreal height = rect.height() / rowCount;
+ QSizeF size(height, height);
+
+ if (!m_busyWidget) {
+ m_busyWidget = new Plasma::BusyWidget(this);
+ }
+
+ QRectF animationRect(QPointF(height, 0), size);
+ m_busyWidget->setGeometry(animationRect);
+ m_startupTimer->start(duration);
+}
+
+void WindowTaskItem::stopStartupAnimation()
+{
+ delete m_busyWidget;
+ m_busyWidget = 0;
+
+ delete m_startupTimer;
+ m_startupTimer = 0;
+}
#include "windowtaskitem.moc"
Index: windowtaskitem.h
===================================================================
--- windowtaskitem.h (revision 1001421)
+++ windowtaskitem.h (working copy)
@@ -27,6 +27,7 @@
#include <taskmanager/taskmanager.h>
#include <taskmanager/taskitem.h>
+#include <Plasma/BusyWidget>
/**
* A task item for a task which represents a window on the desktop.
*/
@@ -71,6 +72,7 @@
private slots:
void updateTask(::TaskManager::TaskChanges changes);
void gotTaskPointer();
+ void stopStartupAnimation();
private:
/** Sets the starting task represented by this item. */
@@ -79,7 +81,12 @@
/** Sets the window represented by this task. */
void setWindowTask(TaskManager::TaskItem* taskItem);
+ void startStartupAnimation(int duration);
+
TaskManager::TaskItem *m_task;
+ QTimer *m_startupTimer;
+
+ Plasma::BusyWidget *m_busyWidget;
};
#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