|
1 /* |
|
2 * Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB |
|
3 * |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of the License "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * EmbedDev AB - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef PODCASTAPPUI_H |
|
20 #define PODCASTAPPUI_H |
|
21 |
|
22 #include <aknviewappui.h> |
|
23 #include <akntabobserver.h> |
|
24 #include <akntabgrp.h> |
|
25 #include <aknnavide.h> |
|
26 |
|
27 class CPodcastMainView; |
|
28 class CPodcastFeedView; |
|
29 class CPodcastShowsView; |
|
30 class CPodcastQueueView; |
|
31 class CPodcastSettingsView; |
|
32 class CPodcastSearchView; |
|
33 class CPodcastModel; |
|
34 |
|
35 const TUid KUidPodcastClientID = {0xA00046AE}; |
|
36 const TUid KUidPodcastFeedViewID = {0x00000001}; |
|
37 const TUid KUidPodcastShowsViewID = {0x00000002}; |
|
38 const TUid KUidPodcastQueueViewID = {0x00000003}; |
|
39 const TUid KUidPodcastSearchViewID = {0x00000004}; |
|
40 const TUid KUidPodcastSettingsViewID = {0x00000005}; |
|
41 |
|
42 const TInt KTabIdFeeds = 0; |
|
43 const TInt KTabIdQueue = 1; |
|
44 |
|
45 const TInt KTimeoutPrio = CActive::EPriorityStandard; |
|
46 |
|
47 class CTimeout; |
|
48 |
|
49 class MTimeoutObserver |
|
50 { |
|
51 public: |
|
52 virtual void HandleTimeout(const CTimeout& aId, TInt aError)=0; |
|
53 protected: |
|
54 virtual ~MTimeoutObserver() {} |
|
55 }; |
|
56 |
|
57 class CTimeout : public CTimer |
|
58 { |
|
59 public: |
|
60 |
|
61 static CTimeout* NewLC(MTimeoutObserver& aObserver, TInt aPrio=KTimeoutPrio) |
|
62 { |
|
63 CTimeout* self=new(ELeave) CTimeout(aObserver, aPrio); |
|
64 CleanupStack::PushL(self); |
|
65 self->ConstructL(); |
|
66 return self; |
|
67 } |
|
68 |
|
69 static CTimeout* NewL(MTimeoutObserver& aObserver, TInt aPrio=KTimeoutPrio) |
|
70 { |
|
71 CTimeout* self=NewLC(aObserver, aPrio); |
|
72 CleanupStack::Pop(self); |
|
73 return self; |
|
74 } |
|
75 |
|
76 ~CTimeout() |
|
77 { |
|
78 Cancel(); |
|
79 } |
|
80 protected: |
|
81 CTimeout(MTimeoutObserver& aObserver, TInt aPrio) : CTimer(aPrio), iObserver(aObserver) |
|
82 { |
|
83 CActiveScheduler::Add(this); |
|
84 } |
|
85 void ConstructL() |
|
86 { |
|
87 CTimer::ConstructL(); |
|
88 } |
|
89 |
|
90 void RunL() |
|
91 { |
|
92 TInt r=iStatus.Int(); |
|
93 iObserver.HandleTimeout(*this, r); |
|
94 } |
|
95 |
|
96 protected: |
|
97 MTimeoutObserver& iObserver; |
|
98 }; |
|
99 |
|
100 class CPodcastAppUi : public CAknViewAppUi, public MAknTabObserver, MTimeoutObserver |
|
101 { |
|
102 public: |
|
103 CPodcastAppUi(CPodcastModel* aPodcastModel); |
|
104 void ConstructL(); |
|
105 ~CPodcastAppUi(); |
|
106 |
|
107 void SetActiveTab(TInt aIndex); |
|
108 void UpdateQueueTab(TInt aQueueLength); |
|
109 void TabLeft(); |
|
110 void TabRight(); |
|
111 private: |
|
112 // From MEikMenuObserver |
|
113 void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); |
|
114 void TabChangedL (TInt aIndex); |
|
115 CArrayFix<TCoeHelpContext>* HelpContextL() const; |
|
116 private: |
|
117 void HandleCommandL(TInt aCommand); |
|
118 void NaviShowTabGroupL(); |
|
119 protected: |
|
120 void HandleTimeout(const CTimeout& aId, TInt aError); |
|
121 |
|
122 private: |
|
123 CPodcastMainView *iMainView; |
|
124 CPodcastFeedView* iFeedView; |
|
125 CPodcastShowsView* iShowsView; |
|
126 CPodcastQueueView* iQueueView; |
|
127 CPodcastSearchView* iSearchView; |
|
128 CPodcastSettingsView* iSettingsView; |
|
129 |
|
130 CPodcastModel* iPodcastModel; |
|
131 |
|
132 CAknNavigationDecorator* iNaviDecorator; |
|
133 CAknTabGroup* iTabGroup; |
|
134 CAknNavigationControlContainer* iNaviPane; |
|
135 |
|
136 CTimeout* iStartTimer; |
|
137 }; |
|
138 |
|
139 #endif |