upnpsharing/upnpcontentserver/inc/upnpselectionreader.h
changeset 0 7f85d04be362
child 38 5360b7ddc251
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:      CUpnpSelectionReader class definition
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef UPNPSELECTIONREADER_H
       
    24 #define UPNPSELECTIONREADER_H
       
    25 
       
    26 // INCLUDES
       
    27 
       
    28 #include "upnpcontentmetadatautility.h"
       
    29 #include "upnpcontentserverdefs.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CUpnpContentMetadataUtility;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37  * CUpnpSelectionReader class
       
    38  * Reads the selections user has made
       
    39  * @since S60 3.1
       
    40  */
       
    41 class CUpnpSelectionReader: public CBase
       
    42     {
       
    43 public:
       
    44     /**
       
    45      * Two-phased constructor.
       
    46      * @since S60 3.1
       
    47      * @param aUtility Pointer to CLF interface
       
    48      */
       
    49     IMPORT_C static CUpnpSelectionReader* NewL(
       
    50         CUpnpContentMetadataUtility* aUtility );
       
    51 
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55     virtual ~CUpnpSelectionReader();
       
    56 
       
    57     /**
       
    58      * Fetch collections from Media Gallery
       
    59      * @param aSettingsTextArray, The array of collection names
       
    60      * @since S60 3.1
       
    61      */
       
    62     IMPORT_C void FetchCollectionsL( CDesCArray* aSettingsTextArray );
       
    63 
       
    64     /**
       
    65      * Fetch playlists from Media Gallery
       
    66      * @param aSettingsTextArray, The array of playlist names
       
    67      * @since S60 3.1
       
    68      */
       
    69     IMPORT_C void FetchPlaylistsL( CDesCArray* aSettingsTextArray );
       
    70 
       
    71     /**
       
    72      * Checks if item is alredy shared
       
    73      * @param aItemName, Name of the item
       
    74      * @param aIdArray, Array of Ids to search from
       
    75      * @return TBool, True is shared, false otherwise
       
    76      * @since S60 3.1
       
    77      */
       
    78     IMPORT_C TBool IsItemShared(const TDesC& aItemName,
       
    79                                 const CDesCArray& aIDArray ) const;
       
    80 
       
    81     /**
       
    82      * Gets the indexes of users previous selections relative to the available
       
    83      * playlists or albums
       
    84      * @since S60 3.1
       
    85      * @param aSelections, Array of selections
       
    86      * @param aType, Selections type needed
       
    87      */
       
    88     IMPORT_C void GetSelectionIndexesL(
       
    89         RArray<TInt>& aSelections,
       
    90         const TUpnpMediaType& aType );
       
    91 
       
    92     /**
       
    93      * Gets the sharing state of Images and videos
       
    94      * @since S60 3.1
       
    95      * @param aShareAllState, The variable to store the state
       
    96      * @return Status of the operation
       
    97      */
       
    98     TInt GetVisualSharingStateL( TInt& aShareAllState );
       
    99 
       
   100     /**
       
   101      * Gets the sharing state of music
       
   102      * @since S60 3.1
       
   103      * @param aShareAllState, The variable to store the state
       
   104      * @return Status of the operation
       
   105      */
       
   106     TInt GetMusicSharingStateL( TInt& aShareAllState );
       
   107 
       
   108     /**
       
   109      * Get the number of shared containers
       
   110      * @since S60 3.1
       
   111      * @return number of shared containers
       
   112      */
       
   113     TInt GetContainerCount() const;
       
   114 
       
   115     /**
       
   116      * Get the playlist ids
       
   117      * @since S60 3.1
       
   118      * @param aPlaylistIds Array containing the playlist ids
       
   119      * @return error code
       
   120      */
       
   121     TInt PlayListIdsL( CDesCArray& aPlaylistIds,
       
   122         CDesCArray& aPlaylistNames );
       
   123 
       
   124     /**
       
   125      * Get the collection ids
       
   126      * @since S60 3.1
       
   127      * @param aCollectionIds Array containing the collection ids
       
   128      * @return error code
       
   129      */
       
   130     TInt CollectionIdsL( CDesCArray& aCollectionIds, 
       
   131         CDesCArray& aCollectionNames );
       
   132 
       
   133     /**
       
   134      * Set the metadata utility pointer
       
   135      * @since S60 3.1
       
   136      * @param aMetaData Pointer to CUpnpContentMetadataUtility instance
       
   137      */
       
   138     void SetMetadata( CUpnpContentMetadataUtility*
       
   139                       aMetaData );
       
   140 
       
   141 protected:  // New functions
       
   142     /**
       
   143      * Two-phased constructor.
       
   144      * @since S60 3.1
       
   145      * @param aUtility Pointer to CLF interface
       
   146      */
       
   147     void ConstructL(
       
   148         CUpnpContentMetadataUtility* aUtility);
       
   149 
       
   150     /**
       
   151      * Searches playlist files
       
   152      * @since S60 3.1
       
   153      */
       
   154     TBool SearchPlaylistFilesL();
       
   155 
       
   156     /**
       
   157      * Searches collections
       
   158      * @since S60 3.1
       
   159      */
       
   160     TBool SearchCollectionsL();
       
   161 
       
   162     /**
       
   163      * Saves sharing state to central repository
       
   164      * @since S60 3.1
       
   165      * @return TInt, error code
       
   166      */
       
   167     TInt SaveSharingState();
       
   168 
       
   169 
       
   170 private:
       
   171     /**
       
   172      * C++ default constructor.
       
   173      */
       
   174     CUpnpSelectionReader();
       
   175 
       
   176     /**
       
   177      * Reads container IDs from file
       
   178      * @since S60 3.1
       
   179      * @param aArray, array where desciptors are read
       
   180      * @param aContainerType, type of container
       
   181      * @return TInt, error code
       
   182      */
       
   183     TInt ReadSharedContainerIDsL(
       
   184         CDesCArray* aArray,
       
   185         const TUpnpMediaType& aContainerType ) const;
       
   186 
       
   187 
       
   188 private: //data
       
   189 
       
   190     /**
       
   191      *  Mediatype selected from listbox
       
   192      */
       
   193     TUpnpMediaType                            iMediaType;
       
   194 
       
   195     /**
       
   196      * Pointer to CLF interface
       
   197      * not owned
       
   198      */
       
   199     CUpnpContentMetadataUtility*         iMetadataUtility;
       
   200 
       
   201     /**
       
   202      * Selection value for images and videos
       
   203      */
       
   204     TInt iVisualSharingSelection;
       
   205 
       
   206     /**
       
   207      * Selection value for playlists
       
   208      */
       
   209     TInt iMusicSharingSelection;
       
   210 
       
   211     /** 
       
   212      * selected image and video indexes
       
   213      * owned
       
   214      */
       
   215     RArray<TInt>*            iSelectedImages;
       
   216 
       
   217     /**
       
   218      * selected music indexes
       
   219      * owned
       
   220      */
       
   221     RArray<TInt>*            iSelectedMusic;
       
   222 
       
   223     /** 
       
   224      * array for playlists
       
   225      * owned
       
   226      */
       
   227     CDesCArrayFlat*                 iPlIdArray;
       
   228 
       
   229     /** 
       
   230      * array for collection Ids
       
   231      * owned
       
   232      */
       
   233     CDesCArrayFlat*                 iCollIdArray;
       
   234 
       
   235     /**
       
   236      * array for image and video containers shown in ui
       
   237      * owned
       
   238      */
       
   239     CDesCArrayFlat*                 iImageContainers;
       
   240 
       
   241     /**
       
   242      * array for playlists shown in ui
       
   243      * owned
       
   244      */
       
   245     CDesCArrayFlat*                 iPlaylistNames;
       
   246 
       
   247     /**
       
   248      * array for collections shown in ui
       
   249      * owned
       
   250      */
       
   251     CDesCArrayFlat* iCollectionNames;
       
   252 
       
   253     /**
       
   254      * number of ui items
       
   255      */
       
   256     TInt iContainerCount;
       
   257 
       
   258     };
       
   259 #endif
       
   260 // End of File