|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * CFLDController observes the list box and invokes a MFLDFileProcessor |
|
16 * if the timer expires. |
|
17 * |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __CFLDCONTROLLER_H__ |
|
24 #define __CFLDCONTROLLER_H__ |
|
25 |
|
26 // INTERNAL INCLUDES |
|
27 #include "MFLDFileListBoxObserver.h" |
|
28 |
|
29 // EXTERNAL INCLUDES |
|
30 #include <e32base.h> |
|
31 #include <ConeResLoader.h> // For RConeResourceLoader |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class MFLDFileObserver; |
|
35 class MFLDFileProcessor; |
|
36 class RWindow; |
|
37 |
|
38 #ifdef RD_VIDEO_AS_RINGING_TONE |
|
39 class CFLDSoftKeyChanger; |
|
40 #endif |
|
41 |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * CFLDController observes the list box and invokes a MFLDFileProcessor |
|
46 * if the timer expires. |
|
47 * |
|
48 * @lib filelist.lib |
|
49 * @since 2.1 |
|
50 */ |
|
51 class CFLDController |
|
52 : public CBase, public MFLDFileListBoxObserver |
|
53 { |
|
54 |
|
55 private: // Enumerations |
|
56 |
|
57 // These match with the ones in Profile Engine |
|
58 enum TRingingTypes |
|
59 { |
|
60 ERingingTypeRinging = 0, |
|
61 ERingingTypeAscending, |
|
62 ERingingTypeRingOnce, |
|
63 ERingingTypeBeepOnce, |
|
64 ERingingTypeSilent |
|
65 }; |
|
66 public: // Constructors and destructors |
|
67 |
|
68 /** |
|
69 * Completes the construction of CFLDController. |
|
70 * @param aWindow A reference to window handle |
|
71 */ |
|
72 IMPORT_C void CompleteConstructionL( RWindow& aWindow ); |
|
73 |
|
74 /** |
|
75 * Destructor |
|
76 */ |
|
77 IMPORT_C virtual ~CFLDController(); |
|
78 |
|
79 /** |
|
80 * Two-phased static constructor. |
|
81 * @param aShowErrorMsgs Show an error note if the file format is not supported |
|
82 * @param aDelay The delay in microseconds until the timer expires |
|
83 * @return A pointer to a fully constructed CController instance |
|
84 */ |
|
85 IMPORT_C static CFLDController* NewL( TBool aShowErrorMsgs, |
|
86 TTimeIntervalMicroSeconds32 aDelay ); |
|
87 |
|
88 /** |
|
89 * Two-phased static constructor, leaves a pointer to cleanup stack |
|
90 * @param aShowErrorMsgs Show an error note if the file format is not supported |
|
91 * @param aDelay The delay in microseconds until the timer expires |
|
92 * @return A pointer to a fully constructed CController instance |
|
93 */ |
|
94 IMPORT_C static CFLDController* NewLC( TBool aShowErrorMsgs, |
|
95 TTimeIntervalMicroSeconds32 aDelay ); |
|
96 |
|
97 private: // Constructors and destructors |
|
98 |
|
99 /** |
|
100 * Constructor |
|
101 * @param aShowErrorMsgs Show an error note if the file format is not supported |
|
102 * @param aDelay The delay in microseconds until the timer expires |
|
103 */ |
|
104 CFLDController( TBool aShowErrorMsgs, |
|
105 TTimeIntervalMicroSeconds32 aDelay ); |
|
106 |
|
107 /** |
|
108 * Second phase constructor |
|
109 */ |
|
110 void ConstructL( ); |
|
111 |
|
112 public: // New methods |
|
113 |
|
114 /** |
|
115 * Set the delay until the timer expires. |
|
116 * @param aDelay The delay in microseconds |
|
117 */ |
|
118 IMPORT_C void SetDelay( TTimeIntervalMicroSeconds32 aDelay ); |
|
119 |
|
120 /** |
|
121 * Set the volume level on which the sound is played |
|
122 * If this method is not called, audio and video players |
|
123 * uses the setting in active profile. |
|
124 * @param aVolume The volume level |
|
125 */ |
|
126 IMPORT_C void SetVolume( TInt aVolume ); |
|
127 |
|
128 /** |
|
129 * Sets the ringing type |
|
130 * If this method is not called, audio and video players |
|
131 * uses the setting in active profile. |
|
132 * @param aRingingType The ringing type (see enum TRingingTypes) |
|
133 */ |
|
134 IMPORT_C void SetRingingType( TInt aRingingType ); |
|
135 |
|
136 /** |
|
137 * Sets vibrating alert on or off. |
|
138 * If this method is not called, audio and video players |
|
139 * uses the setting in active profile. |
|
140 * @param aVibra True: Vibra is on. False: Vibra is off. |
|
141 */ |
|
142 IMPORT_C void SetVibra( TBool aVibra ); |
|
143 |
|
144 /** |
|
145 * Sets the file observer for the class. |
|
146 * The file observer is asked if the file is ok to be processed. |
|
147 * @since 2.5 |
|
148 * @param aFileObserver Pointer to the file observer. |
|
149 */ |
|
150 IMPORT_C void SetFileObserver( MFLDFileObserver* aFileObserver ); |
|
151 |
|
152 /** |
|
153 * Sets 3d-effects on or off. |
|
154 * If this method is called using parameter EFalse 3d-effects are |
|
155 * always disabled even though those are set in active profile. |
|
156 * Otherwise toneplayer uses the setting in active profile. |
|
157 * @param a3dEffects True: 3dEffects are on. False: 3dEffects are off. |
|
158 */ |
|
159 IMPORT_C void Set3dEffects( TBool a3dEffects ); |
|
160 |
|
161 /** |
|
162 * Release allocated resources |
|
163 */ |
|
164 void Release(); |
|
165 |
|
166 private: // New methods |
|
167 |
|
168 /** |
|
169 * This callback method is called when the timer expires. Calls |
|
170 * MFLDFileProcessor::ProcessFileL(). |
|
171 * @param aPtr pointer to CFLDController |
|
172 * @return Returns always zero |
|
173 */ |
|
174 static TInt HandleTimerTickL( TAny* aPtr ); |
|
175 |
|
176 public: // Methods derived from MFLDFileListBoxObserver |
|
177 |
|
178 /** |
|
179 * Receives the event notification from the file list box |
|
180 */ |
|
181 IMPORT_C void HandleFileListBoxEventL( TFileListBoxEvent aEvent, |
|
182 const TDesC& aFileName ); |
|
183 /** |
|
184 * Passes softkey notifications to the file list box |
|
185 */ |
|
186 void HandleSoftKeyState( TFileListSoftKeyState& aSoftKeyState ); |
|
187 |
|
188 private: // Data |
|
189 |
|
190 /// Own: Pointer to the file handler |
|
191 MFLDFileProcessor* iAudioProcessor; |
|
192 |
|
193 #ifdef RD_VIDEO_AS_RINGING_TONE |
|
194 /// Own: Pointer to the file handler |
|
195 MFLDFileProcessor* iVideoProcessor; |
|
196 #endif |
|
197 /// Own: Pointer to timer |
|
198 CPeriodic* iTimer; |
|
199 |
|
200 /// Ref: Pointer to window |
|
201 RWindow* iWindow; |
|
202 |
|
203 /// Currently focused file in the list |
|
204 TFileName iCurrentFile; |
|
205 |
|
206 /// The delay in microseconds until timer expires |
|
207 TTimeIntervalMicroSeconds32 iDelay; |
|
208 |
|
209 /// Ref: Pointer to file observer |
|
210 MFLDFileObserver* iFileObserver; |
|
211 |
|
212 #ifdef RD_VIDEO_AS_RINGING_TONE |
|
213 /// Own: Pointer to the sofkey changer |
|
214 CFLDSoftKeyChanger* iSoftKeyChanger; |
|
215 #endif |
|
216 /// Ringingvolume |
|
217 TInt iRingingVolume; |
|
218 |
|
219 /// Ringingtype |
|
220 TInt iRingingType; |
|
221 |
|
222 /// Vibrasetting (on/off) |
|
223 TBool iVibra; |
|
224 |
|
225 /// Show errors |
|
226 TBool iShowErrorMsgs; |
|
227 |
|
228 /// Resourceloader which loads used resources |
|
229 RConeResourceLoader iResourceLoader; |
|
230 |
|
231 /// 3DSettings (on/off) |
|
232 TBool i3dEffects; |
|
233 |
|
234 }; |
|
235 |
|
236 #endif // __CFLDCONTROLLER_H__ |
|
237 |
|
238 // End of File |