|
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: Class declarations of CMPXLbxExtendedFeatures |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MPXLBXEXTENDEDFEATURES_H |
|
20 #define MPXLBXEXTENDEDFEATURES_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <mdaaudiotoneplayer.h> |
|
24 #include <mpxcollectionobserver.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CEikTextListBox; |
|
28 class CAknNavigationDecorator; |
|
29 class CAknNaviLabel; |
|
30 class CAknNavigationControlContainer; |
|
31 class MMPXCollectionUtility; |
|
32 |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * CMPXLbxExtendedFeatures class |
|
38 * |
|
39 * Extended features for listbox views |
|
40 */ |
|
41 NONSHARABLE_CLASS( CMPXLbxExtendedFeatures ) : public CBase, |
|
42 public MMdaAudioToneObserver, |
|
43 public MMPXCollectionObserver |
|
44 { |
|
45 public: |
|
46 |
|
47 enum TMPXKeyStatus |
|
48 { |
|
49 EMPXKeyOther = 0, |
|
50 EMPXKeyUp, |
|
51 EMPXKeyDown |
|
52 }; |
|
53 |
|
54 enum TMPXScrollingStates |
|
55 { |
|
56 EMPXScrollingIdle = 0, |
|
57 EMPXScrolling1stBufferTime, |
|
58 EMPXScrolling1stSpeed, |
|
59 EMPXScrolling2ndBufferTime, |
|
60 EMPXScrolling2ndSpeed |
|
61 }; |
|
62 |
|
63 public: // Constructors and destructor |
|
64 |
|
65 /** |
|
66 * Symbian OS two-phased constructor. |
|
67 * @since S60 3.2.3 |
|
68 * @param aLbx The handle to the list box view |
|
69 * @param aEnableSetIndex ETrue to enable set index to collection server |
|
70 * everytime the list is browsed |
|
71 */ |
|
72 IMPORT_C static CMPXLbxExtendedFeatures* NewL( |
|
73 CEikTextListBox* aLbx, |
|
74 TBool aEnableSetIndex = ETrue ); |
|
75 |
|
76 /** |
|
77 * C++ default destructor. |
|
78 * @since S60 3.2.3 |
|
79 */ |
|
80 IMPORT_C virtual ~CMPXLbxExtendedFeatures(); |
|
81 |
|
82 private: |
|
83 |
|
84 /** |
|
85 * C++ default constructor. |
|
86 * @since S60 3.2.3 |
|
87 * @param aLbx The handle to the list box view |
|
88 * @param aEnableSetIndex ETrue to enable set index to collection server |
|
89 * everytime the list is browsed |
|
90 */ |
|
91 CMPXLbxExtendedFeatures( |
|
92 CEikTextListBox* aLbx, |
|
93 TBool aEnableSetIndex ); |
|
94 |
|
95 /** |
|
96 * Symbian OS default constructor. |
|
97 * @since S60 3.2.3 |
|
98 */ |
|
99 void ConstructL(); |
|
100 |
|
101 public: // New functions |
|
102 |
|
103 /** |
|
104 * Handle listbox key events |
|
105 * @since S60 3.2.3 |
|
106 * @param aKeyEvent Key event |
|
107 * @param aType Type of key event |
|
108 */ |
|
109 IMPORT_C TKeyResponse HandleLbxKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
110 |
|
111 /** |
|
112 * Enable or disable speed scrolling |
|
113 * @since S60 3.2.3 |
|
114 * @param isEnable ETrue if speed scrolling is desired. EFalse otherwise. |
|
115 */ |
|
116 IMPORT_C void EnableSpeedScrollL( TBool isEnable ); |
|
117 |
|
118 /** |
|
119 * Enable or disable navipane labeling |
|
120 * @since S60 3.2.3 |
|
121 * @param aNaviEnable ETrue if labeling is desired. EFalse otherwise. |
|
122 */ |
|
123 IMPORT_C void SpeedNaviUpdating( TBool aNaviEnable ); |
|
124 |
|
125 /** |
|
126 * Reset everything to default. |
|
127 * @since S60 3.2.3 |
|
128 */ |
|
129 void Reset(); |
|
130 |
|
131 /** |
|
132 * Enable or disable auto loop |
|
133 * @since S60 3.2.3 |
|
134 * @param isEnable ETrue if auto loop is desired. EFalse otherwise. |
|
135 */ |
|
136 void EnableAutoLoop( TBool isEnable ); |
|
137 |
|
138 /** |
|
139 * Timer callback, this is called on each timer event. |
|
140 * @since S60 3.2.3 |
|
141 * @param aPtr pointer to the object for type casting (given in Timer creation). |
|
142 * @return ETrue after successful timer cycle. |
|
143 */ |
|
144 static TInt TimerCallBack( TAny* aPtr ); |
|
145 |
|
146 private: // New functions |
|
147 |
|
148 /** |
|
149 * Construct and start buffer timer. |
|
150 * @since S60 3.2.3 |
|
151 */ |
|
152 void StartTimerL(); |
|
153 |
|
154 /** |
|
155 * Stop and destroy timer. |
|
156 * @since S60 3.2.3 |
|
157 */ |
|
158 void StopTimer(); |
|
159 |
|
160 /** |
|
161 * Change scrolling status, called by TimerCallBack(). |
|
162 * @since S60 3.2.3 |
|
163 */ |
|
164 void BufferTimerHandler(); |
|
165 |
|
166 /** |
|
167 * Update the scrolling speed |
|
168 * @since S60 3.2.3 |
|
169 */ |
|
170 void UpdateScrollingSpeed( TMPXKeyStatus aKeyStatus ); |
|
171 |
|
172 /** |
|
173 * Check if boundary is reached. |
|
174 * @since S60 3.2.3 |
|
175 * @param aKeyStatus current key status. |
|
176 * @return ETrue is boundary is reahced. Otherwise EFalse. |
|
177 */ |
|
178 TBool CheckBoundaryCases( TMPXKeyStatus aKeyStatus ); |
|
179 |
|
180 /** |
|
181 * Get info (ie. scrolling speed) from the cenrep |
|
182 * @since S60 3.2.3 |
|
183 */ |
|
184 void GetInfoFromCenRepL(); |
|
185 |
|
186 /** |
|
187 * Updates the Navi pane with the appropriate speed text |
|
188 * @since S60 3.2.3 |
|
189 */ |
|
190 void SetNaviSpeedTextL( TBool boundaryReached ); |
|
191 |
|
192 /** |
|
193 * Handles key event down |
|
194 * @since S60 3.2.3 |
|
195 * @param aKeyEvent Key event |
|
196 */ |
|
197 TKeyResponse HandleEventKeyDownL( const TKeyEvent& aKeyEvent ); |
|
198 |
|
199 /** |
|
200 * Handles key event up |
|
201 * @since S60 3.2.3 |
|
202 * @param aKeyEvent Key event |
|
203 */ |
|
204 TKeyResponse HandleEventKeyUpL( const TKeyEvent& aKeyEvent ); |
|
205 |
|
206 /** |
|
207 * Enables/Disables Keysound |
|
208 * @since S60 3.2.3 |
|
209 * @param aEnable ETrue to enable key sound, EFalse to disable |
|
210 */ |
|
211 void EnableKeySoundL( TBool aEnable ); |
|
212 |
|
213 /** |
|
214 * Send an async command to the collection to update the index |
|
215 * @since S60 3.2.3 |
|
216 * @param aIndex index to set |
|
217 * @param aForceSet ETrue if speed scrolling checking should be bypassed |
|
218 */ |
|
219 void SetIndexToCollectionL( TInt aIndex, TBool aForceSet = EFalse ); |
|
220 |
|
221 /** |
|
222 * Handle collection message |
|
223 * @since S60 3.2.3 |
|
224 * @param aMessage collection message |
|
225 * @param aError Error code |
|
226 */ |
|
227 void DoHandleCollectionMessageL( CMPXMessage* aMessage, TInt aError ); |
|
228 |
|
229 // from base class MMdaAudioToneObserver |
|
230 /** |
|
231 * From MMdaAudioToneObserver. Called after tone has been initialized. |
|
232 * @since S60 3.2.3 |
|
233 * @param aError Error code |
|
234 */ |
|
235 void MatoPrepareComplete(TInt aError); |
|
236 |
|
237 /** |
|
238 * From MMdaAudioToneObserver. Called after tone has been played. |
|
239 * @since S60 3.2.3 |
|
240 * @param aError Error code |
|
241 */ |
|
242 void MatoPlayComplete(TInt aError); |
|
243 |
|
244 /** |
|
245 * From MMPXCollectionObserver |
|
246 * Handle collection message. |
|
247 * @since S60 3.2.3 |
|
248 * @param aMessage Collection message |
|
249 * @param aErr system error code. |
|
250 */ |
|
251 void HandleCollectionMessage( |
|
252 CMPXMessage* aMessage, TInt aError ); |
|
253 |
|
254 /** |
|
255 * From MMPXCollectionObserver |
|
256 * Handles the collection entries being opened. Typically called |
|
257 * when client has Open()'d a folder |
|
258 * |
|
259 * @since S60 3.2.3 |
|
260 * @param aEntries collection entries opened |
|
261 * @param aIndex focused entry |
|
262 * @param aComplete ETrue no more entries. EFalse more entries |
|
263 * expected |
|
264 * @param aError error code |
|
265 */ |
|
266 void HandleOpenL( |
|
267 const CMPXMedia& aEntries, |
|
268 TInt aIndex, |
|
269 TBool aComplete, |
|
270 TInt aError ); |
|
271 |
|
272 /** |
|
273 * From MMPXCollectionObserver |
|
274 * Handles the collection entries being opened. Typically called |
|
275 * when client has Open()'d an item. Client typically responds by |
|
276 * 'playing' the item |
|
277 * |
|
278 * @since S60 3.2.3 |
|
279 * @param aPlaylist collection path to item |
|
280 * @param aError error code |
|
281 */ |
|
282 void HandleOpenL( |
|
283 const CMPXCollectionPlaylist& aPlaylist, |
|
284 TInt aError ); |
|
285 |
|
286 /** |
|
287 * From MMPXCollectionObserver |
|
288 * Handle media properties |
|
289 * |
|
290 * @since S60 3.2.3 |
|
291 * @param aMedia media |
|
292 * @param aError error code |
|
293 */ |
|
294 void HandleCollectionMediaL( |
|
295 const CMPXMedia& aMedia, |
|
296 TInt aError ); |
|
297 |
|
298 private: // Data |
|
299 |
|
300 RWsSession iWsSession; |
|
301 CPeriodic* iTimer; |
|
302 CEikTextListBox* iLbx; |
|
303 TMPXKeyStatus iKeyStatus; |
|
304 TMPXScrollingStates iScrollingState; |
|
305 CMdaAudioToneUtility* iToneUtility; |
|
306 MMPXCollectionUtility* iCollectionUtility; |
|
307 |
|
308 // Contain info from shared data |
|
309 TInt iFirstBufferTime; |
|
310 TInt iSecondBufferTime; |
|
311 TInt iFirstSpeed; |
|
312 TInt iSecondSpeed; |
|
313 TInt iIndexCount; // counter for speed scolling set index check |
|
314 TInt iResourceOffset; // must be freed |
|
315 |
|
316 TBool iSpeedScrollEnabled; |
|
317 TBool iAutoLoopEnabled; |
|
318 TBool iNaviEnabled; |
|
319 TBool iKeysoundEnabled; |
|
320 TBool iSkipEvent; |
|
321 TBool iFirstKeyEvent; |
|
322 TBool iSkipPlaying; |
|
323 TBool iEnableSetIndex; |
|
324 |
|
325 //FOR NAVI PANE |
|
326 CAknNavigationDecorator* iNaviDecorator; |
|
327 CAknNaviLabel* iNaviLabel; |
|
328 CAknNavigationControlContainer* iNaviPane; |
|
329 }; |
|
330 |
|
331 #endif // MPXLBXEXTENDEDFEATURES_H |
|
332 |
|
333 // End of File |