24
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2009 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: Manages all settings data.*
|
|
15 |
*/
|
|
16 |
|
|
17 |
|
|
18 |
// ===========================================================================
|
|
19 |
// Includes
|
|
20 |
#include <StringLoader.h>
|
|
21 |
#include <barsread.h>
|
|
22 |
#include <AknQueryDialog.h>
|
|
23 |
#include <ecam.h>
|
|
24 |
#include <data_caging_path_literals.hrh> // KDC_APP_RESOURCE_DIR
|
|
25 |
|
|
26 |
#include <cameraapp.rsg>
|
|
27 |
#include <vgacamsettings.rsg>
|
|
28 |
|
|
29 |
#include "CamSettingsModel.h"
|
|
30 |
#include "CamPanic.h"
|
|
31 |
#include "mcamsettingsmodelobserver.h"
|
|
32 |
#include "CamAppUiBase.h"
|
|
33 |
#include "CamSharedDataKeys.h"
|
|
34 |
#include "CamUtility.h"
|
|
35 |
#include "CamVideoQualityLevel.h"
|
|
36 |
|
|
37 |
#include "CameraVariant.hrh" // Variant CR key values
|
|
38 |
#include "CameraappPrivateCRKeys.h" // CR keys
|
|
39 |
#include "camactivepalettehandler.h"
|
|
40 |
#include "CamAppUi.h"
|
|
41 |
#include "camsettingconversion.h"
|
|
42 |
#include "camconfiguration.h"
|
|
43 |
#include "CamStaticSettingsModel.h"
|
|
44 |
#include "CameraUiConfigManager.h"
|
|
45 |
|
|
46 |
// ===========================================================================
|
|
47 |
// Constants
|
|
48 |
|
|
49 |
const TInt KDynamicArrayGranularity = 3;
|
|
50 |
_LIT( KCamNhdResourceFileName, "z:nhdcamsettings.rss" );
|
|
51 |
_LIT( KCamVgaResourceFileName, "z:vgacamsettings.rss" );
|
|
52 |
|
|
53 |
|
|
54 |
// ===========================================================================
|
|
55 |
// Local methods
|
|
56 |
inline TBool SettingIdMatches( const TInt* aSettingId,
|
|
57 |
const TIntSetting& aSettingItem )
|
|
58 |
{
|
|
59 |
return (*aSettingId == aSettingItem.iItemId);
|
|
60 |
};
|
|
61 |
|
|
62 |
inline TInt FindIndex( const RPointerArray<TIntSetting>& aSettingArray,
|
|
63 |
const TInt& aSettingId )
|
|
64 |
{
|
|
65 |
return aSettingArray.Find( aSettingId, SettingIdMatches );
|
|
66 |
};
|
|
67 |
|
|
68 |
inline TInt FindIndex( const RPointerArray<TIntSetting>& aSettingArray,
|
|
69 |
const TIntSetting& aSettingItem )
|
|
70 |
{
|
|
71 |
return FindIndex( aSettingArray, aSettingItem.iItemId );
|
|
72 |
};
|
|
73 |
|
|
74 |
|
|
75 |
// ===========================================================================
|
|
76 |
// Class methods
|
|
77 |
|
|
78 |
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
// TCamVariantInfo constructor
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
//
|
|
83 |
TCamVariantInfo::TCamVariantInfo()
|
|
84 |
: iFlags ( -1 ),
|
|
85 |
iTimeLapseSupport( ECamSupportUnknown ),
|
|
86 |
iAlwaysOnSupport ( ECamSupportUnknown ),
|
|
87 |
iVersion ( -1, 0, 0 )
|
|
88 |
{
|
|
89 |
}
|
|
90 |
|
|
91 |
// ===========================================================================
|
|
92 |
|
|
93 |
// ---------------------------------------------------------------------------
|
|
94 |
// CCamSettingsModel::NewL
|
|
95 |
// Symbian OS two-phased constructor
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
CCamSettingsModel* CCamSettingsModel::NewL( CCamConfiguration& aConfiguration )
|
|
99 |
{
|
|
100 |
CCamSettingsModel* self = CCamSettingsModel::NewLC( aConfiguration );
|
|
101 |
CleanupStack::Pop( self );
|
|
102 |
return self;
|
|
103 |
}
|
|
104 |
|
|
105 |
// ---------------------------------------------------------------------------
|
|
106 |
// CCamSettingsModel::NewLC
|
|
107 |
// Symbian OS two-phased constructor
|
|
108 |
// ---------------------------------------------------------------------------
|
|
109 |
//
|
|
110 |
CCamSettingsModel* CCamSettingsModel::NewLC( CCamConfiguration& aConfiguration )
|
|
111 |
{
|
|
112 |
CCamSettingsModel* self = new( ELeave ) CCamSettingsModel( aConfiguration );
|
|
113 |
CleanupStack::PushL( self );
|
|
114 |
self->ConstructL();
|
|
115 |
return self;
|
|
116 |
}
|
|
117 |
|
|
118 |
// ---------------------------------------------------------------------------
|
|
119 |
// CCamSettingsModel::ResetUserSceneWithoutActivatingChangesL
|
|
120 |
// Resets all user scene settings to their defaults without activating them.
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
void CCamSettingsModel::ResetUserSceneWithoutActivatingChangesL()
|
|
124 |
{
|
|
125 |
PRINT( _L("Camera => CCamSettingsModel::ResetUserSceneWithoutActivatingChangesL"))
|
|
126 |
|
|
127 |
// Reset the user scene data in the repository
|
|
128 |
iStaticModel->ResetSettingItem( KCamCrUserSceneBaseScene );
|
|
129 |
iStaticModel->ResetSettingItem( KCamCrUserSceneWhiteBalance );
|
|
130 |
iStaticModel->ResetSettingItem( KCamCrUserSceneColourFilter );
|
|
131 |
iStaticModel->ResetSettingItem( KCamCrUserSceneFlash );
|
|
132 |
iStaticModel->ResetSettingItem( KCamCrUserSceneExposure );
|
|
133 |
|
|
134 |
if ( iUiConfigManager->IsISOSupported() )
|
|
135 |
{
|
|
136 |
iStaticModel->ResetSettingItem( KCamCrUserSceneLightSensitivity );
|
|
137 |
}
|
|
138 |
iStaticModel->ResetSettingItem( KCamCrUserSceneContrast );
|
|
139 |
iStaticModel->ResetSettingItem( KCamCrUserSceneImageSharpness );
|
|
140 |
iStaticModel->ResetSettingItem( KCamCrUserSceneDefault );
|
|
141 |
|
|
142 |
// Reload the static user scene settings
|
|
143 |
iUserSceneSettings.ResetAndDestroy();
|
|
144 |
iStaticModel->ReadFromCenRepL(
|
|
145 |
static_cast<TInt>( ECamSettingItemUserSceneRangeMin ),
|
|
146 |
static_cast<TInt>( ECamSettingItemUserSceneRangeMax ),
|
|
147 |
iUserSceneSettings
|
|
148 |
);
|
|
149 |
PRINT( _L("Camera <= CCamSettingsModel::ResetUserSceneWithoutActivatingChangesL"))
|
|
150 |
}
|
|
151 |
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
// CCamSettingsModel::ResetUserSceneL
|
|
154 |
// Resets all user scene settings to their defaults.
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
void CCamSettingsModel::ResetUserSceneL()
|
|
158 |
{
|
|
159 |
PRINT( _L("Camera => CCamSettingsModel::ResetUserSceneL"))
|
|
160 |
// Reset the user scene based on scene in the repository to get the default value
|
|
161 |
ResetUserSceneWithoutActivatingChangesL();
|
|
162 |
TInt scene = IntegerSettingValue( ECamSettingItemDynamicPhotoScene );
|
|
163 |
// If current scene is user scene
|
|
164 |
if ( ECamSceneUser == scene )
|
|
165 |
{
|
|
166 |
// if the user scene is currently the photo scene then
|
|
167 |
// activate all the default scene settings to the AP
|
|
168 |
ActivateUserSceneSettingsL();
|
|
169 |
}
|
|
170 |
PRINT( _L("Camera <= CCamSettingsModel::ResetUserSceneL"))
|
|
171 |
}
|
|
172 |
|
|
173 |
|
|
174 |
|
|
175 |
// ---------------------------------------------------------------------------
|
|
176 |
// CCamSettingsModel::IntegerSettingValue
|
|
177 |
// Returns the current integer value for the specified setting
|
|
178 |
// ---------------------------------------------------------------------------
|
|
179 |
//
|
|
180 |
TInt
|
|
181 |
CCamSettingsModel::IntegerSettingValue( TInt aSettingItem ) const
|
|
182 |
{
|
|
183 |
PRINT2( _L("Camera => CCamSettingsModel::IntegerSettingValue, id:%d [%s]"),
|
|
184 |
aSettingItem,
|
|
185 |
KCamSettingItemNames[aSettingItem] );
|
|
186 |
|
|
187 |
TInt value = KErrNotFound;
|
|
188 |
// If the requested item is the photo quality value, this must
|
|
189 |
// be filtered based on the current scene.
|
|
190 |
if ( aSettingItem == ECamSettingItemPhotoQuality )
|
|
191 |
{
|
|
192 |
value = CurrentPhotoQualityValue();
|
|
193 |
}
|
|
194 |
// If the requested item is the photo size, this must be filtered based on
|
|
195 |
// the current scene
|
|
196 |
else if ( aSettingItem == ECamSettingItemPhotoSize )
|
|
197 |
{
|
|
198 |
value = CurrentPhotoResolution();
|
|
199 |
}
|
|
200 |
// If the requested item is the photo compression level, this must
|
|
201 |
// be filtered based on the current scene, and burst mode.
|
|
202 |
else if ( aSettingItem == ECamSettingItemPhotoCompression )
|
|
203 |
{
|
|
204 |
value = CurrentPhotoCompression();
|
|
205 |
}
|
|
206 |
else
|
|
207 |
{
|
|
208 |
// If we have previews active, check first if requested
|
|
209 |
// setting is found among them. Settings model must pretend
|
|
210 |
// that the current value is the one set to preview.
|
|
211 |
TInt previewIndex( FindIndex( iSettingPreviews, aSettingItem ) );
|
|
212 |
if( KErrNotFound != previewIndex )
|
|
213 |
{
|
|
214 |
PRINT( _L("Camera <> Setting item value in previewed currently!") );
|
|
215 |
value = iSettingPreviews[previewIndex]->iValueId;
|
|
216 |
|
|
217 |
if (ECamSettingItemDynamicSelfTimer == aSettingItem) //If the current setting Item is selftimer
|
|
218 |
{
|
|
219 |
TInt settingIndex = SearchInSettingsListFor( iDynamicPhotoIntSettings, aSettingItem );
|
|
220 |
value = iDynamicPhotoIntSettings[settingIndex]->iValueId; //Get the actual selftime setting value but not preview value
|
|
221 |
}
|
|
222 |
}
|
|
223 |
// Otherwise, if setting item is in the dynamic photo settings return it's value.
|
|
224 |
else if( ECamSettingItemDynamicPhotoRangeMax > aSettingItem
|
|
225 |
&& ECamSettingItemDynamicPhotoRangeMin < aSettingItem )
|
|
226 |
{
|
|
227 |
TInt settingIndex = SearchInSettingsListFor( iDynamicPhotoIntSettings, aSettingItem );
|
|
228 |
value = iDynamicPhotoIntSettings[settingIndex]->iValueId;
|
|
229 |
}
|
|
230 |
// Otherwise, if setting item is in the dynamic video settings return it's value.
|
|
231 |
else if( ECamSettingItemDynamicVideoRangeMax > aSettingItem
|
|
232 |
&& ECamSettingItemDynamicVideoRangeMin < aSettingItem )
|
|
233 |
{
|
|
234 |
TInt settingIndex = SearchInSettingsListFor( iDynamicVideoIntSettings, aSettingItem );
|
|
235 |
value = iDynamicVideoIntSettings[settingIndex]->iValueId;
|
|
236 |
}
|
|
237 |
// Otherwise, if setting item is in the user scene settings return it's value.
|
|
238 |
else if( ECamSettingItemUserSceneRangeMax > aSettingItem
|
|
239 |
&& ECamSettingItemUserSceneRangeMin < aSettingItem )
|
|
240 |
{
|
|
241 |
TInt settingIndex = SearchInSettingsListFor( iUserSceneSettings, aSettingItem );
|
|
242 |
value = iUserSceneSettings[settingIndex]->iValueId;
|
|
243 |
}
|
|
244 |
// Otherwise, if setting item is in the static video settings return it's value.
|
|
245 |
else if( ECamSettingItemVideoClipLength == aSettingItem )
|
|
246 |
{
|
|
247 |
// Video clip length workaround
|
|
248 |
// PRINT( _L("Camera <> ECamSettingItemVideoClipLength") );
|
|
249 |
TInt videoQuality = IntegerSettingValue( ECamSettingItemVideoQuality );
|
|
250 |
value = iQualityLevels[videoQuality]->VideoLength();
|
|
251 |
}
|
|
252 |
else
|
|
253 |
{
|
|
254 |
value = iStaticModel->IntegerSettingValue( aSettingItem );
|
|
255 |
}
|
|
256 |
}
|
|
257 |
|
|
258 |
PRINT1( _L("Camera <= CCamSettingsModel::IntegerSettingValue, value:%d"), value );
|
|
259 |
return value;
|
|
260 |
}
|
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
// ---------------------------------------------------------------------------
|
|
266 |
// CCamSettingsModel::SceneSettingValue
|
|
267 |
// Returns the setting value for a specific field of a scene
|
|
268 |
// ---------------------------------------------------------------------------
|
|
269 |
//
|
|
270 |
TInt
|
|
271 |
CCamSettingsModel::SceneSettingValue( TInt aSceneId,
|
|
272 |
TInt aSceneField ) const
|
|
273 |
{
|
|
274 |
PRINT2( _L("CCamSettingsModel::SceneSettingValue, scene[%s] setting[%s]"),
|
|
275 |
KCamSceneNames[aSceneId],
|
|
276 |
KCamSettingItemNames[aSceneField] );
|
|
277 |
|
|
278 |
// If setting item is a scene in the photo scene list
|
|
279 |
TInt sceneIndex = FindSceneInSceneList( aSceneId, iPhotoScenes );
|
|
280 |
if ( sceneIndex != KErrNotFound )
|
|
281 |
{
|
|
282 |
// Search for the field in the scene's field list.
|
|
283 |
const RPointerArray<TIntSetting>& sceneSettings =
|
|
284 |
iPhotoScenes[sceneIndex]->iSettings;
|
|
285 |
TInt fieldCount = sceneSettings.Count();
|
|
286 |
for ( TInt i = 0; i < fieldCount; ++i )
|
|
287 |
{
|
|
288 |
if ( sceneSettings[i]->iItemId == aSceneField )
|
|
289 |
{
|
|
290 |
return sceneSettings[i]->iValueId;
|
|
291 |
}
|
|
292 |
}
|
|
293 |
}
|
|
294 |
|
|
295 |
// Otherwise if setting item is a scene in the video scene list
|
|
296 |
sceneIndex = FindSceneInSceneList( aSceneId, iVideoScenes );
|
|
297 |
if ( sceneIndex != KErrNotFound )
|
|
298 |
{
|
|
299 |
// Search for the field in the scene's field list.
|
|
300 |
const RPointerArray<TIntSetting>& sceneSettings =
|
|
301 |
iVideoScenes[sceneIndex]->iSettings;
|
|
302 |
TInt fieldCount = sceneSettings.Count();
|
|
303 |
for ( TInt i = 0; i < fieldCount; ++i )
|
|
304 |
{
|
|
305 |
if ( sceneSettings[i]->iItemId == aSceneField )
|
|
306 |
{
|
|
307 |
return sceneSettings[i]->iValueId;
|
|
308 |
}
|
|
309 |
}
|
|
310 |
}
|
|
311 |
|
|
312 |
else
|
|
313 |
{
|
|
314 |
PRINT( _L("Camera => CCamSettingsModel::ECamPanicUnknownSettingItem 3" ))
|
|
315 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
316 |
}
|
|
317 |
|
|
318 |
return sceneIndex;
|
|
319 |
}
|
|
320 |
|
|
321 |
// ---------------------------------------------------------------------------
|
|
322 |
// CCamSettingsModel::SetIntegerSettingValueL
|
|
323 |
// Sets a new integer value for the specified setting
|
|
324 |
// ---------------------------------------------------------------------------
|
|
325 |
//
|
|
326 |
void
|
|
327 |
CCamSettingsModel::SetIntegerSettingValueL( TInt aSettingItem,
|
|
328 |
TInt aSettingValue )
|
|
329 |
{
|
|
330 |
PRINT ( _L("Camera => CCamSettingsModel::SetIntegerSettingValueL") );
|
|
331 |
CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEnv->AppUi() );
|
|
332 |
TCamSettingItemIds settingId(
|
|
333 |
static_cast<TCamSettingItemIds>(aSettingItem) );
|
|
334 |
|
|
335 |
PRINT2( _L("Camera <> Setting item[%s] value:%d"), KCamSettingItemNames[settingId], aSettingValue );
|
|
336 |
|
|
337 |
// -------------------------------------------------------
|
|
338 |
// Dynamic image settings
|
|
339 |
if( ECamSettingItemDynamicPhotoRangeMin < settingId
|
|
340 |
&& ECamSettingItemDynamicPhotoRangeMax > settingId )
|
|
341 |
{
|
|
342 |
TInt settingIndex = SearchInSettingsListFor( iDynamicPhotoIntSettings,
|
|
343 |
settingId );
|
|
344 |
iDynamicPhotoIntSettings[settingIndex]->iValueId = aSettingValue;
|
|
345 |
|
|
346 |
// Changing scene
|
|
347 |
if ( ECamSettingItemDynamicPhotoScene == settingId )
|
|
348 |
{
|
|
349 |
if ( ECamActiveCameraNone != appUi->ActiveCamera() || ( ECamActiveCameraNone == appUi->ActiveCamera() && ECamSceneAuto == aSettingValue ) )
|
|
350 |
{
|
|
351 |
PhotoSceneHasChangedL( aSettingValue );
|
|
352 |
}
|
|
353 |
}
|
|
354 |
}
|
|
355 |
// -------------------------------------------------------
|
|
356 |
// Dynamic video settings
|
|
357 |
else if( ECamSettingItemDynamicVideoRangeMin < settingId
|
|
358 |
&& ECamSettingItemDynamicVideoRangeMax > settingId )
|
|
359 |
{
|
|
360 |
TInt settingIndex = SearchInSettingsListFor( iDynamicVideoIntSettings,
|
|
361 |
settingId );
|
|
362 |
iDynamicVideoIntSettings[settingIndex]->iValueId = aSettingValue;
|
|
363 |
if ( settingId == ECamSettingItemDynamicVideoScene )
|
|
364 |
{
|
|
365 |
VideoSceneHasChangedL( aSettingValue );
|
|
366 |
}
|
|
367 |
}
|
|
368 |
// -------------------------------------------------------
|
|
369 |
// User scene settings
|
|
370 |
else if( ECamSettingItemUserSceneRangeMin < settingId
|
|
371 |
&& ECamSettingItemUserSceneRangeMax > settingId )
|
|
372 |
{
|
|
373 |
TBool userSceneModeSettingChanged = EFalse;
|
|
374 |
// If the based-on scene has changed
|
|
375 |
if ( settingId == ECamSettingItemUserSceneBasedOnScene )
|
|
376 |
{
|
|
377 |
TInt scene = IntegerSettingValue( ECamSettingItemDynamicPhotoScene );
|
|
378 |
// If current scene is user scene
|
|
379 |
if ( ECamSceneUser == scene )
|
|
380 |
{
|
|
381 |
// Handle other changes to the settings required by the change in scene.
|
|
382 |
UserSceneHasChangedL( aSettingValue, ETrue );
|
|
383 |
}
|
|
384 |
// Otherwise the user scene hasn't been selected as the active scene
|
|
385 |
// - the change option has just been selected in the scene setting list
|
|
386 |
else
|
|
387 |
{
|
|
388 |
// just handle a change in the scene
|
|
389 |
UserSceneHasChangedL( aSettingValue, EFalse );
|
|
390 |
}
|
|
391 |
userSceneModeSettingChanged = ETrue;
|
|
392 |
}
|
|
393 |
// Writing values to CenRep for all the settings.
|
|
394 |
TInt settingIndex = SearchInSettingsListFor( iUserSceneSettings, settingId );
|
|
395 |
iUserSceneSettings[settingIndex]->iValueId = aSettingValue;
|
|
396 |
SaveStaticSettingL( settingId );
|
|
397 |
|
|
398 |
// If there is only one setting changed other than scene mode setting
|
|
399 |
// and if the Dynamic Scene mode is "User Scene" we update the new setting
|
|
400 |
// value to the camera dynamic settings
|
|
401 |
if ( !userSceneModeSettingChanged && settingId != ECamSettingItemUserSceneDefault )
|
|
402 |
{
|
|
403 |
TInt scene = IntegerSettingValue( ECamSettingItemDynamicPhotoScene );
|
|
404 |
// If user scene is the currently active photo scene then activate the
|
|
405 |
// new user scene settings.
|
|
406 |
if ( ECamSceneUser == scene )
|
|
407 |
{
|
|
408 |
CopyUserSceneSettingToCaptureSettingL( settingId );
|
|
409 |
}
|
|
410 |
}
|
|
411 |
|
|
412 |
}
|
|
413 |
// -------------------------------------------------------
|
|
414 |
else
|
|
415 |
{
|
|
416 |
// use the static settings model
|
|
417 |
iStaticModel->SetIntegerSettingValueL( aSettingItem, aSettingValue );
|
|
418 |
}
|
|
419 |
// -------------------------------------------------------
|
|
420 |
|
|
421 |
NotifyObservers( settingId, aSettingValue );
|
|
422 |
|
|
423 |
PRINT ( _L("Camera <= CCamSettingsModel::SetIntegerSettingValueL") );
|
|
424 |
}
|
|
425 |
|
|
426 |
|
|
427 |
// ---------------------------------------------------------------------------
|
|
428 |
// CCamSettingsModel::SetTextSettingValueL
|
|
429 |
// Sets a new text value for the specified setting
|
|
430 |
// ---------------------------------------------------------------------------
|
|
431 |
//
|
|
432 |
void CCamSettingsModel::SetTextSettingValueL( TInt aSettingItem,
|
|
433 |
const TDesC& aSettingValue )
|
|
434 |
{
|
|
435 |
iStaticModel->SetTextSettingValueL( aSettingItem, aSettingValue );
|
|
436 |
NotifyObservers( (TCamSettingItemIds)aSettingItem, aSettingValue );
|
|
437 |
}
|
|
438 |
|
|
439 |
|
|
440 |
// ---------------------------------------------------------------------------
|
|
441 |
// CCamSettingsModel::TextSettingValue
|
|
442 |
// Returns the current text value for the specified setting
|
|
443 |
// ---------------------------------------------------------------------------
|
|
444 |
//
|
|
445 |
TPtrC
|
|
446 |
CCamSettingsModel::TextSettingValue( TInt aSettingItem ) const
|
|
447 |
{
|
|
448 |
return iStaticModel->TextSettingValue( aSettingItem );
|
|
449 |
}
|
|
450 |
|
|
451 |
// ---------------------------------------------------------------------------
|
|
452 |
// CCamSettingsModel::SettingValueEnabled
|
|
453 |
// Returns ETrue if the setting value is currently enabled
|
|
454 |
// ---------------------------------------------------------------------------
|
|
455 |
//
|
|
456 |
TBool CCamSettingsModel::SettingValueEnabled( TInt aSettingItem,
|
|
457 |
TInt aSettingValue ) const
|
|
458 |
{
|
|
459 |
// The high quality video setting is not supported if
|
|
460 |
// the second camera is enabled
|
|
461 |
if ( aSettingItem == ECamSettingItemVideoQuality &&
|
|
462 |
aSettingValue == ECamVideoQualityHigh &&
|
|
463 |
static_cast<CCamAppUiBase*>(
|
|
464 |
iEnv->AppUi() )->IsSecondCameraEnabled() )
|
|
465 |
{
|
|
466 |
return EFalse;
|
|
467 |
}
|
|
468 |
// All other setting item values are allowed
|
|
469 |
return ETrue;
|
|
470 |
}
|
|
471 |
|
|
472 |
|
|
473 |
|
|
474 |
// ---------------------------------------------------------------------------
|
|
475 |
//
|
|
476 |
// ---------------------------------------------------------------------------
|
|
477 |
//
|
|
478 |
void
|
|
479 |
CCamSettingsModel
|
|
480 |
::AttachObserverL( const MCamSettingsModelObserver* aObserver )
|
|
481 |
{
|
|
482 |
if( aObserver )
|
|
483 |
{
|
|
484 |
TInt index = iObservers.Find( aObserver );
|
|
485 |
if( KErrNotFound == index )
|
|
486 |
{
|
|
487 |
iObservers.AppendL( aObserver );
|
|
488 |
}
|
|
489 |
}
|
|
490 |
}
|
|
491 |
|
|
492 |
|
|
493 |
// ---------------------------------------------------------------------------
|
|
494 |
//
|
|
495 |
// ---------------------------------------------------------------------------
|
|
496 |
//
|
|
497 |
void
|
|
498 |
CCamSettingsModel
|
|
499 |
::DetachObserver( const MCamSettingsModelObserver* aObserver )
|
|
500 |
{
|
|
501 |
if( aObserver )
|
|
502 |
{
|
|
503 |
TInt index = iObservers.Find( aObserver );
|
|
504 |
if( KErrNotFound != index )
|
|
505 |
{
|
|
506 |
iObservers.Remove( index );
|
|
507 |
}
|
|
508 |
}
|
|
509 |
}
|
|
510 |
|
|
511 |
|
|
512 |
|
|
513 |
// ---------------------------------------------------------------------------
|
|
514 |
// CCamSettingsModel::LoadSettingsL
|
|
515 |
// Loads the settings from shared data, or if unable to from the resource file.
|
|
516 |
// ---------------------------------------------------------------------------
|
|
517 |
//
|
|
518 |
void
|
|
519 |
CCamSettingsModel::LoadSettingsL()
|
|
520 |
{
|
|
521 |
PRINT( _L("Camera => CCamSettingsModel::LoadSettingsL"))
|
|
522 |
// Remove any previously loaded values.
|
|
523 |
UnloadSettings();
|
|
524 |
|
|
525 |
PRINT( _L("Camera => CCamSettingsModel::LoadSettingsL B"))
|
|
526 |
LoadDynamicSettingsL( R_CAM_PHOTO_DYNAMIC_SETTINGS_DATA,
|
|
527 |
iDynamicPhotoIntSettings,
|
|
528 |
iDynamicPhotoIntDefaults );
|
|
529 |
|
|
530 |
PRINT( _L("Camera => CCamSettingsModel::LoadSettingsL C"))
|
|
531 |
LoadDynamicSettingsL( R_CAM_VIDEO_DYNAMIC_SETTINGS_DATA,
|
|
532 |
iDynamicVideoIntSettings,
|
|
533 |
iDynamicVideoIntDefaults );
|
|
534 |
|
|
535 |
PRINT( _L("Camera => CCamSettingsModel::LoadSettingsL D"))
|
|
536 |
// Load image scene data
|
|
537 |
LoadSceneDataL();
|
|
538 |
|
|
539 |
// Load video scene data
|
|
540 |
LoadSceneDataL( EFalse );
|
|
541 |
|
|
542 |
PRINT( _L("Camera => CCamSettingsModel::LoadSettingsL E"))
|
|
543 |
//LoadScenesDataL( R_CAM_VIDEO_SCENES_DATA, iVideoScenes );
|
|
544 |
|
|
545 |
PRINT( _L("Camera <= CCamSettingsModel::LoadSettingsL"))
|
|
546 |
}
|
|
547 |
|
|
548 |
|
|
549 |
|
|
550 |
|
|
551 |
// ---------------------------------------------------------------------------
|
|
552 |
// DynamicSettingDefaultValue
|
|
553 |
//
|
|
554 |
// ---------------------------------------------------------------------------
|
|
555 |
//
|
|
556 |
TInt
|
|
557 |
CCamSettingsModel::DynamicSettingDefaultValue( TInt aSettingId ) const
|
|
558 |
{
|
|
559 |
TInt value = KErrNotFound;
|
|
560 |
|
|
561 |
TInt index = SearchInSettingsListFor( iDynamicPhotoIntSettings, aSettingId );
|
|
562 |
if( KErrNotFound != index )
|
|
563 |
{
|
|
564 |
value = iDynamicPhotoIntDefaults[index];
|
|
565 |
}
|
|
566 |
index = SearchInSettingsListFor( iDynamicVideoIntSettings, aSettingId );
|
|
567 |
if( KErrNotFound != index )
|
|
568 |
{
|
|
569 |
value = iDynamicVideoIntDefaults[index];
|
|
570 |
}
|
|
571 |
|
|
572 |
return value;
|
|
573 |
}
|
|
574 |
|
|
575 |
// ---------------------------------------------------------------------------
|
|
576 |
// CCamSettingsModel::SetDynamicSettingsToDefaults
|
|
577 |
// Sets all dynamic settings to their defaults.
|
|
578 |
// ---------------------------------------------------------------------------
|
|
579 |
//
|
|
580 |
void CCamSettingsModel::SetDynamicSettingsToDefaults()
|
|
581 |
{
|
|
582 |
// Set photo dynamic settings to their defaults.
|
|
583 |
TInt i;
|
|
584 |
TInt settingsListCount = iDynamicPhotoIntSettings.Count();
|
|
585 |
for ( i = 0; i < settingsListCount; ++i )
|
|
586 |
{
|
|
587 |
iDynamicPhotoIntSettings[i]->iValueId = iDynamicPhotoIntDefaults[i];
|
|
588 |
}
|
|
589 |
// Set video dynamic settings to their defaults.
|
|
590 |
settingsListCount = iDynamicVideoIntSettings.Count();
|
|
591 |
for ( i = 0; i < settingsListCount; ++i )
|
|
592 |
{
|
|
593 |
iDynamicVideoIntSettings[i]->iValueId = iDynamicVideoIntDefaults[i];
|
|
594 |
}
|
|
595 |
}
|
|
596 |
|
|
597 |
// ---------------------------------------------------------------------------
|
|
598 |
// CCamSettingsModel::SetDynamicSettingsToDefault
|
|
599 |
// Sets a dynamic setting to its default.
|
|
600 |
// ---------------------------------------------------------------------------
|
|
601 |
//
|
|
602 |
void CCamSettingsModel::SetDynamicSettingToDefault( TInt aSettingItem )
|
|
603 |
{
|
|
604 |
// Set photo dynamic settings to their defaults.
|
|
605 |
TInt i;
|
|
606 |
TBool found = EFalse;
|
|
607 |
TInt settingsListCount = iDynamicPhotoIntSettings.Count();
|
|
608 |
for ( i = 0; i < settingsListCount && !found; ++i )
|
|
609 |
{
|
|
610 |
if ( aSettingItem == iDynamicPhotoIntSettings[i]->iItemId )
|
|
611 |
{
|
|
612 |
iDynamicPhotoIntSettings[i]->iValueId = iDynamicPhotoIntDefaults[i];
|
|
613 |
found = ETrue;
|
|
614 |
}
|
|
615 |
}
|
|
616 |
// Set video dynamic settings to their defaults.
|
|
617 |
settingsListCount = iDynamicVideoIntSettings.Count();
|
|
618 |
for ( i = 0; i < settingsListCount && !found; ++i )
|
|
619 |
{
|
|
620 |
if ( aSettingItem == iDynamicVideoIntSettings[i]->iItemId )
|
|
621 |
{
|
|
622 |
iDynamicVideoIntSettings[i]->iValueId = iDynamicVideoIntDefaults[i];
|
|
623 |
found = ETrue;
|
|
624 |
}
|
|
625 |
}
|
|
626 |
|
|
627 |
// NB no error is reported is it's not found
|
|
628 |
}
|
|
629 |
|
|
630 |
|
|
631 |
// ---------------------------------------------------------------------------
|
|
632 |
// virtual SetDynamicSettingToSceneDefaultL
|
|
633 |
//
|
|
634 |
// Sets a dynamic setting to scene default.
|
|
635 |
// ---------------------------------------------------------------------------
|
|
636 |
//
|
|
637 |
TInt
|
|
638 |
CCamSettingsModel::SetDynamicSettingToSceneDefaultL( TInt aSceneId,
|
|
639 |
TInt aSceneField,
|
|
640 |
TInt aSettingId,
|
|
641 |
TBool aVideoScene )
|
|
642 |
{
|
|
643 |
PRINT( _L("Camera => CCamSettingsModel::SetDynamicSettingToSceneDefault") );
|
|
644 |
|
|
645 |
RPointerArray<TIntSetting>* sceneSettings = NULL;
|
|
646 |
TInt sceneIndex = KErrNotFound;
|
|
647 |
|
|
648 |
if( !aVideoScene )
|
|
649 |
{
|
|
650 |
sceneIndex = FindSceneInSceneList( aSceneId, iPhotoScenes );
|
|
651 |
if( KErrNotFound != sceneIndex )
|
|
652 |
{
|
|
653 |
sceneSettings = &(iPhotoScenes[sceneIndex]->iSettings);
|
|
654 |
}
|
|
655 |
}
|
|
656 |
else
|
|
657 |
{
|
|
658 |
sceneIndex = FindSceneInSceneList( aSceneId, iVideoScenes );
|
|
659 |
if( KErrNotFound != sceneIndex )
|
|
660 |
{
|
|
661 |
sceneSettings = &(iVideoScenes[sceneIndex]->iSettings);
|
|
662 |
}
|
|
663 |
}
|
|
664 |
|
|
665 |
TInt settingIndex = KErrNotFound;
|
|
666 |
if( sceneSettings )
|
|
667 |
{
|
|
668 |
settingIndex = SearchInSettingsListFor( *sceneSettings, aSceneField );
|
|
669 |
if( settingIndex != KErrNotFound )
|
|
670 |
{
|
|
671 |
SetIntegerSettingValueL( aSettingId,
|
|
672 |
(*sceneSettings)[settingIndex]->iValueId );
|
|
673 |
}
|
|
674 |
}
|
|
675 |
|
|
676 |
PRINT( _L("Camera <= CCamSettingsModel::SetDynamicSettingToSceneDefault") );
|
|
677 |
return settingIndex;
|
|
678 |
}
|
|
679 |
|
|
680 |
|
|
681 |
|
|
682 |
// ---------------------------------------------------------------------------
|
|
683 |
// CCamSettingsModel::LoadStaticSettingsL
|
|
684 |
// Loads the static settings from shared data. Required to update
|
|
685 |
// the settings whenever get foreground event, incase of external
|
|
686 |
// changes to the settings.
|
|
687 |
// Note that static settings cannot be loaded until the AppUi has been created,
|
|
688 |
// as which settings to use is dependent on if app is embedded or not.
|
|
689 |
// ---------------------------------------------------------------------------
|
|
690 |
//
|
|
691 |
void CCamSettingsModel::LoadStaticSettingsL( TBool aIsEmbedded )
|
|
692 |
{
|
|
693 |
PRINT(_L("Camera => CCamSettingsModel::LoadStaticSettingsL" ))
|
|
694 |
iEmbedded = aIsEmbedded;
|
|
695 |
|
|
696 |
// The model needs to register as an observer of changes in burst mode
|
|
697 |
// activation, as burst mode limits some settings values.
|
|
698 |
// The model registers with the AppUi which is created after the model.
|
|
699 |
// Registration is done here so we can guarantee that the AppUi has
|
|
700 |
// been created.
|
|
701 |
|
|
702 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
|
|
703 |
appUi->AddBurstModeObserverL( this );
|
|
704 |
|
|
705 |
// Free all memory currently used by the static settings.
|
|
706 |
UnloadStaticSettings();
|
|
707 |
|
|
708 |
iStaticModel->ReadFromCenRepL(
|
|
709 |
static_cast<TInt>( ECamSettingItemUserSceneRangeMin ),
|
|
710 |
static_cast<TInt>( ECamSettingItemUserSceneRangeMax ),
|
|
711 |
iUserSceneSettings
|
|
712 |
);
|
|
713 |
iStaticModel->LoadStaticSettingsL( aIsEmbedded );
|
|
714 |
if ( appUi->ReturningFromPretendExit() || appUi->IsFirstBoot() )
|
|
715 |
{
|
|
716 |
SetUserSceneDefault();
|
|
717 |
}
|
|
718 |
|
|
719 |
PRINT(_L("Camera <= CCamSettingsModel::LoadStaticSettingsL" ))
|
|
720 |
|
|
721 |
}
|
|
722 |
|
|
723 |
|
|
724 |
// ---------------------------------------------------------------------------
|
|
725 |
// CCamSettingsModel::SaveSettingsL
|
|
726 |
// Saves the static settings to the shared data ini file
|
|
727 |
// ---------------------------------------------------------------------------
|
|
728 |
//
|
|
729 |
void CCamSettingsModel::SaveSettingsL()
|
|
730 |
{
|
|
731 |
// This method is removed as we save to the CenRep whenever some setting
|
|
732 |
// is changed directly .. refer to SaveStaticSettingsL method
|
|
733 |
}
|
|
734 |
|
|
735 |
|
|
736 |
// ---------------------------------------------------------------------------
|
|
737 |
//
|
|
738 |
// ---------------------------------------------------------------------------
|
|
739 |
//
|
|
740 |
void
|
|
741 |
CCamSettingsModel::SaveStaticSettingL( TCamSettingItemIds aSettingId )
|
|
742 |
{
|
|
743 |
PRINT1( _L("Camera => CCamSettingsModel::SaveStaticSettingL, setting:[%s]"),
|
|
744 |
KCamSettingItemNames[aSettingId] );
|
|
745 |
TBool callStaticModel = ETrue;
|
|
746 |
|
|
747 |
{
|
|
748 |
// All the User Specific Settings are saved here in the CenRep
|
|
749 |
// and the remaining static settings are handled in the static model
|
|
750 |
RPointerArray<TIntSetting>* settingArray =
|
|
751 |
MapSettingItem2SettingsList( aSettingId );
|
|
752 |
|
|
753 |
if( settingArray == &iUserSceneSettings )
|
|
754 |
{
|
|
755 |
callStaticModel = EFalse;
|
|
756 |
TUint32 crKey = CCamStaticSettingsModel::MapSettingItem2CRKey( aSettingId, iEmbedded );
|
|
757 |
iStaticModel->SaveCenRepItemL( aSettingId, crKey, *settingArray );
|
|
758 |
}
|
|
759 |
}
|
|
760 |
if ( callStaticModel )
|
|
761 |
{
|
|
762 |
iStaticModel->SaveStaticSettingL( aSettingId );
|
|
763 |
}
|
|
764 |
PRINT( _L("Camera <= CCamSettingsModel::SaveStaticSettingL") );
|
|
765 |
}
|
|
766 |
|
|
767 |
|
|
768 |
// ---------------------------------------------------------------------------
|
|
769 |
//
|
|
770 |
// ---------------------------------------------------------------------------
|
|
771 |
//
|
|
772 |
RPointerArray<TIntSetting>*
|
|
773 |
CCamSettingsModel::MapSettingItem2SettingsList( TCamSettingItemIds aSettingId )
|
|
774 |
{
|
|
775 |
PRINT( _L("Camera => CCamSettingsModel::MapSettingItem2SettingsList") );
|
|
776 |
|
|
777 |
RPointerArray<TIntSetting>* array( NULL );
|
|
778 |
|
|
779 |
if( ECamSettingItemUserSceneRangeMin < aSettingId
|
|
780 |
&& ECamSettingItemUserSceneRangeMax > aSettingId )
|
|
781 |
{
|
|
782 |
array = &iUserSceneSettings;
|
|
783 |
}
|
|
784 |
else if( ECamSettingItemDynamicPhotoRangeMin < aSettingId
|
|
785 |
&& ECamSettingItemDynamicPhotoRangeMax > aSettingId )
|
|
786 |
{
|
|
787 |
array = &iDynamicPhotoIntSettings;
|
|
788 |
}
|
|
789 |
else if( ECamSettingItemDynamicVideoRangeMin < aSettingId
|
|
790 |
&& ECamSettingItemDynamicVideoRangeMax > aSettingId )
|
|
791 |
{
|
|
792 |
array = &iDynamicVideoIntSettings;
|
|
793 |
}
|
|
794 |
else
|
|
795 |
{
|
|
796 |
array = iStaticModel->MapSettingItem2SettingsList( aSettingId );
|
|
797 |
}
|
|
798 |
|
|
799 |
PRINT( _L("Camera <= CCamSettingsModel::MapSettingItem2SettingsList") );
|
|
800 |
return array;
|
|
801 |
}
|
|
802 |
|
|
803 |
|
|
804 |
// ---------------------------------------------------------------------------
|
|
805 |
// CCamSettingsModel::~CCamSettingsModel
|
|
806 |
// Destructor
|
|
807 |
// ---------------------------------------------------------------------------
|
|
808 |
//
|
|
809 |
CCamSettingsModel::~CCamSettingsModel()
|
|
810 |
{
|
|
811 |
PRINT( _L("Camera => ~CCamSettingsModel") );
|
|
812 |
|
|
813 |
UnLoadResources();
|
|
814 |
|
|
815 |
iObservers.Reset();
|
|
816 |
iObservers.Close();
|
|
817 |
|
|
818 |
iSettingPreviews.ResetAndDestroy();
|
|
819 |
iSettingPreviews.Close();
|
|
820 |
|
|
821 |
|
|
822 |
iUserSceneSettings.ResetAndDestroy();
|
|
823 |
iUserSceneSettings.Close();
|
|
824 |
|
|
825 |
iUserSceneSettingsBackup.ResetAndDestroy();
|
|
826 |
iUserSceneSettingsBackup.Close();
|
|
827 |
|
|
828 |
iDynamicPhotoIntSettings.ResetAndDestroy();
|
|
829 |
iDynamicPhotoIntSettings.Close();
|
|
830 |
|
|
831 |
iDynamicPhotoIntSettingsBackup.ResetAndDestroy();
|
|
832 |
iDynamicPhotoIntSettingsBackup.Close();
|
|
833 |
|
|
834 |
iDynamicPhotoIntDefaults.Close();
|
|
835 |
|
|
836 |
iDynamicVideoIntSettings.ResetAndDestroy();
|
|
837 |
iDynamicVideoIntSettings.Close();
|
|
838 |
|
|
839 |
iDynamicVideoIntSettingsBackup.ResetAndDestroy();
|
|
840 |
iDynamicVideoIntSettingsBackup.Close();
|
|
841 |
|
|
842 |
iDynamicVideoIntDefaults.Close();
|
|
843 |
|
|
844 |
iPhotoScenes.ResetAndDestroy();
|
|
845 |
iPhotoScenes.Close();
|
|
846 |
|
|
847 |
iVideoScenes.ResetAndDestroy();
|
|
848 |
iVideoScenes.Close();
|
|
849 |
|
|
850 |
iQualityLevels.ResetAndDestroy();
|
|
851 |
iQualityLevels.Close();
|
|
852 |
|
|
853 |
iVideoResolutions.Close();
|
|
854 |
iPhotoQualityLevels.Close();
|
|
855 |
iPhotoResolutions.Close();
|
|
856 |
|
|
857 |
if ( iStaticModel )
|
|
858 |
{
|
|
859 |
delete iStaticModel;
|
|
860 |
iStaticModel = NULL;
|
|
861 |
}
|
|
862 |
|
|
863 |
PRINT( _L("Camera <= ~CCamSettingsModel") );
|
|
864 |
}
|
|
865 |
|
|
866 |
// ---------------------------------------------------------------------------
|
|
867 |
// CCamSettingsModel::CCamSettingsModel
|
|
868 |
// C++ constructor
|
|
869 |
// ---------------------------------------------------------------------------
|
|
870 |
//
|
|
871 |
CCamSettingsModel::CCamSettingsModel( CCamConfiguration& aConfiguration )
|
|
872 |
: iDynamicPhotoIntDefaults( KDynamicArrayGranularity ),
|
|
873 |
iDynamicVideoIntDefaults( KDynamicArrayGranularity ),
|
|
874 |
iEngineReadyForVideoPrepare( ETrue ),
|
|
875 |
iConfiguration( aConfiguration )
|
|
876 |
{
|
|
877 |
PRINT( _L("Camera => CCamSettingsModel::CCamSettingsModel") );
|
|
878 |
|
|
879 |
// set up secondary camera defaults
|
|
880 |
// these values are not stored in the shared data file because
|
|
881 |
// they do not persist when the camera is changed or the app is closed
|
|
882 |
|
|
883 |
iSecondaryCameraSettings.iVideoQuality
|
|
884 |
= iConfiguration.SecondaryCameraVideoQuality();
|
|
885 |
iSecondaryCameraSettings.iPhotoQuality
|
|
886 |
= iConfiguration.SecondaryCameraImageQuality();
|
|
887 |
|
|
888 |
// Check that configuration can provide us secondary camera qualities
|
|
889 |
// If either of them is unavailable, all we can do is panic
|
|
890 |
PRINT( _L("Camera <> Checking secondary camera qualities") );
|
|
891 |
__ASSERT_ALWAYS( iSecondaryCameraSettings.iVideoQuality > 0,
|
|
892 |
CamPanic( ECamPanicSecondaryQualityMissing ) );
|
|
893 |
|
|
894 |
__ASSERT_ALWAYS( iSecondaryCameraSettings.iPhotoQuality > 0,
|
|
895 |
CamPanic( ECamPanicSecondaryQualityMissing ) );
|
|
896 |
|
|
897 |
// Check that configuration can provide us a MMS quality.
|
|
898 |
// If not available, all we can do is panic. MMS quality is
|
|
899 |
// needed in embedded mode.
|
|
900 |
PRINT( _L("Camera <> Checking MMS quality") );
|
|
901 |
__ASSERT_ALWAYS( iConfiguration.MmsImageQuality() > 0,
|
|
902 |
CamPanic( ECamPanicMMSQualityMissing ) );
|
|
903 |
|
|
904 |
|
|
905 |
PRINT( _L("Camera <= CCamSettingsModel::CCamSettingsModel") );
|
|
906 |
}
|
|
907 |
|
|
908 |
|
|
909 |
|
|
910 |
// ---------------------------------------------------------------------------
|
|
911 |
// CCamSettingsModel::ConstructL
|
|
912 |
// Symbian OS 2nd phase constructor
|
|
913 |
// ---------------------------------------------------------------------------
|
|
914 |
//
|
|
915 |
void CCamSettingsModel::ConstructL()
|
|
916 |
{
|
|
917 |
PRINT( _L("Camera => CCamSettingsModel::ConstructL"))
|
|
918 |
// Create reference to the CEikonEnv object, since it is used alot.
|
|
919 |
iEnv = CEikonEnv::Static();
|
|
920 |
|
|
921 |
LoadResourcesL();
|
|
922 |
|
|
923 |
iStaticModel = CCamStaticSettingsModel::NewL( iConfiguration );
|
|
924 |
|
|
925 |
iUiConfigManager = iStaticModel->UiConfigManagerPtr();
|
|
926 |
|
|
927 |
if ( !iUiConfigManager )CamPanic( ECamPanicNullPointer );
|
|
928 |
|
|
929 |
PRINT( _L("Camera => CCamSettingsModel::ConstructL create respository"))
|
|
930 |
|
|
931 |
// Load settings.
|
|
932 |
LoadSettingsL();
|
|
933 |
|
|
934 |
// Load the variant flags from the ini file
|
|
935 |
ReadVariantFlagsL();
|
|
936 |
|
|
937 |
// Load flag that specifies whether the engine should be updated with
|
|
938 |
// settings after an engine Prepare..() call.
|
|
939 |
// Create resource reader for reading photo static settings
|
|
940 |
TResourceReader reader;
|
|
941 |
iEnv->CreateResourceReaderLC( reader, R_CAM_ENGINE_UPDATE );
|
|
942 |
iUpdateAfterPrepare = reader.ReadInt16();
|
|
943 |
// Pop resource reader.
|
|
944 |
CleanupStack::PopAndDestroy();
|
|
945 |
|
|
946 |
// read in video quality levels
|
|
947 |
TInt i;
|
|
948 |
|
|
949 |
const TInt nVidQualities( iConfiguration.NumVideoQualities() );
|
|
950 |
for ( i=0; i < nVidQualities; i++ )
|
|
951 |
{
|
|
952 |
TVideoQualitySettings set = iConfiguration.VideoQuality( i );
|
|
953 |
CCamVideoQualityLevel* lev = CCamVideoQualityLevel::NewL( set );
|
|
954 |
CleanupStack::PushL( lev );
|
|
955 |
User::LeaveIfError( iQualityLevels.Append( lev ) );
|
|
956 |
CleanupStack::Pop( lev );
|
|
957 |
}
|
|
958 |
|
|
959 |
// read in (supported) video resolutions
|
|
960 |
TResourceReader videoResReader;
|
|
961 |
iEnv->CreateResourceReaderLC( videoResReader, R_CAM_VIDEO_RESOLUTION_ARRAY );
|
|
962 |
|
|
963 |
// get array of supported values
|
|
964 |
RArray<TInt> supportedVideoRes;
|
|
965 |
CleanupClosePushL( supportedVideoRes );
|
|
966 |
iConfiguration.GetPsiIntArrayL( ECamPsiSupportedVideoResolutions, supportedVideoRes );
|
|
967 |
|
|
968 |
TInt numLevels = videoResReader.ReadInt16();
|
|
969 |
|
|
970 |
for( i = 0; i < numLevels; i++ )
|
|
971 |
{
|
|
972 |
TSize videoRes;
|
|
973 |
videoRes.iWidth = videoResReader.ReadInt16();
|
|
974 |
videoRes.iHeight = videoResReader.ReadInt16();
|
|
975 |
|
|
976 |
User::LeaveIfError( iVideoResolutions.Append( videoRes ) );
|
|
977 |
}
|
|
978 |
|
|
979 |
// Close array of support vid resolutions
|
|
980 |
CleanupStack::PopAndDestroy( &supportedVideoRes );
|
|
981 |
|
|
982 |
// Pop resource reader.
|
|
983 |
CleanupStack::PopAndDestroy();
|
|
984 |
|
|
985 |
|
|
986 |
const TInt numQualities( iConfiguration.NumImageQualities() );
|
|
987 |
for( i=0; i<numQualities; i++ )
|
|
988 |
{
|
|
989 |
User::LeaveIfError(
|
|
990 |
iPhotoQualityLevels.Append( iConfiguration.ImageQuality( i ) ) );
|
|
991 |
}
|
|
992 |
|
|
993 |
// read in photo resolutions
|
|
994 |
TResourceReader photoResReader;
|
|
995 |
iEnv->CreateResourceReaderLC( photoResReader, R_CAM_PHOTO_RESOLUTION_ARRAY );
|
|
996 |
numLevels = photoResReader.ReadInt16();
|
|
997 |
|
|
998 |
// get array of supported values
|
|
999 |
RArray<TInt> supportedStillRes;
|
|
1000 |
CleanupClosePushL( supportedStillRes );
|
|
1001 |
|
|
1002 |
iConfiguration.GetPsiIntArrayL( ECamPsiSupportedStillResolutions, supportedStillRes );
|
|
1003 |
|
|
1004 |
for( i = 0; i < numLevels; i++ )
|
|
1005 |
{
|
|
1006 |
TSize photoRes;
|
|
1007 |
photoRes.iWidth = photoResReader.ReadInt16();
|
|
1008 |
photoRes.iHeight = photoResReader.ReadInt16();
|
|
1009 |
|
|
1010 |
User::LeaveIfError( iPhotoResolutions.Append( photoRes ) );
|
|
1011 |
|
|
1012 |
}
|
|
1013 |
|
|
1014 |
iPreviousFaceTrack = ECamSettOn;
|
|
1015 |
iPreviousSceneMode = ECamSceneAuto;
|
|
1016 |
// Close array of support photo resolutions
|
|
1017 |
CleanupStack::PopAndDestroy( &supportedStillRes );
|
|
1018 |
|
|
1019 |
// Pop resource reader.
|
|
1020 |
CleanupStack::PopAndDestroy();
|
|
1021 |
|
|
1022 |
PRINT( _L("Camera <= CCamSettingsModel::ConstructL"))
|
|
1023 |
}
|
|
1024 |
|
|
1025 |
|
|
1026 |
|
|
1027 |
|
|
1028 |
// ---------------------------------------------------------------------------
|
|
1029 |
// NotifyObservers
|
|
1030 |
//
|
|
1031 |
// Notify setting model observers, that a setting item value has changed.
|
|
1032 |
// Overload for integer setting items.
|
|
1033 |
// ---------------------------------------------------------------------------
|
|
1034 |
//
|
|
1035 |
void
|
|
1036 |
CCamSettingsModel::NotifyObservers( TCamSettingItemIds aSettingId,
|
|
1037 |
TInt aSettingValue )
|
|
1038 |
{
|
|
1039 |
PRINT1( _L("Camera => CCamSettingsModel::NotifyObservers, observers:%d"), iObservers.Count() );
|
|
1040 |
for( TInt i = 0; i < iObservers.Count(); i++ )
|
|
1041 |
{
|
|
1042 |
TRAP_IGNORE( iObservers[i]->IntSettingChangedL( aSettingId,
|
|
1043 |
aSettingValue ) );
|
|
1044 |
}
|
|
1045 |
PRINT ( _L("Camera <= CCamSettingsModel::NotifyObservers") );
|
|
1046 |
}
|
|
1047 |
|
|
1048 |
// ---------------------------------------------------------------------------
|
|
1049 |
// NotifyObservers
|
|
1050 |
//
|
|
1051 |
// Notify setting model observers, that a setting item value has changed.
|
|
1052 |
// Overload for text setting items.
|
|
1053 |
// ---------------------------------------------------------------------------
|
|
1054 |
//
|
|
1055 |
void
|
|
1056 |
CCamSettingsModel::NotifyObservers( TCamSettingItemIds aSettingId,
|
|
1057 |
const TDesC& aSettingValue )
|
|
1058 |
{
|
|
1059 |
for( TInt i = 0; i < iObservers.Count(); i++ )
|
|
1060 |
{
|
|
1061 |
TRAP_IGNORE( iObservers[i]->TextSettingChangedL( aSettingId,
|
|
1062 |
aSettingValue ) );
|
|
1063 |
}
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
|
|
1067 |
// ---------------------------------------------------------------------------
|
|
1068 |
// ReadVariantFlagsL
|
|
1069 |
//
|
|
1070 |
// Read Central Repository key values in KCRUidCameraappVariant repository.
|
|
1071 |
// ---------------------------------------------------------------------------
|
|
1072 |
//
|
|
1073 |
void
|
|
1074 |
CCamSettingsModel::ReadVariantFlagsL()
|
|
1075 |
{
|
|
1076 |
TInt crValue( 0 );
|
|
1077 |
CRepository* cr = CRepository::NewLC( KCRUidCameraappVariant );
|
|
1078 |
|
|
1079 |
// Get variant info general flags
|
|
1080 |
User::LeaveIfError( cr->Get( KCamCrVariantFlags, crValue ) );
|
|
1081 |
iVariantInfo.iFlags = crValue;
|
|
1082 |
|
|
1083 |
// Get 'time lapse enabled' flag
|
|
1084 |
User::LeaveIfError( cr->Get( KCamCrTimeLapseSupport, crValue ) );
|
|
1085 |
|
|
1086 |
iVariantInfo.iTimeLapseSupport = (KCamCrTimeLapseIsSupported == crValue)
|
|
1087 |
? ECamSupportOn
|
|
1088 |
: ECamSupportOff;
|
|
1089 |
|
|
1090 |
// Get 'app always running' flag
|
|
1091 |
User::LeaveIfError( cr->Get( KCamCrAppAlwaysRunning, crValue ) );
|
|
1092 |
iVariantInfo.iAlwaysOnSupport = (KCamCrAppAlwaysRunningIsOn == crValue)
|
|
1093 |
? ECamSupportOn
|
|
1094 |
: ECamSupportOff;
|
|
1095 |
|
|
1096 |
|
|
1097 |
// Get Public Release version
|
|
1098 |
User::LeaveIfError( cr->Get( KCamCrVersionMajor, crValue ) );
|
|
1099 |
iVariantInfo.iVersion.iMajor = (TInt8) crValue;
|
|
1100 |
|
|
1101 |
User::LeaveIfError( cr->Get( KCamCrVersionMinor, crValue ) );
|
|
1102 |
iVariantInfo.iVersion.iMinor = (TInt8) crValue;
|
|
1103 |
|
|
1104 |
User::LeaveIfError( cr->Get( KCamCrBuildNumber, crValue ) );
|
|
1105 |
iVariantInfo.iVersion.iBuild = (TInt16) crValue;
|
|
1106 |
|
|
1107 |
CleanupStack::PopAndDestroy( cr );
|
|
1108 |
}
|
|
1109 |
|
|
1110 |
|
|
1111 |
// ---------------------------------------------------------------------------
|
|
1112 |
// CCamSettingsModel::SettingIsForEngine
|
|
1113 |
// Returns whether a particular setting is an engine setting, or not.
|
|
1114 |
// ---------------------------------------------------------------------------
|
|
1115 |
//
|
|
1116 |
TBool CCamSettingsModel::SettingIsForEngine( TInt aSettingItem )
|
|
1117 |
{
|
|
1118 |
if ( ( aSettingItem == ECamSettingItemPhotoQuality ) ||
|
|
1119 |
( aSettingItem == ECamSettingItemVideoAudioRec ) ||
|
|
1120 |
( aSettingItem == ECamSettingItemVideoResolution ) ||
|
|
1121 |
( aSettingItem == ECamSettingItemVideoFileType ) ||
|
|
1122 |
( aSettingItem == ECamSettingItemVideoQuality ) )
|
|
1123 |
{
|
|
1124 |
return ETrue;
|
|
1125 |
}
|
|
1126 |
else
|
|
1127 |
{
|
|
1128 |
return EFalse;
|
|
1129 |
}
|
|
1130 |
}
|
|
1131 |
|
|
1132 |
|
|
1133 |
// ---------------------------------------------------------------------------
|
|
1134 |
// CCamSettingsModel::SearchInSettingsListFor
|
|
1135 |
// Searches in a settings list for a particular setting item.
|
|
1136 |
// ---------------------------------------------------------------------------
|
|
1137 |
//
|
|
1138 |
TInt CCamSettingsModel::SearchInSettingsListFor
|
|
1139 |
( const RPointerArray<TIntSetting>& aSettingsList, TInt aSettingItem ) const
|
|
1140 |
{
|
|
1141 |
TInt count = aSettingsList.Count();
|
|
1142 |
PRINT2( _L("Camera => CCamSettingsModel::SearchInSettingsListFor item (%d) count (%d)"), aSettingItem, count)
|
|
1143 |
TInt i;
|
|
1144 |
for ( i = 0; i < count; ++i )
|
|
1145 |
{
|
|
1146 |
if ( aSettingsList[i]->iItemId == aSettingItem )
|
|
1147 |
{
|
|
1148 |
return i;
|
|
1149 |
}
|
|
1150 |
}
|
|
1151 |
|
|
1152 |
return KErrNotFound;
|
|
1153 |
}
|
|
1154 |
|
|
1155 |
// ---------------------------------------------------------------------------
|
|
1156 |
// CCamSettingsModel::FindSceneInSceneList
|
|
1157 |
// Finds a scene in a particular scene list.
|
|
1158 |
// ---------------------------------------------------------------------------
|
|
1159 |
//
|
|
1160 |
TInt CCamSettingsModel::FindSceneInSceneList
|
|
1161 |
( TInt aSceneItemId, const RPointerArray<TSceneData >& aSceneList ) const
|
|
1162 |
{
|
|
1163 |
TInt count = aSceneList.Count();
|
|
1164 |
TInt i;
|
|
1165 |
for ( i = 0; i < count; ++i )
|
|
1166 |
{
|
|
1167 |
if ( aSceneList[i]->iSceneId == aSceneItemId )
|
|
1168 |
{
|
|
1169 |
return i;
|
|
1170 |
}
|
|
1171 |
}
|
|
1172 |
|
|
1173 |
return KErrNotFound;
|
|
1174 |
}
|
|
1175 |
|
|
1176 |
// ---------------------------------------------------------------------------
|
|
1177 |
// CCamSettingsModel::UserSceneHasChangedL
|
|
1178 |
// Handles a change in the value for the user scene setting.
|
|
1179 |
// That is, it updates the rest of the user setings.
|
|
1180 |
// ---------------------------------------------------------------------------
|
|
1181 |
//
|
|
1182 |
void CCamSettingsModel::UserSceneHasChangedL( TInt aSceneId, TBool aActivate )
|
|
1183 |
{
|
|
1184 |
|
|
1185 |
// Set the user setup flash setting to that of the new scene.
|
|
1186 |
TInt sceneFlash = DefaultSettingValueForScene( aSceneId, ECamSettingItemSceneFlashMode );
|
|
1187 |
SetIntegerSettingValueL( ECamSettingItemUserSceneFlash, sceneFlash );
|
|
1188 |
|
|
1189 |
// Set the user setup whitebalance to that of the new scene
|
|
1190 |
TInt whiteBal = DefaultSettingValueForScene( aSceneId, ECamSettingItemSceneAWBMode );
|
|
1191 |
SetIntegerSettingValueL( ECamSettingItemUserSceneWhitebalance, whiteBal );
|
|
1192 |
|
|
1193 |
// Set the user setup sharpness to that of the new scene
|
|
1194 |
TInt sharpness = DefaultSettingValueForScene( aSceneId, ECamSettingItemSceneSharpness );
|
|
1195 |
SetIntegerSettingValueL( ECamSettingItemUserSceneImageSharpness, sharpness );
|
|
1196 |
|
|
1197 |
// Set the user setup contrast to that of the new scene
|
|
1198 |
TInt contrast = DefaultSettingValueForScene( aSceneId, ECamSettingItemSceneContrast );
|
|
1199 |
SetIntegerSettingValueL( ECamSettingItemUserSceneContrast, contrast );
|
|
1200 |
|
|
1201 |
// Set the scene
|
|
1202 |
TInt settingIndex = SearchInSettingsListFor( iUserSceneSettings,
|
|
1203 |
ECamSettingItemUserSceneBasedOnScene );
|
|
1204 |
iUserSceneSettings[settingIndex]->iValueId = aSceneId;
|
|
1205 |
|
|
1206 |
// Save the new values.
|
|
1207 |
SaveSettingsL();
|
|
1208 |
|
|
1209 |
if ( aActivate )
|
|
1210 |
{
|
|
1211 |
// Activate user scene settings.
|
|
1212 |
ActivateUserSceneSettingsL();
|
|
1213 |
}
|
|
1214 |
}
|
|
1215 |
|
|
1216 |
// ---------------------------------------------------------------------------
|
|
1217 |
// CCamSettingsModel::PhotoSceneHasChangedL
|
|
1218 |
// Handles a change in the value for the photo scene setting.
|
|
1219 |
// That is, it updates the rest of the photo dynamic setings.
|
|
1220 |
// ---------------------------------------------------------------------------
|
|
1221 |
//
|
|
1222 |
void CCamSettingsModel::PhotoSceneHasChangedL( TInt aSceneId )
|
|
1223 |
{
|
|
1224 |
PRINT( _L("Camera => CCamSettingsModel::PhotoSceneHasChangedL") )
|
|
1225 |
// If the scene has changed to a scene other than the "User" scene
|
|
1226 |
// set capture setup values to defaults and the flash to scene flash.
|
|
1227 |
if ( aSceneId != ECamSceneUser )
|
|
1228 |
{
|
|
1229 |
// Set all the photo capture setup values to their defaults, except
|
|
1230 |
// for the scene setting.
|
|
1231 |
TInt settingsCount = iDynamicPhotoIntSettings.Count();
|
|
1232 |
TInt i;
|
|
1233 |
for ( i = 0; i < settingsCount; ++i )
|
|
1234 |
{
|
|
1235 |
// If the setting item is not the scene change it's value,
|
|
1236 |
// and update the engine
|
|
1237 |
if ( iDynamicPhotoIntSettings[i]->iItemId != ECamSettingItemDynamicPhotoScene )
|
|
1238 |
{
|
|
1239 |
SetIntegerSettingValueL( iDynamicPhotoIntSettings[i]->iItemId,
|
|
1240 |
iDynamicPhotoIntDefaults[i] );
|
|
1241 |
}
|
|
1242 |
}
|
|
1243 |
|
|
1244 |
// Set the capture setup flash setting to that of the new scene.
|
|
1245 |
TInt sceneFlash = DefaultSettingValueForScene( aSceneId, ECamSettingItemSceneFlashMode );
|
|
1246 |
SetIntegerSettingValueL( ECamSettingItemDynamicPhotoFlash, sceneFlash );
|
|
1247 |
|
|
1248 |
// Set the user setup whitebalance to that of the new scene
|
|
1249 |
TInt whiteBal = DefaultSettingValueForScene( aSceneId, ECamSettingItemSceneAWBMode );
|
|
1250 |
SetIntegerSettingValueL( ECamSettingItemDynamicPhotoWhiteBalance, whiteBal );
|
|
1251 |
|
|
1252 |
// Set the user setup sharpness to that of the new scene
|
|
1253 |
TInt sharpness = DefaultSettingValueForScene( aSceneId, ECamSettingItemSceneSharpness );
|
|
1254 |
SetIntegerSettingValueL( ECamSettingItemDynamicPhotoImageSharpness, sharpness );
|
|
1255 |
|
|
1256 |
// Set the user setup contrast to that of the new scene
|
|
1257 |
TInt contrast = DefaultSettingValueForScene( aSceneId, ECamSettingItemSceneContrast );
|
|
1258 |
SetIntegerSettingValueL( ECamSettingItemDynamicPhotoBrightness, contrast );
|
|
1259 |
|
|
1260 |
// Update the engine with the scene settings.
|
|
1261 |
//UpdateEngineWithSceneSettingsL( iPhotoScenes, aSceneId );
|
|
1262 |
}
|
|
1263 |
|
|
1264 |
// Otherwise, activate the user scene settings
|
|
1265 |
else
|
|
1266 |
{
|
|
1267 |
ActivateUserSceneSettingsL();
|
|
1268 |
}
|
|
1269 |
|
|
1270 |
|
|
1271 |
if ( iUiConfigManager->IsFaceTrackingSupported() ) // FT supported
|
|
1272 |
{
|
|
1273 |
PRINT( _L("Camera <> Face tracking supported") )
|
|
1274 |
if ( ECamSceneScenery == aSceneId ||
|
|
1275 |
ECamSceneSports == aSceneId ||
|
|
1276 |
ECamSceneMacro == aSceneId)
|
|
1277 |
{
|
|
1278 |
PRINT( _L("Camera <> New scene mode is scenery, sports or macro") )
|
|
1279 |
if ( ECamSceneScenery != iPreviousSceneMode &&
|
|
1280 |
ECamSceneSports != iPreviousSceneMode &&
|
|
1281 |
ECamSceneMacro != iPreviousSceneMode )
|
|
1282 |
{
|
|
1283 |
PRINT( _L("Camera <> Previous scene mode is not scenery, sports or macro -> Set iPreviousFaceTrack to current value") )
|
|
1284 |
iPreviousFaceTrack = TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) );
|
|
1285 |
}
|
|
1286 |
PRINT( _L("Camera <> Switch face tracking OFF") )
|
|
1287 |
SetIntegerSettingValueL( ECamSettingItemFaceTracking, ECamSettOff );
|
|
1288 |
}
|
|
1289 |
else if ( ( ECamSceneScenery == iPreviousSceneMode ||
|
|
1290 |
ECamSceneSports == iPreviousSceneMode ||
|
|
1291 |
ECamSceneMacro == iPreviousSceneMode ) &&
|
|
1292 |
( ECamSettOff == TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) ) ) )
|
|
1293 |
{
|
|
1294 |
PRINT( _L("Camera <> Previous scene mode was scenery, sports or macro AND face tracking is OFF") )
|
|
1295 |
PRINT( _L("Camera <> Set face tracking to iPreviousFaceTrack") )
|
|
1296 |
SetIntegerSettingValueL( ECamSettingItemFaceTracking, iPreviousFaceTrack );
|
|
1297 |
PRINT( _L("Camera <> Set iPreviousFaceTrack to current face tracking state") )
|
|
1298 |
iPreviousFaceTrack = TCamSettingsOnOff( IntegerSettingValue( ECamSettingItemFaceTracking ) );
|
|
1299 |
CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( iEnv->AppUi() );
|
|
1300 |
TRAP_IGNORE( appUi->APHandler()->UpdateActivePaletteL() );
|
|
1301 |
}
|
|
1302 |
}
|
|
1303 |
|
|
1304 |
|
|
1305 |
iPreviousSceneMode = TCamSceneId( aSceneId ); // store scene mode setting
|
|
1306 |
PRINT( _L("Camera <= CCamSettingsModel::PhotoSceneHasChangedL()") )
|
|
1307 |
}
|
|
1308 |
|
|
1309 |
// ---------------------------------------------------------------------------
|
|
1310 |
// CCamSettingsModel::CopyUserSceneSettingToCaptureSettingL
|
|
1311 |
// Copies a user scene setting across to the capture setup settings.
|
|
1312 |
// ---------------------------------------------------------------------------
|
|
1313 |
//
|
|
1314 |
void CCamSettingsModel::CopyUserSceneSettingToCaptureSettingL( TInt aSettingItem )
|
|
1315 |
{
|
|
1316 |
// Determine the indexes of the user scene setting and
|
|
1317 |
// the corresponding photo capture setting.
|
|
1318 |
|
|
1319 |
// ...determine the index of the user scene setting
|
|
1320 |
TInt userIndex = SearchInSettingsListFor( iUserSceneSettings,
|
|
1321 |
aSettingItem );
|
|
1322 |
|
|
1323 |
// ...determine the index of the corresponding photo capture setting
|
|
1324 |
TInt capIndex = 0;
|
|
1325 |
switch ( aSettingItem )
|
|
1326 |
{
|
|
1327 |
case ECamSettingItemUserSceneWhitebalance:
|
|
1328 |
{
|
|
1329 |
capIndex = SearchInSettingsListFor( iDynamicPhotoIntSettings,
|
|
1330 |
ECamSettingItemDynamicPhotoWhiteBalance );
|
|
1331 |
}
|
|
1332 |
break;
|
|
1333 |
|
|
1334 |
case ECamSettingItemUserSceneExposure:
|
|
1335 |
{
|
|
1336 |
capIndex = SearchInSettingsListFor( iDynamicPhotoIntSettings,
|
|
1337 |
ECamSettingItemDynamicPhotoExposure );
|
|
1338 |
}
|
|
1339 |
break;
|
|
1340 |
|
|
1341 |
case ECamSettingItemUserSceneColourFilter:
|
|
1342 |
{
|
|
1343 |
capIndex = SearchInSettingsListFor( iDynamicPhotoIntSettings,
|
|
1344 |
ECamSettingItemDynamicPhotoColourFilter );
|
|
1345 |
}
|
|
1346 |
break;
|
|
1347 |
case ECamSettingItemUserSceneFlash:
|
|
1348 |
{
|
|
1349 |
capIndex = SearchInSettingsListFor( iDynamicPhotoIntSettings,
|
|
1350 |
ECamSettingItemDynamicPhotoFlash );
|
|
1351 |
}
|
|
1352 |
break;
|
|
1353 |
|
|
1354 |
case ECamSettingItemUserSceneBrightness:
|
|
1355 |
{
|
|
1356 |
capIndex = SearchInSettingsListFor( iDynamicPhotoIntSettings,
|
|
1357 |
ECamSettingItemDynamicPhotoBrightness );
|
|
1358 |
}
|
|
1359 |
break;
|
|
1360 |
case ECamSettingItemUserSceneContrast:
|
|
1361 |
{
|
|
1362 |
capIndex = SearchInSettingsListFor( iDynamicPhotoIntSettings,
|
|
1363 |
ECamSettingItemDynamicPhotoContrast );
|
|
1364 |
}
|
|
1365 |
break;
|
|
1366 |
|
|
1367 |
case ECamSettingItemUserSceneImageSharpness:
|
|
1368 |
{
|
|
1369 |
capIndex = SearchInSettingsListFor( iDynamicPhotoIntSettings,
|
|
1370 |
ECamSettingItemDynamicPhotoImageSharpness );
|
|
1371 |
}
|
|
1372 |
break;
|
|
1373 |
|
|
1374 |
case ECamSettingItemUserSceneLightSensitivity:
|
|
1375 |
{
|
|
1376 |
capIndex = SearchInSettingsListFor(iDynamicPhotoIntSettings,
|
|
1377 |
ECamSettingItemDynamicPhotoLightSensitivity );
|
|
1378 |
}
|
|
1379 |
break;
|
|
1380 |
default:
|
|
1381 |
PRINT( _L("Camera => CCamSettingsModel::ECamPanicUnknownSettingItem 6" ))
|
|
1382 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
1383 |
break;
|
|
1384 |
}
|
|
1385 |
|
|
1386 |
// Copy the user scene setting across to the photo capture setting.
|
|
1387 |
iDynamicPhotoIntSettings[capIndex]->iValueId =
|
|
1388 |
iUserSceneSettings[userIndex]->iValueId;
|
|
1389 |
|
|
1390 |
}
|
|
1391 |
|
|
1392 |
|
|
1393 |
// ---------------------------------------------------------------------------
|
|
1394 |
// CCamSettingsModel::ActivateUserSceneSettings
|
|
1395 |
// Activates the current user scene settings.
|
|
1396 |
// ---------------------------------------------------------------------------
|
|
1397 |
//
|
|
1398 |
void CCamSettingsModel::ActivateUserSceneSettingsL()
|
|
1399 |
{
|
|
1400 |
PRINT( _L("Camera => CCamSettingsModel::ActivateUserSceneSettingsL"))
|
|
1401 |
// Copy all the user scene settings to capture settings.
|
|
1402 |
CopyUserSceneSettingToCaptureSettingL(
|
|
1403 |
ECamSettingItemUserSceneWhitebalance );
|
|
1404 |
CopyUserSceneSettingToCaptureSettingL(
|
|
1405 |
ECamSettingItemUserSceneExposure );
|
|
1406 |
CopyUserSceneSettingToCaptureSettingL(
|
|
1407 |
ECamSettingItemUserSceneColourFilter );
|
|
1408 |
CopyUserSceneSettingToCaptureSettingL(
|
|
1409 |
ECamSettingItemUserSceneFlash );
|
|
1410 |
CopyUserSceneSettingToCaptureSettingL(
|
|
1411 |
ECamSettingItemUserSceneBrightness );
|
|
1412 |
CopyUserSceneSettingToCaptureSettingL(
|
|
1413 |
ECamSettingItemUserSceneContrast );
|
|
1414 |
CopyUserSceneSettingToCaptureSettingL(
|
|
1415 |
ECamSettingItemUserSceneImageSharpness );
|
|
1416 |
|
|
1417 |
if ( iUiConfigManager->IsISOSupported() )
|
|
1418 |
{
|
|
1419 |
CopyUserSceneSettingToCaptureSettingL(
|
|
1420 |
ECamSettingItemUserSceneLightSensitivity );
|
|
1421 |
}
|
|
1422 |
|
|
1423 |
// Handled in appcontroller
|
|
1424 |
//UpdateEngineWithPhotoCaptureSetupSettingsL();
|
|
1425 |
PRINT( _L("Camera <= CCamSettingsModel::ActivateUserSceneSettingsL"))
|
|
1426 |
}
|
|
1427 |
|
|
1428 |
// ---------------------------------------------------------------------------
|
|
1429 |
// CCamSettingsModel::VideoSceneHasChangedL
|
|
1430 |
// Handles a change in the value for the video scene setting.
|
|
1431 |
// That is, it updates the rest of the video dynamic setings.
|
|
1432 |
// ---------------------------------------------------------------------------
|
|
1433 |
//
|
|
1434 |
void CCamSettingsModel::VideoSceneHasChangedL( TInt aSettingValue )
|
|
1435 |
{
|
|
1436 |
// Set all the video capture setup values to their defaults,
|
|
1437 |
// except for the scene setting.
|
|
1438 |
TInt settingsCount = iDynamicVideoIntSettings.Count();
|
|
1439 |
TInt i;
|
|
1440 |
for ( i = 0; i < settingsCount; ++i )
|
|
1441 |
{
|
|
1442 |
//video light is used for LED flash not for xenon flash
|
|
1443 |
if ( iDynamicVideoIntSettings[i]->iItemId == ECamSettingItemDynamicVideoFlash )
|
|
1444 |
{
|
|
1445 |
if ( iUiConfigManager->IsVideoLightSupported() && !iUiConfigManager->IsXenonFlashSupported() )
|
|
1446 |
{
|
|
1447 |
// Set the capture setup flash setting to that of the new scene.
|
|
1448 |
TInt sceneFlash = DefaultSettingValueForVideoScene( aSettingValue, ECamSettingItemSceneFlashMode );
|
|
1449 |
SetIntegerSettingValueL( ECamSettingItemDynamicVideoFlash, sceneFlash );
|
|
1450 |
}
|
|
1451 |
}
|
|
1452 |
// If the setting item is not the scene change it's value.
|
|
1453 |
else if ( iDynamicVideoIntSettings[i]->iItemId != ECamSettingItemDynamicVideoScene )
|
|
1454 |
{
|
|
1455 |
SetIntegerSettingValueL( iDynamicVideoIntSettings[i]->iItemId,
|
|
1456 |
iDynamicVideoIntDefaults[i] );
|
|
1457 |
}
|
|
1458 |
}
|
|
1459 |
|
|
1460 |
// Update the engine with the scene settings.
|
|
1461 |
//UpdateEngineWithSceneSettingsL( iVideoScenes, aSettingValue );
|
|
1462 |
}
|
|
1463 |
|
|
1464 |
|
|
1465 |
// ---------------------------------------------------------------------------
|
|
1466 |
// CCamSettingsModel::DefaultSettingValueForVideoScene
|
|
1467 |
// Returns the default value of a setting for a video scene item.
|
|
1468 |
// ---------------------------------------------------------------------------
|
|
1469 |
//
|
|
1470 |
TInt CCamSettingsModel::DefaultSettingValueForVideoScene( TInt aSceneId, TInt aSettingId ) const
|
|
1471 |
{
|
|
1472 |
TInt sceneIndex = FindSceneInSceneList( aSceneId, iVideoScenes );
|
|
1473 |
|
|
1474 |
TInt settingIndex = SearchInSettingsListFor(
|
|
1475 |
iVideoScenes[sceneIndex]->iSettings, aSettingId );
|
|
1476 |
|
|
1477 |
return iVideoScenes[sceneIndex]->iSettings[settingIndex]->iValueId;
|
|
1478 |
}
|
|
1479 |
|
|
1480 |
|
|
1481 |
// ---------------------------------------------------------------------------
|
|
1482 |
// CCamSettingsModel::PhotoSceneMaximumQuality
|
|
1483 |
// Returns the highest allowed quality for the current photo scene.
|
|
1484 |
// ---------------------------------------------------------------------------
|
|
1485 |
//
|
|
1486 |
TInt CCamSettingsModel::PhotoSceneMaximumQuality( TInt aSceneId ) const
|
|
1487 |
{
|
|
1488 |
// If the scene is the user scene return the maximum amount.
|
|
1489 |
// This is to be changed once user scene has been implemented.
|
|
1490 |
if ( aSceneId == ECamSceneUser )
|
|
1491 |
{
|
|
1492 |
// Get the scene that the user scene is based on and
|
|
1493 |
// get the maximum resolution for this scene.
|
|
1494 |
TInt settingIndex = SearchInSettingsListFor(
|
|
1495 |
iUserSceneSettings, ECamSettingItemUserSceneBasedOnScene );
|
|
1496 |
TInt sceneId = iUserSceneSettings[settingIndex]->iValueId;
|
|
1497 |
|
|
1498 |
return PhotoSceneMaximumQuality( sceneId );
|
|
1499 |
}
|
|
1500 |
|
|
1501 |
// Find the index to the scene.
|
|
1502 |
TInt sceneIndex = FindSceneInSceneList( aSceneId, iPhotoScenes );
|
|
1503 |
// Search for the maximum resolution item in this scene's item list.
|
|
1504 |
TInt settingsCount = iPhotoScenes[sceneIndex]->iSettings.Count();
|
|
1505 |
TInt i;
|
|
1506 |
for ( i = 0; i < settingsCount; ++i )
|
|
1507 |
{
|
|
1508 |
if ( iPhotoScenes[sceneIndex]->iSettings[i]->iItemId == ECamSettingItemSceneMaxRes )
|
|
1509 |
{
|
|
1510 |
return iPhotoScenes[sceneIndex]->iSettings[i]->iValueId;
|
|
1511 |
}
|
|
1512 |
}
|
|
1513 |
PRINT( _L("Camera => CCamSettingsModel::ECamPanicUnknownSettingItem 7" ))
|
|
1514 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
1515 |
// Remove warning
|
|
1516 |
return KErrNotFound;
|
|
1517 |
}
|
|
1518 |
|
|
1519 |
|
|
1520 |
// ---------------------------------------------------------------------------
|
|
1521 |
// CCamSettingsModel::CurrentPhotoQualityValue
|
|
1522 |
// Returns the current photo quality setting.
|
|
1523 |
// ---------------------------------------------------------------------------
|
|
1524 |
//
|
|
1525 |
TInt CCamSettingsModel::CurrentPhotoQualityValue() const
|
|
1526 |
{
|
|
1527 |
return iStaticModel->IntegerSettingValue( ECamSettingItemPhotoQuality );
|
|
1528 |
}
|
|
1529 |
|
|
1530 |
// ---------------------------------------------------------------------------
|
|
1531 |
// CCamSettingsModel::PhotoQualityArrayIndex
|
|
1532 |
// Returns the photo quailty array index of a specified photo quality id
|
|
1533 |
// ---------------------------------------------------------------------------
|
|
1534 |
//
|
|
1535 |
|
|
1536 |
TInt CCamSettingsModel::PhotoQualityArrayIndex(TInt aPhotoQualityId) const
|
|
1537 |
{
|
|
1538 |
for(TInt i=0;i<iPhotoQualityLevels.Count();i++)
|
|
1539 |
{
|
|
1540 |
if(iPhotoQualityLevels[i].iPhotoQualityId == aPhotoQualityId)
|
|
1541 |
{
|
|
1542 |
return i;
|
|
1543 |
}
|
|
1544 |
}
|
|
1545 |
return KErrNotFound;
|
|
1546 |
}
|
|
1547 |
|
|
1548 |
// ---------------------------------------------------------------------------
|
|
1549 |
// CCamSettingsModel::CurrentPhotoCompression
|
|
1550 |
// Returns the current photo quality level (value 1-100).
|
|
1551 |
// ---------------------------------------------------------------------------
|
|
1552 |
//
|
|
1553 |
TInt CCamSettingsModel::CurrentPhotoCompression() const
|
|
1554 |
{
|
|
1555 |
TInt currentQualityLevel = PhotoQualityArrayIndex(CurrentPhotoQualityValue());
|
|
1556 |
|
|
1557 |
if ( currentQualityLevel != KErrNotFound )
|
|
1558 |
{
|
|
1559 |
// Get the compression level for the current quality setting.
|
|
1560 |
TCamPhotoQualitySetting quality =
|
|
1561 |
iPhotoQualityLevels[currentQualityLevel];
|
|
1562 |
TInt compressionLevel = quality.iQualityLevel;
|
|
1563 |
return compressionLevel;
|
|
1564 |
}
|
|
1565 |
|
|
1566 |
PRINT( _L("Camera => CCamSettingsModel::ECamPanicUnknownSettingItem 10" ))
|
|
1567 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
1568 |
// Remove warning
|
|
1569 |
return KErrNotFound;
|
|
1570 |
}
|
|
1571 |
|
|
1572 |
|
|
1573 |
// ---------------------------------------------------------------------------
|
|
1574 |
// CCamSettingsModel::CurrentPhotoResolution
|
|
1575 |
// Returns the photo resolution from current Settings
|
|
1576 |
// ---------------------------------------------------------------------------
|
|
1577 |
//
|
|
1578 |
TCamPhotoSizeId CCamSettingsModel::CurrentPhotoResolution() const
|
|
1579 |
{
|
|
1580 |
return PhotoResolution( CurrentPhotoQualityValue() );
|
|
1581 |
}
|
|
1582 |
|
|
1583 |
// ---------------------------------------------------------------------------
|
|
1584 |
// CCamSettingsModel::PhotoResolution
|
|
1585 |
// Returns the photo resolution for a particular quality index
|
|
1586 |
// ---------------------------------------------------------------------------
|
|
1587 |
//
|
|
1588 |
TCamPhotoSizeId CCamSettingsModel::PhotoResolution( TInt aQualityIndex ) const
|
|
1589 |
{
|
|
1590 |
TInt qualityValue = PhotoQualityArrayIndex( aQualityIndex );
|
|
1591 |
|
|
1592 |
if ( qualityValue != KErrNotFound )
|
|
1593 |
{
|
|
1594 |
TCamPhotoQualitySetting quality =
|
|
1595 |
iPhotoQualityLevels[qualityValue];
|
|
1596 |
|
|
1597 |
return iConfiguration.MapResolutionToPhotoSize( quality.iPhotoResolution );
|
|
1598 |
}
|
|
1599 |
|
|
1600 |
PRINT( _L("Camera => CCamSettingsModel::ECamPanicUnknownSettingItem 11" ))
|
|
1601 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
1602 |
// Remove warning
|
|
1603 |
return ECamPhotoSizeVGA; // We can never get here anyway
|
|
1604 |
}
|
|
1605 |
|
|
1606 |
// ---------------------------------------------------------------------------
|
|
1607 |
// CCamSettingsModel::StorePrimaryCameraSettingsL
|
|
1608 |
// Stores the primary camera settings so they can be reapplied when
|
|
1609 |
// changing from front to back camera
|
|
1610 |
// ---------------------------------------------------------------------------
|
|
1611 |
//
|
|
1612 |
void CCamSettingsModel::StorePrimaryCameraSettingsL()
|
|
1613 |
{
|
|
1614 |
PRINT( _L("Camera => CCamSettingsModel::StorePrimaryCameraSettingsL"))
|
|
1615 |
iStaticModel->StorePrimaryCameraSettingsL();
|
|
1616 |
CopySettingsL(iDynamicPhotoIntSettings, iDynamicPhotoIntSettingsBackup);
|
|
1617 |
CopySettingsL(iDynamicVideoIntSettings, iDynamicVideoIntSettingsBackup);
|
|
1618 |
PRINT( _L("Camera <= CCamSettingsModel::StorePrimaryCameraSettingsL"))
|
|
1619 |
}
|
|
1620 |
|
|
1621 |
// ---------------------------------------------------------------------------
|
|
1622 |
// CCamSettingsModel::RestorePrimaryCameraSettingsL
|
|
1623 |
// Restores the primary camera settings when
|
|
1624 |
// changing from front to back camera
|
|
1625 |
// ---------------------------------------------------------------------------
|
|
1626 |
//
|
|
1627 |
void CCamSettingsModel::RestorePrimaryCameraSettingsL()
|
|
1628 |
{
|
|
1629 |
// set the stored primary camera settings
|
|
1630 |
iStaticModel->RestorePrimaryCameraSettingsL();
|
|
1631 |
CopySettingsL(iDynamicPhotoIntSettingsBackup, iDynamicPhotoIntSettings, ETrue);
|
|
1632 |
CopySettingsL(iDynamicVideoIntSettingsBackup, iDynamicVideoIntSettings, ETrue);
|
|
1633 |
CopySettingsL(iUserSceneSettingsBackup, iUserSceneSettings, ETrue);
|
|
1634 |
}
|
|
1635 |
|
|
1636 |
// ---------------------------------------------------------------------------
|
|
1637 |
// VariantInfo
|
|
1638 |
// ---------------------------------------------------------------------------
|
|
1639 |
//
|
|
1640 |
const TCamVariantInfo&
|
|
1641 |
CCamSettingsModel::VariantInfo()
|
|
1642 |
{
|
|
1643 |
if( 0 > iVariantInfo.iFlags )
|
|
1644 |
{
|
|
1645 |
TRAP_IGNORE( ReadVariantFlagsL() );
|
|
1646 |
}
|
|
1647 |
return iVariantInfo;
|
|
1648 |
}
|
|
1649 |
|
|
1650 |
|
|
1651 |
// ---------------------------------------------------------------------------
|
|
1652 |
// CCamSettingsModel::ResetRepository
|
|
1653 |
// Reset Camera central repository file
|
|
1654 |
// ---------------------------------------------------------------------------
|
|
1655 |
//
|
|
1656 |
void CCamSettingsModel::ResetRepository()
|
|
1657 |
{
|
|
1658 |
iStaticModel->ResetRepository();
|
|
1659 |
}
|
|
1660 |
|
|
1661 |
|
|
1662 |
|
|
1663 |
|
|
1664 |
// ===========================================================================
|
|
1665 |
// From base class MCamSettingPreviewHandler
|
|
1666 |
|
|
1667 |
// ---------------------------------------------------------------------------
|
|
1668 |
//
|
|
1669 |
// ---------------------------------------------------------------------------
|
|
1670 |
//
|
|
1671 |
void
|
|
1672 |
CCamSettingsModel::ActivatePreviewL( const TCamSettingItemIds& aSettingId,
|
|
1673 |
TInt aSettingValue )
|
|
1674 |
{
|
|
1675 |
TInt index = FindIndex( iSettingPreviews, aSettingId );
|
|
1676 |
if( KErrNotFound == index )
|
|
1677 |
{
|
|
1678 |
// Preview for this setting id did not exist yet.
|
|
1679 |
TIntSetting* settingItem = new (ELeave) TIntSetting;
|
|
1680 |
CleanupStack::PushL( settingItem );
|
|
1681 |
|
|
1682 |
settingItem->iItemId = aSettingId;
|
|
1683 |
settingItem->iValueId = aSettingValue;
|
|
1684 |
|
|
1685 |
iSettingPreviews.AppendL( settingItem );
|
|
1686 |
CleanupStack::Pop( settingItem );
|
|
1687 |
}
|
|
1688 |
else
|
|
1689 |
{
|
|
1690 |
// If a preview exists, only update the value.
|
|
1691 |
// Only one preview per setting item active at once.
|
|
1692 |
iSettingPreviews[index]->iValueId = aSettingValue;
|
|
1693 |
}
|
|
1694 |
// The preview is considered as current setting value.
|
|
1695 |
// Notify observers as if the setting value had changed.
|
|
1696 |
NotifyObservers( aSettingId, aSettingValue );
|
|
1697 |
}
|
|
1698 |
|
|
1699 |
|
|
1700 |
// ---------------------------------------------------------------------------
|
|
1701 |
//
|
|
1702 |
// ---------------------------------------------------------------------------
|
|
1703 |
//
|
|
1704 |
void
|
|
1705 |
CCamSettingsModel::CancelPreview( const TCamSettingItemIds& aSettingId )
|
|
1706 |
{
|
|
1707 |
TInt index = FindIndex( iSettingPreviews, aSettingId );
|
|
1708 |
|
|
1709 |
if( KErrNotFound != index )
|
|
1710 |
{
|
|
1711 |
TIntSetting* settingItem = iSettingPreviews[index];
|
|
1712 |
iSettingPreviews.Remove( index );
|
|
1713 |
delete settingItem;
|
|
1714 |
settingItem = NULL;
|
|
1715 |
}
|
|
1716 |
}
|
|
1717 |
|
|
1718 |
|
|
1719 |
// ---------------------------------------------------------------------------
|
|
1720 |
//
|
|
1721 |
// ---------------------------------------------------------------------------
|
|
1722 |
//
|
|
1723 |
void
|
|
1724 |
CCamSettingsModel::CancelPreviews( const RArray<TCamSettingItemIds> aSettingIds )
|
|
1725 |
{
|
|
1726 |
// Check if there is anything to cancel
|
|
1727 |
if( 0 < iSettingPreviews.Count() )
|
|
1728 |
{
|
|
1729 |
for( TInt i = 0; i < aSettingIds.Count(); i++ )
|
|
1730 |
{
|
|
1731 |
CancelPreview( aSettingIds[i] );
|
|
1732 |
}
|
|
1733 |
}
|
|
1734 |
}
|
|
1735 |
|
|
1736 |
|
|
1737 |
// ---------------------------------------------------------------------------
|
|
1738 |
//
|
|
1739 |
// ---------------------------------------------------------------------------
|
|
1740 |
//
|
|
1741 |
void
|
|
1742 |
CCamSettingsModel::CancelAllPreviews()
|
|
1743 |
{
|
|
1744 |
iSettingPreviews.ResetAndDestroy();
|
|
1745 |
}
|
|
1746 |
|
|
1747 |
|
|
1748 |
// ---------------------------------------------------------------------------
|
|
1749 |
//
|
|
1750 |
// ---------------------------------------------------------------------------
|
|
1751 |
//
|
|
1752 |
void
|
|
1753 |
CCamSettingsModel::CommitPreviewL( const TCamSettingItemIds& aSettingId )
|
|
1754 |
{
|
|
1755 |
TInt index = FindIndex( iSettingPreviews, aSettingId );
|
|
1756 |
|
|
1757 |
if( KErrNotFound != index )
|
|
1758 |
{
|
|
1759 |
TIntSetting* settingItem = iSettingPreviews[index];
|
|
1760 |
|
|
1761 |
iSettingPreviews.Remove( index );
|
|
1762 |
|
|
1763 |
CleanupStack::PushL( settingItem );
|
|
1764 |
SetIntegerSettingValueL( settingItem->iItemId, settingItem->iValueId );
|
|
1765 |
CleanupStack::PopAndDestroy( settingItem );
|
|
1766 |
}
|
|
1767 |
else
|
|
1768 |
{
|
|
1769 |
User::Leave( KErrNotFound );
|
|
1770 |
}
|
|
1771 |
}
|
|
1772 |
|
|
1773 |
|
|
1774 |
// ---------------------------------------------------------------------------
|
|
1775 |
//
|
|
1776 |
// ---------------------------------------------------------------------------
|
|
1777 |
//
|
|
1778 |
void
|
|
1779 |
CCamSettingsModel::CommitPreviewsL( const RArray<TCamSettingItemIds>& aSettingIds )
|
|
1780 |
{
|
|
1781 |
if( 0 < iSettingPreviews.Count() )
|
|
1782 |
{
|
|
1783 |
TInt all ( KErrNone );
|
|
1784 |
TInt single( KErrNone );
|
|
1785 |
|
|
1786 |
for( TInt i = 0; i < aSettingIds.Count(); i++ )
|
|
1787 |
{
|
|
1788 |
TRAP( single, CommitPreviewL( aSettingIds[i] ) );
|
|
1789 |
|
|
1790 |
if( KErrNone != single )
|
|
1791 |
all = single;
|
|
1792 |
}
|
|
1793 |
|
|
1794 |
// Leave if there was problem with any of the previews.
|
|
1795 |
User::LeaveIfError( all );
|
|
1796 |
}
|
|
1797 |
}
|
|
1798 |
|
|
1799 |
|
|
1800 |
// ---------------------------------------------------------------------------
|
|
1801 |
//
|
|
1802 |
// ---------------------------------------------------------------------------
|
|
1803 |
//
|
|
1804 |
void
|
|
1805 |
CCamSettingsModel::CommitAllPreviewsL()
|
|
1806 |
{
|
|
1807 |
TInt all ( KErrNone );
|
|
1808 |
TInt single( KErrNone );
|
|
1809 |
for( TInt i = 0; i < iSettingPreviews.Count(); i++ )
|
|
1810 |
{
|
|
1811 |
TRAP( single, SetIntegerSettingValueL( iSettingPreviews[i]->iItemId,
|
|
1812 |
iSettingPreviews[i]->iValueId ) );
|
|
1813 |
|
|
1814 |
if( KErrNone != single )
|
|
1815 |
all = single;
|
|
1816 |
}
|
|
1817 |
|
|
1818 |
// Even if all commits are not successful, deactivate all previews.
|
|
1819 |
iSettingPreviews.ResetAndDestroy();
|
|
1820 |
|
|
1821 |
// Leave if there was problem with any of the previews.
|
|
1822 |
User::LeaveIfError( all );
|
|
1823 |
}
|
|
1824 |
|
|
1825 |
|
|
1826 |
// ---------------------------------------------------------------------------
|
|
1827 |
//
|
|
1828 |
// ---------------------------------------------------------------------------
|
|
1829 |
//
|
|
1830 |
void
|
|
1831 |
CCamSettingsModel
|
|
1832 |
::ActivePreviewsL( RArray<TCamSettingItemIds>& aSettingIds ) const
|
|
1833 |
{
|
|
1834 |
aSettingIds.Reset();
|
|
1835 |
aSettingIds.ReserveL( iSettingPreviews.Count() );
|
|
1836 |
for( TInt i = 0; i < iSettingPreviews.Count(); i++ )
|
|
1837 |
{
|
|
1838 |
aSettingIds.AppendL( (TCamSettingItemIds)iSettingPreviews[i]->iItemId );
|
|
1839 |
}
|
|
1840 |
}
|
|
1841 |
|
|
1842 |
// ===========================================================================
|
|
1843 |
|
|
1844 |
|
|
1845 |
|
|
1846 |
// ---------------------------------------------------------------------------
|
|
1847 |
// CCamSettingsModel::ImageResolutionFromIndex
|
|
1848 |
// Returns the dimensions of the photo (in pixels) based on the size ID passed in
|
|
1849 |
// ---------------------------------------------------------------------------
|
|
1850 |
//
|
|
1851 |
TSize CCamSettingsModel::ImageResolutionFromIndex( TCamPhotoSizeId aIndex )
|
|
1852 |
{
|
|
1853 |
// TCamImageResolution imageRes = iConfiguration.MapPhotoSizeToResolution( aIndex );
|
|
1854 |
return iPhotoResolutions[aIndex];
|
|
1855 |
}
|
|
1856 |
|
|
1857 |
// ---------------------------------------------------------------------------
|
|
1858 |
// CCamSettingsModel::DefaultSettingValueForScene
|
|
1859 |
// Returns the default value of a setting for a particular scene item.
|
|
1860 |
// ---------------------------------------------------------------------------
|
|
1861 |
//
|
|
1862 |
TInt CCamSettingsModel::DefaultSettingValueForScene( TInt aSceneId, TInt aSettingId ) const
|
|
1863 |
{
|
|
1864 |
TInt sceneIndex = FindSceneInSceneList( aSceneId, iPhotoScenes );
|
|
1865 |
|
|
1866 |
TInt settingIndex = SearchInSettingsListFor(
|
|
1867 |
iPhotoScenes[sceneIndex]->iSettings, aSettingId );
|
|
1868 |
|
|
1869 |
return iPhotoScenes[sceneIndex]->iSettings[settingIndex]->iValueId;
|
|
1870 |
}
|
|
1871 |
|
|
1872 |
|
|
1873 |
// ---------------------------------------------------------------------------
|
|
1874 |
// CCamSettingsModel::LoadDynamicSettingsL
|
|
1875 |
// Loads the dynamic settings from resource file for a
|
|
1876 |
// particular group of settings, and stores their defaults.
|
|
1877 |
// ---------------------------------------------------------------------------
|
|
1878 |
//
|
|
1879 |
void CCamSettingsModel::LoadDynamicSettingsL(
|
|
1880 |
TInt aResourceId,
|
|
1881 |
RPointerArray<TIntSetting>& aSettingsList,
|
|
1882 |
RArray<TInt>& aDefaultsList )
|
|
1883 |
{
|
|
1884 |
PRINT( _L("Camera => CCamSettingsModel::LoadDynamicSettingsL" ))
|
|
1885 |
// Create resource reader for reading photo static settings
|
|
1886 |
TResourceReader reader;
|
|
1887 |
iEnv->CreateResourceReaderLC( reader, aResourceId );
|
|
1888 |
TInt count = reader.ReadInt16();
|
|
1889 |
|
|
1890 |
// for each entry in the resource, create a new setting item.
|
|
1891 |
TInt i;
|
|
1892 |
for ( i = 0; i < count; ++i )
|
|
1893 |
{
|
|
1894 |
|
|
1895 |
TIntSetting* newSetting = new (ELeave) TIntSetting;
|
|
1896 |
CleanupStack::PushL( newSetting );
|
|
1897 |
|
|
1898 |
// Read the data for this setting item from resource.
|
|
1899 |
newSetting->iItemId = reader.ReadInt16();
|
|
1900 |
newSetting->iValueId = reader.ReadInt16();
|
|
1901 |
aDefaultsList.AppendL( newSetting->iValueId );
|
|
1902 |
|
|
1903 |
// Add the new setting item and its associated key
|
|
1904 |
// to the parallel arrays for static photo settings.
|
|
1905 |
aSettingsList.AppendL( newSetting );
|
|
1906 |
CleanupStack::Pop( newSetting );
|
|
1907 |
}
|
|
1908 |
|
|
1909 |
CleanupStack::PopAndDestroy(); // reader
|
|
1910 |
PRINT( _L("Camera <= CCamSettingsModel::LoadDynamicSettingsL" ))
|
|
1911 |
}
|
|
1912 |
|
|
1913 |
// ---------------------------------------------------------------------------
|
|
1914 |
// CCamSettingsModel::LoadDynamicSettingsL
|
|
1915 |
// Loads the dynamic settings from resource file for a
|
|
1916 |
// particular group of settings.
|
|
1917 |
// ---------------------------------------------------------------------------
|
|
1918 |
//
|
|
1919 |
void CCamSettingsModel::LoadDynamicSettingsL( TInt aResourceId,
|
|
1920 |
RPointerArray<TIntSetting>& aSettingsList )
|
|
1921 |
{
|
|
1922 |
iStaticModel->LoadSettingsFromResourceL( aResourceId, aSettingsList );
|
|
1923 |
}
|
|
1924 |
|
|
1925 |
|
|
1926 |
// ---------------------------------------------------------------------------
|
|
1927 |
// CCamSettingsModel::LoadScenesDataL
|
|
1928 |
// Loads the scene data from resource file for a particular group of scenes.
|
|
1929 |
// ---------------------------------------------------------------------------
|
|
1930 |
//
|
|
1931 |
void CCamSettingsModel::LoadScenesDataL( TInt aResourceId,
|
|
1932 |
RPointerArray<TSceneData >& aSceneDataArray )
|
|
1933 |
{
|
|
1934 |
// Add array of defaults for static video settings
|
|
1935 |
TResourceReader reader;
|
|
1936 |
// Add array of defaults for static video settings
|
|
1937 |
iEnv->CreateResourceReaderLC( reader, aResourceId );
|
|
1938 |
TInt sceneCount = reader.ReadInt16();
|
|
1939 |
|
|
1940 |
// for each entry in the resource array, create a new scene data item
|
|
1941 |
TInt i;
|
|
1942 |
for ( i = 0; i < sceneCount; i++ )
|
|
1943 |
{
|
|
1944 |
TSceneData * sceneData = new (ELeave) TSceneData ;
|
|
1945 |
CleanupStack::PushL( sceneData );
|
|
1946 |
|
|
1947 |
// Create a resource reader for reading only this scene's data.
|
|
1948 |
TInt resourceID = reader.ReadInt32();
|
|
1949 |
TResourceReader localReader;
|
|
1950 |
iEnv->CreateResourceReaderLC
|
|
1951 |
( localReader, resourceID );
|
|
1952 |
|
|
1953 |
// Read the data for this list item from resource.
|
|
1954 |
// ...read scene id for the scene data
|
|
1955 |
sceneData->iSceneId = localReader.ReadInt16();
|
|
1956 |
// ...read settings for the scene data.
|
|
1957 |
TInt settingsCount = localReader.ReadInt16();
|
|
1958 |
TInt j;
|
|
1959 |
for ( j = 0; j < settingsCount; ++j )
|
|
1960 |
{
|
|
1961 |
TIntSetting* setting = new (ELeave) TIntSetting;
|
|
1962 |
CleanupStack::PushL( setting );
|
|
1963 |
sceneData->iSettings.AppendL( setting );
|
|
1964 |
CleanupStack::Pop( setting );
|
|
1965 |
sceneData->iSettings[j]->iItemId = localReader.ReadInt16();
|
|
1966 |
sceneData->iSettings[j]->iValueId = localReader.ReadInt16();
|
|
1967 |
}
|
|
1968 |
|
|
1969 |
CleanupStack::PopAndDestroy(); // local reader
|
|
1970 |
|
|
1971 |
// Add the scene data to the scenes list.
|
|
1972 |
aSceneDataArray.AppendL( sceneData );
|
|
1973 |
CleanupStack::Pop( sceneData );
|
|
1974 |
}
|
|
1975 |
|
|
1976 |
CleanupStack::PopAndDestroy(); // reader
|
|
1977 |
}
|
|
1978 |
|
|
1979 |
// ---------------------------------------------------------------------------
|
|
1980 |
// CCamSettingsModel::LoadSceneDataL
|
|
1981 |
// Loads the scene data from resource file for a particular group of scenes.
|
|
1982 |
// ---------------------------------------------------------------------------
|
|
1983 |
//
|
|
1984 |
void CCamSettingsModel::LoadSceneDataL( TBool aPhotoSceneSettings )
|
|
1985 |
{
|
|
1986 |
RArray<TSceneSettings> supportedSceneSettings;
|
|
1987 |
CleanupClosePushL( supportedSceneSettings );
|
|
1988 |
|
|
1989 |
iUiConfigManager->SupportedSceneModesAndSettingsL( supportedSceneSettings,
|
|
1990 |
aPhotoSceneSettings );
|
|
1991 |
|
|
1992 |
for ( TInt i = 0; i < supportedSceneSettings.Count(); i++ )
|
|
1993 |
{
|
|
1994 |
//
|
|
1995 |
TSceneSettings scene = supportedSceneSettings[i];
|
|
1996 |
if ( scene.iSupported ) // only if scenes are supported its appened to the list
|
|
1997 |
{
|
|
1998 |
TSceneData* sceneData = new ( ELeave ) TSceneData;
|
|
1999 |
CleanupStack::PushL( sceneData );
|
|
2000 |
|
|
2001 |
// identifier
|
|
2002 |
sceneData->iSceneId = scene.iIdentifier;
|
|
2003 |
|
|
2004 |
// exposure mode
|
|
2005 |
TIntSetting* setting = new ( ELeave ) TIntSetting;
|
|
2006 |
CleanupStack::PushL( setting );
|
|
2007 |
|
|
2008 |
setting->iItemId = ECamSettingItemSceneAEMode;
|
|
2009 |
setting->iValueId = scene.iExposureMode;
|
|
2010 |
|
|
2011 |
sceneData->iSettings.AppendL( setting );
|
|
2012 |
CleanupStack::Pop( setting );
|
|
2013 |
|
|
2014 |
// white balance
|
|
2015 |
setting = new ( ELeave ) TIntSetting;
|
|
2016 |
CleanupStack::PushL( setting );
|
|
2017 |
|
|
2018 |
setting->iItemId = ECamSettingItemSceneAWBMode;
|
|
2019 |
setting->iValueId = scene.iWhiteBalance;
|
|
2020 |
|
|
2021 |
sceneData->iSettings.AppendL( setting );
|
|
2022 |
CleanupStack::Pop( setting );
|
|
2023 |
|
|
2024 |
// flash
|
|
2025 |
setting = new ( ELeave ) TIntSetting;
|
|
2026 |
CleanupStack::PushL( setting );
|
|
2027 |
|
|
2028 |
setting->iItemId = ECamSettingItemSceneFlashMode;
|
|
2029 |
setting->iValueId = scene.iFlash;
|
|
2030 |
|
|
2031 |
sceneData->iSettings.AppendL( setting );
|
|
2032 |
CleanupStack::Pop( setting );
|
|
2033 |
|
|
2034 |
// contrast
|
|
2035 |
setting = new ( ELeave ) TIntSetting;
|
|
2036 |
CleanupStack::PushL( setting );
|
|
2037 |
|
|
2038 |
setting->iItemId = ECamSettingItemSceneContrast;
|
|
2039 |
setting->iValueId = scene.iContrastMode;
|
|
2040 |
|
|
2041 |
sceneData->iSettings.AppendL( setting );
|
|
2042 |
CleanupStack::Pop( setting );
|
|
2043 |
|
|
2044 |
// focal distance
|
|
2045 |
setting = new ( ELeave ) TIntSetting;
|
|
2046 |
CleanupStack::PushL( setting );
|
|
2047 |
|
|
2048 |
setting->iItemId = ECamSettingItemSceneAFMode;
|
|
2049 |
setting->iValueId = scene.iFocalDistance;
|
|
2050 |
|
|
2051 |
sceneData->iSettings.AppendL( setting );
|
|
2052 |
CleanupStack::Pop( setting );
|
|
2053 |
|
|
2054 |
|
|
2055 |
if ( aPhotoSceneSettings )
|
|
2056 |
{
|
|
2057 |
// load settings which are specific to photo scene
|
|
2058 |
|
|
2059 |
// sharpness
|
|
2060 |
setting = new ( ELeave ) TIntSetting;
|
|
2061 |
CleanupStack::PushL( setting );
|
|
2062 |
|
|
2063 |
setting->iItemId = ECamSettingItemSceneSharpness;
|
|
2064 |
setting->iValueId = scene.iSharpnessMode;
|
|
2065 |
|
|
2066 |
sceneData->iSettings.AppendL( setting );
|
|
2067 |
CleanupStack::Pop( setting );
|
|
2068 |
|
|
2069 |
|
|
2070 |
// ISO
|
|
2071 |
setting = new ( ELeave ) TIntSetting;
|
|
2072 |
CleanupStack::PushL( setting );
|
|
2073 |
|
|
2074 |
setting->iItemId = ECamSettingItemSceneISO;
|
|
2075 |
setting->iValueId = scene.iLightSensitivityMode;
|
|
2076 |
|
|
2077 |
sceneData->iSettings.AppendL( setting );
|
|
2078 |
CleanupStack::Pop( setting );
|
|
2079 |
|
|
2080 |
// EV
|
|
2081 |
setting = new ( ELeave ) TIntSetting;
|
|
2082 |
CleanupStack::PushL( setting );
|
|
2083 |
|
|
2084 |
setting->iItemId = ECamSettingItemSceneEV;
|
|
2085 |
setting->iValueId = scene.iExposureCompensationValue;
|
|
2086 |
|
|
2087 |
sceneData->iSettings.AppendL( setting );
|
|
2088 |
CleanupStack::Pop( setting );
|
|
2089 |
}
|
|
2090 |
else
|
|
2091 |
{
|
|
2092 |
// settings which are specific to video scene
|
|
2093 |
// framerate
|
|
2094 |
setting = new ( ELeave ) TIntSetting;
|
|
2095 |
CleanupStack::PushL( setting );
|
|
2096 |
|
|
2097 |
setting->iItemId = ECamSettingItemSceneFramerate;
|
|
2098 |
setting->iValueId = scene.iFrameRate;
|
|
2099 |
|
|
2100 |
sceneData->iSettings.AppendL( setting );
|
|
2101 |
CleanupStack::Pop( setting );
|
|
2102 |
}
|
|
2103 |
// Add the scene data to the scenes list.
|
|
2104 |
if ( aPhotoSceneSettings )
|
|
2105 |
{
|
|
2106 |
iPhotoScenes.AppendL( sceneData );
|
|
2107 |
}
|
|
2108 |
else
|
|
2109 |
{
|
|
2110 |
iVideoScenes.AppendL( sceneData );
|
|
2111 |
}
|
|
2112 |
CleanupStack::Pop( sceneData );
|
|
2113 |
} // end if
|
|
2114 |
} // end for
|
|
2115 |
CleanupStack::PopAndDestroy( &supportedSceneSettings );
|
|
2116 |
}
|
|
2117 |
|
|
2118 |
// ---------------------------------------------------------------------------
|
|
2119 |
// CCamSettingsModel::UnloadSettings
|
|
2120 |
// Remove any previously loaded settings.
|
|
2121 |
// ---------------------------------------------------------------------------
|
|
2122 |
//
|
|
2123 |
void CCamSettingsModel::UnloadSettings()
|
|
2124 |
{
|
|
2125 |
PRINT( _L("Camera => CCamSettingsModel::UnloadSettings()" ))
|
|
2126 |
|
|
2127 |
iDynamicPhotoIntSettings.ResetAndDestroy();
|
|
2128 |
iDynamicVideoIntSettings.ResetAndDestroy();
|
|
2129 |
|
|
2130 |
iPhotoScenes.ResetAndDestroy();
|
|
2131 |
iVideoScenes.ResetAndDestroy();
|
|
2132 |
PRINT( _L("Camera <= CCamSettingsModel::UnloadSettings()" ))
|
|
2133 |
}
|
|
2134 |
|
|
2135 |
// ---------------------------------------------------------------------------
|
|
2136 |
// CCamSettingsModel::UnloadStaticSettings
|
|
2137 |
// Remove any previously loaded static settings.
|
|
2138 |
// ---------------------------------------------------------------------------
|
|
2139 |
//
|
|
2140 |
void CCamSettingsModel::UnloadStaticSettings()
|
|
2141 |
{
|
|
2142 |
PRINT( _L("Camera => CCamSettingsModel::UnloadStaticSettings()" ))
|
|
2143 |
iUserSceneSettings.ResetAndDestroy();
|
|
2144 |
PRINT( _L("Camera <= CCamSettingsModel::UnloadStaticSettings()" ))
|
|
2145 |
}
|
|
2146 |
|
|
2147 |
// ---------------------------------------------------------------------------
|
|
2148 |
// CCamSettingsModel::BurstModeActiveL
|
|
2149 |
// Track burst mode activation
|
|
2150 |
// ---------------------------------------------------------------------------
|
|
2151 |
//
|
|
2152 |
void
|
|
2153 |
CCamSettingsModel::BurstModeActiveL( TBool aActive, TBool /*aStillModeActive*/ )
|
|
2154 |
{
|
|
2155 |
iBurstEnabled = aActive;
|
|
2156 |
}
|
|
2157 |
|
|
2158 |
|
|
2159 |
// ---------------------------------------------------------------------------
|
|
2160 |
// CCamSettingsModel::VideoResolutions
|
|
2161 |
// Return ref. to video resolutions array
|
|
2162 |
// ---------------------------------------------------------------------------
|
|
2163 |
//
|
|
2164 |
const RArray<TSize>&
|
|
2165 |
CCamSettingsModel::VideoResolutions()
|
|
2166 |
{
|
|
2167 |
return iVideoResolutions;
|
|
2168 |
}
|
|
2169 |
|
|
2170 |
// ---------------------------------------------------------------------------
|
|
2171 |
// CCamSettingsModel::VideoQualityArray
|
|
2172 |
// Return ref. to video video quality level array
|
|
2173 |
// ---------------------------------------------------------------------------
|
|
2174 |
//
|
|
2175 |
const RPointerArray<CCamVideoQualityLevel>&
|
|
2176 |
CCamSettingsModel::VideoQualityArray()
|
|
2177 |
{
|
|
2178 |
return iQualityLevels;
|
|
2179 |
}
|
|
2180 |
|
|
2181 |
// ---------------------------------------------------------------------------
|
|
2182 |
// StaticSettingsModel
|
|
2183 |
//
|
|
2184 |
// Gets the reference to the settings model
|
|
2185 |
// ---------------------------------------------------------------------------
|
|
2186 |
//
|
|
2187 |
MCamStaticSettings&
|
|
2188 |
CCamSettingsModel::StaticSettingsModel() const
|
|
2189 |
{
|
|
2190 |
return *iStaticModel;
|
|
2191 |
}
|
|
2192 |
|
|
2193 |
// ===========================================================================
|
|
2194 |
// TSceneData methods
|
|
2195 |
|
|
2196 |
// ---------------------------------------------------------------------------
|
|
2197 |
// TSceneData::~TSceneData
|
|
2198 |
// Destructor
|
|
2199 |
// ---------------------------------------------------------------------------
|
|
2200 |
//
|
|
2201 |
TSceneData::~TSceneData()
|
|
2202 |
{
|
|
2203 |
iSettings.ResetAndDestroy();
|
|
2204 |
iSettings.Close();
|
|
2205 |
}
|
|
2206 |
|
|
2207 |
/*
|
|
2208 |
* Is Image Scene supported
|
|
2209 |
*/
|
|
2210 |
TBool CCamSettingsModel::IsImageSceneSupported( const TInt aSceneId ) const
|
|
2211 |
{
|
|
2212 |
if ( ECamSceneMacro == aSceneId && !iUiConfigManager->IsAutoFocusSupported() )
|
|
2213 |
{
|
|
2214 |
// if the photo scene is macro and if autofocus is not supported
|
|
2215 |
// the macro scene mode is not visible in scene mode settings
|
|
2216 |
return EFalse;
|
|
2217 |
}
|
|
2218 |
return ( KErrNotFound != FindSceneInSceneList( aSceneId, iPhotoScenes ) );
|
|
2219 |
}
|
|
2220 |
|
|
2221 |
/*
|
|
2222 |
* Is Image Scene supported
|
|
2223 |
*/
|
|
2224 |
TBool CCamSettingsModel::IsVideoSceneSupported( const TInt aSceneId ) const
|
|
2225 |
{
|
|
2226 |
return ( KErrNotFound != FindSceneInSceneList( aSceneId, iVideoScenes ) );
|
|
2227 |
}
|
|
2228 |
|
|
2229 |
/*
|
|
2230 |
* Handle to Camera Ui Config Manager
|
|
2231 |
*/
|
|
2232 |
CCameraUiConfigManager* CCamSettingsModel::UiConfigManagerPtr()
|
|
2233 |
{
|
|
2234 |
return iUiConfigManager;
|
|
2235 |
}
|
|
2236 |
|
|
2237 |
|
|
2238 |
// ---------------------------------------------------------------------------
|
|
2239 |
//
|
|
2240 |
// ---------------------------------------------------------------------------
|
|
2241 |
//
|
|
2242 |
void CCamSettingsModel::LoadResourcesL()
|
|
2243 |
{
|
|
2244 |
PRINT( _L("Camera => CCamSettingsModel::LoadResourcesL" ) )
|
|
2245 |
if (iResourceFileOffset == 0)
|
|
2246 |
{
|
|
2247 |
TFileName resourceFile;
|
|
2248 |
TParse parse;
|
|
2249 |
if ( CamUtility::IsNhdDevice() )
|
|
2250 |
{
|
|
2251 |
parse.Set( KCamNhdResourceFileName, &KDC_APP_RESOURCE_DIR, NULL );
|
|
2252 |
}
|
|
2253 |
else
|
|
2254 |
{
|
|
2255 |
parse.Set( KCamVgaResourceFileName, &KDC_APP_RESOURCE_DIR, NULL );
|
|
2256 |
}
|
|
2257 |
resourceFile = parse.FullName();
|
|
2258 |
BaflUtils::NearestLanguageFile( iEnv->FsSession(), resourceFile );
|
|
2259 |
iResourceFileOffset = iEnv->AddResourceFileL( resourceFile );
|
|
2260 |
}
|
|
2261 |
PRINT( _L("Camera <= CCamSettingsModel::LoadResourcesL" ) )
|
|
2262 |
}
|
|
2263 |
|
|
2264 |
|
|
2265 |
// ---------------------------------------------------------------------------
|
|
2266 |
//
|
|
2267 |
// ---------------------------------------------------------------------------
|
|
2268 |
//
|
|
2269 |
void CCamSettingsModel::UnLoadResources()
|
|
2270 |
{
|
|
2271 |
if (iResourceFileOffset > 0)
|
|
2272 |
{
|
|
2273 |
iEnv->DeleteResourceFile( iResourceFileOffset );
|
|
2274 |
iResourceFileOffset = 0;
|
|
2275 |
}
|
|
2276 |
}
|
|
2277 |
|
|
2278 |
// ---------------------------------------------------------------------------
|
|
2279 |
// CCamSettingsModel::StoreFaceTrackingValue
|
|
2280 |
//
|
|
2281 |
// Store user defined FT value outside Sports and Scenery mode that setting
|
|
2282 |
// can be rolled back.
|
|
2283 |
// ---------------------------------------------------------------------------
|
|
2284 |
//
|
|
2285 |
void CCamSettingsModel::StoreFaceTrackingValue()
|
|
2286 |
{
|
|
2287 |
PRINT( _L("Camera => CCamSettingsModel::StoreFaceTrackingValue()" ) )
|
|
2288 |
|
|
2289 |
if ( !iUiConfigManager->IsFaceTrackingSupported() ) // FT not supported
|
|
2290 |
{
|
|
2291 |
PRINT( _L("Camera <= CCamSettingsModel::StoreFaceTrackingValue(), FT _not_ supported" ) )
|
|
2292 |
return;
|
|
2293 |
}
|
|
2294 |
TInt activeScene = IntegerSettingValue( ECamSettingItemDynamicPhotoScene );
|
|
2295 |
if ( ECamSceneScenery == activeScene ||
|
|
2296 |
ECamSceneSports == activeScene ||
|
|
2297 |
ECamSceneMacro == activeScene)
|
|
2298 |
{
|
|
2299 |
PRINT( _L("Camera <> CCamSettingsModel::StoreFaceTrackingValue(), Scenery or Sports mode" ) )
|
|
2300 |
SetIntegerSettingValueL( ECamSettingItemFaceTracking, iPreviousFaceTrack );
|
|
2301 |
}
|
|
2302 |
|
|
2303 |
|
|
2304 |
|
|
2305 |
PRINT( _L("Camera <= CamSettingsModel::StoreFaceTrackingValue()" ) )
|
|
2306 |
}
|
|
2307 |
|
|
2308 |
// ---------------------------------------------------------------------------
|
|
2309 |
// CCamSettingsModel::CopySettingsL
|
|
2310 |
//
|
|
2311 |
// Backup and Restore Settings array
|
|
2312 |
// ---------------------------------------------------------------------------
|
|
2313 |
//
|
|
2314 |
void CCamSettingsModel::CopySettingsL(RPointerArray<TIntSetting>& aSrc,
|
|
2315 |
RPointerArray<TIntSetting>& aDest,
|
|
2316 |
TBool aRestore)
|
|
2317 |
{
|
|
2318 |
if(aRestore)
|
|
2319 |
{
|
|
2320 |
__ASSERT_DEBUG(aSrc.Count() == aDest.Count(), CamPanic(ECamPanicInvalidState));
|
|
2321 |
TInt count = aSrc.Count();
|
|
2322 |
TInt index = 0;
|
|
2323 |
do
|
|
2324 |
{
|
|
2325 |
if(aSrc[index]->iItemId == aDest[index]->iItemId)
|
|
2326 |
{
|
|
2327 |
if(aSrc[index]->iValueId != aDest[index]->iValueId)
|
|
2328 |
{
|
|
2329 |
aDest[index]->iValueId = aSrc[index]->iValueId;
|
|
2330 |
}
|
|
2331 |
}
|
|
2332 |
index++;
|
|
2333 |
}while(index < count);
|
|
2334 |
}
|
|
2335 |
else
|
|
2336 |
{
|
|
2337 |
__ASSERT_DEBUG(aSrc.Count(), CamPanic(ECamPanicInvalidState));
|
|
2338 |
aDest.ResetAndDestroy();
|
|
2339 |
TInt count = aSrc.Count();
|
|
2340 |
TInt index = 0;
|
|
2341 |
do
|
|
2342 |
{
|
|
2343 |
TIntSetting* setting = new(ELeave) TIntSetting();
|
|
2344 |
CleanupStack::PushL(setting);
|
|
2345 |
setting->iItemId = aSrc[index]->iItemId;
|
|
2346 |
setting->iValueId = aSrc[index]->iValueId;
|
|
2347 |
aDest.AppendL(setting);
|
|
2348 |
CleanupStack::Pop(setting);
|
|
2349 |
index++;
|
|
2350 |
}while(index < count);
|
|
2351 |
}
|
|
2352 |
}
|
|
2353 |
|
|
2354 |
// ---------------------------------------------------------------------------
|
|
2355 |
// CCamSettingsModel::StoreUserSceneSettingsL
|
|
2356 |
//
|
|
2357 |
// Store UserScene Settings
|
|
2358 |
// ---------------------------------------------------------------------------
|
|
2359 |
//
|
|
2360 |
void CCamSettingsModel::StoreUserSceneSettingsL()
|
|
2361 |
{
|
|
2362 |
CopySettingsL(iUserSceneSettings, iUserSceneSettingsBackup);
|
|
2363 |
}
|
|
2364 |
|
|
2365 |
// ---------------------------------------------------------------------------
|
|
2366 |
// CCamSettingsModel::SetUserSceneDefault
|
|
2367 |
//
|
|
2368 |
// Set userScene as default
|
|
2369 |
// ---------------------------------------------------------------------------
|
|
2370 |
//
|
|
2371 |
void CCamSettingsModel::SetUserSceneDefault()
|
|
2372 |
{
|
|
2373 |
PRINT( _L("Camera => CCamSettingsModel::SetUserSceneDefault ") );
|
|
2374 |
TInt settingsCount = iDynamicPhotoIntSettings.Count();
|
|
2375 |
TInt userVal = 0;
|
|
2376 |
for ( TInt i = 0; i < settingsCount; ++i )
|
|
2377 |
{
|
|
2378 |
if ( iDynamicPhotoIntSettings[i]->iItemId == ECamSettingItemDynamicPhotoScene )
|
|
2379 |
{
|
|
2380 |
TInt sceneSetCount = iUserSceneSettings.Count();
|
|
2381 |
for ( TInt j = 0; j < sceneSetCount; ++j )
|
|
2382 |
{
|
|
2383 |
if ( iUserSceneSettings[j]->iItemId == ECamSettingItemUserSceneDefault )
|
|
2384 |
{
|
|
2385 |
userVal = iUserSceneSettings[j]->iValueId;
|
|
2386 |
}
|
|
2387 |
}
|
|
2388 |
if ( userVal )
|
|
2389 |
{
|
|
2390 |
PRINT1( _L("Camera <> CCamSettingsModel::SetUserSceneDefault set userVal= %d"), userVal);
|
|
2391 |
iDynamicPhotoIntSettings[i]->iValueId = ECamSceneUser;
|
|
2392 |
ActivateUserSceneSettingsL();
|
|
2393 |
}
|
|
2394 |
|
|
2395 |
}
|
|
2396 |
}
|
|
2397 |
|
|
2398 |
PRINT( _L("Camera <= CCamSettingsModel::SetUserSceneDefault ") );
|
|
2399 |
}
|
|
2400 |
|
|
2401 |
// ---------------------------------------------------------------------------
|
|
2402 |
// CCamSettingsModel::GetPreviousFaceTrack
|
|
2403 |
//
|
|
2404 |
// Returns the face tracking state as it was before the latest scene mode change
|
|
2405 |
// ---------------------------------------------------------------------------
|
|
2406 |
//
|
|
2407 |
TCamSettingsOnOff CCamSettingsModel::GetPreviousFaceTrack()
|
|
2408 |
{
|
|
2409 |
return iPreviousFaceTrack;
|
|
2410 |
}
|
|
2411 |
|
|
2412 |
// ---------------------------------------------------------------------------
|
|
2413 |
// CCamSettingsModel::SetPreviousFaceTrack
|
|
2414 |
// ---------------------------------------------------------------------------
|
|
2415 |
//
|
|
2416 |
void CCamSettingsModel::SetPreviousFaceTrack( TCamSettingsOnOff aPreviousFaceTrack )
|
|
2417 |
{
|
|
2418 |
iPreviousFaceTrack = aPreviousFaceTrack;
|
|
2419 |
}
|
|
2420 |
|
|
2421 |
// ---------------------------------------------------------------------------
|
|
2422 |
// CCamSettingsModel::GetPreviousSceneMode
|
|
2423 |
//
|
|
2424 |
// Returns the scene mode that was in use before the current scene mode was selected
|
|
2425 |
// ---------------------------------------------------------------------------
|
|
2426 |
//
|
|
2427 |
TCamSceneId CCamSettingsModel::GetPreviousSceneMode()
|
|
2428 |
{
|
|
2429 |
return iPreviousSceneMode;
|
|
2430 |
}
|
|
2431 |
|
|
2432 |
// ---------------------------------------------------------------------------
|
|
2433 |
// CCamSettingsModel::SetPreviousSceneMode
|
|
2434 |
// ---------------------------------------------------------------------------
|
|
2435 |
//
|
|
2436 |
void CCamSettingsModel::SetPreviousSceneMode( TCamSceneId aPreviousSceneMode )
|
|
2437 |
{
|
|
2438 |
iPreviousSceneMode = aPreviousSceneMode;
|
|
2439 |
}
|
|
2440 |
|
|
2441 |
|
|
2442 |
// ===========================================================================
|
|
2443 |
// end of File
|