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