1 /* |
|
2 * Copyright (c) 2007-2010 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 for creating, initializing and observing* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "CamCaptureSetupControlHandler.h" |
|
22 #include "CamAppController.h" |
|
23 #include "CamLogger.h" |
|
24 |
|
25 #include "CamCaptureSetupListBox.h" |
|
26 #include <cameraapp.rsg> |
|
27 #include <vgacamsettings.rsg> |
|
28 #include "CamCaptureSetupSlider.h" |
|
29 |
|
30 #include "CamUtility.h" |
|
31 #include "CameraUiConfigManager.h" |
|
32 |
|
33 #include <AknUtils.h> |
|
34 |
|
35 // CONSTANTS |
|
36 |
|
37 |
|
38 // ============================ MEMBER FUNCTIONS =============================== |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CCamCaptureSetupControlHandler::CCamCaptureSetupControlHandler |
|
42 // Constructor |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 CCamCaptureSetupControlHandler::CCamCaptureSetupControlHandler( |
|
46 CCamAppController& aController, |
|
47 TCamSettingItemIds aSettingType ) |
|
48 : iController( aController ), iSettingType( aSettingType) |
|
49 { |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CCamCaptureSetupControlHandler Destructor |
|
54 // |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 CCamCaptureSetupControlHandler::~CCamCaptureSetupControlHandler() |
|
58 { |
|
59 PRINT( _L("Camera => ~CCamCaptureSetupControlHandler") ); |
|
60 PRINT( _L("Camera <= ~CCamCaptureSetupControlHandler") ); |
|
61 } |
|
62 |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CCamCaptureSetupControlHandler::CreateCaptureSetupControlL |
|
66 // Create a new capture setup control with self as observer. |
|
67 // Ownership is transferred to the calling class. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 CCoeControl* CCamCaptureSetupControlHandler::CreateCaptureSetupControlL( const CCoeControl* aParent, |
|
71 TBool aSkinnedBackGround ) |
|
72 { |
|
73 // create a new control determined by iSettingType. |
|
74 // set self as observer |
|
75 switch( iSettingType ) |
|
76 { |
|
77 case ECamSettingItemDynamicPhotoExposure: |
|
78 case ECamSettingItemUserSceneExposure: |
|
79 case ECamSettingItemDynamicPhotoBrightness: |
|
80 case ECamSettingItemDynamicPhotoContrast: |
|
81 case ECamSettingItemDynamicVideoBrightness: |
|
82 case ECamSettingItemDynamicVideoContrast: |
|
83 case ECamSettingItemUserSceneBrightness: |
|
84 case ECamSettingItemUserSceneContrast: |
|
85 { |
|
86 // create and return a slider control |
|
87 CCamCaptureSetupSlider* captureSetupControl = |
|
88 CCamCaptureSetupSlider::NewL( aParent, this, iSettingType, 0, aSkinnedBackGround ); |
|
89 CleanupStack::PushL( captureSetupControl ); |
|
90 captureSetupControl->InitializeL |
|
91 ( iController.IntegerSettingValue( iSettingType ) ); |
|
92 CleanupStack::Pop( captureSetupControl ); |
|
93 |
|
94 // pass ownership of the control to the calling class |
|
95 return captureSetupControl; |
|
96 } |
|
97 default: |
|
98 { |
|
99 TInt resourceId = ResourceForControl(); |
|
100 if ( resourceId != 0 ) |
|
101 { |
|
102 // create and return a radio-button listbox |
|
103 CCamCaptureSetupListBox* captureSetupControl = |
|
104 new( ELeave ) CCamCaptureSetupListBox( this, |
|
105 iController, aSkinnedBackGround ); |
|
106 |
|
107 CleanupStack::PushL( captureSetupControl ); |
|
108 captureSetupControl->ConstructL( aParent, resourceId, iSettingType ); |
|
109 captureSetupControl->InitializeL |
|
110 ( iController.IntegerSettingValue( iSettingType ) ); |
|
111 CleanupStack::Pop( captureSetupControl ); |
|
112 if( iSettingType == ECamSettingItemDynamicPhotoColourFilter || |
|
113 iSettingType == ECamSettingItemDynamicPhotoWhiteBalance || |
|
114 iSettingType == ECamSettingItemDynamicPhotoImageSharpness || |
|
115 |
|
116 iSettingType == ECamSettingItemDynamicVideoColourFilter || |
|
117 iSettingType == ECamSettingItemDynamicVideoWhiteBalance || |
|
118 iSettingType == ECamSettingItemDynamicVideoBrightness || |
|
119 |
|
120 iSettingType == ECamSettingItemUserSceneImageSharpness || |
|
121 iSettingType == ECamSettingItemUserSceneWhitebalance || |
|
122 iSettingType == ECamSettingItemUserSceneColourFilter ) |
|
123 { |
|
124 captureSetupControl->DisableSingleClick( ETrue ); |
|
125 } |
|
126 // pass ownership of the control to the calling class |
|
127 return captureSetupControl; |
|
128 } |
|
129 } |
|
130 break; |
|
131 } |
|
132 return NULL; |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CCamCaptureSetupControlHandler::HandleSettingValueUpdateL |
|
137 // Update the camera setting to the new value |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void CCamCaptureSetupControlHandler::HandleSettingValueUpdateL( TInt aNewValue ) |
|
141 { |
|
142 PRINT( _L("Camera => CCamCaptureSetupControlHandler::HandleSettingValueUpdateL" )) |
|
143 iController.PreviewSettingChangeL( iSettingType, aNewValue ); |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CCamCaptureSetupControlHandler::ControlTitleResourceId |
|
148 // Return the resource id of the text to display in the title pane |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 TInt CCamCaptureSetupControlHandler::ControlTitleResourceId() const |
|
152 { |
|
153 TInt resourceId = 0; |
|
154 switch ( iSettingType ) |
|
155 { |
|
156 case ECamSettingItemDynamicPhotoWhiteBalance: // fallthrough |
|
157 case ECamSettingItemDynamicVideoWhiteBalance: |
|
158 case ECamSettingItemUserSceneWhitebalance: |
|
159 { |
|
160 resourceId = R_CAM_CAPTURE_SETUP_TITLE_NAME_WHITEBALANCE; |
|
161 } |
|
162 break; |
|
163 case ECamSettingItemDynamicVideoColourFilter: // fallthrough |
|
164 case ECamSettingItemDynamicPhotoColourFilter: |
|
165 case ECamSettingItemUserSceneColourFilter: |
|
166 { |
|
167 resourceId = R_CAM_CAPTURE_SETUP_TITLE_NAME_COLOUREFFECT; |
|
168 } |
|
169 break; |
|
170 |
|
171 case ECamSettingItemDynamicPhotoExposure: |
|
172 case ECamSettingItemUserSceneExposure: |
|
173 { |
|
174 resourceId = R_CAM_CAPTURE_SETUP_TITLE_NAME_EV; |
|
175 } |
|
176 break; |
|
177 |
|
178 case ECamSettingItemDynamicPhotoFlash: |
|
179 case ECamSettingItemUserSceneFlash: |
|
180 { |
|
181 resourceId = R_CAM_CAPTURE_SETUP_TITLE_NAME_FLASH; |
|
182 } |
|
183 break; |
|
184 case ECamSettingItemDynamicPhotoBrightness: |
|
185 case ECamSettingItemDynamicVideoBrightness: |
|
186 case ECamSettingItemUserSceneBrightness: |
|
187 { |
|
188 resourceId = R_CAM_CAPTURE_SETUP_TITLE_NAME_BRIGHTNESS; |
|
189 } |
|
190 break; |
|
191 case ECamSettingItemDynamicPhotoContrast: |
|
192 case ECamSettingItemDynamicVideoContrast: |
|
193 case ECamSettingItemUserSceneContrast: |
|
194 { |
|
195 resourceId = R_CAM_CAPTURE_SETUP_TITLE_NAME_CONTRAST; |
|
196 } |
|
197 break; |
|
198 case ECamSettingItemDynamicPhotoImageSharpness: |
|
199 case ECamSettingItemUserSceneImageSharpness: |
|
200 { |
|
201 resourceId = R_CAM_CAPTURE_SETUP_TITLE_NAME_IMAGESHARPNESS; |
|
202 } |
|
203 break; |
|
204 case ECamSettingItemDynamicSelfTimer: |
|
205 { |
|
206 resourceId = R_CAM_CAPTURE_SETUP_TITLE_NAME_SELF_TIMER; |
|
207 break; |
|
208 } |
|
209 case ECamSettingItemUserSceneLightSensitivity: |
|
210 case ECamSettingItemDynamicPhotoLightSensitivity: |
|
211 case ECamSettingItemDynamicVideoLightSensitivity: |
|
212 { |
|
213 resourceId = R_CAM_CAPTURE_SETUP_TITLE_NAME_LIGHT_SENSITIVITY; |
|
214 } |
|
215 break; |
|
216 default: |
|
217 break; |
|
218 } |
|
219 return resourceId; |
|
220 } |
|
221 |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // CCamCaptureSetupControlHandler::ControlPositionResourceId |
|
225 // Return the resource id for the control's position. |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 TInt CCamCaptureSetupControlHandler::ControlPositionResourceId() const |
|
229 { |
|
230 TInt resourceId = 0; |
|
231 switch ( iSettingType ) |
|
232 { |
|
233 case ECamSettingItemDynamicPhotoWhiteBalance: // fallthrough |
|
234 case ECamSettingItemDynamicVideoWhiteBalance: |
|
235 case ECamSettingItemDynamicVideoColourFilter: |
|
236 case ECamSettingItemDynamicPhotoColourFilter: |
|
237 case ECamSettingItemDynamicPhotoFlash: |
|
238 case ECamSettingItemDynamicSelfTimer: |
|
239 case ECamSettingItemUserSceneWhitebalance: |
|
240 case ECamSettingItemUserSceneColourFilter: |
|
241 case ECamSettingItemUserSceneFlash: |
|
242 case ECamSettingItemDynamicPhotoImageSharpness: |
|
243 case ECamSettingItemUserSceneImageSharpness: |
|
244 case ECamSettingItemUserSceneLightSensitivity: |
|
245 case ECamSettingItemDynamicPhotoLightSensitivity: |
|
246 case ECamSettingItemDynamicVideoLightSensitivity: |
|
247 { |
|
248 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
249 { |
|
250 resourceId = ROID(R_CAM_CAPTURE_SETUP_CONTROL_POSITION_ID); |
|
251 } |
|
252 else |
|
253 { |
|
254 resourceId = ROID(R_CAM_CAPTURE_SETUP_CONTROL_POSITION_AH_ID); |
|
255 } |
|
256 } |
|
257 break; |
|
258 |
|
259 case ECamSettingItemDynamicPhotoExposure: // fallthrough |
|
260 case ECamSettingItemUserSceneExposure: |
|
261 |
|
262 case ECamSettingItemDynamicPhotoBrightness: |
|
263 case ECamSettingItemDynamicVideoBrightness: |
|
264 case ECamSettingItemDynamicPhotoContrast: |
|
265 case ECamSettingItemDynamicVideoContrast: |
|
266 case ECamSettingItemUserSceneBrightness: |
|
267 case ECamSettingItemUserSceneContrast: |
|
268 |
|
269 { |
|
270 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
271 { |
|
272 resourceId = ROID(R_CAM_CAPTURE_SETUP_SLIDER_CONTROL_POSITION_ID); |
|
273 } |
|
274 else |
|
275 { |
|
276 resourceId = ROID(R_CAM_CAPTURE_SETUP_SLIDER_CONTROL_POSITION_AH_ID); |
|
277 } |
|
278 break; |
|
279 } |
|
280 default: |
|
281 break; |
|
282 } |
|
283 return resourceId; |
|
284 } |
|
285 |
|
286 // ----------------------------------------------------------------------------- |
|
287 // CCamCaptureSetupControlHandler::ControlUsesViewFinder |
|
288 // Whether or not the control requires a viewfinder preview pane |
|
289 // ----------------------------------------------------------------------------- |
|
290 // |
|
291 TBool CCamCaptureSetupControlHandler::ControlUsesViewFinder() const |
|
292 { |
|
293 return ETrue; |
|
294 } |
|
295 |
|
296 |
|
297 // ----------------------------------------------------------------------------- |
|
298 // CCamCaptureSetupControlHandler::ControlIsListBox |
|
299 // Whether or not the control is of listbox type |
|
300 // ----------------------------------------------------------------------------- |
|
301 // |
|
302 TBool CCamCaptureSetupControlHandler::ControlIsListBox() const |
|
303 { |
|
304 return ( ( iSettingType != ECamSettingItemDynamicPhotoExposure ) |
|
305 && ( iSettingType != ECamSettingItemUserSceneExposure ) |
|
306 && ( iSettingType != ECamSettingItemDynamicPhotoBrightness ) |
|
307 && ( iSettingType != ECamSettingItemDynamicPhotoContrast ) |
|
308 && ( iSettingType != ECamSettingItemDynamicVideoBrightness ) |
|
309 && ( iSettingType != ECamSettingItemDynamicVideoContrast ) |
|
310 && ( iSettingType != ECamSettingItemUserSceneBrightness ) |
|
311 && ( iSettingType != ECamSettingItemUserSceneContrast ) |
|
312 ); |
|
313 } |
|
314 |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // CCamCaptureSetupControlHandler::ControlIsSlider |
|
318 // Whether or not the control is of slider type |
|
319 // ----------------------------------------------------------------------------- |
|
320 // |
|
321 TBool CCamCaptureSetupControlHandler::ControlIsSlider() const |
|
322 { |
|
323 return ( ( iSettingType == ECamSettingItemDynamicPhotoExposure ) |
|
324 || ( iSettingType == ECamSettingItemUserSceneExposure ) |
|
325 || ( iSettingType == ECamSettingItemDynamicPhotoBrightness ) |
|
326 || ( iSettingType == ECamSettingItemDynamicPhotoContrast ) |
|
327 || ( iSettingType == ECamSettingItemDynamicVideoBrightness ) |
|
328 || ( iSettingType == ECamSettingItemDynamicVideoContrast ) |
|
329 || ( iSettingType == ECamSettingItemUserSceneBrightness ) |
|
330 || ( iSettingType == ECamSettingItemUserSceneContrast ) |
|
331 ); |
|
332 } |
|
333 |
|
334 |
|
335 // ----------------------------------------------------------------------------- |
|
336 // CCamCaptureSetupControlHandler::ResourceForControl |
|
337 // Return the resource for list population |
|
338 // ----------------------------------------------------------------------------- |
|
339 // |
|
340 TInt CCamCaptureSetupControlHandler::ResourceForControl() const |
|
341 { |
|
342 TInt resourceId = 0; |
|
343 switch ( iSettingType ) |
|
344 { |
|
345 case ECamSettingItemDynamicPhotoWhiteBalance:// fallthrough |
|
346 case ECamSettingItemUserSceneWhitebalance: |
|
347 resourceId = ROID(R_CAM_CAPTURE_SETUP_LIST_STILL_WHITEBALANCE_ID); |
|
348 break; |
|
349 case ECamSettingItemDynamicPhotoColourFilter:// fallthrough |
|
350 case ECamSettingItemUserSceneColourFilter: |
|
351 resourceId = ROID(R_CAM_CAPTURE_SETUP_LIST_STILL_COLOUREFFECT_ID); |
|
352 break; |
|
353 case ECamSettingItemDynamicPhotoFlash:// fallthrough |
|
354 case ECamSettingItemUserSceneFlash: |
|
355 resourceId = ROID(R_CAM_CAPTURE_SETUP_LIST_STILL_FLASH_ID); |
|
356 break; |
|
357 case ECamSettingItemDynamicVideoWhiteBalance: |
|
358 resourceId = ROID(R_CAM_CAPTURE_SETUP_LIST_VIDEO_WHITEBALANCE_ID); |
|
359 break; |
|
360 case ECamSettingItemDynamicVideoColourFilter: |
|
361 resourceId = ROID(R_CAM_CAPTURE_SETUP_LIST_VIDEO_COLOUREFFECT_ID); |
|
362 break; |
|
363 case ECamSettingItemDynamicPhotoImageSharpness: |
|
364 case ECamSettingItemUserSceneImageSharpness: |
|
365 resourceId = ROID(R_CAM_CAPTURE_SETUP_LIST_PHOTO_IMAGESHARPNESS_ID); |
|
366 break; |
|
367 case ECamSettingItemDynamicSelfTimer: |
|
368 resourceId = ROID(R_CAM_CAPTURE_SETUP_SELF_TIMER_ID); |
|
369 break; |
|
370 case ECamSettingItemUserSceneLightSensitivity: |
|
371 case ECamSettingItemDynamicPhotoLightSensitivity: |
|
372 case ECamSettingItemDynamicVideoLightSensitivity: |
|
373 if ( iController.UiConfigManagerPtr()->IsExtendedLightSensitivitySupported()) |
|
374 { |
|
375 resourceId = R_CAM_CAPTURE_SETUP_STILL_EXTENDED_LIGHT_SENSITIVITY; |
|
376 } |
|
377 else |
|
378 { |
|
379 resourceId = R_CAM_CAPTURE_SETUP_STILL_LIGHT_SENSITIVITY; |
|
380 } |
|
381 break; |
|
382 default: |
|
383 break; |
|
384 } |
|
385 return resourceId; |
|
386 } |
|
387 |
|
388 |
|
389 // ----------------------------------------------------------------------------- |
|
390 // CCamCaptureSetupControlHandler::ViewfinderResourceId |
|
391 // Return the viewfinder resource to use for the appropriate control |
|
392 // ----------------------------------------------------------------------------- |
|
393 // |
|
394 TInt CCamCaptureSetupControlHandler::ViewfinderResourceId() const |
|
395 { |
|
396 TInt resourceId = 0; |
|
397 switch ( iSettingType ) |
|
398 { |
|
399 case ECamSettingItemDynamicPhotoBrightness: |
|
400 case ECamSettingItemDynamicVideoBrightness: |
|
401 case ECamSettingItemDynamicPhotoContrast: |
|
402 case ECamSettingItemDynamicVideoContrast: |
|
403 case ECamSettingItemUserSceneBrightness: |
|
404 case ECamSettingItemUserSceneContrast: |
|
405 case ECamSettingItemDynamicPhotoExposure: |
|
406 case ECamSettingItemDynamicVideoExposure: |
|
407 { |
|
408 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
409 { |
|
410 resourceId = ROID(R_CAM_CAPTURE_SETUP_SLIDER_CONTVF_RECT_ID); |
|
411 } |
|
412 else |
|
413 { |
|
414 resourceId = ROID(R_CAM_CAPTURE_SETUP_SLIDER_CONTVF_RECT_AH_ID); |
|
415 } |
|
416 } |
|
417 break; |
|
418 default: |
|
419 { |
|
420 if ( !AknLayoutUtils::LayoutMirrored() ) |
|
421 { |
|
422 resourceId = ROID(R_CAM_CAPTURE_SETUP_CONTVF_RECT_ID); |
|
423 } |
|
424 else |
|
425 { |
|
426 resourceId = ROID(R_CAM_CAPTURE_SETUP_CONTVF_RECT_AH_ID); |
|
427 } |
|
428 } |
|
429 break; |
|
430 } |
|
431 return resourceId; |
|
432 } |
|
433 |
|
434 // ----------------------------------------------------------------------------- |
|
435 // CCamCaptureSetupControlHandler::SettingType |
|
436 // Identifies which setting is being edited |
|
437 // ----------------------------------------------------------------------------- |
|
438 // |
|
439 TCamSettingItemIds CCamCaptureSetupControlHandler::SettingType() const |
|
440 { |
|
441 return iSettingType; |
|
442 } |
|
443 |
|
444 |
|
445 // End of file |
|