branch | RCL_3 |
changeset 368 | b131f7696342 |
parent 367 | 4b75876aa85a |
child 376 | 31968c23152c |
367:4b75876aa85a | 368:b131f7696342 |
---|---|
42 |
42 |
43 // these must correspond with TShowsIconIndex |
43 // these must correspond with TShowsIconIndex |
44 |
44 |
45 const TUint KShowIconArrayIds[] = |
45 const TUint KShowIconArrayIds[] = |
46 { |
46 { |
47 EMbmPodcastAudio, |
47 // EShowIcon = 0, |
48 EMbmPodcastAudio_mask, |
48 EMbmPodcastAudio, |
49 EMbmPodcastAudio_new, |
49 EMbmPodcastAudio_mask, |
50 EMbmPodcastAudio_new_mask, |
50 // EShowIconNew, |
51 EMbmPodcastAudio_queued, |
51 EMbmPodcastAudio_new, |
52 EMbmPodcastAudio_queued_mask, |
52 EMbmPodcastAudio_new_mask, |
53 EMbmPodcastAudio_downloading, |
53 // EQuedShowIcon, |
54 EMbmPodcastAudio_downloading_mask, |
54 EMbmPodcastAudio_dl_queued, |
55 EMbmPodcastAudio_downloaded, |
55 EMbmPodcastAudio_dl_queued_mask, |
56 EMbmPodcastAudio_downloaded_mask, |
56 // EQuedShowIconNew, |
57 EMbmPodcastAudio_downloaded_new, |
57 EMbmPodcastAudio_dl_queued_new, |
58 EMbmPodcastAudio_downloaded_new_mask, |
58 EMbmPodcastAudio_dl_queued_new_mask, |
59 EMbmPodcastAudio_failed, |
59 // EDownloadingShowIcon, |
60 EMbmPodcastAudio_failed_mask, |
60 EMbmPodcastAudio_dl_active, |
61 EMbmPodcastAudio_suspended, |
61 EMbmPodcastAudio_dl_active_mask, |
62 EMbmPodcastAudio_suspended_mask, |
62 // EDownloadingShowIconNew, |
63 EMbmPodcastVideo, |
63 EMbmPodcastAudio_dl_active_new, |
64 EMbmPodcastVideo_mask, |
64 EMbmPodcastAudio_dl_active_new_mask, |
65 EMbmPodcastVideo_new, |
65 // EDownloadedShowIcon, |
66 EMbmPodcastVideo_new_mask, |
66 EMbmPodcastAudio_dl, |
67 EMbmPodcastVideo_queued, |
67 EMbmPodcastAudio_dl_mask, |
68 EMbmPodcastVideo_queued_mask, |
68 // EDownloadedShowIconNew, |
69 EMbmPodcastVideo_downloading, |
69 EMbmPodcastAudio_dl_new, |
70 EMbmPodcastVideo_downloading_mask, |
70 EMbmPodcastAudio_dl_new_mask, |
71 EMbmPodcastVideo_downloaded, |
71 // EFailedShowIcon, |
72 EMbmPodcastVideo_downloaded_mask, |
72 EMbmPodcastAudio_dl_failed, |
73 EMbmPodcastVideo_downloaded_new, |
73 EMbmPodcastAudio_dl_failed_mask, |
74 EMbmPodcastVideo_downloaded_new_mask, |
74 // EFailedShowIconNew, |
75 EMbmPodcastVideo_failed, |
75 EMbmPodcastAudio_dl_failed_new, |
76 EMbmPodcastVideo_failed_mask, |
76 EMbmPodcastAudio_dl_failed_new_mask, |
77 EMbmPodcastVideo_suspended, |
77 // ESuspendedShowIcon, |
78 EMbmPodcastVideo_suspended_mask, |
78 EMbmPodcastAudio_dl_suspended, |
79 EMbmPodcastFeed, |
79 EMbmPodcastAudio_dl_suspended_mask, |
80 EMbmPodcastFeed_mask, |
80 // ESuspendedShowIconNew |
81 0, |
81 EMbmPodcastAudio_dl_suspended_new, |
82 0 |
82 EMbmPodcastAudio_dl_suspended_new_mask, |
83 // EShowIcon = 0, |
|
84 EMbmPodcastVideo, |
|
85 EMbmPodcastVideo_mask, |
|
86 // EShowIconNew, |
|
87 EMbmPodcastVideo_new, |
|
88 EMbmPodcastVideo_new_mask, |
|
89 // EQuedShowIcon, |
|
90 EMbmPodcastVideo_dl_queued, |
|
91 EMbmPodcastVideo_dl_queued_mask, |
|
92 // EQuedShowIconNew, |
|
93 EMbmPodcastVideo_dl_queued_new, |
|
94 EMbmPodcastVideo_dl_queued_new_mask, |
|
95 // EDownloadingShowIcon, |
|
96 EMbmPodcastVideo_dl_active, |
|
97 EMbmPodcastVideo_dl_active_mask, |
|
98 // EDownloadingShowIconNew, |
|
99 EMbmPodcastVideo_dl_active_new, |
|
100 EMbmPodcastVideo_dl_active_new_mask, |
|
101 // EDownloadedShowIcon, |
|
102 EMbmPodcastVideo_dl, |
|
103 EMbmPodcastVideo_dl_mask, |
|
104 // EDownloadedShowIconNew, |
|
105 EMbmPodcastVideo_dl_new, |
|
106 EMbmPodcastVideo_dl_new_mask, |
|
107 // EFailedShowIcon, |
|
108 EMbmPodcastVideo_dl_failed, |
|
109 EMbmPodcastVideo_dl_failed_mask, |
|
110 // EFailedShowIconNew, |
|
111 EMbmPodcastVideo_dl_failed_new, |
|
112 EMbmPodcastVideo_dl_failed_new_mask, |
|
113 // ESuspendedShowIcon, |
|
114 EMbmPodcastVideo_dl_suspended, |
|
115 EMbmPodcastVideo_dl_suspended_mask, |
|
116 // ESuspendedShowIconNew |
|
117 EMbmPodcastVideo_dl_suspended_new, |
|
118 EMbmPodcastVideo_dl_suspended_new_mask, |
|
119 EMbmPodcastFeed, |
|
120 EMbmPodcastFeed_mask, |
|
121 0, |
|
122 0 |
|
83 }; |
123 }; |
84 |
124 |
85 const TInt KVideoIconOffset = 8; |
125 const TInt KVideoIconOffset = 12; |
86 |
126 |
87 CPodcastShowsView* CPodcastShowsView::NewL(CPodcastModel& aPodcastModel) |
127 CPodcastShowsView* CPodcastShowsView::NewL(CPodcastModel& aPodcastModel) |
88 { |
128 { |
89 CPodcastShowsView* self = CPodcastShowsView::NewLC(aPodcastModel); |
129 CPodcastShowsView* self = CPodcastShowsView::NewLC(aPodcastModel); |
90 CleanupStack::Pop(self); |
130 CleanupStack::Pop(self); |
187 return CPodcastListView::OfferKeyEventL(aKeyEvent, aType); |
227 return CPodcastListView::OfferKeyEventL(aKeyEvent, aType); |
188 } |
228 } |
189 |
229 |
190 CPodcastShowsView::~CPodcastShowsView() |
230 CPodcastShowsView::~CPodcastShowsView() |
191 { |
231 { |
232 DP("CPodcastShowsView::~CPodcastShowsView BEGIN"); |
|
192 iPodcastModel.ShowEngine().RemoveObserver(this); |
233 iPodcastModel.ShowEngine().RemoveObserver(this); |
193 iPodcastModel.FeedEngine().RemoveObserver(this); |
234 iPodcastModel.FeedEngine().RemoveObserver(this); |
235 DP("CPodcastShowsView::~CPodcastShowsView END"); |
|
194 } |
236 } |
195 |
237 |
196 |
238 |
197 TUid CPodcastShowsView::Id() const |
239 TUid CPodcastShowsView::Id() const |
198 { |
240 { |
364 } |
406 } |
365 |
407 |
366 void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex) |
408 void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex) |
367 { |
409 { |
368 TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended(); |
410 TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended(); |
369 |
411 TBool isNew = aShowInfo->PlayState() == ENeverPlayed; |
370 switch (aShowInfo->DownloadState()) |
412 switch (aShowInfo->DownloadState()) |
371 { |
413 { |
372 case EDownloaded: |
414 case EDownloaded: |
373 if (aShowInfo->PlayState() == ENeverPlayed) { |
415 aIconIndex = isNew ? EDownloadedShowIconNew : EDownloadedShowIcon; |
374 aIconIndex = EDownloadedNewShowIcon; |
|
375 } else { |
|
376 aIconIndex = EDownloadedShowIcon; |
|
377 } |
|
378 break; |
416 break; |
379 case ENotDownloaded: |
417 case ENotDownloaded: |
380 if (aShowInfo->PlayState() == ENeverPlayed) { |
418 aIconIndex = isNew ? EShowIconNew : EShowIcon; |
381 aIconIndex = ENewShowIcon; |
|
382 } else { |
|
383 aIconIndex = EShowIcon; |
|
384 } |
|
385 break; |
419 break; |
386 case EQueued: |
420 case EQueued: |
387 aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon; |
421 aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : |
422 (isNew ? EQuedShowIconNew : EQuedShowIcon); |
|
388 break; |
423 break; |
389 case EDownloading: |
424 case EDownloading: |
390 aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon; |
425 aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : |
426 (isNew ? EDownloadingShowIconNew : EDownloadingShowIcon); |
|
391 break; |
427 break; |
392 case EFailedDownload: |
428 case EFailedDownload: |
393 aIconIndex = EFailedShowIcon; |
429 aIconIndex = dlStop ? (isNew ? ESuspendedShowIconNew : ESuspendedShowIcon) : |
430 (isNew ? EFailedShowIconNew : EFailedShowIconNew); |
|
394 break; |
431 break; |
395 } |
432 } |
396 |
433 |
397 if (aShowInfo->ShowType() == EVideoPodcast) |
434 if (aShowInfo->ShowType() == EVideoPodcast) |
398 { |
435 { |
399 aIconIndex += KVideoIconOffset; |
436 aIconIndex += KVideoIconOffset; |
400 } |
437 } |
438 |
|
439 //DP3("dlStop=%d, isNew=%d, aIconIndex=%d", dlStop, isNew, aIconIndex); |
|
401 } |
440 } |
402 |
441 |
403 |
442 |
404 void CPodcastShowsView::UpdateFeedUpdateStateL() |
443 void CPodcastShowsView::UpdateFeedUpdateStateL() |
405 { |
444 { |
428 |
467 |
429 if(aSizeDownloaded > 0) |
468 if(aSizeDownloaded > 0) |
430 { |
469 { |
431 if (aShowInfo.ShowSize() > 0) |
470 if (aShowInfo.ShowSize() > 0) |
432 { |
471 { |
472 TUint showSize = aShowInfo.ShowSize() >= (TUint) aSizeDownloaded ? aShowInfo.ShowSize() : (TUint) aSizeDownloaded; |
|
433 infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb), |
473 infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb), |
434 ((float)aShowInfo.ShowSize() / (float)KSizeMb)); |
474 ((float) showSize / (float)KSizeMb)); |
435 } |
475 } |
436 else |
476 else |
437 { |
477 { |
438 infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb); |
478 infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb); |
439 } |
479 } |
600 { |
640 { |
601 switch (aCommand) |
641 switch (aCommand) |
602 { |
642 { |
603 case EPodcastMarkAsPlayed: |
643 case EPodcastMarkAsPlayed: |
604 HandleSetShowPlayedL(ETrue); |
644 HandleSetShowPlayedL(ETrue); |
605 if (iShowNewShows) UpdateListboxItemsL(); |
|
606 break; |
645 break; |
607 case EPodcastMarkAsUnplayed: |
646 case EPodcastMarkAsUnplayed: |
608 HandleSetShowPlayedL(EFalse); |
647 HandleSetShowPlayedL(EFalse); |
609 if (iShowNewShows) UpdateListboxItemsL(); |
|
610 break; |
648 break; |
611 case EPodcastMarkAllPlayed: |
649 case EPodcastMarkAllPlayed: |
612 { |
650 { |
613 if (iShowNewShows) { |
651 if (iShowNewShows) { |
614 TBuf<KMaxMessageLength> msg; |
652 TBuf<KMaxMessageLength> msg; |
714 note->PrepareLC( R_SHOW_INFO_NOTE ); // Adds to CleanupStack |
752 note->PrepareLC( R_SHOW_INFO_NOTE ); // Adds to CleanupStack |
715 note->RunLD(); |
753 note->RunLD(); |
716 } |
754 } |
717 } |
755 } |
718 |
756 |
757 void CPodcastShowsView::HandleDownloadAllL() |
|
758 { |
|
759 |
|
760 TBuf<KMaxMessageLength> msg; |
|
761 iEikonEnv->ReadResourceL(msg, R_DOWNLOAD_ALL_QUERY); |
|
762 if (!ShowQueryMessageL(msg)) |
|
763 { |
|
764 return; |
|
765 } |
|
766 |
|
767 for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++) |
|
768 { |
|
769 CShowInfo* info = iPodcastModel.ActiveShowList()[i]; |
|
770 |
|
771 if (info->DownloadState() == ENotDownloaded) |
|
772 { |
|
773 TRAP_IGNORE(iPodcastModel.ShowEngine().AddDownloadL(*info)); |
|
774 } |
|
775 } |
|
776 } |
|
777 |
|
719 void CPodcastShowsView::UpdateToolbar(TBool aVisible) |
778 void CPodcastShowsView::UpdateToolbar(TBool aVisible) |
720 { |
779 { |
721 CAknToolbar* toolbar = Toolbar(); |
780 CAknToolbar* toolbar = Toolbar(); |
722 |
781 |
723 if (toolbar) { |
782 if (toolbar) { |
725 toolbar->SetToolbarVisibility(aVisible); |
784 toolbar->SetToolbarVisibility(aVisible); |
726 } |
785 } |
727 |
786 |
728 TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() && |
787 TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.ActiveFeedInfo() && |
729 iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
788 iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
730 |
789 |
731 if (iShowNewShows) |
790 if (iShowNewShows) |
732 { |
791 { |
733 updatingState = iPodcastModel.FeedEngine().ClientState(); |
792 updatingState = iPodcastModel.FeedEngine().ClientState(); |
734 toolbar->HideItem(EPodcastUpdateFeed, ETrue, ETrue ); |
793 toolbar->HideItem(EPodcastUpdateFeed, ETrue, ETrue ); |
735 toolbar->HideItem(EPodcastUpdateAllFeeds, updatingState, ETrue ); |
794 toolbar->HideItem(EPodcastUpdateAllFeeds, updatingState, ETrue ); |
775 |
834 |
776 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
835 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
777 { |
836 { |
778 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
837 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
779 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
838 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
780 iPodcastModel.ShowEngine().UpdateShowL(*info); |
839 if (aPlayed) |
781 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
840 { |
782 iListContainer->Listbox()->DrawItem(index); |
841 // PostPlayHandling calls UpdateShow, which is slow, so we don't need to do it again |
842 iPodcastModel.ShowEngine().PostPlayHandling(info); |
|
843 } |
|
844 else |
|
845 { |
|
846 iPodcastModel.ShowEngine().UpdateShowL(*info); |
|
847 } |
|
848 |
|
849 if (iShowNewShows) |
|
850 { |
|
851 UpdateListboxItemsL(); |
|
852 |
|
853 if (index > 0) |
|
854 { |
|
855 iListContainer->Listbox()->SetCurrentItemIndex(index - 1); |
|
856 } |
|
857 } |
|
858 else |
|
859 { |
|
860 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
|
861 iListContainer->Listbox()->DrawItem(index); |
|
862 } |
|
783 } |
863 } |
784 } |
864 } |
785 |
865 |
786 void CPodcastShowsView::HandleDeleteShowL() |
866 void CPodcastShowsView::HandleDeleteShowL() |
787 { |
867 { |
808 iListContainer->Listbox()->DrawItem(index); |
888 iListContainer->Listbox()->DrawItem(index); |
809 } |
889 } |
810 } |
890 } |
811 } |
891 } |
812 |
892 |
813 void CPodcastShowsView::HandleDownloadAllL() |
|
814 { |
|
815 |
|
816 TBuf<KMaxMessageLength> msg; |
|
817 iEikonEnv->ReadResourceL(msg, R_DOWNLOAD_ALL_QUERY); |
|
818 if (!ShowQueryMessageL(msg)) |
|
819 { |
|
820 return; |
|
821 } |
|
822 |
|
823 for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++) |
|
824 { |
|
825 CShowInfo* info = iPodcastModel.ActiveShowList()[i]; |
|
826 |
|
827 if (info->DownloadState() == ENotDownloaded) |
|
828 { |
|
829 TRAP_IGNORE(iPodcastModel.ShowEngine().AddDownloadL(*info)); |
|
830 } |
|
831 } |
|
832 } |
|
833 |
|
834 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
893 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
835 { |
894 { |
836 ((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows); |
895 ((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows); |
837 UpdateListboxItemsL(); |
896 UpdateListboxItemsL(); |
838 } |
897 } |