author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:15:24 +0300 | |
branch | RCL_3 |
changeset 64 | 3eb824b18d67 |
parent 57 | befca0ec475f |
child 70 | 375929f879c2 |
permissions | -rw-r--r-- |
57 | 1 |
/* |
2 |
* Copyright (c) 2008-2010 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 video data.* |
|
15 |
*/ |
|
16 |
||
17 |
||
18 |
||
19 |
||
20 |
// INCLUDE FILES |
|
21 |
#include <StringLoader.h> |
|
22 |
#include <mpxmediageneraldefs.h> |
|
23 |
#include <mpxmediageneralextdefs.h> |
|
24 |
#include <mpxmedia.h> |
|
25 |
#include <mpxmediaarray.h> |
|
26 |
||
27 |
#include <ganes/HgScroller.h> |
|
28 |
#include <ganes/HgItem.h> |
|
29 |
||
30 |
#include <vcxhgmyvideos.rsg> |
|
31 |
#include <vcxmyvideosdefs.h> |
|
32 |
#include <MPFileDetailsDialog.h> |
|
33 |
#include <myvideosindicator.h> |
|
34 |
#include <centralrepository.h> |
|
35 |
||
36 |
#include "IptvDebug.h" |
|
37 |
||
38 |
#include "vcxhgmyvideosmodel.h" |
|
39 |
#include "vcxhgmyvideosmainview.h" |
|
40 |
#include "vcxhgmyvideoscollectionclient.h" |
|
41 |
#include "vcxhgmyvideosvideomodelhandler.h" |
|
42 |
#include "vcxhgmyvideosvideolistimpl.h" |
|
43 |
#include "vcxhgmyvideosvideodataupdater.h" |
|
64
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
44 |
#include "vcxhgmyvideosthumbnailmanager.h" |
57 | 45 |
|
46 |
#include "vcxhgmyvideos.hrh" |
|
47 |
#include "vcxhgmyvideoslistbase.h" |
|
48 |
#include "vcxhgmyvideosindicatorhelper.h" |
|
49 |
#include "vcxhgmyvideosvideodetailsdialog.h" |
|
50 |
#include "vcxhgmyvideosvideolist.h" |
|
51 |
#include "vcxhgmyvideospanics.h" |
|
52 |
||
53 |
// CONSTANTS |
|
54 |
const TUint KVcxSecondsInMinute( 60 ); |
|
55 |
const TUint KVcxSecondsInHour( 3600 ); |
|
56 |
const TUint KVcxVideoSizeGB( 0x40000000 ); |
|
57 |
const TUint KVcxVideoSizeHalfGB( 0x20000000 ); |
|
58 |
const TUint KVcxVideoSizeMB( 0x100000 ); |
|
59 |
const TUint KVcxVideoSizeHalfMB( 0x80000 ); |
|
60 |
const TUint KVcxVideoSizeKB( 0x400 ); |
|
61 |
const TUint KVcxVideoSizeHalfKB( 0x200 ); |
|
62 |
||
63 |
const TUint KHgBufferSize( 250 ); |
|
64 |
const TUint KHgBufferTreshold( 50 ); |
|
65 |
||
66 |
// ============================ MEMBER FUNCTIONS =============================== |
|
67 |
||
68 |
// ----------------------------------------------------------------------------- |
|
69 |
// CVcxHgMyVideosVideoModelHandler::NewL() |
|
70 |
// ----------------------------------------------------------------------------- |
|
71 |
// |
|
72 |
CVcxHgMyVideosVideoModelHandler* CVcxHgMyVideosVideoModelHandler::NewL( |
|
73 |
CVcxHgMyVideosVideoListImpl& aVideoListImpl, |
|
74 |
CVcxHgMyVideosModel& aModel, |
|
75 |
CVcxHgMyVideosMainView& aView, |
|
76 |
CHgScroller& aScroller ) |
|
77 |
{ |
|
78 |
CVcxHgMyVideosVideoModelHandler* self = |
|
79 |
CVcxHgMyVideosVideoModelHandler::NewLC( |
|
80 |
aVideoListImpl, aModel, aView, aScroller ); |
|
81 |
CleanupStack::Pop( self ); |
|
82 |
return self; |
|
83 |
} |
|
84 |
||
85 |
// ----------------------------------------------------------------------------- |
|
86 |
// CVcxHgMyVideosVideoModelHandler::NewLC() |
|
87 |
// ----------------------------------------------------------------------------- |
|
88 |
// |
|
89 |
CVcxHgMyVideosVideoModelHandler* CVcxHgMyVideosVideoModelHandler::NewLC( |
|
90 |
CVcxHgMyVideosVideoListImpl& aVideoListImpl, |
|
91 |
CVcxHgMyVideosModel& aModel, |
|
92 |
CVcxHgMyVideosMainView& aView, |
|
93 |
CHgScroller& aScroller ) |
|
94 |
{ |
|
95 |
CVcxHgMyVideosVideoModelHandler* self = |
|
96 |
new (ELeave) CVcxHgMyVideosVideoModelHandler( |
|
97 |
aVideoListImpl, aModel, aView, aScroller ); |
|
98 |
CleanupStack::PushL( self ); |
|
99 |
self->ConstructL(); |
|
100 |
return self; |
|
101 |
} |
|
102 |
||
103 |
// ----------------------------------------------------------------------------- |
|
104 |
// Constructor |
|
105 |
// ----------------------------------------------------------------------------- |
|
106 |
// |
|
107 |
CVcxHgMyVideosVideoModelHandler::CVcxHgMyVideosVideoModelHandler( |
|
108 |
CVcxHgMyVideosVideoListImpl& aVideoListImpl, |
|
109 |
CVcxHgMyVideosModel& aModel, |
|
110 |
CVcxHgMyVideosMainView& aView, |
|
111 |
CHgScroller& aScroller ) |
|
112 |
: iVideoListImpl( aVideoListImpl ), |
|
113 |
iModel( aModel ), |
|
114 |
iView( aView ), |
|
115 |
iScroller( aScroller ), |
|
116 |
iCurrentCategoryIndex( KErrNotFound ), |
|
117 |
iRestoreListPosition( EFalse ) |
|
118 |
{ |
|
119 |
} |
|
120 |
||
121 |
// ----------------------------------------------------------------------------- |
|
122 |
// CVcxHgMyVideosVideoModelHandler::ConstructL() |
|
123 |
// ----------------------------------------------------------------------------- |
|
124 |
// |
|
125 |
void CVcxHgMyVideosVideoModelHandler::ConstructL() |
|
126 |
{ |
|
127 |
iVideoArray = CVcxHgMyVideosVideoList::NewL(); |
|
128 |
||
129 |
iVideoIndicator = CMyVideosIndicator::NewL(); |
|
130 |
||
131 |
iDataUpdater = CVcxHgMyVideosVideoDataUpdater::NewL( iModel, |
|
132 |
iScroller, |
|
133 |
*iVideoArray, |
|
134 |
*iVideoIndicator ); |
|
135 |
||
136 |
} |
|
137 |
||
138 |
// ----------------------------------------------------------------------------- |
|
139 |
// Destructor |
|
140 |
// ----------------------------------------------------------------------------- |
|
141 |
// |
|
142 |
CVcxHgMyVideosVideoModelHandler::~CVcxHgMyVideosVideoModelHandler() |
|
143 |
{ |
|
144 |
iMarkedMediaList.Close(); |
|
145 |
||
146 |
delete iVideoDetails; |
|
147 |
delete iVideoIndicator; |
|
148 |
delete iDataUpdater; |
|
149 |
delete iVideoArray; |
|
150 |
delete iRepository; |
|
151 |
} |
|
152 |
||
153 |
// ----------------------------------------------------------------------------- |
|
154 |
// CVcxHgMyVideosVideoModelHandler::DoModelActivateL() |
|
155 |
// ----------------------------------------------------------------------------- |
|
156 |
// |
|
157 |
void CVcxHgMyVideosVideoModelHandler::DoModelActivateL() |
|
158 |
{ |
|
159 |
IPTVLOGSTRING_LOW_LEVEL( |
|
160 |
"MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::DoModelActivateL() - Enter" ); |
|
161 |
||
162 |
iDataUpdater->SetPausedL( EFalse ); |
|
163 |
iModel.CollectionClient().SetVideoModelObserver( this ); |
|
164 |
||
165 |
// Set scroller strip type |
|
166 |
TVcxMyVideosSortingOrder sortOrder = iModel.VideolistSortOrderL(); |
|
167 |
UpdateScrollbarTypeL( sortOrder ); |
|
168 |
||
169 |
// Set up scroll buffer |
|
170 |
iScroller.EnableScrollBufferL( *this, KHgBufferSize, KHgBufferTreshold ); |
|
171 |
||
172 |
IPTVLOGSTRING_LOW_LEVEL( |
|
173 |
"MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::DoModelActivateL() - Exit" ); |
|
174 |
} |
|
175 |
||
176 |
// ----------------------------------------------------------------------------- |
|
177 |
// CVcxHgMyVideosVideoModelHandler::DoModelDeactivate() |
|
178 |
// ----------------------------------------------------------------------------- |
|
179 |
// |
|
180 |
void CVcxHgMyVideosVideoModelHandler::DoModelDeactivate() |
|
181 |
{ |
|
182 |
IPTVLOGSTRING_LOW_LEVEL( |
|
183 |
"MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::DoModelDeactivate() - Enter" ); |
|
184 |
||
185 |
TRAP_IGNORE( iDataUpdater->SetPausedL( ETrue ) ); |
|
186 |
iModel.CollectionClient().SetVideoModelObserver( NULL ); |
|
187 |
iScroller.DisableScrollBuffer(); |
|
188 |
||
189 |
TRAP_IGNORE( SaveFirstListItemIdL() ); |
|
190 |
||
191 |
IPTVLOGSTRING_LOW_LEVEL( |
|
192 |
"MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::DoModelDeactivate() - Exit" ); |
|
193 |
} |
|
194 |
||
195 |
// ----------------------------------------------------------------------------- |
|
196 |
// CVcxHgMyVideosVideoModelHandler::SaveFirstListItemIdL() |
|
197 |
// ----------------------------------------------------------------------------- |
|
198 |
// |
|
199 |
void CVcxHgMyVideosVideoModelHandler::SaveFirstListItemIdL() |
|
200 |
{ |
|
201 |
iFirstListItemId = iVideoArray->ArrayIndexToMpxItemIdL( |
|
202 |
iScroller.FirstIndexOnScreen() ); |
|
203 |
} |
|
204 |
||
205 |
// ----------------------------------------------------------------------------- |
|
206 |
// CVcxHgMyVideosVideoModelHandler::UpdateVideoListL() |
|
207 |
// ----------------------------------------------------------------------------- |
|
208 |
// |
|
209 |
void CVcxHgMyVideosVideoModelHandler::UpdateVideoListL( TInt aCategoryIndex ) |
|
210 |
{ |
|
211 |
IPTVLOGSTRING_LOW_LEVEL( |
|
212 |
"MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::UpdateVideoListL() - Enter" ); |
|
213 |
||
214 |
CVcxHgMyVideosCollectionClient& collectionClient = iModel.CollectionClient(); |
|
215 |
||
216 |
if ( aCategoryIndex == iCurrentCategoryIndex ) |
|
217 |
{ |
|
218 |
// If we are re-opening the same video list again, then try |
|
219 |
// restore the highlight to previous position. |
|
220 |
iRestoreListPosition = ETrue; |
|
221 |
} |
|
222 |
else |
|
223 |
{ |
|
224 |
iRestoreListPosition = EFalse; |
|
225 |
||
226 |
// Removes videos from video list. |
|
227 |
iVideoArray->RemoveVideoList(); |
|
228 |
||
229 |
// Removes videos from scroller. After this command, list highlight |
|
230 |
// disappears, so don't forget to set highlight in NewVideoListL() |
|
231 |
// function. |
|
232 |
iScroller.Reset(); |
|
233 |
} |
|
234 |
||
235 |
// Ask for video list from MPX collection. |
|
236 |
collectionClient.GetVideoListL( aCategoryIndex ); |
|
237 |
||
238 |
iCurrentCategoryIndex = aCategoryIndex; |
|
239 |
||
240 |
IPTVLOGSTRING_LOW_LEVEL( |
|
241 |
"MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::UpdateVideoListL() - Exit" ); |
|
242 |
} |
|
243 |
||
244 |
// ----------------------------------------------------------------------------- |
|
245 |
// CVcxHgMyVideosVideoModelHandler::ResortVideoListL() |
|
246 |
// ----------------------------------------------------------------------------- |
|
247 |
// |
|
248 |
void CVcxHgMyVideosVideoModelHandler::ResortVideoListL() |
|
249 |
{ |
|
250 |
IPTVLOGSTRING_LOW_LEVEL( |
|
251 |
"MPX My Videos UI # ResortVideoListL() - Enter" ); |
|
252 |
||
253 |
if ( iScroller.ItemCount() > 0 ) |
|
254 |
{ |
|
255 |
TVcxMyVideosSortingOrder sortOrder = iModel.VideolistSortOrderL(); |
|
256 |
||
257 |
if ( iVideoListImpl.IsMarking() ) |
|
258 |
{ |
|
259 |
SaveMarkingsL(); |
|
260 |
} |
|
261 |
||
262 |
iVideoArray->ResortVideoListL( sortOrder ); |
|
263 |
||
264 |
TInt highlight = iScroller.SelectedIndex(); |
|
265 |
||
266 |
ResetScrollerBufferAndItemsL(); |
|
267 |
||
268 |
iScroller.SetSelectedIndex( highlight ); |
|
269 |
||
270 |
iView.DynInitMskL(); |
|
271 |
||
272 |
if ( iVideoListImpl.IsMarking() ) |
|
273 |
{ |
|
274 |
RestoreMarkingsL(); |
|
275 |
} |
|
276 |
||
277 |
// Switch to appropriate scroller strip |
|
278 |
UpdateScrollbarTypeL( sortOrder ); |
|
279 |
} |
|
280 |
IPTVLOGSTRING_LOW_LEVEL( |
|
281 |
"MPX My Videos UI # ResortVideoListL() - Exit" ); |
|
282 |
} |
|
283 |
||
284 |
// ----------------------------------------------------------------------------- |
|
285 |
// CVcxHgMyVideosVideoModelHandler::Highlight() |
|
286 |
// ----------------------------------------------------------------------------- |
|
287 |
// |
|
288 |
TInt CVcxHgMyVideosVideoModelHandler::Highlight() |
|
289 |
{ |
|
290 |
return iScroller.SelectedIndex(); |
|
291 |
} |
|
292 |
||
293 |
// ----------------------------------------------------------------------------- |
|
294 |
// CVcxHgMyVideosVideoModelHandler::VideoCount() |
|
295 |
// ----------------------------------------------------------------------------- |
|
296 |
// |
|
297 |
TInt CVcxHgMyVideosVideoModelHandler::VideoCount() |
|
298 |
{ |
|
299 |
return iScroller.ItemCount(); |
|
300 |
} |
|
301 |
||
302 |
// ----------------------------------------------------------------------------- |
|
303 |
// CVcxHgMyVideosVideoModelHandler::CurrentCategoryIndex() |
|
304 |
// ----------------------------------------------------------------------------- |
|
305 |
// |
|
306 |
TInt CVcxHgMyVideosVideoModelHandler::CurrentCategoryIndex() |
|
307 |
{ |
|
308 |
return iCurrentCategoryIndex; |
|
309 |
} |
|
310 |
||
311 |
// ----------------------------------------------------------------------------- |
|
312 |
// CVcxHgMyVideosVideoModelHandler::MarkedVideosL() |
|
313 |
// ----------------------------------------------------------------------------- |
|
314 |
// |
|
315 |
void CVcxHgMyVideosVideoModelHandler::MarkedVideosL( |
|
316 |
RArray<TInt>& aMarkedVideos ) |
|
317 |
{ |
|
318 |
iScroller.GetMarkedItemsL( aMarkedVideos ); |
|
319 |
} |
|
320 |
||
321 |
// ----------------------------------------------------------------------------- |
|
322 |
// CVcxHgMyVideosVideoModelHandler::HandleMarkCommandL() |
|
323 |
// ----------------------------------------------------------------------------- |
|
324 |
// |
|
325 |
void CVcxHgMyVideosVideoModelHandler::HandleMarkCommandL( TInt aMarkCommand ) |
|
326 |
{ |
|
327 |
switch ( aMarkCommand ) |
|
328 |
{ |
|
329 |
case EVcxHgMyVideosCmdMark: |
|
330 |
{ |
|
331 |
TInt highlight = Highlight(); |
|
332 |
iScroller.Mark( highlight ); |
|
333 |
iScroller.RefreshScreen( highlight ); |
|
334 |
} |
|
335 |
break; |
|
336 |
case EVcxHgMyVideosCmdUnmark: |
|
337 |
{ |
|
338 |
TInt highlight = Highlight(); |
|
339 |
iScroller.UnMark( highlight ); |
|
340 |
iScroller.RefreshScreen( highlight ); |
|
341 |
} |
|
342 |
break; |
|
343 |
case EVcxHgMyVideosCmdMarkAll: |
|
344 |
{ |
|
345 |
iScroller.MarkAll(); |
|
346 |
} |
|
347 |
break; |
|
348 |
case EVcxHgMyVideosCmdUnmarkAll: |
|
349 |
{ |
|
350 |
iScroller.UnMarkAll(); |
|
351 |
} |
|
352 |
break; |
|
353 |
default: |
|
354 |
{ |
|
355 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # HandleMarkCommandL - LEAVE: Invalid mark command" ); |
|
356 |
User::Leave( KErrNotSupported ); |
|
357 |
} |
|
358 |
break; |
|
359 |
} |
|
360 |
} |
|
361 |
||
362 |
// ----------------------------------------------------------------------------- |
|
363 |
// CVcxHgMyVideosVideoModelHandler::VideoAgeProfileL() |
|
364 |
// ----------------------------------------------------------------------------- |
|
365 |
// |
|
366 |
TInt32 CVcxHgMyVideosVideoModelHandler::VideoAgeProfileL( TInt aIndex ) |
|
367 |
{ |
|
368 |
return VideoAgeProfileL( iVideoArray->MPXMedia( aIndex ) ); |
|
369 |
} |
|
370 |
||
371 |
// ----------------------------------------------------------------------------- |
|
372 |
// CVcxHgMyVideosVideoModelHandler::VideoAgeProfileL() |
|
373 |
// ----------------------------------------------------------------------------- |
|
374 |
// |
|
375 |
TInt32 CVcxHgMyVideosVideoModelHandler::VideoAgeProfileL( TMPXItemId aId ) |
|
376 |
{ |
|
377 |
return VideoAgeProfileL( iVideoArray->MPXMediaByMPXItemId( aId ) ); |
|
378 |
} |
|
379 |
||
380 |
// ----------------------------------------------------------------------------- |
|
381 |
// CVcxHgMyVideosVideoModelHandler::VideoAgeProfileL() |
|
382 |
// ----------------------------------------------------------------------------- |
|
383 |
// |
|
384 |
TInt32 CVcxHgMyVideosVideoModelHandler::VideoAgeProfileL( CMPXMedia* aMedia ) |
|
385 |
{ |
|
386 |
TInt32 ageProfile( 0 ); |
|
387 |
||
388 |
if ( aMedia ) |
|
389 |
{ |
|
390 |
if ( aMedia->IsSupported( KVcxMediaMyVideosAgeProfile ) ) |
|
391 |
{ |
|
392 |
ageProfile = aMedia->ValueTObjectL<TInt32>( KVcxMediaMyVideosAgeProfile ); |
|
393 |
} |
|
394 |
} |
|
395 |
||
396 |
return ageProfile; |
|
397 |
} |
|
398 |
||
399 |
// ----------------------------------------------------------------------------- |
|
400 |
// CVcxHgMyVideosVideoModelHandler::FindVideoMpxIdL() |
|
401 |
// Tries to find MPX Item Id based on URI. Does not modify MPX Item Id's initial |
|
402 |
// value if video not found. |
|
403 |
// ----------------------------------------------------------------------------- |
|
404 |
// |
|
405 |
TBool CVcxHgMyVideosVideoModelHandler::FindVideoMpxIdL( const TDesC& aVideoPath, |
|
406 |
TMPXItemId& aMpxItemId ) |
|
407 |
{ |
|
408 |
CMPXMedia* media = iVideoArray->MPXMediaByUri( aVideoPath ); |
|
409 |
if ( media ) |
|
410 |
{ |
|
411 |
if ( media->IsSupported( KMPXMediaGeneralId ) ) |
|
412 |
{ |
|
413 |
aMpxItemId = media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
414 |
return ETrue; |
|
415 |
} |
|
416 |
} |
|
417 |
return EFalse; |
|
418 |
} |
|
419 |
||
420 |
// ----------------------------------------------------------------------------- |
|
421 |
// CVcxHgMyVideosVideoModelHandler::ShowVideoDetailsDialogL() |
|
422 |
// ----------------------------------------------------------------------------- |
|
423 |
// |
|
424 |
void CVcxHgMyVideosVideoModelHandler::ShowVideoDetailsDialogL() |
|
425 |
{ |
|
426 |
TInt highlight = Highlight(); |
|
427 |
||
428 |
if ( highlight != KErrNotFound ) |
|
429 |
{ |
|
430 |
TMPXItemId mpxItemId = iVideoArray->ArrayIndexToMpxItemIdL( highlight ); |
|
431 |
iModel.CollectionClient().GetVideoDetailsL( mpxItemId ); |
|
432 |
} |
|
433 |
} |
|
434 |
||
435 |
// ----------------------------------------------------------------------------- |
|
436 |
// |
|
437 |
// ----------------------------------------------------------------------------- |
|
438 |
// |
|
439 |
CMyVideosIndicator& CVcxHgMyVideosVideoModelHandler::VideoIndicator() |
|
440 |
{ |
|
441 |
return *iVideoIndicator; |
|
442 |
} |
|
443 |
||
444 |
// ----------------------------------------------------------------------------- |
|
445 |
// CVcxHgMyVideosVideoModelHandler::GetVideoName() |
|
446 |
// ----------------------------------------------------------------------------- |
|
447 |
// |
|
448 |
const TDesC& CVcxHgMyVideosVideoModelHandler::GetVideoName( TInt aId ) |
|
449 |
{ |
|
450 |
CMPXMedia* media = iVideoArray->MPXMediaByMPXItemId( TMPXItemId( aId, 0 ) ); |
|
451 |
||
452 |
if ( media && media->IsSupported( KMPXMediaGeneralTitle ) ) |
|
453 |
{ |
|
454 |
return media->ValueText( KMPXMediaGeneralTitle ); |
|
455 |
} |
|
456 |
return KNullDesC; |
|
457 |
} |
|
458 |
||
459 |
// ----------------------------------------------------------------------------- |
|
460 |
// CVcxHgMyVideosVideoModelHandler::GetVideoUri() |
|
461 |
// ----------------------------------------------------------------------------- |
|
462 |
// |
|
463 |
const TDesC& CVcxHgMyVideosVideoModelHandler::GetVideoUri( TInt aIndex ) |
|
464 |
{ |
|
465 |
CMPXMedia* media = iVideoArray->MPXMedia( aIndex ); |
|
466 |
||
467 |
if ( media && media->IsSupported( KMPXMediaGeneralUri ) ) |
|
468 |
{ |
|
469 |
return media->ValueText( KMPXMediaGeneralUri ); |
|
470 |
} |
|
471 |
return KNullDesC; |
|
472 |
} |
|
473 |
||
474 |
// ----------------------------------------------------------------------------- |
|
475 |
// CVcxHgMyVideosVideoModelHandler::GetVideoId() |
|
476 |
// ----------------------------------------------------------------------------- |
|
477 |
// |
|
478 |
TInt CVcxHgMyVideosVideoModelHandler::GetVideoId( TInt aIndex ) |
|
479 |
{ |
|
480 |
CMPXMedia* media = iVideoArray->MPXMedia( aIndex ); |
|
481 |
||
482 |
if ( media && media->IsSupported( KMPXMediaGeneralId ) ) |
|
483 |
{ |
|
484 |
return media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ).iId1; |
|
485 |
} |
|
486 |
||
487 |
return KErrNotFound; |
|
488 |
} |
|
489 |
||
490 |
// ----------------------------------------------------------------------------- |
|
491 |
// CVcxHgMyVideosVideoModelHandler::GetVideoSize() |
|
492 |
// ----------------------------------------------------------------------------- |
|
493 |
// |
|
494 |
TInt64 CVcxHgMyVideosVideoModelHandler::GetVideoSize( TInt aIndex ) |
|
495 |
{ |
|
496 |
CMPXMedia* media = iVideoArray->MPXMedia( aIndex ); |
|
497 |
||
498 |
if ( media && media->IsSupported( KMPXMediaGeneralExtSizeInt64 ) ) |
|
499 |
{ |
|
500 |
return media->ValueTObjectL<TInt64>( KMPXMediaGeneralExtSizeInt64 ); |
|
501 |
} |
|
502 |
return 0; |
|
503 |
} |
|
504 |
||
505 |
// ----------------------------------------------------------------------------- |
|
506 |
// CVcxHgMyVideosVideoModelHandler::DeleteVideosL() |
|
507 |
// ----------------------------------------------------------------------------- |
|
508 |
// |
|
509 |
void CVcxHgMyVideosVideoModelHandler::DeleteVideosL( |
|
510 |
const RArray<TInt>& aOperationTargets ) |
|
511 |
{ |
|
512 |
CMPXMedia* media = NULL; |
|
513 |
TMPXItemId mpxItemId; |
|
514 |
CMPXMedia* mediaToDelete = NULL; |
|
515 |
CMPXMediaArray* mediasToDelete = CMPXMediaArray::NewL(); |
|
516 |
CleanupStack::PushL( mediasToDelete ); |
|
517 |
||
518 |
for ( TInt i = 0; i < aOperationTargets.Count(); i++ ) |
|
519 |
{ |
|
520 |
media = iVideoArray->MPXMediaByMPXItemId( TMPXItemId(aOperationTargets[i],0) ); |
|
521 |
||
522 |
if ( media && media->IsSupported( KMPXMediaGeneralId ) ) |
|
523 |
{ |
|
524 |
mpxItemId = media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
525 |
mediaToDelete = CMPXMedia::NewL(); |
|
526 |
CleanupStack::PushL( mediaToDelete ); |
|
527 |
mediaToDelete->SetTObjectValueL( KMPXMediaGeneralId, mpxItemId ); |
|
528 |
mediasToDelete->AppendL( *mediaToDelete ); |
|
529 |
CleanupStack::PopAndDestroy( mediaToDelete ); |
|
530 |
iDataUpdater->PrepareForMoveOrDelete( mpxItemId ); |
|
531 |
} |
|
532 |
} |
|
533 |
||
534 |
if ( mediasToDelete->Count() <= 0 ) |
|
535 |
{ |
|
536 |
User::Leave( KErrNotFound ); |
|
537 |
} |
|
538 |
||
539 |
TRAPD( err, iModel.CollectionClient().DeleteVideosL( mediasToDelete ) ); |
|
540 |
||
541 |
if ( err != KErrNone ) |
|
542 |
{ |
|
543 |
VideoDeletionCompletedL( aOperationTargets.Count(), mpxItemId ); |
|
544 |
if ( err != KErrNotReady ) |
|
545 |
{ |
|
546 |
User::Leave( err ); |
|
547 |
} |
|
548 |
} |
|
549 |
CleanupStack::PopAndDestroy( mediasToDelete ); |
|
550 |
} |
|
551 |
||
552 |
// ----------------------------------------------------------------------------- |
|
553 |
// CVcxHgMyVideosVideoModelHandler::MoveOrCopyVideosL() |
|
554 |
// ----------------------------------------------------------------------------- |
|
555 |
// |
|
556 |
void CVcxHgMyVideosVideoModelHandler::MoveOrCopyVideosL( |
|
557 |
const RArray<TInt>& aOperationTargets, |
|
558 |
TInt aTargetDrive, |
|
559 |
TBool aCopy ) |
|
560 |
{ |
|
561 |
CMPXMedia* media = NULL; |
|
562 |
TMPXItemId mpxItemId; |
|
563 |
CMPXMedia* mediaToMoveOrCopy = NULL; |
|
564 |
CMPXMediaArray* mediasToMoveOrCopy = CMPXMediaArray::NewL(); |
|
565 |
CleanupStack::PushL( mediasToMoveOrCopy ); |
|
566 |
||
567 |
for ( TInt i = 0; i < aOperationTargets.Count(); i++ ) |
|
568 |
{ |
|
569 |
media = iVideoArray->MPXMediaByMPXItemId( TMPXItemId(aOperationTargets[i],0) ); |
|
570 |
||
571 |
if ( media && media->IsSupported( KMPXMediaGeneralId ) ) |
|
572 |
{ |
|
573 |
mpxItemId = media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
574 |
mediaToMoveOrCopy = CMPXMedia::NewL(); |
|
575 |
CleanupStack::PushL( mediaToMoveOrCopy ); |
|
576 |
mediaToMoveOrCopy->SetTObjectValueL( KMPXMediaGeneralId, mpxItemId ); |
|
577 |
mediasToMoveOrCopy->AppendL( *mediaToMoveOrCopy ); |
|
578 |
CleanupStack::PopAndDestroy( mediaToMoveOrCopy ); |
|
579 |
iDataUpdater->PrepareForMoveOrDelete( mpxItemId ); |
|
580 |
} |
|
581 |
} |
|
582 |
||
583 |
if ( mediasToMoveOrCopy->Count() <= 0 ) |
|
584 |
{ |
|
585 |
User::Leave( KErrNotFound ); |
|
586 |
} |
|
587 |
||
588 |
iModel.CollectionClient().MoveOrCopyVideosL( mediasToMoveOrCopy, aTargetDrive, aCopy ); |
|
589 |
||
590 |
CleanupStack::PopAndDestroy( mediasToMoveOrCopy ); |
|
591 |
} |
|
592 |
||
593 |
// ----------------------------------------------------------------------------- |
|
594 |
// CVcxHgMyVideosVideoModelHandler::PlayVideoL() |
|
595 |
// ----------------------------------------------------------------------------- |
|
596 |
// |
|
597 |
void CVcxHgMyVideosVideoModelHandler::PlayVideoL( TInt aIndex ) |
|
598 |
{ |
|
599 |
CMPXMedia* media = iVideoArray->MPXMedia( aIndex ); |
|
600 |
||
601 |
if ( media && media->IsSupported( KMPXMediaGeneralId ) ) |
|
602 |
{ |
|
603 |
// Playback should be tried always when single clicking a video in My Videos |
|
604 |
TMPXItemId mpxItemId = media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
605 |
SetVideoLastWatchedL( *media ); |
|
606 |
ClearNewVideoFlagL( *media ); |
|
64
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
607 |
ResetEmptyDrmThumnailL( *media, aIndex ); |
57 | 608 |
IPTVLOGSTRING3_LOW_LEVEL( "CVcxHgMyVideosVideoModelHandler::PlayVideoL() aIndex=%d mpxItemId=%d", aIndex, (TInt) mpxItemId ); |
609 |
iModel.CollectionClient().PlayVideoL( mpxItemId ); |
|
610 |
} |
|
611 |
} |
|
612 |
||
613 |
// ----------------------------------------------------------------------------- |
|
614 |
// CVcxHgMyVideosVideoModelHandler::Release() |
|
615 |
// ----------------------------------------------------------------------------- |
|
616 |
// |
|
617 |
void CVcxHgMyVideosVideoModelHandler::Release( TInt aReleaseStart, |
|
618 |
TInt aReleaseEnd ) |
|
619 |
{ |
|
620 |
for ( TInt i = aReleaseStart; i <= aReleaseEnd; i++ ) |
|
621 |
{ |
|
622 |
TRAP_IGNORE( iDataUpdater->ReleaseData( iVideoArray->ArrayIndexToMpxItemIdL( i ) ) ); |
|
623 |
} |
|
624 |
} |
|
625 |
||
626 |
// ----------------------------------------------------------------------------- |
|
627 |
// CVcxHgMyVideosVideoModelHandler::Request() |
|
628 |
// ----------------------------------------------------------------------------- |
|
629 |
// |
|
630 |
void CVcxHgMyVideosVideoModelHandler::Request( TInt aRequestStart, |
|
631 |
TInt aRequestEnd, |
|
632 |
THgScrollDirection aDirection ) |
|
633 |
{ |
|
634 |
TRAP_IGNORE( HandleRequestL( aRequestStart, aRequestEnd, aDirection ) ); |
|
635 |
} |
|
636 |
||
637 |
// ----------------------------------------------------------------------------- |
|
638 |
// CVcxHgMyVideosVideoModelHandler::HandleRequestL() |
|
639 |
// ----------------------------------------------------------------------------- |
|
640 |
// |
|
641 |
void CVcxHgMyVideosVideoModelHandler::HandleRequestL( TInt aRequestStart, |
|
642 |
TInt aRequestEnd, |
|
643 |
THgScrollDirection /*aDirection*/ ) |
|
644 |
{ |
|
645 |
IPTVLOGSTRING_LOW_LEVEL( |
|
646 |
"MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::HandleRequestL - Enter" ); |
|
647 |
||
648 |
TInt videoCount = iVideoArray->VideoCount(); |
|
649 |
TInt requestStart = ( aRequestStart >= 0 ? aRequestStart : 0 ); |
|
650 |
TInt requestEnd = ( aRequestEnd < videoCount ? aRequestEnd : ( videoCount - 1 ) ); |
|
651 |
||
652 |
IPTVLOGSTRING3_LOW_LEVEL( |
|
653 |
"MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::HandleRequestL - aRequestStart: %d, aRequestEnd: %d", requestStart, requestEnd ); |
|
654 |
||
655 |
TBool flushNeeded = EFalse; |
|
656 |
for ( TInt i = requestStart; i <= requestEnd; i++ ) |
|
657 |
{ |
|
658 |
UpdateVideoListItemL( i ); |
|
659 |
iDataUpdater->AddToRequestBufferL( iVideoArray->ArrayIndexToMpxItemIdL( i ) ); |
|
660 |
flushNeeded = ETrue; |
|
661 |
} |
|
662 |
if ( flushNeeded ) |
|
663 |
{ |
|
664 |
iDataUpdater->FlushRequestBufferL(); |
|
665 |
} |
|
666 |
||
667 |
iScroller.DrawDeferred(); |
|
668 |
||
669 |
IPTVLOGSTRING_LOW_LEVEL( |
|
670 |
"MPX My Videos UI # CVcxHgMyVideosVideoModelHandler::HandleRequestL() - Exit" ); |
|
671 |
} |
|
672 |
||
673 |
// ----------------------------------------------------------------------------- |
|
674 |
// CVcxHgMyVideosVideoModelHandler::FormatVideoSecondRowLC() |
|
675 |
// ----------------------------------------------------------------------------- |
|
676 |
// |
|
677 |
HBufC* CVcxHgMyVideosVideoModelHandler::FormatVideoSecondRowLC( CMPXMedia& aMedia ) |
|
678 |
||
679 |
{ |
|
680 |
_LIT( KVcxSecondLineSeparator, "," ); |
|
681 |
||
682 |
HBufC* details = NULL; |
|
683 |
HBufC* sizeStr = NULL; |
|
684 |
HBufC* lengthStr = NULL; |
|
685 |
TReal32 length( 0 ); |
|
686 |
TInt64 size( 0 ); |
|
687 |
TInt detailsSize( 0 ); |
|
688 |
||
689 |
// Use KMPXMediaGeneralDuration or KVcxMediaMyVideosDuration? |
|
690 |
if ( aMedia.IsSupported( KVcxMediaMyVideosDuration ) ) |
|
691 |
{ |
|
692 |
length = *( aMedia.Value<TReal32>( KVcxMediaMyVideosDuration ) ); // In seconds |
|
693 |
IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # FormatVideoSecondRowCompletedLC() length=%f", length ); |
|
694 |
} |
|
695 |
||
696 |
if ( aMedia.IsSupported( KMPXMediaGeneralExtSizeInt64 ) ) |
|
697 |
{ |
|
698 |
size = *( aMedia.Value<TInt64>( KMPXMediaGeneralExtSizeInt64 ) ); // In bytes |
|
699 |
IPTVLOGSTRING2_LOW_LEVEL( "MPX My Videos UI # FormatVideoSecondRowCompletedLC() size=%ld", size ); |
|
700 |
} |
|
701 |
||
702 |
if ( size > 0 ) |
|
703 |
{ |
|
704 |
TUint64 bytes = static_cast<TUint64>( size ); |
|
705 |
TUint64 dispSize = 0; |
|
706 |
||
707 |
if ( bytes >= KVcxVideoSizeGB ) |
|
708 |
{ |
|
709 |
dispSize = bytes + KVcxVideoSizeHalfGB; |
|
710 |
dispSize /= KVcxVideoSizeGB; |
|
711 |
sizeStr = StringLoader::LoadLC( R_VCXHGMYVIDEOS_SIZE_LIST_GB, dispSize ); |
|
712 |
} |
|
713 |
else if ( bytes >= KVcxVideoSizeMB ) |
|
714 |
{ |
|
715 |
dispSize = bytes + KVcxVideoSizeHalfMB; |
|
716 |
dispSize /= KVcxVideoSizeMB; |
|
717 |
sizeStr = StringLoader::LoadLC( R_VCXHGMYVIDEOS_SIZE_LIST_MB, dispSize ); |
|
718 |
} |
|
719 |
else |
|
720 |
{ |
|
721 |
dispSize = bytes + KVcxVideoSizeHalfKB; |
|
722 |
dispSize /= KVcxVideoSizeKB; |
|
723 |
sizeStr = StringLoader::LoadLC( R_VCXHGMYVIDEOS_LIST_SIZE_KB, dispSize ); |
|
724 |
} |
|
725 |
detailsSize += sizeStr->Length(); |
|
726 |
} |
|
727 |
if ( length > 0 ) |
|
728 |
{ |
|
729 |
TUint total = static_cast<TUint>( length ); |
|
730 |
||
731 |
TUint hours = total / KVcxSecondsInHour; |
|
732 |
TUint minutes = total / KVcxSecondsInMinute % KVcxSecondsInMinute; |
|
733 |
TUint seconds = total % KVcxSecondsInMinute; |
|
734 |
||
735 |
if ( hours > 0 ) |
|
736 |
{ |
|
737 |
CArrayFix<TInt>* numbers = new (ELeave) CArrayFixFlat<TInt>(2); |
|
738 |
CleanupStack::PushL( numbers ); |
|
739 |
numbers->AppendL( hours ); |
|
740 |
numbers->AppendL( minutes ); |
|
741 |
lengthStr = StringLoader::LoadL( R_VCXHGMYVIDEOS_VIDEO_LIST_LENGTH_H_MIN, *numbers ); |
|
742 |
CleanupStack::PopAndDestroy( numbers ); |
|
743 |
CleanupStack::PushL( lengthStr ); |
|
744 |
} |
|
745 |
else if ( minutes > 0 ) |
|
746 |
{ |
|
747 |
CArrayFix<TInt>* numbers = new (ELeave) CArrayFixFlat<TInt>(2); |
|
748 |
CleanupStack::PushL( numbers ); |
|
749 |
numbers->AppendL( minutes ); |
|
750 |
numbers->AppendL( seconds ); |
|
751 |
lengthStr = StringLoader::LoadL( R_VCXHGMYVIDEOS_VIDEO_LIST_LENGTH_MIN_SEC, *numbers ); |
|
752 |
CleanupStack::PopAndDestroy( numbers ); |
|
753 |
CleanupStack::PushL( lengthStr ); |
|
754 |
} |
|
755 |
else |
|
756 |
{ |
|
757 |
lengthStr = StringLoader::LoadLC( R_VCXHGMYVIDEOS_VIDEO_LIST_LENGTH_SEC, seconds ); |
|
758 |
} |
|
759 |
detailsSize += lengthStr->Length(); |
|
760 |
} |
|
761 |
||
762 |
details = HBufC::NewL( detailsSize + KVcxSecondLineSeparator().Length() ); |
|
763 |
if ( lengthStr ) |
|
764 |
{ |
|
765 |
details->Des().Append( *lengthStr ); |
|
766 |
CleanupStack::PopAndDestroy( lengthStr ); |
|
767 |
} |
|
768 |
if ( sizeStr ) |
|
769 |
{ |
|
770 |
if ( lengthStr ) // Add separator when both are available. |
|
771 |
{ |
|
772 |
details->Des().Append( KVcxSecondLineSeparator ); |
|
773 |
} |
|
774 |
details->Des().Append( *sizeStr ); |
|
775 |
CleanupStack::PopAndDestroy( sizeStr ); |
|
776 |
} |
|
777 |
||
778 |
CleanupStack::PushL( details ); |
|
779 |
return details; |
|
780 |
} |
|
781 |
||
782 |
// ----------------------------------------------------------------------------- |
|
783 |
// CVcxHgMyVideosVideoModelHandler::ReplaceVideoArrayL() |
|
784 |
// ----------------------------------------------------------------------------- |
|
785 |
// |
|
786 |
void CVcxHgMyVideosVideoModelHandler::ReplaceVideoArrayL( CMPXMediaArray& aVideoList ) |
|
787 |
{ |
|
788 |
iVideoArray->ReplaceVideoListL( aVideoList ); |
|
789 |
iDataUpdater->InfoArrayChanged(); |
|
790 |
} |
|
791 |
||
792 |
// ----------------------------------------------------------------------------- |
|
793 |
// CVcxHgMyVideosVideoModelHandler::UpdateVideoListItemL() |
|
794 |
// ----------------------------------------------------------------------------- |
|
795 |
// |
|
796 |
void CVcxHgMyVideosVideoModelHandler::UpdateVideoListItemL( TInt aListIndex ) |
|
797 |
{ |
|
798 |
IPTVLOGSTRING2_LOW_LEVEL( "CVcxHgMyVideosVideoModelHandler::UpdateVideoListItemL() ENTER list index = %d", aListIndex ); |
|
799 |
||
800 |
if ( aListIndex >= 0 && aListIndex < iScroller.ItemCount() ) |
|
801 |
{ |
|
802 |
TVcxHgMyVideosIndicatorHelper indicatorHelper; |
|
803 |
CMPXMedia* media( NULL ); |
|
804 |
||
805 |
media = iVideoArray->MPXMedia( aListIndex ); |
|
806 |
||
807 |
if ( media ) |
|
808 |
{ |
|
809 |
CHgItem& item = iScroller.ItemL( aListIndex ); |
|
810 |
TBool isMarked = ( item.Flags() & CHgItem::EHgItemFlagMarked ); |
|
811 |
item.ClearFlags( item.Flags() ); |
|
812 |
||
813 |
if ( media->IsSupported( KMPXMediaGeneralTitle ) ) |
|
814 |
{ |
|
815 |
HBufC* name( NULL ); |
|
816 |
name = media->ValueText( KMPXMediaGeneralTitle ).AllocLC(); |
|
817 |
if ( name->Length() > 0 ) |
|
818 |
{ |
|
819 |
item.SetTitleL( *name ); |
|
820 |
} |
|
821 |
CleanupStack::PopAndDestroy( name ); |
|
822 |
} |
|
823 |
||
824 |
HBufC* details( NULL ); |
|
825 |
||
826 |
details = FormatVideoSecondRowLC( *media ); |
|
827 |
if ( details->Length() > 0 ) |
|
828 |
{ |
|
829 |
item.SetTextL( *details ); |
|
830 |
} |
|
831 |
CleanupStack::PopAndDestroy( details ); |
|
832 |
||
833 |
TBool isNewVideo( EFalse ); |
|
834 |
if ( media->IsSupported( KMPXMediaGeneralFlags ) ) |
|
835 |
{ |
|
836 |
if ( media->ValueTObjectL<TUint32>( KMPXMediaGeneralFlags ) & |
|
837 |
EVcxMyVideosVideoNew ) |
|
838 |
{ |
|
839 |
isNewVideo = ETrue; |
|
840 |
} |
|
841 |
} |
|
842 |
TInt indicator1( 0 ); |
|
843 |
TInt indicator2( 0 ); |
|
844 |
||
845 |
indicatorHelper.GetIndicatorsForVideoL( |
|
846 |
iModel, |
|
847 |
isNewVideo, |
|
848 |
EFalse, // *Recordings* |
|
849 |
media->ValueText( KMPXMediaGeneralUri ), |
|
850 |
TVcxHgMyVideosIndicatorHelper::EIndicatorDrmStatusUnknown, |
|
851 |
indicator1, |
|
852 |
indicator2 ); |
|
853 |
if ( indicator1 ) |
|
854 |
{ |
|
855 |
item.SetFlags( indicator1 ); |
|
856 |
} |
|
857 |
if ( indicator2 ) |
|
858 |
{ |
|
859 |
item.SetFlags( indicator2 ); |
|
860 |
} |
|
861 |
if ( isMarked ) |
|
862 |
{ |
|
863 |
item.SetFlags( CHgItem::EHgItemFlagMarked ); |
|
864 |
} |
|
865 |
if ( item.Icon() && VideoIndicator().IsIndicatorShown( *media ) ) |
|
866 |
{ |
|
867 |
item.SetFlags( CHgItem::EHgItemFlagsIconOverlayIndicator ); |
|
868 |
} |
|
869 |
if ( media->IsSupported( KMPXMediaGeneralDate ) ) |
|
870 |
{ |
|
871 |
TInt64 itemDate = media->ValueTObjectL<TInt64>( KMPXMediaGeneralDate ); |
|
872 |
item.SetTime( itemDate ); |
|
873 |
} |
|
874 |
} |
|
875 |
} |
|
876 |
||
877 |
IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosVideoModelHandler::UpdateVideoListItemL() RETURN" ); |
|
878 |
} |
|
879 |
||
880 |
// ----------------------------------------------------------------------------- |
|
881 |
// CVcxHgMyVideosVideoModelHandler::DeleteItemL() |
|
882 |
// ----------------------------------------------------------------------------- |
|
883 |
// |
|
884 |
void CVcxHgMyVideosVideoModelHandler::DeleteItemL( TMPXItemId aMpxItemId ) |
|
885 |
{ |
|
886 |
// Remove video from data updater. |
|
887 |
iDataUpdater->ReleaseData( aMpxItemId ); |
|
888 |
||
889 |
// Remove video from video array. |
|
890 |
TInt removedIndex = iVideoArray->RemoveVideo( aMpxItemId ); |
|
891 |
||
892 |
if ( removedIndex != KErrNotFound ) |
|
893 |
{ |
|
894 |
// Remove item from the list. |
|
895 |
iScroller.RemoveItem( removedIndex ); |
|
896 |
||
897 |
if ( iScroller.ItemCount() > 0 ) |
|
898 |
{ |
|
899 |
TInt selectedIndex = iScroller.SelectedIndex(); |
|
900 |
||
901 |
// Selected index number is greater than |
|
902 |
// item count. Set the last item to be highlighted. |
|
903 |
if ( selectedIndex >= iScroller.ItemCount() ) |
|
904 |
{ |
|
905 |
iScroller.SetSelectedIndex( iScroller.ItemCount() - 1 ); |
|
906 |
} |
|
907 |
} |
|
908 |
else |
|
909 |
{ |
|
910 |
// Last item has deleted, set empty text and reset list. |
|
911 |
iVideoListImpl.SetEmptyListTextByResourceL( R_VCXHGMYVIDEOS_NO_VIDEOS ); |
|
912 |
iScroller.Reset(); |
|
913 |
||
914 |
// End marking mode for empty list |
|
915 |
if ( iVideoListImpl.IsMarking() ) |
|
916 |
{ |
|
917 |
iVideoListImpl.EndMarkingMode(); |
|
918 |
iView.DynInitRskL(); |
|
919 |
} |
|
920 |
} |
|
921 |
||
922 |
// fix for error where highlight was sometimes lost after delete. Problem is |
|
923 |
// that someone is 'stealing' keyboard focus from the scroller (probably the |
|
924 |
// confirmation note, as user needs to clicks them to start the delete). |
|
925 |
iScroller.SetFocus( ETrue ); |
|
926 |
||
927 |
iScroller.DrawDeferred(); |
|
928 |
iView.DynInitMskL(); |
|
929 |
} |
|
930 |
} |
|
931 |
||
932 |
// ----------------------------------------------------------------------------- |
|
933 |
// CVcxHgMyVideosVideoModelHandler::InsertVideoL() |
|
934 |
// ----------------------------------------------------------------------------- |
|
935 |
// |
|
936 |
void CVcxHgMyVideosVideoModelHandler::InsertVideoL( CMPXMedia* aVideo ) |
|
937 |
{ |
|
938 |
if ( aVideo ) |
|
939 |
{ |
|
940 |
if ( aVideo->IsSupported( KMPXMediaGeneralId ) ) |
|
941 |
{ |
|
942 |
CleanupStack::PushL( aVideo ); |
|
943 |
TMPXItemId itemId = aVideo->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ); |
|
944 |
||
945 |
// Get current sort order. |
|
946 |
TVcxMyVideosSortingOrder sortOrder = iModel.VideolistSortOrderL(); |
|
947 |
||
948 |
// Ownership of video item is transferred to video array. |
|
949 |
CleanupStack::Pop( aVideo ); |
|
950 |
iVideoArray->AddToCorrectPlaceL( aVideo, sortOrder ); |
|
951 |
||
952 |
TInt index = iVideoArray->IndexByMPXItemId( itemId ); |
|
953 |
||
954 |
if ( index >= 0 ) |
|
955 |
{ |
|
956 |
// Create a new Hg list item. Ownership of list item |
|
957 |
// is transferred to scroller. |
|
958 |
CHgItem* listItem = CHgItem::NewL(); |
|
959 |
iScroller.InsertItem( listItem, index ); |
|
960 |
||
961 |
if ( iScroller.SelectedIndex() == KErrNotFound ) |
|
962 |
{ |
|
963 |
iScroller.SetSelectedIndex( 0 ); |
|
964 |
} |
|
965 |
UpdateVideoListItemL( index ); |
|
966 |
||
967 |
// Update screen. |
|
968 |
iScroller.DrawDeferred(); |
|
969 |
iView.DynInitMskL(); |
|
970 |
||
971 |
iDataUpdater->RequestDataL( itemId ); |
|
972 |
} |
|
973 |
} |
|
974 |
else |
|
975 |
{ |
|
976 |
delete aVideo; |
|
977 |
} |
|
978 |
} |
|
979 |
} |
|
980 |
||
981 |
// ----------------------------------------------------------------------------- |
|
982 |
// CVcxHgMyVideosVideoModelHandler::ValidOrigin() |
|
983 |
// ----------------------------------------------------------------------------- |
|
984 |
// |
|
985 |
TBool CVcxHgMyVideosVideoModelHandler::ValidOrigin( CMPXMedia& aMedia ) |
|
986 |
{ |
|
987 |
IPTVLOGSTRING_LOW_LEVEL( |
|
988 |
"MPX My Videos UI # ValidOrigin - Enter" ); |
|
989 |
||
990 |
TBool isValid( EFalse ); |
|
991 |
||
992 |
if ( aMedia.IsSupported( KVcxMediaMyVideosOrigin ) ) |
|
993 |
{ |
|
994 |
TUint8 mediaOrigin( EVcxMyVideosOriginOther ); |
|
995 |
mediaOrigin = aMedia.ValueTObjectL<TUint8>( KVcxMediaMyVideosOrigin ); |
|
996 |
||
997 |
// All videos |
|
998 |
if ( CurrentCategoryIndex() == KVcxMvcCategoryIdAll ) |
|
999 |
{ |
|
1000 |
IPTVLOGSTRING_LOW_LEVEL( |
|
1001 |
"MPX My Videos UI # ValidOrigin - Origin: All" ); |
|
1002 |
isValid = ETrue; |
|
1003 |
} |
|
1004 |
// Captured |
|
1005 |
else if ( CurrentCategoryIndex() == KVcxMvcCategoryIdCaptured && |
|
1006 |
mediaOrigin == EVcxMyVideosOriginCapturedWithCamera ) |
|
1007 |
{ |
|
1008 |
IPTVLOGSTRING_LOW_LEVEL( |
|
1009 |
"MPX My Videos UI # ValidOrigin - Origin: Captured" ); |
|
1010 |
isValid = ETrue; |
|
1011 |
} |
|
1012 |
// Downloads |
|
1013 |
else if ( CurrentCategoryIndex() == KVcxMvcCategoryIdDownloads && |
|
1014 |
mediaOrigin == EVcxMyVideosOriginDownloaded ) |
|
1015 |
{ |
|
1016 |
IPTVLOGSTRING_LOW_LEVEL( |
|
1017 |
"MPX My Videos UI # ValidOrigin - Origin: Downloads" ); |
|
1018 |
isValid = ETrue; |
|
1019 |
} |
|
1020 |
// Other |
|
1021 |
else if ( CurrentCategoryIndex() == KVcxMvcCategoryIdOther && |
|
1022 |
( mediaOrigin == EVcxMyVideosOriginSideLoaded || |
|
1023 |
mediaOrigin == EVcxMyVideosOriginOther ) ) |
|
1024 |
{ |
|
1025 |
IPTVLOGSTRING_LOW_LEVEL( |
|
1026 |
"MPX My Videos UI # ValidOrigin - Origin: Other" ); |
|
1027 |
isValid = ETrue; |
|
1028 |
} |
|
1029 |
} |
|
1030 |
IPTVLOGSTRING2_LOW_LEVEL( |
|
1031 |
"MPX My Videos UI # ValidOrigin, isValid %b - Exit", isValid ); |
|
1032 |
return isValid; |
|
1033 |
} |
|
1034 |
||
1035 |
// ----------------------------------------------------------------------------- |
|
1036 |
// CVcxHgMyVideosVideoModelHandler::NewVideoListL() |
|
1037 |
// MPX Collection calls this callback when video list is available. |
|
1038 |
// ----------------------------------------------------------------------------- |
|
1039 |
// |
|
1040 |
void CVcxHgMyVideosVideoModelHandler::NewVideoListL( CMPXMediaArray& aVideoList ) |
|
1041 |
{ |
|
1042 |
IPTVLOGSTRING2_LOW_LEVEL( |
|
1043 |
"MPX My Videos UI # NewVideoListL(count=%d) - Enter", aVideoList.Count() ); |
|
1044 |
||
1045 |
TBool sameItems = iVideoArray->HasSameItemsL( aVideoList ); |
|
1046 |
if ( !sameItems ) |
|
1047 |
{ |
|
1048 |
ReplaceVideoArrayL( aVideoList ); |
|
1049 |
} |
|
1050 |
||
1051 |
TInt videoCount = iVideoArray->VideoCount(); |
|
1052 |
if ( videoCount > 0 ) |
|
1053 |
{ |
|
1054 |
if ( !sameItems ) |
|
1055 |
{ |
|
1056 |
ResizeScrollerL( videoCount ); |
|
1057 |
} |
|
1058 |
||
1059 |
TInt firstItemIndex( KErrNotFound ); |
|
1060 |
||
1061 |
if ( iRestoreListPosition ) |
|
1062 |
{ |
|
1063 |
firstItemIndex = iVideoArray->IndexByMPXItemId( iFirstListItemId ); |
|
1064 |
} |
|
1065 |
||
1066 |
IPTVLOGSTRING2_LOW_LEVEL( "CVcxHgMyVideosVideoModelHandler::NewVideoListL() Setting list position first index = %d", firstItemIndex ); |
|
1067 |
firstItemIndex != KErrNotFound ? iScroller.SetFirstIndexOnScreen( firstItemIndex ) : |
|
1068 |
iScroller.SetFirstIndexOnScreen( 0 ); |
|
1069 |
} |
|
1070 |
else |
|
1071 |
{ |
|
1072 |
ResizeScrollerL( videoCount ); |
|
1073 |
iVideoListImpl.SetEmptyListTextByResourceL( R_VCXHGMYVIDEOS_NO_VIDEOS ); |
|
1074 |
iScroller.Reset(); |
|
1075 |
iScroller.DrawDeferred(); |
|
1076 |
} |
|
1077 |
iView.DynInitMskL(); |
|
1078 |
||
1079 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # NewVideoListL() - Exit" ); |
|
1080 |
} |
|
1081 |
||
1082 |
// ----------------------------------------------------------------------------- |
|
1083 |
// CVcxHgMyVideosVideoModelHandler::VideoListModifiedL() |
|
1084 |
// MPX Collection calls this callback when the video list has been modified. |
|
1085 |
// ----------------------------------------------------------------------------- |
|
1086 |
// |
|
1087 |
void CVcxHgMyVideosVideoModelHandler::VideoListModifiedL() |
|
1088 |
{ |
|
1089 |
IPTVLOGSTRING2_LOW_LEVEL( |
|
1090 |
"MPX My Videos UI # VideoListModifiedL(count=%d) - Enter", |
|
1091 |
iVideoArray->VideoCount() ); |
|
1092 |
||
1093 |
TInt videoCount = iVideoArray->VideoCount(); |
|
1094 |
||
1095 |
if ( iScroller.ItemCount() != videoCount ) |
|
1096 |
{ |
|
1097 |
iScroller.ResizeL( videoCount ); |
|
1098 |
} |
|
1099 |
||
1100 |
if ( iScroller.ItemCount() > 0 ) |
|
1101 |
{ |
|
1102 |
iScroller.DrawDeferred(); |
|
1103 |
} |
|
1104 |
||
1105 |
iView.DynInitMskL(); |
|
1106 |
||
1107 |
IPTVLOGSTRING_LOW_LEVEL( |
|
1108 |
"MPX My Videos UI # VideoListModifiedL() - Exit" ); |
|
1109 |
} |
|
1110 |
||
1111 |
// ----------------------------------------------------------------------------- |
|
1112 |
// CVcxHgMyVideosVideoModelHandler::VideoModifiedL() |
|
1113 |
// MPX Collection calls this callback when single video item has been modified. |
|
1114 |
// ----------------------------------------------------------------------------- |
|
1115 |
// |
|
1116 |
void CVcxHgMyVideosVideoModelHandler::VideoModifiedL( TMPXChangeEventType aEventType, |
|
1117 |
TMPXItemId aMpxItemId, |
|
1118 |
TInt32 aExtraInfo, |
|
1119 |
TBool aSimulated ) |
|
1120 |
{ |
|
1121 |
IPTVLOGSTRING2_LOW_LEVEL( |
|
1122 |
"MPX My Videos UI # VideoModifiedL(event=%d)", aEventType ); |
|
1123 |
||
1124 |
switch ( aEventType ) |
|
1125 |
{ |
|
1126 |
case EMPXItemInserted: |
|
1127 |
{ |
|
1128 |
if ( aMpxItemId.iId2 < 2 ) |
|
1129 |
{ |
|
1130 |
iModel.CollectionClient().FetchMpxMediaByMpxIdL( aMpxItemId ); |
|
1131 |
} |
|
1132 |
} |
|
1133 |
break; |
|
1134 |
||
1135 |
case EMPXItemModified: |
|
1136 |
{ |
|
1137 |
if ( aExtraInfo == EVcxMyVideosVideoListOrderChanged ) |
|
1138 |
{ |
|
1139 |
if ( aMpxItemId.iId1 == iCurrentCategoryIndex && |
|
1140 |
aMpxItemId.iId2 == 1 ) |
|
1141 |
{ |
|
1142 |
// Re-fetch current list completely, MMC card has |
|
1143 |
// removed or inserted. |
|
1144 |
IPTVLOGSTRING_LOW_LEVEL( "MPX My Videos UI # VideoModifiedL - Re-fetching list" ); |
|
1145 |
iModel.CollectionClient().GetVideoListL( iCurrentCategoryIndex ); |
|
1146 |
} |
|
1147 |
} |
|
1148 |
else |
|
1149 |
{ |
|
1150 |
TInt index = iVideoArray->IndexByMPXItemId( aMpxItemId ); |
|
1151 |
if ( index != KErrNotFound ) |
|
1152 |
{ |
|
1153 |
UpdateVideoListItemL( index ); |
|
1154 |
iScroller.RefreshScreen( index ); |
|
1155 |
||
1156 |
if ( ! aSimulated ) |
|
1157 |
{ |
|
1158 |
iDataUpdater->RequestDataL( aMpxItemId ); |
|
1159 |
} |
|
1160 |
iView.DynInitMskL(); |
|
1161 |
} |
|
1162 |
} |
|
1163 |
} |
|
1164 |
break; |
|
1165 |
||
1166 |
case EMPXItemDeleted: |
|
1167 |
{ |
|
1168 |
if ( aMpxItemId.iId2 < 2 ) |
|
1169 |
{ |
|
1170 |
DeleteItemL( aMpxItemId ); |
|
1171 |
} |
|
1172 |
} |
|
1173 |
break; |
|
1174 |
||
1175 |
default: |
|
1176 |
{ |
|
1177 |
IPTVLOGSTRING_LOW_LEVEL( |
|
1178 |
"MPX My Videos UI # VideoModifiedL() Unexpected change!" ); |
|
1179 |
#ifdef _DEBUG |
|
1180 |
User::Panic( KVcxHgMyVideosPanic, EVcxHgMyVideosPanicLogicalVideo ); |
|
1181 |
#endif // _DEBUG |
|
1182 |
} |
|
1183 |
break; |
|
1184 |
} |
|
1185 |
} |
|
1186 |
||
1187 |
// ----------------------------------------------------------------------------- |
|
1188 |
// CVcxHgMyVideosVideoModelHandler::VideoFetchingCompletedL() |
|
1189 |
// MPX Collection calls this callback when a single video has fetched. |
|
1190 |
// ----------------------------------------------------------------------------- |
|
1191 |
// |
|
1192 |
void CVcxHgMyVideosVideoModelHandler::VideoFetchingCompletedL( CMPXMedia* aVideo ) |
|
1193 |
{ |
|
1194 |
if ( ValidOrigin( *aVideo ) ) |
|
1195 |
{ |
|
1196 |
// Ownership of video item is transferred. |
|
1197 |
InsertVideoL( aVideo ); |
|
1198 |
} |
|
1199 |
else |
|
1200 |
{ |
|
1201 |
delete aVideo; |
|
1202 |
} |
|
1203 |
} |
|
1204 |
||
1205 |
// ----------------------------------------------------------------------------- |
|
1206 |
// CVcxHgMyVideosVideoModelHandler::VideoDeletionCompletedL() |
|
1207 |
// MPX Collection calls this callback when deletion of multiple videos completes. |
|
1208 |
// ----------------------------------------------------------------------------- |
|
1209 |
// |
|
1210 |
void CVcxHgMyVideosVideoModelHandler::VideoDeletionCompletedL( TInt aFailedCount, |
|
1211 |
TMPXItemId aFailedMpxId ) |
|
1212 |
{ |
|
1213 |
CMPXMedia* media = iVideoArray->MPXMediaByMPXItemId( aFailedMpxId ); |
|
1214 |
||
1215 |
if ( aFailedCount == 1 && media && media->IsSupported( KMPXMediaGeneralTitle ) ) |
|
1216 |
{ |
|
1217 |
iVideoListImpl.VideoDeletionCompletedL( aFailedCount, |
|
1218 |
media->ValueText( KMPXMediaGeneralTitle ) ); |
|
1219 |
} |
|
1220 |
else |
|
1221 |
{ |
|
1222 |
iVideoListImpl.VideoDeletionCompletedL( aFailedCount, |
|
1223 |
KNullDesC ); |
|
1224 |
} |
|
1225 |
} |
|
1226 |
||
1227 |
// ----------------------------------------------------------------------------- |
|
1228 |
// CVcxHgMyVideosVideoModelHandler::VideoMoveOrCopyCompletedL() |
|
1229 |
// MPX Collection calls this callback when move or copy command is completed. |
|
1230 |
// ----------------------------------------------------------------------------- |
|
1231 |
// |
|
1232 |
void CVcxHgMyVideosVideoModelHandler::VideoMoveOrCopyCompletedL( TInt aFailedCount, |
|
1233 |
TMPXItemId aFailedMpxId ) |
|
1234 |
{ |
|
1235 |
CMPXMedia* media = iVideoArray->MPXMediaByMPXItemId( aFailedMpxId ); |
|
1236 |
||
1237 |
if ( aFailedCount == 1 && media && media->IsSupported( KMPXMediaGeneralTitle ) ) |
|
1238 |
{ |
|
1239 |
iVideoListImpl.VideoMoveOrCopyCompletedL( aFailedCount, |
|
1240 |
media->ValueText( KMPXMediaGeneralTitle ) ); |
|
1241 |
} |
|
1242 |
else |
|
1243 |
{ |
|
1244 |
iVideoListImpl.VideoMoveOrCopyCompletedL( aFailedCount, |
|
1245 |
KNullDesC ); |
|
1246 |
} |
|
1247 |
} |
|
1248 |
||
1249 |
// ----------------------------------------------------------------------------- |
|
1250 |
// CVcxHgMyVideosVideoModelHandler::VideoDetailsCompletedL() |
|
1251 |
// MPX Collection calls this callback when details fetching is completed. |
|
1252 |
// ----------------------------------------------------------------------------- |
|
1253 |
// |
|
1254 |
void CVcxHgMyVideosVideoModelHandler::VideoDetailsCompletedL( const CMPXMedia& aMedia ) |
|
1255 |
{ |
|
1256 |
if ( !iVideoDetails ) |
|
1257 |
{ |
|
1258 |
iVideoDetails = CVcxHgMyVideosVideoDetailsDialog::NewL(); |
|
1259 |
} |
|
1260 |
iVideoDetails->ShowVideoDetailsDialogL( aMedia ); |
|
1261 |
} |
|
1262 |
||
1263 |
// ----------------------------------------------------------------------------- |
|
1264 |
// CVcxHgMyVideosVideoModelHandler::UpdateScrollbarTypeL() |
|
1265 |
// Update scrollbar strip type depending on sort order |
|
1266 |
// ----------------------------------------------------------------------------- |
|
1267 |
// |
|
1268 |
void CVcxHgMyVideosVideoModelHandler::UpdateScrollbarTypeL( const TVcxMyVideosSortingOrder& aSortingOrder ) |
|
1269 |
{ |
|
1270 |
if ( EVcxMyVideosSortingName == aSortingOrder ) |
|
1271 |
{ |
|
1272 |
// First letter on strip |
|
1273 |
iScroller.SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite ); |
|
1274 |
} |
|
1275 |
else if ( EVcxMyVideosSortingCreationDate == aSortingOrder ) |
|
1276 |
{ |
|
1277 |
// Show date on strip |
|
1278 |
iScroller.SetScrollBarTypeL( CHgScroller::EHgScrollerTimeStrip ); |
|
1279 |
} |
|
1280 |
else |
|
1281 |
{ |
|
1282 |
// No strip |
|
1283 |
iScroller.SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar ); |
|
1284 |
} |
|
1285 |
} |
|
1286 |
||
1287 |
// ----------------------------------------------------------------------------- |
|
1288 |
// CVcxHgMyVideosVideoModelHandler::ResetScrollerItemsL() |
|
1289 |
// ----------------------------------------------------------------------------- |
|
1290 |
// |
|
1291 |
void CVcxHgMyVideosVideoModelHandler::ResetScrollerItemsL() |
|
1292 |
{ |
|
1293 |
// Reset items for refetch |
|
1294 |
TInt count = iScroller.ItemCount(); |
|
1295 |
for ( TInt i = 0; i < count; ++i ) |
|
1296 |
{ |
|
1297 |
iScroller.ItemL( i ).SetIcon( NULL ); |
|
1298 |
} |
|
1299 |
} |
|
1300 |
||
1301 |
// ----------------------------------------------------------------------------- |
|
1302 |
// CVcxHgMyVideosVideoModelHandler::ResetScrollerBufferAndItemsL() |
|
1303 |
// ----------------------------------------------------------------------------- |
|
1304 |
// |
|
1305 |
void CVcxHgMyVideosVideoModelHandler::ResetScrollerBufferAndItemsL() |
|
1306 |
{ |
|
1307 |
// Reset scroll buffer and items for refetch |
|
1308 |
iScroller.DisableScrollBuffer(); |
|
1309 |
iScroller.EnableScrollBufferL( *this, KHgBufferSize, KHgBufferTreshold ); |
|
1310 |
ResetScrollerItemsL(); |
|
1311 |
} |
|
1312 |
||
1313 |
// ----------------------------------------------------------------------------- |
|
1314 |
// CVcxHgMyVideosVideoModelHandler::ResizeScrollerL() |
|
1315 |
// ----------------------------------------------------------------------------- |
|
1316 |
// |
|
1317 |
void CVcxHgMyVideosVideoModelHandler::ResizeScrollerL( TInt aNewItemCount ) |
|
1318 |
{ |
|
1319 |
if (iScroller.ItemCount() > 0) |
|
1320 |
{ |
|
1321 |
// Reset scroller without time consuming scaling of icons never shown |
|
1322 |
iScroller.DisableScrollBuffer(); |
|
1323 |
iScroller.ResizeL( aNewItemCount ); |
|
1324 |
iScroller.EnableScrollBufferL( *this, KHgBufferSize, KHgBufferTreshold ); |
|
1325 |
ResetScrollerItemsL(); |
|
1326 |
} |
|
1327 |
else |
|
1328 |
{ |
|
1329 |
// CHgScroller::Reset() was already called, no need to reset tricks |
|
1330 |
iScroller.ResizeL( aNewItemCount ); |
|
1331 |
} |
|
1332 |
} |
|
1333 |
||
1334 |
// ----------------------------------------------------------------------------- |
|
1335 |
// CVcxHgMyVideosVideoModelHandler::SaveMarkingsL() |
|
1336 |
// ----------------------------------------------------------------------------- |
|
1337 |
// |
|
1338 |
void CVcxHgMyVideosVideoModelHandler::SaveMarkingsL() |
|
1339 |
{ |
|
1340 |
// Get marked list item indexes |
|
1341 |
RArray<TInt> markedVideos; |
|
1342 |
CleanupClosePushL( markedVideos ); |
|
1343 |
MarkedVideosL( markedVideos ); |
|
1344 |
TInt markedCount( markedVideos.Count() ); |
|
1345 |
||
1346 |
iMarkedMediaList.Reset(); |
|
1347 |
iMarkedMediaList.ReserveL( markedCount ); |
|
1348 |
||
1349 |
TInt markedIndex; |
|
1350 |
||
1351 |
for ( TInt i = 0; i <markedCount; i++ ) |
|
1352 |
{ |
|
1353 |
markedIndex = markedVideos[ i ]; |
|
1354 |
CMPXMedia* media = iVideoArray->MPXMedia( markedIndex ); |
|
1355 |
iMarkedMediaList.Append( media ); |
|
1356 |
iScroller.ItemL( markedIndex ).ClearFlags( CHgItem::EHgItemFlagMarked ); |
|
1357 |
IPTVLOGSTRING3_LOW_LEVEL( "CVcxHgMyVideosVideoModelHandler::SaveMarkingsL() marked index = %d CMPXMedia = 0x%08x", markedIndex, media ); |
|
1358 |
} |
|
1359 |
||
1360 |
CleanupStack::PopAndDestroy( &markedVideos ); |
|
1361 |
} |
|
1362 |
||
1363 |
// ----------------------------------------------------------------------------- |
|
1364 |
// CVcxHgMyVideosVideoModelHandler::RestoreMarkingsL() |
|
1365 |
// ----------------------------------------------------------------------------- |
|
1366 |
// |
|
1367 |
void CVcxHgMyVideosVideoModelHandler::RestoreMarkingsL() |
|
1368 |
{ |
|
1369 |
TInt videoCount = iVideoArray->VideoCount(); |
|
1370 |
TInt found( KErrNotFound ); |
|
1371 |
||
1372 |
for ( TInt i = 0; i < videoCount; i++ ) |
|
1373 |
{ |
|
1374 |
CMPXMedia* media = iVideoArray->MPXMedia( i ); |
|
1375 |
found = iMarkedMediaList.Find( media ); |
|
1376 |
if ( KErrNotFound != found ) |
|
1377 |
{ |
|
1378 |
iScroller.ItemL( i ).SetFlags( CHgItem::EHgItemFlagMarked ); |
|
1379 |
} |
|
1380 |
IPTVLOGSTRING4_LOW_LEVEL( "CVcxHgMyVideosVideoModelHandler::RestoreMarkingsL() list index = %d CMPXMedia = 0x%08x found = %d", i, media, found ); |
|
1381 |
} |
|
1382 |
||
1383 |
iMarkedMediaList.Reset(); |
|
1384 |
} |
|
1385 |
// ----------------------------------------------------------------------------- |
|
1386 |
// CVcxHgMyVideosVideoModelHandler::SetVideoLastWatchedL() |
|
1387 |
// ----------------------------------------------------------------------------- |
|
1388 |
// |
|
1389 |
void CVcxHgMyVideosVideoModelHandler::SetVideoLastWatchedL( CMPXMedia& aMedia ) |
|
1390 |
{ |
|
1391 |
if ( !iRepository ) |
|
1392 |
{ |
|
1393 |
iRepository = CRepository::NewL( TUid::Uid( KVcxMyVideosCollectionCenrepUid ) ); |
|
1394 |
} |
|
1395 |
iRepository->Set( KVcxMyVideosCollectionCenrepKeyLastWatchedMpxId, |
|
1396 |
TInt( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ).iId1 )); |
|
1397 |
||
1398 |
iRepository->Set( KVcxMyVideosCollectionCenrepKeyLastWatchedName, |
|
1399 |
aMedia.ValueText( KMPXMediaGeneralTitle )); |
|
1400 |
||
1401 |
iRepository->Set( KVcxMyVideosCollectionCenrepKeyLastWatchedPath, |
|
1402 |
aMedia.ValueText( KMPXMediaGeneralUri )); |
|
1403 |
||
1404 |
iRepository->Set( KVcxMyVideosCollectionCenrepKeyLastWatchedIndicator, |
|
1405 |
TInt( VideoIndicator().IsIndicatorShown( aMedia )) ); |
|
1406 |
} |
|
1407 |
||
1408 |
// ----------------------------------------------------------------------------- |
|
1409 |
// CVcxHgMyVideosVideoModelHandler::ClearNewVideoFlagL() |
|
1410 |
// ----------------------------------------------------------------------------- |
|
1411 |
// |
|
1412 |
void CVcxHgMyVideosVideoModelHandler::ClearNewVideoFlagL( CMPXMedia& aMedia ) |
|
1413 |
{ |
|
1414 |
TUint32 flags = aMedia.ValueTObjectL<TUint32>( KMPXMediaGeneralFlags ); |
|
1415 |
if( flags & EVcxMyVideosVideoNew ) |
|
1416 |
{ |
|
1417 |
flags &= ~EVcxMyVideosVideoNew; |
|
1418 |
iModel.CollectionClient().SetFlagsL( |
|
1419 |
aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ), flags ); |
|
1420 |
} |
|
1421 |
} |
|
64
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1422 |
|
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1423 |
// ----------------------------------------------------------------------------- |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1424 |
// CVcxHgMyVideosVideoModelHandler::ResetEmptyDrmThumnailL() |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1425 |
// ----------------------------------------------------------------------------- |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1426 |
// |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1427 |
void CVcxHgMyVideosVideoModelHandler::ResetEmptyDrmThumnailL( CMPXMedia& aMedia, TInt aIndex ) |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1428 |
{ |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1429 |
CHgItem& item = iScroller.ItemL( aIndex ); |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1430 |
|
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1431 |
if ( !item.Icon() ) |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1432 |
{ |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1433 |
if ( aMedia.IsSupported( KMPXMediaGeneralFlags ) && |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1434 |
aMedia.ValueTObjectL<TUint32>( KMPXMediaGeneralFlags ) |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1435 |
== EVcxMyVideosVideoDrmProtected ); |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1436 |
{ |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1437 |
CThumbnailObjectSource* source = |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1438 |
CThumbnailObjectSource::NewLC( aMedia.ValueText( KMPXMediaGeneralUri ), NULL ); |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1439 |
|
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1440 |
// We cannot know at this phase, do the user get the license |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1441 |
// when playing the video, so we have to reset this every time. |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1442 |
iModel.ThumbnailManager().Reset( *source ); |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1443 |
|
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1444 |
CleanupStack::PopAndDestroy( source ); |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1445 |
} |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1446 |
} |
3eb824b18d67
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
1447 |
} |