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: Video settings list class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <CAknMemorySelectionSettingItem.h> // CAknMemorySelectionSettingItem |
|
22 #include <bldvariant.hrh> |
|
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 #include <AknCommonDialogsDynMem.h> |
|
31 |
|
32 #include "GSCamcorderPlugin.hrh" |
|
33 #include "Cam.hrh" |
|
34 #include "CamSettings.hrh" |
|
35 #include "CamSettingsInternal.hrh" |
|
36 #include "GSCamVideoSettingsList.h" |
|
37 #include "CamPanic.h" |
|
38 #include "CamAppUiBase.h" |
|
39 #include "GSCamcorderPlugin.h" |
|
40 #include "CamUtility.h" |
|
41 #include "MCamAppController.h" |
|
42 #include "CamStaticSettingsModel.h" |
|
43 #include "GSCamQualitySettingItem.h" |
|
44 #include "GSCamDefaultNameSettingItem.h" |
|
45 #include "GSCustomQualitySettingItem.h" |
|
46 #include "CameraUiConfigManager.h" |
|
47 |
|
48 #include "CamCollectionManagerAo.h" |
|
49 #include "CamWaitDialog.h" |
|
50 |
|
51 #include "camconfiguration.h" |
|
52 #include "CamLocationSettingItem.h" |
|
53 |
|
54 // FORWARD DECLARATIONS |
|
55 |
|
56 // ========================= MEMBER FUNCTIONS ================================ |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CGSCamVideoSettingsList::CGSCamVideoSettingsList |
|
60 // C++ constructor |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 CGSCamVideoSettingsList::CGSCamVideoSettingsList( CCamStaticSettingsModel& aModel ) |
|
64 :iModel( aModel ) |
|
65 { |
|
66 iSettings.Reset(); |
|
67 } |
|
68 |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CGSCamVideoSettingsList::ConstructL |
|
72 // Symbian OS 2nd phase constructor |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 void CGSCamVideoSettingsList::ConstructL( TBool aLaunchedFromGS, |
|
76 TBool aSecondaryCameraSettings ) |
|
77 { |
|
78 CAknViewAppUi *AppUi = |
|
79 static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
80 |
|
81 CGSCamcorderPlugin* parent = static_cast<CGSCamcorderPlugin*> |
|
82 ( AppUi->View( KGSCamcorderGSPluginUid ) ); |
|
83 |
|
84 if ( parent ) |
|
85 { |
|
86 parent->LoadVideoStaticSettingsL( ETrue ); |
|
87 parent->LoadPhotoStaticSettingsL( ETrue ); |
|
88 } |
|
89 |
|
90 iModel.Configuration().GetPsiIntArrayL( ECamPsiSupportedVideoQualities, iSupportedVideoQualities ); |
|
91 |
|
92 iLaunchedFromGS = aLaunchedFromGS; |
|
93 iSecondaryCameraSettings = aSecondaryCameraSettings; |
|
94 iSettings.ResetAndDestroy(); |
|
95 |
|
96 TInt resId; |
|
97 if ( iModel.UiConfigManagerPtr() && |
|
98 iModel.UiConfigManagerPtr()->IsLocationSupported() ) |
|
99 { |
|
100 resId = iLaunchedFromGS?R_CAM_VIDEO_GSSETTINGS_WITH_LOCATION_ITEM_LIST_CAMCORDER: |
|
101 R_CAM_VIDEO_SETTINGS_WITH_LOCATION_ITEM_LIST_CAMCORDER; |
|
102 } |
|
103 else |
|
104 { |
|
105 resId = iLaunchedFromGS?R_CAM_VIDEO_GSSETTINGS_ITEM_LIST_CAMCORDER: |
|
106 R_CAM_VIDEO_SETTINGS_ITEM_LIST_CAMCORDER; |
|
107 } |
|
108 |
|
109 if ( iSecondaryCameraSettings ) |
|
110 { |
|
111 resId = R_CAM_VIDEO_SETTINGS_ITEM_LIST_PORTRAIT; |
|
112 } |
|
113 |
|
114 ConstructFromResourceL( resId ); |
|
115 } |
|
116 |
|
117 |
|
118 // Destructor |
|
119 //CGSCamVideoSettingsList::~CGSCamVideoSettingsList() |
|
120 // |
|
121 CGSCamVideoSettingsList::~CGSCamVideoSettingsList() |
|
122 { |
|
123 iSettings.ResetAndDestroy(); |
|
124 iSettings.Close(); |
|
125 iSupportedVideoQualities.Close(); |
|
126 } |
|
127 |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CGSCamVideoSettingsList::CreateSettingItemL |
|
131 // From CAknSettingItemList Handles creating setting items |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 CAknSettingItem* CGSCamVideoSettingsList::CreateSettingItemL( TInt aIdentifier ) |
|
135 { |
|
136 CAknViewAppUi *AppUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() ); |
|
137 CGSCamcorderPlugin* parent = static_cast<CGSCamcorderPlugin*> |
|
138 ( AppUi->View( KGSCamcorderGSPluginUid ) ); |
|
139 // Add storage place to storage list of settings values. |
|
140 // ...create the storage place. |
|
141 TIntSetting* newSetting = new( ELeave ) TIntSetting; |
|
142 CleanupStack::PushL( newSetting ); |
|
143 // ...set the identifier for this setting item. |
|
144 newSetting->iItemId = aIdentifier; |
|
145 if( aIdentifier != ECamSettingItemRestoreCameraSettings ) |
|
146 { |
|
147 if ( parent ) |
|
148 { |
|
149 newSetting->iValueId = parent->IntegerSettingValue( aIdentifier ); |
|
150 } |
|
151 } |
|
152 else |
|
153 { |
|
154 newSetting->iValueId = 0; |
|
155 } |
|
156 // ...add the new storage place item to the storage list. |
|
157 iSettings.AppendL( newSetting ); |
|
158 CleanupStack::Pop( newSetting ); |
|
159 |
|
160 // Create the list setting item |
|
161 CAknSettingItem* settingItem = NULL; |
|
162 TInt lastItem = iSettings.Count() - 1; |
|
163 // Setting items take reference to the value to be manipulated. |
|
164 TInt& valueId( iSettings[lastItem]->iValueId ); |
|
165 |
|
166 switch ( aIdentifier ) |
|
167 { |
|
168 case ECamSettingItemVideoAudioRec: |
|
169 case ECamSettingItemVideoShowCapturedVideo: |
|
170 case ECamSettingItemVideoOpZoomOff: |
|
171 { |
|
172 settingItem = |
|
173 new( ELeave ) CAknBinaryPopupSettingItem( aIdentifier, valueId ); |
|
174 } |
|
175 break; |
|
176 case ECamSettingItemVideoDigitalZoom: |
|
177 { |
|
178 if ( iModel.UiConfigManagerPtr() && |
|
179 iModel.UiConfigManagerPtr()->IsExtendedDigitalZoomSupported() ) |
|
180 { |
|
181 settingItem = new( ELeave ) CAknBinaryPopupSettingItem( aIdentifier, valueId ); |
|
182 } |
|
183 break; |
|
184 } |
|
185 case ECamSettingItemVideoQuality: |
|
186 { |
|
187 if ( parent ) |
|
188 { |
|
189 iQualityValue = parent->IntegerSettingValue( ECamSettingItemVideoQuality); |
|
190 } |
|
191 if ( !iLaunchedFromGS ) |
|
192 { |
|
193 settingItem = new( ELeave ) |
|
194 CGSCamQualitySettingItem( ECamControllerVideo, |
|
195 aIdentifier, |
|
196 iQualityValue, |
|
197 iModel ); |
|
198 } |
|
199 else |
|
200 { |
|
201 settingItem = new( ELeave ) |
|
202 CGSCustomQualitySettingItem( aIdentifier, |
|
203 iQualityValue, |
|
204 iModel, |
|
205 ECamControllerVideo ); |
|
206 } |
|
207 } |
|
208 break; |
|
209 |
|
210 case ECamSettingItemRecLocation: |
|
211 { |
|
212 if ( !iLaunchedFromGS ) |
|
213 { |
|
214 settingItem = |
|
215 new( ELeave ) CCamLocationSettingItem( ECamControllerVideo, |
|
216 aIdentifier, |
|
217 valueId ); |
|
218 } |
|
219 else |
|
220 { |
|
221 settingItem = new( ELeave ) |
|
222 CAknBinaryPopupSettingItem( aIdentifier, valueId ); |
|
223 } |
|
224 } |
|
225 break; |
|
226 |
|
227 case ECamSettingItemVideoMediaStorage: |
|
228 { |
|
229 // Convert the setting to a memory enum |
|
230 iMemVal = static_cast<DriveInfo::TDefaultDrives> |
|
231 ( CamUtility::MapToSettingsListMemory( valueId ) ); |
|
232 |
|
233 if(iMemVal != KErrNotFound) |
|
234 { |
|
235 TInt driveInt; |
|
236 TInt err = DriveInfo::GetDefaultDrive( iMemVal, driveInt ); |
|
237 iDrive = static_cast<TDriveNumber>(driveInt); |
|
238 } |
|
239 else |
|
240 { |
|
241 iDrive = static_cast<TDriveNumber>(0); //Doesn't matter |
|
242 } |
|
243 TInt includedMedias(0); |
|
244 CGSCamcorderPlugin* parent = static_cast<CGSCamcorderPlugin*> |
|
245 ( AppUi->View( KGSCamcorderGSPluginUid ) ); |
|
246 TInt driveCount(0); |
|
247 if( !parent->IntegerSettingValue(ECamSettingItemRemovePhoneMemoryUsage) ) |
|
248 { |
|
249 includedMedias |= AknCommonDialogsDynMem::EMemoryTypePhone; |
|
250 driveCount++; |
|
251 } |
|
252 |
|
253 TInt drive(0); |
|
254 TUint driveStatus(0); |
|
255 TInt err(0); |
|
256 err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ); |
|
257 if( err == KErrNone ) |
|
258 { |
|
259 err = DriveInfo::GetDriveStatus( CCoeEnv::Static()->FsSession(), |
|
260 drive, |
|
261 driveStatus ); |
|
262 if( err == KErrNone ) |
|
263 { |
|
264 if( ( driveStatus & DriveInfo::EDrivePresent) == DriveInfo::EDrivePresent ) |
|
265 { |
|
266 if( ( driveStatus & DriveInfo::EDriveRemovable ) != DriveInfo::EDriveRemovable ) |
|
267 { |
|
268 includedMedias |= AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage; |
|
269 driveCount++; |
|
270 } |
|
271 } |
|
272 } |
|
273 } |
|
274 |
|
275 err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ); |
|
276 if( err == KErrNone ) |
|
277 { |
|
278 err = DriveInfo::GetDriveStatus( CCoeEnv::Static()->FsSession(), |
|
279 drive, |
|
280 driveStatus ); |
|
281 if( err == KErrNone ) |
|
282 { |
|
283 if( ( driveStatus & DriveInfo::EDrivePresent) == DriveInfo::EDrivePresent ) |
|
284 { |
|
285 includedMedias |= AknCommonDialogsDynMem::EMemoryTypeMMCExternalInDevice; |
|
286 driveCount++; |
|
287 } |
|
288 } |
|
289 } |
|
290 settingItem = new ( ELeave ) |
|
291 CAknMemorySelectionSettingItemMultiDrive( |
|
292 aIdentifier, |
|
293 iDrive |
|
294 ); |
|
295 static_cast<CAknMemorySelectionSettingItemMultiDrive*>(settingItem) |
|
296 ->SetIncludedMediasL(includedMedias); |
|
297 if( driveCount <= 1 ) |
|
298 { |
|
299 settingItem->SetHidden( ETrue ); |
|
300 } |
|
301 break; |
|
302 } |
|
303 case ECamSettingItemVideoNameBaseType: |
|
304 { |
|
305 if ( parent ) |
|
306 { |
|
307 iDefaultNameBase = parent->TextSettingValue( |
|
308 ECamSettingItemVideoNameBase ); |
|
309 } |
|
310 TBool flag = ( iLaunchedFromGS ); |
|
311 settingItem = new( ELeave ) |
|
312 CGSCamDefaultNameSettingItem( iDefaultNameBase, |
|
313 ECamControllerVideo, |
|
314 aIdentifier, |
|
315 valueId, |
|
316 flag ); |
|
317 } |
|
318 break; |
|
319 |
|
320 |
|
321 case ECamSettingItemVideoStab: |
|
322 { |
|
323 if ( iModel.UiConfigManagerPtr() && |
|
324 iModel.UiConfigManagerPtr()->IsVideoStabilizationSupported() ) |
|
325 { |
|
326 settingItem = |
|
327 new( ELeave ) CAknBinaryPopupSettingItem( aIdentifier, valueId ); |
|
328 } |
|
329 } |
|
330 break; |
|
331 case ECamSettingItemRestoreCameraSettings: |
|
332 { |
|
333 settingItem = new ( ELeave ) CAknBigSettingItemBase( aIdentifier ); |
|
334 } |
|
335 break; |
|
336 case ECamSettingItemContinuousAutofocus: |
|
337 { |
|
338 if ( iModel.UiConfigManagerPtr() && |
|
339 iModel.UiConfigManagerPtr()->IsContinuosAutofocusSupported() ) |
|
340 { |
|
341 settingItem = |
|
342 new( ELeave ) CAknBinaryPopupSettingItem( aIdentifier, valueId ); |
|
343 } |
|
344 |
|
345 break; |
|
346 } |
|
347 default: |
|
348 __ASSERT_DEBUG( EFalse, CamPanic( ECamPanicUnhandledCreateSettingItem ) ); |
|
349 break; |
|
350 } |
|
351 |
|
352 PRINT( _L("Camera <= CCamVideoSettingsList::CreateSettingItemL") ); |
|
353 return settingItem; |
|
354 } |
|
355 |
|
356 |
|
357 // --------------------------------------------------------------------------- |
|
358 // CGSCamVideoSettingsList::EditItemL |
|
359 // Launch the setting page for the current item by calling |
|
360 // EditItemL on it. |
|
361 // --------------------------------------------------------------------------- |
|
362 // |
|
363 void CGSCamVideoSettingsList::EditItemL( TInt aIndex, TBool aCalledFromMenu ) |
|
364 { |
|
365 PRINT( _L("Camera => CCamVideoSettingsList::EditItemL" )) |
|
366 CAknViewAppUi *AppUi = static_cast<CAknViewAppUi*>( |
|
367 CCoeEnv::Static()->AppUi() ); |
|
368 |
|
369 CGSCamcorderPlugin* parent = static_cast<CGSCamcorderPlugin*> |
|
370 ( AppUi->View( KGSCamcorderGSPluginUid ) ); |
|
371 |
|
372 CAknSettingItemArray* itemArray = SettingItemArray(); |
|
373 CAknSettingItem* editedItem = itemArray->At(aIndex); |
|
374 |
|
375 if ( editedItem->Identifier() == ECamSettingItemRestoreCameraSettings ) |
|
376 { |
|
377 TInt response = 0; |
|
378 if ( parent ) |
|
379 { |
|
380 response = parent->DisplayRestoreSettingsDlgL(); |
|
381 } |
|
382 // If launched from GS and response "Yes" reload settings page to update values |
|
383 if ( iLaunchedFromGS && response ) |
|
384 { |
|
385 AppUi->ActivateLocalViewL( KGSCamcorderGSPluginUid ); |
|
386 } |
|
387 return; |
|
388 } |
|
389 |
|
390 // Edit item via setting page or in-place. |
|
391 CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu ); |
|
392 // Write the new value for the edited control to its stored data. |
|
393 editedItem->StoreL(); |
|
394 |
|
395 // Update the settings model so that the navipane is updated. |
|
396 TInt settingValue; |
|
397 // ...If the changed setting is the media storage setting |
|
398 // ...then convert the memory value to settings model type value. |
|
399 if ( editedItem->Identifier() == ECamSettingItemVideoMediaStorage ) |
|
400 { |
|
401 iMemVal = static_cast<DriveInfo::TDefaultDrives>(CamUtility::GetDriveTypeFromDriveNumber( iDrive )); |
|
402 settingValue = CamUtility::MapFromSettingsListMemory( iMemVal ); |
|
403 settingValue = ( (settingValue == ECamMediaStoragePhone) && |
|
404 parent->IntegerSettingValue(ECamSettingItemRemovePhoneMemoryUsage) )? |
|
405 ECamMediaStorageNone:settingValue; |
|
406 //__ASSERT_DEBUG( settingValue != KErrNotFound, CamPanic( ECamPanicUnknownSettingItem ) ); |
|
407 } |
|
408 else if ( editedItem->Identifier() == ECamSettingItemVideoQuality ) |
|
409 { |
|
410 settingValue = iQualityValue; |
|
411 } |
|
412 // ...Otherwise, no conversion necessary. |
|
413 else |
|
414 { |
|
415 settingValue = ValueOfSetting( editedItem->Identifier() ); |
|
416 } |
|
417 // ...Update the settings model with the new value. |
|
418 if ( parent ) |
|
419 { |
|
420 parent->SetIntegerSettingValueL( editedItem->Identifier(), |
|
421 settingValue ); |
|
422 } |
|
423 |
|
424 // If the setting is for the video base name then store the name. |
|
425 if ( editedItem->Identifier() == ECamSettingItemVideoNameBaseType |
|
426 && parent ) |
|
427 { |
|
428 parent->SetTextSettingValueL( ECamSettingItemVideoNameBase, |
|
429 iDefaultNameBase ); |
|
430 } |
|
431 |
|
432 PRINT( _L("Camera <= CCamVideoSettingsList::EditItemL" )) |
|
433 } |
|
434 |
|
435 // --------------------------------------------------------------------------- |
|
436 // CGSCamVideoSettingsList::ValueOfSetting |
|
437 // Returns the current value of the a setting for this list. |
|
438 // Note, this is not the value currently stored in the settings model, as these |
|
439 // may differ. |
|
440 // --------------------------------------------------------------------------- |
|
441 // |
|
442 TInt CGSCamVideoSettingsList::ValueOfSetting( TInt aItemId ) const |
|
443 { |
|
444 TInt itemIndex = IndexOfSetting( aItemId ); |
|
445 return iSettings[itemIndex]->iValueId; |
|
446 } |
|
447 |
|
448 // --------------------------------------------------------------------------- |
|
449 // CGSCamVideoSettingsList::IndexOfSetting |
|
450 // Returns the array index of a setting for this list. |
|
451 // --------------------------------------------------------------------------- |
|
452 // |
|
453 TInt CGSCamVideoSettingsList::IndexOfSetting( TInt aItemId ) const |
|
454 { |
|
455 TInt i; |
|
456 TInt itemTotal = iSettings.Count(); |
|
457 for ( i = 0; i < itemTotal; ++i ) |
|
458 { |
|
459 if ( iSettings[i]->iItemId == aItemId ) |
|
460 { |
|
461 return i; |
|
462 } |
|
463 } |
|
464 |
|
465 // Should never get here. |
|
466 // Remove lint warning |
|
467 return KErrNotFound; |
|
468 } |
|
469 |
|
470 |
|
471 // --------------------------------------------------------------------------- |
|
472 // CGSCamVideoSettingsList::SizeChanged |
|
473 // Set the size and position of component controls. |
|
474 // --------------------------------------------------------------------------- |
|
475 // |
|
476 void CGSCamVideoSettingsList::SizeChanged() |
|
477 { |
|
478 CAknSettingItemList::SizeChanged(); |
|
479 CEikListBox* lb = ListBox(); |
|
480 if( lb ) |
|
481 { |
|
482 lb->SetRect( Rect() ); // Set container's rect to listbox |
|
483 } |
|
484 } |
|
485 |
|
486 |
|
487 // End of File |
|
488 |
|