|
1 /* |
|
2 * Copyright (c) 2006 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: A list model for add tracks dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CMPXADDTRACKSLISTMODEL_H |
|
20 #define C_CMPXADDTRACKSLISTMODEL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <mpxcollectionpath.h> // TMPXItemId |
|
24 |
|
25 // CLASS DECLARATION |
|
26 class MDesCArray; |
|
27 class CMPXMedia; |
|
28 class CMPXMediaArray; |
|
29 |
|
30 /** |
|
31 * List model for add tracks dialog. |
|
32 * Keep track of list item . |
|
33 */ |
|
34 NONSHARABLE_CLASS( CMPXAddTracksListModel ) : public CBase |
|
35 { |
|
36 public: // Constructors and destructor |
|
37 |
|
38 /** |
|
39 * Two-phased constructor. |
|
40 * @return A pointer to a newly created object |
|
41 */ |
|
42 static CMPXAddTracksListModel* NewL(); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 virtual ~CMPXAddTracksListModel(); |
|
48 |
|
49 public: // New functions |
|
50 |
|
51 /** |
|
52 * Reset tracks list. |
|
53 */ |
|
54 void ResetTracksList(); |
|
55 |
|
56 /** |
|
57 * Return track name. |
|
58 * @param aIndex Track's index. |
|
59 * @return Track name. |
|
60 */ |
|
61 const TDesC& TrackName( TInt aIndex ) const; |
|
62 |
|
63 /** |
|
64 * Return track type. |
|
65 * @param aIndex Track's index. |
|
66 * @return Track type. |
|
67 */ |
|
68 TInt TrackTypeL( TInt aIndex ) const; |
|
69 |
|
70 /** |
|
71 * Return track Category. |
|
72 * @param aIndex Track's index. |
|
73 * @return Track category. |
|
74 */ |
|
75 TInt TrackCategoryL( TInt aIndex ) const; |
|
76 |
|
77 /** |
|
78 * Return track id. |
|
79 * @param aIndex Track's index. |
|
80 * @return Track id. |
|
81 */ |
|
82 TMPXItemId TrackIdL( TInt aIndex ) const; |
|
83 |
|
84 /** |
|
85 * Return media at a given index |
|
86 * |
|
87 * @param aIndex index to get |
|
88 */ |
|
89 const CMPXMedia& MediaL( TInt aIndex ) const; |
|
90 |
|
91 /** |
|
92 * Return number of tracks stored in the list. |
|
93 * @return Number of tracks stored in the list. |
|
94 */ |
|
95 TInt TracksListCount() const; |
|
96 |
|
97 /** |
|
98 * Insert groups at aPos of the tracks list. |
|
99 * @param aMedia media array containing the track info. |
|
100 * @param aPos Index for the groups to be added to. Ignore this field |
|
101 * if groups are appended to the end of the list. |
|
102 * @param aCategory category of the group could be either EMPXSong or EMPXArtist |
|
103 */ |
|
104 void InsertGroupsL( CMPXMediaArray& aMedia, TInt aPos = -1 , TInt aCategory = EMPXArtist); |
|
105 |
|
106 /** |
|
107 * Insert tracks under the current group. |
|
108 * @param aTrack track with song ids. |
|
109 * @param aIndex Index to insert. |
|
110 */ |
|
111 void InsertTrackL( CMPXMedia& aTrack, TInt aIndex ); |
|
112 |
|
113 /** |
|
114 * Insert tracks under the current group. Update the expanded array too. |
|
115 * @param aTracks List of tracks with song ids. |
|
116 * @param aIndex Index of the group. |
|
117 */ |
|
118 void InsertTracksUnderGroupL( |
|
119 CMPXMediaArray& aTracks, |
|
120 TInt aIndex ); |
|
121 |
|
122 /** |
|
123 * Remove all tracks under group. |
|
124 * @param aIndex Index of the group which tracks will be removed. |
|
125 * @return Number of tracks removed. |
|
126 */ |
|
127 TInt RemoveAllTracksFromGroupL( TInt aIndex ); |
|
128 |
|
129 /** |
|
130 * Remove tracks . |
|
131 * @param aIndex Index of the track which will be removed. |
|
132 */ |
|
133 void RemoveTracks( TInt aIndex ); |
|
134 |
|
135 /** |
|
136 * Return expanded groups count. |
|
137 * @return Expanded groups count. |
|
138 */ |
|
139 TInt ExpandedGroupsCount() const; |
|
140 |
|
141 /** |
|
142 * Check if the index is expanded or not. |
|
143 * @param aIndex Listbox index. |
|
144 * @return ETrue if aIndex is expanded. Otherwise, EFalse. |
|
145 */ |
|
146 TBool IsExpandedIndex( TInt aIndex ) const; |
|
147 |
|
148 /** |
|
149 * Mark the current index as expanded. |
|
150 * @param aIndex Index to be marked as expanded. |
|
151 * @param aCount Number of tracks added. |
|
152 */ |
|
153 void MarkExpandedL( TInt aIndex, TInt aCount ); |
|
154 |
|
155 /** |
|
156 * Clear the current index as collapsed. |
|
157 * @param aIndex Index to be removed from the expanded array. |
|
158 * @param aCount Number of tracks removed. |
|
159 */ |
|
160 void UnMarkExpanded( TInt aIndex, TInt aCount ); |
|
161 |
|
162 /** |
|
163 * Return the oldest expanded group index. |
|
164 * @return The oldest expanded group index. |
|
165 */ |
|
166 TInt OldestExpandedGroupIndex(); |
|
167 |
|
168 /** |
|
169 * Return the closest expanded group index. |
|
170 * @param aIndex Current index |
|
171 * @return Closest expanded group index if found. Otherwise, KErrNotFound. |
|
172 */ |
|
173 TInt ClosestExpandedGroupIdx( TInt aIndex ); |
|
174 |
|
175 /** |
|
176 * Return animation icon index for highlight item. |
|
177 * @param aIndex current highlight index number. |
|
178 * @return highlight item's aniamtion icon's index, KErrNotFound. |
|
179 */ |
|
180 TInt AnimationIconNum( TInt aIndex ); |
|
181 |
|
182 /** |
|
183 * Set animation icon index number. |
|
184 * @param aIndex current highlight index number |
|
185 * @param aAnimIconNum current animation icon index |
|
186 */ |
|
187 void SetAnimationIconNum( TInt aIndex, TInt aAnimIconNum ); |
|
188 |
|
189 /** |
|
190 * There are mathed songs, it means Songs(All) node is shown. |
|
191 * @return ETrue if there are matched songs, |
|
192 * EFalse if there is not. |
|
193 */ |
|
194 TBool FindSongs(); |
|
195 |
|
196 /** |
|
197 * Set flag to indicate if there are mathed songs. |
|
198 * @param aFindSongs if there are songs matched |
|
199 */ |
|
200 void SetFindSongsFlag( TBool aFindSongs ); |
|
201 |
|
202 /** |
|
203 * determines if the current item is on removable drive |
|
204 * |
|
205 * @param aIndex current highlight index number |
|
206 * @return ETrue if on removable drive, EFalse otherwise |
|
207 */ |
|
208 TBool IsOnRemovableDrive( TInt aIndex ); |
|
209 |
|
210 private: // Constructors |
|
211 |
|
212 /** |
|
213 * C++ default constructor. |
|
214 */ |
|
215 CMPXAddTracksListModel(); |
|
216 |
|
217 /** |
|
218 * By default Symbian 2nd phase constructor is private. |
|
219 */ |
|
220 void ConstructL(); |
|
221 |
|
222 private: // Data |
|
223 CMPXMediaArray* iTracksList; |
|
224 RArray<TInt> iExpandedIndices; |
|
225 TInt iCurrentHighlightIndex; // Current highlite item |
|
226 TInt iAnimIconNum; // animation icon number |
|
227 TBool iFindSongs; // Find songs flag |
|
228 TInt iMMCDrive; |
|
229 }; |
|
230 |
|
231 #endif // C_CMPXADDTRACKSLISTMODEL_H |
|
232 |
|
233 // End of File |