27 // CLASS DECLARATION |
27 // CLASS DECLARATION |
28 |
28 |
29 class MMPXDbAlbumObserver |
29 class MMPXDbAlbumObserver |
30 { |
30 { |
31 public: |
31 public: |
32 virtual TInt HandleIsUnknownArtistL(TUint32 aId) = 0; |
|
33 virtual HBufC* HandleArtistForAlbumL( const TUint32 aId ) = 0; |
|
34 /** |
32 /** |
35 * HandleAlbumartForAlbumL. |
33 * HandleAlbumartForAlbumL. |
36 * @param aId, The album ID. |
34 * @param aId, The album ID. |
37 * @param aArt, The albumart uri. |
35 * @param aArt, The albumart uri. |
38 * @returns alternative albumart retrieved in the specified Album. |
36 * @returns alternative albumart retrieved in the specified Album. |
39 */ |
37 */ |
40 virtual HBufC* HandleAlbumartForAlbumL( const TUint32 aId, TPtrC aArt ) = 0; |
38 virtual HBufC* HandleAlbumartForAlbumL( const TUint32 aId, TPtrC aArt ) = 0; |
|
39 |
|
40 /** |
|
41 * Called when album artist is removed from an album |
|
42 * @param aCategoryId category item ID |
|
43 * @param aDrive drive the category item is on |
|
44 * @param aItemChangedMessages changed mesages array to be updated or NULL |
|
45 */ |
|
46 virtual void DeleteAlbumForArtistL(TUint32 aCategoryId, |
|
47 TInt aDrive, CMPXMessageArray* aItemChangedMessages) = 0; |
|
48 |
|
49 /** |
|
50 * Called when album artist is added to an album |
|
51 * @param aName name string |
|
52 * @param aArt Album art path |
|
53 * @param aDriveId drive to add the category to |
|
54 * @return the ID of the category item (new or existing) |
|
55 */ |
|
56 virtual TUint32 AddAlbumArtistL(const TDesC& aName, const TDesC& aArt, TInt aDriveId) = 0; |
41 }; |
57 }; |
42 /** |
58 /** |
43 * Responsible for managing all music databases |
59 * Responsible for managing all music databases |
44 * |
60 * |
45 * @lib MPXDbPlugin.lib |
61 * @lib MPXDbPlugin.lib |
72 * Destructor |
88 * Destructor |
73 */ |
89 */ |
74 virtual ~CMPXDbAlbum(); |
90 virtual ~CMPXDbAlbum(); |
75 |
91 |
76 public: |
92 public: |
77 |
93 /** |
78 /** |
94 * Add an album item. If the record already exists, its counter will |
79 * Add a category item. If the record already exists, its counter will |
|
80 * be incremented. |
95 * be incremented. |
81 * @param aName: This is the name to be entered into the row |
96 * @param aCategory category type |
|
97 * @param aMedia: The media object |
82 * @param aDriveId: The Drive Id the name (category) belongs |
98 * @param aDriveId: The Drive Id the name (category) belongs |
83 * @param aNewRecord: indicates to the caller if a new record is created. |
99 * @param aNewRecord: indicates to the caller if a new record is created. |
84 * ETrue if a new row is created in the table; otherwise EFalse. |
100 * ETrue if a new row is created in the table; otherwise EFalse. |
85 * @param aCaseSensitive indicates whether case sensitivity should be taken |
101 * @param aCaseSensitive indicates whether case sensitivity should be taken |
86 * into consideration when generating the unique row id |
102 * into consideration when generating the unique row id |
87 * @return The unique id of the row added. |
103 * @return The unique id of the row added. |
88 */ |
104 */ |
89 TUint32 AddItemL(const TDesC& aName, const TDesC& aArtistName, const TDesC& aArt, TInt aDriveId, TBool& aNewRecord, |
105 virtual TUint32 AddItemL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, TInt aDriveId, TBool& aNewRecord, |
90 TBool aCaseSensitive = ETrue); |
106 TBool aCaseSensitive = ETrue); |
91 |
107 |
92 /** |
108 /** |
93 * Decrement the number of songs for the item. If the count gets to 0, remove |
109 * Decrement the number of songs for the item. If the count gets to 0, remove |
94 * the item. |
110 * the item. |
100 * number number of songs on that drive with that album/artist. |
116 * number number of songs on that drive with that album/artist. |
101 * @param aItemChangedMessages if valid on return contains a deleted message if the |
117 * @param aItemChangedMessages if valid on return contains a deleted message if the |
102 * category was deleted |
118 * category was deleted |
103 * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete, |
119 * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete, |
104 * EFalse otherwise |
120 * EFalse otherwise |
105 * @param aArtist: The ID of the artist |
|
106 * @param aArt: The albumart uri |
121 * @param aArt: The albumart uri |
107 */ |
122 */ |
108 void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId, |
123 void DecrementSongsForAlbumL(TUint32 aId, TInt aDriveId, |
109 CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TUint32 aArtist, const TDesC& aArt ); |
124 CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TDesC& aArt ); |
110 |
125 |
111 /** |
126 /** |
112 * Gets the details for all category items. |
127 * Gets the details for all category items. |
113 * @param aAttrs attributes to be returned |
128 * @param aAttrs attributes to be returned |
114 * @param aMediaArray returns the requested attributes for all items |
129 * @param aMediaArray returns the requested attributes for all items |
122 * @param aMediaArray returns the requested attributes for all items |
137 * @param aMediaArray returns the requested attributes for all items |
123 */ |
138 */ |
124 void GetAllCategoryItemsMediaWallL(const TArray<TMPXAttribute>& aAttrs, |
139 void GetAllCategoryItemsMediaWallL(const TArray<TMPXAttribute>& aAttrs, |
125 CMPXMediaArray& aMediaArray); |
140 CMPXMediaArray& aMediaArray); |
126 |
141 |
|
142 /** |
|
143 * Gets details for the category items under a parent category item. |
|
144 * This applies to albums for a given artist. The method panics if the |
|
145 * category or parent category are invalid. |
|
146 * @param aParentCategory identifies the parent category |
|
147 * @param aParentId identifies the parent item |
|
148 * @param aAttrs attributes to be returned |
|
149 * @param aMediaArray returns the requested attributes for all items |
|
150 */ |
|
151 virtual void GetSubCategoryItemsL(TMPXGeneralCategory aParentCategory, TUint32 aParentId, |
|
152 const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray); |
|
153 |
127 /** |
154 /** |
128 * Update a category item. |
155 * Update a category item. |
129 * @param aId: The ID of the category to update |
156 * @param aId: The ID of the category to update |
130 * @param aMedia: The media data |
157 * @param aMedia: The media data |
131 * @param aDriveId: The Drive Id the name (category) belongs |
158 * @param aDriveId: The Drive Id the name (category) belongs |
132 * @param aItemChangedMessages: if valid on return contains a updated message if the |
159 * @param aItemChangedMessages: if valid on return contains a updated message if the |
133 * category was updated |
160 * category was updated |
134 */ |
161 */ |
135 void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages); |
162 void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages); |
136 |
163 |
137 public: |
164 public: |
138 /** |
|
139 * Get albums count for a specified artist |
|
140 * @param aId: The ID of the artist |
|
141 */ |
|
142 TInt GetAlbumsCountForArtistL(TUint32 aArtistId); |
|
143 |
|
144 /** |
165 /** |
145 * Get songs count for a specified album and a specified artist |
166 * Get songs count for a specified album and a specified artist |
146 * @param aArtistId: The ID of the artist |
167 * @param aArtistId: The ID of the artist |
147 * @param aAlbumId: The ID of the album |
168 * @param aAlbumId: The ID of the album |
148 */ |
169 */ |
149 TInt GetSongsCountInAlbumMatchingArtistL(TUint32 aArtistId, TUint32 aAlbumId); |
170 TInt GetSongsCountInAlbumMatchingArtistL(TUint32 aArtistId, TUint32 aAlbumId); |
|
171 /** |
|
172 * Check if the specified album ID is an unknown album. |
|
173 * An “Unknown album” is one where the album name and album artist are unknown. |
|
174 * @param aId: The ID of the album |
|
175 * @return ETrue if it's an unknown album |
|
176 */ |
|
177 TBool IsUnknownAlbumL(const TUint32 aId); |
|
178 |
|
179 /** |
|
180 * Generate Unique ID for Album |
|
181 * @param aMedia media object |
|
182 * @param aCaseSensitive indicates whether case sensitivity should be taken |
|
183 * into consideration when generating the unique row id |
|
184 * @return the ID of album |
|
185 */ |
|
186 TUint32 GenerateUniqueIdL(const CMPXMedia& aMedia); |
150 |
187 |
151 private: |
188 private: |
152 /** |
189 /** |
153 * Updates the media with information from the table |
190 * Updates the media with information from the table |
154 * @param aRecord record containing the source fields |
191 * @param aRecord record containing the source fields |
165 * @param aValues values of each field of Album table |
202 * @param aValues values of each field of Album table |
166 * @return a string containing the selection criteria. The ownership is passed to the caller. |
203 * @return a string containing the selection criteria. The ownership is passed to the caller. |
167 */ |
204 */ |
168 void GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia, |
205 void GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia, |
169 CDesCArray& aFields, CDesCArray& aValues); |
206 CDesCArray& aFields, CDesCArray& aValues); |
170 |
207 |
171 |
|
172 TBool IsUnknownArtistL(TUint32 aId); |
|
173 |
|
174 /** |
|
175 * Get the ArtistName of song which belongs to the specified Album. |
|
176 * @param aId The ID of the album |
|
177 * @returns alternative artistname retrieved in the specified Album. |
|
178 */ |
|
179 HBufC* ArtistForAlbumL(const TUint32 aId); |
|
180 /** |
208 /** |
181 * Get the Albumart of song which belongs to the specified Album. |
209 * Get the Albumart of song which belongs to the specified Album. |
182 * @param aId The ID of the album |
210 * @param aId The ID of the album |
183 * @param aArt albumart with the song is deleted. |
211 * @param aArt albumart with the song is deleted. |
184 * @returns alternative albumart retrieved in the specified Album. |
212 * @returns alternative albumart retrieved in the specified Album. |
185 */ |
213 */ |
186 HBufC* AlbumartForAlbumL(const TUint32 aId, TPtrC aArt); |
214 HBufC* AlbumartForAlbumL(const TUint32 aId, TPtrC aArt); |
187 |
215 |
|
216 /** |
|
217 * Processes a recordset by constructing media instances and adding them |
|
218 * to the specified array. |
|
219 * @param aAttrs attributes to be returned |
|
220 * @param aRecordset recordset to be processed |
|
221 * @param aMediaArray returns the media instances |
|
222 */ |
|
223 void ProcessAlbumRecordSetL(const TArray<TMPXAttribute>& aAttrs, |
|
224 RSqlStatement& aRecordset, CMPXMediaArray& aMediaArray); |
|
225 |
|
226 /** |
|
227 * Processes a recordset by constructing media instances and adding them |
|
228 * to the specified array. |
|
229 * @param aAttrs attributes to be returned |
|
230 * @param aRecordset recordset to be processed |
|
231 * @param aMediaArray returns the media instances |
|
232 */ |
|
233 void ProcessMediaWallAlbumRecordSetL(const TArray<TMPXAttribute>& aAttrs, |
|
234 RSqlStatement& aRecordset, CMPXMediaArray& aMediaArray); |
|
235 |
|
236 /** |
|
237 * Retrieve AlbumArtist name from media object |
|
238 * @param aMedia media object |
|
239 * @param aName returned name |
|
240 * @return ETrue if name is available |
|
241 */ |
|
242 TBool RetrieveAlbumArtistL(const CMPXMedia& aMedia, TPtrC& aName); |
|
243 |
|
244 /** |
|
245 * Retrieve Artist name from media object |
|
246 * @param aMedia media object |
|
247 * @param aName returned name |
|
248 */ |
|
249 void RetrieveArtist(const CMPXMedia& aMedia, TPtrC& aName); |
|
250 |
|
251 /** |
|
252 * Check if Art needs to be updated |
|
253 * @param aDeletedSongArt deleted song's art |
|
254 * @param aCurrentAlbumArt Album's current art |
|
255 * @return ETrue if aDeletedSongArt is not non-embedded album art and |
|
256 * aDeleteSongArt and aCurrentAlbumArt are the same and known |
|
257 */ |
|
258 TBool NeedToUpdateArt(const TDesC& aDeletedSongArt, const TDesC& aCurrentAlbumArt); |
|
259 |
188 private: // from MMPXTable |
260 private: // from MMPXTable |
189 |
261 |
190 /** |
262 /** |
191 * @see MMPXTable |
263 * @see MMPXTable |
192 */ |
264 */ |