|
1 /* |
|
2 * Copyright (c) 2009 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef GLXFETCHER_H |
|
19 #define GLXFETCHER_H |
|
20 |
|
21 #include <hbmainwindow.h> |
|
22 #include <xqserviceprovider.h> |
|
23 #include <QStringList> |
|
24 #include <xqsharablefile.h> |
|
25 #include <QModelIndex> |
|
26 #include <QAbstractItemModel> |
|
27 |
|
28 //FORWARD CLASS DECLARATION |
|
29 class GlxGetImageService; |
|
30 class GlxImageViewerService; |
|
31 class GlxStateManager; |
|
32 class CGlxImageViewerManager; |
|
33 class GlxGetImageServiceNSDI; |
|
34 class GlxGetImageServiceDSDI; |
|
35 |
|
36 class GlxExternalUtility; |
|
37 /** |
|
38 * This is qthigway service handler class for all services provide by photos. |
|
39 * |
|
40 */ |
|
41 class GlxAiwServiceHandler: public HbMainWindow |
|
42 { |
|
43 Q_OBJECT |
|
44 public: |
|
45 /** |
|
46 * Constructor |
|
47 */ |
|
48 GlxAiwServiceHandler(); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 ~GlxAiwServiceHandler(); |
|
54 |
|
55 /** |
|
56 * launch image fetcher view |
|
57 * @param viewTitle title for image fetcher |
|
58 */ |
|
59 void launchFetcher(QString viewTitle); |
|
60 |
|
61 /** |
|
62 * launch image viewer |
|
63 * @param viewTitle title for image fetcher |
|
64 */ |
|
65 void launchImageViewer(QString viewTitle); |
|
66 |
|
67 public slots: |
|
68 /** |
|
69 * This slot is called when image to be returned to fetcher |
|
70 * client is selected |
|
71 * @param index index of the selected image |
|
72 * @param model model for the current view where image is selected |
|
73 */ |
|
74 void itemSelected(const QModelIndex & index,QAbstractItemModel & model); |
|
75 |
|
76 /** |
|
77 * This slot is called when service client is closed |
|
78 * |
|
79 */ |
|
80 void handleClientDisconnect(); |
|
81 |
|
82 private: |
|
83 /// state manager for the services |
|
84 GlxStateManager *mStateMgr; |
|
85 /// image fetcher service provider |
|
86 GlxGetImageService* mFetcherService; |
|
87 /// image fetcher service provider with new service name and depricated interface name |
|
88 GlxGetImageServiceNSDI* mNSDIService; |
|
89 /// image fetcher service provider with depricated name and depricated inaterface name |
|
90 GlxGetImageServiceDSDI* mDSDIService; |
|
91 GlxImageViewerService* mImageViewerService; |
|
92 GlxExternalUtility *mUtil; |
|
93 }; |
|
94 |
|
95 /** |
|
96 * GlxGetImageService : Image fetcher service provider |
|
97 * |
|
98 */ |
|
99 class GlxGetImageService : public XQServiceProvider |
|
100 { |
|
101 Q_OBJECT |
|
102 public: |
|
103 /** |
|
104 * Constructor |
|
105 */ |
|
106 GlxGetImageService( GlxAiwServiceHandler *parent = 0 ); |
|
107 |
|
108 /** |
|
109 * Destructor. |
|
110 */ |
|
111 ~GlxGetImageService(); |
|
112 |
|
113 /** |
|
114 * check if service is active |
|
115 */ |
|
116 bool isActive(); |
|
117 |
|
118 /** |
|
119 * called to complete fetch service and return to client |
|
120 * @param fileList list of Uri to be returned to client |
|
121 */ |
|
122 void complete( QStringList filesList); |
|
123 |
|
124 public slots: |
|
125 /** |
|
126 * slot for qthighway to notify provider about request |
|
127 */ |
|
128 void fetch(); |
|
129 |
|
130 /** |
|
131 * slot for service provider to notify client about error |
|
132 */ |
|
133 void fetchFailed( int errorCode ); |
|
134 |
|
135 private: |
|
136 /** |
|
137 * called to complete qthighway service |
|
138 * @param fileList list of Uri to be returned to client |
|
139 */ |
|
140 void doComplete( QStringList filesList); |
|
141 |
|
142 private: |
|
143 /// current service request id |
|
144 int mImageRequestIndex; |
|
145 /// service handler for all photos services |
|
146 GlxAiwServiceHandler* mServiceApp; |
|
147 }; |
|
148 |
|
149 /** |
|
150 * Class Description |
|
151 * GlxGetImageServiceDSDI |
|
152 * Service provide for new service and depricated interface |
|
153 */ |
|
154 class GlxGetImageServiceNSDI : public XQServiceProvider |
|
155 { |
|
156 Q_OBJECT |
|
157 public: |
|
158 /** |
|
159 * Constructor |
|
160 */ |
|
161 GlxGetImageServiceNSDI( GlxAiwServiceHandler *parent = 0 ); |
|
162 /** |
|
163 * Destructor. |
|
164 */ |
|
165 ~GlxGetImageServiceNSDI(); |
|
166 |
|
167 /** |
|
168 * check if service is active |
|
169 */ |
|
170 bool isActive(); |
|
171 |
|
172 /** |
|
173 * called to complete fetch service and return to client |
|
174 * @param fileList list of Uri to be returned to client |
|
175 */ |
|
176 void complete( QStringList filesList); |
|
177 |
|
178 public slots: |
|
179 /** |
|
180 * slot for qthighway to notify provider about request |
|
181 */ |
|
182 void fetch( QVariantMap filter , QVariant flag ); |
|
183 |
|
184 /** |
|
185 * slot for qthighway to notify provider about request |
|
186 */ |
|
187 void fetch(); |
|
188 |
|
189 public slots: |
|
190 /** |
|
191 * slot for service provider to notify client about error |
|
192 */ |
|
193 void fetchFailed( int errorCode ); |
|
194 |
|
195 private: |
|
196 /** |
|
197 * called to complete fetch service and return to client |
|
198 * @param fileList list of Uri to be returned to client |
|
199 */ |
|
200 void doComplete( QStringList filesList); |
|
201 |
|
202 private: |
|
203 /// current service request id |
|
204 int mImageRequestIndex; |
|
205 /// service handler for all photos services |
|
206 GlxAiwServiceHandler* mServiceApp; |
|
207 }; |
|
208 |
|
209 /** |
|
210 * GlxGetImageServiceDSDI |
|
211 * Service provide for depricated service and depricated interface |
|
212 */ |
|
213 class GlxGetImageServiceDSDI : public XQServiceProvider |
|
214 { |
|
215 Q_OBJECT |
|
216 public: |
|
217 /** |
|
218 * Constructor |
|
219 */ |
|
220 GlxGetImageServiceDSDI( GlxAiwServiceHandler *parent = 0 ); |
|
221 /** |
|
222 * Destructor. |
|
223 */ |
|
224 ~GlxGetImageServiceDSDI(); |
|
225 |
|
226 /** |
|
227 * check if service is active |
|
228 */ |
|
229 bool isActive(); |
|
230 |
|
231 /** |
|
232 * called to complete fetch service and return to client |
|
233 * @param fileList list of Uri to be returned to client |
|
234 */ |
|
235 void complete( QStringList filesList); |
|
236 |
|
237 public slots: |
|
238 /** |
|
239 * slot for qthighway to notify provider about request |
|
240 */ |
|
241 void fetch( QVariantMap filter, QVariant flag); |
|
242 |
|
243 public slots: |
|
244 /** |
|
245 * slot for service provider to notify client about error |
|
246 */ |
|
247 void fetchFailed( int errorCode ); |
|
248 |
|
249 private: |
|
250 /** |
|
251 * called to complete fetch service and return to client |
|
252 * @param fileList list of Uri to be returned to client |
|
253 */ |
|
254 void doComplete( QStringList filesList); |
|
255 |
|
256 private: |
|
257 /// current service request id |
|
258 int mImageRequestIndex; |
|
259 /// service handler for all photos services |
|
260 GlxAiwServiceHandler* mServiceApp; |
|
261 }; |
|
262 |
|
263 /** |
|
264 * Image viewer service provider |
|
265 */ |
|
266 class GlxImageViewerService : public XQServiceProvider |
|
267 { |
|
268 Q_OBJECT |
|
269 public: |
|
270 /** |
|
271 * Constructor |
|
272 */ |
|
273 GlxImageViewerService( GlxAiwServiceHandler *parent = 0 ); |
|
274 |
|
275 /** |
|
276 * Destructor. |
|
277 */ |
|
278 ~GlxImageViewerService(); |
|
279 |
|
280 /** |
|
281 * compete request |
|
282 * @param ok true id success else false |
|
283 */ |
|
284 void complete(bool ok); |
|
285 |
|
286 /** |
|
287 * check if request is aSync |
|
288 * @return true if async else false |
|
289 */ |
|
290 bool asyncRequest() {return mAsyncRequest;} |
|
291 |
|
292 public slots: |
|
293 /** |
|
294 * slot for qthighway to notify provider about request |
|
295 */ |
|
296 bool view(QString file); |
|
297 |
|
298 /** |
|
299 * slot for qthighway to notify provider about request |
|
300 */ |
|
301 bool view(XQSharableFile file); |
|
302 |
|
303 private: |
|
304 /// service handler for all photos services |
|
305 GlxAiwServiceHandler* mServiceApp; |
|
306 /// current request id |
|
307 int mAsyncReqId; |
|
308 bool mRetValue; |
|
309 bool mAsyncRequest; |
|
310 /// image viewer manager instance to get info regarding file |
|
311 CGlxImageViewerManager* mImageViewerInstance; |
|
312 }; |
|
313 |
|
314 |
|
315 #endif //GLXFETCHER_H |