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: Client class for My Videos MPX Collection.*
|
|
15 |
*/
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef VCXHGMYVIDEOSCOLLECTIONCLIENT_H
|
|
21 |
#define VCXHGMYVIDEOSCOLLECTIONCLIENT_H
|
|
22 |
|
|
23 |
// INCLUDE FILES
|
|
24 |
#include <coemain.h>
|
|
25 |
#include <mpxcollectionobserver.h>
|
|
26 |
|
|
27 |
// FORWARD DECLARATIONS
|
|
28 |
class MMPXCollectionUtility;
|
|
29 |
class MVcxHgMyVideosCategoryModelObserver;
|
|
30 |
class MVcxHgMyVideosVideoModelObserver;
|
|
31 |
class CVcxHgMyVideosDownloadClient;
|
|
32 |
|
|
33 |
// CLASS DECLARATION
|
|
34 |
|
|
35 |
/**
|
|
36 |
* Client class for My Videos MPX Collection.
|
|
37 |
*
|
|
38 |
* @lib vcxhgmyvideos.lib
|
|
39 |
*/
|
|
40 |
NONSHARABLE_CLASS( CVcxHgMyVideosCollectionClient ) : public CBase,
|
|
41 |
public MMPXCollectionObserver
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
|
|
45 |
enum TVcxHgMyVideosCollectionCommand
|
|
46 |
{
|
|
47 |
EVcxHgMyVideosCollectionCommandNone = 0,
|
|
48 |
EVcxHgMyVideosCollectionCommandMultiDelete_Starting,
|
|
49 |
EVcxHgMyVideosCollectionCommandMultiDelete_Started,
|
|
50 |
EVcxHgMyVideosCollectionCommandMultiDelete_Finished,
|
|
51 |
EVcxHgMyVideosCollectionCommandCancelDelete_Requested,
|
|
52 |
EVcxHgMyVideosCollectionCommandCancelDelete_Completed,
|
|
53 |
EVcxHgMyVideosCollectionCommandResort,
|
|
54 |
EVcxHgMyVideosCollectionCommandMoveCopy_Starting,
|
|
55 |
EVcxHgMyVideosCollectionCommandMoveCopy_Started,
|
|
56 |
EVcxHgMyVideosCollectionCommandMoveCopy_Finished,
|
|
57 |
EVcxHgMyVideosCollectionCommandCancelMoveCopy_Requested,
|
|
58 |
EVcxHgMyVideosCollectionCommandCancelMoveCopy_Completed,
|
|
59 |
EVcxHgMyVideosCollectionCommandVideoDetails_Requested
|
|
60 |
};
|
|
61 |
|
|
62 |
public: // Constructors and destructor
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Two-phased constructor.
|
|
66 |
*
|
|
67 |
* @return New object.
|
|
68 |
*/
|
|
69 |
static CVcxHgMyVideosCollectionClient* NewL();
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Two-phased constructor.
|
|
73 |
*
|
|
74 |
* @return New object.
|
|
75 |
*/
|
|
76 |
static CVcxHgMyVideosCollectionClient* NewLC();
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Destructor.
|
|
80 |
*/
|
|
81 |
virtual ~CVcxHgMyVideosCollectionClient();
|
|
82 |
|
|
83 |
public:
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Returns Download client.
|
|
87 |
*
|
|
88 |
* @return Reference to Download client.
|
|
89 |
*/
|
|
90 |
CVcxHgMyVideosDownloadClient& DownloadClient();
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Returns true if object has pending command for MPX Collection Utility.
|
|
94 |
*
|
|
95 |
* @return ETrue if command is pending.
|
|
96 |
*/
|
|
97 |
TBool HasPendingCommand();
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Called to set category data observer. Can be called with NULL to
|
|
101 |
* reset the observer.
|
|
102 |
*
|
|
103 |
* @param aCategoryModelObserver Observer.
|
|
104 |
*/
|
|
105 |
void SetCategoryModelObserver(
|
|
106 |
MVcxHgMyVideosCategoryModelObserver* aCategoryModelObserver );
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Called to set video data observer. Can be called with NULL to
|
|
110 |
* reset the observer.
|
|
111 |
*
|
|
112 |
* @param aVideoModelObserver Observer.
|
|
113 |
*/
|
|
114 |
void SetVideoModelObserver(
|
|
115 |
MVcxHgMyVideosVideoModelObserver* aVideoModelObserver );
|
|
116 |
|
|
117 |
/**
|
|
118 |
* When called, starts fetching category list. Category list is returned
|
|
119 |
* through callback interface MVcxHgMyVideosCategoryModelObserver.
|
|
120 |
*/
|
|
121 |
void GetCategoryListL();
|
|
122 |
|
|
123 |
/**
|
|
124 |
* When called, starts fetching video list. Video list is returned
|
|
125 |
* through callback interface MVcxHgMyVideosVideoModelObserver.
|
|
126 |
*
|
|
127 |
* @param aIndex Index of video list to fetch.
|
|
128 |
*/
|
|
129 |
void GetVideoListL( TInt aIndex );
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Translates array index to MPX item id by reading the value from array.
|
|
133 |
*
|
|
134 |
* @param aArrayIndex Index in array.
|
|
135 |
* @param aArray Array of MPX Media objects.
|
|
136 |
* @return MPX item id
|
|
137 |
*/
|
|
138 |
TMPXItemId ArrayIndexToMpxItemIdL( TInt aArrayIndex, CMPXMediaArray* aArray );
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Deletes an array of videos.
|
|
142 |
*
|
|
143 |
* @param aMediasToDelete Array of MPX Media objects to delete.
|
|
144 |
*/
|
|
145 |
void DeleteVideosL( CMPXMediaArray* aMediasToDelete );
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Cancels ongoing deletion of videos. See DeleteVideosL().
|
|
149 |
*/
|
|
150 |
void CancelDeleteVideosL();
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Moves or copies array of videos.
|
|
154 |
*
|
|
155 |
* @param mediasToMoveOrCopy Array of MPX Media objects to move/copy.
|
|
156 |
* @param aTargetDrive Target drive.
|
|
157 |
* @param aCopy ETrue of copy operation, EFalse if move.
|
|
158 |
*/
|
|
159 |
void MoveOrCopyVideosL( CMPXMediaArray* mediasToMoveOrCopy,
|
|
160 |
TInt aTargetDrive,
|
|
161 |
TBool aCopy );
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Cancels ongoing move/copy operation of videos. See MoveOrCopyVideosL().
|
|
165 |
*/
|
|
166 |
void CancelMoveOrCopyVideosL();
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Play a video with given MPX item id.
|
|
170 |
*
|
|
171 |
* @param aMpxItemId MPX item id
|
|
172 |
*/
|
|
173 |
void PlayVideoL( TMPXItemId aMpxItemId );
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Fetches MPX Media object based on MPX ID. Fetched MPX Media object
|
|
177 |
* is returned through callback interface MVcxHgMyVideosVideoModelObserver.
|
|
178 |
*
|
|
179 |
* @param aMpxId MPX ID.
|
|
180 |
*/
|
|
181 |
void FetchMpxMediaByMpxIdL( TMPXItemId& aMpxId );
|
|
182 |
|
|
183 |
/**
|
|
184 |
* Gets all details for the selected MPX Media object.
|
|
185 |
* Result will be returned in HandleCommandComplete().
|
|
186 |
*
|
|
187 |
* @param aMpxId MPX ID.
|
|
188 |
*/
|
|
189 |
void GetVideoDetailsL( TMPXItemId& aMpxId );
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Sets new general flags to given MPX Media object.
|
|
193 |
*
|
|
194 |
* @param aMpxItemId MpxId of media object for which flags are set.
|
|
195 |
* @param aFlags New flags to be set.
|
|
196 |
*/
|
|
197 |
void SetFlagsL( TMPXItemId aMpxItemId, TUint32 aFlags );
|
|
198 |
|
|
199 |
public: // From MMPXCollectionObserver
|
|
200 |
|
|
201 |
/**
|
|
202 |
* From MMPXCollectionObserver->MMPXCollectionMediaObserver
|
|
203 |
* Handle extended media properties
|
|
204 |
*
|
|
205 |
* @param aMedia media
|
|
206 |
* @param aError error code
|
|
207 |
*/
|
|
208 |
void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
|
|
209 |
|
|
210 |
/**
|
|
211 |
* From MMPXCollectionUtilityObserver.
|
|
212 |
* Handle collection message
|
|
213 |
* NOTE: only one of HandleCollectionMessage callback can be implemented
|
|
214 |
*
|
|
215 |
* @param aMessage collection message, ownership not transferred.
|
|
216 |
* Please check aMsg is not NULL before using it. If aErr is not
|
|
217 |
* KErrNone, plugin might still call back with more info in the aMsg.
|
|
218 |
* @param aErr system error code.
|
|
219 |
*/
|
|
220 |
void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
|
|
221 |
|
|
222 |
/**
|
|
223 |
* From MMPXCollectionUtilityObserver.
|
|
224 |
* Handles the collection entries being opened. Typically called
|
|
225 |
* when client has Open()'d a folder
|
|
226 |
*
|
|
227 |
* @param aEntries collection entries opened
|
|
228 |
* @param aIndex focused entry
|
|
229 |
* @param aComplete ETrue no more entries. EFalse more entries
|
|
230 |
* expected
|
|
231 |
* @param aError error code
|
|
232 |
*/
|
|
233 |
void HandleOpenL( const CMPXMedia& aEntries,
|
|
234 |
TInt aIndex,
|
|
235 |
TBool aComplete,
|
|
236 |
TInt aError );
|
|
237 |
|
|
238 |
/**
|
|
239 |
* From MMPXCollectionUtilityObserver.
|
|
240 |
* Handles the item being opened. Typically called
|
|
241 |
* when client has Open()'d an item. Client typically responds by
|
|
242 |
* 'playing' the item via the playlist
|
|
243 |
*
|
|
244 |
* @param aPlaylist collection playlist
|
|
245 |
* @param aError error code
|
|
246 |
*/
|
|
247 |
void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
|
|
248 |
|
|
249 |
/**
|
|
250 |
* From MMPXCollectionUtilityObserver.
|
|
251 |
* Handle completion of a asynchronous command
|
|
252 |
*
|
|
253 |
* @param aCommandResult result of the command, NULL if error
|
|
254 |
* @param aError error code
|
|
255 |
*/
|
|
256 |
void HandleCommandComplete( CMPXCommand* aCommandResult, TInt aError );
|
|
257 |
|
|
258 |
protected: // Constructors
|
|
259 |
|
|
260 |
/**
|
|
261 |
* Default C++ constructor.
|
|
262 |
*/
|
|
263 |
CVcxHgMyVideosCollectionClient();
|
|
264 |
|
|
265 |
/**
|
|
266 |
* Symbian 2nd phase constructor.
|
|
267 |
*/
|
|
268 |
void ConstructL();
|
|
269 |
|
|
270 |
/**
|
|
271 |
* Called by HandleCollectionMessage(). Handles collection messages.
|
|
272 |
*
|
|
273 |
* @param aMessage collection message.
|
|
274 |
* @param aError system error code.
|
|
275 |
*/
|
|
276 |
void HandleCollectionMessageL( CMPXMessage* aMessage, TInt aError );
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Called by HandleCollectionMessageL(). Handles single collection message.
|
|
280 |
*
|
|
281 |
* @param aMessage collection message.
|
|
282 |
* @param aError system error code.
|
|
283 |
*/
|
|
284 |
void HandleSingleCollectionMessageL( CMPXMessage* aMessage, TInt aError );
|
|
285 |
|
|
286 |
/**
|
|
287 |
* Returns the current level of collection.
|
|
288 |
*/
|
|
289 |
TInt CollectionLevelL();
|
|
290 |
|
|
291 |
/**
|
|
292 |
* Handles item addition message, called by HandleSingleCollectionMessageL().
|
|
293 |
*
|
|
294 |
* @param aMessage collection message.
|
|
295 |
* @param aError system error code.
|
|
296 |
*/
|
|
297 |
void HandleMyVideosItemsAppendedL( CMPXMessage* aMessage, TInt aError );
|
|
298 |
|
|
299 |
/**
|
|
300 |
* Handles item changed message, called by HandleSingleCollectionMessageL().
|
|
301 |
*
|
|
302 |
* @param aMessage collection message.
|
|
303 |
* @param aError system error code.
|
|
304 |
*/
|
|
305 |
void HandleMyVideosItemsChangedL( CMPXMessage* aMessage, TInt aError );
|
|
306 |
|
|
307 |
/**
|
|
308 |
* Handles delete related messages, called by HandleSingleCollectionMessageL().
|
|
309 |
*
|
|
310 |
* @param aMessage collection message.
|
|
311 |
* @param aError system error code.
|
|
312 |
*/
|
|
313 |
void HandleMyVideosDeleteMessageL( CMPXMessage* aMessage, TInt aError );
|
|
314 |
|
|
315 |
/**
|
|
316 |
* Handles move or copy related messages, called by HandleSingleCollectionMessageL().
|
|
317 |
*
|
|
318 |
* @param aMessage collection message.
|
|
319 |
* @param aError system error code.
|
|
320 |
*/
|
|
321 |
void HandleMyVideosMoveOrCopyMessageL( CMPXMessage* aMessage, TInt aError );
|
|
322 |
|
|
323 |
/**
|
|
324 |
* Handles response message when MPX Media object requested.
|
|
325 |
*
|
|
326 |
* @param aMessage collection message.
|
|
327 |
* @param aError system error code.
|
|
328 |
*/
|
|
329 |
void HandleGetMediasByMpxIdRespL( CMPXMessage* aMessage, TInt aError );
|
|
330 |
|
|
331 |
/**
|
|
332 |
* Handles list complete message, called by HandleSingleCollectionMessageL().
|
|
333 |
*
|
|
334 |
* @param aMessage collection message.
|
|
335 |
* @param aError system error code.
|
|
336 |
*/
|
|
337 |
void HandleMyVideosListCompleteL( CMPXMessage* aMessage, TInt aError );
|
|
338 |
|
|
339 |
/**
|
|
340 |
* Handles response message when video details requested.
|
|
341 |
*
|
|
342 |
* @param aMessage collection message.
|
|
343 |
* @param aError system error code.
|
|
344 |
*/
|
|
345 |
void HandleGetVideoDetailsRespL( CMPXMessage* aMessage, TInt aError );
|
|
346 |
|
|
347 |
protected:
|
|
348 |
|
|
349 |
enum TVcxHgCollectionOpenStatus
|
|
350 |
{
|
|
351 |
EVcxHgCollectionNotOpen = 0,
|
|
352 |
EVcxHgCollectionOpening,
|
|
353 |
EVcxHgCollectionOpened
|
|
354 |
};
|
|
355 |
|
|
356 |
protected:
|
|
357 |
|
|
358 |
/**
|
|
359 |
* Pointer to MPX Collection utility.
|
|
360 |
* Own.
|
|
361 |
*/
|
|
362 |
MMPXCollectionUtility* iCollectionUtility;
|
|
363 |
|
|
364 |
/**
|
|
365 |
* Pointer to Download client.
|
|
366 |
* Own.
|
|
367 |
*/
|
|
368 |
CVcxHgMyVideosDownloadClient* iDownloadClient;
|
|
369 |
|
|
370 |
/**
|
|
371 |
* Pointer to observer of category model.
|
|
372 |
* Not own.
|
|
373 |
*/
|
|
374 |
MVcxHgMyVideosCategoryModelObserver* iCategoryModelObserver;
|
|
375 |
|
|
376 |
/**
|
|
377 |
* Pointer to observer of video model.
|
|
378 |
* Not own.
|
|
379 |
*/
|
|
380 |
MVcxHgMyVideosVideoModelObserver* iVideoModelObserver;
|
|
381 |
|
|
382 |
/**
|
|
383 |
* Variable for storing My Videos collection opening status.
|
|
384 |
*/
|
|
385 |
TVcxHgCollectionOpenStatus iCollectionOpenStatus;
|
|
386 |
|
|
387 |
/**
|
|
388 |
* Variable for storing pending collection command.
|
|
389 |
*/
|
|
390 |
TVcxHgMyVideosCollectionCommand iPendingCommand;
|
|
391 |
|
|
392 |
/**
|
|
393 |
* Variable for storing current collection level.
|
|
394 |
*/
|
|
395 |
TInt iCollectionLevel;
|
|
396 |
|
|
397 |
#if defined(_DEBUG) && IPTV_LOGGING_METHOD != 0
|
|
398 |
private:
|
|
399 |
/**
|
|
400 |
* Debug only: Prints list of videos to debug output.
|
|
401 |
*/
|
|
402 |
void DebugPrintVideoListL( CMPXMediaArray* aVideoArray );
|
|
403 |
#endif // _DEBUG && IPTV_LOGGING_METHOD
|
|
404 |
|
|
405 |
};
|
|
406 |
|
|
407 |
#endif // VCXHGMYVIDEOSCOLLECTIONCLIENT_H
|