23
|
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: UI level handler for category data.*
|
|
15 |
*/
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef VCXHGMYVIDEOSCATEGORYMODELHANDLER_H
|
|
21 |
#define VCXHGMYVIDEOSCATEGORYMODELHANDLER_H
|
|
22 |
|
|
23 |
// INCLUDE FILES
|
|
24 |
#include "vcxhgmyvideoscategorymodelobserver.h"
|
|
25 |
|
|
26 |
|
|
27 |
#include <thumbnailmanager.h>
|
|
28 |
#include <thumbnailmanagerobserver.h>
|
|
29 |
|
|
30 |
// FORWARD DECLARATIONS
|
|
31 |
class CMPXMedia;
|
|
32 |
class CVcxHgMyVideosModel;
|
|
33 |
class CHgScroller;
|
|
34 |
class CMPXMedia;
|
|
35 |
class CMyVideosIndicator;
|
|
36 |
class CVcxHgMyVideosThumbnailManager;
|
|
37 |
class TAknsItemID;
|
|
38 |
|
|
39 |
// ENUMERATIONS
|
|
40 |
enum TVcxHgMyVideosCategoryItemType
|
|
41 |
{
|
|
42 |
TVcxHgMyVideosCategoryItemTypeUndefined = 0,
|
|
43 |
TVcxHgMyVideosCategoryItemTypeUid,
|
|
44 |
TVcxHgMyVideosCategoryItemTypeUrl
|
|
45 |
};
|
|
46 |
|
|
47 |
// CONSTANTS
|
|
48 |
const TInt KMyVideosTitleStringMaxLength = 256;
|
|
49 |
const TInt KMyVideosTitleUrlMaxLength = 256;
|
|
50 |
|
|
51 |
// CLASS DECLARATION
|
|
52 |
|
|
53 |
/**
|
|
54 |
* UI level handler for category data.
|
|
55 |
*
|
|
56 |
* @lib vcxhgmyvideos.lib
|
|
57 |
*/
|
|
58 |
NONSHARABLE_CLASS( CVcxHgMyVideosCategoryModelHandler ) :
|
|
59 |
public CBase,
|
|
60 |
public MVcxHgMyVideosCategoryModelObserver,
|
|
61 |
public MThumbnailManagerObserver
|
|
62 |
{
|
|
63 |
public:
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Default constructor
|
|
67 |
*
|
|
68 |
* @param aModel Application model
|
|
69 |
* @param aScroller Hg list component.
|
|
70 |
*/
|
|
71 |
static CVcxHgMyVideosCategoryModelHandler* NewL(
|
|
72 |
CVcxHgMyVideosModel& aModel,
|
|
73 |
CHgScroller& aScroller );
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Destructor.
|
|
77 |
*/
|
|
78 |
virtual ~CVcxHgMyVideosCategoryModelHandler();
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Activates category model.
|
|
82 |
*/
|
|
83 |
void DoModelActivateL();
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Deactivates category model.
|
|
87 |
*/
|
|
88 |
void DoModelDeactivate();
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Makes sure model has correct category list.
|
|
92 |
*/
|
|
93 |
void GetCategoryListL();
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Gets list highlight.
|
|
97 |
*
|
|
98 |
* @return Highlight.
|
|
99 |
*/
|
|
100 |
TInt Highlight();
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Returns category index corresponding the Ganes index.
|
|
104 |
*
|
|
105 |
* @param Ganes scroller list index
|
|
106 |
* @return Index of category
|
|
107 |
*/
|
|
108 |
TInt ResolveCategoryId( TInt aScrollerIndex );
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Plays last watched videdo.
|
|
112 |
*
|
|
113 |
* @param Ganes scroller list index
|
|
114 |
* @return Index of category
|
|
115 |
*/
|
|
116 |
void PlayLastWatchedVidedoL();
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Returns video indicator.
|
|
120 |
*
|
|
121 |
* @return Reference to video indicator.
|
|
122 |
*/
|
|
123 |
CMyVideosIndicator& VideoIndicatorL();
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Handles "ExtraItem" list item selection.
|
|
127 |
*
|
|
128 |
* @param aCategoryId Selected category id
|
|
129 |
* @param aItemType On return, item type. If both UID and URL were found,
|
|
130 |
* UID type will be returned.
|
|
131 |
*
|
|
132 |
* @param aUid On return, UID if selected item contains UID
|
|
133 |
* @param aUrl On return, URL string if selected item contains URL
|
|
134 |
*/
|
|
135 |
void HandleExtraItemSelectionL( TInt aCategoryId,
|
|
136 |
TVcxHgMyVideosCategoryItemType& aItemType,
|
|
137 |
TUid& aUid,
|
|
138 |
TDes& aUrl );
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Create empty icon to be used as category list default icon
|
|
142 |
*
|
|
143 |
* @return empty icon
|
|
144 |
*/
|
|
145 |
CGulIcon* CreateEmptyHgListIconL();
|
|
146 |
|
|
147 |
public: // From MVcxHgMyVideosCategoryModelObserver
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Called when a list of categories is available.
|
|
151 |
* Ownership of array is transferred.
|
|
152 |
*
|
|
153 |
* @param aCategoryList List of categories
|
|
154 |
* @param aIsPartial ETrue if list fetching continues, and KVcxMessageMyVideosListComplete
|
|
155 |
* message will arrive. EFalse if this is last event of list fetching.
|
|
156 |
*/
|
|
157 |
void NewCategoryListL( CMPXMediaArray* aCategoryList, TBool aIsPartial );
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Called when the list of categories has been modified.
|
|
161 |
*/
|
|
162 |
void CategoryListModifiedL();
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Called when a single category has been modified (add/remove/modify).
|
|
166 |
*
|
|
167 |
* @param aEventType Type of modification event (add/remove/modify).
|
|
168 |
* @param aMpxItemId MPX Item Id of the modified item.
|
|
169 |
*/
|
|
170 |
void CategoryModifiedL( TMPXChangeEventType aEventType,
|
|
171 |
TMPXItemId& aMpxItemId );
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Called when category list items have been fetched.
|
|
175 |
*/
|
|
176 |
void CategoryListFetchingCompletedL();
|
|
177 |
|
|
178 |
public: // From MThumbnailManagerObserver)
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Preview thumbnail generation or loading is complete.
|
|
182 |
*
|
|
183 |
* @param aThumbnail An object representing the resulting thumbnail.
|
|
184 |
* @param aId Request ID for the operation
|
|
185 |
*/
|
|
186 |
void ThumbnailPreviewReady( MThumbnailData& aThumbnail,
|
|
187 |
TThumbnailRequestId aId );
|
|
188 |
|
|
189 |
/**
|
|
190 |
* Final thumbnail bitmap generation or loading is complete.
|
|
191 |
*
|
|
192 |
* @param aError Error code.
|
|
193 |
* @param aThumbnail An object representing the resulting thumbnail.
|
|
194 |
* @param aId Request ID for the operation.
|
|
195 |
*/
|
|
196 |
void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail,
|
|
197 |
TThumbnailRequestId aId );
|
|
198 |
|
|
199 |
private:
|
|
200 |
|
|
201 |
/**
|
|
202 |
* C++ constructor
|
|
203 |
*
|
|
204 |
* @param aModel Application model
|
|
205 |
* @param aScroller Hg list component.
|
|
206 |
*/
|
|
207 |
CVcxHgMyVideosCategoryModelHandler(
|
|
208 |
CVcxHgMyVideosModel& aModel,
|
|
209 |
CHgScroller& aScroller );
|
|
210 |
|
|
211 |
/**
|
|
212 |
* Loads name of category from resources.
|
|
213 |
*
|
|
214 |
* @param aCategoryId Index of category.
|
|
215 |
* @return Name of category.
|
|
216 |
*/
|
|
217 |
HBufC* GetCategoryNameLC( TInt aCategoryId );
|
|
218 |
|
|
219 |
/**
|
|
220 |
* Loads icon for category
|
|
221 |
*
|
|
222 |
* @param aCategoryId Id of category
|
|
223 |
* @return Category icon
|
|
224 |
*/
|
|
225 |
CGulIcon* GetCategoryIconL( TInt aCategoryId );
|
|
226 |
|
|
227 |
/**
|
|
228 |
* Formats second row text for categories.
|
|
229 |
*
|
|
230 |
* @param aMedia MPX media object for row.
|
|
231 |
* @return Second row text for category.
|
|
232 |
*/
|
|
233 |
HBufC* FormatCategorySecondRowLC( CMPXMedia& aMedia );
|
|
234 |
|
|
235 |
/**
|
|
236 |
* Formats second row text for categories.
|
|
237 |
*
|
|
238 |
* @param aCategoryId Category id.
|
|
239 |
* @return Second row text for category.
|
|
240 |
*/
|
|
241 |
HBufC* FormatCategorySecondRowLC( TInt aCategoryId );
|
|
242 |
|
|
243 |
/**
|
|
244 |
* Translates MPX Item Id to index on UI list.
|
|
245 |
*
|
|
246 |
* @param aMpxItemId MPX Item Id.
|
|
247 |
* @return Index on UI, or KErrNotFound.
|
|
248 |
*/
|
|
249 |
TInt UiIndexFromMpxItemId( TMPXItemId& aMpxItemId );
|
|
250 |
|
|
251 |
/**
|
|
252 |
* Updates the whole category list.
|
|
253 |
*/
|
|
254 |
void UpdateCategoryListL();
|
|
255 |
|
|
256 |
/**
|
|
257 |
* Updates list item from specified index.
|
|
258 |
*
|
|
259 |
* @param aListIndex Item's index on UI list.
|
|
260 |
*/
|
|
261 |
void UpdateCategoryListItemL( TInt aListIndex );
|
|
262 |
|
|
263 |
/**
|
|
264 |
* Removes list item from specefied index.
|
|
265 |
*
|
|
266 |
* @param aListIndex Item's index on UI list.
|
|
267 |
*/
|
|
268 |
void RemoveCategoryListItem( TInt aListIndex );
|
|
269 |
|
|
270 |
/**
|
|
271 |
* Goes through given number of categories and
|
|
272 |
* fills iCategoryIdArray from the accepted ones
|
|
273 |
*/
|
|
274 |
void MakeCategoryIdArray();
|
|
275 |
|
|
276 |
/**
|
|
277 |
* Checks if the given category is accepted or not.
|
|
278 |
*
|
|
279 |
* @param aCategoryId category id
|
|
280 |
* @return TBool if accepted
|
|
281 |
*/
|
|
282 |
TBool AcceptCategory( TInt aCategoryId );
|
|
283 |
|
|
284 |
/**
|
|
285 |
* Finds correct array index for given category id
|
|
286 |
* from iCategoryIdAraay
|
|
287 |
*
|
|
288 |
* @param aCategoryId category id to be found
|
|
289 |
* @return Array index
|
|
290 |
*/
|
|
291 |
TInt ResolveCategoryArrayIndexById( TInt aCategoryId );
|
|
292 |
|
|
293 |
/**
|
|
294 |
* @param aCategoryId Category id to be found
|
|
295 |
* @return CMPXMedia
|
|
296 |
*/
|
|
297 |
CMPXMedia* GetCategoryDataL( TInt aCategoryId );
|
|
298 |
|
|
299 |
/**
|
|
300 |
* Gets the last watched videos icon from tbn server.
|
|
301 |
* Result is returned asynchronously to ThumbnailReady callback.
|
|
302 |
*/
|
|
303 |
void LoadLastWatchedIconL();
|
|
304 |
|
|
305 |
/**
|
|
306 |
* Clears the last watched videos icon and indicator.
|
|
307 |
*/
|
|
308 |
void ClearLastWatchedIconL();
|
|
309 |
|
|
310 |
/**
|
|
311 |
* Set indicator for last watched item
|
|
312 |
*/
|
|
313 |
void SetLastWatchedIndicatorL();
|
|
314 |
|
|
315 |
/**
|
|
316 |
* Final thumbnail bitmap generation or loading is complete.
|
|
317 |
* @param aError Error code.
|
|
318 |
* @param aThumbnail An object representing the resulting thumbnail.
|
|
319 |
* @param aId Request ID for the operation.
|
|
320 |
*/
|
|
321 |
void ThumbnailReadyL( TInt aError, MThumbnailData& aThumbnail,
|
|
322 |
TThumbnailRequestId aId );
|
|
323 |
|
|
324 |
/**
|
|
325 |
* Create hg list icon from file
|
|
326 |
*
|
|
327 |
* @param aSkinId Skin-Id of the icon
|
|
328 |
* @param aFileName mif file name
|
|
329 |
* @param aBitmapId bitmap index in mif file (used if skin-Id is not found)
|
|
330 |
* @param aMaskId mask index in mif file (used if skin-Id is not found)
|
|
331 |
* @return Icon
|
|
332 |
*/
|
|
333 |
CGulIcon* CreateHgListIconL(
|
|
334 |
const TAknsItemID& aSkinId,
|
|
335 |
const TFileName& aFileName,
|
|
336 |
TInt aBitmapId,
|
|
337 |
TInt aMaskId );
|
|
338 |
|
|
339 |
/**
|
|
340 |
* Check, if the last watched cenrep key is set
|
|
341 |
*
|
|
342 |
* @return ETrue if the key has been set, otherwise EFalse
|
|
343 |
*/
|
|
344 |
TBool LastWatchedSetL();
|
|
345 |
|
|
346 |
/**
|
|
347 |
* Check, if the preloaded video exists
|
|
348 |
* If the key exists, but the file is missing, it is considered,
|
|
349 |
* as it does not exist.
|
|
350 |
*
|
|
351 |
* @return ETrue if the preloaded does exist, otherwise EFalse
|
|
352 |
*/
|
|
353 |
TBool PreloadedExistsL();
|
|
354 |
|
|
355 |
private:
|
|
356 |
|
|
357 |
/**
|
|
358 |
* Application model.
|
|
359 |
* Not own.
|
|
360 |
*/
|
|
361 |
CVcxHgMyVideosModel& iModel;
|
|
362 |
|
|
363 |
/**
|
|
364 |
* Reference to Hg list component.
|
|
365 |
* Not own.
|
|
366 |
*/
|
|
367 |
CHgScroller& iScroller;
|
|
368 |
|
|
369 |
/**
|
|
370 |
* Array of categories.
|
|
371 |
* Own.
|
|
372 |
*/
|
|
373 |
CMPXMediaArray* iCategoryList;
|
|
374 |
|
|
375 |
/**
|
|
376 |
* TArray containing category ID's. Each index
|
|
377 |
* corresponds to the scroller list (eg. correct
|
|
378 |
* category ID for the 1st item in scroller list can
|
|
379 |
* be found from index 0).
|
|
380 |
*/
|
|
381 |
RArray<TInt> iCategoryIdArray;
|
|
382 |
|
|
383 |
/**
|
|
384 |
* CVcxHgMyVideosThumbnailManager instance, not own.
|
|
385 |
*/
|
|
386 |
CVcxHgMyVideosThumbnailManager& iTnManager;
|
|
387 |
|
|
388 |
/**
|
|
389 |
* Request ID of ongoing thumbnail request, or KErrNotFound.
|
|
390 |
*/
|
|
391 |
TThumbnailRequestId iTnRequestId;
|
|
392 |
|
|
393 |
/**
|
|
394 |
* Video indicator class instance. Own.
|
|
395 |
*/
|
|
396 |
CMyVideosIndicator* iVideoIndicator;
|
|
397 |
};
|
|
398 |
|
|
399 |
#endif // VCXHGMYVIDEOSCATEGORYMODELHANDLER_H
|