30
|
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: stubclass of videolistdata for testing VideoListDataModel class methods*
|
|
15 |
*/
|
|
16 |
|
|
17 |
|
|
18 |
#ifndef __VIDEOLISTDATA_H__
|
|
19 |
#define __VIDEOLISTDATA_H__
|
|
20 |
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <QObject>
|
|
24 |
#include <QDate>
|
|
25 |
#include <QIcon>
|
|
26 |
#include <QSet>
|
|
27 |
#include <qabstractitemmodel.h>
|
|
28 |
#include "videodatasignalreceiver.h"
|
|
29 |
|
|
30 |
|
|
31 |
// FORWARD DECLARATIONS
|
|
32 |
class CMPXMediaArray;
|
|
33 |
class VideoThumbnailData;
|
|
34 |
|
|
35 |
|
|
36 |
class VideoListDataModel;
|
|
37 |
class CMPXMediaArray;
|
34
|
38 |
class DummyData;
|
|
39 |
|
|
40 |
|
|
41 |
|
30
|
42 |
|
|
43 |
class VideoListDataModelPrivate : public VideoDataSignalReceiver
|
|
44 |
{
|
|
45 |
/**
|
|
46 |
* define to be able to use signals and slots
|
|
47 |
*/
|
|
48 |
Q_OBJECT
|
|
49 |
|
|
50 |
/**
|
|
51 |
* disable copy-constructor and assignment operator
|
|
52 |
*/
|
|
53 |
Q_DISABLE_COPY(VideoListDataModelPrivate)
|
34
|
54 |
|
|
55 |
friend class DummyData;
|
|
56 |
|
30
|
57 |
public:
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Default constructor
|
|
61 |
*/
|
|
62 |
VideoListDataModelPrivate(VideoListDataModel *model);
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Destructor
|
|
66 |
*/
|
|
67 |
~VideoListDataModelPrivate();
|
|
68 |
|
|
69 |
/**
|
|
70 |
* returns 0 or -1 based on global init failure flag
|
|
71 |
* if flag is true, return 0
|
|
72 |
*
|
|
73 |
* @return int 0 or -1
|
|
74 |
*/
|
|
75 |
int initialize();
|
|
76 |
|
34
|
77 |
/**
|
|
78 |
* calls model's sidconnect -method (implemented for coverity's sake)
|
|
79 |
*/
|
|
80 |
void callModelDisconnect();
|
|
81 |
|
|
82 |
/**
|
|
83 |
* calls model object's reportAsyncStatus
|
|
84 |
*/
|
|
85 |
void callModelAsyncReport(int status, QVariant data);
|
|
86 |
|
30
|
87 |
signals:
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Not emitted from here but had to be defined in order to
|
|
91 |
* get stub into use to testable object
|
|
92 |
*/
|
|
93 |
void dataChanged(const QModelIndex &startIndex, const QModelIndex &endIndex);
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Not emitted from here but had to be defined in order to
|
|
97 |
* get stub into use to testable object
|
|
98 |
*/
|
34
|
99 |
void videoDetailsReady(TMPXItemId index);
|
30
|
100 |
|
|
101 |
|
|
102 |
public: // services
|
|
103 |
|
|
104 |
/**
|
|
105 |
* return count of mMediaArray
|
|
106 |
*
|
|
107 |
* @rerurn int
|
|
108 |
*/
|
|
109 |
int getVideoCount();
|
|
110 |
|
|
111 |
/**
|
|
112 |
* return video id of the item at given index
|
|
113 |
*
|
|
114 |
* @param index
|
|
115 |
* @return int
|
|
116 |
*/
|
34
|
117 |
TMPXItemId getMediaIdFromIndex(int index) const;
|
30
|
118 |
|
|
119 |
/**
|
|
120 |
* return video path of the item with given media id
|
|
121 |
*
|
|
122 |
* @param mediaId
|
|
123 |
* @return int
|
|
124 |
*/
|
|
125 |
const QString getFilePathForId(TMPXItemId mediaId) const;
|
|
126 |
|
|
127 |
/**
|
|
128 |
* return name of the item at given index
|
|
129 |
*
|
|
130 |
* @param index
|
|
131 |
* @return QString
|
|
132 |
*/
|
|
133 |
const QString getVideoNameFromIndex( int index ) const;
|
|
134 |
|
|
135 |
/**
|
|
136 |
* return default tn always
|
|
137 |
*
|
|
138 |
* @param index
|
|
139 |
* @return QIcon
|
|
140 |
*/
|
|
141 |
const QIcon* getVideoThumbnailFromIndex( int index ) const;
|
|
142 |
|
|
143 |
/**
|
35
|
144 |
* return video count of the item at given index
|
|
145 |
*
|
|
146 |
* @param index
|
|
147 |
* @return quint32
|
|
148 |
*/
|
|
149 |
quint32 VideoListDataModelPrivate::getCategoryVideoCountFromIndex( int index ) const;
|
|
150 |
|
|
151 |
/**
|
30
|
152 |
* return video size of the item at given index
|
|
153 |
*
|
|
154 |
* @param index
|
|
155 |
* @return quint32
|
|
156 |
*/
|
|
157 |
quint32 getVideoSizeFromIndex( int index ) const;
|
|
158 |
|
|
159 |
/**
|
|
160 |
* return video age profile of the item at given index
|
|
161 |
*
|
|
162 |
* @param index
|
|
163 |
* @return quint32
|
|
164 |
*/
|
|
165 |
quint32 getVideoAgeProfileFromIndex( int index ) const;
|
|
166 |
|
|
167 |
/**
|
|
168 |
* return video duration of the item at given index
|
|
169 |
*
|
|
170 |
* @param index
|
|
171 |
* @return quint32
|
|
172 |
*/
|
|
173 |
quint32 getVideodurationFromIndex( int index ) const;
|
|
174 |
|
|
175 |
/**
|
|
176 |
* return video creation datetime of the item at given index
|
|
177 |
*
|
|
178 |
* @param index
|
|
179 |
* @return QDateTime
|
|
180 |
*/
|
|
181 |
QDateTime getVideoDateFromIndex( int index ) const;
|
|
182 |
|
|
183 |
/**
|
|
184 |
* Returns the metadata for the video.
|
|
185 |
*
|
|
186 |
* @param index: item position where client wants the date from.
|
|
187 |
* @return QMap map of the QVariants that hold the data. Keys defined
|
|
188 |
* in VideoCollectionCommon
|
|
189 |
*/
|
|
190 |
QMap<QString, QVariant> getMetaDataFromIndex(int index) const;
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Returns video status
|
|
194 |
*
|
|
195 |
* @param index: item position where client wants the date from.
|
|
196 |
*
|
|
197 |
* @return int status code
|
|
198 |
*/
|
|
199 |
int getVideoStatusFromIndex(int index) const;
|
|
200 |
|
|
201 |
/**
|
34
|
202 |
* marks videos to be removed: it's id and index are saved to
|
|
203 |
* remove buffer in data container
|
30
|
204 |
*
|
34
|
205 |
* @param itemIndex: index of item to be removed
|
|
206 |
* @return TMPXItemId: id of the item marked
|
30
|
207 |
*
|
|
208 |
*/
|
34
|
209 |
TMPXItemId markVideoRemoved(const QModelIndex &itemIndex);
|
30
|
210 |
|
|
211 |
/**
|
|
212 |
* Removes provided ids from the remove -list
|
|
213 |
*
|
|
214 |
* @param itemIds ids of the items to be removed
|
|
215 |
*/
|
34
|
216 |
void restoreRemoved(QList<TMPXItemId> *idList);
|
30
|
217 |
|
|
218 |
/**
|
|
219 |
* Returns the file path of the video.
|
|
220 |
*
|
|
221 |
* @param index: item position where client wants the file path from.
|
|
222 |
*/
|
|
223 |
const QString getFilePathFromIndex(int index) const;
|
34
|
224 |
|
|
225 |
/**
|
|
226 |
* returns mBelongsToAlbum;
|
|
227 |
*/
|
|
228 |
bool belongsToAlbum(TMPXItemId itemId, TMPXItemId albumId);
|
|
229 |
|
|
230 |
/**
|
|
231 |
* returns mBelongsToAlbum;
|
|
232 |
*/
|
|
233 |
void setAlbumInUse(TMPXItemId albumId);
|
|
234 |
|
35
|
235 |
/**
|
|
236 |
* returns mRemoveFrAlbumReturn
|
|
237 |
*/
|
|
238 |
int removeItemsFromAlbum(TMPXItemId &albumId, const QList<TMPXItemId> &ids);
|
|
239 |
|
|
240 |
|
30
|
241 |
private: // private methods
|
|
242 |
|
|
243 |
/**
|
|
244 |
* return id of given item
|
|
245 |
*
|
|
246 |
* @param CMPXMedia
|
|
247 |
* @return TMPXItemId
|
|
248 |
*/
|
|
249 |
TMPXItemId getMediaId(const CMPXMedia *media ) const;
|
|
250 |
|
|
251 |
/**
|
|
252 |
* return item from given index of given item
|
|
253 |
*
|
|
254 |
* @param index
|
|
255 |
* @return CMPXMedia
|
|
256 |
*/
|
|
257 |
CMPXMedia* getMediaFromIndex( int index ) const;
|
|
258 |
|
|
259 |
/**
|
|
260 |
* return index of item of given id
|
|
261 |
*
|
|
262 |
* @param mediaId
|
|
263 |
* @return int
|
|
264 |
*/
|
|
265 |
int indexOfMediaId(TMPXItemId mediaId) const;
|
|
266 |
|
|
267 |
|
|
268 |
public slots:
|
|
269 |
|
|
270 |
/**
|
|
271 |
* ssaves given list to mMediaArray
|
|
272 |
*
|
|
273 |
* @param aVideoList: video list
|
|
274 |
*
|
|
275 |
*/
|
|
276 |
void newVideoListSlot(CMPXMediaArray* aVideoList);
|
|
277 |
|
|
278 |
/**
|
|
279 |
* not used in stub
|
|
280 |
*
|
|
281 |
*/
|
|
282 |
void appendVideoListSlot(CMPXMediaArray * videoList);
|
|
283 |
|
|
284 |
/**
|
|
285 |
* not used in stub
|
|
286 |
*
|
|
287 |
*/
|
|
288 |
void newVideoAvailableSlot(CMPXMedia* aVideo);
|
|
289 |
|
|
290 |
/**
|
|
291 |
* not used in stub
|
|
292 |
*
|
|
293 |
*/
|
|
294 |
void videoDeletedSlot(TMPXItemId videoId);
|
|
295 |
|
|
296 |
/**
|
|
297 |
* used to clear mItemsUnderDeletion for this stub
|
|
298 |
*
|
|
299 |
*/
|
|
300 |
void videoDeleteCompletedSlot(int overallCount,QList<TMPXItemId> *failedMediaIds);
|
|
301 |
|
|
302 |
/**
|
|
303 |
* not used in stub
|
|
304 |
*
|
|
305 |
*/
|
|
306 |
void videoDetailsCompletedSlot(TMPXItemId videoId);
|
34
|
307 |
|
|
308 |
/**
|
|
309 |
* not used in stub
|
|
310 |
*/
|
|
311 |
void albumListAvailableSlot(TMPXItemId albumId, CMPXMediaArray *albumItems);
|
|
312 |
|
|
313 |
/**
|
|
314 |
* not used in stub
|
|
315 |
*/
|
|
316 |
void albumRemoveFailureSlot(QList<TMPXItemId> *items);
|
|
317 |
|
|
318 |
/**
|
|
319 |
* not used in stub
|
|
320 |
*/
|
|
321 |
void itemDeletedSlot(TMPXItemId id);
|
|
322 |
|
|
323 |
public:
|
30
|
324 |
|
|
325 |
/**
|
|
326 |
* Pointer to the public class
|
|
327 |
* Not own.
|
|
328 |
*/
|
|
329 |
VideoListDataModel *q_ptr;
|
|
330 |
|
|
331 |
/**
|
34
|
332 |
* dummy media data wrapper
|
|
333 |
*/
|
|
334 |
DummyData &mMediaData;
|
|
335 |
|
|
336 |
/**
|
30
|
337 |
* pointer to shared-array of medias
|
|
338 |
*/
|
|
339 |
CMPXMediaArray *mMediaArray;
|
|
340 |
|
|
341 |
/**
|
|
342 |
* default icon
|
|
343 |
*/
|
|
344 |
QIcon mIcon;
|
|
345 |
|
|
346 |
/**
|
|
347 |
* marked as removed -map
|
|
348 |
*/
|
34
|
349 |
QList<TMPXItemId> mItemsUnderDeletion;
|
|
350 |
|
|
351 |
/**
|
|
352 |
* setted in setAlbumInUse
|
|
353 |
*/
|
|
354 |
TMPXItemId mCurrentAlbum;
|
|
355 |
|
|
356 |
/**
|
|
357 |
* if true, markVideoRemoved returns invalid id
|
|
358 |
*/
|
|
359 |
static bool mReturnInvalidMarked;
|
|
360 |
|
|
361 |
/**
|
|
362 |
* if true, initialize fails
|
|
363 |
*/
|
|
364 |
static bool mFailInit;
|
|
365 |
|
|
366 |
/**
|
35
|
367 |
* if true, size returned is mVideoCount
|
|
368 |
*/
|
|
369 |
static bool mOverrideVideoCount;
|
|
370 |
|
|
371 |
/**
|
|
372 |
* override video count value
|
|
373 |
*/
|
|
374 |
static quint32 mVideoCount;
|
|
375 |
|
|
376 |
/**
|
34
|
377 |
* if true, size returned is mSize
|
|
378 |
*/
|
|
379 |
static bool mOverrideSize;
|
|
380 |
|
|
381 |
/**
|
|
382 |
* overrided size value
|
|
383 |
*/
|
|
384 |
static quint32 mSize;
|
|
385 |
|
|
386 |
/**
|
|
387 |
* if true, dureation returned is mDuration
|
|
388 |
*/
|
|
389 |
static bool mOverrideDuration;
|
|
390 |
|
|
391 |
/**
|
|
392 |
* overrided duration
|
|
393 |
*/
|
|
394 |
static quint32 mDuration;
|
|
395 |
|
|
396 |
/**
|
|
397 |
* value from videocount to be returned
|
|
398 |
*/
|
|
399 |
static int mGetVideoCountFail;
|
|
400 |
|
|
401 |
/**
|
|
402 |
* value from belongsToAlbum to be returned
|
|
403 |
*/
|
|
404 |
static bool mBelongsToAlbum;
|
30
|
405 |
|
35
|
406 |
/**
|
|
407 |
* value returned from removeItemsFromAlbum
|
|
408 |
*/
|
|
409 |
static int mRemoveFrAlbumReturn;
|
|
410 |
|
30
|
411 |
};
|
34
|
412 |
|
|
413 |
/**
|
|
414 |
* dummy data wrapper class
|
|
415 |
*/
|
|
416 |
class DummyData
|
|
417 |
{
|
|
418 |
public:
|
|
419 |
|
|
420 |
int indexOfId(TMPXItemId id)
|
|
421 |
{
|
|
422 |
if(!mObj->mMediaArray)
|
|
423 |
{
|
|
424 |
return -1;
|
|
425 |
}
|
|
426 |
|
|
427 |
for(int i = 0; i < mObj->getVideoCount(); ++i)
|
|
428 |
{
|
|
429 |
if(id == mObj->getMediaIdFromIndex(i))
|
|
430 |
{
|
|
431 |
return i;
|
|
432 |
}
|
|
433 |
}
|
|
434 |
return -1;
|
|
435 |
}
|
|
436 |
|
|
437 |
VideoListDataModelPrivate *mObj;
|
|
438 |
};
|
|
439 |
|
30
|
440 |
#endif // __VIDEOLISTDATA_H__
|
|
441 |
|
|
442 |
// End of file
|
|
443 |
|
|
444 |
|
|
445 |
|