mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbmusic.h
changeset 51 560ce2306a17
parent 38 b93f525c9244
equal deleted inserted replaced
47:4cc1412daed0 51:560ce2306a17
    49     {
    49     {
    50     public:
    50     public:
    51 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
    51 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
    52         /**
    52         /**
    53         * Called when a new category item has to be added to a category table.
    53         * Called when a new category item has to be added to a category table.
    54         * @param aCategory category type
    54         * @param aName Abstract Album art name
    55         * @param aName name string
       
    56         * @param aDrive drive to add the category to
    55         * @param aDrive drive to add the category to
    57         * @param aItemChangedMessages changed mesages array to be updated or NULL
    56         * @param aItemChangedMessages changed mesages array to be updated or NULL
    58         * @param aItemExist Out parameter, ETrue if the item already exist before the add,
    57         * @param aItemExist Out parameter, ETrue if the item already exist before the add,
    59         *        EFalse otherwise
    58         *        EFalse otherwise
       
    59         * @param aUri Abstract Album art Uri
    60         * @param aAlbumArtist AlbumArtist string
    60         * @param aAlbumArtist AlbumArtist string
    61         * @param aGenre Genre string
       
    62         * @return the ID of the category item (new or existing)
    61         * @return the ID of the category item (new or existing)
    63         */
    62         */
    64         virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
    63         virtual TUint32 AddAbstractAlbumItemL(const TDesC& aName, 
    65             TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TDesC& aAlbumArtist=KNullDesC,
    64             TInt aDriveId, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist,
    66             const TDesC& aGenre=KNullDesC) = 0;
    65             const TDesC& aUri, const TDesC& aAlbumArtist=KNullDesC) = 0;
    67 #else
    66 #endif // ABSTRACTAUDIOALBUM_INCLUDED
       
    67 
    68         /**
    68         /**
    69         * Called when a new category item has to be added to a category table.
    69         * Called when a new category item has to be added to a category table.
    70         * @param aCategory category type
    70         * @param aCategory category type
    71         * @param aName name string
    71         * @param aMedia media object
    72         * @param aDrive drive to add the category to
    72         * @param aDrive drive to add the category to
    73         * @param aItemChangedMessages changed mesages array to be updated or NULL
    73         * @param aItemChangedMessages changed mesages array to be updated or NULL
    74         * @param aItemExist Out parameter, ETrue if the item already exist before the add,
    74         * @param aItemExist Out parameter, ETrue if the item already exist before the add,
    75         *        EFalse otherwise
    75         *        EFalse otherwise
    76         * @return the ID of the category item (new or existing)
    76         * @return the ID of the category item (new or existing)
    77         */
    77         */
    78         virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
    78         virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,       
    79             TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
    79             TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
    80 #endif // ABSTRACTAUDIOALBUM_INCLUDED
    80 
    81        // for Album and Artist table
       
    82         virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
       
    83             const TDesC& aArtistName, const TDesC& aArt,
       
    84             TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
       
    85         /**
    81         /**
    86         * Called when the ID of a category item changed for a Music record, for example when
    82         * Called when the ID of a category item changed for a Music record, for example when
    87         * the artist name changed for a song. The implementation is supposed to update the
    83         * the artist name changed for a song. The implementation is supposed to update the
    88         * category record and add corresponding item changed messages to the array parameter.
    84         * category record and add corresponding item changed messages to the array parameter.
    89         * @param aCategory category type
    85         * @param aCategory category type
    90         * @param aCategoryId old category item ID
    86         * @param aCategoryId old category item ID
    91         * @param aDrive drive the category item is on
    87         * @param aDrive drive the category item is on
    92         * @param aItemChangedMessages changed mesages array to be updated or NULL
    88         * @param aItemChangedMessages changed mesages array to be updated or NULL
    93         * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
    89         * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
    94         *        EFalse otherwise
    90         *        EFalse otherwise
       
    91         * @param aArt Art of the music record. 
       
    92         *             Art needs to be given so that the cateogry can switch over to different art 
       
    93         *             if necessary
       
    94         * 
    95         */
    95         */
    96         virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
    96         virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
    97             TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
    97             TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TDesC& aArt = KNullDesC) = 0;
    98 
    98 
    99         /**
    99         /**
   100         * Called when the play count attribute of a song is changed. Should add an item changed
   100         * Called when the play count attribute of a song is changed. Should add an item changed
   101         * message to the array.
   101         * message to the array.
   102         * @param aItemChangedMessages array of item changed messages to add to
   102         * @param aItemChangedMessages array of item changed messages to add to
   119          * @param aMedia media data
   119          * @param aMedia media data
   120          * @param aItemChangedMessages changed mesages array to be updated or NULL
   120          * @param aItemChangedMessages changed mesages array to be updated or NULL
   121          */
   121          */
   122         virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
   122         virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
   123              const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages) = 0;
   123              const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages) = 0;
       
   124 
   124 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
   125 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
   125         /**
   126         /**
   126         * Get title from the Id
   127         * Get title from the Id
   127         * @param Id to search for
   128         * @param Id to search for
   128         * @return name matching the ID
   129         * @return name matching the ID
   129         */
   130         */
   130         virtual HBufC* HandleGetAlbumNameFromIdL( TUint32 aId ) = 0;
   131         virtual HBufC* HandleGetAlbumNameFromIdL( TUint32 aId ) = 0;
   131 #endif // ABSTRACTAUDIOALBUM_INCLUDED    
   132 #endif // ABSTRACTAUDIOALBUM_INCLUDED
   132 	};
   133         
       
   134         /**
       
   135         * Generate Unique ID for Album
       
   136         * @param aMedia media object
       
   137         * @param aCaseSensitive indicates whether case sensitivity should be taken
       
   138         *        into consideration when generating the unique row id
       
   139         * @return the ID of album
       
   140         */
       
   141         virtual TUint32 GenerateUniqueIdForAlbumL(const CMPXMedia& aMedia) = 0;
       
   142 
       
   143         /**
       
   144         * Check if the specified album ID is Unknown album
       
   145         * @param aId: The ID of the album
       
   146         * @return ETrue if it's Unknown album
       
   147         */
       
   148         virtual TBool IsUnknownAlbumL(const TUint32 aId) = 0;
       
   149     };
   133 
   150 
   134 /**
   151 /**
   135 * Responsible for managing the Music table
   152 * Responsible for managing the Music table
   136 *
   153 *
   137 * @lib MPXDbPlugin.lib
   154 * @lib MPXDbPlugin.lib
   499         * @param aType criteria type (EMPXItem or EMPXGroup)
   516         * @param aType criteria type (EMPXItem or EMPXGroup)
   500         * @param aCriteria selection criteria
   517         * @param aCriteria selection criteria
   501         * @param aAttrs the attributes to include for the artist(s) matching the
   518         * @param aAttrs the attributes to include for the artist(s) matching the
   502         *        selection criteria
   519         *        selection criteria
   503         * @param aMediaArray returns the songs
   520         * @param aMediaArray returns the songs
   504         */
   521         * @param aSortByTrackOrder if TRUE sorts tracks according to their track numbers, 
       
   522 		*        if FALSE using track titles or filename
       
   523         */       
   505         void FindSongsL(TUint32 aGeneralId, TUint32 aContainerId, TMPXGeneralType aType,
   524         void FindSongsL(TUint32 aGeneralId, TUint32 aContainerId, TMPXGeneralType aType,
   506             const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
   525             const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
   507             CMPXMediaArray& aMediaArray);
   526             CMPXMediaArray& aMediaArray, TBool aSortByTrackOrder = EFalse);
   508 
   527         
   509         /**
   528         /**
   510         * Returns the track count for a given drive
   529         * Returns the track count for a given drive
   511         * @param aDrive drive
   530         * @param aDrive drive
   512         * @return the count
   531         * @return the count
   513         */
   532         */
   521         * @param aUriArr, will contain all URIs on return
   540         * @param aUriArr, will contain all URIs on return
   522         * @param aLastID, will contain unique ID of a last record in the array
   541         * @param aLastID, will contain unique ID of a last record in the array
   523         */
   542         */
   524         void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
   543         void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
   525                                CDesCArray& aUriArr, TInt& aLastID);
   544                                CDesCArray& aUriArr, TInt& aLastID);
   526 
       
   527         /**
       
   528          * Get the ID of Artist which belongs to the specified Album
       
   529          * @param aId, the ID of Album
       
   530          */
       
   531         TUint32 ArtistForAlbumL(const TUint32 aId);
       
   532             
   545             
   533         /**
   546         /**
   534         * Get the Albumart of song which belongs to the specified Album
   547         * Get the Albumart of song which belongs to the specified Album
   535         * @param aId, the ID of Album
   548         * @param aId, the ID of Album
   536         * @param aArt, AlbumArt uri
   549         * @param aArt, AlbumArt uri
   670         * @return Full URI string. The ownership is passed to the caller.
   683         * @return Full URI string. The ownership is passed to the caller.
   671         */
   684         */
   672         HBufC* ConstructUriL(RSqlStatement& aMusicTable, TUint32 aMediaId);
   685         HBufC* ConstructUriL(RSqlStatement& aMusicTable, TUint32 aMediaId);
   673 
   686 
   674         /**
   687         /**
   675         * Checks if the specified category field (artist/album/genre/composer)
   688         * Checks if the specified category field (artist/genre/composer/abstractalbum)
   676         * will change and notifies the observer if so.
   689         * will change and notifies the observer if so.
   677         * @param aCategory identifies the category
   690         * @param aCategory identifies the category
   678         * @param aMedia contains the new record attributes
   691         * @param aMedia contains the new record attributes
   679         * @param aAttribute corresponding attribute in the media parameter
   692         * @param aAttribute corresponding attribute in the media parameter
   680         * @param aColumnIndex column index in the recordset
   693         * @param aOldId the current category item ID
   681         * @param aMusicTable current record in the music table or NULL if this is an insert
       
   682         * @param aDriveId drive ID the update is for
   694         * @param aDriveId drive ID the update is for
   683         * @param aItemChangedMessages item changed messages to append to
   695         * @param aItemChangedMessages item changed messages to append to
   684         * @param aItemId returns the category item ID
   696         * @param aItemId returns the category item ID
   685         * @return ETrue if the field was modified
   697         * @return ETrue if the field was modified
   686         */
   698         */
   687         TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
   699         TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
   688             const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
   700             const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
   689             CMPXMessageArray* aItemChangedMessages, TUint32& aItemId);
   701             CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, const TDesC& aArt = KNullDesC);
   690 
   702 
       
   703         /**
       
   704         * Checks if album will change and notifies the observer if so.
       
   705         * @param aMedia contains the new record attributes
       
   706         * @param aAttribute corresponding attribute in the media parameter
       
   707         * @param aOldId the current category item ID
       
   708         * @param aDriveId drive ID the update is for
       
   709         * @param aItemChangedMessages item changed messages to append to
       
   710         * @param aItemId returns the album item ID
       
   711 		* @param aArt old art of the music record
       
   712 		* @param aCaseSensitive indicates whether case sensitivity should be taken
       
   713         * @return ETrue if the field was modified
       
   714         */
       
   715         TBool UpdateCategoryFieldForAlbumL(const CMPXMedia& aMedia, 
       
   716 		    const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId, 
       
   717 			CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, const TDesC& aArt = KNullDesC);       
       
   718         
   691         /**
   719         /**
   692         * Checks if extra attributes are required. The "standard attribute set includes:
   720         * Checks if extra attributes are required. The "standard attribute set includes:
   693         * EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory,
   721         * EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory,
   694         * EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags
   722         * EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags
   695         * @param aAttrs attributes to be checked
   723         * @param aAttrs attributes to be checked