|
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: VideoListDataModelPrivate class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 |
|
20 #include <mpxmediageneraldefs.h> |
|
21 #include <thumbnailmanager_qt.h> |
|
22 #include <mpxmediaarray.h> |
|
23 #include <mpxmedia.h> |
|
24 #include <qvariant.h> |
|
25 |
|
26 #include "videolistdatamodel.h" |
|
27 #include "videocollectionwrapper.h" |
|
28 #include "videolistdatamodel_p.h" |
|
29 #include "videothumbnaildata.h" |
|
30 #include "vcxmyvideosdefs.h" |
|
31 #include "videocollectionutils.h" |
|
32 #include "videocollectioncommon.h" |
|
33 |
|
34 /** |
|
35 * private global inline hash function for TMPXItemId keys in QSet |
|
36 */ |
|
37 inline uint qHash(TMPXItemId key) |
|
38 { |
|
39 QPair<uint, uint> keyPair(key.iId1, key.iId2); |
|
40 |
|
41 return qHash(keyPair); |
|
42 } |
|
43 |
|
44 // ================= MEMBER FUNCTIONS ======================= |
|
45 // |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // VideoListDataModelPrivate |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 VideoListDataModelPrivate::VideoListDataModelPrivate(VideoListDataModel *model) : |
|
52 q_ptr(model), |
|
53 mVideoThumbnailData(VideoThumbnailData::instance()), |
|
54 mInitialized(false) |
|
55 { |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // ~VideoListDataModelPrivate |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 VideoListDataModelPrivate::~VideoListDataModelPrivate() |
|
63 { |
|
64 mMediaData.clear(); |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // initialize |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 int VideoListDataModelPrivate::initialize() |
|
72 { |
|
73 if(mInitialized) |
|
74 { |
|
75 return 0; |
|
76 } |
|
77 if(!connect( &mVideoThumbnailData, SIGNAL(thumbnailsFetched( QList<TMPXItemId> )), |
|
78 this, SLOT(thumbnailsFetchedSlot( QList<TMPXItemId> )))) |
|
79 { |
|
80 return -1; |
|
81 } |
|
82 |
|
83 mInitialized = true; |
|
84 return 0; |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // getVideoCount |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 int VideoListDataModelPrivate::getVideoCount() |
|
92 { |
|
93 return mMediaData.count(); |
|
94 } |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // getMediaIdFromIndex |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 TMPXItemId VideoListDataModelPrivate::getMediaIdFromIndex( int index ) const |
|
101 { |
|
102 return mMediaData.idFromIndex(index); |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // getVideoNameFromIndex |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 const QString VideoListDataModelPrivate::getVideoNameFromIndex( int index ) const |
|
110 { |
|
111 QString txt; |
|
112 CMPXMedia* media = mMediaData.fromIndex(index); |
|
113 VideoCollectionUtils::instance().mediaValue<QString>(media, KMPXMediaGeneralTitle, txt ); |
|
114 return txt; |
|
115 } |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // getVideoThumbnailFromIndex |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 const QIcon* VideoListDataModelPrivate::getVideoThumbnailFromIndex( int index ) const |
|
122 { |
|
123 return mVideoThumbnailData.getThumbnail( mMediaData.idFromIndex(index) ); |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // getVideoSizeFromIndex |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 quint32 VideoListDataModelPrivate::getVideoSizeFromIndex( int index ) const |
|
131 { |
|
132 quint32 size(0); |
|
133 CMPXMedia *media = mMediaData.fromIndex(index); |
|
134 VideoCollectionUtils::instance().mediaValue<quint32>(media, KMPXMediaGeneralSize, size ); |
|
135 return size; |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // getVideoAgeProfileFromIndex |
|
140 // --------------------------------------------------------------------------- |
|
141 // |
|
142 quint32 VideoListDataModelPrivate::getVideoAgeProfileFromIndex( int index ) const |
|
143 { |
|
144 quint32 ageProfile(0); |
|
145 CMPXMedia *media = mMediaData.fromIndex(index); |
|
146 VideoCollectionUtils::instance().mediaValue<quint32>(media, KVcxMediaMyVideosAgeProfile, ageProfile ); |
|
147 return ageProfile; |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // getVideodurationFromIndex |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 quint32 VideoListDataModelPrivate::getVideodurationFromIndex( int index ) const |
|
155 { |
|
156 quint32 returnDuration(0); |
|
157 float duration(0); |
|
158 CMPXMedia *media = mMediaData.fromIndex(index); |
|
159 VideoCollectionUtils::instance().mediaValue<float>(media, KVcxMediaMyVideosDuration, duration ); |
|
160 returnDuration = static_cast<quint32>(duration); |
|
161 return returnDuration; |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // getVideoDateFromIndex |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 QDateTime VideoListDataModelPrivate::getVideoDateFromIndex( int index ) const |
|
169 { |
|
170 QDateTime date; |
|
171 quint64 dateTimeValue; |
|
172 if(!VideoCollectionUtils::instance().mediaValue<quint64>(mMediaData.fromIndex(index), KMPXMediaGeneralDate, dateTimeValue)) |
|
173 { |
|
174 return date; |
|
175 } |
|
176 TDateTime temp = TTime( dateTimeValue ).DateTime(); |
|
177 date = QDateTime(QDate(temp.Year(), temp.Month()+1, temp.Day()+1), |
|
178 QTime(temp.Hour(), temp.Minute(), temp.Second(), temp.MicroSecond())); |
|
179 return date; |
|
180 } |
|
181 |
|
182 // ----------------------------------------------------------------------------- |
|
183 // getMetaDataFromIndex |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 QMap<QString, QVariant> VideoListDataModelPrivate::getMetaDataFromIndex(int index) const |
|
187 { |
|
188 using namespace VideoCollectionCommon; |
|
189 QMap<QString, QVariant> map; |
|
190 CMPXMedia *media = mMediaData.fromIndex(index); |
|
191 if(!media) { |
|
192 return map; |
|
193 } |
|
194 |
|
195 // MetaKeyDate |
|
196 QDateTime date = getVideoDateFromIndex(index); |
|
197 if(date.isValid()) { |
|
198 map[MetaKeyDate] = date.date(); |
|
199 } |
|
200 |
|
201 // MetaKeyDurationString |
|
202 quint32 dur = getVideodurationFromIndex(index); |
|
203 QString duration = VideoCollectionUtils::instance().prepareLengthString(dur); |
|
204 if(!duration.isNull() && !duration.isEmpty()) { |
|
205 map[MetaKeyDurationString] = duration; |
|
206 } |
|
207 |
|
208 // MetaKeySizeString |
|
209 quint32 s = getVideoSizeFromIndex(index); |
|
210 QString size = VideoCollectionUtils::instance().prepareSizeString(s); |
|
211 if(!size.isNull() && !size.isEmpty()) { |
|
212 map[MetaKeySizeString] = size; |
|
213 } |
|
214 |
|
215 // MetaKeyStarRating |
|
216 quint8 rating = 0; |
|
217 if(VideoCollectionUtils::instance().mediaValue<quint8>(media, KVcxMediaMyVideosRating, rating)) |
|
218 { |
|
219 map[MetaKeyStarRating] = rating; |
|
220 } |
|
221 |
|
222 // MetaKeyDRMInfo |
|
223 |
|
224 // MetaKeyServiceURL |
|
225 |
|
226 // MetaKeyDescription |
|
227 QString desc; |
|
228 if(VideoCollectionUtils::instance().mediaValue<QString>(media, KMPXMediaGeneralComment, desc)) { |
|
229 map[MetaKeyDescription] = desc; |
|
230 } |
|
231 |
|
232 // MetaKeyModifiedDate |
|
233 quint64 dateTimeValue; |
|
234 if(VideoCollectionUtils::instance().mediaValue<quint64>(media, KVcxMediaMyVideosModifiedDate, dateTimeValue)) { |
|
235 TDateTime temp = TTime( dateTimeValue ).DateTime(); |
|
236 QDateTime date = QDateTime(QDate(temp.Year(), temp.Month()+1, temp.Day()), |
|
237 QTime(temp.Hour(), temp.Minute(), temp.Second(), temp.MicroSecond())); |
|
238 map[MetaKeyModifiedDate] = date.date(); |
|
239 } |
|
240 |
|
241 // MetaKeyShotLocation |
|
242 |
|
243 // MetaKeyAuthor |
|
244 QString author; |
|
245 if(VideoCollectionUtils::instance().mediaValue<QString>(media, KVcxMediaMyVideosAuthor, author)) { |
|
246 map[MetaKeyAuthor] = author; |
|
247 } |
|
248 |
|
249 // MetaKeyCopyright |
|
250 QString copyright; |
|
251 if(VideoCollectionUtils::instance().mediaValue<QString>(media, KMPXMediaGeneralCopyright, copyright)) { |
|
252 map[MetaKeyCopyright] = copyright; |
|
253 } |
|
254 |
|
255 // MetaKeyAudioType |
|
256 |
|
257 // MetaKeyLanguageString |
|
258 QString language; |
|
259 if(VideoCollectionUtils::instance().mediaValue<QString>(media, KVcxMediaMyVideosAudioLanguage, language)) { |
|
260 map[MetaKeyLanguageString] = language; |
|
261 } |
|
262 |
|
263 // MetaKeyKeywords |
|
264 |
|
265 // MetaKeyVideoResolutionString |
|
266 |
|
267 // MetaKeyBitRate |
|
268 |
|
269 // MetaKeyFormat |
|
270 QString format; |
|
271 if(VideoCollectionUtils::instance().mediaValue<QString>(media, KMPXMediaGeneralMimeType, format)) { |
|
272 map[MetaKeyFormat] = format; |
|
273 } |
|
274 |
|
275 return map; |
|
276 } |
|
277 |
|
278 // ----------------------------------------------------------------------------- |
|
279 // getVideoStatusFromIndex |
|
280 // ----------------------------------------------------------------------------- |
|
281 // |
|
282 int VideoListDataModelPrivate::getVideoStatusFromIndex(int index) const |
|
283 { |
|
284 int status = 0; |
|
285 if(mItemsUnderDeletion.contains(getMediaIdFromIndex(index))) |
|
286 { |
|
287 status = VideoCollectionCommon::StatusDeleted; |
|
288 } |
|
289 return status; |
|
290 } |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // markVideosRemoved |
|
294 // ----------------------------------------------------------------------------- |
|
295 // |
|
296 QList<TMPXItemId> VideoListDataModelPrivate::markVideosRemoved(const QModelIndexList &itemIndexes) |
|
297 { |
|
298 QList<TMPXItemId> idList; |
|
299 TMPXItemId id; |
|
300 QModelIndexList::const_iterator iter = itemIndexes.constBegin(); |
|
301 while(iter != itemIndexes.constEnd()) |
|
302 { |
|
303 id = getMediaIdFromIndex((*iter).row()); |
|
304 if(id != TMPXItemId::InvalidId()) |
|
305 { |
|
306 mItemsUnderDeletion.insert(id); |
|
307 idList.append(id); |
|
308 } |
|
309 iter++; |
|
310 } |
|
311 return idList; |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------------- |
|
315 // unMarkVideosRemoved |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 void VideoListDataModelPrivate::unMarkVideosRemoved(QList<TMPXItemId> &itemIds) |
|
319 { |
|
320 QList<TMPXItemId>::const_iterator iter = itemIds.constBegin(); |
|
321 while(iter != itemIds.constEnd()) |
|
322 { |
|
323 mItemsUnderDeletion.remove(*iter); |
|
324 iter++; |
|
325 } |
|
326 } |
|
327 |
|
328 // ----------------------------------------------------------------------------- |
|
329 // getFilePathFromIndex |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 const QString VideoListDataModelPrivate::getFilePathFromIndex(int index) const |
|
333 { |
|
334 QString filePath; |
|
335 VideoCollectionUtils::instance().mediaValue<QString>(mMediaData.fromIndex(index), |
|
336 KMPXMediaGeneralUri, filePath ); |
|
337 return filePath; |
|
338 } |
|
339 |
|
340 // ----------------------------------------------------------------------------- |
|
341 // getFilePathForId |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 const QString VideoListDataModelPrivate::getFilePathForId(TMPXItemId mediaId) const |
|
345 { |
|
346 QString filePath; |
|
347 int index = mMediaData.indexOfId(mediaId); |
|
348 VideoCollectionUtils::instance().mediaValue<QString>(mMediaData.fromIndex(index), |
|
349 KMPXMediaGeneralUri, filePath ); |
|
350 return filePath; |
|
351 } |
|
352 |
|
353 // ----------------------------------------------------------------------------- |
|
354 // getMediaId |
|
355 // ----------------------------------------------------------------------------- |
|
356 // |
|
357 TMPXItemId VideoListDataModelPrivate::getMediaId(const CMPXMedia *media ) const |
|
358 { |
|
359 TMPXItemId mediaId = TMPXItemId::InvalidId(); |
|
360 |
|
361 VideoCollectionUtils::instance().mediaValue<TMPXItemId>(media, KMPXMediaGeneralId, mediaId ); |
|
362 |
|
363 return mediaId; |
|
364 } |
|
365 |
|
366 // ----------------------------------------------------------------------------- |
|
367 // appendDataToContainerL |
|
368 // ----------------------------------------------------------------------------- |
|
369 // |
|
370 void VideoListDataModelPrivate::appendDataToContainerL(CMPXMediaArray *videoArray, unsigned int startIndex) |
|
371 { |
|
372 if(!videoArray || startIndex >= videoArray->Count()) |
|
373 { |
|
374 return; |
|
375 } |
|
376 // get id used check wether we need category or video list masking |
|
377 TMPXItemId mpxFirstId = TMPXItemId::InvalidId(); |
|
378 VideoCollectionUtils::instance().mediaValue<TMPXItemId>(videoArray->AtL(0), KMPXMediaGeneralId, mpxFirstId ); |
|
379 if(mpxFirstId == TMPXItemId::InvalidId()) |
|
380 { |
|
381 // invalid |
|
382 return; |
|
383 } |
|
384 |
|
385 int count = videoArray->Count(); |
|
386 CMPXMedia *newMedia = 0; |
|
387 TMPXItemId itemId = TMPXItemId::InvalidId(); |
|
388 for(int i = startIndex; i < count; ++i) |
|
389 { |
|
390 newMedia = 0; |
|
391 itemId = TMPXItemId::InvalidId(); |
|
392 itemId = getMediaId(videoArray->AtL(i)); |
|
393 // type of list is taken from the first item |
|
394 // remaining items are accepted only if they match the type |
|
395 // TODO: currently albums are filtered out |
|
396 if((mpxFirstId.iId2 == 0 && itemId != TMPXItemId::InvalidId()) || |
|
397 (mpxFirstId.iId2 >= 1 && (itemId.iId1 == KVcxMvcCategoryIdDownloads) || |
|
398 (itemId.iId1 == KVcxMvcCategoryIdCaptured)) && mpxFirstId.iId2 == itemId.iId2) |
|
399 { |
|
400 newMedia = CMPXMedia::NewL(*(videoArray->AtL(i))); |
|
401 mMediaData.append(newMedia); |
|
402 } |
|
403 } |
|
404 } |
|
405 |
|
406 // ----------------------------------------------------------------------------- |
|
407 // thumbnailsFetchedSlot |
|
408 // ----------------------------------------------------------------------------- |
|
409 // |
|
410 void VideoListDataModelPrivate::thumbnailsFetchedSlot(QList<TMPXItemId> mediaIds) |
|
411 { |
|
412 // TODO: find way to optimize dataChanged events |
|
413 |
|
414 TMPXItemId id; |
|
415 QModelIndex rowIndex; |
|
416 |
|
417 while(!mediaIds.isEmpty()) |
|
418 { |
|
419 id = mediaIds.takeFirst(); |
|
420 rowIndex = q_ptr->index(mMediaData.indexOfId(id), 0); |
|
421 if(rowIndex.isValid()) |
|
422 { |
|
423 emit dataChanged( rowIndex, rowIndex); |
|
424 } |
|
425 } |
|
426 } |
|
427 |
|
428 // ----------------------------------------------------------------------------- |
|
429 // newVideoListSlot |
|
430 // ----------------------------------------------------------------------------- |
|
431 // |
|
432 void VideoListDataModelPrivate::newVideoListSlot( CMPXMediaArray *newVideoList ) |
|
433 { |
|
434 if( !newVideoList ) |
|
435 { |
|
436 return; |
|
437 } |
|
438 |
|
439 int count = newVideoList->Count(); |
|
440 |
|
441 // clear old content |
|
442 if((mMediaData.count() > 0)) |
|
443 { |
|
444 q_ptr->beginRemoveRows(QModelIndex(), 0, mMediaData.count() - 1); |
|
445 mMediaData.clear(); |
|
446 q_ptr->endRemoveRows(); |
|
447 } |
|
448 |
|
449 // decide wether we we are inserting new or not, if provided list is empty -> we do not insert any videos |
|
450 count == 0 ? q_ptr->beginInsertRows(QModelIndex(), 0, 0) : q_ptr->beginInsertRows(QModelIndex(), 0, count - 1); |
|
451 |
|
452 TRAP_IGNORE(appendDataToContainerL(newVideoList)); |
|
453 |
|
454 q_ptr->endInsertRows(); |
|
455 emit q_ptr->modelReady(); |
|
456 } |
|
457 |
|
458 // ----------------------------------------------------------------------------- |
|
459 // appendVideoListSlot |
|
460 // ----------------------------------------------------------------------------- |
|
461 // |
|
462 void VideoListDataModelPrivate::appendVideoListSlot(CMPXMediaArray* videoList) |
|
463 { |
|
464 if(!videoList) |
|
465 { |
|
466 return; |
|
467 } |
|
468 if(videoList->Count() == 0 || videoList->Count() <= mMediaData.count()) |
|
469 { |
|
470 // nothing to append or count matches, no changes -> nothing to append |
|
471 return; |
|
472 } |
|
473 |
|
474 // array gotten is in same order as existing data from the start, |
|
475 // so we only need to go throught the appendding array from the index |
|
476 // at position where first new items is excepted to exists. |
|
477 int startIndex = mMediaData.count(); |
|
478 |
|
479 q_ptr->beginInsertRows(QModelIndex(), startIndex, videoList->Count() - 1); |
|
480 |
|
481 TRAP_IGNORE(appendDataToContainerL(videoList, startIndex)); |
|
482 |
|
483 q_ptr->endInsertRows(); |
|
484 } |
|
485 |
|
486 // ----------------------------------------------------------------------------- |
|
487 // newVideoAvailable |
|
488 // ----------------------------------------------------------------------------- |
|
489 // |
|
490 void VideoListDataModelPrivate::newVideoAvailableSlot(CMPXMedia *newVideo) |
|
491 { |
|
492 if(!newVideo ) |
|
493 { |
|
494 return; |
|
495 } |
|
496 |
|
497 // try to get id of the video, if not found consider invalid clip |
|
498 TMPXItemId mediaId = getMediaId(newVideo); |
|
499 if( mediaId == TMPXItemId::InvalidId()) |
|
500 { |
|
501 return; |
|
502 } |
|
503 |
|
504 // append video into list, ownership of provided mediaobject is not transferred, |
|
505 // so we need to create copy of CMPXMedia |
|
506 CMPXMedia *videoToAppend = 0; |
|
507 TRAP_IGNORE(videoToAppend = CMPXMedia::NewL(*newVideo)); |
|
508 |
|
509 q_ptr->beginInsertRows(QModelIndex(), mMediaData.count(), mMediaData.count()); |
|
510 |
|
511 mMediaData.append(videoToAppend); |
|
512 |
|
513 q_ptr->endInsertRows(); |
|
514 |
|
515 } |
|
516 |
|
517 // ----------------------------------------------------------------------------- |
|
518 // videoDeleted |
|
519 // ----------------------------------------------------------------------------- |
|
520 // |
|
521 void VideoListDataModelPrivate::videoDeletedSlot(TMPXItemId videoId) |
|
522 { |
|
523 int index = -1; |
|
524 |
|
525 if(mItemsUnderDeletion.contains(videoId)) |
|
526 { |
|
527 mItemsUnderDeletion.remove(videoId); |
|
528 } |
|
529 index = mMediaData.indexOfId(videoId); |
|
530 |
|
531 if(index >= 0 && index < mMediaData.count()) |
|
532 { |
|
533 q_ptr->beginRemoveRows(QModelIndex(), index, index); |
|
534 mMediaData.remove(videoId); |
|
535 mVideoThumbnailData.removeThumbnail( videoId ); |
|
536 q_ptr->endRemoveRows(); |
|
537 } |
|
538 } |
|
539 |
|
540 // ----------------------------------------------------------------------------- |
|
541 // videoDeleteCompleted |
|
542 // ----------------------------------------------------------------------------- |
|
543 // |
|
544 void VideoListDataModelPrivate::videoDeleteCompletedSlot(int overallCount, QList<TMPXItemId> *failedMediaIds) |
|
545 { |
|
546 // overallCount not used at the moment, since there is no need of |
|
547 // reporting UI about succeed deletion |
|
548 Q_UNUSED(overallCount); |
|
549 |
|
550 if(!failedMediaIds) |
|
551 { |
|
552 return; |
|
553 } |
|
554 QModelIndex failedIndex; |
|
555 int failedCount = 0; |
|
556 |
|
557 // delete requested from UI |
|
558 // go failed list throught and remove all failed from |
|
559 // list under deletion |
|
560 QList<TMPXItemId>::const_iterator iter = failedMediaIds->constBegin(); |
|
561 while(iter != failedMediaIds->constEnd()) |
|
562 { |
|
563 if(mItemsUnderDeletion.contains(*iter)) |
|
564 { |
|
565 // failure found, remove from list and notify UI about changed status |
|
566 failedIndex = q_ptr->index(mMediaData.indexOfId(*iter), 0); |
|
567 mItemsUnderDeletion.remove(*iter); |
|
568 failedCount++; |
|
569 emit dataChanged( failedIndex, failedIndex); |
|
570 } |
|
571 iter++; |
|
572 } |
|
573 // send status throught videocollectionwraper: |
|
574 // - failed status, if some user requested deletion failed: |
|
575 // --- if one item, get name and pass it along signal |
|
576 // --- if multiple items, pass count of items |
|
577 if(failedCount > 0) |
|
578 { |
|
579 VideoCollectionWrapper *wrapper = VideoCollectionWrapper::instance(); |
|
580 QVariant data; |
|
581 if(failedCount == 1) |
|
582 { |
|
583 data = getVideoNameFromIndex(failedIndex.row()); |
|
584 wrapper->sendAsyncStatus(VideoCollectionCommon::statusSingleDeleteFail, data); |
|
585 |
|
586 } |
|
587 else |
|
588 { |
|
589 data = failedCount; |
|
590 wrapper->sendAsyncStatus(VideoCollectionCommon::statusMultipleDeleteFail, data); |
|
591 } |
|
592 wrapper->decreaseReferenceCount(); |
|
593 wrapper = 0; |
|
594 } |
|
595 } |
|
596 |
|
597 // ----------------------------------------------------------------------------- |
|
598 // VideoDetailsCompleted |
|
599 // ----------------------------------------------------------------------------- |
|
600 // |
|
601 void VideoListDataModelPrivate::videoDetailsCompletedSlot(TMPXItemId videoId) |
|
602 { |
|
603 int index = mMediaData.indexOfId(videoId); |
|
604 if(index >= 0) |
|
605 { |
|
606 emit videoDetailsReady(index); |
|
607 } |
|
608 } |
|
609 |
|
610 // End of file |