54 delete valueText; |
54 delete valueText; |
55 } |
55 } |
56 return status; |
56 return status; |
57 } |
57 } |
58 |
58 |
|
59 bool VideoListDataModelPrivate::mReturnInvalidMarked = false; |
|
60 |
59 |
61 |
60 /** |
62 /** |
61 * init failure flag |
63 * init failure flag |
62 */ |
64 */ |
63 bool gFailInit = false; |
65 bool VideoListDataModelPrivate::mFailInit = false; |
64 |
66 |
65 /** |
67 |
66 * override size flag and value |
68 bool VideoListDataModelPrivate::mOverrideSize = false; |
67 */ |
69 quint32 VideoListDataModelPrivate::mSize = 0; |
68 bool gOverrideSize = false; |
70 |
69 quint32 gSize = 0; |
71 bool VideoListDataModelPrivate::mOverrideDuration = false; |
70 |
72 quint32 VideoListDataModelPrivate::mDuration = 0; |
71 /** |
73 |
72 * override duration flag and value |
74 int VideoListDataModelPrivate::mGetVideoCountFail = -1; |
73 */ |
75 |
74 bool gOverrideDuration = false; |
76 bool VideoListDataModelPrivate::mBelongsToAlbum = false; |
75 quint32 gDuration = 0; |
|
76 |
|
77 /** |
|
78 * getVideoCount failure counter. if under 0, never fails |
|
79 * |
|
80 */ |
|
81 int gGetVideoCountFail = -1; |
|
82 |
|
83 ///// |
|
84 // static helpers |
|
85 // ----------------------------------------------------------------------------- |
|
86 // overrideSizeValue |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void VideoListDataModelPrivate::overrideSizeValue(bool override, quint32 value) |
|
90 { |
|
91 gOverrideSize = override; |
|
92 gSize = value; |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // overrideDurationValue |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 void VideoListDataModelPrivate::overrideDurationValue(bool override, float value) |
|
100 { |
|
101 gOverrideDuration = override; |
|
102 gDuration = value; |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // setInitFailureStatus |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 void VideoListDataModelPrivate::setInitFailureStatus(bool fail) |
|
110 { |
|
111 gFailInit = fail; |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // setGetVideoCountFailAfterNCall |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void VideoListDataModelPrivate::setGetVideoCountFailAfterNCall(int counter) |
|
119 { |
|
120 gGetVideoCountFail = counter; |
|
121 } |
|
122 |
77 |
123 // ----------------------------------------------------------------------------- |
78 // ----------------------------------------------------------------------------- |
124 // CVideoListData |
79 // CVideoListData |
125 // ----------------------------------------------------------------------------- |
80 // ----------------------------------------------------------------------------- |
126 // |
81 // |
127 VideoListDataModelPrivate::VideoListDataModelPrivate(VideoListDataModel *model) : |
82 VideoListDataModelPrivate::VideoListDataModelPrivate(VideoListDataModel *model) : |
128 q_ptr(model), |
83 q_ptr(model), |
|
84 mMediaData(*(new DummyData)), |
129 mMediaArray(0) |
85 mMediaArray(0) |
130 { |
86 { |
|
87 mMediaData.mObj = this; |
131 mIcon = QIcon(":/icons/default_thumbnail.svg"); |
88 mIcon = QIcon(":/icons/default_thumbnail.svg"); |
132 } |
89 } |
133 |
90 |
134 // ----------------------------------------------------------------------------- |
91 // ----------------------------------------------------------------------------- |
135 // ~VideoListDataModelPrivate |
92 // ~VideoListDataModelPrivate |
136 // ----------------------------------------------------------------------------- |
93 // ----------------------------------------------------------------------------- |
137 // |
94 // |
138 VideoListDataModelPrivate::~VideoListDataModelPrivate() |
95 VideoListDataModelPrivate::~VideoListDataModelPrivate() |
139 { |
96 { |
|
97 delete &mMediaData; |
140 } |
98 } |
141 |
99 |
142 // ----------------------------------------------------------------------------- |
100 // ----------------------------------------------------------------------------- |
143 // initialize |
101 // initialize |
144 // ----------------------------------------------------------------------------- |
102 // ----------------------------------------------------------------------------- |
145 // |
103 // |
146 int VideoListDataModelPrivate::initialize() |
104 int VideoListDataModelPrivate::initialize() |
147 { |
105 { |
148 if(gFailInit) |
106 if(mFailInit) |
149 { |
107 { |
150 return -1; |
108 return -1; |
151 } |
109 } |
152 |
110 |
153 return 0; |
111 return 0; |
154 } |
112 } |
155 |
113 |
156 // ----------------------------------------------------------------------------- |
114 // ----------------------------------------------------------------------------- |
|
115 // callModelDisconnect |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void VideoListDataModelPrivate::callModelDisconnect() |
|
119 { |
|
120 q_ptr->disconnectSignals(); |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // callModelAsyncReport |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void VideoListDataModelPrivate::callModelAsyncReport(int status, QVariant data) |
|
128 { |
|
129 q_ptr->reportAsyncStatus(status, data); |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
157 // getVideoCount |
133 // getVideoCount |
158 // ----------------------------------------------------------------------------- |
134 // ----------------------------------------------------------------------------- |
159 // |
135 // |
160 int VideoListDataModelPrivate::getVideoCount() |
136 int VideoListDataModelPrivate::getVideoCount() |
161 { |
137 { |
162 int count = 0; |
138 int count = 0; |
163 if(mMediaArray) |
139 if(mMediaArray) |
164 { |
140 { |
165 count = mMediaArray->Count(); |
141 count = mMediaArray->Count(); |
166 } |
142 } |
167 gGetVideoCountFail--; |
143 mGetVideoCountFail--; |
168 if(gGetVideoCountFail == 0) |
144 if(mGetVideoCountFail == 0) |
169 { |
145 { |
170 return 0; |
146 return 0; |
171 } |
147 } |
172 return count; |
148 return count; |
173 } |
149 } |
286 // |
262 // |
287 const QString VideoListDataModelPrivate::getFilePathForId( TMPXItemId mediaId ) const |
263 const QString VideoListDataModelPrivate::getFilePathForId( TMPXItemId mediaId ) const |
288 { |
264 { |
289 return getFilePathFromIndex( indexOfMediaId(mediaId) ); |
265 return getFilePathFromIndex( indexOfMediaId(mediaId) ); |
290 } |
266 } |
|
267 |
|
268 // ----------------------------------------------------------------------------- |
|
269 // getFilePathForId |
|
270 // ----------------------------------------------------------------------------- |
|
271 // |
|
272 bool VideoListDataModelPrivate::belongsToAlbum(TMPXItemId itemId, TMPXItemId albumId) |
|
273 { |
|
274 Q_UNUSED(itemId); |
|
275 Q_UNUSED(albumId); |
|
276 return mBelongsToAlbum; |
|
277 } |
|
278 |
|
279 // ----------------------------------------------------------------------------- |
|
280 // setAlbumInUse |
|
281 // ----------------------------------------------------------------------------- |
|
282 // |
|
283 void VideoListDataModelPrivate::setAlbumInUse(TMPXItemId albumId) |
|
284 { |
|
285 mCurrentAlbum = albumId; |
|
286 } |
|
287 |
291 |
288 |
292 // ----------------------------------------------------------------------------- |
289 // ----------------------------------------------------------------------------- |
293 // getVideoStatusFromIndex |
290 // getVideoStatusFromIndex |
294 // ----------------------------------------------------------------------------- |
291 // ----------------------------------------------------------------------------- |
295 // |
292 // |
306 |
303 |
307 // ----------------------------------------------------------------------------- |
304 // ----------------------------------------------------------------------------- |
308 // markVideoRemoved |
305 // markVideoRemoved |
309 // ----------------------------------------------------------------------------- |
306 // ----------------------------------------------------------------------------- |
310 // |
307 // |
311 QList<TMPXItemId> VideoListDataModelPrivate::markVideosRemoved(const QModelIndexList &indexes) |
308 TMPXItemId VideoListDataModelPrivate::markVideoRemoved(const QModelIndex &itemIndex) |
312 { |
309 { |
313 mItemsUnderDeletion.clear(); |
310 TMPXItemId id = TMPXItemId::InvalidId(); |
314 QList<TMPXItemId> idList; |
311 if(!mReturnInvalidMarked) |
315 if(!mMediaArray) |
312 { |
316 { |
313 if(!itemIndex.isValid() || itemIndex.row() >= mMediaArray->Count()) |
317 return idList; |
314 { |
318 } |
315 return id; |
319 |
316 } |
|
317 id = getMediaIdFromIndex(itemIndex.row()); |
|
318 mItemsUnderDeletion.append(id); |
|
319 } |
|
320 return id; |
|
321 } |
|
322 |
|
323 // ----------------------------------------------------------------------------- |
|
324 // restoreRemoved |
|
325 // ----------------------------------------------------------------------------- |
|
326 // |
|
327 void VideoListDataModelPrivate::restoreRemoved(QList<TMPXItemId> *idList) |
|
328 { |
320 TMPXItemId id; |
329 TMPXItemId id; |
321 QModelIndex index; |
330 foreach(id, *idList) |
322 foreach(index, indexes) |
331 { |
323 { |
332 mItemsUnderDeletion.removeAll(id); |
324 id = getMediaIdFromIndex(index.row()); |
|
325 if(id != TMPXItemId::InvalidId()) |
|
326 { |
|
327 mItemsUnderDeletion.insert(id); |
|
328 idList.append(id); |
|
329 } |
|
330 } |
|
331 return idList; |
|
332 } |
|
333 |
|
334 // ----------------------------------------------------------------------------- |
|
335 // unMarkVideosRemoved |
|
336 // ----------------------------------------------------------------------------- |
|
337 // |
|
338 void VideoListDataModelPrivate::unMarkVideosRemoved(QList<TMPXItemId> &itemIds) |
|
339 { |
|
340 TMPXItemId id; |
|
341 foreach(id, itemIds) |
|
342 { |
|
343 mItemsUnderDeletion.remove(id); |
|
344 } |
333 } |
345 } |
334 } |
346 |
335 |
347 // ----------------------------------------------------------------------------- |
336 // ----------------------------------------------------------------------------- |
348 // getFilePathFromIndex |
337 // getFilePathFromIndex |
426 |
415 |
427 // ----------------------------------------------------------------------------- |
416 // ----------------------------------------------------------------------------- |
428 // appendVideoListSlot |
417 // appendVideoListSlot |
429 // ----------------------------------------------------------------------------- |
418 // ----------------------------------------------------------------------------- |
430 // |
419 // |
431 void VideoListDataModelPrivate::appendVideoListSlot(CMPXMediaArray* /*aVideo*/) |
420 void VideoListDataModelPrivate::appendVideoListSlot(CMPXMediaArray* aVideo) |
432 { |
421 { |
433 // NOP |
422 Q_UNUSED(aVideo); |
434 } |
423 } |
435 |
424 |
436 // ----------------------------------------------------------------------------- |
425 // ----------------------------------------------------------------------------- |
437 // newVideoAvailable |
426 // newVideoAvailable |
438 // ----------------------------------------------------------------------------- |
427 // ----------------------------------------------------------------------------- |
439 // |
428 // |
440 void VideoListDataModelPrivate::newVideoAvailableSlot(CMPXMedia* /*aVideo*/) |
429 void VideoListDataModelPrivate::newVideoAvailableSlot(CMPXMedia* aVideo) |
441 { |
430 { |
442 // NOP |
431 Q_UNUSED(aVideo); |
443 } |
432 } |
444 |
433 |
445 // ----------------------------------------------------------------------------- |
434 // ----------------------------------------------------------------------------- |
446 // videoDeleted |
435 // videoDeleted |
447 // ----------------------------------------------------------------------------- |
436 // ----------------------------------------------------------------------------- |
448 // |
437 // |
449 void VideoListDataModelPrivate::videoDeletedSlot(TMPXItemId /*videoId*/) |
438 void VideoListDataModelPrivate::videoDeletedSlot(TMPXItemId videoId) |
450 { |
439 { |
451 // NOP |
440 Q_UNUSED(videoId); |
452 } |
441 } |
453 |
442 |
454 // ----------------------------------------------------------------------------- |
443 // ----------------------------------------------------------------------------- |
455 // videoDeleteCompleted |
444 // videoDeleteCompleted |
456 // ----------------------------------------------------------------------------- |
445 // ----------------------------------------------------------------------------- |
457 // |
446 // |
458 void VideoListDataModelPrivate::videoDeleteCompletedSlot(int overallCount, QList<TMPXItemId> */*failedMediaIds*/) |
447 void VideoListDataModelPrivate::videoDeleteCompletedSlot(int overallCount, QList<TMPXItemId> *failedMediaIds) |
459 { |
448 { |
|
449 Q_UNUSED(overallCount); |
|
450 Q_UNUSED(failedMediaIds); |
460 mItemsUnderDeletion.clear(); |
451 mItemsUnderDeletion.clear(); |
461 } |
452 } |
462 |
453 |
463 // ----------------------------------------------------------------------------- |
454 // ----------------------------------------------------------------------------- |
464 // videoDetailsCompleted |
455 // videoDetailsCompleted |
465 // ----------------------------------------------------------------------------- |
456 // ----------------------------------------------------------------------------- |
466 // |
457 // |
467 void VideoListDataModelPrivate::videoDetailsCompletedSlot(TMPXItemId /*videoId*/) |
458 void VideoListDataModelPrivate::videoDetailsCompletedSlot(TMPXItemId videoId) |
468 { |
459 { |
469 // NOP |
460 Q_UNUSED(videoId); |
|
461 } |
|
462 |
|
463 // ----------------------------------------------------------------------------- |
|
464 // albumListAvailableSlot |
|
465 // ----------------------------------------------------------------------------- |
|
466 // |
|
467 void VideoListDataModelPrivate::albumListAvailableSlot(TMPXItemId albumId, |
|
468 CMPXMediaArray *albumItems) |
|
469 { |
|
470 Q_UNUSED(albumId); |
|
471 Q_UNUSED(albumItems); |
|
472 } |
|
473 |
|
474 // ----------------------------------------------------------------------------- |
|
475 // albumRemoveFailureSlot |
|
476 // ----------------------------------------------------------------------------- |
|
477 // |
|
478 void VideoListDataModelPrivate::albumRemoveFailureSlot(QList<TMPXItemId> *items) |
|
479 { |
|
480 Q_UNUSED(items); |
|
481 } |
|
482 |
|
483 // ----------------------------------------------------------------------------- |
|
484 // itemDeletedSlot |
|
485 // ----------------------------------------------------------------------------- |
|
486 // |
|
487 void VideoListDataModelPrivate::itemDeletedSlot(TMPXItemId id) |
|
488 { |
|
489 Q_UNUSED(id); |
470 } |
490 } |
471 |
491 |
472 // End of file |
492 // End of file |