1 /* |
|
2 * Copyright (c) 2007 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: Implements the quality slider for image and video settings* |
|
15 */ |
|
16 |
|
17 |
|
18 #ifndef GSCAMQUALITYSETTINGCONTAINER_H |
|
19 #define GSCAMQUALITYSETTINGCONTAINER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <bldvariant.hrh> |
|
23 #include <coecntrl.h> |
|
24 #include <AknUtils.h> |
|
25 #include "CamSettingValueObserver.h" |
|
26 #include "GSCamQualitySettingSlider.h" |
|
27 #include "CamControllerObservers.h" |
|
28 |
|
29 // CONSTANTS |
|
30 const TInt KMaxTextLength = 40; |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CCamCaptureSetupSlider; |
|
34 class MAknQueryValue; |
|
35 |
|
36 class CCamConfiguration; |
|
37 class MTouchFeedback; |
|
38 |
|
39 enum TCamCameraStateFlags |
|
40 { |
|
41 ECamIdle = 0, |
|
42 ECamReserved = 1<<0, |
|
43 ECamPowerOn = 1<<1, |
|
44 ECamVFOn = 1<<2, |
|
45 ECamImageOn = 1<<3, |
|
46 ECamVideoOn = 1<<4 |
|
47 // ECamCaptureOn = 1<<5 |
|
48 }; |
|
49 /** |
|
50 * Implements the quality slider control and descriptive texts |
|
51 * |
|
52 * @since 2.8 |
|
53 */ |
|
54 class CGSCamQualitySettingContainer : public CCoeControl, |
|
55 public MCamSettingValueObserver, |
|
56 public MCamControllerObserver |
|
57 { |
|
58 public: // Constructors and destructor |
|
59 |
|
60 /** |
|
61 * Two-phased constructor. |
|
62 * @since 2.8 |
|
63 * @param aController reference to the app controller |
|
64 * @param aMode the current capture mode |
|
65 * @param aParent this control's parent |
|
66 * @return pointer to a new quality container |
|
67 */ |
|
68 static CGSCamQualitySettingContainer* NewL( MCamAppController& aController, |
|
69 TCamCameraMode aMode, |
|
70 CCoeControl* aParent ); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 virtual ~CGSCamQualitySettingContainer(); |
|
76 |
|
77 public: // New functions |
|
78 |
|
79 /** |
|
80 * Returns the selected quality |
|
81 * @since 2.8 |
|
82 * @return the selected quality |
|
83 */ |
|
84 TInt SelectedQuality() const; |
|
85 |
|
86 public: // Functions from base classes |
|
87 |
|
88 /** |
|
89 * From CCoeControl |
|
90 * Constructs the control from a resource |
|
91 * @since 2.8 |
|
92 * @param aReader the resource reader |
|
93 */ |
|
94 void ConstructFromResourceL( TResourceReader& aReader ); |
|
95 |
|
96 /** |
|
97 * From CCoeControl |
|
98 * Standard CCoeControl routine to return the number of component controls |
|
99 * @since 2.8 |
|
100 * @return the number of component controls |
|
101 */ |
|
102 TInt CountComponentControls() const; |
|
103 |
|
104 /** |
|
105 * From CCoeControl |
|
106 * Standard CCoeControl routine to return the control at a given index |
|
107 * @since 2.8 |
|
108 * @param anIndex index at which to return control |
|
109 * @return the control at the given index |
|
110 */ |
|
111 CCoeControl* ComponentControl( TInt anIndex ) const; |
|
112 |
|
113 /** |
|
114 * From CCoeControl |
|
115 * Draws the controls |
|
116 * @since 2.8 |
|
117 * @param aRect the invlaid rect to draw |
|
118 */ |
|
119 void Draw( const TRect& aRect ) const; |
|
120 |
|
121 /** |
|
122 * From CCoeControl |
|
123 * Called when the size of the control changes |
|
124 * @since 2.8 |
|
125 */ |
|
126 void SizeChanged(); |
|
127 |
|
128 /** |
|
129 * From CCoeControl |
|
130 * Offers a key event to the control |
|
131 * @since 2.8 |
|
132 * @param aKeyEvent the key event offered |
|
133 * @param aType the type key event |
|
134 * @return whether the key was handled |
|
135 */ |
|
136 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
137 |
|
138 /** |
|
139 * From MCamSettingValueObserver |
|
140 * Handles a change in the slider value |
|
141 * @since 2.8 |
|
142 * @param aNewValue the new value of the setting |
|
143 */ |
|
144 void HandleSettingValueUpdateL( TInt aNewValue ); |
|
145 |
|
146 public: // From MCamControllerObserver |
|
147 /** |
|
148 * From MCamControllerObserver |
|
149 * Handles an event from the controller |
|
150 * @since 2.8 |
|
151 * @param aEvent the event that the controller sends out |
|
152 * @param aError KErrNone if the operation that cause the event was successful |
|
153 */ |
|
154 void HandleControllerEventL( TCamControllerEvent aEvent, TInt aError ); |
|
155 |
|
156 protected: // New functions |
|
157 |
|
158 protected: // Functions from base classes |
|
159 |
|
160 private: |
|
161 |
|
162 /** |
|
163 * C++ default constructor. |
|
164 * @since 2.8 |
|
165 * @param aController reference to the app controller |
|
166 * @param aMode the current capture mode |
|
167 * @param aParent this control's parent |
|
168 */ |
|
169 CGSCamQualitySettingContainer( MCamAppController& aController, |
|
170 TCamCameraMode aMode, |
|
171 CCoeControl* aParent ); |
|
172 |
|
173 /** |
|
174 * By default Symbian 2nd phase constructor is private. |
|
175 * @since 2.8 |
|
176 */ |
|
177 void ConstructL(); |
|
178 |
|
179 /** |
|
180 * Reads the layout from a resource file |
|
181 * @since 2.8 |
|
182 */ |
|
183 void ReadLayoutL(); |
|
184 |
|
185 /** |
|
186 * Draws the quality description texts for image/video |
|
187 * @since 2.8 |
|
188 * @param aGc The graphics context to draw to |
|
189 */ |
|
190 void DrawQualityTexts( CWindowGc& aGc, TRgb aColor ) const; |
|
191 |
|
192 /** |
|
193 * Draws the storage icon for image/video |
|
194 * @since 2.8 |
|
195 * @param aGc The graphics context to draw to |
|
196 */ |
|
197 void DrawStorageIcon( CWindowGc& aGc ) const; |
|
198 |
|
199 /** |
|
200 * Draws the remaining image count/video time remaining |
|
201 * @since 2.8 |
|
202 * @param aGc The graphics context to draw to |
|
203 */ |
|
204 void DrawRemainingText( CWindowGc& aGc ) const; |
|
205 |
|
206 /** |
|
207 * Queries the controller to update the remaining time text |
|
208 * @since 2.8 |
|
209 */ |
|
210 void UpdateRemainingTextL(); |
|
211 |
|
212 /** |
|
213 * Resets the remaing time/images text. |
|
214 */ |
|
215 void ResetRemainingTextL(); |
|
216 |
|
217 /** |
|
218 * Populates a text array from the resource definition of available |
|
219 * quality texts using the supported quality values |
|
220 * @since 3.0 |
|
221 * @param aReader the resource reader with the array of available texts |
|
222 * @param aArray the array to populate |
|
223 */ |
|
224 void ReadInTextArrayL( TResourceReader& aReader, CDesCArrayFlat& aArray ); |
|
225 |
|
226 public: // Data |
|
227 |
|
228 protected: // Data |
|
229 |
|
230 private: // Data |
|
231 // the app controller interface |
|
232 MCamAppController& iController; |
|
233 |
|
234 // the parent control |
|
235 CCoeControl* iParent; |
|
236 // the selected quality settings |
|
237 TInt iSelectedQuality; |
|
238 // phone storage location bitmap |
|
239 CFbsBitmap* iPhoneIcon; |
|
240 // phone storage location mask |
|
241 CFbsBitmap* iPhoneIconMask; |
|
242 // MMC storage location bitmap |
|
243 CFbsBitmap* iMMCIcon; |
|
244 // MMC storage location mask |
|
245 CFbsBitmap* iMMCIconMask; |
|
246 // mass storage storage location bitmap |
|
247 CFbsBitmap* iMassStorageIcon; |
|
248 // mass storage storage location mask |
|
249 CFbsBitmap* iMassStorageIconMask; |
|
250 // The text in the title pane |
|
251 HBufC* iTextTitle; |
|
252 // The subtitle text at top of page |
|
253 HBufC* iTextTopSubtitle; |
|
254 // The subtitle text at bottom of page |
|
255 HBufC* iTextBottomSubtitle; |
|
256 // The title for the remaining time text |
|
257 HBufC* iTextRemainingTitle; |
|
258 // The remaining count/time text |
|
259 TBuf<KMaxTextLength> iTextRemaining; |
|
260 // Format string for remaining time |
|
261 HBufC* iTimeFormat; |
|
262 |
|
263 // Array of all quality titles |
|
264 CDesCArrayFlat* iTitleArray; |
|
265 // Array of all quality descriptions |
|
266 CDesCArrayFlat* iDescArray; |
|
267 // Array of the enumeration mapping to the titles |
|
268 RArray<TInt> iEnumArray; |
|
269 // Array of quality description lines |
|
270 CArrayFixFlat<TPtrC>* iCurrentDescLineArray; |
|
271 // The layout of the quality title |
|
272 TAknLayoutText iLayoutSettingTitle; |
|
273 // the layout for the rect containing all description text |
|
274 TAknLayoutRect iLayoutDescRect; |
|
275 // Array of layouts for each of the lines in the quality decription |
|
276 RArray<TAknLayoutText> iLayoutSettingDescLines; |
|
277 // The layout for the remaining title text |
|
278 TAknLayoutText iLayoutRemainingTitle; |
|
279 // The layout for the remaining images/video time |
|
280 TAknLayoutText iLayoutRemainingText; |
|
281 // The layout for the storage icon |
|
282 TAknLayoutRect iLayoutIcon; |
|
283 // The slider control |
|
284 CGSCamQualitySettingSlider* iSlider; |
|
285 // The current capture mode (video/still) |
|
286 TCamCameraMode iMode; |
|
287 // The current storage location |
|
288 TCamMediaStorage iStorageLocation; |
|
289 |
|
290 // Array of supported qualities |
|
291 RArray<TInt> iSupportedQualitiesArray; |
|
292 |
|
293 // ETrue if remaining video recording time for current video quality |
|
294 // is known, so remaining time and storage icon can be drawn. |
|
295 TBool iRemainingVideoTimeKnown; |
|
296 |
|
297 // Configuration Manager |
|
298 CCamConfiguration* iConfiguration; |
|
299 |
|
300 MTouchFeedback* iFeedback; // not own |
|
301 }; |
|
302 |
|
303 #endif // GSCAMQUALITYSETTINGCONTAINER_H |
|
304 |
|
305 // End of File |
|