|
1 /* |
|
2 * Copyright (c) 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: This class is responsible for the auto playlist functionality. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MPXDBAUTOPLAYLIST_H |
|
20 #define MPXDBAUTOPLAYLIST_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <mpxattribute.h> |
|
25 |
|
26 // CLASS FORWARDS |
|
27 class CMPXMedia; |
|
28 class CMPXMediaArray; |
|
29 class CMPXDbManager; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Responsible for managing the music table |
|
35 * |
|
36 * @lib MPXDbPlugin.lib |
|
37 */ |
|
38 class CMPXDbAutoPlaylist : |
|
39 public CBase |
|
40 { |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 * @return new CMPXDbAutoPlaylist instance. |
|
46 */ |
|
47 static CMPXDbAutoPlaylist* NewL(CMPXDbManager& aDbManager, RFs& aFs, CMPXResource& aResource); |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 * @return new CMPXDbAutoPlaylist instance on the cleanup stack. |
|
52 */ |
|
53 static CMPXDbAutoPlaylist* NewLC(CMPXDbManager& aDbManager, RFs& aFs, CMPXResource& aResource); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 virtual ~CMPXDbAutoPlaylist(); |
|
59 |
|
60 public: |
|
61 |
|
62 /** |
|
63 * Get the playlist ID of an auto-playlist by type |
|
64 * @param aPlaylistType type of the auto-playlist |
|
65 * @return auto playlist ID |
|
66 * @leave KErrNotSupported if invalid playlist type |
|
67 */ |
|
68 TUint32 AutoPlaylistIdL(TMPXAutoPlaylistType aPlaylistType); |
|
69 |
|
70 /** |
|
71 * Get the name of an auto playlist |
|
72 * @param aPlaylistId identifies the playlist |
|
73 * @return the name of the playlist |
|
74 * @leave KErrNotSupported if invalid playlist ID |
|
75 */ |
|
76 TPtrC AutoPlaylistNameL(TUint32 aPlaylistId); |
|
77 |
|
78 /** |
|
79 * Checks whether the playlist ID corresponds to an auto playlist or not. |
|
80 * @param aPlaylistId identifies the playlist |
|
81 * @return Auto playlist type or EMPXNoAutoPlaylist if not found |
|
82 */ |
|
83 TMPXAutoPlaylistType AutoPlaylistTypeL(TUint32 aPlaylistId); |
|
84 |
|
85 /** |
|
86 * Get information on a specified playlist |
|
87 * @param aPlaylistId identifies the playlist |
|
88 * @param aAttrs the attributes to include for the playlists found. |
|
89 * @param aMedia returns the playlist information |
|
90 * @leave KErrNotSupported if invalid playlist ID |
|
91 */ |
|
92 void GetPlaylistL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs, |
|
93 CMPXMedia& aMedia); |
|
94 |
|
95 /** |
|
96 * Get information on all auto playlists |
|
97 * @param aMediaArray returns information on all auto playlists |
|
98 */ |
|
99 void GetAllPlaylistsL(CMPXMediaArray& aMediaArray); |
|
100 |
|
101 private: |
|
102 |
|
103 /** |
|
104 * Get count and duration information of the auto-playlist |
|
105 * @param aType the type of the auto-playlist |
|
106 * @param aCount reference to count to be returned |
|
107 * @param aDuration reference to duration to be returned |
|
108 */ |
|
109 void GetPlaylistDetailsL(TMPXAutoPlaylistType aType, TInt& aCount, TInt& aDuration); |
|
110 |
|
111 /** |
|
112 * Update the media with information about the auto-playlist |
|
113 * @param aPlaylistId Id of the auto-playlist |
|
114 * @param aAttrs the attributes to include for the playlist matching the |
|
115 * selection criteria |
|
116 * @param aMedia the playlist details object |
|
117 */ |
|
118 void UpdateMediaL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs, |
|
119 CMPXMedia& aMedia); |
|
120 |
|
121 private: |
|
122 |
|
123 /** |
|
124 * C++ constructor |
|
125 */ |
|
126 CMPXDbAutoPlaylist(CMPXDbManager& aDbManager); |
|
127 |
|
128 /** |
|
129 * Second phase constructor |
|
130 */ |
|
131 void ConstructL(RFs& aFs, CMPXResource& aResource); |
|
132 |
|
133 private: // Data |
|
134 TUint32 iRecentlyPlayedPlaylistId; // recently played playlist ID |
|
135 TUint32 iMostPlayedPlaylistId; // most played playlist ID |
|
136 TUint32 iRecentlyAddedPlaylistId; // recently added playlist ID |
|
137 |
|
138 // owned |
|
139 HBufC* iRecentlyPlayedPlaylist; // recently played playlist name |
|
140 HBufC* iMostPlayedPlaylist; // most played playlist name |
|
141 HBufC* iRecentlyAddedPlaylist; // recently added playlist name |
|
142 CMPXDbManager& iDbManager; |
|
143 }; |
|
144 |
|
145 #endif // MPXDBAUTOPLAYLIST_H |
|
146 |
|
147 // End of File |