videocollection/videocollectionwrapper/inc/videocollectionclient.h
author hgs
Fri, 14 May 2010 15:14:51 +0300
changeset 38 ff53afa8ad05
parent 36 8aed59de29f9
child 50 21fe8338c6bf
permissions -rw-r--r--
201019
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:   VideoCollectionClient class definition*
hgs
parents:
diff changeset
    15
*/
hgs
parents:
diff changeset
    16
hgs
parents:
diff changeset
    17
#ifndef __VIDEOCOLLECTIONCLIENT_H
hgs
parents:
diff changeset
    18
#define __VIDEOCOLLECTIONCLIENT_H
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
#include <vcxmyvideosdefs.h>
hgs
parents:
diff changeset
    21
#include <QList>
34
hgs
parents: 30
diff changeset
    22
#include "videocollectioncommon.h"
36
hgs
parents: 35
diff changeset
    23
30
hgs
parents:
diff changeset
    24
// FORWARD DECLARATIONS
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
class MMPXCollectionUtility;
hgs
parents:
diff changeset
    27
class VideoDataSignalReceiver;
hgs
parents:
diff changeset
    28
class VideoCollectionListener;
hgs
parents:
diff changeset
    29
hgs
parents:
diff changeset
    30
// CLASS DECLARATION
hgs
parents:
diff changeset
    31
hgs
parents:
diff changeset
    32
/**
hgs
parents:
diff changeset
    33
 * Client class for My Videos MPX Collection.
hgs
parents:
diff changeset
    34
 *
hgs
parents:
diff changeset
    35
 * @lib videocollectionwrapper.dll
hgs
parents:
diff changeset
    36
 */
hgs
parents:
diff changeset
    37
class VideoCollectionClient 
hgs
parents:
diff changeset
    38
{
36
hgs
parents: 35
diff changeset
    39
30
hgs
parents:
diff changeset
    40
public: 
hgs
parents:
diff changeset
    41
    
hgs
parents:
diff changeset
    42
    /**
hgs
parents:
diff changeset
    43
     * Constructor
hgs
parents:
diff changeset
    44
     */
hgs
parents:
diff changeset
    45
    VideoCollectionClient();
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
    /**
hgs
parents:
diff changeset
    48
     * Destructor.
hgs
parents:
diff changeset
    49
     */
hgs
parents:
diff changeset
    50
    virtual ~VideoCollectionClient();
hgs
parents:
diff changeset
    51
    
hgs
parents:
diff changeset
    52
    /**
hgs
parents:
diff changeset
    53
     * Initializes object and allocates members
hgs
parents:
diff changeset
    54
     * 
34
hgs
parents: 30
diff changeset
    55
     * @param signal receiver
hgs
parents: 30
diff changeset
    56
     * 
30
hgs
parents:
diff changeset
    57
     * @return 0 if ok, < 0 in case of error
hgs
parents:
diff changeset
    58
     */
34
hgs
parents: 30
diff changeset
    59
    int initialize(VideoDataSignalReceiver *signalReceiver);
30
hgs
parents:
diff changeset
    60
hgs
parents:
diff changeset
    61
public:
hgs
parents:
diff changeset
    62
        
hgs
parents:
diff changeset
    63
    /**
hgs
parents:
diff changeset
    64
     * Collection opening status
hgs
parents:
diff changeset
    65
     */
hgs
parents:
diff changeset
    66
    enum TCollectionOpenStatus
hgs
parents:
diff changeset
    67
    {        
hgs
parents:
diff changeset
    68
        ECollectionNotOpen = 0,
hgs
parents:
diff changeset
    69
        ECollectionOpening,
hgs
parents:
diff changeset
    70
        ECollectionOpened            
hgs
parents:
diff changeset
    71
    };  
hgs
parents:
diff changeset
    72
hgs
parents:
diff changeset
    73
    /**
hgs
parents:
diff changeset
    74
     * Connects videodata signals to provided object
hgs
parents:
diff changeset
    75
     * If method fails, client should deallocate it's 
hgs
parents:
diff changeset
    76
     * VideoDataSignalReceiver object to make sure thee are
hgs
parents:
diff changeset
    77
     * no unused signal connections.
hgs
parents:
diff changeset
    78
     * 
hgs
parents:
diff changeset
    79
     * @param aVideoModelObserver Observer.
hgs
parents:
diff changeset
    80
     * 
hgs
parents:
diff changeset
    81
     * @return int -1 in case of failure
hgs
parents:
diff changeset
    82
     */
hgs
parents:
diff changeset
    83
    int connectCollectionSignalReceiver(
hgs
parents:
diff changeset
    84
            VideoDataSignalReceiver *signalReceiver);
hgs
parents:
diff changeset
    85
    
hgs
parents:
diff changeset
    86
    /**
hgs
parents:
diff changeset
    87
     * Returns the current level of collection.
hgs
parents:
diff changeset
    88
     * 
hgs
parents:
diff changeset
    89
     * @return some type of TCollectionLevels or -1 in case of error
hgs
parents:
diff changeset
    90
     */
hgs
parents:
diff changeset
    91
    int getCollectionLevel();
hgs
parents:
diff changeset
    92
    
hgs
parents:
diff changeset
    93
    /**
34
hgs
parents: 30
diff changeset
    94
     * Returns the current category requested to open
30
hgs
parents:
diff changeset
    95
     * 
hgs
parents:
diff changeset
    96
     */
34
hgs
parents: 30
diff changeset
    97
    void getCategoryId(TMPXItemId &id);
30
hgs
parents:
diff changeset
    98
hgs
parents:
diff changeset
    99
    /**
hgs
parents:
diff changeset
   100
     * Returns reference to collection open status. Client can use
hgs
parents:
diff changeset
   101
     * this to get and change the status
hgs
parents:
diff changeset
   102
     * 
hgs
parents:
diff changeset
   103
     * @return some type of TCollectionLevels or -1 in case of error
hgs
parents:
diff changeset
   104
     */
hgs
parents:
diff changeset
   105
    int getOpenStatus();
hgs
parents:
diff changeset
   106
    
hgs
parents:
diff changeset
   107
    /**
hgs
parents:
diff changeset
   108
     * Sets open status, if given status is ECollectionOpened calls 
hgs
parents:
diff changeset
   109
     * startOpenCurrentState to start collection into current state. 
hgs
parents:
diff changeset
   110
     * 
hgs
parents:
diff changeset
   111
     */
36
hgs
parents: 35
diff changeset
   112
    void setOpenStatus(int status,  bool startOpening = true);
30
hgs
parents:
diff changeset
   113
        
hgs
parents:
diff changeset
   114
    /**
hgs
parents:
diff changeset
   115
     * Starts opening of collection to the all videos category
hgs
parents:
diff changeset
   116
     * 
hgs
parents:
diff changeset
   117
     * @return 0 startup ok
hgs
parents:
diff changeset
   118
     */
hgs
parents:
diff changeset
   119
    int startOpenCollection(int level);     
hgs
parents:
diff changeset
   120
    
hgs
parents:
diff changeset
   121
    /**
hgs
parents:
diff changeset
   122
     * Calls open to collection to get current
hgs
parents:
diff changeset
   123
     * state to be opened. 
hgs
parents:
diff changeset
   124
     * 
hgs
parents:
diff changeset
   125
     * @return 0 startup ok
hgs
parents:
diff changeset
   126
     */
hgs
parents:
diff changeset
   127
    int startOpenCurrentState();
hgs
parents:
diff changeset
   128
    
hgs
parents:
diff changeset
   129
    /** 
hgs
parents:
diff changeset
   130
     * calls collection to deleteFile(s) mpx media object defined by the given ids
hgs
parents:
diff changeset
   131
     *
hgs
parents:
diff changeset
   132
     * @param mediaIds pointerr to the list of items to be removed
hgs
parents:
diff changeset
   133
     * @return 0 if ok
hgs
parents:
diff changeset
   134
     */
hgs
parents:
diff changeset
   135
    int deleteVideos(QList<TMPXItemId> *mediaIds);
hgs
parents:
diff changeset
   136
    
hgs
parents:
diff changeset
   137
    /**
34
hgs
parents: 30
diff changeset
   138
     * Calls collection to open item defined by the given id.
30
hgs
parents:
diff changeset
   139
     * 
hgs
parents:
diff changeset
   140
     * @param aMediaId id of the item
hgs
parents:
diff changeset
   141
     * @return KErrNone if ok  
hgs
parents:
diff changeset
   142
     */
34
hgs
parents: 30
diff changeset
   143
    int openItem(TMPXItemId &mediaId);
30
hgs
parents:
diff changeset
   144
hgs
parents:
diff changeset
   145
    /**
hgs
parents:
diff changeset
   146
     * calls collection to go back to collection level
hgs
parents:
diff changeset
   147
     * 
hgs
parents:
diff changeset
   148
     */
hgs
parents:
diff changeset
   149
    int back();
hgs
parents:
diff changeset
   150
hgs
parents:
diff changeset
   151
    /**
hgs
parents:
diff changeset
   152
     * Fetches MPX Media object based on MPX ID. Object can be requested later
hgs
parents:
diff changeset
   153
     * with method GetLatestFetchedMpxMediaL(). Note, there is no indication
hgs
parents:
diff changeset
   154
     * when the object becomes available.
hgs
parents:
diff changeset
   155
     * 
hgs
parents:
diff changeset
   156
     * @param aMpxId MPX ID.
hgs
parents:
diff changeset
   157
     * 
hgs
parents:
diff changeset
   158
     * @return 0 media fetchingstarted ok 
hgs
parents:
diff changeset
   159
     */
hgs
parents:
diff changeset
   160
    int fetchMpxMediaByMpxId(TMPXItemId &aMpxId);    
hgs
parents:
diff changeset
   161
    
hgs
parents:
diff changeset
   162
    /**
hgs
parents:
diff changeset
   163
     * Gets all details for the selected MPX Media object.
hgs
parents:
diff changeset
   164
     * Result will be returned in CVideoCollectionListener::HandleCollectionMediaL().
hgs
parents:
diff changeset
   165
     * 
hgs
parents:
diff changeset
   166
     * @param aMediaId meida id of the item (TMPXItemId.iId1) 
hgs
parents:
diff changeset
   167
     * 
hgs
parents:
diff changeset
   168
     * @return 0 if detail fetching started ok
hgs
parents:
diff changeset
   169
     */
hgs
parents:
diff changeset
   170
    int getVideoDetails(TMPXItemId& aMediaId);
hgs
parents:
diff changeset
   171
    
hgs
parents:
diff changeset
   172
    /**
34
hgs
parents: 30
diff changeset
   173
     * Add a new album.
hgs
parents: 30
diff changeset
   174
     * 
hgs
parents: 30
diff changeset
   175
     * @param title, Album title.
hgs
parents: 30
diff changeset
   176
     * @return TMPXItemId id of created album TMPXItemId:::InvalidId() in case of failure
hgs
parents: 30
diff changeset
   177
     */
hgs
parents: 30
diff changeset
   178
    TMPXItemId addNewAlbum(const QString &title);
hgs
parents: 30
diff changeset
   179
hgs
parents: 30
diff changeset
   180
    /**
hgs
parents: 30
diff changeset
   181
     * Add a new album.
30
hgs
parents:
diff changeset
   182
     * 
34
hgs
parents: 30
diff changeset
   183
     * @param mediaIds, list of album id's to be removed.
hgs
parents: 30
diff changeset
   184
     * @return 0 if no errors.
30
hgs
parents:
diff changeset
   185
     */
34
hgs
parents: 30
diff changeset
   186
    int removeAlbums(const QList<TMPXItemId> &mediaIds);
hgs
parents: 30
diff changeset
   187
hgs
parents: 30
diff changeset
   188
    /**
hgs
parents: 30
diff changeset
   189
     * Add items in existing album.
hgs
parents: 30
diff changeset
   190
     * 
hgs
parents: 30
diff changeset
   191
     * @param albumId, Album where to add items.
hgs
parents: 30
diff changeset
   192
     * @param mediaIds, Items which to add.
hgs
parents: 30
diff changeset
   193
     * @return 0 if no errors.
hgs
parents: 30
diff changeset
   194
     */
35
hgs
parents: 34
diff changeset
   195
    int addItemsInAlbum(TMPXItemId &albumId, const QList<TMPXItemId> &mediaIds);
hgs
parents: 34
diff changeset
   196
    
hgs
parents: 34
diff changeset
   197
    /**
hgs
parents: 34
diff changeset
   198
     * Removes items from existing album.
hgs
parents: 34
diff changeset
   199
     * 
hgs
parents: 34
diff changeset
   200
     * @param albumId, Album from where to remove items.
hgs
parents: 34
diff changeset
   201
     * @param mediaIds, Items which to remove.
hgs
parents: 34
diff changeset
   202
     * @return 0 if no errors.
hgs
parents: 34
diff changeset
   203
     */
hgs
parents: 34
diff changeset
   204
    int removeItemsFromAlbum(TMPXItemId &albumId, const QList<TMPXItemId> &mediaIds);
36
hgs
parents: 35
diff changeset
   205
    
hgs
parents: 35
diff changeset
   206
    /**
hgs
parents: 35
diff changeset
   207
     * Renames an album.
hgs
parents: 35
diff changeset
   208
     * 
hgs
parents: 35
diff changeset
   209
     * @param albumId, Album to be renamed.
hgs
parents: 35
diff changeset
   210
     * @param newTitle, New title for the album.
hgs
parents: 35
diff changeset
   211
     * @return 0 if no errors.
hgs
parents: 35
diff changeset
   212
     */
hgs
parents: 35
diff changeset
   213
    int renameAlbum(const TMPXItemId &albumId, const QString &newTitle);
30
hgs
parents:
diff changeset
   214
hgs
parents:
diff changeset
   215
private:
hgs
parents:
diff changeset
   216
    
hgs
parents:
diff changeset
   217
    /**
hgs
parents:
diff changeset
   218
     * Private implementation to handle leaving code of collection opening.
hgs
parents:
diff changeset
   219
     * 
hgs
parents:
diff changeset
   220
     */
hgs
parents:
diff changeset
   221
    void startOpenCollectionL(int level);
hgs
parents:
diff changeset
   222
    
hgs
parents:
diff changeset
   223
    /**
hgs
parents:
diff changeset
   224
     * Private implementation to handle leaving code of video deletion.
hgs
parents:
diff changeset
   225
     * 
hgs
parents:
diff changeset
   226
     * @param mediaIds list of ides to remove
hgs
parents:
diff changeset
   227
     */
hgs
parents:
diff changeset
   228
    void deleteVideosL(QList<TMPXItemId> &mediaIds);
hgs
parents:
diff changeset
   229
    
hgs
parents:
diff changeset
   230
    /**
hgs
parents:
diff changeset
   231
     * Private implementation to handle leaving code of video opening.
hgs
parents:
diff changeset
   232
     * 
hgs
parents:
diff changeset
   233
     * @param videoId id of the video to open
hgs
parents:
diff changeset
   234
     */
hgs
parents:
diff changeset
   235
    void openVideoL(TMPXItemId &videoId);
hgs
parents:
diff changeset
   236
hgs
parents:
diff changeset
   237
    /**
hgs
parents:
diff changeset
   238
     * Private implementation to handle leaving code of collection opening.
hgs
parents:
diff changeset
   239
     * 
hgs
parents:
diff changeset
   240
     * @param id id of the collection to open
hgs
parents:
diff changeset
   241
     */
hgs
parents:
diff changeset
   242
    void openCategoryL(TMPXItemId &id);
hgs
parents:
diff changeset
   243
hgs
parents:
diff changeset
   244
    /**
hgs
parents:
diff changeset
   245
     * Private implementation to handle leaving code of collection back stepping.
hgs
parents:
diff changeset
   246
     * 
hgs
parents:
diff changeset
   247
     */
hgs
parents:
diff changeset
   248
    void backL();
hgs
parents:
diff changeset
   249
hgs
parents:
diff changeset
   250
    /**
hgs
parents:
diff changeset
   251
     * Private implementation to handle leaving code while starting to get video 
hgs
parents:
diff changeset
   252
     * details
hgs
parents:
diff changeset
   253
     * 
hgs
parents:
diff changeset
   254
     * @param videoId id of the video to get details from 
hgs
parents:
diff changeset
   255
     */
hgs
parents:
diff changeset
   256
    void getVideoDetailsL(TMPXItemId &videoId);
34
hgs
parents: 30
diff changeset
   257
        
30
hgs
parents:
diff changeset
   258
    /**
34
hgs
parents: 30
diff changeset
   259
     * Removes user created albums.
30
hgs
parents:
diff changeset
   260
     * 
34
hgs
parents: 30
diff changeset
   261
     * @param mediaIds, list of album id's to be removed
30
hgs
parents:
diff changeset
   262
     */
34
hgs
parents: 30
diff changeset
   263
    void removeAlbumsL(const QList<TMPXItemId> &mediaIds);
hgs
parents: 30
diff changeset
   264
30
hgs
parents:
diff changeset
   265
    /**
hgs
parents:
diff changeset
   266
     * Private implementation to handle leaving code while starting to fetch video 
hgs
parents:
diff changeset
   267
     * object from collection
hgs
parents:
diff changeset
   268
     * 
hgs
parents:
diff changeset
   269
     * @param mpxId mpxif for the video object to fetch from collection
hgs
parents:
diff changeset
   270
     */
hgs
parents:
diff changeset
   271
    void fetchMpxMediaByMpxIdL(TMPXItemId &mpxId);    
hgs
parents:
diff changeset
   272
    
34
hgs
parents: 30
diff changeset
   273
    /**
hgs
parents: 30
diff changeset
   274
     * Create a new album.
hgs
parents: 30
diff changeset
   275
     * 
hgs
parents: 30
diff changeset
   276
     * @param title, Album title.
hgs
parents: 30
diff changeset
   277
     * @return album id.
hgs
parents: 30
diff changeset
   278
     */
hgs
parents: 30
diff changeset
   279
    TMPXItemId createAlbumL(const QString &title);
hgs
parents: 30
diff changeset
   280
    
hgs
parents: 30
diff changeset
   281
    /**
hgs
parents: 30
diff changeset
   282
     * Add items in an album.
hgs
parents: 30
diff changeset
   283
     * 
hgs
parents: 30
diff changeset
   284
     * @param albumId, Album where to add items.
hgs
parents: 30
diff changeset
   285
     * @param mediaIds, Items to add in the album.
hgs
parents: 30
diff changeset
   286
     * @return None.
hgs
parents: 30
diff changeset
   287
     */
35
hgs
parents: 34
diff changeset
   288
    void addItemsInAlbumL(TMPXItemId &albumId, const QList<TMPXItemId> &mediaIds);
hgs
parents: 34
diff changeset
   289
    
hgs
parents: 34
diff changeset
   290
    /**
hgs
parents: 34
diff changeset
   291
     * Removes items from an album.
hgs
parents: 34
diff changeset
   292
     * 
hgs
parents: 34
diff changeset
   293
     * @param albumId, Album where to remove items.
hgs
parents: 34
diff changeset
   294
     * @param mediaIds, Items to remove from album.
hgs
parents: 34
diff changeset
   295
     * @return None.
hgs
parents: 34
diff changeset
   296
     */
hgs
parents: 34
diff changeset
   297
    void removeItemsFromAlbumL(TMPXItemId &albumId, const QList<TMPXItemId> &mediaIds);
34
hgs
parents: 30
diff changeset
   298
    
36
hgs
parents: 35
diff changeset
   299
    /**
hgs
parents: 35
diff changeset
   300
     * Renames an album.
hgs
parents: 35
diff changeset
   301
     * 
hgs
parents: 35
diff changeset
   302
     * @param albumId, Album to be renamed.
hgs
parents: 35
diff changeset
   303
     * @param newTitle, New title for the album.
hgs
parents: 35
diff changeset
   304
     * @return None.
hgs
parents: 35
diff changeset
   305
     */
hgs
parents: 35
diff changeset
   306
    void renameAlbumL(const TMPXItemId &albumId, const QString newTitle);
hgs
parents: 35
diff changeset
   307
    
30
hgs
parents:
diff changeset
   308
private:
hgs
parents:
diff changeset
   309
hgs
parents:
diff changeset
   310
    /**
hgs
parents:
diff changeset
   311
     * Pointer to MPX Collection utility.
hgs
parents:
diff changeset
   312
     * Own.
hgs
parents:
diff changeset
   313
     */
hgs
parents:
diff changeset
   314
    MMPXCollectionUtility* mCollectionUtility;
hgs
parents:
diff changeset
   315
    
hgs
parents:
diff changeset
   316
    /**
hgs
parents:
diff changeset
   317
     * Variable for storing My Videos collection opening status.
hgs
parents:
diff changeset
   318
     */
hgs
parents:
diff changeset
   319
    int mCollectionOpenStatus;     
hgs
parents:
diff changeset
   320
hgs
parents:
diff changeset
   321
    /**
hgs
parents:
diff changeset
   322
     * Collectionlistener
hgs
parents:
diff changeset
   323
     */
hgs
parents:
diff changeset
   324
    VideoCollectionListener *mCollectionListener;
hgs
parents:
diff changeset
   325
    
hgs
parents:
diff changeset
   326
    /**
hgs
parents:
diff changeset
   327
     * Variable for storing opened My Videos category and album ids.
hgs
parents:
diff changeset
   328
     */
hgs
parents:
diff changeset
   329
	TMPXItemId mOpenCategoryAlbum;
hgs
parents:
diff changeset
   330
hgs
parents:
diff changeset
   331
    /**
hgs
parents:
diff changeset
   332
     * Variable for storing My Videos collection path level.
hgs
parents:
diff changeset
   333
     */
34
hgs
parents: 30
diff changeset
   334
    VideoCollectionCommon::TCollectionLevels mCollectionPathLevel;
30
hgs
parents:
diff changeset
   335
 };
hgs
parents:
diff changeset
   336
hgs
parents:
diff changeset
   337
#endif // __VIDEOCOLLECTIONCLIENT_H