homescreenapp/hsdomainmodel/inc/hswallpaper.h
changeset 62 341166945d65
parent 46 23b5d6a29cce
child 86 e4f038c420f7
--- a/homescreenapp/hsdomainmodel/inc/hswallpaper.h	Thu Jun 24 13:11:40 2010 +0100
+++ b/homescreenapp/hsdomainmodel/inc/hswallpaper.h	Fri Jun 25 19:19:22 2010 +0300
@@ -19,13 +19,13 @@
 #define HSWALLPAPER_H
 
 #include <HbWidget>
-#include <QScopedPointer>
 #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