17 |
17 |
18 #include <mpxlog.h> |
18 #include <mpxlog.h> |
19 #include <mpxmedia.h> |
19 #include <mpxmedia.h> |
20 #include <mpxmediaarray.h> |
20 #include <mpxmediaarray.h> |
21 #include <mpxmediacontainerdefs.h> |
21 #include <mpxmediacontainerdefs.h> |
|
22 #include <mpxmediageneraldefs.h> |
22 #include "vcxmyvideosalbum.h" |
23 #include "vcxmyvideosalbum.h" |
23 #include "vcxmyvideoscollectionplugin.h" |
24 #include "vcxmyvideoscollectionplugin.h" |
24 #include "vcxmyvideosvideocache.h" |
25 #include "vcxmyvideosvideocache.h" |
25 #include "vcxmyvideoscollectionutil.h" |
26 #include "vcxmyvideoscollectionutil.h" |
26 |
27 |
109 // --------------------------------------------------------------------------- |
110 // --------------------------------------------------------------------------- |
110 // CVcxMyVideosAlbum::Sort |
111 // CVcxMyVideosAlbum::Sort |
111 // --------------------------------------------------------------------------- |
112 // --------------------------------------------------------------------------- |
112 // |
113 // |
113 void CVcxMyVideosAlbum::Sort() |
114 void CVcxMyVideosAlbum::Sort() |
114 { |
115 { |
115 const TLinearOrder<TVcxMyVideosAlbumVideo> KOrderByMdsId( |
116 const TLinearOrder<TVcxMyVideosAlbumVideo> KOrderByMdsId( |
116 CVcxMyVideosAlbum::CompareVideosByMdsId ); |
117 CVcxMyVideosAlbum::CompareVideosByMdsId ); |
117 |
118 |
118 iVideoList.Sort( KOrderByMdsId ); |
119 iVideoList.Sort( KOrderByMdsId ); |
119 } |
120 } |
218 iVideoList.Compress(); |
219 iVideoList.Compress(); |
219 } |
220 } |
220 } |
221 } |
221 |
222 |
222 // --------------------------------------------------------------------------- |
223 // --------------------------------------------------------------------------- |
223 // CVcxMyVideosAlbum::UpdateAttributesL |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 void CVcxMyVideosAlbum::UpdateAttributesL() |
|
227 { |
|
228 //CalcNewVideoCountAndLatestNonWatchedL(); |
|
229 //CalcPlaytimeL(); |
|
230 } |
|
231 |
|
232 // --------------------------------------------------------------------------- |
|
233 // CVcxMyVideosAlbum::CompareVideosByMdsId |
224 // CVcxMyVideosAlbum::CompareVideosByMdsId |
234 // --------------------------------------------------------------------------- |
225 // --------------------------------------------------------------------------- |
235 // |
226 // |
236 TInt CVcxMyVideosAlbum::CompareVideosByMdsId( const TVcxMyVideosAlbumVideo& aVideo1, |
227 TInt CVcxMyVideosAlbum::CompareVideosByMdsId( const TVcxMyVideosAlbumVideo& aVideo1, |
237 const TVcxMyVideosAlbumVideo& aVideo2 ) |
228 const TVcxMyVideosAlbumVideo& aVideo2 ) |
265 return toVideoList; |
256 return toVideoList; |
266 } |
257 } |
267 |
258 |
268 // --------------------------------------------------------------------------- |
259 // --------------------------------------------------------------------------- |
269 // CVcxMyVideosAlbum::CreateVideoListL |
260 // CVcxMyVideosAlbum::CreateVideoListL |
270 // Appends to video list items which belong to this album. |
261 // Appends to video list the items which belong to this album. |
271 // --------------------------------------------------------------------------- |
262 // --------------------------------------------------------------------------- |
272 // |
263 // |
273 void CVcxMyVideosAlbum::AppendToVideoListL( CMPXMedia& aFromVideoList, |
264 void CVcxMyVideosAlbum::AppendToVideoListL( CMPXMedia& aFromVideoList, |
274 CMPXMedia& aToVideoList, TInt aNewItemStartIndex ) |
265 CMPXMedia& aToVideoList, TInt aNewItemStartIndex ) |
275 { |
266 { |
294 toArray->AppendL( toVideo ); |
285 toArray->AppendL( toVideo ); |
295 CleanupStack::Pop( toVideo ); |
286 CleanupStack::Pop( toVideo ); |
296 } |
287 } |
297 } |
288 } |
298 } |
289 } |
|
290 |
|
291 // --------------------------------------------------------------------------- |
|
292 // CVcxMyVideosAlbum::CalculateAttributesL |
|
293 // --------------------------------------------------------------------------- |
|
294 // |
|
295 void CVcxMyVideosAlbum::CalculateAttributesL( TInt aStartIndex ) |
|
296 { |
|
297 TUint32 count = iVideoList.Count(); |
|
298 iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryItemCount, count ); |
|
299 TInt newCount = 0; |
|
300 CMPXMedia* video; |
|
301 CMPXMedia* latestNewVideo = NULL; |
|
302 TInt pos; |
|
303 TUint32 flags; |
|
304 TInt64 currentItemsCreationDate = 0; |
|
305 TInt64 latestCreationDate = TVcxMyVideosCollectionUtil::CreationDateL( *iMedia ); |
|
306 for ( TInt i = aStartIndex; i < count; i++ ) |
|
307 { |
|
308 video = iCollection.iCache->FindVideoByMdsIdL( iVideoList[i].iMdsId, pos ); |
|
309 if ( video ) |
|
310 { |
|
311 flags = TVcxMyVideosCollectionUtil::FlagsL( *video ); |
|
312 if ( flags & EVcxMyVideosVideoNew ) |
|
313 { |
|
314 newCount++; |
|
315 currentItemsCreationDate = TVcxMyVideosCollectionUtil::CreationDateL( *video ); |
|
316 if ( latestCreationDate < currentItemsCreationDate ) |
|
317 { |
|
318 latestCreationDate = currentItemsCreationDate; |
|
319 latestNewVideo = video; |
|
320 } |
|
321 } |
|
322 } |
|
323 } |
|
324 iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryItemCount, count ); |
|
325 iMedia->SetTObjectValueL<TUint32>( KVcxMediaMyVideosCategoryNewItemCount, newCount ); |
|
326 if ( latestNewVideo ) |
|
327 { |
|
328 iMedia->SetTextValueL( KVcxMediaMyVideosCategoryNewItemName, |
|
329 TVcxMyVideosCollectionUtil::Title( *latestNewVideo ) ); |
|
330 } |
|
331 iMedia->SetTObjectValueL<TInt64>( KMPXMediaGeneralDate, latestCreationDate ); |
|
332 } |
|
333 |