summaryrefslogtreecommitdiff
path: root/graphicswatchlet.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-09-17 03:03:23 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-09-17 03:03:23 +0200
commit3a755f46d9cf6e3650d40a960d0d0db8c1ad9fa1 (patch)
treef330f63caec08b6626c808b5ae70c64cab0246a6 /graphicswatchlet.cpp
parent0dca79a8c15b76ca53617c0ed3396ab6435f0152 (diff)
downloadsowatch-3a755f46d9cf6e3650d40a960d0d0db8c1ad9fa1.tar.gz
sowatch-3a755f46d9cf6e3650d40a960d0d0db8c1ad9fa1.zip
preparing for library package
Diffstat (limited to 'graphicswatchlet.cpp')
-rw-r--r--graphicswatchlet.cpp47
1 files changed, 0 insertions, 47 deletions
diff --git a/graphicswatchlet.cpp b/graphicswatchlet.cpp
deleted file mode 100644
index 538723a..0000000
--- a/graphicswatchlet.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <QtCore/QDebug>
-#include <QtGui/QPainter>
-
-#include "watch.h"
-#include "graphicswatchlet.h"
-
-using namespace sowatch;
-
-GraphicsWatchlet::GraphicsWatchlet(WatchServer* server, const QString& id) :
- Watchlet(server, id), _scene(0), _damaged()
-{
-}
-
-QGraphicsScene* GraphicsWatchlet::scene()
-{
- return _scene;
-}
-
-void GraphicsWatchlet::setScene(QGraphicsScene *scene)
-{
- if (_scene) {
- disconnect(this, SLOT(sceneChanged(QList<QRectF>)));
- }
- _scene = scene;
- if (_scene) {
- connect(_scene, SIGNAL(changed(QList<QRectF>)),
- this, SLOT(sceneChanged(QList<QRectF>)));
- }
-}
-
-void GraphicsWatchlet::sceneChanged(const QList<QRectF> &region)
-{
- foreach(const QRectF& r, region)
- {
- _damaged += r.toRect();
- }
-
- if (!_damaged.isEmpty() && _active && !watch()->busy()) {
- const QVector<QRect> rects = _damaged.rects();
- QPainter p(watch());
- foreach(const QRect& r, rects)
- {
- _scene->render(&p, r, r, Qt::IgnoreAspectRatio);
- }
- _damaged = QRegion();
- }
-}