diff options
author | Luiz Agostini <luiz.agostini@openbossa.org> | 2009-10-31 18:24:23 -0300 |
---|---|---|
committer | Luiz Agostini <luiz.agostini@openbossa.org> | 2009-11-05 00:42:09 -0300 |
commit | b4e03add970492ffc6dbd15552601216f9122d1e (patch) | |
tree | 06aa7828b60606add70666c0779e1cb707a245ff /weather | |
parent | 3dafeb510c1a518fb9f558a334526b27eef494c8 (diff) |
Weather: stars are 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/forecaststars.cpp | 12 | ||||
-rw-r--r-- | weather/forecaststars.h | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/weather/bootmanager.cpp b/weather/bootmanager.cpp index ed2346c..6a19fbf 100644 --- a/weather/bootmanager.cpp +++ b/weather/bootmanager.cpp @@ -5,6 +5,7 @@ #include "forecasthungitem.h" #include "forecastrain.h" #include "forecastsnow.h" +#include "forecaststars.h" #include <QDebug> @@ -26,6 +27,7 @@ void BootManager::run() int count = ForecastHungItem::loadImages(); count += ForecastRain::loadImages(); count += ForecastSnow::loadImages(); + count += ForecastStars::loadImages(); m_imagesLoaded = count == 0; diff --git a/weather/forecaststars.cpp b/weather/forecaststars.cpp index fd26e3a..7d18f20 100644 --- a/weather/forecaststars.cpp +++ b/weather/forecaststars.cpp @@ -31,6 +31,7 @@ #include "forecaststars.h" #include "settings.h" +#include "pixmaploader.h" #include <QTime> #include <QPropertyAnimation> @@ -39,10 +40,10 @@ typedef struct { const char * const prefix; const qreal radius; - 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; } } StarObjectData; @@ -73,6 +74,13 @@ ForecastStars::ForecastStars(int count, QGraphicsItem *parent) m_starts.append(new Star(qrand() % 3, this)); } +int ForecastStars::loadImages() +{ + for (int i = 0; i < StarTypesCount;++i) + PixmapLoader::load(StarObjectsData[i].name()); + return StarTypesCount; +} + QAbstractAnimation *ForecastStars::getAnimation() { QPropertyAnimation *result = new QPropertyAnimation(this, "progress"); diff --git a/weather/forecaststars.h b/weather/forecaststars.h index abb4a3f..fb6fb62 100644 --- a/weather/forecaststars.h +++ b/weather/forecaststars.h @@ -45,6 +45,8 @@ public: ForecastStars(int count, QGraphicsItem *parent = 0); QAbstractAnimation *getAnimation(); + static int loadImages(); + QRectF rect() const; void setRect(QRectF rect); |