|
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: Image settings list class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <bldvariant.hrh> |
|
22 #include <CAknMemorySelectionSettingItem.h> // CAknMemorySelectionSettingItem |
|
23 #include <featmgr.h> |
|
24 #include <gscamerapluginrsc.rsg> |
|
25 #include <StringLoader.h> |
|
26 #include <AknQueryDialog.h> |
|
27 #include <AknWaitDialog.h> |
|
28 #include <CAknMemorySelectionSettingItemMultiDrive.h> |
|
29 #include <driveinfo.h> // DriveInfo |
|
30 |
|
31 #include "GSCamcorderPlugin.hrh" |
|
32 #include "Cam.hrh" |
|
33 #include "CamSettings.hrh" |
|
34 #include "CamSettingsInternal.hrh" |
|
35 #include "CamPanic.h" |
|
36 #include "CamAppUiBase.h" |
|
37 #include "CamUtility.h" |
|
38 #include "MCamAppController.h" |
|
39 #include "GSCamPhotoSettingsList.h" |
|
40 #include "GSCamcorderPlugin.h" |
|
41 #include "GSCamQualitySettingItem.h" |
|
42 #include "GSCustomQualitySettingItem.h" |
|
43 #include "GSCamDefaultNameSettingItem.h" |
|
44 #include "CameraUiConfigManager.h" |
|
45 #include "CamCollectionManagerAo.h" |
|
46 #include "CamWaitDialog.h" |
|
47 #include "CamLocationSettingItem.h" |
|
48 #include "camconfiguration.h" |
|
49 |
|
50 // ========================= MEMBER FUNCTIONS ================================ |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // CGSCamPhotoSettingsList::CGSCamPhotoSettingsList |
|
54 // C++ constructor |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 CGSCamPhotoSettingsList::CGSCamPhotoSettingsList( CCamStaticSettingsModel& aModel ) |
|
58 : iModel( aModel ) |
|
59 { |
|
60 } |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // CGSCamPhotoSettingsList::ConstructL |
|
65 // Symbian OS 2nd phase constructor |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 void CGSCamPhotoSettingsList::ConstructL( TBool aLaunchedFromGS, |
|
69 TBool aSecondaryCameraSettings ) |
|
70 { |
|
71 CAknViewAppUi *AppUi = static_cast<CAknViewAppUi*> |
|
72 ( CCoeEnv::Static()->AppUi() ); |
|
73 |
|
74 CGSCamcorderPlugin* parent = static_cast<CGSCamcorderPlugin*> |
|
75 ( AppUi->View( KGSCamcorderGSPluginUid ) ); |
|
76 if ( parent ) |
|
77 { |
|
78 parent->LoadVideoStaticSettingsL( ETrue ); |
|
79 parent->LoadPhotoStaticSettingsL( ETrue ); |
|
80 } |
|
81 |
|
82 iLaunchedFromGS = aLaunchedFromGS; |
|
83 iSecondaryCameraSettings = aSecondaryCameraSettings; |
|
84 iSettings.ResetAndDestroy(); |
|
85 iModel.Configuration().GetPsiIntArrayL( ECamPsiSupportedStillQualities, iSupportedQualityLevels ); |
|
86 |
|
87 TInt resId; |
|
88 if ( iModel.UiConfigManagerPtr() && |
|
89 iModel.UiConfigManagerPtr()->IsLocationSupported() ) |
|
90 { |
|
91 resId = R_CAM_PHOTO_SETTINGS_WITH_LOCATION_ITEM_LIST_CAMCORDER; |
|
92 } |
|
93 else |
|
94 { |
|
95 resId = R_CAM_PHOTO_SETTINGS_ITEM_LIST_CAMCORDER; |
|
96 } |
|
97 |
|
98 if ( iSecondaryCameraSettings ) |
|
99 { |
|
100 resId = R_CAM_VIDEO_SETTINGS_ITEM_LIST_PORTRAIT; |
|
101 } |
|
102 |
|
103 if ( iSecondaryCameraSettings ) |
|
104 { |
|
105 resId = R_CAM_PHOTO_SETTINGS_ITEM_LIST_PORTRAIT; |
|
106 } |
|
107 ConstructFromResourceL( resId ); |
|
108 } |
|
109 |
|
110 |
|
111 // Destructor |
|
112 CGSCamPhotoSettingsList::~CGSCamPhotoSettingsList() |
|
113 { |
|
114 iSettings.ResetAndDestroy(); |
|
115 iSettings.Close(); |
|
116 iSupportedQualityLevels.Close(); |
|
117 } |
|
118 |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // CGSCamPhotoSettingsList::CreateSettingItemL |
|
122 // From CAknSettingItemList Handles creating setting items |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 CAknSettingItem* CGSCamPhotoSettingsList::CreateSettingItemL( TInt aIdentifier ) |
|
126 { |
|
127 // Add storage place to storage list of settings values. |
|
128 // ...create the storage place. |
|
129 CAknViewAppUi *AppUi = static_cast<CAknViewAppUi*> |
|
130 ( CCoeEnv::Static()->AppUi() ); |
|
131 |
|
132 CGSCamcorderPlugin* parent = static_cast<CGSCamcorderPlugin*> |
|
133 ( AppUi->View( KGSCamcorderGSPluginUid ) ); |
|
134 |
|
135 TIntSetting* newSetting = new( ELeave ) TIntSetting; |
|
136 CleanupStack::PushL( newSetting ); |
|
137 // ...set the identifier for this setting item. |
|
138 newSetting->iItemId = aIdentifier; |
|
139 if( aIdentifier != ECamSettingItemRestoreCameraSettings && parent ) |
|
140 { |
|
141 newSetting->iValueId = parent->IntegerSettingValue( aIdentifier ); |
|
142 } |
|
143 else |
|
144 { |
|
145 newSetting->iValueId = 0; |
|
146 } |
|
147 // ...add the new storage place item to the storage list. |
|
148 iSettings.AppendL( newSetting ); |
|
149 CleanupStack::Pop( newSetting ); |
|
150 |
|
151 // Create the list setting item |
|
152 CAknSettingItem* settingItem = NULL; |
|
153 TInt lastItem = iSettings.Count() - 1; |
|
154 // Setting items take reference to the value to be manipulated. |
|
155 TInt& valueId( iSettings[lastItem]->iValueId ); |
|
156 |
|
157 switch ( aIdentifier ) |
|
158 { |
|
159 case ECamSettingItemPhotoShowFocusPoint: |
|
160 case ECamSettingItemShowCapturedPhoto: |
|
161 { |
|
162 settingItem = new( ELeave ) |
|
163 CAknBinaryPopupSettingItem( aIdentifier, valueId ); |
|
164 } |
|
165 break; |
|
166 |
|
167 case ECamSettingItemPhotoDigitalZoom: |
|
168 { |
|
169 if ( iModel.UiConfigManagerPtr() && |
|
170 iModel.UiConfigManagerPtr()->IsExtendedDigitalZoomSupported() ) |
|
171 { |
|
172 settingItem = new( ELeave ) |
|
173 CAknEnumeratedTextPopupSettingItem( aIdentifier, valueId ); |
|
174 } |
|
175 } |
|
176 break; |
|
177 |
|
178 case ECamSettingItemPhotoQuality: |
|
179 { |
|
180 if ( parent ) |
|
181 { |
|
182 iQualityValue = parent->IntegerSettingValue( ECamSettingItemPhotoQuality ); |
|
183 } |
|
184 if ( !iLaunchedFromGS ) |
|
185 { |
|
186 settingItem = new( ELeave ) |
|
187 CGSCamQualitySettingItem( ECamControllerImage, |
|
188 aIdentifier, |
|
189 iQualityValue, |
|
190 iModel |
|
191 ); |
|
192 } |
|
193 else |
|
194 { |
|
195 settingItem = new( ELeave ) |
|
196 CGSCustomQualitySettingItem( aIdentifier, |
|
197 iQualityValue, |
|
198 iModel, |
|
199 ECamControllerImage |
|
200 ); |
|
201 } |
|
202 } |
|
203 break; |
|
204 case ECamSettingItemPhotoCaptureTone: |
|
205 { |
|
206 settingItem = new( ELeave ) |
|
207 CAknEnumeratedTextPopupSettingItem( aIdentifier, valueId ); |
|
208 } |
|
209 break; |
|
210 |
|
211 case ECamSettingItemImageRotation: |
|
212 { |
|
213 if ( iModel.UiConfigManagerPtr() && |
|
214 iModel.UiConfigManagerPtr()->IsOrientationSensorSupported() ) |
|
215 { |
|
216 settingItem = |
|
217 new( ELeave ) CAknBinaryPopupSettingItem( aIdentifier, valueId ); |
|
218 } |
|
219 } |
|
220 break; |
|
221 |
|
222 case ECamSettingItemRestoreCameraSettings: |
|
223 { |
|
224 settingItem = new ( ELeave ) CAknBigSettingItemBase( aIdentifier ); |
|
225 } |
|
226 break; |
|
227 |
|
228 case ECamSettingItemPhotoMediaStorage: |
|
229 { |
|
230 // Convert the setting to a memory enum |
|
231 iMemVal = static_cast<DriveInfo::TDefaultDrives> |
|
232 ( CamUtility::MapToSettingsListMemory( valueId ) ); |
|
233 __ASSERT_DEBUG( iMemVal != KErrNotFound, |
|
234 CamPanic( ECamPanicUnhandledCreateSettingItem ) ); |
|
235 |
|
236 // Get the root path of the default mass storage memory. |
|
237 TInt driveInt; |
|
238 TInt err = DriveInfo::GetDefaultDrive( iMemVal, driveInt ); |
|
239 iDrive = static_cast<TDriveNumber>(driveInt); |
|
240 |
|
241 settingItem = new ( ELeave ) |
|
242 CAknMemorySelectionSettingItemMultiDrive( |
|
243 aIdentifier, |
|
244 iDrive ); |
|
245 } |
|
246 break; |
|
247 |
|
248 case ECamSettingItemPhotoNameBaseType: |
|
249 { |
|
250 if ( parent ) |
|
251 { |
|
252 iDefaultNameBase = parent->TextSettingValue( |
|
253 ECamSettingItemPhotoNameBase ); |
|
254 TBool flag = ( iLaunchedFromGS || iSecondaryCameraSettings ); |
|
255 settingItem = |
|
256 new( ELeave ) CGSCamDefaultNameSettingItem( iDefaultNameBase, |
|
257 ECamControllerImage, |
|
258 aIdentifier, |
|
259 valueId, |
|
260 flag ); |
|
261 } |
|
262 } |
|
263 break; |
|
264 |
|
265 case ECamSettingItemRecLocation: |
|
266 { |
|
267 if ( !iLaunchedFromGS ) |
|
268 { |
|
269 settingItem = |
|
270 new( ELeave ) CCamLocationSettingItem( ECamControllerImage, |
|
271 aIdentifier, |
|
272 valueId ); |
|
273 } |
|
274 else |
|
275 { |
|
276 settingItem = |
|
277 new( ELeave ) CAknEnumeratedTextPopupSettingItem( aIdentifier, |
|
278 valueId ); |
|
279 } |
|
280 } |
|
281 break; |
|
282 |
|
283 default: |
|
284 { |
|
285 break; |
|
286 } |
|
287 } |
|
288 return settingItem; |
|
289 } |
|
290 |
|
291 |
|
292 |
|
293 // --------------------------------------------------------------------------- |
|
294 // CGSCamPhotoSettingsList::EditItemL |
|
295 // Launch the setting page for the current item by calling |
|
296 // EditItemL on it. |
|
297 // --------------------------------------------------------------------------- |
|
298 // |
|
299 void CGSCamPhotoSettingsList::EditItemL( TInt aIndex, TBool aCalledFromMenu ) |
|
300 { |
|
301 CAknViewAppUi *AppUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
302 CGSCamcorderPlugin* parent = static_cast<CGSCamcorderPlugin*> |
|
303 ( AppUi->View( KGSCamcorderGSPluginUid ) ); |
|
304 CAknSettingItemArray* itemArray = SettingItemArray(); |
|
305 CAknSettingItem* editedItem = itemArray->At(aIndex); |
|
306 |
|
307 if ( editedItem->Identifier() == ECamSettingItemRestoreCameraSettings ) |
|
308 { |
|
309 TInt response = 0; |
|
310 if ( parent ) |
|
311 { |
|
312 response = parent->DisplayRestoreSettingsDlgL(); |
|
313 } |
|
314 // If launched from GS and response "Yes" reload settings page to update values |
|
315 if ( iLaunchedFromGS && response ) |
|
316 { |
|
317 AppUi->ActivateLocalViewL( KGSCamcorderGSPluginUid ); |
|
318 } |
|
319 return; |
|
320 } |
|
321 |
|
322 // Edit item via setting page or in-place. |
|
323 CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ); |
|
324 |
|
325 // Write the new value for the edited control to its stored data. |
|
326 editedItem->StoreL(); |
|
327 |
|
328 // Update the settings model so that the navipane is updated. |
|
329 TInt settingValue; |
|
330 // ...If the changed setting is the media storage setting |
|
331 // ...then convert the memory value to settings model type value. |
|
332 if ( editedItem->Identifier() == ECamSettingItemPhotoMediaStorage ) |
|
333 { |
|
334 iMemVal = static_cast<DriveInfo::TDefaultDrives>(CamUtility::GetDriveTypeFromDriveNumber( iDrive )); |
|
335 settingValue = CamUtility::MapFromSettingsListMemory( iMemVal ); |
|
336 } |
|
337 else if ( editedItem->Identifier() == ECamSettingItemPhotoQuality ) |
|
338 { |
|
339 settingValue = iQualityValue; |
|
340 } |
|
341 else |
|
342 { |
|
343 settingValue = ValueOfSetting( editedItem->Identifier() ); |
|
344 } |
|
345 |
|
346 if ( parent ) |
|
347 { |
|
348 parent->SetIntegerSettingValueL( editedItem->Identifier(), settingValue ); |
|
349 } |
|
350 |
|
351 // If the setting is for the photo base name then store the name. |
|
352 if ( parent ) |
|
353 { |
|
354 parent->SetTextSettingValueL( ECamSettingItemPhotoNameBase, |
|
355 iDefaultNameBase ); |
|
356 } |
|
357 |
|
358 } |
|
359 |
|
360 // --------------------------------------------------------------------------- |
|
361 // CGSCamPhotoSettingsList::ValueOfSetting |
|
362 // Returns the current value of the a setting for this list. |
|
363 // Note, this is not the value currently stored in the settings model, as these |
|
364 // may differ. |
|
365 // --------------------------------------------------------------------------- |
|
366 // |
|
367 TInt CGSCamPhotoSettingsList::ValueOfSetting( TInt aItemId ) const |
|
368 { |
|
369 TInt itemIndex = IndexOfSetting( aItemId ); |
|
370 return iSettings[itemIndex]->iValueId; |
|
371 } |
|
372 |
|
373 // --------------------------------------------------------------------------- |
|
374 // CGSCamPhotoSettingsList::IndexOfSetting |
|
375 // Returns the array index of a setting for this list. |
|
376 // --------------------------------------------------------------------------- |
|
377 // |
|
378 TInt CGSCamPhotoSettingsList::IndexOfSetting( TInt aItemId ) const |
|
379 { |
|
380 TInt i; |
|
381 TInt itemTotal = iSettings.Count(); |
|
382 for ( i = 0; i < itemTotal; ++i ) |
|
383 { |
|
384 if ( iSettings[i]->iItemId == aItemId ) |
|
385 { |
|
386 return i; |
|
387 } |
|
388 } |
|
389 |
|
390 // Should never get here. |
|
391 // Remove lint warning |
|
392 return KErrNotFound; |
|
393 } |
|
394 |
|
395 |
|
396 // --------------------------------------------------------------------------- |
|
397 // CGSCamPhotoSettingsList::SizeChanged |
|
398 // Set the size and position of component controls. |
|
399 // --------------------------------------------------------------------------- |
|
400 // |
|
401 void CGSCamPhotoSettingsList::SizeChanged() |
|
402 { |
|
403 CAknSettingItemList::SizeChanged(); |
|
404 |
|
405 CEikListBox* lb = ListBox(); |
|
406 if( lb ) |
|
407 { |
|
408 lb->SetRect( Rect() ); // Set container's rect to listbox |
|
409 } |
|
410 } |
|
411 |
|
412 // End of File |
|
413 |