|
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 #ifndef VCXHGVODCONTENTLISTMODELHANDLER_H |
|
21 #define VCXHGVODCONTENTLISTMODELHANDLER_H |
|
22 |
|
23 #include <ganes/HgScrollBufferObserverIface.h> |
|
24 |
|
25 #include "vcxhgvodthumbnailobserver.h" |
|
26 #include "vcxhgvodmainviewcontainer.h" |
|
27 #include "vcxnscontentproviderif.h" |
|
28 #include "vcxnscontentproviderobserver.h" |
|
29 |
|
30 class CHgScroller; |
|
31 class CVcxHgVodMainView; |
|
32 class CVcxNsUiEngine; |
|
33 class CVcxNsContent; |
|
34 class CVcxHgVodContentListImpl; |
|
35 class CVcxHgVodThumbnailManager; |
|
36 class TVcxHgVodVideoDetailsDialog; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 /** |
|
40 * |
|
41 * @code |
|
42 * |
|
43 * @endcode |
|
44 * |
|
45 * @lib vcxhgvodui.lib |
|
46 * @since S60 v5.0 |
|
47 */ |
|
48 class CVcxHgVodContentListModelHandler : public CBase, |
|
49 public MVcxNsContentProviderObserver, |
|
50 public MVcxHgVodThumbnailObserver, |
|
51 public MHgScrollBufferObserver |
|
52 { |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 */ |
|
59 static CVcxHgVodContentListModelHandler* NewL( |
|
60 CVcxNsUiEngine& aDataProviderIf, |
|
61 CVcxHgVodMainView& aView, |
|
62 CHgScroller& aScroller, |
|
63 CVcxHgVodContentListImpl& aContentListImpl ); |
|
64 |
|
65 /** |
|
66 * Two-phased constructor. |
|
67 */ |
|
68 static CVcxHgVodContentListModelHandler* NewLC( |
|
69 CVcxNsUiEngine& aDataProviderIf, |
|
70 CVcxHgVodMainView& aView, |
|
71 CHgScroller& aScroller, |
|
72 CVcxHgVodContentListImpl& aContentListImpl ); |
|
73 |
|
74 /** |
|
75 * Destructor. |
|
76 */ |
|
77 virtual ~CVcxHgVodContentListModelHandler(); |
|
78 |
|
79 /** |
|
80 * Activate model |
|
81 * |
|
82 */ |
|
83 void DoActivateModelL( ); |
|
84 |
|
85 /** |
|
86 * Deactivate model |
|
87 * |
|
88 */ |
|
89 void DoDeActivateModel( ); |
|
90 |
|
91 /** |
|
92 * Get services and set to widget model. |
|
93 * |
|
94 */ |
|
95 void SetListContentL(); |
|
96 |
|
97 /** |
|
98 * Get category provider interface pointer |
|
99 * |
|
100 */ |
|
101 MVcxNsContentProviderIf* ContentProvider(); |
|
102 |
|
103 /** |
|
104 * Get selected video's details |
|
105 */ |
|
106 void ShowVideoDetailsL( TInt aSelected ); |
|
107 |
|
108 /** |
|
109 * Check if model is empty. |
|
110 */ |
|
111 TBool IsEmptyModel(); |
|
112 |
|
113 public: |
|
114 |
|
115 /** |
|
116 * From MVcxNsContentProviderObserver |
|
117 * Notify content's data has been updated. |
|
118 */ |
|
119 void ContentUpdated( TInt aIndex ); |
|
120 |
|
121 /** |
|
122 * From MVcxNsContentProviderObserver |
|
123 * Application state or full view data needs to be updated. |
|
124 */ |
|
125 void RefreshView(); |
|
126 |
|
127 /** |
|
128 * From MVcxNsCategoryProviderObserver |
|
129 * Application state needs to be updated. |
|
130 */ |
|
131 void HandleAppStateChangedL(); |
|
132 |
|
133 /** |
|
134 * MVcxNsContentProviderObserver |
|
135 * Epg update is ongoing, show the notification. |
|
136 * When downloading and parsing the xml, both parameters are 0. |
|
137 * |
|
138 * @param aDownloaded count of downloaded thumbnails. |
|
139 * @param aTotal Total count of thumbnails to be downloaded. |
|
140 */ |
|
141 void ShowUpdatingNoteL( TBool aShow, TInt aDownloadedTbns, TInt aTotalTbns ); |
|
142 |
|
143 /** |
|
144 * From MVcxNsContentProviderObserver |
|
145 * Handle error |
|
146 * |
|
147 * @param aError Error to handle in UI |
|
148 */ |
|
149 void HandleUpdateErrorL( TInt aError ); |
|
150 |
|
151 /** |
|
152 * From MVcxNsContentProviderObserver |
|
153 * Handle download error |
|
154 * |
|
155 * @param aError Error to handle in UI |
|
156 * @param aContent Details of the video which content has failed. |
|
157 */ |
|
158 void HandleDownloadErrorL( TIptvDlError aError, CVcxNsContent& aContent ); |
|
159 |
|
160 /** |
|
161 * From MVcxHgVodThumbnailObserver |
|
162 * Notifies about completed thumbnail loading. |
|
163 * |
|
164 * @param aIcon Pointer to the created icon, ownership is transferred. |
|
165 * @param aClientId ContentId of the thumbnail. |
|
166 */ |
|
167 void MvtoThumbnailReady( CGulIcon* aIcon, TInt64 aClientId ); |
|
168 |
|
169 private: |
|
170 |
|
171 /** |
|
172 * Default constructor |
|
173 * |
|
174 */ |
|
175 CVcxHgVodContentListModelHandler( |
|
176 CVcxNsUiEngine& aDataProviderIf, |
|
177 CVcxHgVodMainView& aView, |
|
178 CHgScroller& aScroller, |
|
179 CVcxHgVodContentListImpl& aContentListImpl ); |
|
180 |
|
181 /** |
|
182 * Constructor |
|
183 */ |
|
184 void ConstructL( ); |
|
185 |
|
186 |
|
187 /** |
|
188 * Generate second line text according to content current status. |
|
189 * @param aContent Content details |
|
190 * @return Content info string |
|
191 */ |
|
192 HBufC* GenerateContextInfoTextLC( CVcxNsContent& aContent ); |
|
193 |
|
194 /** |
|
195 * Update msk commands. |
|
196 */ |
|
197 void HandleCommandUpdatesL(); |
|
198 |
|
199 /** |
|
200 * Update data in the model |
|
201 * |
|
202 * @param aStartIndex Index at which the item request has been initiated |
|
203 * @param aRange Number of items to update |
|
204 */ |
|
205 void ProvideDataL( int aStartIndex, int aRange ); |
|
206 |
|
207 /** |
|
208 * Update view details: |
|
209 * Title pane, empty list text. |
|
210 */ |
|
211 void UpdateViewDetailsL(); |
|
212 |
|
213 /** |
|
214 * Refreshes view. |
|
215 */ |
|
216 void RefreshViewL(); |
|
217 |
|
218 /** |
|
219 * Updates data of item in list. |
|
220 * @param aIndex Item's index |
|
221 */ |
|
222 void UpdateListItemL( TInt aIndex ); |
|
223 |
|
224 /** |
|
225 * Handles completed thumbnail loading. Makes sure that the |
|
226 * aIcon is pushed to CleanupStack before any leaving code is |
|
227 * executed. |
|
228 */ |
|
229 void DoThumbnailReadyL( CGulIcon* aIcon, TInt64 aClientId ); |
|
230 |
|
231 /** |
|
232 * From MHgScrollBufferObserver |
|
233 * |
|
234 * Buffer position changed. The items between the aBufferStart |
|
235 * and aBufferEnd should be loaded as soon as possible. |
|
236 * |
|
237 * @param aBufferStart The index of the first item in buffer. |
|
238 * @param aBufferEnd The index of the last item in buffer. |
|
239 * @param aDirection The direction of request. |
|
240 */ |
|
241 void Request( TInt aBufferStart, TInt aBufferEnd, THgScrollDirection aDirection ); |
|
242 |
|
243 /** |
|
244 * From MHgScrollBufferObserver |
|
245 * |
|
246 * Buffer position changed. The items between the aBufferStart |
|
247 * and aBufferEnd should be released. |
|
248 * |
|
249 * @param aBufferStart The index of the first item in buffer. |
|
250 * @param aBufferEnd The index of the last item in buffer. |
|
251 */ |
|
252 void Release( TInt aBufferStart, TInt aBufferEnd ); |
|
253 |
|
254 |
|
255 private: // data |
|
256 |
|
257 /** |
|
258 * Video details dialog. |
|
259 * Own. |
|
260 */ |
|
261 TVcxHgVodVideoDetailsDialog* iVideoDetails; |
|
262 |
|
263 /** |
|
264 * Ref to Ui Engine interface. |
|
265 * |
|
266 */ |
|
267 CVcxNsUiEngine& iDataProviderIf; |
|
268 |
|
269 /** |
|
270 * Reference to vod main view |
|
271 * |
|
272 */ |
|
273 CVcxHgVodMainView& iView; |
|
274 |
|
275 /** |
|
276 * Reference to UI component responsible for displaying the list. |
|
277 */ |
|
278 CHgScroller& iScroller; |
|
279 |
|
280 /** |
|
281 * Pointer to content provider if in UI engine |
|
282 * |
|
283 */ |
|
284 MVcxNsContentProviderIf* iContentProvider; |
|
285 |
|
286 /** |
|
287 * Pointer to array that holds contents in UI engine |
|
288 * Not own. |
|
289 */ |
|
290 RPointerArray<CVcxNsContent>* iContents; |
|
291 |
|
292 /** |
|
293 * Ref to list implementation |
|
294 * |
|
295 */ |
|
296 CVcxHgVodContentListImpl& iListImpl; |
|
297 |
|
298 /** |
|
299 * Used to load thumbnails asynchronously. |
|
300 */ |
|
301 CVcxHgVodThumbnailManager* iTnManager; |
|
302 |
|
303 }; |
|
304 |
|
305 #endif // VCXHGVODCONTENTLISTMODELHANDLER_H |