54
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Manages all static settings data.*
|
|
15 |
*/
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
// ===========================================================================
|
|
20 |
// Includes
|
|
21 |
|
|
22 |
#include <StringLoader.h>
|
|
23 |
#include <barsread.h>
|
|
24 |
#include <AknQueryDialog.h>
|
|
25 |
#include <ecam.h>
|
|
26 |
#ifndef CAMERAAPP_PLUGIN_BUILD
|
|
27 |
#include <cameraapp.rsg>
|
|
28 |
#include <vgacamsettings.rsg>
|
|
29 |
#include "camsettingconversion.h"
|
|
30 |
#else
|
|
31 |
#include <gscamerapluginrsc.rsg>
|
|
32 |
#endif
|
|
33 |
|
|
34 |
#include "CamStaticSettingsModel.h"
|
|
35 |
#include "CamUtility.h"
|
|
36 |
#include "CamPanic.h"
|
|
37 |
#include "CamAppUiBase.h"
|
|
38 |
#include "CamVideoQualityLevel.h"
|
|
39 |
#include "CameraappPrivateCRKeys.h" // CR keys
|
|
40 |
#include "CameraUiConfigManager.h"
|
|
41 |
#include "camconfiguration.h"
|
|
42 |
|
|
43 |
|
|
44 |
// ===========================================================================
|
|
45 |
// Constants
|
|
46 |
|
|
47 |
const TInt KCamCRStringInitialLength = 64;
|
|
48 |
const TInt KCamUseDefaultVideoQuality = -1;
|
|
49 |
|
|
50 |
// ===========================================================================
|
|
51 |
// Local methods
|
|
52 |
|
|
53 |
inline TBool SettingIdMatches( const TInt* aSettingId,
|
|
54 |
const TIntSetting& aSettingItem )
|
|
55 |
{
|
|
56 |
return (*aSettingId == aSettingItem.iItemId);
|
|
57 |
};
|
|
58 |
|
|
59 |
|
|
60 |
// ===========================================================================
|
|
61 |
// Class methods
|
|
62 |
|
|
63 |
// ---------------------------------------------------------------------------
|
|
64 |
// CCamStaticSettingsModel::NewL
|
|
65 |
// Symbian OS two-phased constructor
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
CCamStaticSettingsModel*
|
|
69 |
CCamStaticSettingsModel::NewL( CCamConfiguration& aConfiguration )
|
|
70 |
{
|
|
71 |
CCamStaticSettingsModel* self
|
|
72 |
= CCamStaticSettingsModel::NewLC( aConfiguration );
|
|
73 |
CleanupStack::Pop( self );
|
|
74 |
return self;
|
|
75 |
}
|
|
76 |
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
// CCamStaticSettingsModel::NewLC
|
|
79 |
// Symbian OS two-phased constructor
|
|
80 |
// ---------------------------------------------------------------------------
|
|
81 |
//
|
|
82 |
CCamStaticSettingsModel*
|
|
83 |
CCamStaticSettingsModel::NewLC( CCamConfiguration& aConfiguration )
|
|
84 |
{
|
|
85 |
CCamStaticSettingsModel* self
|
|
86 |
= new( ELeave ) CCamStaticSettingsModel( aConfiguration );
|
|
87 |
CleanupStack::PushL( self );
|
|
88 |
self->ConstructL();
|
|
89 |
return self;
|
|
90 |
}
|
|
91 |
|
|
92 |
|
|
93 |
// ---------------------------------------------------------------------------
|
|
94 |
// CCamStaticSettingsModel::IntegerSettingValue
|
|
95 |
// Returns the current integer value for the specified setting
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
TInt
|
|
99 |
CCamStaticSettingsModel::IntegerSettingValue( TInt aSettingItem ) const
|
|
100 |
{
|
|
101 |
TInt value = KErrNotFound;
|
|
102 |
const RPointerArray<TIntSetting> *iStaticIntSettings=NULL;
|
|
103 |
// If setting item is in the static photo settings return it's value.
|
|
104 |
if( ECamSettingItemStaticPhotoRangeMax > aSettingItem
|
|
105 |
&& ECamSettingItemStaticPhotoRangeMin < aSettingItem )
|
|
106 |
{
|
|
107 |
iStaticIntSettings=&iStaticPhotoIntSettings;
|
|
108 |
}
|
|
109 |
// Otherwise, if setting item is in the static video settings return it's value.
|
|
110 |
else if( ECamSettingItemStaticVideoRangeMax > aSettingItem
|
|
111 |
&& ECamSettingItemStaticVideoRangeMin < aSettingItem )
|
|
112 |
{
|
|
113 |
iStaticIntSettings=&iStaticVideoIntSettings;
|
|
114 |
}
|
|
115 |
// Look in static common settings.
|
|
116 |
else if( ECamSettingItemStaticCommonRangeMax > aSettingItem
|
|
117 |
&& ECamSettingItemStaticCommonRangeMin < aSettingItem )
|
|
118 |
{
|
|
119 |
iStaticIntSettings=&iStaticCommonIntSettings;
|
|
120 |
}
|
|
121 |
else
|
|
122 |
{
|
|
123 |
PRINT( _L("Camera <> Not found, PANIC !! ECamPanicUnknownSettingItem" ))
|
|
124 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
125 |
}
|
|
126 |
|
|
127 |
if( iStaticIntSettings )
|
|
128 |
{
|
|
129 |
TInt settingIndex = SearchInSettingsListFor(
|
|
130 |
*iStaticIntSettings,
|
|
131 |
aSettingItem );
|
|
132 |
if( settingIndex < iStaticIntSettings->Count() && settingIndex >= 0 )
|
|
133 |
{
|
|
134 |
value = (*iStaticIntSettings)[settingIndex]->iValueId;
|
|
135 |
}
|
|
136 |
}
|
|
137 |
return value;
|
|
138 |
}
|
|
139 |
|
|
140 |
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
// CCamStaticSettingsModel::SetIntegerSettingValueL
|
|
143 |
// Sets a new integer value for the specified setting
|
|
144 |
// ---------------------------------------------------------------------------
|
|
145 |
//
|
|
146 |
void
|
|
147 |
CCamStaticSettingsModel::SetIntegerSettingValueL( TInt aSettingItem,
|
|
148 |
TInt aSettingValue )
|
|
149 |
{
|
|
150 |
TCamSettingItemIds settingId(
|
|
151 |
static_cast<TCamSettingItemIds>(aSettingItem) );
|
|
152 |
|
|
153 |
// Static image settings
|
|
154 |
if( ECamSettingItemStaticPhotoRangeMin < settingId
|
|
155 |
&& ECamSettingItemStaticPhotoRangeMax > settingId )
|
|
156 |
{
|
|
157 |
PRINT( _L("Camera <> static photo setting") );
|
|
158 |
TInt settingIndex = SearchInSettingsListFor( iStaticPhotoIntSettings, settingId );
|
|
159 |
iStaticPhotoIntSettings[settingIndex]->iValueId = aSettingValue;
|
|
160 |
SaveStaticSettingL( settingId );
|
|
161 |
|
|
162 |
// Video / photo storage settings follow eachother
|
|
163 |
if ( ECamSettingItemPhotoMediaStorage == settingId )
|
|
164 |
{
|
|
165 |
TInt index = SearchInSettingsListFor( iStaticVideoIntSettings,
|
|
166 |
ECamSettingItemVideoMediaStorage );
|
|
167 |
if ( index != KErrNotFound )
|
|
168 |
{
|
|
169 |
iStaticVideoIntSettings[index]->iValueId = aSettingValue;
|
|
170 |
SaveStaticSettingL( ECamSettingItemVideoMediaStorage );
|
|
171 |
}
|
|
172 |
}
|
|
173 |
}
|
|
174 |
// -------------------------------------------------------
|
|
175 |
// Static video settings
|
|
176 |
else if( ECamSettingItemStaticVideoRangeMin < settingId
|
|
177 |
&& ECamSettingItemStaticVideoRangeMax > settingId )
|
|
178 |
{
|
|
179 |
TInt settingIndex = SearchInSettingsListFor( iStaticVideoIntSettings, settingId );
|
|
180 |
iStaticVideoIntSettings[settingIndex]->iValueId = aSettingValue;
|
|
181 |
SaveStaticSettingL( settingId );
|
|
182 |
|
|
183 |
// Video / photo storage settings follow eachother
|
|
184 |
if ( ECamSettingItemVideoMediaStorage == settingId )
|
|
185 |
{
|
|
186 |
TInt index = SearchInSettingsListFor( iStaticPhotoIntSettings,
|
|
187 |
ECamSettingItemPhotoMediaStorage );
|
|
188 |
if ( index != KErrNotFound )
|
|
189 |
{
|
|
190 |
iStaticPhotoIntSettings[index]->iValueId = aSettingValue;
|
|
191 |
SaveStaticSettingL( ECamSettingItemPhotoMediaStorage );
|
|
192 |
}
|
|
193 |
}
|
|
194 |
}
|
|
195 |
// -------------------------------------------------------
|
|
196 |
// Static common settings
|
|
197 |
else if( ECamSettingItemStaticCommonRangeMin < settingId
|
|
198 |
&& ECamSettingItemStaticCommonRangeMax > settingId )
|
|
199 |
{
|
|
200 |
TInt settingIndex = SearchInSettingsListFor( iStaticCommonIntSettings, settingId );
|
|
201 |
iStaticCommonIntSettings[settingIndex]->iValueId = aSettingValue;
|
|
202 |
SaveStaticSettingL( settingId );
|
|
203 |
}
|
|
204 |
// -------------------------------------------------------
|
|
205 |
else
|
|
206 |
{
|
|
207 |
// Ignored at the moment
|
|
208 |
PRINT( _L("Camera <> Setting item not found !!!") );
|
|
209 |
}
|
|
210 |
// -------------------------------------------------------
|
|
211 |
}
|
|
212 |
|
|
213 |
|
|
214 |
// ---------------------------------------------------------------------------
|
|
215 |
// CCamStaticSettingsModel::SetTextSettingValueL
|
|
216 |
// Sets a new text value for the specified setting
|
|
217 |
// ---------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
void CCamStaticSettingsModel::SetTextSettingValueL( TInt aSettingItem,
|
|
220 |
const TDesC& aSettingValue )
|
|
221 |
{
|
|
222 |
switch ( aSettingItem )
|
|
223 |
{
|
|
224 |
case ECamSettingItemPhotoNameBase:
|
|
225 |
{
|
|
226 |
iPhotoBaseName = aSettingValue;
|
|
227 |
break;
|
|
228 |
}
|
|
229 |
case ECamSettingItemVideoNameBase:
|
|
230 |
{
|
|
231 |
iVideoBaseName = aSettingValue;
|
|
232 |
break;
|
|
233 |
}
|
|
234 |
case ECamSettingItemDefaultAlbumName:
|
|
235 |
{
|
|
236 |
iDefaultAlbumName = aSettingValue;
|
|
237 |
break;
|
|
238 |
}
|
|
239 |
default:
|
|
240 |
{
|
|
241 |
PRINT( _L("Camera <> CCamSettingsModel::ECamPanicUnknownSettingItem 4" ))
|
|
242 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
243 |
return;
|
|
244 |
}
|
|
245 |
}
|
|
246 |
SaveStaticSettingL( static_cast<TCamSettingItemIds>(aSettingItem) );
|
|
247 |
}
|
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
// ---------------------------------------------------------------------------
|
|
252 |
// CCamStaticSettingsModel::TextSettingValue
|
|
253 |
// Returns the current text value for the specified setting
|
|
254 |
// ---------------------------------------------------------------------------
|
|
255 |
//
|
|
256 |
TPtrC CCamStaticSettingsModel::TextSettingValue( TInt aSettingItem ) const
|
|
257 |
{
|
|
258 |
switch ( aSettingItem )
|
|
259 |
{
|
|
260 |
case ECamSettingItemPhotoNameBase: return iPhotoBaseName;
|
|
261 |
case ECamSettingItemVideoNameBase: return iVideoBaseName;
|
|
262 |
case ECamSettingItemDefaultAlbumName: return iDefaultAlbumName;
|
|
263 |
default:
|
|
264 |
{
|
|
265 |
PRINT( _L("Camera =><= CCamSettingsModel::TextSettingValue, PANIC!!!" ) );
|
|
266 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
267 |
}
|
|
268 |
}
|
|
269 |
return NULL;
|
|
270 |
}
|
|
271 |
|
|
272 |
#ifndef CAMERAAPP_PLUGIN_BUILD
|
|
273 |
// ---------------------------------------------------------------------------
|
|
274 |
// CCamStaticSettingsModel::LoadStaticSettingsL
|
|
275 |
// Loads the static settings from shared data. Required to update
|
|
276 |
// the settings whenever get foreground event, incase of external
|
|
277 |
// changes to the settings.
|
|
278 |
// Note that static settings cannot be loaded until the AppUi has been created,
|
|
279 |
// as which settings to use is dependent on if app is embedded or not.
|
|
280 |
// ---------------------------------------------------------------------------
|
|
281 |
//
|
|
282 |
void CCamStaticSettingsModel::LoadStaticSettingsL( TBool aIsEmbedded )
|
|
283 |
{
|
|
284 |
PRINT(_L("Camera => CCamStaticSettingsModel::LoadStaticSettingsL" ))
|
|
285 |
iEmbedded = aIsEmbedded;
|
|
286 |
|
|
287 |
// Free all memory currently used by the static settings.
|
|
288 |
UnloadStaticSettings();
|
|
289 |
|
|
290 |
// Settings that depend on embedded status
|
|
291 |
// If this application is embedded in MMS load
|
|
292 |
// the embedded defaults for static settings.
|
|
293 |
#ifndef CAMERAAPP_PLUGIN_BUILD
|
|
294 |
if ( iEmbedded )
|
|
295 |
{
|
|
296 |
LoadEmbeddedSettingsL();
|
|
297 |
}
|
|
298 |
#endif //CAMERAAPP_PLUGIN_BUILD
|
|
299 |
|
|
300 |
// Settings that *do not* depend on embedded status
|
|
301 |
LoadPhotoStaticSettingsL( EFalse );
|
|
302 |
LoadVideoStaticSettingsL( EFalse );
|
|
303 |
LoadCommonStaticSettingsL( EFalse );
|
|
304 |
|
|
305 |
PRINT(_L("Camera <= CCamSettingsModel::LoadStaticSettingsL" ))
|
|
306 |
}
|
|
307 |
|
|
308 |
#endif //#ifndef CAMERAAPP_PLUGIN_BUILD
|
|
309 |
|
|
310 |
// ---------------------------------------------------------------------------
|
|
311 |
// CCamStaticSettingsModel::ReadCenRepIntL
|
|
312 |
// Reads the specified setting from Central Repository to the specified
|
|
313 |
// settings model array
|
|
314 |
// ---------------------------------------------------------------------------
|
|
315 |
//
|
|
316 |
void CCamStaticSettingsModel::ReadFromCenRepL( const TInt aMinRange,
|
|
317 |
const TInt aMaxRange,
|
|
318 |
RPointerArray <TIntSetting>& aArray )
|
|
319 |
{
|
|
320 |
TUint32 crKey;
|
|
321 |
TBool ignore(EFalse);
|
|
322 |
for ( TInt i = aMinRange+1; i < aMaxRange; i++ )
|
|
323 |
{
|
|
324 |
ignore = EFalse;
|
|
325 |
if ( i == ECamSettingItemPhotoNameBase )
|
|
326 |
{
|
|
327 |
LoadPhotoBaseNameL();
|
|
328 |
}
|
|
329 |
else if ( i == ECamSettingItemVideoNameBase )
|
|
330 |
{
|
|
331 |
LoadVideoBaseNameL();
|
|
332 |
}
|
|
333 |
else if ( i == ECamSettingItemDefaultAlbumName )
|
|
334 |
{
|
|
335 |
LoadDefaultAlbumNameL();
|
|
336 |
}
|
|
337 |
else
|
|
338 |
{
|
|
339 |
/*
|
|
340 |
* Settings that depend on embedded status, we ignore reading the settings
|
|
341 |
* if we are loading settings for embedded camera.
|
|
342 |
*/
|
|
343 |
if ( iEmbedded &&
|
|
344 |
( i == ECamSettingItemPhotoQuality ||
|
|
345 |
i == ECamSettingItemShowCapturedPhoto ||
|
|
346 |
i == ECamSettingItemVideoQuality ||
|
|
347 |
i == ECamSettingItemVideoShowCapturedVideo ||
|
|
348 |
i == ECamSettingItemVideoAudioRec ) )
|
|
349 |
{
|
|
350 |
ignore = ETrue;
|
|
351 |
}
|
|
352 |
if ( !ignore )
|
|
353 |
{
|
|
354 |
crKey = MapSettingItem2CRKey( static_cast<TCamSettingItemIds>( i ),
|
|
355 |
iEmbedded );
|
|
356 |
ReadCenRepIntL( static_cast<TCamSettingItemIds>( i ),
|
|
357 |
crKey,
|
|
358 |
aArray );
|
|
359 |
}
|
|
360 |
}
|
|
361 |
}
|
|
362 |
}
|
|
363 |
|
|
364 |
|
|
365 |
#ifndef CAMERAAPP_PLUGIN_BUILD
|
|
366 |
// ---------------------------------------------------------------------------
|
|
367 |
// CCamStaticSettingsModel::LoadEmbeddedSettingsL();
|
|
368 |
// Reads the specified setting from Central Repository to the specified
|
|
369 |
// settings model array
|
|
370 |
// ---------------------------------------------------------------------------
|
|
371 |
//
|
|
372 |
void CCamStaticSettingsModel::LoadEmbeddedSettingsL()
|
|
373 |
{
|
|
374 |
LoadSettingsFromResourceL( R_CAM_PHOTO_EMBEDDED_STATIC_SETTINGS_DATA,
|
|
375 |
iStaticPhotoIntSettings );
|
|
376 |
LoadSettingsFromResourceL( R_CAM_VIDEO_EMBEDDED_STATIC_SETTINGS_DATA,
|
|
377 |
iStaticVideoIntSettings );
|
|
378 |
|
|
379 |
// Video - Record Audio (not shared with standalone)
|
|
380 |
ReadCenRepIntL( ECamSettingItemVideoAudioRec,
|
|
381 |
KCamCrEmbeddedVideoAudRec,
|
|
382 |
iStaticVideoIntSettings );
|
|
383 |
|
|
384 |
TIntSetting* newSetting = new (ELeave) TIntSetting;
|
|
385 |
CleanupStack::PushL( newSetting );
|
|
386 |
|
|
387 |
// Read the data for this setting item from resource.
|
|
388 |
newSetting->iItemId = ECamSettingItemPhotoQuality;
|
|
389 |
|
|
390 |
CCamAppUiBase* appUi = 0;
|
|
391 |
TSize requiredReso, requiredResolution;
|
|
392 |
// if using the second camera
|
|
393 |
if( static_cast<CCamAppUiBase*>(
|
|
394 |
CEikonEnv::Static()->AppUi() )->ActiveCamera() == ECamActiveCameraSecondary )
|
|
395 |
{
|
|
396 |
PRINT(_L("Camera <=> CCamStaticSettingsModel::LoadEmbeddedSettingsL Setting secondary camera image quality" ))
|
|
397 |
newSetting->iValueId = iConfiguration.SecondaryCameraImageQuality();
|
|
398 |
}
|
|
399 |
else
|
|
400 |
{
|
|
401 |
appUi = static_cast<CCamAppUiBase*>( CEikonEnv::Static()->AppUi() );
|
|
402 |
requiredReso = appUi->RequestedNewFileResolution();
|
|
403 |
requiredResolution = iConfiguration.MapRequiredResolutionToActualResolutionPhoto(requiredReso);
|
|
404 |
if ( requiredResolution == TSize(0,0) )
|
|
405 |
{
|
|
406 |
PRINT(_L("Camera <=> CCamStaticSettingsModel::LoadEmbeddedSettingsL Setting mms image quality" ))
|
|
407 |
newSetting->iValueId = iConfiguration.MmsImageQuality();
|
|
408 |
}
|
|
409 |
else
|
|
410 |
{
|
|
411 |
PRINT(_L("Camera <=> CCamStaticSettingsModdel::LoadEmbeddedSettingsL Setting custom image quality"));
|
|
412 |
TSize resolutionToGet = requiredResolution;
|
|
413 |
PRINT2(_L("Camera <=> CCamStaticSettingsModel::LoadEmbeddedSettingsL image resolutionToGet(%d,%d)"), resolutionToGet.iWidth, resolutionToGet.iHeight );
|
|
414 |
TInt QualityIndex = iConfiguration.GetRequiredImageQualityIndex( resolutionToGet );
|
|
415 |
PRINT1(_L("Camera <=> CCamStaticSettingsModel::LoadEmbeddedSettingsL image QualityIndex: %d"), QualityIndex );
|
|
416 |
newSetting->iValueId = iConfiguration.ImageQuality( QualityIndex ).iPhotoQualityId;
|
|
417 |
PRINT1(_L("Camera <=> CCamStaticSettingsModel::LoadEmbeddedSettingsL image newSetting->iValueId: %d"), newSetting->iValueId );
|
|
418 |
}
|
|
419 |
}
|
|
420 |
|
|
421 |
// Add the new setting item and its associated key
|
|
422 |
// to the parallel arrays for static photo settings.
|
|
423 |
iStaticPhotoIntSettings.AppendL( newSetting );
|
|
424 |
CleanupStack::Pop( newSetting );
|
|
425 |
|
|
426 |
newSetting = new (ELeave) TIntSetting;
|
|
427 |
CleanupStack::PushL( newSetting );
|
|
428 |
|
|
429 |
// Read the data for this setting item from resource.
|
|
430 |
newSetting->iItemId = ECamSettingItemVideoQuality;
|
|
431 |
|
|
432 |
// if using the second camera
|
|
433 |
if( static_cast<CCamAppUiBase*>(
|
|
434 |
CEikonEnv::Static()->AppUi() )->ActiveCamera() == ECamActiveCameraSecondary )
|
|
435 |
{
|
|
436 |
PRINT(_L("Camera <=> CCamStaticSettingsModel::LoadEmbeddedSettingsL Setting secondary camera image quality" ))
|
|
437 |
newSetting->iValueId = iConfiguration.SecondaryCameraVideoQuality();
|
|
438 |
}
|
|
439 |
else
|
|
440 |
{
|
|
441 |
appUi = static_cast<CCamAppUiBase*>( CEikonEnv::Static()->AppUi() );
|
|
442 |
requiredReso = appUi->RequestedNewFileResolution();
|
|
443 |
requiredResolution = iConfiguration.MapRequiredResolutionToActualResolutionVideo(requiredReso);
|
|
444 |
if ( requiredResolution == TSize(0,0) )
|
|
445 |
{
|
|
446 |
PRINT(_L("Camera <=> CCamStaticSettingsModel::LoadEmbeddedSettingsL Setting mms video quality" ))
|
|
447 |
newSetting->iValueId = iConfiguration.SecondaryCameraVideoQuality();
|
|
448 |
}
|
|
449 |
else
|
|
450 |
{
|
|
451 |
TSize resolutionToGet = requiredResolution;
|
|
452 |
PRINT2(_L("Camera <=> CCamStaticSettingsModel::LoadEmbeddedSettingsL resolutionToGet(%d,%d)"), resolutionToGet.iWidth, resolutionToGet.iHeight );
|
|
453 |
TInt QualityIndex = iConfiguration.GetRequiredVideoQualityIndex( resolutionToGet );
|
|
454 |
PRINT1(_L("Camera <=> CCamStaticSettingsModel::LoadEmbeddedSettingsL QualityIndex: %d"), QualityIndex );
|
|
455 |
newSetting->iValueId = iConfiguration.VideoQualitySetting( QualityIndex );
|
|
456 |
PRINT1(_L("Camera <=> CCamStaticSettingsModel::LoadEmbeddedSettingsL newSetting->iValueId: %d"), newSetting->iValueId );
|
|
457 |
}
|
|
458 |
}
|
|
459 |
|
|
460 |
// Add the new setting item and its associated key
|
|
461 |
// to the parallel arrays for static photo settings.
|
|
462 |
iStaticVideoIntSettings.AppendL( newSetting );
|
|
463 |
CleanupStack::Pop( newSetting );
|
|
464 |
}
|
|
465 |
|
|
466 |
#endif //CAMERAAPP_PLUGIN_BUILD
|
|
467 |
|
|
468 |
// ---------------------------------------------------------------------------
|
|
469 |
// CCamStaticSettingsModel::ReadCenRepIntL
|
|
470 |
// Reads the specified setting from Central Repository to the specified
|
|
471 |
// settings model array
|
|
472 |
// ---------------------------------------------------------------------------
|
|
473 |
//
|
|
474 |
void CCamStaticSettingsModel::ReadCenRepIntL( TCamSettingItemIds aUiId,
|
|
475 |
TInt aCenRepID,
|
|
476 |
RPointerArray <TIntSetting>& aArray )
|
|
477 |
{
|
|
478 |
PRINT2(_L("Camera => CCamStaticSettingsModel::ReadCenRepIntL set id:%d, cenrep id: 0x%02X" ), aUiId, aCenRepID )
|
|
479 |
TIntSetting* newSetting = new( ELeave ) TIntSetting;
|
|
480 |
CleanupStack::PushL( newSetting );
|
|
481 |
newSetting->iItemId = aUiId;
|
|
482 |
#ifndef CAMERAAPP_PLUGIN_BUILD
|
|
483 |
// if using the second camera, then get the photo\video quality from
|
|
484 |
// the cached value, not the shared data file
|
|
485 |
if( ( aUiId == ECamSettingItemPhotoQuality ||
|
|
486 |
aUiId == ECamSettingItemVideoQuality ) &&
|
|
487 |
static_cast<CCamAppUiBase*>(
|
|
488 |
CEikonEnv::Static()->AppUi() )->ActiveCamera() == ECamActiveCameraSecondary )
|
|
489 |
{
|
|
490 |
if ( aUiId == ECamSettingItemPhotoQuality )
|
|
491 |
{
|
|
492 |
newSetting->iValueId = iSecondaryCameraSettings.iPhotoQuality;
|
|
493 |
}
|
|
494 |
else
|
|
495 |
{
|
|
496 |
newSetting->iValueId = iSecondaryCameraSettings.iVideoQuality;
|
|
497 |
}
|
|
498 |
}
|
|
499 |
else // get the value from the shared data file
|
|
500 |
#endif //CAMERAAPP_PLUGIN_BUILD
|
|
501 |
{
|
|
502 |
User::LeaveIfError( iRepository->Get( aCenRepID , newSetting->iValueId ) );
|
|
503 |
|
|
504 |
// When getting the default video qulity, should get the default setting
|
|
505 |
// from ICM
|
|
506 |
if(aUiId == ECamSettingItemVideoQuality &&
|
|
507 |
newSetting->iValueId == KCamUseDefaultVideoQuality)
|
|
508 |
{
|
|
509 |
newSetting->iValueId = iConfiguration.GetDefaultVideoQualityFromIcmL();
|
|
510 |
}
|
|
511 |
}
|
|
512 |
|
|
513 |
aArray.AppendL( newSetting );
|
|
514 |
CleanupStack::Pop( newSetting );
|
|
515 |
PRINT(_L("Camera <= CCamStaticSettingsModel::ReadCenRepIntL" ))
|
|
516 |
}
|
|
517 |
|
|
518 |
// ---------------------------------------------------------------------------
|
|
519 |
// CCamStaticSettingsModel::SaveCenRepItemL
|
|
520 |
// Writes the specified setting to the Central Repository
|
|
521 |
// ---------------------------------------------------------------------------
|
|
522 |
//
|
|
523 |
void
|
|
524 |
CCamStaticSettingsModel::SaveCenRepItemL(
|
|
525 |
TCamSettingItemIds aItemId,
|
|
526 |
TInt aCenRepId,
|
|
527 |
const RPointerArray<TIntSetting>& aArray )
|
|
528 |
{
|
|
529 |
PRINT( _L("Camera => CCamStaticSettingsModel::SaveCenRepItemL") );
|
|
530 |
TInt settingIndex = SearchInSettingsListFor( aArray, aItemId );
|
|
531 |
|
|
532 |
if ( settingIndex != KErrNotFound )
|
|
533 |
{
|
|
534 |
TInt settingValue = aArray[ settingIndex ]->iValueId;
|
|
535 |
User::LeaveIfError( iRepository->Set( aCenRepId, settingValue ) );
|
|
536 |
}
|
|
537 |
else
|
|
538 |
{
|
|
539 |
User::Leave( settingIndex );
|
|
540 |
}
|
|
541 |
PRINT( _L("Camera <= CCamStaticSettingsModel::SaveCenRepItemL") );
|
|
542 |
}
|
|
543 |
|
|
544 |
// ---------------------------------------------------------------------------
|
|
545 |
// CCamStaticSettingsModel::SaveSettingsL
|
|
546 |
// Saves the static settings to the shared data ini file
|
|
547 |
// ---------------------------------------------------------------------------
|
|
548 |
//
|
|
549 |
void CCamStaticSettingsModel::SaveSettingsL()
|
|
550 |
{
|
|
551 |
// do nothing, from now whenever a setting is changed,
|
|
552 |
// we call savestaticsettingL.
|
|
553 |
}
|
|
554 |
|
|
555 |
|
|
556 |
// --------------------------------------------
|
|
557 |
// CCamStaticSettingsModel::SaveStaticSettingL
|
|
558 |
// --------------------------------------------
|
|
559 |
//
|
|
560 |
void
|
|
561 |
CCamStaticSettingsModel::SaveStaticSettingL( TCamSettingItemIds aSettingId )
|
|
562 |
{
|
|
563 |
PRINT( _L("CCamStaticSettingsModel => SaveStaticSettingL") );
|
|
564 |
|
|
565 |
switch( aSettingId )
|
|
566 |
{
|
|
567 |
// Special cases for text settings.
|
|
568 |
// KCamCrLastUsedMonthFolder is also in text form, but it cannot be accessed
|
|
569 |
// with a setting item id.
|
|
570 |
case ECamSettingItemPhotoNameBase: SavePhotoBaseNameL(); break;
|
|
571 |
case ECamSettingItemVideoNameBase: SaveVideoBaseNameL(); break;
|
|
572 |
case ECamSettingItemDefaultAlbumName: SaveDefaultAlbumNameL(); break;
|
|
573 |
|
|
574 |
// Only save photo and video quality for primary camera
|
|
575 |
case ECamSettingItemPhotoQuality:
|
|
576 |
{
|
|
577 |
if ( !iEmbedded )
|
|
578 |
{
|
|
579 |
#ifndef CAMERAAPP_PLUGIN_BUILD
|
|
580 |
CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( CEikonEnv::Static()->AppUi() );
|
|
581 |
if ( appUi->ActiveCamera() == ECamActiveCameraPrimary )
|
|
582 |
#endif //CAMERAAPP_PLUGIN_BUILD
|
|
583 |
{
|
|
584 |
SaveCenRepItemL( ECamSettingItemPhotoQuality,
|
|
585 |
KCamCrPhotoQuality,
|
|
586 |
iStaticPhotoIntSettings );
|
|
587 |
}
|
|
588 |
}
|
|
589 |
break;
|
|
590 |
}
|
|
591 |
case ECamSettingItemVideoQuality:
|
|
592 |
{
|
|
593 |
if ( !iEmbedded )
|
|
594 |
{
|
|
595 |
#ifndef CAMERAAPP_PLUGIN_BUILD
|
|
596 |
CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( CEikonEnv::Static()->AppUi() );
|
|
597 |
if ( appUi->ActiveCamera() == ECamActiveCameraPrimary )
|
|
598 |
#endif //CAMERAAPP_PLUGIN_BUILD
|
|
599 |
{
|
|
600 |
SaveCenRepItemL( ECamSettingItemVideoQuality,
|
|
601 |
KCamCrVideoQuality,
|
|
602 |
iStaticVideoIntSettings );
|
|
603 |
}
|
|
604 |
}
|
|
605 |
break;
|
|
606 |
}
|
|
607 |
// Text settings which require no special handling
|
|
608 |
case ECamSettingItemImageToolbarItems:
|
|
609 |
case ECamSettingItemImageToolbarDefaultItems:
|
|
610 |
{
|
|
611 |
TUint32 crKey = MapSettingItem2CRKey( aSettingId, iEmbedded );
|
|
612 |
TPtrC value = TextSettingValue( aSettingId );
|
|
613 |
|
|
614 |
User::LeaveIfError( iRepository->Set( crKey, value ) );
|
|
615 |
break;
|
|
616 |
}
|
|
617 |
case ECamSettingItemShowCapturedPhoto:
|
|
618 |
case ECamSettingItemVideoShowCapturedVideo:
|
|
619 |
{
|
|
620 |
if ( iEmbedded )
|
|
621 |
{
|
|
622 |
// if in the embedded mode, we dont save value to the CenRep
|
|
623 |
// because in Embedded mode show photo/video capture setting is
|
|
624 |
// always on.
|
|
625 |
return;
|
|
626 |
}
|
|
627 |
else
|
|
628 |
{
|
|
629 |
}
|
|
630 |
}
|
|
631 |
// Integer settings which require no special handling
|
|
632 |
default:
|
|
633 |
{
|
|
634 |
RPointerArray<TIntSetting>* settingArray =
|
|
635 |
MapSettingItem2SettingsList( aSettingId );
|
|
636 |
|
|
637 |
if( settingArray )
|
|
638 |
{
|
|
639 |
TUint32 crKey = MapSettingItem2CRKey( aSettingId, iEmbedded );
|
|
640 |
SaveCenRepItemL( aSettingId, crKey, *settingArray );
|
|
641 |
}
|
|
642 |
else
|
|
643 |
{
|
|
644 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
645 |
}
|
|
646 |
break;
|
|
647 |
}
|
|
648 |
} // switch
|
|
649 |
|
|
650 |
PRINT( _L("CCamStaticSettingsModel <= SaveStaticSettingL") );
|
|
651 |
}
|
|
652 |
|
|
653 |
|
|
654 |
// ---------------------------------------------------------------------------
|
|
655 |
// MapSettingItem2CRKey <<static>>
|
|
656 |
// ---------------------------------------------------------------------------
|
|
657 |
//
|
|
658 |
TUint32
|
|
659 |
CCamStaticSettingsModel::MapSettingItem2CRKey( TCamSettingItemIds aSettingId,
|
|
660 |
TBool aEmbedded )
|
|
661 |
{
|
|
662 |
PRINT( _L("Camera => CCamStaticSettingsModel::MapSettingItem2CRKey") );
|
|
663 |
TUint32 crKey( 0 );
|
|
664 |
|
|
665 |
// -------------------------------------------------------
|
|
666 |
// static photo settings
|
|
667 |
if( ECamSettingItemStaticPhotoRangeMin < aSettingId
|
|
668 |
&& ECamSettingItemStaticPhotoRangeMax > aSettingId )
|
|
669 |
{
|
|
670 |
PRINT( _L(" Camera <=> CCamStaticSettingsModel ECamSettingItemStaticPhoto") );
|
|
671 |
switch( aSettingId )
|
|
672 |
{
|
|
673 |
case ECamSettingItemPhotoQuality: crKey = KCamCrPhotoQuality; break;
|
|
674 |
case ECamSettingItemPhotoSize: crKey = KCamCrPhotoSize; break;
|
|
675 |
case ECamSettingItemPhotoShowFocusPoint: crKey = KCamCrFocusPoint; break;
|
|
676 |
case ECamSettingItemPhotoStoreInAlbum: crKey = KCamCrPhotoStoreAlbum; break; //KCamCrDefaultAlbumId
|
|
677 |
case ECamSettingItemShowCapturedPhoto: crKey = KCamCrPhotoShowCaptured; break;
|
|
678 |
case ECamSettingItemPhotoCaptureTone: crKey = KCamCrPhotoCaptureTone; break;
|
|
679 |
case ECamSettingItemFaceTracking: crKey = KCamCrPhotoFaceTracking; break;
|
|
680 |
case ECamSettingItemPhotoMediaStorage: crKey = KCamCrPhotoMemInUse; break;
|
|
681 |
case ECamSettingItemPhotoNameBase: crKey = KCamCrPhotoNameBase; break;
|
|
682 |
|
|
683 |
case ECamSettingItemPhotoNameBaseType: crKey = KCamCrPhotoNameType; break;
|
|
684 |
case ECamSettingItemPhotoNumber: crKey = KCamCrPhotoImgCount; break;
|
|
685 |
case ECamSettingItemPhotoDigitalZoom: crKey = KCamCrPhotoExtDigZoom; break;
|
|
686 |
case ECamSettingItemImageRotation: crKey = KCamCrPhotoRotation; break;
|
|
687 |
case ECamSettingItemFlickerCancel: crKey = KCamCrFlickerCancellation; break;
|
|
688 |
|
|
689 |
case ECamSettingItemImageToolbarItems: crKey = KCamCrImageToolbarItems; break;
|
|
690 |
case ECamSettingItemImageToolbarDefaultItems: crKey = KCamCrImageToolbarDefaultItems; break;
|
|
691 |
case ECamSettingItemContinuousAutofocus: crKey = KCamCrContinuousAutofocus; break;
|
|
692 |
default: CamPanic( ECamPanicUnknownSettingItem );
|
|
693 |
break;
|
|
694 |
}
|
|
695 |
}
|
|
696 |
// -------------------------------------------------------
|
|
697 |
// static video settings
|
|
698 |
else if( ECamSettingItemStaticVideoRangeMin < aSettingId
|
|
699 |
&& ECamSettingItemStaticVideoRangeMax > aSettingId )
|
|
700 |
{
|
|
701 |
PRINT( _L(" Camera <=> CCamStaticSettingsModel : ECamSettingItemStaticVideoRange") );
|
|
702 |
switch( aSettingId )
|
|
703 |
{
|
|
704 |
case ECamSettingItemVideoAudioRec:
|
|
705 |
if( aEmbedded ) crKey = KCamCrEmbeddedVideoAudRec;
|
|
706 |
else crKey = KCamCrVideoAudRec;
|
|
707 |
break;
|
|
708 |
case ECamSettingItemContinuousAutofocus:
|
|
709 |
crKey = KCamCrContinuousAutofocus;
|
|
710 |
break;
|
|
711 |
case ECamSettingItemVideoResolution: crKey = KCamCrVideoRes; break;
|
|
712 |
case ECamSettingItemVideoClipLength: crKey = KCamCrVideoClipLen; break;
|
|
713 |
case ECamSettingItemVideoFileType: crKey = KCamCrVideoFileType; break;
|
|
714 |
case ECamSettingItemVideoStoreInAlbum: crKey = KCamCrVideoStoreAlbum; break; //KCamCrDefaultAlbumId
|
|
715 |
case ECamSettingItemVideoShowCapturedVideo: crKey = KCamCrVideoShowCaptured; break;
|
|
716 |
case ECamSettingItemVideoMediaStorage: crKey = KCamCrVideoMemInUse; break;
|
|
717 |
case ECamSettingItemVideoNameBase: crKey = KCamCrVideoNameBase; break;
|
|
718 |
case ECamSettingItemVideoNameBaseType: crKey = KCamCrVideoNameType; break;
|
|
719 |
case ECamSettingItemVideoNumber: crKey = KCamCrVideoCount; break;
|
|
720 |
case ECamSettingItemVideoQuality: crKey = KCamCrVideoQuality; break;
|
|
721 |
case ECamSettingItemVideoDigitalZoom: crKey = KCamCrVideoExtDigZoom; break;
|
|
722 |
case ECamSettingItemVideoStab: crKey = KCamCrVideoStabilisation; break;
|
|
723 |
default: CamPanic( ECamPanicUnknownSettingItem );
|
|
724 |
break;
|
|
725 |
}
|
|
726 |
}
|
|
727 |
// -------------------------------------------------------
|
|
728 |
// static common settings
|
|
729 |
else if( ECamSettingItemStaticCommonRangeMin < aSettingId
|
|
730 |
&& ECamSettingItemStaticCommonRangeMax > aSettingId )
|
|
731 |
{
|
|
732 |
PRINT( _L("Camera <=> CCamStaticSettingsModel ECamSettingItemStaticCommon") );
|
|
733 |
switch( aSettingId )
|
|
734 |
{
|
|
735 |
case ECamSettingItemUserMode: crKey = KCamCrUserMode; break;
|
|
736 |
case ECamSettingItemDefaultAlbumId: crKey = KCamCrDefaultAlbumId; break;
|
|
737 |
case ECamSettingItemDefaultAlbumName: crKey = KCamCrDefaultAlbumTitle; break;
|
|
738 |
case ECamSettingItemRecLocation: crKey = KCamCrPhotoStoreLocation; break;
|
|
739 |
case ECamSettingItemPhotoEditorSupport: crKey = KCamCrPhotoEditorSupport; break;
|
|
740 |
case ECamSettingItemVideoEditorSupport: crKey = KCamCrVideoEditorSupport; break;
|
|
741 |
case ECamSettingItemRemovePhoneMemoryUsage: crKey = KCamCrRemovePhoneMemoryUsage; break;
|
|
742 |
case ECamSettingItemStopRecordingInHdmiMode: crKey = KCamCrStopRecordingInHdmiMode; break;
|
|
743 |
|
|
744 |
default: CamPanic( ECamPanicUnknownSettingItem );
|
|
745 |
break;
|
|
746 |
}
|
|
747 |
}
|
|
748 |
// -------------------------------------------------------
|
|
749 |
else if( ECamSettingItemUserSceneRangeMin < aSettingId
|
|
750 |
&& ECamSettingItemUserSceneRangeMax > aSettingId )
|
|
751 |
{
|
|
752 |
PRINT( _L("Camera <=> CCamStaticSettingsModel ECamSettingItemUserSceneRange") );
|
|
753 |
switch( aSettingId )
|
|
754 |
{
|
|
755 |
case ECamSettingItemUserSceneBasedOnScene: crKey = KCamCrUserSceneBaseScene; break;
|
|
756 |
case ECamSettingItemUserSceneWhitebalance: crKey = KCamCrUserSceneWhiteBalance; break;
|
|
757 |
case ECamSettingItemUserSceneColourFilter: crKey = KCamCrUserSceneColourFilter; break;
|
|
758 |
case ECamSettingItemUserSceneExposure: crKey = KCamCrUserSceneExposure; break;
|
|
759 |
case ECamSettingItemUserSceneFlash: crKey = KCamCrUserSceneFlash; break;
|
|
760 |
case ECamSettingItemUserSceneBrightness: crKey = KCamCrUserSceneBrightness; break;
|
|
761 |
case ECamSettingItemUserSceneContrast: crKey = KCamCrUserSceneContrast; break;
|
|
762 |
case ECamSettingItemUserSceneImageSharpness: crKey = KCamCrUserSceneImageSharpness; break;
|
|
763 |
case ECamSettingItemUserSceneColourSaturation: crKey = KCamCrUserSceneColourSaturation; break;
|
|
764 |
case ECamSettingItemUserSceneLightSensitivity: crKey = KCamCrUserSceneLightSensitivity; break;
|
|
765 |
case ECamSettingItemUserSceneDefault: crKey = KCamCrUserSceneDefault; break;
|
|
766 |
default: CamPanic( ECamPanicUnknownSettingItem );
|
|
767 |
break;
|
|
768 |
}
|
|
769 |
}
|
|
770 |
else
|
|
771 |
{
|
|
772 |
PRINT( _L(" Camera <=> CCamStaticSettingsModel CamPanic( ECamPanicUnknownSettingItem )") );
|
|
773 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
774 |
}
|
|
775 |
|
|
776 |
PRINT( _L("Camera <= CCamSettingsModel::MapSettingItem2CRKey") );
|
|
777 |
return crKey;
|
|
778 |
}
|
|
779 |
|
|
780 |
// ---------------------------------------------------------------------------
|
|
781 |
//
|
|
782 |
// ---------------------------------------------------------------------------
|
|
783 |
//
|
|
784 |
RPointerArray<TIntSetting>*
|
|
785 |
CCamStaticSettingsModel::MapSettingItem2SettingsList( TCamSettingItemIds aSettingId )
|
|
786 |
{
|
|
787 |
PRINT( _L("Camera => CCamStaticSettingsModel::MapSettingItem2SettingsList") );
|
|
788 |
|
|
789 |
RPointerArray<TIntSetting>* array( NULL );
|
|
790 |
|
|
791 |
if( ECamSettingItemStaticPhotoRangeMin < aSettingId &&
|
|
792 |
ECamSettingItemStaticPhotoRangeMax > aSettingId )
|
|
793 |
{
|
|
794 |
if( ECamSettingItemPhotoNameBase == aSettingId )
|
|
795 |
array = NULL;
|
|
796 |
else
|
|
797 |
array = &iStaticPhotoIntSettings;
|
|
798 |
}
|
|
799 |
else if( ECamSettingItemStaticVideoRangeMin < aSettingId &&
|
|
800 |
ECamSettingItemStaticVideoRangeMax > aSettingId )
|
|
801 |
{
|
|
802 |
if( ECamSettingItemVideoNameBase == aSettingId )
|
|
803 |
array = NULL;
|
|
804 |
else
|
|
805 |
array = &iStaticVideoIntSettings;
|
|
806 |
}
|
|
807 |
else if( ECamSettingItemStaticCommonRangeMin < aSettingId &&
|
|
808 |
ECamSettingItemStaticCommonRangeMax > aSettingId )
|
|
809 |
{
|
|
810 |
array = &iStaticCommonIntSettings;
|
|
811 |
}
|
|
812 |
else
|
|
813 |
{
|
|
814 |
CamPanic( ECamPanicUnknownSettingItem );
|
|
815 |
array = NULL;
|
|
816 |
}
|
|
817 |
|
|
818 |
PRINT( _L("Camera <= CCamStaticSettingsModel::MapSettingItem2SettingsList") );
|
|
819 |
return array;
|
|
820 |
}
|
|
821 |
|
|
822 |
|
|
823 |
// ---------------------------------------------------------------------------
|
|
824 |
// CCamStaticSettingsModel::~CCamStaticSettingsModel
|
|
825 |
// Destructor
|
|
826 |
// ---------------------------------------------------------------------------
|
|
827 |
//
|
|
828 |
CCamStaticSettingsModel::~CCamStaticSettingsModel()
|
|
829 |
{
|
|
830 |
PRINT( _L("Camera => ~CCamStaticSettingsModel") );
|
|
831 |
iStaticCommonIntSettings.ResetAndDestroy();
|
|
832 |
iStaticCommonIntSettings.Close();
|
|
833 |
|
|
834 |
iStaticPhotoIntSettings.ResetAndDestroy();
|
|
835 |
iStaticPhotoIntSettings.Close();
|
|
836 |
|
|
837 |
iStaticVideoIntSettings.ResetAndDestroy();
|
|
838 |
iStaticVideoIntSettings.Close();
|
|
839 |
delete iRepository;
|
|
840 |
delete iConfigManager;
|
|
841 |
iConfigManager = NULL;
|
|
842 |
PRINT( _L("Camera <= ~CCamStaticSettingsModel") );
|
|
843 |
}
|
|
844 |
|
|
845 |
|
|
846 |
// ---------------------------------------------------------------------------
|
|
847 |
// CCamStaticSettingsModel::CCamStaticSettingsModel
|
|
848 |
// C++ constructor
|
|
849 |
// ---------------------------------------------------------------------------
|
|
850 |
//
|
|
851 |
CCamStaticSettingsModel::CCamStaticSettingsModel( CCamConfiguration& aConfiguration )
|
|
852 |
: iEmbedded( EFalse ),
|
|
853 |
iConfiguration( aConfiguration )
|
|
854 |
{
|
|
855 |
iSecondaryCameraSettings.iVideoQuality
|
|
856 |
= iConfiguration.SecondaryCameraVideoQuality();
|
|
857 |
iSecondaryCameraSettings.iPhotoQuality
|
|
858 |
= iConfiguration.SecondaryCameraImageQuality();
|
|
859 |
|
|
860 |
// Check that configuration can provide us secondary camera qualities
|
|
861 |
// If either of them is unavailable, all we can do is panic
|
|
862 |
PRINT( _L("Camera <> Checking secondary camera qualities") );
|
|
863 |
__ASSERT_ALWAYS( iSecondaryCameraSettings.iVideoQuality > 0,
|
|
864 |
CamPanic( ECamPanicSecondaryQualityMissing ) );
|
|
865 |
|
|
866 |
__ASSERT_ALWAYS( iSecondaryCameraSettings.iPhotoQuality > 0,
|
|
867 |
CamPanic( ECamPanicSecondaryQualityMissing ) );
|
|
868 |
}
|
|
869 |
|
|
870 |
|
|
871 |
// ---------------------------------------------------------------------------
|
|
872 |
// CCamStaticSettingsModel::ConstructL
|
|
873 |
// Symbian OS 2nd phase constructor
|
|
874 |
// ---------------------------------------------------------------------------
|
|
875 |
//
|
|
876 |
void CCamStaticSettingsModel::ConstructL()
|
|
877 |
{
|
|
878 |
PRINT( _L("Camera => CCamStaticSettingsModel::ConstructL") );
|
|
879 |
iRepository = CRepository::NewL( KCRUidCameraappSettings );
|
|
880 |
iConfigManager = CCameraUiConfigManager::NewL();
|
|
881 |
PRINT( _L("Camera <= CCamStaticSettingsModel::ConstructL") );
|
|
882 |
}
|
|
883 |
|
|
884 |
|
|
885 |
// ---------------------------------------------------------------------------
|
|
886 |
// CCamStaticSettingsModel::SearchInSettingsListFor
|
|
887 |
// Searches in a settings list for a particular setting item.
|
|
888 |
// ---------------------------------------------------------------------------
|
|
889 |
//
|
|
890 |
TInt
|
|
891 |
CCamStaticSettingsModel::SearchInSettingsListFor(
|
|
892 |
const RPointerArray<TIntSetting>& aSettingsList,
|
|
893 |
TInt aSettingItem ) const
|
|
894 |
{
|
|
895 |
return aSettingsList.Find( aSettingItem, SettingIdMatches );
|
|
896 |
}
|
|
897 |
|
|
898 |
// ---------------------------------------------------------------------------
|
|
899 |
// CCamStaticSettingsModel::ResetRepository
|
|
900 |
// Reset Camera central repository file
|
|
901 |
// ---------------------------------------------------------------------------
|
|
902 |
//
|
|
903 |
void CCamStaticSettingsModel::ResetRepository()
|
|
904 |
{
|
|
905 |
if( iRepository )
|
|
906 |
{
|
|
907 |
iRepository->Reset();
|
|
908 |
}
|
|
909 |
}
|
|
910 |
|
|
911 |
|
|
912 |
// ---------------------------------------------------------------------------
|
|
913 |
// CCamStaticSettingsModel::UnloadStaticSettings
|
|
914 |
// Remove any previously loaded static settings.
|
|
915 |
// ---------------------------------------------------------------------------
|
|
916 |
//
|
|
917 |
void CCamStaticSettingsModel::UnloadStaticSettings()
|
|
918 |
{
|
|
919 |
PRINT( _L("Camera => CCamStaticSettingsModel::UnloadStaticSettings()" ))
|
|
920 |
iStaticCommonIntSettings.ResetAndDestroy();
|
|
921 |
iStaticPhotoIntSettings.ResetAndDestroy();
|
|
922 |
iStaticVideoIntSettings.ResetAndDestroy();
|
|
923 |
PRINT( _L("Camera <= CCamStaticSettingsModel::UnloadStaticSettings()" ))
|
|
924 |
}
|
|
925 |
|
|
926 |
// ---------------------------------------------------------------------------
|
|
927 |
// CCamStaticSettingsModel::LoadPhotoBaseNameL
|
|
928 |
// Loads the photo base name either from resource or from shared data
|
|
929 |
// as appropriate
|
|
930 |
// ---------------------------------------------------------------------------
|
|
931 |
//
|
|
932 |
void
|
|
933 |
CCamStaticSettingsModel::LoadPhotoBaseNameL()
|
|
934 |
{
|
|
935 |
User::LeaveIfError( iRepository->Get( KCamCrPhotoNameBase , iPhotoBaseName ) );
|
|
936 |
// If photoname base not defined
|
|
937 |
if ( iPhotoBaseName.Length() == 0 )
|
|
938 |
{
|
|
939 |
// Read base file name from resources and set the shared data key.
|
|
940 |
StringLoader::Load( iPhotoBaseName, R_CAM_NAMEBASE_IMAGE );
|
|
941 |
}
|
|
942 |
}
|
|
943 |
|
|
944 |
//
|
|
945 |
// ---------------------------------------------------------------------------
|
|
946 |
// CCamStaticSettingsModel::LoadVideoBaseNameL
|
|
947 |
// Loads the video base name either from resource or from shared data
|
|
948 |
// as appropriate
|
|
949 |
// ---------------------------------------------------------------------------
|
|
950 |
void
|
|
951 |
CCamStaticSettingsModel::LoadVideoBaseNameL()
|
|
952 |
{
|
|
953 |
User::LeaveIfError( iRepository->Get( KCamCrVideoNameBase , iVideoBaseName ) );
|
|
954 |
if ( iVideoBaseName.Length() == 0 )
|
|
955 |
{
|
|
956 |
// Read base file name from resources and set the shared data key.
|
|
957 |
StringLoader::Load( iVideoBaseName, R_CAM_NAMEBASE_VIDEO );
|
|
958 |
}
|
|
959 |
}
|
|
960 |
|
|
961 |
|
|
962 |
//
|
|
963 |
// ---------------------------------------------------------------------------
|
|
964 |
// CCamStaticSettingsModel::LoadVideoBaseNameL
|
|
965 |
// Loads the video base name either from resource or from shared data
|
|
966 |
// as appropriate
|
|
967 |
// ---------------------------------------------------------------------------
|
|
968 |
void
|
|
969 |
CCamStaticSettingsModel::LoadDefaultAlbumNameL()
|
|
970 |
{
|
|
971 |
User::LeaveIfError( iRepository->Get( KCamCrDefaultAlbumTitle,
|
|
972 |
iDefaultAlbumName ) );
|
|
973 |
}
|
|
974 |
|
|
975 |
|
|
976 |
// ---------------------------------------------------------------------------
|
|
977 |
// CCamStaticSettingsModel::SavePhotoBaseNameL
|
|
978 |
// Saves the photo base name after comparing against resource to see if we
|
|
979 |
// have switched back to the default base
|
|
980 |
// ---------------------------------------------------------------------------
|
|
981 |
//
|
|
982 |
void
|
|
983 |
CCamStaticSettingsModel::SavePhotoBaseNameL()
|
|
984 |
{
|
|
985 |
TBuf<KMaxNameBaseLength> savedBaseName;
|
|
986 |
TBuf<KMaxNameBaseLength> resourceBaseName;
|
|
987 |
TBuf<KMaxNameBaseLength> sharedDataBaseName = iPhotoBaseName;
|
|
988 |
|
|
989 |
User::LeaveIfError( iRepository->Get( KCamCrPhotoNameBase,
|
|
990 |
savedBaseName ) );
|
|
991 |
StringLoader::Load(resourceBaseName, R_CAM_NAMEBASE_IMAGE );
|
|
992 |
|
|
993 |
if ( savedBaseName.Length() == 0 && iPhotoBaseName == resourceBaseName )
|
|
994 |
{
|
|
995 |
sharedDataBaseName = KNullDesC;
|
|
996 |
}
|
|
997 |
User::LeaveIfError( iRepository->Set( KCamCrPhotoNameBase,
|
|
998 |
sharedDataBaseName ) );
|
|
999 |
}
|
|
1000 |
|
|
1001 |
//
|
|
1002 |
// ---------------------------------------------------------------------------
|
|
1003 |
// CCamStaticSettingsModel::SaveVideoBaseNameL
|
|
1004 |
// Saves the video base name after comparing against resource to see if we
|
|
1005 |
// have switched back to the default base
|
|
1006 |
// ---------------------------------------------------------------------------
|
|
1007 |
void CCamStaticSettingsModel::SaveVideoBaseNameL()
|
|
1008 |
{
|
|
1009 |
TBuf<KMaxNameBaseLength> savedBaseName;
|
|
1010 |
TBuf<KMaxNameBaseLength> resourceBaseName;
|
|
1011 |
TBuf<KMaxNameBaseLength> sharedDataBaseName = iVideoBaseName;
|
|
1012 |
|
|
1013 |
User::LeaveIfError( iRepository->Get( KCamCrVideoNameBase,
|
|
1014 |
savedBaseName ) );
|
|
1015 |
StringLoader::Load(resourceBaseName, R_CAM_NAMEBASE_VIDEO );
|
|
1016 |
|
|
1017 |
if ( savedBaseName.Length() == 0 &&
|
|
1018 |
iVideoBaseName == resourceBaseName )
|
|
1019 |
{
|
|
1020 |
sharedDataBaseName = KNullDesC;
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
User::LeaveIfError( iRepository->Set( KCamCrVideoNameBase,
|
|
1024 |
sharedDataBaseName ) );
|
|
1025 |
}
|
|
1026 |
|
|
1027 |
|
|
1028 |
//
|
|
1029 |
// ---------------------------------------------------------------------------
|
|
1030 |
// CCamStaticSettingsModel::SaveDefaultAlbumNameL
|
|
1031 |
// Saves the name of the default album set
|
|
1032 |
// ---------------------------------------------------------------------------
|
|
1033 |
void CCamStaticSettingsModel::SaveDefaultAlbumNameL()
|
|
1034 |
{
|
|
1035 |
User::LeaveIfError( iRepository->Set( KCamCrDefaultAlbumTitle,
|
|
1036 |
iDefaultAlbumName ) );
|
|
1037 |
}
|
|
1038 |
|
|
1039 |
|
|
1040 |
// ---------------------------------------------------------------------------
|
|
1041 |
// CCamStaticSettingsModel::ReadCenRepStringL
|
|
1042 |
// ---------------------------------------------------------------------------
|
|
1043 |
//
|
|
1044 |
HBufC*
|
|
1045 |
CCamStaticSettingsModel::ReadCenRepStringL( TInt aCenRepKeyId )
|
|
1046 |
{
|
|
1047 |
PRINT1( _L("Camera => CCamSettingsModel::ReadCenRepStringL, key:0x%02x"), aCenRepKeyId );
|
|
1048 |
|
|
1049 |
HBufC* string = HBufC::NewLC( KCamCRStringInitialLength );
|
|
1050 |
|
|
1051 |
TPtr ptr = string->Des();
|
|
1052 |
TInt size = 0;
|
|
1053 |
TInt status = iRepository->Get( aCenRepKeyId, ptr, size );
|
|
1054 |
|
|
1055 |
// Did not fit into the string, reserve more memory and try again
|
|
1056 |
if( KErrOverflow == status )
|
|
1057 |
{
|
|
1058 |
PRINT2( _L("Camera <> CCamSettingsModel: need bigger buffer, length: %d -> %d"), ptr.MaxLength(), size );
|
|
1059 |
CleanupStack::PopAndDestroy(); // String
|
|
1060 |
string = HBufC::NewLC( size );
|
|
1061 |
ptr = string->Des();
|
|
1062 |
|
|
1063 |
status = iRepository->Get( aCenRepKeyId, ptr, size );
|
|
1064 |
}
|
|
1065 |
|
|
1066 |
User::LeaveIfError( status );
|
|
1067 |
CleanupStack::Pop(); // string
|
|
1068 |
PRINT1( _L("Camera <= CCamSettingsModel::ReadCenRepStringL, got string:[%S]"), string);
|
|
1069 |
|
|
1070 |
return string;
|
|
1071 |
}
|
|
1072 |
|
|
1073 |
// ---------------------------------------------------------------------------
|
|
1074 |
// CCamStaticSettingsModel::ResetSettingItem
|
|
1075 |
// ---------------------------------------------------------------------------
|
|
1076 |
//
|
|
1077 |
void CCamStaticSettingsModel::ResetSettingItem( const TInt aCenRepKeyId )
|
|
1078 |
{
|
|
1079 |
TInt err = iRepository->Reset( aCenRepKeyId );
|
|
1080 |
if ( KErrNone != err )
|
|
1081 |
{
|
|
1082 |
// Handle the error case
|
|
1083 |
}
|
|
1084 |
}
|
|
1085 |
|
|
1086 |
|
|
1087 |
// ---------------------------------------------------------------------------
|
|
1088 |
// CCamSettingsModel::StorePrimaryCameraSettingsL
|
|
1089 |
// Stores the primary camera settings so they can be reapplied when
|
|
1090 |
// changing from front to back camera
|
|
1091 |
// ---------------------------------------------------------------------------
|
|
1092 |
//
|
|
1093 |
void CCamStaticSettingsModel::StorePrimaryCameraSettingsL()
|
|
1094 |
{
|
|
1095 |
PRINT( _L("Camera => CCamStaticSettingsModel::StorePrimaryCameraSettingsL"))
|
|
1096 |
TInt settingIndex = SearchInSettingsListFor( iStaticPhotoIntSettings,
|
|
1097 |
ECamSettingItemPhotoQuality );
|
|
1098 |
if ( settingIndex != KErrNotFound )
|
|
1099 |
{
|
|
1100 |
iPrimaryCameraSettings.iPhotoQuality =
|
|
1101 |
iStaticPhotoIntSettings[settingIndex]->iValueId;
|
|
1102 |
}
|
|
1103 |
|
|
1104 |
settingIndex = SearchInSettingsListFor( iStaticVideoIntSettings,
|
|
1105 |
ECamSettingItemVideoQuality );
|
|
1106 |
if ( settingIndex != KErrNotFound )
|
|
1107 |
{
|
|
1108 |
iPrimaryCameraSettings.iVideoQuality =
|
|
1109 |
iStaticVideoIntSettings[settingIndex]->iValueId;
|
|
1110 |
}
|
|
1111 |
PRINT( _L("Camera <= CCamStaticSettingsModel::StorePrimaryCameraSettingsL"))
|
|
1112 |
}
|
|
1113 |
|
|
1114 |
// ---------------------------------------------------------------------------
|
|
1115 |
// CCamSettingsModel::RestorePrimaryCameraSettingsL
|
|
1116 |
// Restores the primary camera settings when
|
|
1117 |
// changing from front to back camera
|
|
1118 |
// ---------------------------------------------------------------------------
|
|
1119 |
//
|
|
1120 |
void CCamStaticSettingsModel::RestorePrimaryCameraSettingsL()
|
|
1121 |
{
|
|
1122 |
// set the stored primary camera settings
|
|
1123 |
SetIntegerSettingValueL( ECamSettingItemPhotoQuality,
|
|
1124 |
iPrimaryCameraSettings.iPhotoQuality );
|
|
1125 |
SetIntegerSettingValueL( ECamSettingItemVideoQuality,
|
|
1126 |
iPrimaryCameraSettings.iVideoQuality );
|
|
1127 |
// set the secondary camera settings back to defaults
|
|
1128 |
iSecondaryCameraSettings.iPhotoQuality = iConfiguration.SecondaryCameraImageQuality();
|
|
1129 |
iSecondaryCameraSettings.iVideoQuality = iConfiguration.SecondaryCameraVideoQuality();
|
|
1130 |
}
|
|
1131 |
|
|
1132 |
#ifndef CAMERAAPP_PLUGIN_BUILD
|
|
1133 |
// ---------------------------------------------------------------------------
|
|
1134 |
// CCamStaticSettingsModel::LoadDynamicSettingsL
|
|
1135 |
// Loads the dynamic settings from resource file for a
|
|
1136 |
// particular group of settings.
|
|
1137 |
// ---------------------------------------------------------------------------
|
|
1138 |
//
|
|
1139 |
void
|
|
1140 |
CCamStaticSettingsModel::LoadSettingsFromResourceL(
|
|
1141 |
TInt aResourceId,
|
|
1142 |
RPointerArray<TIntSetting>& aSettingsList )
|
|
1143 |
{
|
|
1144 |
// Create resource reader for reading photo static settings
|
|
1145 |
TResourceReader reader;
|
|
1146 |
CEikonEnv::Static()->CreateResourceReaderLC( reader, aResourceId );
|
|
1147 |
TInt count = reader.ReadInt16();
|
|
1148 |
|
|
1149 |
// for each entry in the resource, create a new setting item.
|
|
1150 |
TInt i;
|
|
1151 |
for ( i = 0; i < count; ++i )
|
|
1152 |
{
|
|
1153 |
TIntSetting* newSetting = new (ELeave) TIntSetting;
|
|
1154 |
CleanupStack::PushL( newSetting );
|
|
1155 |
|
|
1156 |
// Read the data for this setting item from resource.
|
|
1157 |
newSetting->iItemId = reader.ReadInt16();
|
|
1158 |
newSetting->iValueId = reader.ReadInt16();
|
|
1159 |
|
|
1160 |
// Add the new setting item and its associated key
|
|
1161 |
// to the parallel arrays for static photo settings.
|
|
1162 |
aSettingsList.AppendL( newSetting );
|
|
1163 |
CleanupStack::Pop( newSetting );
|
|
1164 |
}
|
|
1165 |
|
|
1166 |
CleanupStack::PopAndDestroy(); // reader
|
|
1167 |
}
|
|
1168 |
#endif //CAMERAAPP_PLUGIN_BUILD
|
|
1169 |
|
|
1170 |
// ---------------------------------------------------------------------------
|
|
1171 |
// CCamStaticSettingsModel::Configuration
|
|
1172 |
//
|
|
1173 |
// ---------------------------------------------------------------------------
|
|
1174 |
//
|
|
1175 |
CCamConfiguration&
|
|
1176 |
CCamStaticSettingsModel::Configuration() const
|
|
1177 |
{
|
|
1178 |
return iConfiguration;
|
|
1179 |
}
|
|
1180 |
|
|
1181 |
//
|
|
1182 |
// CCamStaticSettingsModel::LoadPhotoStaticSettingsL
|
|
1183 |
//
|
|
1184 |
void CCamStaticSettingsModel::LoadPhotoStaticSettingsL( const TBool aResetFromPlugin )
|
|
1185 |
{
|
|
1186 |
if ( aResetFromPlugin )
|
|
1187 |
{
|
|
1188 |
LoadCommonStaticSettingsL( aResetFromPlugin );
|
|
1189 |
iStaticPhotoIntSettings.ResetAndDestroy();
|
|
1190 |
}
|
|
1191 |
// Load Photo/Image Settings
|
|
1192 |
ReadFromCenRepL( static_cast<TInt>( ECamSettingItemStaticPhotoRangeMin ),
|
|
1193 |
static_cast<TInt>( ECamSettingItemPhotoCompression ),
|
|
1194 |
iStaticPhotoIntSettings );
|
|
1195 |
|
|
1196 |
}
|
|
1197 |
|
|
1198 |
//
|
|
1199 |
// CCamStaticSettingsModel::LoadVideoStaticSettingsL
|
|
1200 |
//
|
|
1201 |
void CCamStaticSettingsModel::LoadVideoStaticSettingsL( const TBool aResetFromPlugin )
|
|
1202 |
{
|
|
1203 |
if ( aResetFromPlugin )
|
|
1204 |
{
|
|
1205 |
LoadCommonStaticSettingsL( aResetFromPlugin );
|
|
1206 |
iStaticVideoIntSettings.ResetAndDestroy();
|
|
1207 |
}
|
|
1208 |
// Load Video Settings
|
|
1209 |
ReadFromCenRepL( static_cast<TInt>( ECamSettingItemStaticVideoRangeMin ),
|
|
1210 |
static_cast<TInt>( ECamSettingItemVideoOpZoomOff ),
|
|
1211 |
iStaticVideoIntSettings );
|
|
1212 |
|
|
1213 |
}
|
|
1214 |
|
|
1215 |
//
|
|
1216 |
// CCamStaticSettingsModel::LoadCommonStaticSettingsL
|
|
1217 |
//
|
|
1218 |
void CCamStaticSettingsModel::LoadCommonStaticSettingsL( const TBool aResetFromPlugin )
|
|
1219 |
{
|
|
1220 |
if ( aResetFromPlugin )
|
|
1221 |
{
|
|
1222 |
iStaticCommonIntSettings.ResetAndDestroy();
|
|
1223 |
}
|
|
1224 |
// Load Common Settings
|
|
1225 |
ReadFromCenRepL( static_cast<TInt>( ECamSettingItemStaticCommonRangeMin ),
|
|
1226 |
static_cast<TInt>( ECamSettingItemStaticCommonRangeMax ),
|
|
1227 |
iStaticCommonIntSettings );
|
|
1228 |
}
|
|
1229 |
|
|
1230 |
/*
|
|
1231 |
* Handle to Camera Ui Config Manager
|
|
1232 |
*/
|
|
1233 |
CCameraUiConfigManager* CCamStaticSettingsModel::UiConfigManagerPtr()
|
|
1234 |
{
|
|
1235 |
return iConfigManager;
|
|
1236 |
}
|
|
1237 |
//End of File
|