homescreenapp/hsdomainmodel/inc/hswallpaper.h
changeset 60 30f14686fb04
parent 46 23b5d6a29cce
child 86 e4f038c420f7
equal deleted inserted replaced
55:03646e8da489 60:30f14686fb04
    17 
    17 
    18 #ifndef HSWALLPAPER_H
    18 #ifndef HSWALLPAPER_H
    19 #define HSWALLPAPER_H
    19 #define HSWALLPAPER_H
    20 
    20 
    21 #include <HbWidget>
    21 #include <HbWidget>
    22 #include <QScopedPointer>
       
    23 #include "hsdomainmodel_global.h"
    22 #include "hsdomainmodel_global.h"
    24 #include "hstest_global.h"
    23 #include "hstest_global.h"
    25 
    24 
    26 class HbIconItem;
    25 class HbIconItem;
       
    26 class HsWallpaperLoader;
    27 
    27 
    28 HOMESCREEN_TEST_CLASS(TestRuntimeServices)
    28 HOMESCREEN_TEST_CLASS(TestHsDomainModel)
    29 
    29 
    30 class HSDOMAINMODEL_EXPORT HsWallpaper : public HbWidget
    30 class HSDOMAINMODEL_EXPORT HsWallpaper : public HbWidget
    31 {
    31 {
    32     Q_OBJECT
    32     Q_OBJECT
    33 
    33 
    34 public:
    34 public:
    35     HsWallpaper(QGraphicsItem *parent = 0);
    35     HsWallpaper(QGraphicsItem *parent = 0);
    36     ~HsWallpaper();
    36     ~HsWallpaper();
    37 
    37 
    38     bool setImagesById(const QString &id = "d",
    38 signals:
    39                        const QString &ext = "png");
    39     void imageSet();
       
    40     void imageSetFailed();
    40 
    41 
    41     bool setImagesByPaths(const QString &landscapeImagePath,
    42 public slots:
    42                           const QString &portraitImagePath);
    43     void setImage(const QString &path);
       
    44     void setDefaultImage();
       
    45     void remove();
    43 
    46 
    44     void setPortraitImage(const QString &path, bool activate = false);
    47 protected:
    45     void setLandscapeImage(const QString &path, bool activate = false);
    48     virtual QString wallpaperDirectory() const = 0;
       
    49     virtual QVariantHash createTargets(const QString &sourcePath) = 0;
    46 
    50 
    47     bool removeImages();
    51     bool setExistingImage();
       
    52     QString rootDirectory() const;
    48 
    53 
    49     static QString wallpaperDirectory();
    54 private:
    50     static QString wallpaperPath(Qt::Orientation orientation,
       
    51                                  const QString &id = "d",
       
    52                                  const QString &ext = "png");
       
    53 
       
    54 private:    
       
    55     Q_DISABLE_COPY(HsWallpaper)
    55     Q_DISABLE_COPY(HsWallpaper)
    56 
    56 
    57 private slots:
    57 private slots:
    58     void onOrientationChanged(Qt::Orientation orientation);
    58     void onLoaderFinished();
       
    59     void onLoaderFailed();
       
    60     void updateIconItem(Qt::Orientation orientation);
       
    61 
       
    62 protected:
       
    63     int mId;
    59 
    64 
    60 private:
    65 private:
    61     QString mLImagePath;
    66     bool mIsDefaultImage;
    62     QString mPImagePath;
    67     QString mPortraitImagePath;
    63     Qt::Orientation mOrientation;
    68     QString mLandscapeImagePath;
       
    69     HbIconItem *mIconItem;
       
    70     HsWallpaperLoader *mLoader;
    64 
    71 
    65     HbIconItem *mIconItem;
    72     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
       
    73 };
       
    74 
       
    75 class HsScene;
       
    76 class HSDOMAINMODEL_EXPORT HsSceneWallpaper : public HsWallpaper
       
    77 {
       
    78     Q_OBJECT
       
    79 
       
    80 public:
       
    81     HsSceneWallpaper(HsScene *scene, QGraphicsItem *parent = 0);
       
    82     ~HsSceneWallpaper();
       
    83 
       
    84     HsScene *scene() const { return mScene; }
       
    85     void setScene(HsScene *scene);
       
    86 
       
    87 protected:
       
    88     QString wallpaperDirectory() const;
       
    89     QVariantHash createTargets(const QString &sourcePath);
       
    90 
       
    91 private:
       
    92     Q_DISABLE_COPY(HsSceneWallpaper)
       
    93 
       
    94 private:
       
    95     HsScene *mScene;
       
    96     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
       
    97 };
       
    98 
       
    99 class HsPage;
       
   100 class HSDOMAINMODEL_EXPORT HsPageWallpaper : public HsWallpaper
       
   101 {
       
   102     Q_OBJECT
       
   103 
       
   104 public:
       
   105     HsPageWallpaper(HsPage *page, QGraphicsItem *parent = 0);
       
   106     ~HsPageWallpaper();
    66     
   107     
    67     HOMESCREEN_TEST_FRIEND_CLASS(TestRuntimeServices)
   108     HsPage *page() const { return mPage; }
       
   109     void setPage(HsPage *page);
       
   110 
       
   111 protected:
       
   112     QString wallpaperDirectory() const;
       
   113     QVariantHash createTargets(const QString &sourcePath);
       
   114 
       
   115 private:
       
   116     Q_DISABLE_COPY(HsPageWallpaper)
       
   117 
       
   118 private:
       
   119     HsPage *mPage;
       
   120     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
    68 };
   121 };
    69 
   122 
    70 #endif // HSWALLPAPER_H
   123 #endif // HSWALLPAPER_H