videocollection/videocollectionwrapper/tsrc/testvideomodel_p/inc/mediaobjectfactory.h
changeset 15 cf5481c2bc0b
child 17 69946d1824c4
equal deleted inserted replaced
2:dec420019252 15:cf5481c2bc0b
       
     1 /*
       
     2 * Copyright (c) 2009 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 "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:  Helper class for creating mediaobjects for testing CVideoListDataModel class methods*
       
    15 */
       
    16 
       
    17 
       
    18 #ifndef __TESTVIDEOLISTMEDIAFACTORY_H__
       
    19 #define __TESTVIDEOLISTMEDIAFACTORY_H__
       
    20 
       
    21 
       
    22 class CMPXMediaArray;
       
    23 class CMPXMedia;
       
    24 
       
    25 /**
       
    26  * flag values for selecting wich details are created for items
       
    27  */
       
    28 enum MediaDataSelection
       
    29 {
       
    30     MediaDataNone = 0x00,    
       
    31     MediaDataRatingFlag = 0x01,
       
    32     MediaDataDateFlag = 0x02,
       
    33     MediaDataSizeFlag  = 0x04,
       
    34     MediaDataDurationFlag = 0x08,
       
    35     MediaDataAgeProfile = 0x10,
       
    36     MediaDataFilePath = 0x20,
       
    37     MediaDataName = 0x40,
       
    38     MediaDataId   = 0x80,
       
    39     MediaDataDesc = 0x100,
       
    40     MediaDataModified = 0x200,
       
    41     MediaDataAuthor = 0x400,
       
    42     MediaDataCopyright = 0x800,
       
    43     MediaDataLanguage = 0x1000,
       
    44     MediaDataFormat = 0x2000,
       
    45     MediaDetailCategoryVideoCount = 0x4000,
       
    46     MediaDataAll = 0xffff
       
    47 };
       
    48 
       
    49 // const used for media creation
       
    50 _LIT( KMediaTestNamePrefix, "MEDIATESTNAME_%d" );
       
    51 const QString gQTMediaNamePrefix = "MEDIATESTNAME_";
       
    52 
       
    53 _LIT( KMediaTestPathPrefix, "MEDIATESTPATH_%d" );
       
    54 const QString gQTMediaPathPrefix = "MEDIATESTPATH_";
       
    55 
       
    56 _LIT( KMediaTestDescPrefix, "MEDIATESTDESC_%d" );
       
    57 const QString gQTMediaDescPrefix = "MEDIATESTDESC_";
       
    58 
       
    59 _LIT( KMediaTestAuthorPrefix, "MEDIATESTAUTHOR_%d" );
       
    60 const QString gQTMediaAuthorPrefix = "MEDIATESTAUTHOR_";
       
    61 
       
    62 _LIT( KMediaTestCopyrightPrefix, "MEDIATESTCOPYRIGHT_%d" );
       
    63 const QString gQTMediaCopyrightPrefix = "MEDIATESTCOPYRIGHT_";
       
    64 
       
    65 _LIT( KMediaTestLanguagePrefix, "MEDIATESTLANGUAGE_%d" );
       
    66 const QString gQTMediaLanguagePrefix = "MEDIATESTLANGUAGE_";
       
    67 
       
    68 _LIT( KMediaTestFormatPrefix, "MEDIATESTFORMAT_%d" );
       
    69 const QString gQTMediaFormatPrefix = "MEDIATESTFORMAT_";
       
    70 
       
    71 class MediaObjectFactory 
       
    72 {
       
    73 
       
    74 public:
       
    75     /**
       
    76      * constructor.
       
    77      */
       
    78     MediaObjectFactory();
       
    79     
       
    80     /**
       
    81      * destructor
       
    82      */
       
    83     ~MediaObjectFactory();
       
    84     
       
    85     /**
       
    86      * returns pointer to media-array 
       
    87      */
       
    88     CMPXMediaArray* mediaArray();
       
    89     
       
    90     /**
       
    91      * creates a copy of media-array and transfers ownership to caller 
       
    92      */
       
    93     CMPXMediaArray* copyOfMediaArray();
       
    94     
       
    95     /**
       
    96      * creates wanted amount of items with selected details
       
    97      * 
       
    98      * @param count
       
    99      * @param MediaDetailSelection flags
       
   100      */
       
   101     void createMediaItems(int count, int flags = MediaDataAll);
       
   102        
       
   103     /**
       
   104      * creates CMPXMediaArray of category items
       
   105      * 
       
   106      */
       
   107     void createCollectionItems();
       
   108 
       
   109     /**
       
   110      * deletes media-array 
       
   111      */
       
   112     void removeArray();
       
   113     
       
   114     /**
       
   115      * creates media-item
       
   116      * 
       
   117      * @index used as part of data values
       
   118      * @MediaDetailSelection
       
   119      * 
       
   120      * @return CMPXMedia 
       
   121      */
       
   122     CMPXMedia* getMedia(int index, int dataSelectionFlags  = MediaDataAll );
       
   123     
       
   124     /**
       
   125      * creates media-item
       
   126      * 
       
   127      * @index used as part of data values
       
   128      * @MediaDetailSelection
       
   129      * 
       
   130      * @return CMPXMedia 
       
   131      */
       
   132     CMPXMedia* getMediaWithWantedIds(int id1, int id2 );
       
   133     
       
   134 private:
       
   135     
       
   136     /**
       
   137      * fills data for media
       
   138      */
       
   139     bool fillData(CMPXMedia *media, int index, int dataSelectionFlags  = MediaDataAll );
       
   140     
       
   141     /**
       
   142      * array of medias
       
   143      */
       
   144     CMPXMediaArray *mArray;
       
   145 };
       
   146 
       
   147 
       
   148 #endif  // __TESTVIDEOLISTMEDIAFACTORY_H__
       
   149 
       
   150 // End of file
       
   151     
       
   152 
       
   153