homescreenapp/hsdomainmodel/inc/hswallpaper.h
author hgs
Fri, 06 Aug 2010 13:36:36 +0300
changeset 71 1db7cc813a4e
parent 62 341166945d65
child 86 e4f038c420f7
permissions -rw-r--r--
201031
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#ifndef HSWALLPAPER_H
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#define HSWALLPAPER_H
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <HbWidget>
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include "hsdomainmodel_global.h"
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include "hstest_global.h"
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 39
diff changeset
    25
class HbIconItem;
62
hgs
parents: 46
diff changeset
    26
class HsWallpaperLoader;
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 39
diff changeset
    27
62
hgs
parents: 46
diff changeset
    28
HOMESCREEN_TEST_CLASS(TestHsDomainModel)
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
class HSDOMAINMODEL_EXPORT HsWallpaper : public HbWidget
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
{
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
    Q_OBJECT
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
public:
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
    HsWallpaper(QGraphicsItem *parent = 0);
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
    ~HsWallpaper();
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
62
hgs
parents: 46
diff changeset
    38
signals:
hgs
parents: 46
diff changeset
    39
    void imageSet();
hgs
parents: 46
diff changeset
    40
    void imageSetFailed();
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 39
diff changeset
    41
62
hgs
parents: 46
diff changeset
    42
public slots:
hgs
parents: 46
diff changeset
    43
    void setImage(const QString &path);
hgs
parents: 46
diff changeset
    44
    void setDefaultImage();
hgs
parents: 46
diff changeset
    45
    void remove();
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 39
diff changeset
    46
62
hgs
parents: 46
diff changeset
    47
protected:
hgs
parents: 46
diff changeset
    48
    virtual QString wallpaperDirectory() const = 0;
hgs
parents: 46
diff changeset
    49
    virtual QVariantHash createTargets(const QString &sourcePath) = 0;
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
62
hgs
parents: 46
diff changeset
    51
    bool setExistingImage();
hgs
parents: 46
diff changeset
    52
    QString rootDirectory() const;
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
62
hgs
parents: 46
diff changeset
    54
private:
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
    Q_DISABLE_COPY(HsWallpaper)
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 39
diff changeset
    57
private slots:
62
hgs
parents: 46
diff changeset
    58
    void onLoaderFinished();
hgs
parents: 46
diff changeset
    59
    void onLoaderFailed();
hgs
parents: 46
diff changeset
    60
    void updateIconItem(Qt::Orientation orientation);
hgs
parents: 46
diff changeset
    61
hgs
parents: 46
diff changeset
    62
protected:
hgs
parents: 46
diff changeset
    63
    int mId;
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 39
diff changeset
    64
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
private:
62
hgs
parents: 46
diff changeset
    66
    bool mIsDefaultImage;
hgs
parents: 46
diff changeset
    67
    QString mPortraitImagePath;
hgs
parents: 46
diff changeset
    68
    QString mLandscapeImagePath;
hgs
parents: 46
diff changeset
    69
    HbIconItem *mIconItem;
hgs
parents: 46
diff changeset
    70
    HsWallpaperLoader *mLoader;
hgs
parents: 46
diff changeset
    71
hgs
parents: 46
diff changeset
    72
    HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
hgs
parents: 46
diff changeset
    73
};
hgs
parents: 46
diff changeset
    74
hgs
parents: 46
diff changeset
    75
class HsScene;
hgs
parents: 46
diff changeset
    76
class HSDOMAINMODEL_EXPORT HsSceneWallpaper : public HsWallpaper
hgs
parents: 46
diff changeset
    77
{
hgs
parents: 46
diff changeset
    78
    Q_OBJECT
hgs
parents: 46
diff changeset
    79
hgs
parents: 46
diff changeset
    80
public:
hgs
parents: 46
diff changeset
    81
    HsSceneWallpaper(HsScene *scene, QGraphicsItem *parent = 0);
hgs
parents: 46
diff changeset
    82
    ~HsSceneWallpaper();
hgs
parents: 46
diff changeset
    83
hgs
parents: 46
diff changeset
    84
    HsScene *scene() const { return mScene; }
hgs
parents: 46
diff changeset
    85
    void setScene(HsScene *scene);
hgs
parents: 46
diff changeset
    86
hgs
parents: 46
diff changeset
    87
protected:
hgs
parents: 46
diff changeset
    88
    QString wallpaperDirectory() const;
hgs
parents: 46
diff changeset
    89
    QVariantHash createTargets(const QString &sourcePath);
hgs
parents: 46
diff changeset
    90
hgs
parents: 46
diff changeset
    91
private:
hgs
parents: 46
diff changeset
    92
    Q_DISABLE_COPY(HsSceneWallpaper)
46
23b5d6a29cce Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 39
diff changeset
    93
62
hgs
parents: 46
diff changeset
    94
private:
hgs
parents: 46
diff changeset
    95
    HsScene *mScene;
hgs
parents: 46
diff changeset
    96
    HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
hgs
parents: 46
diff changeset
    97
};
hgs
parents: 46
diff changeset
    98
hgs
parents: 46
diff changeset
    99
class HsPage;
hgs
parents: 46
diff changeset
   100
class HSDOMAINMODEL_EXPORT HsPageWallpaper : public HsWallpaper
hgs
parents: 46
diff changeset
   101
{
hgs
parents: 46
diff changeset
   102
    Q_OBJECT
hgs
parents: 46
diff changeset
   103
hgs
parents: 46
diff changeset
   104
public:
hgs
parents: 46
diff changeset
   105
    HsPageWallpaper(HsPage *page, QGraphicsItem *parent = 0);
hgs
parents: 46
diff changeset
   106
    ~HsPageWallpaper();
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
    
62
hgs
parents: 46
diff changeset
   108
    HsPage *page() const { return mPage; }
hgs
parents: 46
diff changeset
   109
    void setPage(HsPage *page);
hgs
parents: 46
diff changeset
   110
hgs
parents: 46
diff changeset
   111
protected:
hgs
parents: 46
diff changeset
   112
    QString wallpaperDirectory() const;
hgs
parents: 46
diff changeset
   113
    QVariantHash createTargets(const QString &sourcePath);
hgs
parents: 46
diff changeset
   114
hgs
parents: 46
diff changeset
   115
private:
hgs
parents: 46
diff changeset
   116
    Q_DISABLE_COPY(HsPageWallpaper)
hgs
parents: 46
diff changeset
   117
hgs
parents: 46
diff changeset
   118
private:
hgs
parents: 46
diff changeset
   119
    HsPage *mPage;
hgs
parents: 46
diff changeset
   120
    HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
35
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
};
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
f9ce957a272c Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
#endif // HSWALLPAPER_H