|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MVCXNSUPDATEPROGRESSHANDLER_H |
|
22 #define MVCXNSUPDATEPROGRESSHANDLER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32std.h> |
|
26 #include <e32base.h> |
|
27 #include "vcxnsuiengine.h" |
|
28 #include "vcxnsupdateprogressif.h" |
|
29 #include "MIptvTimerObserver.h" |
|
30 |
|
31 class CIptvTimer; |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * MVcxNsUpdateProgressObserver |
|
36 * |
|
37 * @lib vcxnsuiengine.lib |
|
38 */ |
|
39 class MVcxNsUpdateProgressObserver |
|
40 { |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Handle feed update progress change |
|
45 * Informs which index in list needs to be updated with new progress |
|
46 * @param aIndex Index where progress needs to be updated |
|
47 * @param aProgress Progress as percentage |
|
48 * |
|
49 */ |
|
50 virtual void HandleFeedUpdateProgressL( TInt aIndex, TInt aProgress ) = 0; |
|
51 }; |
|
52 |
|
53 /** |
|
54 * CVcxNsUpdateProgressHandler class |
|
55 * |
|
56 * @lib vcxnsuiengine.lib |
|
57 */ |
|
58 NONSHARABLE_CLASS( CVcxNsUpdateProgressHandler ): public CBase, |
|
59 public MVcxNsUpdateProgressIf, |
|
60 public MIptvTimerObserver |
|
61 { |
|
62 |
|
63 public: |
|
64 |
|
65 /** |
|
66 * Constructor |
|
67 * @param aUiEngine Ui engine |
|
68 */ |
|
69 static CVcxNsUpdateProgressHandler* NewL( CVcxNsUiEngine& aUiEngine ); |
|
70 |
|
71 /** |
|
72 * Destructor |
|
73 */ |
|
74 virtual ~CVcxNsUpdateProgressHandler(); |
|
75 |
|
76 public: |
|
77 |
|
78 /** |
|
79 * From MVcxNsUpdateProgressIf |
|
80 * RegisterObserver. |
|
81 * @param aObserver Observer |
|
82 */ |
|
83 void RegisterObserver( MVcxNsUpdateProgressObserver* aObserver ); |
|
84 |
|
85 /** |
|
86 * From MVcxNsUpdateProgressIf |
|
87 * DeRegisterObserver. |
|
88 * @param aObserver Observer |
|
89 */ |
|
90 void DeRegisterObserver( MVcxNsUpdateProgressObserver* aObserver ); |
|
91 |
|
92 /** |
|
93 * From MVcxNsUpdateProgressIf |
|
94 * Get progress. |
|
95 * @param aServiceId Service id which progress is requested |
|
96 * @return Progress between 0-99, KErrNotFound if not available |
|
97 */ |
|
98 TInt GetProgress( TUint32 aServiceId ); |
|
99 |
|
100 /** |
|
101 * From MIptvTimerObserver |
|
102 * The function to be called when a timeout occurs. |
|
103 * |
|
104 * @param aTimer Pointer to timer which expired. |
|
105 */ |
|
106 void TimerExpired( CIptvTimer* aTimer ); |
|
107 |
|
108 /** |
|
109 * Cancel progress handler. |
|
110 * |
|
111 */ |
|
112 void Cancel(); |
|
113 |
|
114 public: |
|
115 |
|
116 /** |
|
117 * Update progress value according to status. |
|
118 * @param aServiceId Service id |
|
119 * @param aUpdateStatusMsg Update status message |
|
120 * @param aInfo Additional info with status |
|
121 */ |
|
122 void HandleUpdateStatusChangeL( |
|
123 TUint32 aServiceId, |
|
124 TInt aUpdateStatusMsg, |
|
125 TInt aInfo ); |
|
126 |
|
127 private: |
|
128 |
|
129 /** |
|
130 * Default constructor |
|
131 * @param aUiEngine Reference to ui engine. |
|
132 */ |
|
133 CVcxNsUpdateProgressHandler( CVcxNsUiEngine& aUiEngine ); |
|
134 |
|
135 /** |
|
136 * Check if thumbnails are allowed. |
|
137 * @return ETrue if thumbnail download is allowed |
|
138 * otherwise EFalse. |
|
139 */ |
|
140 TBool ThumbnailsAllowedL() const; |
|
141 |
|
142 /** |
|
143 * Start progress update timer |
|
144 */ |
|
145 void StartProgressUpdateTimerL( ); |
|
146 |
|
147 /** |
|
148 * Refresh progress with specified progress value. |
|
149 * Informs observer of the change. |
|
150 * @param aProgress Progress value |
|
151 */ |
|
152 void RefreshProgressL( TInt aProgress ); |
|
153 |
|
154 private: |
|
155 |
|
156 // Data |
|
157 |
|
158 /** |
|
159 * Update progress observer. |
|
160 * Not Own. |
|
161 */ |
|
162 MVcxNsUpdateProgressObserver* iProgressObserver; |
|
163 |
|
164 /** |
|
165 * Reference to UI engine. |
|
166 */ |
|
167 CVcxNsUiEngine& iUiEngine; |
|
168 |
|
169 /** |
|
170 * Progress timer. |
|
171 * Own. |
|
172 */ |
|
173 CIptvTimer* iProgressTimer; |
|
174 |
|
175 /** |
|
176 * Flag for thumbnail setting. |
|
177 * ETrue if thumbnail download in content update is allowed. |
|
178 * By default EFalse. |
|
179 */ |
|
180 TBool iThumbnails; |
|
181 |
|
182 /** |
|
183 * Previously updated progress value. |
|
184 * |
|
185 */ |
|
186 TInt iPreviousProgress; |
|
187 |
|
188 /** |
|
189 * Saves information on how much progress is increased |
|
190 * when one thumbnail has been downloaded. |
|
191 * If value is 0, progress is calculated based on |
|
192 * iThumbnailsPercent. |
|
193 */ |
|
194 TInt iProgressPerThumbnail; |
|
195 |
|
196 /** |
|
197 * Information on how many thumbnails must be |
|
198 * downloaded to increase progress by percent. |
|
199 */ |
|
200 TInt iThumbnailsInPercent; |
|
201 |
|
202 /** |
|
203 * Counter for downloaded thumbnails. |
|
204 */ |
|
205 TInt iThumbnailCounter; |
|
206 |
|
207 /** |
|
208 * Service id of currently updated service. |
|
209 */ |
|
210 TUint32 iCurrentServiceId; |
|
211 |
|
212 /** |
|
213 * Current status of content update. |
|
214 */ |
|
215 TInt iCurrentStatus; |
|
216 }; |
|
217 |
|
218 |
|
219 #endif // MVCXNSUPDATEPROGRESSHANDLER_H |