only paint the interface on DesktopZoom. based on a patch by The Other Aaron.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=692597
This commit is contained in:
Aaron J. Seigo 2007-07-25 23:42:43 +00:00
parent f49f45411b
commit 19a46e2c40

View File

@ -24,12 +24,15 @@
#include <QPainter>
#include <QSize>
#include <QTimer>
#include <QStyleOptionGraphicsItem>
#include <KIcon>
#include <KDialog>
#include <KPluginInfo>
#include <KStandardDirs>
#include <KService>
#include <KServiceTypeTrader>
#include <KIconLoader>
#include "plasma/corona.h"
#include "plasma/dataenginemanager.h"
@ -212,6 +215,11 @@ public:
#endif
}
void paintHover(QPainter* painter, Applet* q)
{
//TODO draw hover interface for close, configure, info and move
}
static uint nextId()
{
++s_maxAppletId;
@ -472,7 +480,8 @@ QRectF Applet::boundingRect () const
void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(widget)
qreal zoomLevel = painter->transform().m11() / transform().m11();
if (zoomLevel == scalingFactor(Plasma::DesktopZoom)) { // Show Desktop
if (d->background) {
d->paintBackground(painter, this);
}
@ -482,8 +491,16 @@ void Applet::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QW
}
paintInterface(painter, option, QRect(QPoint(0,0), contentSize().toSize()));
//TODO: interface overlays on hover
d->paintHover(painter, this);
} else if (zoomLevel == scalingFactor(Plasma::GroupZoom)) { // Show Groups + Applet outline
//TODO: make pretty.
painter->drawRoundRect(boundingRect());
int midX = x() + (boundingRect().width() / 2);
int midY = y() + (boundingRect().height() / 2);
//int iconSize = KIconLoader().currentSize(Desktop);
KIcon(icon()).paint(painter, midX, midY, 64, 64);
}/* else if (zoomLevel == scalingFactor(Plasma::OverviewZoom)) { //Show Groups only
} */
}
void Applet::paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option,