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 aName Abstract Album art name |
54 * @param aCategory category type |
|
55 * @param aName name string |
55 * @param aDrive drive to add the category to |
56 * @param aDrive drive to add the category to |
56 * @param aItemChangedMessages changed mesages array to be updated or NULL |
57 * @param aItemChangedMessages changed mesages array to be updated or NULL |
57 * @param aItemExist Out parameter, ETrue if the item already exist before the add, |
58 * @param aItemExist Out parameter, ETrue if the item already exist before the add, |
58 * EFalse otherwise |
59 * EFalse otherwise |
59 * @param aUri Abstract Album art Uri |
|
60 * @param aAlbumArtist AlbumArtist string |
60 * @param aAlbumArtist AlbumArtist string |
|
61 * @param aGenre Genre string |
61 * @return the ID of the category item (new or existing) |
62 * @return the ID of the category item (new or existing) |
62 */ |
63 */ |
63 virtual TUint32 AddAbstractAlbumItemL(const TDesC& aName, |
64 virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName, |
64 TInt aDriveId, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, |
65 TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TDesC& aAlbumArtist=KNullDesC, |
65 const TDesC& aUri, const TDesC& aAlbumArtist=KNullDesC) = 0; |
66 const TDesC& aGenre=KNullDesC) = 0; |
66 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
67 #else |
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 aMedia media object |
71 * @param aName name string |
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 CMPXMedia& aMedia, |
78 virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName, |
79 TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0; |
79 TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0; |
80 |
80 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
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; |
81 /** |
85 /** |
82 * Called when the ID of a category item changed for a Music record, for example when |
86 * Called when the ID of a category item changed for a Music record, for example when |
83 * the artist name changed for a song. The implementation is supposed to update the |
87 * the artist name changed for a song. The implementation is supposed to update the |
84 * category record and add corresponding item changed messages to the array parameter. |
88 * category record and add corresponding item changed messages to the array parameter. |
85 * @param aCategory category type |
89 * @param aCategory category type |
86 * @param aCategoryId old category item ID |
90 * @param aCategoryId old category item ID |
87 * @param aDrive drive the category item is on |
91 * @param aDrive drive the category item is on |
88 * @param aItemChangedMessages changed mesages array to be updated or NULL |
92 * @param aItemChangedMessages changed mesages array to be updated or NULL |
89 * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete, |
93 * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete, |
90 * EFalse otherwise |
94 * 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, const TDesC& aArt = KNullDesC) = 0; |
97 TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 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 |
|
125 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
124 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
126 /** |
125 /** |
127 * Get title from the Id |
126 * Get title from the Id |
128 * @param Id to search for |
127 * @param Id to search for |
129 * @return name matching the ID |
128 * @return name matching the ID |
130 */ |
129 */ |
131 virtual HBufC* HandleGetAlbumNameFromIdL( TUint32 aId ) = 0; |
130 virtual HBufC* HandleGetAlbumNameFromIdL( TUint32 aId ) = 0; |
132 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
131 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
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 }; |
132 }; |
150 |
133 |
151 /** |
134 /** |
152 * Responsible for managing the Music table |
135 * Responsible for managing the Music table |
153 * |
136 * |
164 * @param aObserver observer reference |
147 * @param aObserver observer reference |
165 * @return New CMPXDbMusic instance. |
148 * @return New CMPXDbMusic instance. |
166 */ |
149 */ |
167 static CMPXDbMusic* NewL(CMPXDbManager& aDbManager, CMPXResource& aResource, |
150 static CMPXDbMusic* NewL(CMPXDbManager& aDbManager, CMPXResource& aResource, |
168 MMPXDbMusicObserver& aObserver); |
151 MMPXDbMusicObserver& aObserver); |
169 |
152 |
170 /** |
153 /** |
171 * Two-phased constructor. |
154 * Two-phased constructor. |
172 * @param aDbManager database manager to use for database interactions |
155 * @param aDbManager database manager to use for database interactions |
173 * @param aObserver observer reference |
156 * @param aObserver observer reference |
174 * @return New CMPXDbMusic instance on the cleanup stack. |
157 * @return New CMPXDbMusic instance on the cleanup stack. |
175 */ |
158 */ |
176 static CMPXDbMusic* NewLC(CMPXDbManager& aDbManager, CMPXResource& aResource, |
159 static CMPXDbMusic* NewLC(CMPXDbManager& aDbManager, CMPXResource& aResource, |
177 MMPXDbMusicObserver& aObserver); |
160 MMPXDbMusicObserver& aObserver); |
178 |
161 |
179 /** |
162 /** |
180 * Destructor |
163 * Destructor |
181 */ |
164 */ |
182 virtual ~CMPXDbMusic(); |
165 virtual ~CMPXDbMusic(); |
183 |
166 |
516 * @param aType criteria type (EMPXItem or EMPXGroup) |
499 * @param aType criteria type (EMPXItem or EMPXGroup) |
517 * @param aCriteria selection criteria |
500 * @param aCriteria selection criteria |
518 * @param aAttrs the attributes to include for the artist(s) matching the |
501 * @param aAttrs the attributes to include for the artist(s) matching the |
519 * selection criteria |
502 * selection criteria |
520 * @param aMediaArray returns the songs |
503 * @param aMediaArray returns the songs |
521 * @param aSortByTrackOrder if TRUE sorts tracks according to their track numbers, |
504 */ |
522 * if FALSE using track titles or filename |
|
523 */ |
|
524 void FindSongsL(TUint32 aGeneralId, TUint32 aContainerId, TMPXGeneralType aType, |
505 void FindSongsL(TUint32 aGeneralId, TUint32 aContainerId, TMPXGeneralType aType, |
525 const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs, |
506 const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs, |
526 CMPXMediaArray& aMediaArray, TBool aSortByTrackOrder = EFalse); |
507 CMPXMediaArray& aMediaArray); |
527 |
508 |
528 /** |
509 /** |
529 * Returns the track count for a given drive |
510 * Returns the track count for a given drive |
530 * @param aDrive drive |
511 * @param aDrive drive |
531 * @return the count |
512 * @return the count |
532 */ |
513 */ |
540 * @param aUriArr, will contain all URIs on return |
521 * @param aUriArr, will contain all URIs on return |
541 * @param aLastID, will contain unique ID of a last record in the array |
522 * @param aLastID, will contain unique ID of a last record in the array |
542 */ |
523 */ |
543 void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords, |
524 void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords, |
544 CDesCArray& aUriArr, TInt& aLastID); |
525 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); |
545 |
532 |
546 /** |
533 /** |
547 * Get the Albumart of song which belongs to the specified Album |
534 * Get the Albumart of song which belongs to the specified Album |
548 * @param aId, the ID of Album |
535 * @param aId, the ID of Album |
549 * @param aArt, AlbumArt uri |
536 * @param aArt, AlbumArt uri |
683 * @return Full URI string. The ownership is passed to the caller. |
670 * @return Full URI string. The ownership is passed to the caller. |
684 */ |
671 */ |
685 HBufC* ConstructUriL(RSqlStatement& aMusicTable); |
672 HBufC* ConstructUriL(RSqlStatement& aMusicTable); |
686 |
673 |
687 /** |
674 /** |
688 * Checks if the specified category field (artist/genre/composer/abstractalbum) |
675 * Checks if the specified category field (artist/album/genre/composer) |
689 * will change and notifies the observer if so. |
676 * will change and notifies the observer if so. |
690 * @param aCategory identifies the category |
677 * @param aCategory identifies the category |
691 * @param aMedia contains the new record attributes |
678 * @param aMedia contains the new record attributes |
692 * @param aAttribute corresponding attribute in the media parameter |
679 * @param aAttribute corresponding attribute in the media parameter |
693 * @param aOldId the current category item ID |
680 * @param aColumnIndex column index in the recordset |
|
681 * @param aMusicTable current record in the music table or NULL if this is an insert |
694 * @param aDriveId drive ID the update is for |
682 * @param aDriveId drive ID the update is for |
695 * @param aItemChangedMessages item changed messages to append to |
683 * @param aItemChangedMessages item changed messages to append to |
696 * @param aItemId returns the category item ID |
684 * @param aItemId returns the category item ID |
697 * @return ETrue if the field was modified |
685 * @return ETrue if the field was modified |
698 */ |
686 */ |
699 TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, |
687 TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, |
700 const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId, |
688 const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId, |
701 CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, const TDesC& aArt = KNullDesC); |
689 CMPXMessageArray* aItemChangedMessages, TUint32& aItemId); |
702 |
690 |
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 |
|
719 /** |
691 /** |
720 * Checks if extra attributes are required. The "standard attribute set includes: |
692 * Checks if extra attributes are required. The "standard attribute set includes: |
721 * EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory, |
693 * EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory, |
722 * EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags |
694 * EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags |
723 * @param aAttrs attributes to be checked |
695 * @param aAttrs attributes to be checked |