90
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <QVariantHash>
|
|
19 |
#include <QGraphicsLinearLayout>
|
|
20 |
|
|
21 |
#include <HbIconItem>
|
|
22 |
|
|
23 |
#include "hswallpaper.h"
|
|
24 |
#include "hsscene.h"
|
|
25 |
#include "hspage.h"
|
|
26 |
|
|
27 |
/*!
|
|
28 |
|
|
29 |
*/
|
|
30 |
|
|
31 |
/*!
|
|
32 |
|
|
33 |
*/
|
|
34 |
HsWallpaper::HsWallpaper(QGraphicsItem *parent)
|
|
35 |
: HbWidget(parent),
|
|
36 |
mIsDefaultImage(false),
|
|
37 |
mIconItem(0)
|
|
38 |
{
|
|
39 |
setFlag(ItemHasNoContents);
|
|
40 |
setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored);
|
|
41 |
|
|
42 |
mIconItem = new HbIconItem();
|
|
43 |
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout;
|
|
44 |
layout->setContentsMargins(0, 0, 0, 0);
|
|
45 |
layout->addItem(mIconItem);
|
|
46 |
setLayout(layout);
|
|
47 |
}
|
|
48 |
|
|
49 |
/*!
|
|
50 |
|
|
51 |
*/
|
|
52 |
HsWallpaper::~HsWallpaper()
|
|
53 |
{
|
|
54 |
}
|
|
55 |
|
|
56 |
/*!
|
|
57 |
|
|
58 |
*/
|
|
59 |
void HsWallpaper::setImage(const QString &path)
|
|
60 |
{
|
|
61 |
if (!path.isEmpty()) {
|
|
62 |
emit imageSet();
|
|
63 |
} else {
|
|
64 |
emit imageSetFailed();
|
|
65 |
}
|
|
66 |
}
|
|
67 |
|
|
68 |
void HsWallpaper::setImages(const QString &portraitFileName, const QString &landscapeFileName)
|
|
69 |
{
|
|
70 |
Q_UNUSED(portraitFileName)
|
|
71 |
Q_UNUSED(landscapeFileName)
|
|
72 |
emit imageSet();
|
|
73 |
}
|
|
74 |
|
|
75 |
/*!
|
|
76 |
|
|
77 |
*/
|
|
78 |
void HsWallpaper::setDefaultImage()
|
|
79 |
{
|
|
80 |
}
|
|
81 |
|
|
82 |
/*!
|
|
83 |
|
|
84 |
*/
|
|
85 |
void HsWallpaper::remove()
|
|
86 |
{
|
|
87 |
mPortraitImagePath.clear();
|
|
88 |
mLandscapeImagePath.clear();
|
|
89 |
}
|
|
90 |
|
|
91 |
/*!
|
|
92 |
|
|
93 |
*/
|
|
94 |
bool HsWallpaper::setExistingImage()
|
|
95 |
{
|
|
96 |
return true;
|
|
97 |
}
|
|
98 |
|
|
99 |
QString HsWallpaper::rootDirectory() const
|
|
100 |
{
|
|
101 |
return QString();
|
|
102 |
}
|
|
103 |
|
|
104 |
/*!
|
|
105 |
|
|
106 |
*/
|
|
107 |
void HsWallpaper::onLoaderFinished()
|
|
108 |
{
|
|
109 |
emit imageSet();
|
|
110 |
}
|
|
111 |
|
|
112 |
/*!
|
|
113 |
|
|
114 |
*/
|
|
115 |
void HsWallpaper::onLoaderFailed()
|
|
116 |
{
|
|
117 |
emit imageSetFailed();
|
|
118 |
}
|
|
119 |
|
|
120 |
/*!
|
|
121 |
|
|
122 |
*/
|
|
123 |
void HsWallpaper::updateIconItem(Qt::Orientation orientation)
|
|
124 |
{
|
|
125 |
Q_UNUSED(orientation);
|
|
126 |
}
|
|
127 |
|
|
128 |
/*!
|
|
129 |
|
|
130 |
*/
|
|
131 |
HsSceneWallpaper::HsSceneWallpaper(HsScene *scene, QGraphicsItem *parent)
|
|
132 |
: HsWallpaper(parent),
|
|
133 |
mScene(0)
|
|
134 |
{
|
|
135 |
setScene(scene);
|
|
136 |
}
|
|
137 |
|
|
138 |
/*!
|
|
139 |
|
|
140 |
*/
|
|
141 |
HsSceneWallpaper::~HsSceneWallpaper()
|
|
142 |
{
|
|
143 |
}
|
|
144 |
|
|
145 |
/*!
|
|
146 |
|
|
147 |
*/
|
|
148 |
void HsSceneWallpaper::setScene(HsScene *scene)
|
|
149 |
{
|
|
150 |
Q_UNUSED(scene);
|
|
151 |
}
|
|
152 |
|
|
153 |
/*!
|
|
154 |
|
|
155 |
*/
|
|
156 |
QString HsSceneWallpaper::wallpaperDirectory() const
|
|
157 |
{
|
|
158 |
return QString();
|
|
159 |
}
|
|
160 |
|
|
161 |
/*!
|
|
162 |
|
|
163 |
*/
|
|
164 |
QVariantHash HsSceneWallpaper::createTargets(const QString &sourcePath)
|
|
165 |
{
|
|
166 |
Q_UNUSED(sourcePath);
|
|
167 |
return QVariantHash();
|
|
168 |
}
|
|
169 |
|
|
170 |
/*!
|
|
171 |
PAGE
|
|
172 |
*/
|
|
173 |
HsPageWallpaper::HsPageWallpaper(HsPage *page, QGraphicsItem *parent)
|
|
174 |
: HsWallpaper(parent),
|
|
175 |
mPage(0)
|
|
176 |
{
|
|
177 |
setPage(page);
|
|
178 |
}
|
|
179 |
|
|
180 |
/*!
|
|
181 |
|
|
182 |
*/
|
|
183 |
HsPageWallpaper::~HsPageWallpaper()
|
|
184 |
{
|
|
185 |
}
|
|
186 |
|
|
187 |
/*!
|
|
188 |
|
|
189 |
*/
|
|
190 |
void HsPageWallpaper::setPage(HsPage *page)
|
|
191 |
{
|
|
192 |
if (!page) {
|
|
193 |
return;
|
|
194 |
}
|
|
195 |
|
|
196 |
mPage = page;
|
|
197 |
mId = page->databaseId();
|
|
198 |
}
|
|
199 |
|
|
200 |
/*!
|
|
201 |
|
|
202 |
*/
|
|
203 |
QString HsPageWallpaper::wallpaperDirectory() const
|
|
204 |
{
|
|
205 |
return QString();
|
|
206 |
}
|
|
207 |
|
|
208 |
/*!
|
|
209 |
|
|
210 |
*/
|
|
211 |
QVariantHash HsPageWallpaper::createTargets(const QString &sourcePath)
|
|
212 |
{
|
|
213 |
Q_UNUSED(sourcePath);
|
|
214 |
return QVariantHash();
|
|
215 |
}
|
|
216 |
|