* remove unneeded members (like a copy of the icon)

* don't re-do math we've already done (progress var)
* go from disable dto enabled, after all that is exactly what's happening: when you mouse over it becomes active. now that the items don't overlap the icon this works out nicely; it also makes the toolbox less LOUD and in your face when not in use

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=758486
This commit is contained in:
Aaron J. Seigo 2008-01-08 00:41:53 +00:00
parent b1d5d22ffe
commit 2073330692
2 changed files with 6 additions and 10 deletions

View File

@ -39,7 +39,6 @@ static const int ToolName = 7001;
DesktopToolbox::DesktopToolbox(QGraphicsItem *parent) DesktopToolbox::DesktopToolbox(QGraphicsItem *parent)
: QGraphicsItem(parent), : QGraphicsItem(parent),
m_icon("plasma"), m_icon("plasma"),
m_iconSelected("plasma"),
m_size(50), m_size(50),
m_showing(false), m_showing(false),
m_animId(0), m_animId(0),
@ -94,13 +93,13 @@ void DesktopToolbox::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
const qreal progress = m_animFrame / m_size; const qreal progress = m_animFrame / m_size;
if (progress > 0.1) { if (progress > 0.1) {
m_iconSelected.paint(painter, QRect(m_size*2 - 34, 2, 32, 32), Qt::AlignCenter, QIcon::Disabled, QIcon::Off); m_icon.paint(painter, QRect(m_size*2 - 34, 2, 32, 32));
} }
if (progress < 0.95) { if (progress <= 0.9) {
painter->save(); painter->save();
painter->setOpacity(1.0 - m_animFrame / m_size); painter->setOpacity(1 - progress);
m_icon.paint(painter, QRect(m_size*2 - 34, 2, 32, 32)); m_icon.paint(painter, QRect(m_size*2 - 34, 2, 32, 32), Qt::AlignCenter, QIcon::Disabled, QIcon::Off);
painter->restore(); painter->restore();
} }
} }
@ -116,7 +115,6 @@ QPainterPath DesktopToolbox::shape() const
void DesktopToolbox::hoverEnterEvent(QGraphicsSceneHoverEvent *event) void DesktopToolbox::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{ {
// Plasma::Phase::self()->moveItem(this, Phase::SlideIn, QPoint(-25, -25));
int maxwidth = 0; int maxwidth = 0;
foreach (QGraphicsItem* tool, QGraphicsItem::children()) { foreach (QGraphicsItem* tool, QGraphicsItem::children()) {
if (!tool->isEnabled()) { if (!tool->isEnabled()) {
@ -155,7 +153,6 @@ void DesktopToolbox::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
void DesktopToolbox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void DesktopToolbox::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{ {
// Plasma::Phase::self->moveItem(this, Phase::SlideOut, boundingRect()QPoint(-50, -50));
int x = m_size*2; int x = m_size*2;
int y = 0; int y = 0;
Plasma::Phase* phase = Plasma::Phase::self(); Plasma::Phase* phase = Plasma::Phase::self();

View File

@ -57,7 +57,6 @@ protected slots:
private: private:
KIcon m_icon; KIcon m_icon;
KIcon m_iconSelected;
int m_size; int m_size;
bool m_hidden; bool m_hidden;
bool m_showing; bool m_showing;