|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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: UI level handler for category data.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <StringLoader.h> |
|
22 |
|
23 #include <mpxmediageneraldefs.h> |
|
24 #include <mpxmedia.h> |
|
25 #include <mpxmediaarray.h> |
|
26 |
|
27 #include <ganes/HgScroller.h> |
|
28 #include <ganes/HgItem.h> |
|
29 #include <ganes/HgDoubleGraphicList.h> |
|
30 |
|
31 #include <thumbnailmanager.h> |
|
32 #include <thumbnailmanagerobserver.h> |
|
33 #include <thumbnailobjectsource.h> |
|
34 #include <thumbnaildata.h> |
|
35 #include <gulicon.h> |
|
36 #include <AknsUtils.h> |
|
37 #include <AknUtils.h> |
|
38 #include <aknlayoutscalable_avkon.cdl.h> |
|
39 #include <coemain.h> |
|
40 #include <aknappui.h> |
|
41 #include <bautils.h> |
|
42 |
|
43 #include <vcxhgmyvideosicons.mbg> |
|
44 #include <myvideosindicator.h> |
|
45 #include <vcxhgmyvideos.rsg> |
|
46 #include <vcxmyvideosdefs.h> |
|
47 #include <vcxmyvideosuids.h> |
|
48 #include "IptvDebug.h" |
|
49 |
|
50 #include "vcxhgmyvideoscategorymodelhandler.h" |
|
51 #include "vcxhgmyvideosmodel.h" |
|
52 #include "vcxhgmyvideoscollectionclient.h" |
|
53 #include "vcxhgmyvideosthumbnailmanager.h" |
|
54 #include "vcxhgmyvideoscenrepkeys.h" |
|
55 |
|
56 _LIT( KVcxHgMyVideosMifFile, "\\resource\\apps\\vcxhgmyvideosicons.mif" ); |
|
57 |
|
58 // ============================ MEMBER FUNCTIONS =============================== |
|
59 |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CVcxHgMyVideosCategoryModelHandler::NewL() |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CVcxHgMyVideosCategoryModelHandler* CVcxHgMyVideosCategoryModelHandler::NewL( |
|
66 CVcxHgMyVideosModel& aModel, |
|
67 CHgScroller& aScroller ) |
|
68 { |
|
69 CVcxHgMyVideosCategoryModelHandler* self = |
|
70 new (ELeave) CVcxHgMyVideosCategoryModelHandler( aModel, aScroller ); |
|
71 |
|
72 return self; |
|
73 } |
|
74 |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CVcxHgMyVideosCategoryModelHandler::CVcxHgMyVideosCategoryModelHandler() |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 CVcxHgMyVideosCategoryModelHandler::CVcxHgMyVideosCategoryModelHandler( |
|
81 CVcxHgMyVideosModel& aModel, CHgScroller& aScroller ) |
|
82 : iModel( aModel ), |
|
83 iScroller( aScroller ), |
|
84 iTnManager( aModel.ThumbnailManager() ), |
|
85 iTnRequestId( KErrNotFound ) |
|
86 { |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CVcxHgMyVideosCategoryModelHandler::~CVcxHgMyVideosCategoryModelHandler() |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 CVcxHgMyVideosCategoryModelHandler::~CVcxHgMyVideosCategoryModelHandler() |
|
94 { |
|
95 delete iCategoryList; |
|
96 delete iVideoIndicator; |
|
97 |
|
98 iCategoryIdArray.Reset(); |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CVcxHgMyVideosCategoryModelHandler::DoModelActivateL() |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CVcxHgMyVideosCategoryModelHandler::DoModelActivateL() |
|
106 { |
|
107 IPTVLOGSTRING_LOW_LEVEL( |
|
108 "MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::DoModelActivateL() - Enter" ); |
|
109 |
|
110 UpdateCategoryListL(); |
|
111 |
|
112 iModel.CollectionClient().SetCategoryModelObserver( this ); |
|
113 |
|
114 iTnManager.AddObserverL( *this ); |
|
115 |
|
116 IPTVLOGSTRING_LOW_LEVEL( |
|
117 "MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::DoModelActivateL() - Exit" ); |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CVcxHgMyVideosCategoryModelHandler::DoModelDeactivate() |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 void CVcxHgMyVideosCategoryModelHandler::DoModelDeactivate() |
|
125 { |
|
126 IPTVLOGSTRING_LOW_LEVEL( |
|
127 "MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::DoModelDeactivate() - Enter" ); |
|
128 |
|
129 iModel.CollectionClient().SetCategoryModelObserver( NULL ); |
|
130 |
|
131 iTnManager.RemoveObserver( *this ); |
|
132 |
|
133 TRAP_IGNORE( ClearLastWatchedIconL() ) |
|
134 |
|
135 IPTVLOGSTRING_LOW_LEVEL( |
|
136 "MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::DoModelDeactivate() - Exit" ); |
|
137 } |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // CVcxHgMyVideosCategoryModelHandler::GetCategoryListL() |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 void CVcxHgMyVideosCategoryModelHandler::GetCategoryListL() |
|
144 { |
|
145 IPTVLOGSTRING_LOW_LEVEL( |
|
146 "MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::GetCategoryListL() - Enter" ); |
|
147 |
|
148 iModel.CollectionClient().GetCategoryListL(); |
|
149 |
|
150 IPTVLOGSTRING_LOW_LEVEL( |
|
151 "MPX My Videos UI # CVcxHgMyVideosCategoryModelHandler::GetCategoryListL() - Exit" ); |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CVcxHgMyVideosCategoryModelHandler::Highlight() |
|
156 // ----------------------------------------------------------------------------- |
|
157 // |
|
158 TInt CVcxHgMyVideosCategoryModelHandler::Highlight() |
|
159 { |
|
160 return iScroller.SelectedIndex(); |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // CVcxHgMyVideosCategoryModelHandler::GetCategoryNameLC() |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 HBufC* CVcxHgMyVideosCategoryModelHandler::GetCategoryNameLC( TInt aCategoryId ) |
|
168 { |
|
169 HBufC* name = NULL; |
|
170 |
|
171 switch ( aCategoryId ) |
|
172 { |
|
173 case KVcxMvcCategoryIdAll: |
|
174 name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_STORAGE_ALL_LIST ); |
|
175 break; |
|
176 case KVcxMvcCategoryIdDownloads: |
|
177 name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_STORAGE_DOWNLOADS_LIST ); |
|
178 break; |
|
179 case KVcxMvcCategoryIdCaptured: |
|
180 name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_STORAGE_CAPTURED_LIST ); |
|
181 break; |
|
182 case KVcxMvcCategoryIdOther: |
|
183 name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_STORAGE_OTHER_LIST ); |
|
184 break; |
|
185 case KCategoryIdLastWatched: |
|
186 if ( LastWatchedSetL() ) |
|
187 { |
|
188 name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_LAST_WATCHED ); |
|
189 } |
|
190 else |
|
191 { |
|
192 if ( PreloadedExistsL() ) |
|
193 { |
|
194 TBuf<KMyVideosTitleStringMaxLength> string; |
|
195 TInt error = iModel.GetMyVideosCustomizationString( |
|
196 KCRVideoPlayerPreloadedVideoName, string ); |
|
197 name = error ? KNullDesC().AllocLC() : string.AllocLC(); |
|
198 } |
|
199 else |
|
200 { |
|
201 name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_LAST_WATCHED ); |
|
202 } |
|
203 } |
|
204 break; |
|
205 case KCategoryIdExtraItem1: |
|
206 // ExtraItem1 is always interpreted as Ovi Store |
|
207 name = StringLoader::LoadLC( R_VCXHGMYVIDEOS_OVI_STORE ); |
|
208 break; |
|
209 case KCategoryIdExtraItem2: |
|
210 case KCategoryIdExtraItem3: |
|
211 { |
|
212 TInt key = 0; |
|
213 if ( aCategoryId == KCategoryIdExtraItem2 ) |
|
214 { |
|
215 key = KCRVideoPlayerExtraItem2Title; |
|
216 } |
|
217 else if ( aCategoryId == KCategoryIdExtraItem3 ) |
|
218 { |
|
219 key = KCRVideoPlayerExtraItem3Title; |
|
220 } |
|
221 |
|
222 TBuf<KMyVideosTitleStringMaxLength> titleString; |
|
223 TInt error = iModel.GetMyVideosCustomizationString( key, titleString ); |
|
224 if ( error == KErrNone ) |
|
225 { |
|
226 name = titleString.AllocLC(); |
|
227 } |
|
228 else |
|
229 { |
|
230 name = KNullDesC().AllocLC(); |
|
231 } |
|
232 } |
|
233 break; |
|
234 |
|
235 default: |
|
236 { |
|
237 name = KNullDesC().AllocLC(); |
|
238 IPTVLOGSTRING_LOW_LEVEL( |
|
239 "MPX My Videos UI # GetCategoryNameLC() Unexpected category!" ); |
|
240 } |
|
241 break; |
|
242 } |
|
243 return name; |
|
244 } |
|
245 |
|
246 // ----------------------------------------------------------------------------- |
|
247 // CVcxHgMyVideosCategoryModelHandler::GetCategoryIconL() |
|
248 // ----------------------------------------------------------------------------- |
|
249 // |
|
250 CGulIcon* CVcxHgMyVideosCategoryModelHandler::GetCategoryIconL( TInt aCategoryId ) |
|
251 { |
|
252 IPTVLOGSTRING2_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::GetCategoryIconL() Enter! Category id = %d", aCategoryId ); |
|
253 |
|
254 CGulIcon* icon( NULL ); |
|
255 TAknsItemID skinId = KAknsIIDNone; |
|
256 TInt bitmapId( 0 ); |
|
257 TInt maskId( 0 ); |
|
258 TInt key( KErrNotFound ); |
|
259 TFileName iconFile( KNullDesC() ); |
|
260 |
|
261 // Find icon file & bitmap IDs or cenrep keys |
|
262 switch ( aCategoryId ) |
|
263 { |
|
264 case KVcxMvcCategoryIdDownloads: // fall through |
|
265 case KVcxMvcCategoryIdAll: // fall through |
|
266 case KVcxMvcCategoryIdOther: |
|
267 skinId.Set( KAknsIIDQgnPropDownloadThumbnailVideo ); |
|
268 iconFile = KVcxHgMyVideosMifFile; |
|
269 bitmapId = EMbmVcxhgmyvideosiconsQgn_prop_download_thumbnail_video; |
|
270 maskId = EMbmVcxhgmyvideosiconsQgn_prop_download_thumbnail_video_mask; |
|
271 break; |
|
272 case KVcxMvcCategoryIdCaptured: |
|
273 skinId.Set( KAknsIIDQgnPropCapturedThumbnailVideo ); |
|
274 iconFile = KVcxHgMyVideosMifFile; |
|
275 bitmapId = EMbmVcxhgmyvideosiconsQgn_prop_captured_thumbnail_video; |
|
276 maskId = EMbmVcxhgmyvideosiconsQgn_prop_captured_thumbnail_video_mask; |
|
277 break; |
|
278 case KCategoryIdLastWatched: |
|
279 LoadLastWatchedIconL(); |
|
280 if ( iTnRequestId == KErrNotFound ) |
|
281 { |
|
282 // Last watched or preloaded not found => show default icon |
|
283 skinId.Set( KAknsIIDQgnPropRecentThumbnailVideo ); |
|
284 iconFile = KVcxHgMyVideosMifFile; |
|
285 bitmapId = EMbmVcxhgmyvideosiconsQgn_prop_recent_thumbnail_video; |
|
286 maskId = EMbmVcxhgmyvideosiconsQgn_prop_recent_thumbnail_video_mask; |
|
287 } |
|
288 break; |
|
289 case KCategoryIdExtraItem1: |
|
290 // ExtraItem1 is always interpreted as Ovi Store |
|
291 skinId.Set( KAknsIIDQgnPropOviThumbnailVideo ); |
|
292 iconFile = KVcxHgMyVideosMifFile; |
|
293 bitmapId = EMbmVcxhgmyvideosiconsQgn_prop_ovi_thumbnail_video; |
|
294 maskId = EMbmVcxhgmyvideosiconsQgn_prop_ovi_thumbnail_video_mask; |
|
295 break; |
|
296 case KCategoryIdExtraItem2: |
|
297 key = KCRVideoPlayerExtraItem2IconPath; |
|
298 break; |
|
299 case KCategoryIdExtraItem3: |
|
300 key = KCRVideoPlayerExtraItem3IconPath; |
|
301 break; |
|
302 default: |
|
303 { |
|
304 IPTVLOGSTRING_LOW_LEVEL( |
|
305 "MPX My Videos UI # GetCategoryIconLC() Unexpected category!" ); |
|
306 } |
|
307 break; |
|
308 } |
|
309 |
|
310 if ( key != KErrNotFound ) |
|
311 { |
|
312 // Extra item 2 or 3, get icon file from cenrep |
|
313 TInt error = iModel.GetMyVideosCustomizationString( key, iconFile ); |
|
314 if ( error == KErrNone && iconFile.Length() > 0 ) |
|
315 { |
|
316 IPTVLOGSTRING3_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::GetCategoryIconL() cenrep key %d iconFile %S", key, &iconFile ); |
|
317 bitmapId = 0x4000; |
|
318 maskId = 0x4001; |
|
319 } |
|
320 else |
|
321 { // Use default service icon |
|
322 skinId.Set( KAknsIIDQgnPropServiceThumbnailVideo ); |
|
323 iconFile = KVcxHgMyVideosMifFile; |
|
324 bitmapId = EMbmVcxhgmyvideosiconsQgn_prop_service_thumbnail_video; |
|
325 maskId = EMbmVcxhgmyvideosiconsQgn_prop_service_thumbnail_video_mask; |
|
326 } |
|
327 } |
|
328 |
|
329 if ( bitmapId && iconFile.Length() > 0 ) |
|
330 { |
|
331 // find mif file |
|
332 TFindFile findFile( iModel.FileServerSessionL() ); |
|
333 TInt error = findFile.FindByDir( iconFile, KNullDesC ); |
|
334 |
|
335 // Create icon if icon file was found |
|
336 if ( KErrNone == error ) |
|
337 { |
|
338 TParse parse; |
|
339 parse.Set( findFile.File(), NULL, NULL ); |
|
340 iconFile = parse.FullName(); |
|
341 IPTVLOGSTRING3_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::GetCategoryIconLC() get %d from file %S", bitmapId, &iconFile ); |
|
342 |
|
343 icon = CreateHgListIconL( skinId, iconFile, bitmapId, maskId ); |
|
344 } |
|
345 else |
|
346 { |
|
347 IPTVLOGSTRING2_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::GetCategoryIconL() FindByDir() returned %d", error ); |
|
348 } |
|
349 } |
|
350 else |
|
351 { |
|
352 IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::GetCategoryIconLC() no icon file or id" ); |
|
353 } |
|
354 |
|
355 return icon; |
|
356 } |
|
357 |
|
358 // ----------------------------------------------------------------------------- |
|
359 // CVcxHgMyVideosCategoryModelHandler::FormatCategorySecondRowLC() |
|
360 // ----------------------------------------------------------------------------- |
|
361 // |
|
362 HBufC* CVcxHgMyVideosCategoryModelHandler::FormatCategorySecondRowLC( CMPXMedia& aMedia ) |
|
363 { |
|
364 HBufC* details = NULL; |
|
365 TInt newVideos = 0; |
|
366 TInt videos = 0; |
|
367 |
|
368 if ( aMedia.IsSupported( KVcxMediaMyVideosCategoryNewItemCount ) ) |
|
369 { |
|
370 newVideos = *( aMedia.Value<TInt>( KVcxMediaMyVideosCategoryNewItemCount ) ); |
|
371 } |
|
372 if ( aMedia.IsSupported( KVcxMediaMyVideosCategoryItemCount ) ) |
|
373 { |
|
374 videos = *( aMedia.Value<TInt>( KVcxMediaMyVideosCategoryItemCount ) ); |
|
375 } |
|
376 |
|
377 if ( newVideos > 0 ) |
|
378 { |
|
379 if ( newVideos == 1 ) |
|
380 { |
|
381 details = StringLoader::LoadL( R_VCXHGMYVIDEOS_ONE_NEW_VIDEO ); |
|
382 } |
|
383 else |
|
384 { |
|
385 details = StringLoader::LoadL( R_VCXHGMYVIDEOS_N_NEW_VIDEOS, newVideos ); |
|
386 } |
|
387 CleanupStack::PushL( details ); |
|
388 } |
|
389 else |
|
390 { |
|
391 if ( videos == 0 ) |
|
392 { |
|
393 details = StringLoader::LoadLC( R_VCXHGMYVIDEOS_NO_VIDEOS_IN_CATEGORY ); |
|
394 } |
|
395 else if ( videos == 1 ) |
|
396 { |
|
397 details = StringLoader::LoadLC( R_VCXHGMYVIDEOS_ONE_VIDEO_IN_CATEGORY ); |
|
398 } |
|
399 else |
|
400 { |
|
401 details = StringLoader::LoadLC( R_VCXHGMYVIDEOS_VIDEOS_IN_CATEGORY, videos ); |
|
402 } |
|
403 } |
|
404 |
|
405 return details; |
|
406 } |
|
407 |
|
408 |
|
409 // ----------------------------------------------------------------------------- |
|
410 // CVcxHgMyVideosCategoryModelHandler::FormatCategorySecondRowLC() |
|
411 // ----------------------------------------------------------------------------- |
|
412 // |
|
413 HBufC* CVcxHgMyVideosCategoryModelHandler::FormatCategorySecondRowLC( TInt aCategoryId ) |
|
414 { |
|
415 HBufC* secondRow = NULL; |
|
416 |
|
417 switch ( aCategoryId ) |
|
418 { |
|
419 case KVcxMvcCategoryIdAll: |
|
420 case KVcxMvcCategoryIdDownloads: |
|
421 case KVcxMvcCategoryIdTvRecordings: |
|
422 case KVcxMvcCategoryIdCaptured: |
|
423 case KVcxMvcCategoryIdOther: |
|
424 { |
|
425 CMPXMedia* media = GetCategoryDataL( aCategoryId ); |
|
426 if ( media ) |
|
427 { |
|
428 secondRow = FormatCategorySecondRowLC( *media ); |
|
429 } |
|
430 else |
|
431 { |
|
432 secondRow = KNullDesC().AllocLC(); |
|
433 } |
|
434 } |
|
435 break; |
|
436 case KCategoryIdLastWatched: |
|
437 { |
|
438 if ( LastWatchedSetL() ) |
|
439 { |
|
440 TBuf<KMaxPath> path; |
|
441 TInt error = iModel.GetLastWatchedPathL( path ); |
|
442 if ( BaflUtils::FileExists( iModel.FileServerSessionL(), path ) ) |
|
443 { |
|
444 TBuf<KMyVideosTitleStringMaxLength> string; |
|
445 TInt error = iModel.GetLastWatchedNameL( string ); |
|
446 secondRow = error ? KNullDesC().AllocLC() : string.AllocLC(); |
|
447 } |
|
448 else |
|
449 { |
|
450 secondRow = StringLoader::LoadLC( R_VCXHGMYVIDEOS_NO_VIDEOS_IN_CATEGORY ); |
|
451 } |
|
452 } |
|
453 else |
|
454 { |
|
455 if ( PreloadedExistsL() ) |
|
456 { |
|
457 TBuf<KMyVideosTitleStringMaxLength> string; |
|
458 TInt error = iModel.GetMyVideosCustomizationString( |
|
459 KCRVideoPlayerPreloadedVideoDescription, string ); |
|
460 secondRow = error ? KNullDesC().AllocLC() : string.AllocLC(); |
|
461 } |
|
462 else |
|
463 { |
|
464 secondRow = StringLoader::LoadLC( R_VCXHGMYVIDEOS_NO_VIDEOS_IN_CATEGORY ); |
|
465 } |
|
466 } |
|
467 } |
|
468 break; |
|
469 |
|
470 case KCategoryIdExtraItem1: |
|
471 // ExtraItem1 is always interpreted as Ovi Store |
|
472 secondRow = StringLoader::LoadLC( R_VCXHGMYVIDEOS_OVI_STORE_VIDEOS ); |
|
473 break; |
|
474 |
|
475 case KCategoryIdExtraItem2: |
|
476 case KCategoryIdExtraItem3: |
|
477 { |
|
478 TInt key = 0; |
|
479 if ( aCategoryId == KCategoryIdExtraItem2 ) |
|
480 { |
|
481 key = KCRVideoPlayerExtraItem2Text; |
|
482 } |
|
483 else if ( aCategoryId == KCategoryIdExtraItem3 ) |
|
484 { |
|
485 key = KCRVideoPlayerExtraItem3Text; |
|
486 } |
|
487 |
|
488 TBuf<KMyVideosTitleStringMaxLength> detailsString; |
|
489 TInt error = iModel.GetMyVideosCustomizationString( key, detailsString ); |
|
490 if ( error == KErrNone ) |
|
491 { |
|
492 secondRow = detailsString.AllocLC(); |
|
493 } |
|
494 else |
|
495 { |
|
496 secondRow = KNullDesC().AllocLC(); |
|
497 } |
|
498 break; |
|
499 } |
|
500 default: |
|
501 { |
|
502 secondRow = KNullDesC().AllocLC(); |
|
503 IPTVLOGSTRING_LOW_LEVEL( |
|
504 "MPX My Videos UI # FormatCategorySecondRowLC() Unexpected category!" ); |
|
505 break; |
|
506 } |
|
507 } |
|
508 return secondRow; |
|
509 } |
|
510 |
|
511 // ----------------------------------------------------------------------------- |
|
512 // CVcxHgMyVideosCategoryModelHandler::UiIndexFromMpxItemId() |
|
513 // ----------------------------------------------------------------------------- |
|
514 // |
|
515 TInt CVcxHgMyVideosCategoryModelHandler::UiIndexFromMpxItemId( TMPXItemId& aMpxItemId ) |
|
516 { |
|
517 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # UiIndexFromMpxItemId() - Enter" ); |
|
518 |
|
519 TInt index ( KErrNotFound ); |
|
520 |
|
521 if ( iCategoryList ) |
|
522 { |
|
523 CMPXMedia* media = NULL; |
|
524 TMPXItemId mpxItemId; |
|
525 |
|
526 for ( TInt i = 0; i < iCategoryList->Count(); i++ ) |
|
527 { |
|
528 media = (*iCategoryList)[i]; |
|
529 |
|
530 if ( media && media->IsSupported( KMPXMediaGeneralId ) ) |
|
531 { |
|
532 mpxItemId = *media->Value<TMPXItemId>( KMPXMediaGeneralId ); |
|
533 |
|
534 if ( mpxItemId == aMpxItemId ) |
|
535 { |
|
536 index = ResolveCategoryArrayIndexById( i ); |
|
537 break; |
|
538 } |
|
539 } |
|
540 } |
|
541 } |
|
542 |
|
543 IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # UiIndexFromMpxItemId(), index = %d - Exit", index ); |
|
544 return index; |
|
545 } |
|
546 |
|
547 // ----------------------------------------------------------------------------- |
|
548 // CVcxHgMyVideosCategoryModelHandler::ResolveCategoryArrayIndexById() |
|
549 // ----------------------------------------------------------------------------- |
|
550 // |
|
551 TInt CVcxHgMyVideosCategoryModelHandler::ResolveCategoryArrayIndexById( TInt aCategoryId ) |
|
552 { |
|
553 TInt ret( KErrNotFound ); |
|
554 |
|
555 for(TInt i = 0; i < iCategoryIdArray.Count(); i++ ) |
|
556 { |
|
557 if( iCategoryIdArray[ i ] == aCategoryId ) |
|
558 { |
|
559 ret = i; |
|
560 break; |
|
561 } |
|
562 } |
|
563 |
|
564 return ret; |
|
565 } |
|
566 |
|
567 // ----------------------------------------------------------------------------- |
|
568 // CVcxHgMyVideosCategoryModelHandler::NewCategoryListL() |
|
569 // MPX Collection calls this callback when new category list is available. |
|
570 // ----------------------------------------------------------------------------- |
|
571 // |
|
572 void CVcxHgMyVideosCategoryModelHandler::NewCategoryListL( |
|
573 CMPXMediaArray* aCategoryList, TBool aIsPartial ) |
|
574 { |
|
575 IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # NewCategoryListL() - Enter. IsPartial=%d", aIsPartial ); |
|
576 |
|
577 delete iCategoryList; |
|
578 iCategoryList = aCategoryList; |
|
579 |
|
580 UpdateCategoryListL(); |
|
581 |
|
582 if ( !aIsPartial ) |
|
583 { |
|
584 // KVcxMessageMyVideosListComplete does not come, finish list fetching now |
|
585 CategoryListFetchingCompletedL(); |
|
586 } |
|
587 |
|
588 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # NewCategoryListL() - Exit" ); |
|
589 } |
|
590 |
|
591 // ----------------------------------------------------------------------------- |
|
592 // CVcxHgMyVideosCategoryModelHandler::CategoryListModifiedL() |
|
593 // MPX Collection calls this callback when the category list is modified. |
|
594 // ----------------------------------------------------------------------------- |
|
595 // |
|
596 void CVcxHgMyVideosCategoryModelHandler::CategoryListModifiedL() |
|
597 { |
|
598 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # CategoryListModifiedL() - Enter" ); |
|
599 |
|
600 UpdateCategoryListL(); |
|
601 |
|
602 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # CategoryListModifiedL() - Exit" ); |
|
603 } |
|
604 |
|
605 // ----------------------------------------------------------------------------- |
|
606 // CVcxHgMyVideosCategoryModelHandler::CategoryModifiedL() |
|
607 // MPX Collection calls this callback when single category is modified. |
|
608 // ----------------------------------------------------------------------------- |
|
609 // |
|
610 void CVcxHgMyVideosCategoryModelHandler::CategoryModifiedL( TMPXChangeEventType aEventType, |
|
611 TMPXItemId& aMpxItemId ) |
|
612 { |
|
613 IPTVLOGSTRING2_LOW_LEVEL( |
|
614 "MPX My Videos UI # CategoryModifiedL(event=%d)", aEventType ); |
|
615 |
|
616 switch ( aEventType ) |
|
617 { |
|
618 case EMPXItemModified: |
|
619 { |
|
620 TInt uiIndex = UiIndexFromMpxItemId( aMpxItemId ); |
|
621 UpdateCategoryListItemL( uiIndex ); |
|
622 iScroller.RefreshScreen( uiIndex ); |
|
623 } |
|
624 break; |
|
625 |
|
626 case EMPXItemInserted: |
|
627 { |
|
628 TInt id1( 0 ); |
|
629 TInt ret = iModel.GetLastWatchedIdL( id1 ); |
|
630 |
|
631 if ( ret == KErrNone && |
|
632 id1 == aMpxItemId.iId1 ) |
|
633 { |
|
634 ClearLastWatchedIconL(); |
|
635 UpdateCategoryListItemL( ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
636 iScroller.RefreshScreen( ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
637 } |
|
638 } |
|
639 break; |
|
640 case EMPXItemDeleted: |
|
641 { |
|
642 TInt id1( 0 ); |
|
643 TInt ret = iModel.GetLastWatchedIdL( id1 ); |
|
644 |
|
645 if ( ret == KErrNone && |
|
646 id1 == aMpxItemId.iId1 ) |
|
647 { |
|
648 ClearLastWatchedIconL(); |
|
649 UpdateCategoryListItemL( ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
650 iScroller.RefreshScreen( ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
651 } |
|
652 } |
|
653 break; |
|
654 default: |
|
655 { |
|
656 IPTVLOGSTRING_LOW_LEVEL( |
|
657 "MPX My Videos UI # CategoryModifiedL() Unexpected event!" ); |
|
658 } |
|
659 break; |
|
660 } |
|
661 } |
|
662 |
|
663 // ----------------------------------------------------------------------------- |
|
664 // CVcxHgMyVideosCategoryModelHandler::UpdateCategoryListL() |
|
665 // ----------------------------------------------------------------------------- |
|
666 // |
|
667 void CVcxHgMyVideosCategoryModelHandler::UpdateCategoryListL() |
|
668 { |
|
669 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # UpdateCategoryListL() - Enter" ); |
|
670 |
|
671 MakeCategoryIdArray(); |
|
672 |
|
673 if ( iCategoryIdArray.Count() != iScroller.ItemCount() ) |
|
674 { |
|
675 iScroller.ResizeL( iCategoryIdArray.Count() ); |
|
676 } |
|
677 |
|
678 if ( iCategoryIdArray.Count() > 0 ) |
|
679 { |
|
680 for ( TInt i = 0; i < iCategoryIdArray.Count(); i++ ) |
|
681 { |
|
682 UpdateCategoryListItemL( i ); |
|
683 } |
|
684 if ( iScroller.SelectedIndex() < 0 || |
|
685 iScroller.SelectedIndex() >= iScroller.ItemCount() ) |
|
686 { |
|
687 iScroller.SetSelectedIndex( 0 ); |
|
688 } |
|
689 } |
|
690 |
|
691 // Refresh the whole list. |
|
692 iScroller.DrawDeferred(); |
|
693 |
|
694 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # UpdateCategoryListL() - Exit" ); |
|
695 } |
|
696 |
|
697 // ----------------------------------------------------------------------------- |
|
698 // CVcxHgMyVideosCategoryModelHandler::UpdateCategoryListItemL() |
|
699 // ----------------------------------------------------------------------------- |
|
700 // |
|
701 void CVcxHgMyVideosCategoryModelHandler::UpdateCategoryListItemL( TInt aListIndex ) |
|
702 { |
|
703 IPTVLOGSTRING2_LOW_LEVEL( |
|
704 "MPX My Videos UI # UpdateCategoryListItemL (index=%d)", aListIndex ); |
|
705 |
|
706 if( aListIndex >= 0 && |
|
707 aListIndex < iScroller.ItemCount() && |
|
708 aListIndex < iCategoryIdArray.Count() ) |
|
709 { |
|
710 CHgItem& listItem = iScroller.ItemL( aListIndex ); |
|
711 |
|
712 HBufC* categoryName( NULL ); |
|
713 categoryName = GetCategoryNameLC( iCategoryIdArray[ aListIndex ] ); |
|
714 listItem.SetTitleL( *categoryName ); |
|
715 CleanupStack::PopAndDestroy( categoryName ); |
|
716 |
|
717 HBufC* secondRow( NULL ); |
|
718 secondRow = FormatCategorySecondRowLC( iCategoryIdArray[ aListIndex ] ); |
|
719 listItem.SetTextL( *secondRow ); |
|
720 CleanupStack::PopAndDestroy( secondRow ); |
|
721 |
|
722 // Set icon for category |
|
723 if ( !listItem.Icon() ) |
|
724 { |
|
725 listItem.SetIcon( GetCategoryIconL( iCategoryIdArray[ aListIndex ] ) ); |
|
726 } |
|
727 } |
|
728 |
|
729 IPTVLOGSTRING_LOW_LEVEL( |
|
730 "MPX My Videos UI # UpdateCategoryListItemL() - Exit" ); |
|
731 } |
|
732 |
|
733 // ----------------------------------------------------------------------------- |
|
734 // CVcxHgMyVideosCategoryModelHandler::RemoveCategoryListItem() |
|
735 // ----------------------------------------------------------------------------- |
|
736 // |
|
737 void CVcxHgMyVideosCategoryModelHandler::RemoveCategoryListItem( TInt aListIndex ) |
|
738 { |
|
739 if ( aListIndex >= 0 && aListIndex < iScroller.ItemCount() ) |
|
740 { |
|
741 iScroller.RemoveItem( aListIndex ); |
|
742 } |
|
743 } |
|
744 |
|
745 // ----------------------------------------------------------------------------- |
|
746 // CVcxHgMyVideosCategoryModelHandler::ResolveCategoryId() |
|
747 // ----------------------------------------------------------------------------- |
|
748 // |
|
749 TInt CVcxHgMyVideosCategoryModelHandler::ResolveCategoryId( TInt aScrollerIndex ) |
|
750 { |
|
751 TInt ret( -1 ); |
|
752 if ( aScrollerIndex >= 0 && |
|
753 aScrollerIndex <= iCategoryIdArray.Count() ) |
|
754 { |
|
755 ret = iCategoryIdArray[ aScrollerIndex ]; |
|
756 } |
|
757 return ret; |
|
758 } |
|
759 |
|
760 // ----------------------------------------------------------------------------- |
|
761 // CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArray() |
|
762 // ----------------------------------------------------------------------------- |
|
763 // |
|
764 void CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArray() |
|
765 { |
|
766 IPTVLOGSTRING_LOW_LEVEL("CVcxHgMyVideosCategoryModelHandler::MakeCategoryIdArray"); |
|
767 |
|
768 iCategoryIdArray.Reset(); |
|
769 |
|
770 TInt error = KErrNone; |
|
771 TInt value = KErrNotFound; |
|
772 TInt categoryId = KErrNotFound; |
|
773 |
|
774 // Check that cenrep exists and has some valid data |
|
775 error = iModel.GetMyVideosCustomizationInt( KCRVideoPlayerItemLocation1, value ); |
|
776 |
|
777 if ( error == KErrNone && value > EMyVideosListItemTypeEmpty ) |
|
778 { |
|
779 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # MakeCategoryIdArray() Getting category items from cenrep" ); |
|
780 |
|
781 for ( TInt i=KCRVideoPlayerItemLocation1; i<=KCRVideoPlayerItemLocation7; i++ ) |
|
782 { |
|
783 error = iModel.GetMyVideosCustomizationInt( i , value ); |
|
784 if ( error == KErrNone && value != EMyVideosListItemTypeEmpty ) |
|
785 { |
|
786 switch ( value ) |
|
787 { |
|
788 case EMyVideosListItemTypeLastWatched: |
|
789 categoryId = KCategoryIdLastWatched; |
|
790 break; |
|
791 case EMyVideosListItemTypeCapturedVideos: |
|
792 categoryId = KVcxMvcCategoryIdCaptured; |
|
793 break; |
|
794 case EMyVideosListItemTypeOtherVideos: |
|
795 categoryId = KVcxMvcCategoryIdOther; |
|
796 break; |
|
797 case EMyVideosListItemTypeExtra1: |
|
798 categoryId = KCategoryIdExtraItem1; |
|
799 break; |
|
800 case EMyVideosListItemTypeExtra2: |
|
801 categoryId = KCategoryIdExtraItem2; |
|
802 break; |
|
803 case EMyVideosListItemTypeExtra3: |
|
804 categoryId = KCategoryIdExtraItem3; |
|
805 break; |
|
806 case EMyVideosListItemTypeEmpty: |
|
807 categoryId = KErrNotFound; |
|
808 break; |
|
809 default: |
|
810 categoryId = KErrNotFound; |
|
811 break; |
|
812 } |
|
813 |
|
814 if ( AcceptCategory( categoryId ) ) |
|
815 { |
|
816 iCategoryIdArray.Append( categoryId ); |
|
817 } |
|
818 } |
|
819 } |
|
820 } |
|
821 else |
|
822 { |
|
823 iCategoryIdArray.Append( KCategoryIdLastWatched ); |
|
824 iCategoryIdArray.Append( KVcxMvcCategoryIdCaptured ); |
|
825 iCategoryIdArray.Append( KVcxMvcCategoryIdOther ); |
|
826 iCategoryIdArray.Append( KCategoryIdExtraItem1 ); |
|
827 } |
|
828 } |
|
829 |
|
830 // ----------------------------------------------------------------------------- |
|
831 // CVcxHgMyVideosCategoryModelHandler::AcceptCategory() |
|
832 // ----------------------------------------------------------------------------- |
|
833 // |
|
834 TBool CVcxHgMyVideosCategoryModelHandler::AcceptCategory( TInt aCategoryId ) |
|
835 { |
|
836 TBool ret(EFalse); |
|
837 switch ( aCategoryId ) |
|
838 { |
|
839 case KVcxMvcCategoryIdAll: |
|
840 case KVcxMvcCategoryIdCaptured: |
|
841 case KVcxMvcCategoryIdOther: |
|
842 case KCategoryIdLastWatched: |
|
843 case KCategoryIdExtraItem1: |
|
844 case KCategoryIdExtraItem2: |
|
845 case KCategoryIdExtraItem3: |
|
846 IPTVLOGSTRING2_LOW_LEVEL( |
|
847 "MPX My Videos UI # AcceptCategory() Accepted category: %d", aCategoryId ); |
|
848 ret = ETrue; |
|
849 break; |
|
850 default: |
|
851 IPTVLOGSTRING2_LOW_LEVEL( |
|
852 "MPX My Videos UI # AcceptCategory() Unknown category: %d", aCategoryId ); |
|
853 break; |
|
854 } |
|
855 |
|
856 return ret; |
|
857 } |
|
858 |
|
859 // ----------------------------------------------------------------------------- |
|
860 // MPX Collection calls this callback when category list items have been fetched. |
|
861 // ----------------------------------------------------------------------------- |
|
862 // |
|
863 void CVcxHgMyVideosCategoryModelHandler::CategoryListFetchingCompletedL() |
|
864 { |
|
865 IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # CategoryListFetchingCompletedL()" ); |
|
866 |
|
867 // Send custom command to appui that signals that the |
|
868 // my videos main view is constructed. |
|
869 CAknAppUi* appui = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
870 |
|
871 if ( appui ) |
|
872 { |
|
873 appui->HandleCommandL( KVcxMyVideosCmdDoLateConstruct ); |
|
874 } |
|
875 } |
|
876 |
|
877 // ----------------------------------------------------------------------------- |
|
878 // CVcxHgMyVideosVideoModelHandler::GetCategoryDataL() |
|
879 // |
|
880 // ----------------------------------------------------------------------------- |
|
881 // |
|
882 CMPXMedia* CVcxHgMyVideosCategoryModelHandler::GetCategoryDataL( TInt aCategoryId ) |
|
883 { |
|
884 if ( iCategoryList && aCategoryId >= 0 && iCategoryList->Count() > aCategoryId ) |
|
885 { |
|
886 return (*iCategoryList)[ aCategoryId ]; |
|
887 } |
|
888 |
|
889 return NULL; |
|
890 } |
|
891 |
|
892 // ----------------------------------------------------------------------------- |
|
893 // CVcxHgMyVideosVideoModelHandler::PlayLastWatchedVidedoL() |
|
894 // |
|
895 // ----------------------------------------------------------------------------- |
|
896 // |
|
897 void CVcxHgMyVideosCategoryModelHandler::PlayLastWatchedVidedoL() |
|
898 { |
|
899 TBuf<KMaxPath> path; |
|
900 TInt error( KErrNotFound ); |
|
901 if ( LastWatchedSetL() ) |
|
902 { |
|
903 error = iModel.GetLastWatchedPathL( path ); |
|
904 } |
|
905 else if ( PreloadedExistsL() ) |
|
906 { |
|
907 error = iModel.GetMyVideosCustomizationString( |
|
908 KCRVideoPlayerPreloadedVideoPath, path ); |
|
909 } |
|
910 |
|
911 if ( !error && path.Length() && BaflUtils::FileExists( iModel.FileServerSessionL(), path ) ) |
|
912 { |
|
913 CAknAppUi* appui = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
914 |
|
915 if ( appui ) |
|
916 { |
|
917 appui->OpenFileL( path ); |
|
918 iModel.SetAppState( CVcxHgMyVideosModel::EVcxMyVideosAppStatePlayer ); |
|
919 } |
|
920 } |
|
921 } |
|
922 |
|
923 // ----------------------------------------------------------------------------- |
|
924 // CVcxHgMyVideosVideoModelHandler::LoadLastWatchedIconL() |
|
925 // |
|
926 // ----------------------------------------------------------------------------- |
|
927 // |
|
928 void CVcxHgMyVideosCategoryModelHandler::LoadLastWatchedIconL() |
|
929 { |
|
930 if ( LastWatchedSetL() ) |
|
931 { |
|
932 TBuf<KMaxPath> path; |
|
933 TInt error = iModel.GetLastWatchedPathL( path ); |
|
934 |
|
935 if ( BaflUtils::FileExists( iModel.FileServerSessionL(), path ) ) |
|
936 { |
|
937 CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( |
|
938 path, |
|
939 KNullDesC ); |
|
940 iTnRequestId = iTnManager.GetL( *source ); |
|
941 CleanupStack::PopAndDestroy( source ); |
|
942 } |
|
943 } |
|
944 else |
|
945 { |
|
946 if ( PreloadedExistsL() ) |
|
947 { |
|
948 TBuf<KMaxPath> path; |
|
949 TInt error = iModel.GetMyVideosCustomizationString( |
|
950 KCRVideoPlayerPreloadedVideoPath, path ); |
|
951 CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( |
|
952 path, |
|
953 KNullDesC ); |
|
954 |
|
955 iTnRequestId = iTnManager.GetL( *source ); |
|
956 CleanupStack::PopAndDestroy( source ); |
|
957 } |
|
958 } |
|
959 } |
|
960 |
|
961 // ----------------------------------------------------------------------------- |
|
962 // CVcxHgMyVideosVideoModelHandler::ClearLastWatchedIconL() |
|
963 // |
|
964 // ----------------------------------------------------------------------------- |
|
965 // |
|
966 void CVcxHgMyVideosCategoryModelHandler::ClearLastWatchedIconL() |
|
967 { |
|
968 CHgItem& item = iScroller.ItemL( ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
969 item.ClearFlags( CHgItem::EHgItemFlagsIconOverlayIndicator ); |
|
970 item.SetIcon( NULL ); |
|
971 } |
|
972 |
|
973 // ----------------------------------------------------------------------------- |
|
974 // CVcxHgMyVideosVideoModelHandler::SetLastWatchedIndicatorL() |
|
975 // |
|
976 // ----------------------------------------------------------------------------- |
|
977 // |
|
978 void CVcxHgMyVideosCategoryModelHandler::SetLastWatchedIndicatorL() |
|
979 { |
|
980 if ( KErrNotFound != ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ) |
|
981 { |
|
982 CHgItem& lastWatchedItem = iScroller.ItemL( |
|
983 ResolveCategoryArrayIndexById( KCategoryIdLastWatched ) ); |
|
984 TInt isIndicator( 0 ); |
|
985 iModel.GetLastWatchedIndicatorL( isIndicator ); |
|
986 |
|
987 TBuf<KMaxPath> path; |
|
988 TInt error = iModel.GetLastWatchedPathL( path ); |
|
989 TBool exist = BaflUtils::FileExists( iModel.FileServerSessionL(), path ); |
|
990 if ( isIndicator && path.Length() && exist ) |
|
991 { |
|
992 lastWatchedItem.SetFlags( CHgItem::EHgItemFlagsIconOverlayIndicator ); |
|
993 } |
|
994 else |
|
995 { |
|
996 lastWatchedItem.ClearFlags( CHgItem::EHgItemFlagsIconOverlayIndicator ); |
|
997 } |
|
998 } |
|
999 } |
|
1000 |
|
1001 // ----------------------------------------------------------------------------- |
|
1002 // CVcxHgMyVideosVideoModelHandler::VideoIndicatorL() |
|
1003 // |
|
1004 // ----------------------------------------------------------------------------- |
|
1005 // |
|
1006 CMyVideosIndicator& CVcxHgMyVideosCategoryModelHandler::VideoIndicatorL() |
|
1007 { |
|
1008 if ( !iVideoIndicator ) |
|
1009 { |
|
1010 iVideoIndicator = CMyVideosIndicator::NewL(); |
|
1011 } |
|
1012 return *iVideoIndicator; |
|
1013 } |
|
1014 |
|
1015 // ----------------------------------------------------------------------------- |
|
1016 // CVcxHgMyVideosVideoModelHandler::ThumbnailPreviewReady() |
|
1017 // |
|
1018 // ----------------------------------------------------------------------------- |
|
1019 // |
|
1020 void CVcxHgMyVideosCategoryModelHandler::ThumbnailPreviewReady( |
|
1021 MThumbnailData& /*aThumbnail*/, |
|
1022 TThumbnailRequestId /*aId*/ ) |
|
1023 { |
|
1024 // No implementation |
|
1025 } |
|
1026 |
|
1027 // ----------------------------------------------------------------------------- |
|
1028 // CVcxHgMyVideosVideoModelHandler::ThumbnailReady() |
|
1029 // |
|
1030 // ----------------------------------------------------------------------------- |
|
1031 // |
|
1032 void CVcxHgMyVideosCategoryModelHandler::ThumbnailReady( |
|
1033 TInt aError, |
|
1034 MThumbnailData& aThumbnail, |
|
1035 TThumbnailRequestId aId ) |
|
1036 { |
|
1037 if ( aId == iTnRequestId ) |
|
1038 { |
|
1039 iTnRequestId = KErrNotFound; |
|
1040 |
|
1041 TRAP_IGNORE( ThumbnailReadyL( aError, aThumbnail, aId ) ); |
|
1042 } |
|
1043 } |
|
1044 |
|
1045 // ----------------------------------------------------------------------------- |
|
1046 // CVcxHgMyVideosVideoModelHandler::ThumbnailReady() |
|
1047 // |
|
1048 // ----------------------------------------------------------------------------- |
|
1049 // |
|
1050 void CVcxHgMyVideosCategoryModelHandler::ThumbnailReadyL( |
|
1051 TInt aError, |
|
1052 MThumbnailData& aThumbnail, |
|
1053 TThumbnailRequestId /*aId*/ ) |
|
1054 { |
|
1055 TInt lastWatchedIndex = ResolveCategoryArrayIndexById( KCategoryIdLastWatched ); |
|
1056 if ( lastWatchedIndex != KErrNotFound ) |
|
1057 { |
|
1058 CHgItem& listItem = iScroller.ItemL( lastWatchedIndex ); |
|
1059 CGulIcon* thumbnail( NULL ); |
|
1060 |
|
1061 if ( !aError ) |
|
1062 { |
|
1063 thumbnail = CGulIcon::NewL( aThumbnail.DetachBitmap() ); |
|
1064 CleanupStack::PushL( thumbnail ); |
|
1065 SetLastWatchedIndicatorL(); |
|
1066 } |
|
1067 else |
|
1068 { |
|
1069 TFileName iconFile( KVcxHgMyVideosMifFile ); |
|
1070 thumbnail = CreateHgListIconL( |
|
1071 KAknsIIDQgnPropRecentThumbnailVideo, |
|
1072 iconFile, |
|
1073 EMbmVcxhgmyvideosiconsQgn_prop_recent_thumbnail_video, |
|
1074 EMbmVcxhgmyvideosiconsQgn_prop_recent_thumbnail_video_mask ); |
|
1075 |
|
1076 CleanupStack::PushL( thumbnail ); |
|
1077 } |
|
1078 |
|
1079 listItem.SetIcon( thumbnail ); // Takes ownership |
|
1080 CleanupStack::Pop( thumbnail ); |
|
1081 iScroller.RefreshScreen( lastWatchedIndex ); |
|
1082 } |
|
1083 } |
|
1084 |
|
1085 |
|
1086 // ----------------------------------------------------------------------------- |
|
1087 // CVcxHgMyVideosVideoModelHandler::HandleExtraItemSelectionL() |
|
1088 // |
|
1089 // ----------------------------------------------------------------------------- |
|
1090 // |
|
1091 void CVcxHgMyVideosCategoryModelHandler::HandleExtraItemSelectionL( |
|
1092 TInt categoryId, |
|
1093 TVcxHgMyVideosCategoryItemType& aItemType, |
|
1094 TUid& aUid, |
|
1095 TDes& aUrl ) |
|
1096 { |
|
1097 TInt uidKey = 0; |
|
1098 TInt urlKey = 0; |
|
1099 |
|
1100 aItemType = TVcxHgMyVideosCategoryItemTypeUndefined; |
|
1101 |
|
1102 switch ( categoryId ) |
|
1103 { |
|
1104 case KCategoryIdExtraItem1: |
|
1105 { |
|
1106 uidKey = KCRVideoPlayerExtraItem1Uid; |
|
1107 urlKey = KCRVideoPlayerExtraItem1Url; |
|
1108 break; |
|
1109 } |
|
1110 case KCategoryIdExtraItem2: |
|
1111 { |
|
1112 uidKey = KCRVideoPlayerExtraItem2Uid; |
|
1113 urlKey = KCRVideoPlayerExtraItem2Url; |
|
1114 break; |
|
1115 } |
|
1116 case KCategoryIdExtraItem3: |
|
1117 { |
|
1118 uidKey = KCRVideoPlayerExtraItem3Uid; |
|
1119 urlKey = KCRVideoPlayerExtraItem3Url; |
|
1120 break; |
|
1121 } |
|
1122 default: |
|
1123 return; |
|
1124 } |
|
1125 |
|
1126 TBuf<KMyVideosTitleUrlMaxLength> urlString; |
|
1127 TInt uidInt( 0 ) ; |
|
1128 |
|
1129 // Try to get URL. |
|
1130 TInt error = iModel.GetMyVideosCustomizationString( urlKey, urlString ); |
|
1131 if ( error == KErrNone && urlString.Size() > 0 ) |
|
1132 { |
|
1133 aUrl = urlString; |
|
1134 aItemType = TVcxHgMyVideosCategoryItemTypeUrl; |
|
1135 } |
|
1136 |
|
1137 // Try to fetch application UID. |
|
1138 error = iModel.GetMyVideosCustomizationInt( uidKey, uidInt ); |
|
1139 if ( error == KErrNone && uidInt != 0 ) |
|
1140 { |
|
1141 aUid = TUid::Uid( uidInt ); |
|
1142 aItemType = TVcxHgMyVideosCategoryItemTypeUid; |
|
1143 } |
|
1144 } |
|
1145 |
|
1146 // ----------------------------------------------------------------------------- |
|
1147 // CVcxHgMyVideosVideoModelHandler::CreateHgListIconL() |
|
1148 // |
|
1149 // ----------------------------------------------------------------------------- |
|
1150 // |
|
1151 CGulIcon* CVcxHgMyVideosCategoryModelHandler::CreateHgListIconL( |
|
1152 const TAknsItemID& aSkinId, |
|
1153 const TFileName& aFileName, |
|
1154 TInt aBitmapId, |
|
1155 TInt aMaskId ) |
|
1156 { |
|
1157 IPTVLOGSTRING3_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::CreateHgListIconL() skin major=%d, skin minor=%d", aSkinId.iMajor, aSkinId.iMinor ); |
|
1158 IPTVLOGSTRING4_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::CreateHgListIconL() bitmap=%d mask=%d file %S", aBitmapId, aMaskId, &aFileName ); |
|
1159 |
|
1160 CFbsBitmap* bitmap( NULL ); |
|
1161 CFbsBitmap* mask( NULL ); |
|
1162 CGulIcon* icon( NULL ); |
|
1163 |
|
1164 // Create default icon for Hg list. |
|
1165 AknsUtils::CreateIconLC( |
|
1166 AknsUtils::SkinInstance(), |
|
1167 aSkinId, |
|
1168 bitmap, |
|
1169 mask, |
|
1170 aFileName, |
|
1171 aBitmapId, |
|
1172 aMaskId ); |
|
1173 |
|
1174 TInt error( KErrNone ); |
|
1175 error = AknIconUtils::SetSize( |
|
1176 bitmap, |
|
1177 CHgDoubleGraphicList::PreferredImageSize(), |
|
1178 EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
1179 User::LeaveIfError( error ); |
|
1180 |
|
1181 error = AknIconUtils::SetSize( |
|
1182 mask, |
|
1183 CHgDoubleGraphicList::PreferredImageSize(), |
|
1184 EAspectRatioPreservedAndUnusedSpaceRemoved ); |
|
1185 User::LeaveIfError( error ); |
|
1186 |
|
1187 // Ownership of bitmap and mask is transferred to icon. |
|
1188 icon = CGulIcon::NewL( bitmap, mask ); |
|
1189 CleanupStack::Pop( 2 ); // mask and bitmap |
|
1190 |
|
1191 IPTVLOGSTRING2_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::CreateHgListIconL() icon=0x%08x", icon ); |
|
1192 |
|
1193 return icon; |
|
1194 } |
|
1195 |
|
1196 // ----------------------------------------------------------------------------- |
|
1197 // CVcxHgMyVideosVideoModelHandler::CreateEmptyHgListIconL() |
|
1198 // |
|
1199 // ----------------------------------------------------------------------------- |
|
1200 // |
|
1201 CGulIcon* CVcxHgMyVideosCategoryModelHandler::CreateEmptyHgListIconL() |
|
1202 { |
|
1203 IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosCategoryModelHandler::CreateEmptyHgListIconL()" ); |
|
1204 CGulIcon* icon( NULL ); |
|
1205 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
|
1206 |
|
1207 bitmap->Create( CHgDoubleGraphicList::PreferredImageSize(), ENone ); |
|
1208 CleanupStack::PushL( bitmap ); |
|
1209 icon = CGulIcon::NewL( bitmap ); |
|
1210 CleanupStack::Pop( bitmap ); |
|
1211 |
|
1212 return icon; |
|
1213 } |
|
1214 |
|
1215 // ----------------------------------------------------------------------------- |
|
1216 // CVcxHgMyVideosVideoModelHandler::LastWatchedSetL() |
|
1217 // ----------------------------------------------------------------------------- |
|
1218 // |
|
1219 TBool CVcxHgMyVideosCategoryModelHandler::LastWatchedSetL() |
|
1220 { |
|
1221 TBuf<KMaxPath> path; |
|
1222 TInt error = iModel.GetLastWatchedPathL( path ); |
|
1223 TInt length = path.Length(); |
|
1224 |
|
1225 if ( error == KErrNone && length > 0 ) |
|
1226 { |
|
1227 return ETrue; |
|
1228 } |
|
1229 else |
|
1230 { |
|
1231 return EFalse; |
|
1232 } |
|
1233 } |
|
1234 // ----------------------------------------------------------------------------- |
|
1235 // CVcxHgMyVideosVideoModelHandler::PreloadedExistsL() |
|
1236 // ----------------------------------------------------------------------------- |
|
1237 // |
|
1238 TBool CVcxHgMyVideosCategoryModelHandler::PreloadedExistsL() |
|
1239 { |
|
1240 TBuf<KMaxPath> path; |
|
1241 TInt error = iModel.GetMyVideosCustomizationString( KCRVideoPlayerPreloadedVideoPath, path ); |
|
1242 if ( !error && path.Length() && BaflUtils::FileExists( iModel.FileServerSessionL(), path ) ) |
|
1243 { |
|
1244 return ETrue; |
|
1245 } |
|
1246 else |
|
1247 { |
|
1248 return EFalse; |
|
1249 } |
|
1250 } |