|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: HG VOD* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #include <aknmessagequerydialog.h> |
|
21 #include <StringLoader.h> |
|
22 #include <vcxhgvodui.rsg> |
|
23 #include <ganes/HgScroller.h> |
|
24 #include <ganes/HgItem.h> |
|
25 #include <ganes/HgDoubleGraphicList.h> |
|
26 |
|
27 #include "vcxnsserviceproviderif.h" |
|
28 #include "vcxhgvodservicelistmodelhandler.h" |
|
29 #include "vcxhgvodmainview.h" |
|
30 #include "vcxhgvodmainviewcontainer.h" |
|
31 #include "vcxhgvodui.hrh" |
|
32 #include "vcxhgvodutils.h" |
|
33 #include "vcxhgvodthumbnailmanager.h" |
|
34 #include "vcxnsuiengine.h" |
|
35 #include "vcxnsservice.h" |
|
36 #include "vcxhgvodservicelistimpl.h" |
|
37 #include "IptvDebug.h" |
|
38 |
|
39 TInt FindServiceIndex( TUint32 aId, RPointerArray<CVcxNsService>* aArray ) |
|
40 { |
|
41 TInt index( KErrNotFound ); |
|
42 for ( TInt i = 0; i < aArray->Count(); i++ ) |
|
43 { |
|
44 if ( (*aArray)[i]->GetServiceId() == aId ) |
|
45 { |
|
46 index = i; |
|
47 break; |
|
48 } |
|
49 } |
|
50 |
|
51 return index; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CVcxHgVodServiceListModelHandler::~CVcxHgVodServiceListModelHandler() |
|
56 // Destructor |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CVcxHgVodServiceListModelHandler::~CVcxHgVodServiceListModelHandler() |
|
60 { |
|
61 if ( iServiceProvider ) |
|
62 { |
|
63 iServiceProvider->DeRegisterObserver( this ); |
|
64 } |
|
65 |
|
66 delete iTnManager; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CVcxHgVodServiceListImpl::NewL() |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 CVcxHgVodServiceListModelHandler* CVcxHgVodServiceListModelHandler::NewL( |
|
74 CVcxNsUiEngine& aDataProviderIf, |
|
75 CVcxHgVodMainView& aView, |
|
76 CHgScroller& aScroller, |
|
77 CVcxHgVodServiceListImpl& aServiceListImpl ) |
|
78 { |
|
79 CVcxHgVodServiceListModelHandler* self = |
|
80 CVcxHgVodServiceListModelHandler::NewLC( |
|
81 aDataProviderIf, |
|
82 aView, |
|
83 aScroller, |
|
84 aServiceListImpl ); |
|
85 CleanupStack::Pop( self ); |
|
86 return self; |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CVcxHgVodServiceListModelHandler::NewLC() |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 CVcxHgVodServiceListModelHandler* CVcxHgVodServiceListModelHandler::NewLC( |
|
94 CVcxNsUiEngine& aDataProviderIf, |
|
95 CVcxHgVodMainView& aView, |
|
96 CHgScroller& aScroller, |
|
97 CVcxHgVodServiceListImpl& aServiceListImpl ) |
|
98 { |
|
99 CVcxHgVodServiceListModelHandler* self = |
|
100 new (ELeave) CVcxHgVodServiceListModelHandler( |
|
101 aDataProviderIf, |
|
102 aView, |
|
103 aScroller, |
|
104 aServiceListImpl ); |
|
105 CleanupStack::PushL( self ); |
|
106 self->ConstructL(); |
|
107 return self; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CVcxHgVodServiceListModelHandler::CVcxHgVodServiceListModelHandler() |
|
112 // Constructor |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 CVcxHgVodServiceListModelHandler::CVcxHgVodServiceListModelHandler( |
|
116 CVcxNsUiEngine& aDataProviderIf, |
|
117 CVcxHgVodMainView& aView, |
|
118 CHgScroller& aScroller, |
|
119 CVcxHgVodServiceListImpl& aServiceListImpl ) |
|
120 : iDataProviderIf ( aDataProviderIf ), |
|
121 iScroller ( aScroller ), |
|
122 iView ( aView ), |
|
123 iServiceListImpl ( aServiceListImpl ) |
|
124 { |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CVcxHgVodServiceListModelHandler::ConstructL() |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void CVcxHgVodServiceListModelHandler::ConstructL() |
|
132 { |
|
133 iServiceProvider = iDataProviderIf.GetServiceProviderL(); |
|
134 iProgressHandler = iDataProviderIf.ProgressHandlerL(); |
|
135 iTnManager = CVcxHgVodThumbnailManager::NewL( iView.EikonEnv().FsSession() ); |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 void CVcxHgVodServiceListModelHandler::ServiceAdded( TInt aIndex ) |
|
143 { |
|
144 IPTVLOGSTRING_LOW_LEVEL(">>>CVcxHgVodServiceListModelHandler::ServiceAdded"); |
|
145 |
|
146 SetSelected( aIndex ); |
|
147 |
|
148 IPTVLOGSTRING_LOW_LEVEL("<<<CVcxHgVodServiceListModelHandler::ServiceAdded"); |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 void CVcxHgVodServiceListModelHandler::ServiceUpdated( TInt aIndex ) |
|
156 { |
|
157 IPTVLOGSTRING_LOW_LEVEL(">>>CVcxHgVodServiceListModelHandler::ServiceUpdated"); |
|
158 |
|
159 TRAP_IGNORE( UpdateListItemL( aIndex ) ); |
|
160 |
|
161 IPTVLOGSTRING_LOW_LEVEL("<<<CVcxHgVodServiceListModelHandler::ServiceUpdated"); |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // Refresh view, update all services. |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 void CVcxHgVodServiceListModelHandler::RefreshView() |
|
169 { |
|
170 IPTVLOGSTRING_LOW_LEVEL(">>>CVcxHgVodServiceListModelHandler::RefreshView"); |
|
171 |
|
172 if ( iDataProviderIf.VcAppState() == EStateServiceView ) |
|
173 { |
|
174 TRAP_IGNORE( iServices = &(iServiceProvider->GetSubscribedServicesL()) ); |
|
175 |
|
176 TRAP_IGNORE( RefreshViewL() ); |
|
177 |
|
178 TRAP_IGNORE( iServiceListImpl.CheckSoftkeysL() ); |
|
179 } |
|
180 |
|
181 IPTVLOGSTRING_LOW_LEVEL("<<<CVcxHgVodServiceListModelHandler::RefreshView"); |
|
182 } |
|
183 |
|
184 // ----------------------------------------------------------------------------- |
|
185 // Application state change initialized by data provider. |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 void CVcxHgVodServiceListModelHandler::HandleAppStateChangedL() |
|
189 { |
|
190 IPTVLOGSTRING_LOW_LEVEL(">>>CVcxHgVodServiceListModelHandler::HandleAppStateChangedL"); |
|
191 iView.ChangeListViewL(); |
|
192 IPTVLOGSTRING_LOW_LEVEL("<<<CVcxHgVodServiceListModelHandler::HandleAppStateChangedL"); |
|
193 } |
|
194 |
|
195 // ----------------------------------------------------------------------------- |
|
196 // Open defined browser link |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 void CVcxHgVodServiceListModelHandler::OpenBrowserLinkL( const TDesC& aUri ) |
|
200 { |
|
201 iServiceListImpl.OpenEmbeddedBrowserL( aUri ); |
|
202 } |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // Open player for streaming ( no implementation ) |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 void CVcxHgVodServiceListModelHandler::OpenStreamingLinkL( const TDesC& /*aUri*/ ) |
|
209 { |
|
210 } |
|
211 |
|
212 // ----------------------------------------------------------------------------- |
|
213 // Service removed |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 void CVcxHgVodServiceListModelHandler::ServiceRemoved( |
|
217 TInt aIndex, |
|
218 RPointerArray<CVcxNsService>& aUpdatedServiceList ) |
|
219 { |
|
220 IPTVLOGSTRING_LOW_LEVEL(">>>CVcxHgVodServiceListModelHandler::ServiceRemoved"); |
|
221 |
|
222 if ( iScroller.ItemCount() > 0 |
|
223 && iScroller.ItemCount() > aIndex ) |
|
224 { |
|
225 iScroller.RemoveItem( aIndex ); |
|
226 iScroller.RefreshScreen( aIndex ); |
|
227 } |
|
228 iServices = NULL; |
|
229 iServices = &aUpdatedServiceList; |
|
230 |
|
231 IPTVLOGSTRING_LOW_LEVEL("<<<CVcxHgVodServiceListModelHandler::ServiceRemoved"); |
|
232 } |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // Activate model |
|
236 // ----------------------------------------------------------------------------- |
|
237 // |
|
238 void CVcxHgVodServiceListModelHandler::DoActivateModelL( ) |
|
239 { |
|
240 IPTVLOGSTRING_LOW_LEVEL(">>>CVcxHgVodServiceListModelHandler::DoActivateModelL"); |
|
241 |
|
242 iServiceProvider->RegisterObserver( this ); |
|
243 |
|
244 if ( iProgressHandler ) |
|
245 { |
|
246 iProgressHandler->RegisterObserver( this ); |
|
247 } |
|
248 |
|
249 iScroller.EnableScrollBufferL( *this, KScrollerBufferSize, KScrollerBufferTreshold ); |
|
250 iScroller.Reset(); |
|
251 RefreshView(); |
|
252 |
|
253 iScroller.SetSelectedIndex( iHighlight ); |
|
254 iScroller.ControlEnv()->WsSession().ClearAllRedrawStores(); |
|
255 iScroller.MakeVisible( ETrue ); |
|
256 iScroller.DrawDeferred(); |
|
257 |
|
258 IPTVLOGSTRING_LOW_LEVEL("<<<CVcxHgVodServiceListModelHandler::DoActivateModelL"); |
|
259 } |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // Deactivate model |
|
263 // ----------------------------------------------------------------------------- |
|
264 // |
|
265 void CVcxHgVodServiceListModelHandler::DoDeActivateModel( ) |
|
266 { |
|
267 IPTVLOGSTRING_LOW_LEVEL(">>>CVcxHgVodServiceListModelHandler::DoDeActivateModel"); |
|
268 |
|
269 if ( iServiceProvider ) |
|
270 { |
|
271 iServiceProvider->DeRegisterObserver( this ); |
|
272 } |
|
273 |
|
274 if ( iProgressHandler ) |
|
275 { |
|
276 iProgressHandler->DeRegisterObserver( this ); |
|
277 } |
|
278 |
|
279 iTnManager->Reset(); |
|
280 |
|
281 iHighlight = iScroller.SelectedIndex(); |
|
282 iScroller.DisableScrollBuffer(); |
|
283 iScroller.MakeVisible( EFalse ); |
|
284 |
|
285 IPTVLOGSTRING_LOW_LEVEL("<<<CVcxHgVodServiceListModelHandler::DoDeActivateModel"); |
|
286 } |
|
287 |
|
288 // ----------------------------------------------------------------------------- |
|
289 // Get pointer to service provider |
|
290 // ----------------------------------------------------------------------------- |
|
291 // |
|
292 MVcxNsServiceProviderIf* CVcxHgVodServiceListModelHandler::ServiceProvider() |
|
293 { |
|
294 return iServiceProvider; |
|
295 } |
|
296 |
|
297 // ----------------------------------------------------------------------------- |
|
298 // |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 TInt CVcxHgVodServiceListModelHandler::GetSelected() |
|
302 { |
|
303 return iScroller.SelectedIndex(); |
|
304 } |
|
305 |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 // ----------------------------------------------------------------------------- |
|
309 // |
|
310 void CVcxHgVodServiceListModelHandler::SetSelected( TInt aIndex ) |
|
311 { |
|
312 if( aIndex >= 0 && iScroller.ItemCount() > aIndex ) |
|
313 { |
|
314 iScroller.SetSelectedIndex( aIndex ); |
|
315 } |
|
316 } |
|
317 |
|
318 // --------------------------------------------------------- |
|
319 // CVcxHgVodServiceListModelHandler::IsEmptyModel |
|
320 // --------------------------------------------------------- |
|
321 // |
|
322 TBool CVcxHgVodServiceListModelHandler::IsEmptyModel() |
|
323 { |
|
324 return iScroller.ItemCount() <= 0; |
|
325 } |
|
326 |
|
327 // --------------------------------------------------------- |
|
328 // CVcxHgVodServiceListModelHandler::GenerateServiceInfoTextLC |
|
329 // --------------------------------------------------------- |
|
330 // |
|
331 HBufC* CVcxHgVodServiceListModelHandler::GenerateServiceInfoTextLC( |
|
332 CVcxNsService::TServiceUpdateStatus aUpdateStatus, |
|
333 TTime aUpdateTime ) |
|
334 { |
|
335 IPTVLOGSTRING_LOW_LEVEL(">>>CVcxHgVodServiceListModelHandler::GenerateServiceInfoTextLC"); |
|
336 HBufC* serviceInfo; |
|
337 |
|
338 if ( aUpdateStatus == CVcxNsService::EUpdateFailed ) |
|
339 { |
|
340 serviceInfo = CVcxHgVodUtils::LoadStringFromResourceLC( R_VCXHG_FEED_UPDATE_FAILED ); |
|
341 } |
|
342 else if ( aUpdateTime == 0 ) |
|
343 { |
|
344 serviceInfo = KVcxNsSpaceString().AllocLC(); |
|
345 } |
|
346 else |
|
347 { |
|
348 TBuf<KVcxNsMaxDateBufSize + KVcxNsMaxTimeBufSize + 1> datetimebuf; |
|
349 CVcxHgVodUtils::FormatDateAndTimeL( aUpdateTime, datetimebuf ); |
|
350 |
|
351 serviceInfo = CVcxHgVodUtils::LoadStringFromResourceLC( R_VCXHG_LAST_UPDATE, datetimebuf ); |
|
352 } |
|
353 IPTVLOGSTRING_LOW_LEVEL("<<<CVcxHgVodServiceListModelHandler::GenerateServiceInfoTextLC"); |
|
354 return serviceInfo; |
|
355 } |
|
356 |
|
357 // ----------------------------------------------------------------------------- |
|
358 // Show selected feed's details |
|
359 // ----------------------------------------------------------------------------- |
|
360 // |
|
361 void CVcxHgVodServiceListModelHandler::ShowFeedDetailsL( TInt aSelected ) |
|
362 { |
|
363 IPTVLOGSTRING_LOW_LEVEL(">>>CVcxHgVodServiceListModelHandler::ShowFeedDetailsL"); |
|
364 |
|
365 if ( aSelected >= 0 && aSelected < iServices->Count() ) |
|
366 { |
|
367 if ( iServiceProvider->GetServiceData( aSelected )->GetDesc().Length() > 0 ) |
|
368 { |
|
369 const TDesC& feedDesc = iServiceProvider->GetServiceData( aSelected )->GetDesc(); |
|
370 HBufC* context = HBufC::NewLC( feedDesc.Length() ); |
|
371 context->Des().Append( feedDesc ); |
|
372 |
|
373 CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *context ); |
|
374 dlg->ExecuteLD( R_VCXHGVOD_FEED_DETAILS_MESSAGE_QUERY ); |
|
375 |
|
376 if ( context ) |
|
377 { |
|
378 CleanupStack::PopAndDestroy( context ); |
|
379 } |
|
380 } |
|
381 } |
|
382 |
|
383 IPTVLOGSTRING_LOW_LEVEL("<<<CVcxHgVodServiceListModelHandler::ShowFeedDetailsL"); |
|
384 } |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // Update progress |
|
388 // ----------------------------------------------------------------------------- |
|
389 // |
|
390 void CVcxHgVodServiceListModelHandler::HandleFeedUpdateProgressL( |
|
391 TInt aIndex, |
|
392 TInt aProgress ) |
|
393 { |
|
394 IPTVLOGSTRING_LOW_LEVEL(">>>CVcxHgVodServiceListModelHandler::HandleFeedUpdateProgressL"); |
|
395 |
|
396 if ( aIndex < iScroller.ItemCount() |
|
397 && aIndex < iServices->Count() |
|
398 && aIndex >= 0 ) |
|
399 { |
|
400 // need to add progress, when loc string is available. |
|
401 // For now only remove the compiler warning |
|
402 aProgress = aProgress; |
|
403 HBufC* info = CVcxHgVodUtils::LoadStringFromResourceLC( R_VCXHG_UPDATING_FEED ); |
|
404 |
|
405 if ( info->Length() > 0 ) |
|
406 { |
|
407 CHgItem& item = iScroller.ItemL( aIndex ); |
|
408 item.SetTextL( *info ); |
|
409 iScroller.RefreshScreen( aIndex ); |
|
410 } |
|
411 CleanupStack::PopAndDestroy( info ); |
|
412 } |
|
413 |
|
414 IPTVLOGSTRING_LOW_LEVEL("<<<CVcxHgVodServiceListModelHandler::HandleFeedUpdateProgressL"); |
|
415 } |
|
416 // ----------------------------------------------------------------------------- |
|
417 // |
|
418 // ----------------------------------------------------------------------------- |
|
419 // |
|
420 void CVcxHgVodServiceListModelHandler::MarkItem( TInt aIndex ) |
|
421 { |
|
422 if ( aIndex >= 0 && aIndex < iScroller.ItemCount() ) |
|
423 { |
|
424 TRAP_IGNORE( |
|
425 { |
|
426 CHgItem& item = iScroller.ItemL( aIndex ); |
|
427 item.SetFlags( CHgItem::EHgItemFlagMarked ); |
|
428 iScroller.RefreshScreen( aIndex ); |
|
429 } ); |
|
430 } |
|
431 } |
|
432 |
|
433 // ----------------------------------------------------------------------------- |
|
434 // |
|
435 // ----------------------------------------------------------------------------- |
|
436 // |
|
437 void CVcxHgVodServiceListModelHandler::UnmarkItem( TInt aIndex ) |
|
438 { |
|
439 if ( aIndex >= 0 && aIndex < iScroller.ItemCount() ) |
|
440 { |
|
441 TRAP_IGNORE( |
|
442 { |
|
443 CHgItem& item = iScroller.ItemL( aIndex ); |
|
444 item.ClearFlags( CHgItem::EHgItemFlagMarked ); |
|
445 iScroller.RefreshScreen( aIndex ); |
|
446 } ); |
|
447 } |
|
448 } |
|
449 |
|
450 // ----------------------------------------------------------------------------- |
|
451 // |
|
452 // ----------------------------------------------------------------------------- |
|
453 // |
|
454 void CVcxHgVodServiceListModelHandler::MoveItemL( TInt aSourceIndex, TInt aTargetIndex ) |
|
455 { |
|
456 if ( aSourceIndex == aTargetIndex || |
|
457 aSourceIndex < 0 || |
|
458 aTargetIndex < 0 || |
|
459 aSourceIndex >= iScroller.ItemCount() || |
|
460 aTargetIndex >= iScroller.ItemCount() ) |
|
461 { |
|
462 return; |
|
463 } |
|
464 |
|
465 CHgItem& oldItem = iScroller.ItemL( aSourceIndex ); |
|
466 CGulIcon* newIcon = NULL; |
|
467 |
|
468 if ( oldItem.Icon() ) |
|
469 { |
|
470 newIcon = CVcxHgVodUtils::DuplicateGulIconL( oldItem.Icon() ); |
|
471 } |
|
472 |
|
473 CHgItem* newItem = CHgItem::NewL( oldItem.Flags(), newIcon, |
|
474 oldItem.Title(), oldItem.Text() ); |
|
475 |
|
476 newItem->SetTime( oldItem.Time() ); |
|
477 |
|
478 iScroller.RemoveItem( aSourceIndex ); |
|
479 iScroller.InsertItem( newItem, aTargetIndex ); |
|
480 iScroller.DrawDeferred(); |
|
481 } |
|
482 |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 // ----------------------------------------------------------------------------- |
|
486 // |
|
487 TInt CVcxHgVodServiceListModelHandler::ItemCount() |
|
488 { |
|
489 return iScroller.ItemCount(); |
|
490 } |
|
491 |
|
492 // ----------------------------------------------------------------------------- |
|
493 // |
|
494 // ----------------------------------------------------------------------------- |
|
495 // |
|
496 TInt CVcxHgVodServiceListModelHandler::LastItemSelected() |
|
497 { |
|
498 return iScroller.SelectedIndex() == iScroller.ItemCount() - 1; |
|
499 } |
|
500 |
|
501 // ----------------------------------------------------------------------------- |
|
502 // |
|
503 // ----------------------------------------------------------------------------- |
|
504 // |
|
505 void CVcxHgVodServiceListModelHandler::MvtoThumbnailReady( |
|
506 CGulIcon* aIcon, |
|
507 TInt64 aClientId ) |
|
508 { |
|
509 // error ignored, as there is no error handling that can be done if this leaves |
|
510 TRAP_IGNORE( DoThumbnailReadyL( aIcon, aClientId ) ); |
|
511 } |
|
512 |
|
513 // ----------------------------------------------------------------------------- |
|
514 // |
|
515 // ----------------------------------------------------------------------------- |
|
516 // |
|
517 void CVcxHgVodServiceListModelHandler::RefreshViewL() |
|
518 { |
|
519 TInt highlight = iScroller.SelectedIndex(); |
|
520 |
|
521 iScroller.Reset(); |
|
522 |
|
523 if ( iServices && iServices->Count() > 0 ) |
|
524 { |
|
525 iScroller.ResizeL( iServices->Count() ); |
|
526 |
|
527 if ( highlight < 0 ) |
|
528 { |
|
529 highlight = 0; |
|
530 } |
|
531 else if ( highlight >= iScroller.ItemCount() ) |
|
532 { |
|
533 highlight = iScroller.ItemCount() - 1; |
|
534 } |
|
535 |
|
536 iScroller.SetSelectedIndex( highlight ); |
|
537 } |
|
538 |
|
539 iScroller.DrawDeferred(); |
|
540 } |
|
541 |
|
542 // ----------------------------------------------------------------------------- |
|
543 // |
|
544 // ----------------------------------------------------------------------------- |
|
545 // |
|
546 void CVcxHgVodServiceListModelHandler::Request( TInt aBufferStart, |
|
547 TInt aBufferEnd, THgScrollDirection /*aDirection*/ ) |
|
548 { |
|
549 for ( TInt i = aBufferStart; i <= aBufferEnd; i++ ) |
|
550 { |
|
551 TRAP_IGNORE( UpdateListItemL( i ) ); |
|
552 } |
|
553 } |
|
554 |
|
555 // ----------------------------------------------------------------------------- |
|
556 // |
|
557 // ----------------------------------------------------------------------------- |
|
558 // |
|
559 void CVcxHgVodServiceListModelHandler::Release( TInt /*aBufferStart*/, |
|
560 TInt /*aBufferEnd*/ ) |
|
561 { |
|
562 // No implementation required. |
|
563 } |
|
564 |
|
565 // ----------------------------------------------------------------------------- |
|
566 // |
|
567 // ----------------------------------------------------------------------------- |
|
568 // |
|
569 void CVcxHgVodServiceListModelHandler::UpdateListItemL( TInt aIndex ) |
|
570 { |
|
571 if ( iDataProviderIf.VcAppState() == EStateServiceView && |
|
572 aIndex >= 0 && iServices && iServices->Count() > aIndex && |
|
573 iScroller.ItemCount() > aIndex ) |
|
574 { |
|
575 CHgItem& item = iScroller.ItemL( aIndex ); |
|
576 CVcxNsService& service = *(*iServices)[ aIndex ]; |
|
577 |
|
578 HBufC* name = NULL; |
|
579 HBufC* info = NULL; |
|
580 |
|
581 CVcxNsService::TServiceUpdateStatus updateStatus = service.GetUpdateStatus(); |
|
582 |
|
583 if ( service.GetName().CompareF( KVcxNsVideoDirectory ) == 0 ) |
|
584 { |
|
585 name = CVcxHgVodUtils::LoadStringFromResourceLC( R_VCXHG_VOD_FEEDS_VIDEO_DIRECTORY ); |
|
586 item.SetIcon( NULL ); |
|
587 } |
|
588 else |
|
589 { |
|
590 name = service.GetName().AllocLC(); |
|
591 |
|
592 const TDesC& iconPath = service.GetIconPath(); |
|
593 |
|
594 if ( updateStatus != CVcxNsService::EUpdateOngoing || !( item.Icon() ) ) |
|
595 { |
|
596 item.SetIcon( NULL ); |
|
597 if ( iconPath.Length() > 0 ) |
|
598 { |
|
599 iTnManager->AddThumbnailRequestL( *this, |
|
600 service.GetIconPath(), |
|
601 CHgDoubleGraphicList::PreferredImageSize(), |
|
602 service.GetServiceId() ); |
|
603 } |
|
604 } |
|
605 } |
|
606 |
|
607 item.SetTitleL( *name ); |
|
608 CleanupStack::PopAndDestroy( name ); |
|
609 |
|
610 if ( updateStatus == CVcxNsService::EUpdateOngoing ) |
|
611 { |
|
612 TInt progress( 0 ); |
|
613 |
|
614 if ( iProgressHandler ) |
|
615 { |
|
616 progress = iProgressHandler->GetProgress( service.GetServiceId() ); |
|
617 } |
|
618 |
|
619 // need to add progress here, when loc string is available. |
|
620 // For now just remove the compiler warning |
|
621 progress = progress; |
|
622 info = CVcxHgVodUtils::LoadStringFromResourceLC( R_VCXHG_UPDATING_FEED ); |
|
623 } |
|
624 else |
|
625 { |
|
626 info = GenerateServiceInfoTextLC( updateStatus, service.GetUpdateTime() ); |
|
627 } |
|
628 |
|
629 if ( info->Length() > 0 ) |
|
630 { |
|
631 // Set detail ( 2nd line text ) |
|
632 item.SetTextL( *info ); |
|
633 } |
|
634 CleanupStack::PopAndDestroy( info ); |
|
635 |
|
636 iScroller.RefreshScreen( aIndex ); |
|
637 } |
|
638 |
|
639 iServiceListImpl.SetMskL( R_VCXHG_VOD_MSK_BUTTON_OPEN ); |
|
640 } |
|
641 |
|
642 // ----------------------------------------------------------------------------- |
|
643 // |
|
644 // ----------------------------------------------------------------------------- |
|
645 // |
|
646 void CVcxHgVodServiceListModelHandler::DoThumbnailReadyL( |
|
647 CGulIcon* aIcon, |
|
648 TInt64 aClientId ) |
|
649 { |
|
650 CleanupStack::PushL( aIcon ); |
|
651 TInt index = FindServiceIndex( (TUint32)aClientId, iServices ); |
|
652 |
|
653 if ( index >= 0 && iScroller.ItemCount() > index ) |
|
654 { |
|
655 iScroller.ItemL( index ).SetIcon( aIcon ); |
|
656 iScroller.RefreshScreen( index ); |
|
657 CleanupStack::Pop( aIcon ); |
|
658 } |
|
659 else |
|
660 { |
|
661 // For some reason the scroller list was update after image conversion |
|
662 // started, and the icon is no longer needed. |
|
663 CleanupStack::PopAndDestroy( aIcon ); |
|
664 } |
|
665 } |