1 /* |
|
2 * Copyright (c) 2005 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: Header file of mediafiledialogstate. |
|
15 * Class used to deal with the items of the Main view |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MEDIAFILEDIALOGSTATE_H |
|
22 #define MEDIAFILEDIALOGSTATE_H |
|
23 |
|
24 // INCLUDES |
|
25 #include "mediafiledialogutils.h" |
|
26 |
|
27 #include <e32base.h> |
|
28 |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 |
|
33 enum TMediaFileListFolder |
|
34 { |
|
35 EEFolderRoot = 0, |
|
36 EEFolderDownload, |
|
37 EEFolderTones, |
|
38 EEFolderMusic, |
|
39 EEFolderVideos, |
|
40 EEFolderRecordings, |
|
41 EEFolderSearch, |
|
42 EEFolderAllMusic, |
|
43 EEFolderArtistRoot, |
|
44 EEFolderArtist, |
|
45 EEFolderArtistUnknown, // 10 |
|
46 EEFolderArtistAll, |
|
47 EEFolderArtistAlbum, |
|
48 EEFolderArtistAlbumUnknown, |
|
49 EEFolderAlbumRoot, |
|
50 EEFolderAlbum, |
|
51 EEFolderAlbumUnknown, |
|
52 EEFolderGenreRoot, |
|
53 EEFolderGenre, |
|
54 EEFolderGenreUnknown, |
|
55 EEFolderComposerRoot, // 20 |
|
56 EEFolderComposer, |
|
57 EEFolderComposerUnknown, |
|
58 EEFolderNullItemOne, |
|
59 EEFolderNullItemTwo, |
|
60 EEFolderRecent, |
|
61 EEFolderNone, |
|
62 EEFolderPersistent, |
|
63 EEFolderUnknown, |
|
64 EEFolderSearchMusic |
|
65 }; |
|
66 |
|
67 |
|
68 enum TMediaFileListIcons |
|
69 { |
|
70 EEIconMusic = 0, |
|
71 EEIconTone = 1, |
|
72 EEIconVideo = 2, |
|
73 EEIconRecording = 3, |
|
74 EEIconArtist = 4, |
|
75 EEIconAlbum = 5, |
|
76 EEIconGenre = 6, |
|
77 EEIconComposer = 7, |
|
78 EEIconFolder = 8, |
|
79 EEIconUnknown = 9, |
|
80 EEIconFolderDownload = 10, |
|
81 EEIconNullItemOff = 11, |
|
82 EEIconMemoryCard = 12, |
|
83 EEIconMassStorage = 13, |
|
84 EEIconEmpty = 14 |
|
85 }; |
|
86 |
|
87 enum TMediaFileListQueryDirection |
|
88 { |
|
89 EEQueryUp, |
|
90 EEQueryDown, |
|
91 EEQueryUpdate |
|
92 }; |
|
93 |
|
94 |
|
95 |
|
96 // CLASS DECLARATION |
|
97 |
|
98 NONSHARABLE_CLASS (TMFListItem) |
|
99 { |
|
100 public: |
|
101 // position in listbox |
|
102 TInt iListIndex; |
|
103 |
|
104 // one of TMediaFileListFolder |
|
105 TInt iFolderId; |
|
106 |
|
107 // one of TMediaFileListFolder |
|
108 TInt iParentFolderId; |
|
109 |
|
110 // non-persistent child items from metadata (folders or file names) |
|
111 TInt iChildFolderId; |
|
112 |
|
113 // is list item a persistent folder |
|
114 TBool iPersistent; |
|
115 |
|
116 // is list item hidden |
|
117 TBool iHidden; |
|
118 |
|
119 // icon that is shown in listbox |
|
120 TInt iIconId; |
|
121 |
|
122 // icon that is shown in listbox |
|
123 TInt iChildIconId; |
|
124 |
|
125 // count of unknown items in this folder |
|
126 TInt iUnknownCount; |
|
127 |
|
128 // text that is shown in listox |
|
129 TBuf<KBufSize128> iText; |
|
130 |
|
131 // text that is shown in navi pane |
|
132 TBuf<KBufSize128> iTitle; |
|
133 |
|
134 |
|
135 public: |
|
136 TMFListItem(); |
|
137 }; |
|
138 |
|
139 /** |
|
140 * TMFCurrentItemInfo |
|
141 * |
|
142 * Used for maintaining the open item info in a list box |
|
143 * folder and current list item position. |
|
144 */ |
|
145 |
|
146 NONSHARABLE_CLASS (TMFCurrentItemInfo) |
|
147 { |
|
148 public: |
|
149 // has media file database changed |
|
150 TBool iIndexCheckNeeded; |
|
151 |
|
152 // current item listbox index |
|
153 TInt iItemIndex; |
|
154 |
|
155 // currently selected media file id |
|
156 TInt iMediaFileId; |
|
157 |
|
158 // currently selected persistent folder id |
|
159 TInt iFolderId; |
|
160 |
|
161 // currently selected non-persistent folder id |
|
162 TBuf<KBufSize128> iFolderText; |
|
163 |
|
164 public: |
|
165 void Reset(); |
|
166 }; |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 /** |
|
172 * CMediaFileDialogState |
|
173 * |
|
174 * Used for maintaining MediaFileDialog state eg currently open |
|
175 * folder and current list item position. |
|
176 */ |
|
177 NONSHARABLE_CLASS (CMediaFileDialogState) : public CBase |
|
178 { |
|
179 public: |
|
180 static CMediaFileDialogState* NewL(); |
|
181 virtual ~CMediaFileDialogState(); |
|
182 |
|
183 private: |
|
184 CMediaFileDialogState(); |
|
185 void ConstructL(); |
|
186 |
|
187 public: |
|
188 void Init(); |
|
189 void AddPermanentItemsL(); |
|
190 |
|
191 TInt NextFolderUp(); |
|
192 TInt NextFolderDown( TInt aListIndex ); |
|
193 void SetQueryInfo( TInt aQueryId, const TDesC& aQueryText, |
|
194 TInt aQueryListPosition, TInt aQueryDirection ); |
|
195 void SetStateAfterQuery(); |
|
196 |
|
197 public: |
|
198 void SetCurrentFolder( TInt aFolderId ); |
|
199 TInt CurrentFolder(); |
|
200 |
|
201 TBool FindBoxNeeded(); |
|
202 TBool QueryNeeded(); |
|
203 TBool QueryNeeded( TInt aFolderId ); |
|
204 TInt QueryFolder(); |
|
205 |
|
206 void SetText( TInt aFolderId, const TDesC& aText ); |
|
207 void GetText( TInt aFolderId, TDes& aText ); |
|
208 void SetTitle( TInt aFolderId, const TDesC& aText ); |
|
209 void GetTitle( TInt aFolderId, TDes& aText ); |
|
210 void GetSearchTitleL( TDes& aText, TInt aCount ); |
|
211 void GetSearchTitle( TDes& aText, TInt aCount ); |
|
212 |
|
213 void SetUnknownFolderPosition( TInt aQueryCount ); |
|
214 void SetListIndex( TInt aFolderId, TInt aListIndex ); |
|
215 TInt ListIndex( TInt aFolderId ); |
|
216 void EnableNullItemL( TInt aFolderId, const TDesC& aText, TInt aIconId ); |
|
217 |
|
218 |
|
219 private: |
|
220 TInt IndexFromId( TInt aFolderId ); |
|
221 TInt FolderIndex( TInt aListIndex ); |
|
222 |
|
223 public: |
|
224 TInt PersistentFolderCount( TInt aFolderId ); |
|
225 TInt PersistentFolderCount(); |
|
226 TInt LeadingPersistentFolderCount(); |
|
227 TInt CurrentItemIndex(); |
|
228 void SetCurrentItemIndex( TInt aIndex ); |
|
229 TInt FolderId( TInt aListIndex ); |
|
230 void GetFolderInfo( TInt aListIndex, TInt& aId, TDes& aText, |
|
231 TBool& aPersistent, TInt& aIconId ); |
|
232 |
|
233 public: |
|
234 TMFCurrentItemInfo& CurrentItemInfo(); |
|
235 TInt QueryDirection(); |
|
236 TInt PreviousFolderId(); |
|
237 TBool IsPersistent( TInt aFolderId ); |
|
238 |
|
239 public: |
|
240 void ResetUnknownCount(); |
|
241 void SetUnknownCount( TInt aFolderId, TInt aCount ); |
|
242 TInt UnknownCount( TInt aFolderId ); |
|
243 void HideUnknownFolders(); |
|
244 void HideUnknownFolder( TInt aFolderId, TInt aUnknownCount ); |
|
245 void HideRootFolder( TInt aFolderId, TBool aHidden, |
|
246 const TDesC& aText, TInt aIconId ); |
|
247 |
|
248 public: |
|
249 void PrintCurrentFolder(); |
|
250 |
|
251 public: |
|
252 static void GetFolderTypeText(TDes& aText, TInt aType); |
|
253 |
|
254 private: |
|
255 static void Panic( TInt aReason ); |
|
256 |
|
257 private: |
|
258 RArray<TMFListItem> iList; |
|
259 TInt iCurrentFolderId; |
|
260 TInt iCurrentFolderIndex; |
|
261 TInt iListPosition; |
|
262 |
|
263 // temporary query info - iList is updated after successful query |
|
264 TInt iQueryFolderId; |
|
265 TInt iQueryDirection; |
|
266 TBuf<KBufSize128> iQueryText; |
|
267 |
|
268 // previous folder id |
|
269 TInt iPreviousFolderId; |
|
270 |
|
271 // current item info, needed for setting focus to current item |
|
272 // when media file database changes |
|
273 TMFCurrentItemInfo iCurrentItemInfo; |
|
274 }; |
|
275 |
|
276 |
|
277 |
|
278 #endif // MEDIAFILEDIALOGSTATE_H |
|
279 |
|
280 // End of File |
|