diff -r 03646e8da489 -r 30f14686fb04 homescreenapp/hsdomainmodel/inc/hswallpaper.h --- a/homescreenapp/hsdomainmodel/inc/hswallpaper.h Fri Jun 11 13:30:16 2010 +0300 +++ b/homescreenapp/hsdomainmodel/inc/hswallpaper.h Wed Jun 23 18:03:36 2010 +0300 @@ -19,13 +19,13 @@ #define HSWALLPAPER_H #include -#include #include "hsdomainmodel_global.h" #include "hstest_global.h" class HbIconItem; +class HsWallpaperLoader; -HOMESCREEN_TEST_CLASS(TestRuntimeServices) +HOMESCREEN_TEST_CLASS(TestHsDomainModel) class HSDOMAINMODEL_EXPORT HsWallpaper : public HbWidget { @@ -35,36 +35,89 @@ HsWallpaper(QGraphicsItem *parent = 0); ~HsWallpaper(); - bool setImagesById(const QString &id = "d", - const QString &ext = "png"); +signals: + void imageSet(); + void imageSetFailed(); - bool setImagesByPaths(const QString &landscapeImagePath, - const QString &portraitImagePath); - - void setPortraitImage(const QString &path, bool activate = false); - void setLandscapeImage(const QString &path, bool activate = false); +public slots: + void setImage(const QString &path); + void setDefaultImage(); + void remove(); - bool removeImages(); +protected: + virtual QString wallpaperDirectory() const = 0; + virtual QVariantHash createTargets(const QString &sourcePath) = 0; - static QString wallpaperDirectory(); - static QString wallpaperPath(Qt::Orientation orientation, - const QString &id = "d", - const QString &ext = "png"); + bool setExistingImage(); + QString rootDirectory() const; -private: +private: Q_DISABLE_COPY(HsWallpaper) private slots: - void onOrientationChanged(Qt::Orientation orientation); + void onLoaderFinished(); + void onLoaderFailed(); + void updateIconItem(Qt::Orientation orientation); + +protected: + int mId; private: - QString mLImagePath; - QString mPImagePath; - Qt::Orientation mOrientation; + bool mIsDefaultImage; + QString mPortraitImagePath; + QString mLandscapeImagePath; + HbIconItem *mIconItem; + HsWallpaperLoader *mLoader; + + HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel) +}; + +class HsScene; +class HSDOMAINMODEL_EXPORT HsSceneWallpaper : public HsWallpaper +{ + Q_OBJECT + +public: + HsSceneWallpaper(HsScene *scene, QGraphicsItem *parent = 0); + ~HsSceneWallpaper(); + + HsScene *scene() const { return mScene; } + void setScene(HsScene *scene); + +protected: + QString wallpaperDirectory() const; + QVariantHash createTargets(const QString &sourcePath); + +private: + Q_DISABLE_COPY(HsSceneWallpaper) - HbIconItem *mIconItem; +private: + HsScene *mScene; + HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel) +}; + +class HsPage; +class HSDOMAINMODEL_EXPORT HsPageWallpaper : public HsWallpaper +{ + Q_OBJECT + +public: + HsPageWallpaper(HsPage *page, QGraphicsItem *parent = 0); + ~HsPageWallpaper(); - HOMESCREEN_TEST_FRIEND_CLASS(TestRuntimeServices) + HsPage *page() const { return mPage; } + void setPage(HsPage *page); + +protected: + QString wallpaperDirectory() const; + QVariantHash createTargets(const QString &sourcePath); + +private: + Q_DISABLE_COPY(HsPageWallpaper) + +private: + HsPage *mPage; + HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel) }; #endif // HSWALLPAPER_H