9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Implementation of My Videos MPX Collection Plugin interface* |
14 * Description: Implementation of My Videos MPX Collection Plugin interface* |
15 */ |
15 */ |
16 |
|
17 |
16 |
18 |
17 |
19 |
18 |
20 #ifndef VCXMYVIDEOSCOLLECTIONPLUGIN_H |
19 #ifndef VCXMYVIDEOSCOLLECTIONPLUGIN_H |
21 #define VCXMYVIDEOSCOLLECTIONPLUGIN_H |
20 #define VCXMYVIDEOSCOLLECTIONPLUGIN_H |
28 #include <vcxmyvideosdefs.h> |
27 #include <vcxmyvideosdefs.h> |
29 |
28 |
30 #include "vcxmyvideosactivetask.h" |
29 #include "vcxmyvideosactivetask.h" |
31 |
30 |
32 #include "vcxmyvideosmdsdb.h" |
31 #include "vcxmyvideosmdsdb.h" |
33 #include "vcxmyvideosdownloadutil.h" |
|
34 |
32 |
35 // FORWARD DECLARATIONS |
33 // FORWARD DECLARATIONS |
36 class CVcxMyVideosMdsDb; |
34 class CVcxMyVideosMdsDb; |
37 class CMPXResource; |
35 class CMPXResource; |
38 class CMPXMediaArray; |
36 class CMPXMediaArray; |
39 class CVcxMyVideosDownloadUtil; |
|
40 class CVcxMyVideosVideoCache; |
37 class CVcxMyVideosVideoCache; |
41 class CVcxMyVideosCategories; |
38 class CVcxMyVideosCategories; |
42 class CVcxMyVideosMessageList; |
39 class CVcxMyVideosMessageList; |
43 class CVcxMyVideosAsyncFileOperations; |
40 class CVcxMyVideosAsyncFileOperations; |
44 class CVcxMyVideosOpenHandler; |
41 class CVcxMyVideosOpenHandler; |
|
42 class CVcxMyVideosAlbums; |
45 |
43 |
46 // CONSTANTS |
44 // CONSTANTS |
47 |
45 |
48 // CLASS DECLARATION |
46 // CLASS DECLARATION |
49 |
47 |
53 * @lib mpxmyvideoscollectionplugin.lib |
51 * @lib mpxmyvideoscollectionplugin.lib |
54 */ |
52 */ |
55 NONSHARABLE_CLASS(CVcxMyVideosCollectionPlugin) : |
53 NONSHARABLE_CLASS(CVcxMyVideosCollectionPlugin) : |
56 public CMPXCollectionPlugin, |
54 public CMPXCollectionPlugin, |
57 public MVcxMyVideosMdsDbObserver, |
55 public MVcxMyVideosMdsDbObserver, |
58 public MVcxMyVideosActiveTaskObserver, |
56 public MVcxMyVideosActiveTaskObserver |
59 public MVcxMyVideosDownloadUtilObserver |
|
60 { |
57 { |
61 public: // Constructors and destructor |
58 public: // Constructors and destructor |
62 |
59 |
63 friend class CVcxMyVideosOpenHandler; |
60 friend class CVcxMyVideosOpenHandler; |
64 friend class CVcxMyVideosVideoCache; |
61 friend class CVcxMyVideosVideoCache; |
|
62 friend class CVcxMyVideosAlbums; |
65 |
63 |
66 /** |
64 /** |
67 * Two-phased constructor |
65 * Two-phased constructor |
68 * @param aInitParams: initialization parameters |
66 * @param aInitParams: initialization parameters |
69 * @return object constructed |
67 * @return object constructed |
224 |
222 |
225 /** |
223 /** |
226 * From MVcxMyVideosMdsDbObserver. Called when media is removed or inserted. |
224 * From MVcxMyVideosMdsDbObserver. Called when media is removed or inserted. |
227 */ |
225 */ |
228 void HandleObjectPresentNotification(); |
226 void HandleObjectPresentNotification(); |
229 |
227 |
230 /** |
228 /** |
231 * Leaving version of HandleObjectPresentNotification. |
229 * Leaving version of HandleObjectPresentNotification. |
232 */ |
230 */ |
233 void DoHandleObjectPresentNotificationL(); |
231 void DoHandleObjectPresentNotificationL(); |
234 |
232 |
235 /** |
|
236 * From CVcxMyVideosDownloadUtilObserver. |
|
237 */ |
|
238 void HandleDlEvent( TVcxMyVideosDownloadState aState, |
|
239 TUint32 aDownloadId, TInt aProgress, TInt64 aDownloaded, |
|
240 TInt32 aError, TInt32 aGlobalError ); |
|
241 |
|
242 /** |
|
243 * Leaving version of HandleDlEvent. |
|
244 */ |
|
245 void DoHandleDlEventL( TVcxMyVideosDownloadState aState, |
|
246 TUint32 aDownloadId, TInt aProgress, TInt64 aDownloaded, |
|
247 TInt32 aError, TInt32 aGlobalError ); |
|
248 |
|
249 private: |
233 private: |
250 /** |
234 /** |
251 * Constructor |
235 * Constructor |
252 */ |
236 */ |
253 CVcxMyVideosCollectionPlugin(); |
237 CVcxMyVideosCollectionPlugin(); |
254 |
238 |
255 /** |
239 /** |
256 * Symbian 2nd phase constructor. |
240 * Symbian 2nd phase constructor. |
257 */ |
241 */ |
258 void ConstructL (); |
242 void ConstructL (); |
259 |
|
260 /** |
|
261 * Synchronizes set of videos in cache with Download Manager. |
|
262 * Download related attributes are set in cache if corresponding |
|
263 * download is found. |
|
264 * |
|
265 * @param aItemsInCache Array of MDS IDs. |
|
266 */ |
|
267 void SyncWithDownloadsL( RArray<TUint32>& aItemsInCache ); |
|
268 |
|
269 /** |
|
270 * Synchronizes video with Download Manager. |
|
271 * |
|
272 * @aVideo Video to synchronize. |
|
273 * @aEventAdded Set to ETrue if event was added to iMessageList, does not change the |
|
274 * value otherwise. |
|
275 */ |
|
276 void SyncVideoWithDownloadsL( CMPXMedia& aVideo, TBool& aEventAdded, |
|
277 TBool aAddEvent = ETrue ); |
|
278 |
|
279 /** |
|
280 * Copies download attributes from aDownload to aVideo. |
|
281 * |
|
282 * @param aVideo Video in cache. |
|
283 * @param aDownload Corresponding download in Download Manager. |
|
284 * @param aSendMpxEvent ETrue if MPX item has been modified and caller should |
|
285 * send the modification event. |
|
286 */ |
|
287 void SyncVideoAndDownloadL( |
|
288 CMPXMedia& aVideo, |
|
289 RHttpDownload& aDownload, |
|
290 TBool& aSendMpxEvent ); |
|
291 |
243 |
292 /** |
244 /** |
293 * Copies KVcxMediaMyVideosTransactionId field from aRequest to aResp. |
245 * Copies KVcxMediaMyVideosTransactionId field from aRequest to aResp. |
294 */ |
246 */ |
295 void SetTransactionIdL( CMPXMedia& aRequest, CMPXMedia& aResp ); |
247 void SetTransactionIdL( CMPXMedia& aRequest, CMPXMedia& aResp ); |
316 * Called by iCache when it notices that current video list fetching has to |
268 * Called by iCache when it notices that current video list fetching has to |
317 * be done again from the scratch. This is called only when there is video list |
269 * be done again from the scratch. This is called only when there is video list |
318 * fetching ongoing. |
270 * fetching ongoing. |
319 */ |
271 */ |
320 void RestartVideoListFetchingL(); |
272 void RestartVideoListFetchingL(); |
321 |
273 |
322 |
|
323 /** |
|
324 * Sets download ID to 0 and download state to none. Updates MDS and sends |
|
325 * modified event. |
|
326 * |
|
327 * @param aDownloadId Download ID of the MPX item. |
|
328 */ |
|
329 void SetDownloadIdToZeroL( TUint aDownloadId ); |
|
330 |
|
331 |
|
332 #ifdef _DEBUG |
|
333 /** |
|
334 * Returns download state as a descriptor. |
|
335 */ |
|
336 const TDesC& DownloadState( TUint8 aDlState ); |
|
337 #endif |
|
338 |
|
339 public: |
274 public: |
340 |
275 |
341 /** |
276 /** |
342 * Adds video to MDS and cache. |
277 * Adds video to MDS and cache. |
343 * |
278 * |
361 * Ownership does not move. |
296 * Ownership does not move. |
362 */ |
297 */ |
363 void SendMyVideosMessageL( TUint32 aMessageId, CMPXCommand* aCommand = NULL ); |
298 void SendMyVideosMessageL( TUint32 aMessageId, CMPXCommand* aCommand = NULL ); |
364 |
299 |
365 /** |
300 /** |
366 * Synchronizes video list with Download Manager. |
|
367 * |
|
368 * @param aVideoList Video list to synchronize. |
|
369 * @param aStartPos Items before aStartPos index are left out from synchronizing. |
|
370 * @param aSendEvents If ETrue and modifications are done to the list, then |
|
371 * MPX events are sent. |
|
372 */ |
|
373 void SyncVideoListWithDownloadsL( CMPXMedia& aVideoList, |
|
374 TBool aSendEvents, TInt aStartPos = 0 ); |
|
375 |
|
376 /** |
|
377 * Returns reference to iDownloadUtil. If iDownloadUtil is NULL then |
|
378 * it is created. |
|
379 */ |
|
380 CVcxMyVideosDownloadUtil& DownloadUtilL(); |
|
381 |
|
382 /** |
|
383 * Sends messages to clients. If udeb version, adds messageid |
301 * Sends messages to clients. If udeb version, adds messageid |
384 * parameter to the message for debugging purposes. May or may not |
302 * parameter to the message for debugging purposes. May or may not |
385 * contain media list as parameter. |
303 * contain media list as parameter. |
386 * |
304 * |
387 * @param aMessages Messages to send. |
305 * @param aMessages Messages to send. |
392 * Creates iCategories if its not created yet and returns reference to it. |
310 * Creates iCategories if its not created yet and returns reference to it. |
393 * |
311 * |
394 * @return Reference to iCategories member. |
312 * @return Reference to iCategories member. |
395 */ |
313 */ |
396 CVcxMyVideosCategories& CategoriesL(); |
314 CVcxMyVideosCategories& CategoriesL(); |
397 |
315 |
398 /** |
316 /** |
399 * Notifies to mediator listeners that a download has completed. |
317 * Creates iAlbums if its not created yet and returns reference to it. |
400 * |
318 * |
401 * @param aVideo Downloaded video. |
319 * @return Reference to iAlbums member. |
402 */ |
320 */ |
403 void NotifyDownloadCompletedL( CMPXMedia& aVideo ); |
321 CVcxMyVideosAlbums& AlbumsL(); |
404 |
322 |
405 /** |
323 /** |
406 * Notifies to mediator listeners that count of new videos has decreased. |
324 * Notifies to mediator listeners that count of new videos has decreased. |
407 * |
325 * |
408 * @param aVideo Removed or watched video. |
326 * @param aVideo Removed or watched video. |
433 |
351 |
434 /** |
352 /** |
435 * Executes command in several small steps. |
353 * Executes command in several small steps. |
436 */ |
354 */ |
437 CVcxMyVideosActiveTask* iActiveTask; |
355 CVcxMyVideosActiveTask* iActiveTask; |
438 |
356 |
439 private: |
357 private: |
440 |
358 |
441 /** |
359 /** |
442 * Contains category list, accessed through CategoriesL() function. |
360 * Contains category list, accessed through CategoriesL() function. |
443 * Own. |
361 * Own. |
444 */ |
362 */ |
445 CVcxMyVideosCategories* iCategories; |
363 CVcxMyVideosCategories* iCategories; |
446 |
364 |
447 /** |
365 /** |
448 * Download util, own. |
366 * Albums related functionality (except mds db operations). Own. |
449 */ |
367 */ |
450 CVcxMyVideosDownloadUtil* iDownloadUtil; |
368 CVcxMyVideosAlbums* iAlbums; |
451 |
369 |
452 /** |
370 /** |
453 * Target drive for Move operation. |
371 * Target drive for Move operation. |
454 */ |
372 */ |
455 TInt iTargetDrive; |
373 TInt iTargetDrive; |
456 |
374 |