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: Declaration of EqualizerPresetsDialog class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef EQUALIZERPRESETSDIALOG_H |
|
22 #define EQUALIZERPRESETSDIALOG_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <AknDialog.h> |
|
26 #include <aknlists.h> |
|
27 #include <EqualizerConstants.h> |
|
28 #include <AudioEqualizerUtility.h> |
|
29 |
|
30 // CLASS DECLARATION |
|
31 class CEqualizerPresetListArray; |
|
32 class CEqualizerEditingDialog; |
|
33 |
|
34 /** |
|
35 * This class is used to notify the client application about the activation |
|
36 * of a new preset. |
|
37 * |
|
38 * @lib Equalizer.lib |
|
39 * @since Series 60 3.0 |
|
40 */ |
|
41 NONSHARABLE_CLASS(MEqualizerPresetActivationObserver) |
|
42 { |
|
43 public: // New functions |
|
44 /** |
|
45 * This member is called by the Equalizer UI when the user activates |
|
46 * a new preset. |
|
47 * @ since Series 60 3.0 |
|
48 * @ aActivatedPreset It is KEqualizerPresetNone if the preset "None" |
|
49 * is active. Otherwise, it is the value of |
|
50 * TEfAudioEqualizerUtilityPreset::iPresetNameKey for the entry |
|
51 * whose TEfAudioEqualizerUtilityPreset::iPresetName matches the |
|
52 * activated preset name, in the array retrieved using |
|
53 * CAudioEqualizerUtility::Presets(). |
|
54 */ |
|
55 virtual void HandlePresetActivation (TInt aActivatedPreset) = 0; |
|
56 }; |
|
57 |
|
58 /** |
|
59 * This class is used to display the preset list view of the Equalizer. |
|
60 * |
|
61 * @lib Equalizer.lib |
|
62 * @since Series 60 3.0 |
|
63 */ |
|
64 class CEqualizerPresetsDialog : public CAknDialog |
|
65 #ifdef RD_SCALABLE_UI_V2 |
|
66 , public MEikListBoxObserver |
|
67 #endif //RD_SCALABLE_UI_V2 |
|
68 { |
|
69 public: //Constructors and Destructors |
|
70 /** |
|
71 * This function is called to create an object of |
|
72 * type CEqualizerPresetsDialog - Two phase Construction |
|
73 * @since 3.0 |
|
74 * @param aAudEqUtility a reference to CAudioEqualizerUtility |
|
75 * @param aCurrentActivePreset It is KEqualizerPresetNone if the preset |
|
76 * "None" is active. Otherwise, it is the value of |
|
77 * TEfAudioEqualizerUtilityPreset::iPresetNameKey for the entry |
|
78 * whose TEfAudioEqualizerUtilityPreset::iPresetName matches the |
|
79 * activated preset name, in the array retrieved using |
|
80 * CAudioEqualizerUtility::Presets(). |
|
81 * @param aEqualizerPresetActivationObserver a reference to an object |
|
82 * of type MEqualizerPresetActivationObserver |
|
83 */ |
|
84 IMPORT_C static CEqualizerPresetsDialog* NewL( |
|
85 CAudioEqualizerUtility* aAudEqUtility, |
|
86 TInt aCurrentActivePreset, |
|
87 MEqualizerPresetActivationObserver& aEqrPresetActObserver); |
|
88 |
|
89 /** |
|
90 * Destructor |
|
91 * @since 3.0 |
|
92 */ |
|
93 virtual ~CEqualizerPresetsDialog(); |
|
94 private: //New functions |
|
95 /** |
|
96 * Second Phase Constructor |
|
97 * @since 3.0 |
|
98 * @param aCurrentActivePreset the index into the preset array retrieved |
|
99 * with the method CAudioEqualizerUtility::Presets()if a preset other |
|
100 * than "None" is active. It is KEqualizerPresetNone if the preset |
|
101 * "None" is active. |
|
102 */ |
|
103 void ConstructL(const TInt aCurrentActivePreset); |
|
104 /** |
|
105 * This function is called to create an object of |
|
106 * type CEqualizerPresetsDialog - First Phase Constructor |
|
107 * @since 3.0 |
|
108 * @param aAudEqUtility a reference to CAudioEqualizerUtility |
|
109 * @param aEqualizerPresetActivationObserver a reference to an object |
|
110 * of type MEqualizerPresetActivationObserver |
|
111 */ |
|
112 CEqualizerPresetsDialog ( |
|
113 CAudioEqualizerUtility* aAudEqUtility, |
|
114 MEqualizerPresetActivationObserver& aEqrPresetActObserver); |
|
115 |
|
116 /** |
|
117 * This function is called to get a free preset name |
|
118 * @since 3.0 |
|
119 * @param aName Used to reurn a free preset name |
|
120 */ |
|
121 void BuildPresetNameL( TDes& aName) const; |
|
122 |
|
123 /** |
|
124 * This function returns the highlighted Preset in ListBox |
|
125 * @since 3.0 |
|
126 * @return Highlighted Preset e.g. "None" |
|
127 */ |
|
128 TPresetName GetHighlightedPresetInListBox() const; |
|
129 /** |
|
130 * This function is called to find the index of a preset in the list |
|
131 * of presets returned by CAudioEqualizerUtility::Presets() |
|
132 * @since 3.0 |
|
133 * @param aPreset The preset focussed in ListBox |
|
134 * @return index of the highlighted preset in the ListBox in the |
|
135 * list of presets returned by CAudioEqualizerUtility::Presets() |
|
136 */ |
|
137 TInt GetEngineIndexL(const TPresetName& aPreset) const; |
|
138 /** |
|
139 * This function is used for the activation of a preset |
|
140 * @since 3.0 |
|
141 * @param aIndex The index of the preset in the ListBox |
|
142 * @param aPresetName The name of the preset |
|
143 */ |
|
144 void ActivateEqrPresetL(const TInt aIndex, const TDesC& aPreset); |
|
145 /** |
|
146 * This function is used for the editing of a preset |
|
147 * @since 3.0 |
|
148 * @param aIndex The index of the preset in the ListBox |
|
149 * @param aPresetName The name of the preset |
|
150 */ |
|
151 void EditEqrPresetL(const TInt aIndex, const TDesC& aPreset); |
|
152 /** |
|
153 * This function is used for the creation of a new preset |
|
154 * @since 3.0 |
|
155 * @param aIndex The index of the preset in the ListBox. This is set |
|
156 * to a the index in the ListBox if preset creation is successful. |
|
157 * If the creation is unscuccessful, then the parameter is not changed. |
|
158 * @param aPreset The name of the preset created |
|
159 */ |
|
160 void CreateNewEqrPresetL(TInt& aIndex, TPresetName& aPreset) const; |
|
161 |
|
162 /** |
|
163 * This function is used for the renaming of a preset |
|
164 * @since 3.0 |
|
165 * @param aIndex The index of the preset in the ListBox |
|
166 * @param aPresetName The name of the preset |
|
167 */ |
|
168 void RenameEqrPresetL(const TInt aIndex, const TDesC& aPreset); |
|
169 |
|
170 /** |
|
171 * This function is used for the deletion of a preset |
|
172 * @since 3.0 |
|
173 * @param aIndex The index of the preset in the ListBox |
|
174 * @param aPresetName The name of the preset |
|
175 */ |
|
176 void DeleteEqrPresetL(const TInt aIndex, const TDesC& aPreset); |
|
177 |
|
178 /** |
|
179 * This function is used to display a dialog to query the user |
|
180 * for a new name. It is used while creating a new preset or |
|
181 * renaming an existing preset. |
|
182 * @since 3.0 |
|
183 * @param aResourceId The resource id to use for the dialog |
|
184 * @param aPresetName |
|
185 * @return ETrue if the user did not cancel the dialog box |
|
186 * EFalse otherwise |
|
187 */ |
|
188 TBool GetNewNameL(const TInt aResourceId, TDes& aPresetName) const; |
|
189 |
|
190 /** |
|
191 * This function is used to load the ListBox icons in an array |
|
192 * @since 3.0 |
|
193 * @returns array of ListBox icons |
|
194 */ |
|
195 CArrayPtr<CGulIcon>* GetListBoxIconsL() const; |
|
196 |
|
197 /** |
|
198 * This function is used to inform the client application about the |
|
199 * currently active preset |
|
200 * engine |
|
201 * @since 3.0 |
|
202 */ |
|
203 void SetCurrentPreset(const TPresetName& aPreset); |
|
204 |
|
205 /** |
|
206 * This function is used to rturn the currently active preset |
|
207 * engine |
|
208 * @since 3.0 |
|
209 */ |
|
210 TPresetName CurrentPreset() const; |
|
211 |
|
212 /** |
|
213 * This function is used to search for a preset name in the ListBox |
|
214 * @since 3.0 |
|
215 * @param aPreset The preset name to search for |
|
216 * @return It returns the index of the preset, if found and |
|
217 * KErrNotFound if not found. |
|
218 */ |
|
219 TInt SearchPresetL(const TPresetName& aPreset) const; |
|
220 |
|
221 /** |
|
222 * This function is used to display a dialog to the user for |
|
223 * editing a particular preset. |
|
224 * @since 3.0 |
|
225 * @param aAudEqUtility pointer to CAudioEqualizerUtility |
|
226 * @param aIndex the index of the preset in the array of presets |
|
227 * @param aIsActive whether the preset is active or not? |
|
228 * returned by CAudioEqualizerUtility::Presets() |
|
229 */ |
|
230 void DisplaySettingsL(CAudioEqualizerUtility* aAudEqUtility, |
|
231 const TInt aIndex, const TBool aIsActive); |
|
232 |
|
233 /** |
|
234 * This function is used to display a note to the user if |
|
235 * memory is below critical level when creating a new preset. |
|
236 * @since 3.1 |
|
237 */ |
|
238 void ShowDiskFullNoteL() const; |
|
239 |
|
240 public: |
|
241 /** |
|
242 * This function is used to execute the Dialog. |
|
243 * @since 3.0 |
|
244 * @returns return value of CAknDialog::ExecuteLD() |
|
245 */ |
|
246 IMPORT_C TInt ExecuteLD(); |
|
247 |
|
248 /** |
|
249 * This function is used to set new values for CAudioEqualizerUtility* |
|
250 * @since 3.0 |
|
251 * @param aAudEqUtility New pointer to CAudioEqualizerUtility |
|
252 */ |
|
253 IMPORT_C void SetAudioEqualizerL(CAudioEqualizerUtility* aAudEqUtility); |
|
254 |
|
255 private: //Functions from base classes |
|
256 |
|
257 /** |
|
258 * From CAknDialog |
|
259 * This function responds to the size changes to sets the |
|
260 * size and position of the |
|
261 * contents of this control. |
|
262 */ |
|
263 void SizeChanged(); |
|
264 |
|
265 /** |
|
266 * From CAknDialog |
|
267 * Handles changes to the application |
|
268 * when it switches to or from the foreground. |
|
269 */ |
|
270 void HandleForegroundEventL( TBool aForeground); |
|
271 |
|
272 /** |
|
273 * From CAknDialog |
|
274 * Responds to a change in focus. |
|
275 * This is called whenever the control gains or loses focus |
|
276 */ |
|
277 void FocusChanged(TDrawNow aDrawNow); |
|
278 |
|
279 /** |
|
280 * From CCoeControl |
|
281 * This function is called when there is a Skin change event |
|
282 * or layout change event |
|
283 */ |
|
284 void HandleResourceChangeL(TInt aType); |
|
285 |
|
286 /** |
|
287 * This function is called when there is a Skin change event |
|
288 * or layout change event, it calls HandleResourceChangeL() |
|
289 */ |
|
290 void HandleResourceChange(TInt aType); |
|
291 |
|
292 /** |
|
293 * From CAknDialog Called when a key event happens. |
|
294 */ |
|
295 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
296 TEventCode aType ); |
|
297 /** |
|
298 * From CAknDialog Called just before the dialog is displayed. |
|
299 */ |
|
300 void PreLayoutDynInitL(void); |
|
301 /** |
|
302 * From CAknDialog Called to process a user's menu command. |
|
303 */ |
|
304 void ProcessCommandL(TInt aCommandId); |
|
305 /** |
|
306 * From CAknDialog Called just before the menu pane is displayed |
|
307 */ |
|
308 void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); |
|
309 /** |
|
310 * From CAknDialog Called when OK key is pressed |
|
311 */ |
|
312 TBool OkToExitL(TInt aButtonId); |
|
313 |
|
314 /** |
|
315 * Get help context for the control. |
|
316 * @param aContext The context that is filled in. |
|
317 * @return None. |
|
318 */ |
|
319 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
320 |
|
321 #ifdef RD_SCALABLE_UI_V2 |
|
322 /** |
|
323 * From MEikListBoxObserver |
|
324 * Handles listbox events. |
|
325 * @param aListBox Listbox where the event occurred. |
|
326 * @param aEventType Event type. |
|
327 * |
|
328 */ |
|
329 void HandleListBoxEventL( CEikListBox* aListBox, |
|
330 TListBoxEvent aEventType ); |
|
331 #endif //RD_SCALABLE_UI_V2 |
|
332 |
|
333 private: |
|
334 // Used to store whether the "OK" key has been pressed or not |
|
335 // and accordingly invoke appropriate code in DynInitMenuPaneL(). |
|
336 // It is set to ETrue in OkToExitL() when the key pressed is "OK" |
|
337 // and set to EFalse in DynInitMenuPaneL() after the "Context |
|
338 // Sensitive" menu handling has been done. |
|
339 TBool iContextSensitiveMenu; |
|
340 // Used to store the offset of the resource file |
|
341 TInt iResourceFileOffset; |
|
342 // The ListBox control |
|
343 CAknSingleGraphicStyleListBox* iListBox; |
|
344 // Name of currently active preset |
|
345 TPresetName iActivePreset; |
|
346 // Application title text |
|
347 HBufC* iAppTitleText; |
|
348 // Preset "None" Text |
|
349 HBufC* iPresetNoneText; |
|
350 // Equalizer's title text |
|
351 HBufC* iTitleText; |
|
352 // Used to store a pointer to CAudioEqualizerUtility |
|
353 CAudioEqualizerUtility* iAudEqUtility; |
|
354 // Used to store a reference to the observer class |
|
355 MEqualizerPresetActivationObserver& iEqrPresetActObserver; |
|
356 // ListBox Item Array |
|
357 CEqualizerPresetListArray* iItemArray; |
|
358 // Ignore Key events between track changes |
|
359 TBool iIgnoreKeyEvents; |
|
360 //Editing dialog |
|
361 CEqualizerEditingDialog *iEditingDialog; |
|
362 CRepository* iRepository; |
|
363 // Status pane layout before launching this dialog |
|
364 TInt iPreviousStatusPaneLayout; |
|
365 }; |
|
366 |
|
367 #endif // EQUALIZERPRESETSDIALOG_H |
|
368 |
|
369 // End of File |
|