diff options
author | Luiz Agostini <luiz.agostini@openbossa.org> | 2009-10-31 18:21:53 -0300 |
---|---|---|
committer | Luiz Agostini <luiz.agostini@openbossa.org> | 2009-11-05 00:42:08 -0300 |
commit | 3dafeb510c1a518fb9f558a334526b27eef494c8 (patch) | |
tree | 4ca9b802ab61a604f5bba5d22f2eff21b7880374 /weather | |
parent | 691f8eec255eb56805df2b24f68b75a689417c3a (diff) |
Weather: snow is now using pixmap loader.
Signed-off-by: Luiz Agostini <luiz.agostini@openbossa.org>
Diffstat (limited to 'weather')
-rw-r--r-- | weather/bootmanager.cpp | 2 | ||||
-rw-r--r-- | weather/forecastsnow.cpp | 12 | ||||
-rw-r--r-- | weather/forecastsnow.h | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/weather/bootmanager.cpp b/weather/bootmanager.cpp index cf36ecb..ed2346c 100644 --- a/weather/bootmanager.cpp +++ b/weather/bootmanager.cpp @@ -4,6 +4,7 @@ #include "pixmaploader.h" #include "forecasthungitem.h" #include "forecastrain.h" +#include "forecastsnow.h" #include <QDebug> @@ -24,6 +25,7 @@ void BootManager::run() PixmapLoader::connectToOnIdleSignal(this, SLOT(pixmapLoaderIsIdle())); int count = ForecastHungItem::loadImages(); count += ForecastRain::loadImages(); + count += ForecastSnow::loadImages(); m_imagesLoaded = count == 0; diff --git a/weather/forecastsnow.cpp b/weather/forecastsnow.cpp index de03a77..d342c1e 100644 --- a/weather/forecastsnow.cpp +++ b/weather/forecastsnow.cpp @@ -31,16 +31,17 @@ #include "forecastsnow.h" #include "settings.h" +#include "pixmaploader.h" #include <QPainter> typedef struct { const char * const prefix; - QPixmap pic() const { return Settings::getScaledPic(name()); } + QString name() const { return prefix; } + QPixmap pic() const { return PixmapLoader::getPic(name()); } private: - QString name() const { return prefix; } } SnowFlaketData; @@ -87,6 +88,13 @@ ForecastSnow::SnowFlake::SnowFlake(int type, const QSizeF &bounds) m_speed = QPointF(x, y); } +int ForecastSnow::loadImages() +{ + for (int i = 0; i < SnowFlakeCount;++i) + PixmapLoader::load(SnowFlakeArray[i].name()); + return SnowFlakeCount; +} + static inline bool doDeviation(qreal &factor) { if (qrand() % deviation2 > deviation1) diff --git a/weather/forecastsnow.h b/weather/forecastsnow.h index 73c15c4..809b232 100644 --- a/weather/forecastsnow.h +++ b/weather/forecastsnow.h @@ -43,6 +43,8 @@ class ForecastSnow : public QObject public: ForecastSnow(int count, const QRectF &bounds, QGraphicsItem *parent); + static int loadImages(); + void paint(QPainter *painter); public slots: |