[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: <panweiping3 () gmail ! com>
Date: 2009-07-29 13:32:26
Message-ID: 499f24540907290632u31ab9731ye8aec3fb33bff39 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Aaron J. Seigo дµÀ:
> On Thursday 23 July 2009, ÅËÎÀƽ(Peter Pan) wrote:
>> Taht will cover the icon and looks mussy.
>> I prefer to let it over the text.
>
> hm.. ok, how about on the right side of the button then, where the # of
> windows usually appears when there are several windows grouped?
>
> also as for this:
>
> + QRectF rect = parentGroup()->tasksLayout()->contentsRect();
> + int rowCount = parentGroup()->tasksLayout()->rowCount();
> + qreal height = rect.height() / rowCount;
> + QSizeF size(height, height);
>
> it should be able to just position it relative to the task button itself,
> something like this which would make it consistent with the group number
> drawing as well:
>
> Plasma::FrameSvg *itemBackground = m_applet->itemBackground();
> QSizeF busySize(itemBackground->elementSize(expanderElement()));
> QRectF animationRect(QPointF(size().width() - busySize.width(),
(size.height()
> - busySize.height()) / 2), busySize);
>
> even with this code, however, if the size of the button changes while the
app
> is launching the busy widget will no longer be in the right place.
>
> so ... either the positioning code should be put into a separate method
and be
> called from both startStartupAnimation and resizeEvent or a layout should
be
> used to manage that for us. a layout is probably overkill in this
situation,
> though.
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel@kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
Fisrt, I prefer to use Plasma::BusyWidget, consistent with others.
Second, I prefer to replace icon when the app is starting up, like
firefox when it is opening a new website.
Third, I set the BusyWidgest's geometry in AbstractTaskItem::drawTask(),
so it can get the proper geometry.
Best regards!
--
ÅËÎÀƽ(Peter Pan)
[Attachment #5 (text/html)]
Aaron J. Seigo дµÀ:<br>> On Thursday 23 July 2009, ÅËÎÀƽ(Peter Pan) \
wrote:<br>>> Taht will cover the icon and looks mussy.<br>>> I prefer to \
let it over the text.<br>> <br>> hm.. ok, how about on the right side of the \
button then, where the # of <br> > windows usually appears when there are several \
windows grouped?<br>> <br>> also as for this:<br>> <br>> \
+ QRectF rect = \
parentGroup()->tasksLayout()->contentsRect();<br>> + int \
rowCount = parentGroup()->tasksLayout()->rowCount();<br> > \
+ qreal height = rect.height() / rowCount; <br>> \
+ QSizeF size(height, height);<br>> <br>> it should be able \
to just position it relative to the task button itself, <br>> something like this \
which would make it consistent with the group number <br> > drawing as \
well:<br>> <br>> Plasma::FrameSvg *itemBackground = \
m_applet->itemBackground();<br>> QSizeF \
busySize(itemBackground->elementSize(expanderElement()));<br>> QRectF \
animationRect(QPointF(size().width() - busySize.width(), (size.height() <br> > - \
busySize.height()) / 2), busySize);<br>> <br>> even with this code, \
however, if the size of the button changes while the app <br>> is launching the \
busy widget will no longer be in the right place.<br>> <br> > so ... either the \
positioning code should be put into a separate method and be <br>> called from \
both startStartupAnimation and resizeEvent or a layout should be <br>> used to \
manage that for us. a layout is probably overkill in this situation, <br> > \
though.<br>> <br>> <br>> <br>> \
------------------------------------------------------------------------<br>> \
<br>> _______________________________________________<br>> Plasma-devel mailing \
list<br> > <a href="mailto:Plasma-devel@kde.org">Plasma-devel@kde.org</a><br>> \
<a href="https://mail.kde.org/mailman/listinfo/plasma-devel">https://mail.kde.org/mailman/listinfo/plasma-devel</a><br><br>Fisrt, \
I prefer to use Plasma::BusyWidget, consistent with others.<br> <br>Second, I prefer \
to replace icon when the app is starting up, like<br>firefox when it is opening a new \
website.<br><br>Third, I set the BusyWidgest's geometry in \
AbstractTaskItem::drawTask(),<br>so it can get the proper geometry.<br> <br>Best \
regards!<br><br><br>-- <br>ÅËÎÀƽ(Peter Pan)<br>
--0016364574b4c5f9ea046fd837a1--
["kdebase-plasma-tasks-startup-animator.patch" (text/x-patch)]
Index: abstracttaskitem.cpp
===================================================================
--- abstracttaskitem.cpp (版本 1004126)
+++ abstracttaskitem.cpp (工作副本)
@@ -586,26 +586,34 @@
QRectF bounds = boundingRect().adjusted(m_applet->itemLeftMargin(), \
m_applet->itemTopMargin(), -m_applet->itemRightMargin(), \
-m_applet->itemBottomMargin());
- if ((!m_animId && ~option->state & QStyle::State_MouseOver) ||
- (m_oldBackgroundPrefix != "hover" && m_backgroundPrefix != "hover")) {
- m_icon.paint(painter, iconRect(bounds).toRect());
+ WindowTaskItem *window = qobject_cast<WindowTaskItem *>(this);
+ QGraphicsWidget *busyWidget;
+ busyWidget = window ? window->busyWidget() : 0;
+
+ if (busyWidget) {
+ busyWidget->setGeometry(iconRect(bounds));
+ busyWidget->show();
} else {
- KIconEffect *effect = KIconLoader::global()->iconEffect();
- QPixmap result = m_icon.pixmap(iconRect(bounds).toRect().size());
+ if ((!m_animId && ~option->state & QStyle::State_MouseOver)
+ ||(m_oldBackgroundPrefix != "hover" && m_backgroundPrefix != "hover")) {
+ m_icon.paint(painter, iconRect(bounds).toRect());
+ } else {
+ KIconEffect *effect = KIconLoader::global()->iconEffect();
+ QPixmap result = m_icon.pixmap(iconRect(bounds).toRect().size());
- if (effect->hasEffect(KIconLoader::Desktop, KIconLoader::ActiveState)) {
- if (qFuzzyCompare(qreal(1.0), m_alpha)) {
- result = effect->apply(result, KIconLoader::Desktop, \
KIconLoader::ActiveState);
- } else {
- result = Plasma::PaintUtils::transition(
- result,
- effect->apply(result, KIconLoader::Desktop,
- KIconLoader::ActiveState), \
m_fadeIn?m_alpha:1-m_alpha); + if (effect->hasEffect(KIconLoader::Desktop, \
KIconLoader::ActiveState)) { + if (qFuzzyCompare(qreal(1.0), m_alpha)) \
{ + result = effect->apply(result, KIconLoader::Desktop, \
KIconLoader::ActiveState); + } else {
+ result = Plasma::PaintUtils::transition(result,
+ effect->apply(result, KIconLoader::Desktop,
+ KIconLoader::ActiveState), \
m_fadeIn?m_alpha:1-m_alpha); + }
}
+ painter->drawPixmap(iconRect(bounds).topLeft(), result);
}
- painter->drawPixmap(iconRect(bounds).topLeft(), result);
}
-
+
painter->setPen(QPen(textColor(), 1.0));
QRect rect = textRect(bounds).toRect();
Index: windowtaskitem.cpp
===================================================================
--- windowtaskitem.cpp (版本 1004126)
+++ windowtaskitem.cpp (工作副本)
@@ -60,7 +60,8 @@
WindowTaskItem::WindowTaskItem(QGraphicsWidget *parent, Tasks *applet)
: AbstractTaskItem(parent, applet),
- m_task(0)
+ m_task(0),
+ m_busyWidget(0)
{
}
@@ -239,6 +240,11 @@
connect(task, SIGNAL(gotTaskPointer()), this, SLOT(gotTaskPointer()));
setText(task->startup()->text());
setIcon(KIcon(task->startup()->icon()));
+
+ if (!m_busyWidget) {
+ m_busyWidget = new Plasma::BusyWidget(this);
+ m_busyWidget->hide();
+ }
}
void WindowTaskItem::gotTaskPointer()
@@ -246,6 +252,9 @@
//kDebug();
TaskManager::TaskItem *item = qobject_cast<TaskManager::TaskItem*>(sender());
if (item) {
+ delete m_busyWidget;
+ m_busyWidget = 0;
+
setWindowTask(item);
}
}
@@ -342,5 +351,10 @@
}
}
+QGraphicsWidget *WindowTaskItem::busyWidget() const
+{
+ return m_busyWidget;
+}
+
#include "windowtaskitem.moc"
Index: windowtaskitem.h
===================================================================
--- windowtaskitem.h (版本 1004126)
+++ windowtaskitem.h (工作副本)
@@ -22,6 +22,7 @@
#ifndef WINDOWTASKITEM_H
#define WINDOWTASKITEM_H
+#include <Plasma/BusyWidget>
#include "abstracttaskitem.h"
// Own
#include <taskmanager/taskmanager.h>
@@ -54,6 +55,7 @@
virtual bool isWindowItem() const;
virtual bool isActive() const;
virtual void setAdditionalMimeData(QMimeData* mimeData);
+ QGraphicsWidget *busyWidget() const;
signals:
/** Emitted when a window is selected for activation, minimization, \
iconification */ @@ -80,6 +82,7 @@
void setWindowTask(TaskManager::TaskItem* taskItem);
TaskManager::TaskItem *m_task;
+ Plasma::BusyWidget *m_busyWidget;
};
#endif
Index: tasks.cpp
===================================================================
--- tasks.cpp (版本 1004126)
+++ tasks.cpp (工作副本)
@@ -399,6 +399,7 @@
void Tasks::setPopupDialog(bool status)
{
+ Q_UNUSED(status)
QWidget *widget = qobject_cast<QWidget *>(sender());
if (widget->isVisible()) {
_______________________________________________
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