54
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <activepalette2factory.h>
|
|
22 |
#include <activepalette2genericpluginint.h>
|
|
23 |
#include <activepalette2itemvisible.h>
|
|
24 |
#include <activepalette2eventdata.h>
|
|
25 |
#include <activepalette2navigationkeys.h>
|
|
26 |
#include <cameraapp.rsg>
|
|
27 |
#include <vgacamsettings.rsg>
|
|
28 |
#include <barsc.h>
|
|
29 |
#include <barsread.h>
|
|
30 |
#include <bautils.h>
|
|
31 |
#include <AknIconUtils.h>
|
|
32 |
#include <aknnotewrappers.h>
|
|
33 |
#include <AknUtils.h>
|
|
34 |
#include <e32math.h>
|
|
35 |
#include <gulicon.h>
|
|
36 |
#include <cameraapp.mbg>
|
|
37 |
#include <utf.h>
|
|
38 |
#include <textresolver.h>
|
|
39 |
#include <apgcli.h>
|
|
40 |
#include <apaid.h>
|
|
41 |
|
|
42 |
#include "CamUtility.h"
|
|
43 |
#include "CamAppController.h"
|
|
44 |
#include "camactivepalettehandler.h"
|
|
45 |
#include "CamAppUid.h"
|
|
46 |
#include "CamCaptureSetupViewBase.h"
|
|
47 |
#include "CamAppUiBase.h"
|
|
48 |
#include "CamPanic.h"
|
|
49 |
#include "CamAppUi.h"
|
|
50 |
#include "CamUtility.h"
|
|
51 |
#include "CamTimeLapseUtility.h"
|
|
52 |
#include "CamPSI.h"
|
|
53 |
#include "CameraUiConfigManager.h"
|
|
54 |
#include "OstTraceDefinitions.h"
|
|
55 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
56 |
#include "camactivepalettehandlerTraces.h"
|
|
57 |
#endif
|
|
58 |
|
|
59 |
|
|
60 |
typedef TAP2GenericPluginIcon TCamAPGenericPluginIcon;
|
|
61 |
typedef TAP2GenericPluginParams TCamAPGenericPluginParams;
|
|
62 |
|
|
63 |
// ============================ CONSTANTS ======================================
|
|
64 |
|
|
65 |
// ActivePalette2 settings
|
|
66 |
const TActivePalette2DrawMode KActivePaletteDrawMode = EAP2DrawModeSemiTransparentTooltipModeFading;
|
|
67 |
|
|
68 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
69 |
|
|
70 |
// -----------------------------------------------------------------------------
|
|
71 |
// CCamActivePaletteHandler::CCamActivePaletteHandler
|
|
72 |
// C++ default constructor can NOT contain any code, that
|
|
73 |
// might leave.
|
|
74 |
// -----------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
CCamActivePaletteHandler::CCamActivePaletteHandler( CCamAppController& aController )
|
|
77 |
: iController( aController )
|
|
78 |
{
|
|
79 |
}
|
|
80 |
|
|
81 |
// -----------------------------------------------------------------------------
|
|
82 |
// CCamActivePaletteHandler::ConstructL
|
|
83 |
// Symbian 2nd phase constructor can leave.
|
|
84 |
// -----------------------------------------------------------------------------
|
|
85 |
//
|
|
86 |
void CCamActivePaletteHandler::ConstructL( TBool aCreatePalette )
|
|
87 |
{
|
|
88 |
if ( !iController.IsTouchScreenSupported() )
|
|
89 |
{
|
|
90 |
iEnv = CEikonEnv::Static();
|
|
91 |
|
|
92 |
if( aCreatePalette )
|
|
93 |
{
|
|
94 |
iActivePalette =
|
|
95 |
ActivePalette2Factory::CreateActivePaletteUIL( KActivePaletteDrawMode );
|
|
96 |
iActivePalette->SetObserver( this );
|
|
97 |
}
|
|
98 |
|
|
99 |
// Get the icon file name
|
|
100 |
delete iIconFileName;
|
|
101 |
iIconFileName = NULL;
|
|
102 |
iIconFileName = HBufC::NewL( KMaxFileName );
|
|
103 |
TPtr ptr = iIconFileName->Des();
|
|
104 |
CamUtility::ResourceFileName( ptr );
|
|
105 |
|
|
106 |
|
|
107 |
// get res id for EV comp from psi
|
|
108 |
CamUtility::GetPsiInt( ECamPsiAPEVCompLegend, iEvCompRes );
|
|
109 |
if( iEvCompRes == KErrNotSupported )
|
|
110 |
{
|
|
111 |
iEvCompRes = R_CAM_CAPTURE_SETUP_MENU_PHOTO_EXPOSURE_ARRAY;
|
|
112 |
}
|
|
113 |
}
|
|
114 |
}
|
|
115 |
|
|
116 |
// -----------------------------------------------------------------------------
|
|
117 |
// CCamActivePaletteHandler::NewL
|
|
118 |
// Two-phased constructor.
|
|
119 |
// -----------------------------------------------------------------------------
|
|
120 |
//
|
|
121 |
CCamActivePaletteHandler* CCamActivePaletteHandler::NewL( CCamAppController& aController, TBool aCreatePalette )
|
|
122 |
{
|
|
123 |
CCamActivePaletteHandler* self = new( ELeave ) CCamActivePaletteHandler( aController );
|
|
124 |
|
|
125 |
CleanupStack::PushL( self );
|
|
126 |
self->ConstructL( aCreatePalette );
|
|
127 |
CleanupStack::Pop();
|
|
128 |
|
|
129 |
return self;
|
|
130 |
}
|
|
131 |
|
|
132 |
|
|
133 |
// Destructor
|
|
134 |
CCamActivePaletteHandler::~CCamActivePaletteHandler()
|
|
135 |
{
|
|
136 |
PRINT( _L("Camera => ~CCamActivePaletteHandler") );
|
|
137 |
delete iIconFileName;
|
|
138 |
iIconFileName = NULL;
|
|
139 |
|
|
140 |
iItemArray.Close();
|
|
141 |
|
|
142 |
iCurrentValSettingsItem.Close();
|
|
143 |
|
|
144 |
iPreCaptureItems.Close();
|
|
145 |
delete iToolTipText;
|
|
146 |
|
|
147 |
delete iOneClickUploadTooltip;
|
|
148 |
|
|
149 |
DestroyActivePalette();
|
|
150 |
PRINT( _L("Camera <= ~CCamActivePaletteHandler") );
|
|
151 |
}
|
|
152 |
|
|
153 |
// -----------------------------------------------------------------------------
|
|
154 |
// CCamActivePaletteHandler::ActivePalette()
|
|
155 |
// Return handle to Active Palette
|
|
156 |
// (other items were commented in a header).
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
//
|
|
159 |
MActivePalette2UI* CCamActivePaletteHandler::ActivePalette() const
|
|
160 |
{
|
|
161 |
return iActivePalette;
|
|
162 |
}
|
|
163 |
|
|
164 |
|
|
165 |
/*
|
|
166 |
* To check if a specific feature is supported, to append or show in AP
|
|
167 |
*/
|
|
168 |
TBool CCamActivePaletteHandler:: IsAPItemFeatureSupportedL( const TInt aItemId ) const
|
|
169 |
{
|
|
170 |
TBool featureSupported = ETrue; // by default we feature supported
|
|
171 |
CCameraUiConfigManager* configMgr = iController.UiConfigManagerPtr();
|
|
172 |
switch( aItemId )
|
|
173 |
{
|
|
174 |
case ECamSettingItemFaceTracking:
|
|
175 |
{
|
|
176 |
featureSupported = configMgr->IsFaceTrackingSupported();
|
|
177 |
break;
|
|
178 |
}
|
|
179 |
case ECamSettingItemGotoPhotos:
|
|
180 |
{
|
|
181 |
featureSupported = configMgr->IsPhotosSupported();
|
|
182 |
break;
|
|
183 |
}
|
|
184 |
case ECamSettingItemDynamicPhotoFlash:
|
|
185 |
{
|
|
186 |
featureSupported = configMgr->IsFlashModeSupported();
|
|
187 |
break;
|
|
188 |
}
|
|
189 |
case ECamSettingItemDynamicVideoFlash:
|
|
190 |
{
|
|
191 |
featureSupported = configMgr->IsVideoLightSupported();
|
|
192 |
break;
|
|
193 |
}
|
|
194 |
case ECamSettingItemDynamicPhotoColourFilter:
|
|
195 |
case ECamSettingItemDynamicVideoColourFilter:
|
|
196 |
{
|
|
197 |
featureSupported = configMgr->IsColorToneFeatureSupported();
|
|
198 |
break;
|
|
199 |
}
|
|
200 |
case ECamSettingItemDynamicPhotoWhiteBalance:
|
|
201 |
case ECamSettingItemDynamicVideoWhiteBalance:
|
|
202 |
{
|
|
203 |
featureSupported = configMgr->IsWhiteBalanceFeatureSupported();
|
|
204 |
break;
|
|
205 |
}
|
|
206 |
case ECamSettingItemDynamicPhotoLightSensitivity:
|
|
207 |
{
|
|
208 |
featureSupported = configMgr->IsISOSupported();
|
|
209 |
break;
|
|
210 |
}
|
|
211 |
case ECamSettingItemDynamicPhotoExposure:
|
|
212 |
{
|
|
213 |
featureSupported = configMgr->IsEVSupported();
|
|
214 |
break;
|
|
215 |
}
|
|
216 |
case ECamSettingItemDynamicPhotoImageSharpness:
|
|
217 |
{
|
|
218 |
featureSupported = configMgr->IsSharpnessFeatureSupported();
|
|
219 |
break;
|
|
220 |
}
|
|
221 |
case ECamSettingItemDynamicPhotoContrast:
|
|
222 |
case ECamSettingItemDynamicVideoContrast:
|
|
223 |
{
|
|
224 |
featureSupported = configMgr->IsContrastSupported();
|
|
225 |
break;
|
|
226 |
}
|
|
227 |
case ECamSettingItemDynamicPhotoBrightness:
|
|
228 |
case ECamSettingItemDynamicVideoBrightness:
|
|
229 |
{
|
|
230 |
featureSupported = configMgr->IsBrightnessSupported();
|
|
231 |
break;
|
|
232 |
}
|
|
233 |
default:
|
|
234 |
{
|
|
235 |
break;
|
|
236 |
}
|
|
237 |
}
|
|
238 |
return featureSupported;
|
|
239 |
}
|
|
240 |
|
|
241 |
// -----------------------------------------------------------------------------
|
|
242 |
// CCamActivePaletteHandler::InstallAPItemsL
|
|
243 |
// Install ap items from resource
|
|
244 |
// (other items were commented in a header).
|
|
245 |
// -----------------------------------------------------------------------------
|
|
246 |
//
|
|
247 |
void CCamActivePaletteHandler::InstallAPItemsL( TInt aResId )
|
|
248 |
{
|
|
249 |
PRINT( _L( "Camera => CCamActivePaletteHandler::InstallAPItemsL" ) );
|
|
250 |
|
|
251 |
if ( !iController.IsTouchScreenSupported() )
|
|
252 |
{
|
|
253 |
// Clear existing items first
|
|
254 |
iItemArray.Reset();
|
|
255 |
|
|
256 |
if ( iController.UiConfigManagerPtr() &&
|
|
257 |
iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() )
|
|
258 |
{
|
|
259 |
iCurrentValSettingsItem.Reset();
|
|
260 |
}
|
|
261 |
|
|
262 |
|
|
263 |
// Array for new toolbar items
|
|
264 |
RArray<TCamActivePaletteItem> newItems;
|
|
265 |
CleanupClosePushL( newItems );
|
|
266 |
|
|
267 |
// Static toolbar content - load items from resource
|
|
268 |
PRINT( _L( "Camera <> CCamActivePaletteHandler::InstallAPItemsL - Static toolbar items from resource" ) );
|
|
269 |
ReadToolbarItemsFromResourceL( aResId, newItems );
|
|
270 |
iDynamicToolbar = EFalse;
|
|
271 |
|
|
272 |
TInt nItems = newItems.Count();
|
|
273 |
|
|
274 |
for( TInt i=0; i<nItems; i++ )
|
|
275 |
{
|
|
276 |
TCamActivePaletteItem item = newItems[i];
|
|
277 |
TBool append ( ETrue );
|
|
278 |
if ( ECamActivePaletteItemTypePostCapture != item.iType )
|
|
279 |
{
|
|
280 |
append = IsAPItemFeatureSupportedL( item.iItemId );
|
|
281 |
}
|
|
282 |
else
|
|
283 |
{
|
|
284 |
// if postcapture items, then check if add to album and properties ae supported
|
|
285 |
if ( ECamCmdAddToAlbum == item.iCmdId ||
|
|
286 |
ECamCmdProperties == item.iCmdId ||
|
|
287 |
ECamCmdPhotos == item.iCmdId )
|
|
288 |
{
|
|
289 |
append = iController.UiConfigManagerPtr()->IsPhotosSupported();
|
|
290 |
}
|
|
291 |
else
|
|
292 |
{
|
|
293 |
}
|
|
294 |
}
|
|
295 |
|
|
296 |
if ( append )
|
|
297 |
{
|
|
298 |
iItemArray.AppendL( item );
|
|
299 |
}
|
|
300 |
}
|
|
301 |
|
|
302 |
TInt items = iItemArray.Count();
|
|
303 |
|
|
304 |
for( TInt i=0; i<items; i++ )
|
|
305 |
{
|
|
306 |
TCamAPSettingsItem settingItem;
|
|
307 |
settingItem.iSettingItem = iItemArray[i].iItemId;
|
|
308 |
|
|
309 |
TUid uid( TUid::Uid( KActivePalette2GenericPluginUID ) );
|
|
310 |
|
|
311 |
switch( iItemArray[i].iType )
|
|
312 |
{
|
|
313 |
case ECamActivePaletteItemTypeCommand:
|
|
314 |
{
|
|
315 |
PRINT( _L("Camera <> CCamActivePaletteHandler: case ECamActivePaletteItemTypeCommand") );
|
|
316 |
// Command id is used to identify the icon.
|
|
317 |
// Only one icon is used for command type items.
|
|
318 |
settingItem.iSettingVal = iItemArray[i].iCmdId;
|
|
319 |
iIconId = GetBitmapIdFromValueL( settingItem );
|
|
320 |
break;
|
|
321 |
}
|
|
322 |
case ECamActivePaletteItemTypePreCapture:
|
|
323 |
{
|
|
324 |
PRINT( _L("Camera <> CCamActivePaletteHandler: case ECamActivePaletteItemTypePreCapture") );
|
|
325 |
// Get initial value & associated icon
|
|
326 |
settingItem.iSettingVal = iController.IntegerSettingValue( iItemArray[i].iItemId );
|
|
327 |
iIconId = GetBitmapIdFromValueL( settingItem );
|
|
328 |
break;
|
|
329 |
}
|
|
330 |
case ECamActivePaletteItemTypePreCaptureNonSetting:
|
|
331 |
{
|
|
332 |
PRINT( _L("Camera <> CCamActivePaletteHandler: case ECamActivePaletteItemTypePreCaptureNonSetting") );
|
|
333 |
settingItem.iSettingVal = DetermineNonSettingState( iItemArray[i] );
|
|
334 |
iIconId = GetBitmapIdFromValueL( settingItem );
|
|
335 |
if ( iIconId != KErrNotFound )
|
|
336 |
{
|
|
337 |
SetNonSettingItemTooltipL( iItemArray[i] );
|
|
338 |
}
|
|
339 |
break;
|
|
340 |
}
|
|
341 |
case ECamActivePaletteItemTypePostCapture:
|
|
342 |
{
|
|
343 |
PRINT( _L("Camera <> CCamActivePaletteHandler: case ECamActivePaletteItemTypePostCapture") );
|
|
344 |
// Setting up the AP post-capture is simpler as the icons
|
|
345 |
// don't need to change depending on any settings.
|
|
346 |
LoadPostCaptureResourcesL( PostCaptureItemId( iItemArray[i].iCmdId ) );
|
|
347 |
break;
|
|
348 |
}
|
|
349 |
default:
|
|
350 |
{
|
|
351 |
PRINT( _L("Camera <> CCamActivePaletteHandler: default case => PANIC!!!") );
|
|
352 |
__ASSERT_DEBUG( EFalse, CamPanic( ECamPanicInvalidActivePaletteItemType ) );
|
|
353 |
break;
|
|
354 |
}
|
|
355 |
} // switch
|
|
356 |
|
|
357 |
PRINT( _L("Camera <> CCamActivePaletteHandler::InstallAPItemsL About to install item"));
|
|
358 |
|
|
359 |
// Override tooltip for one-click upload
|
|
360 |
if ( iOneClickUploadTooltip &&
|
|
361 |
iItemArray[i].iCmdId == ECamCmdOneClickUpload )
|
|
362 |
{
|
|
363 |
delete iToolTipText;
|
|
364 |
iToolTipText = NULL;
|
|
365 |
iToolTipText = iOneClickUploadTooltip->AllocL();
|
|
366 |
}
|
|
367 |
|
|
368 |
// cache the current values of the AP items so that we don't need to check later
|
|
369 |
// specifically for the items that there values are persisted
|
|
370 |
if ( iController.UiConfigManagerPtr() &&
|
|
371 |
iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() )
|
|
372 |
{
|
|
373 |
TCamAPSettingsItem tempSettingItem;
|
|
374 |
tempSettingItem.iSettingItem = iItemArray[i].iItemId;
|
|
375 |
// set initial value to some invalid number using -1
|
|
376 |
tempSettingItem.iSettingVal = -1;
|
|
377 |
iCurrentValSettingsItem.AppendL( tempSettingItem );
|
|
378 |
}
|
|
379 |
|
|
380 |
InstallOneAPItemL( iItemArray[i], uid, *iToolTipText, *iIconFileName, iIconId, iIconId );
|
|
381 |
|
|
382 |
PRINT( _L("Camera <> CCamActivePaletteHandler::InstallAPItemsL Item installed"));
|
|
383 |
} // for
|
|
384 |
|
|
385 |
if ( iController.UiConfigManagerPtr()->IsXenonFlashSupported() )
|
|
386 |
{
|
|
387 |
CheckFlashItemVisibilityL();
|
|
388 |
}
|
|
389 |
|
|
390 |
CleanupStack::PopAndDestroy(); // newItems
|
|
391 |
}
|
|
392 |
PRINT( _L( "Camera <= CCamActivePaletteHandler::InstallAPItemsL" ) );
|
|
393 |
}
|
|
394 |
|
|
395 |
|
|
396 |
|
|
397 |
|
|
398 |
// -----------------------------------------------------------------------------
|
|
399 |
// InstallOneAPItemL
|
|
400 |
//
|
|
401 |
// Helper method to install one AP item.
|
|
402 |
// -----------------------------------------------------------------------------
|
|
403 |
//
|
|
404 |
void
|
|
405 |
CCamActivePaletteHandler
|
|
406 |
::InstallOneAPItemL( const TCamActivePaletteItem& aItem,
|
|
407 |
const TUid& aPluginUid,
|
|
408 |
const TDesC& aToolTipText,
|
|
409 |
const TDesC& aIconFileName,
|
|
410 |
TInt aIconId,
|
|
411 |
TInt aMaskId )
|
|
412 |
{
|
|
413 |
// only add items that actually exist
|
|
414 |
if( iIconId != KErrNotFound )
|
|
415 |
{
|
|
416 |
TCamAPGenericPluginParams params(
|
|
417 |
TCamAPGenericPluginParams::EGenericCustomResFile,
|
|
418 |
aIconFileName,
|
|
419 |
aIconId,
|
|
420 |
aMaskId,
|
|
421 |
aToolTipText,
|
|
422 |
aItem.iCmdId, // message ID
|
|
423 |
0 ); // Custom param
|
|
424 |
TPckg<TCamAPGenericPluginParams> paramsPckg( params );
|
|
425 |
|
|
426 |
TActivePalette2ItemVisible itemVisible( aItem.iCmdId,aItem.iIsVisible );
|
|
427 |
iActivePalette->InstallItemL( itemVisible,
|
|
428 |
aPluginUid,
|
|
429 |
paramsPckg );
|
|
430 |
}
|
|
431 |
}
|
|
432 |
|
|
433 |
|
|
434 |
// -----------------------------------------------------------------------------
|
|
435 |
// CheckFlashItemVisibilityL
|
|
436 |
//
|
|
437 |
// Hide flash AP item if needed.
|
|
438 |
// -----------------------------------------------------------------------------
|
|
439 |
//
|
|
440 |
void CCamActivePaletteHandler::CheckFlashItemVisibilityL()
|
|
441 |
{
|
|
442 |
if ( !iController.IsTouchScreenSupported() &&
|
|
443 |
iController.UiConfigManagerPtr()->IsXenonFlashSupported() )
|
|
444 |
{
|
|
445 |
// Make flash item invisible, in case updating AP for burst mode
|
|
446 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
|
|
447 |
if( appUi && ECamImageCaptureBurst == appUi->CurrentBurstMode() ||
|
|
448 |
|
|
449 |
// ECamCaptureModeTimeLapse == appUi->CurrentBurstMode() ||
|
|
450 |
ECamSceneSports == iController.IntegerSettingValue( ECamSettingItemDynamicPhotoScene ) )
|
|
451 |
{
|
|
452 |
// Flash item is disabled in burst mode and for sport scene
|
|
453 |
iActivePalette->SetItemVisibility( ECamCmdCaptureSetupFlashStill, EFalse );
|
|
454 |
}
|
|
455 |
else
|
|
456 |
{
|
|
457 |
iActivePalette->SetItemVisibility( ECamCmdCaptureSetupFlashStill, ETrue );
|
|
458 |
}
|
|
459 |
}
|
|
460 |
}
|
|
461 |
|
|
462 |
|
|
463 |
// -----------------------------------------------------------------------------
|
|
464 |
// CCamActivePaletteHandler::ReturnedFromPretendExitL
|
|
465 |
// Resets current item position and updates the active palette.
|
|
466 |
// -----------------------------------------------------------------------------
|
|
467 |
//
|
|
468 |
void CCamActivePaletteHandler::ReturnedFromPretendExitL()
|
|
469 |
{
|
|
470 |
PRINT( _L("Camera => CCamActivePaletteHandler::ReturnedFromPretendExitL"));
|
|
471 |
if ( !iController.IsTouchScreenSupported() )
|
|
472 |
{
|
|
473 |
if ( iActivePalette )
|
|
474 |
{
|
|
475 |
ResetToDefaultItem();
|
|
476 |
}
|
|
477 |
|
|
478 |
UpdateActivePaletteL();
|
|
479 |
}
|
|
480 |
PRINT( _L("Camera <= CCamActivePaletteHandler::ReturnedFromPretendExitL"));
|
|
481 |
}
|
|
482 |
|
|
483 |
|
|
484 |
|
|
485 |
// -----------------------------------------------------------------------------
|
|
486 |
// CCamActivePaletteHandler::ResetToFirstItem
|
|
487 |
// Resets highlight to the first AP item
|
|
488 |
// -----------------------------------------------------------------------------
|
|
489 |
//
|
|
490 |
void CCamActivePaletteHandler::ResetToFirstItem()
|
|
491 |
{
|
|
492 |
PRINT( _L("Camera => CCamActivePaletteHandler::ResetToFirstItem"));
|
|
493 |
if ( !iController.IsTouchScreenSupported() )
|
|
494 |
{
|
|
495 |
if( iActivePalette && iItemArray.Count() > 0 )
|
|
496 |
{
|
|
497 |
iActivePalette->SetCurrentItem( iItemArray[0].iCmdId );
|
|
498 |
}
|
|
499 |
}
|
|
500 |
PRINT( _L("Camera <= CCamActivePaletteHandler::ResetToFirstItem"));
|
|
501 |
}
|
|
502 |
|
|
503 |
|
|
504 |
|
|
505 |
// -----------------------------------------------------------------------------
|
|
506 |
// CCamActivePaletteHandler::ResetToDefaultItem
|
|
507 |
// Resets highlight to the default AP item
|
|
508 |
// -----------------------------------------------------------------------------
|
|
509 |
//
|
|
510 |
void CCamActivePaletteHandler::ResetToDefaultItem()
|
|
511 |
{
|
|
512 |
PRINT( _L("Camera => CCamActivePaletteHandler::ResetToDefaultItem"));
|
|
513 |
if ( !iController.IsTouchScreenSupported() )
|
|
514 |
{
|
|
515 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
|
|
516 |
if( !appUi->IsEmbedded()
|
|
517 |
/*#ifndef __WINS__
|
|
518 |
|| appUi->IsInCallSend()
|
|
519 |
#endif*/
|
|
520 |
)
|
|
521 |
{
|
|
522 |
if( iActivePalette && iItemArray.Count() > 1 )
|
|
523 |
{
|
|
524 |
// In static toolbar, always reset to second item
|
|
525 |
// First item selected to adjust the visible items
|
|
526 |
iActivePalette->SetCurrentItem( iItemArray[0].iCmdId );
|
|
527 |
iActivePalette->SetCurrentItem( iItemArray[1].iCmdId );
|
|
528 |
}
|
|
529 |
}
|
|
530 |
else
|
|
531 |
{
|
|
532 |
ResetToFirstItem();
|
|
533 |
}
|
|
534 |
}
|
|
535 |
PRINT( _L("Camera <= CCamActivePaletteHandler::ResetToDefaultItem"));
|
|
536 |
}
|
|
537 |
|
|
538 |
|
|
539 |
|
|
540 |
// -----------------------------------------------------------------------------
|
|
541 |
// CCamActivePaletteHandler::UpdateActivePaletteL
|
|
542 |
// Force Active palette update
|
|
543 |
// (other items were commented in a header).
|
|
544 |
// -----------------------------------------------------------------------------
|
|
545 |
//
|
|
546 |
void CCamActivePaletteHandler::UpdateActivePaletteL()
|
|
547 |
{
|
|
548 |
PRINT( _L("Camera => CCamActivePaletteHandler::UpdateActivePaletteL"))
|
|
549 |
if ( !iController.IsTouchScreenSupported() )
|
|
550 |
{
|
|
551 |
TBool orientation = iController.UiConfigManagerPtr() &&
|
|
552 |
iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported();
|
|
553 |
if( iUpdatesDisabled )
|
|
554 |
{
|
|
555 |
PRINT( _L("Camera <= CCamActivePaletteHandler::UpdateActivePaletteL (updates disabled)"))
|
|
556 |
return;
|
|
557 |
}
|
|
558 |
|
|
559 |
if( !iActivePalette )
|
|
560 |
{
|
|
561 |
PRINT( _L("Camera <= CCamActivePaletteHandler::UpdateActivePaletteL no palette"))
|
|
562 |
return;
|
|
563 |
}
|
|
564 |
|
|
565 |
HBufC8* package = NULL;
|
|
566 |
TInt messageId = -1;
|
|
567 |
TInt count = iItemArray.Count();
|
|
568 |
for( TInt i = 0; i < count; i++ )
|
|
569 |
{
|
|
570 |
TCamAPSettingsItem settingItem;
|
|
571 |
|
|
572 |
TCamActivePaletteItem& item = iItemArray[i];
|
|
573 |
|
|
574 |
settingItem.iSettingItem = item.iItemId;
|
|
575 |
|
|
576 |
switch (item.iType)
|
|
577 |
{
|
|
578 |
case ECamActivePaletteItemTypeCommand:
|
|
579 |
{
|
|
580 |
// Tooltip or icon will now change for command type item
|
|
581 |
break;
|
|
582 |
}
|
|
583 |
case ECamActivePaletteItemTypePreCapture:
|
|
584 |
case ECamActivePaletteItemTypePostCapture:
|
|
585 |
{
|
|
586 |
if ( item.iItemId >= 0 )
|
|
587 |
{
|
|
588 |
// attempt to get actual setting value
|
|
589 |
// get handle to controller
|
|
590 |
settingItem.iSettingVal = iController.IntegerSettingValue( item.iItemId );
|
|
591 |
|
|
592 |
if( !orientation ||
|
|
593 |
( orientation &&
|
|
594 |
settingItem.iSettingVal != iCurrentValSettingsItem[i].iSettingVal ) )
|
|
595 |
{
|
|
596 |
TPckgBuf<TCamAPSettingsItem> buf( settingItem );
|
|
597 |
TInt iconId = GetBitmapIdFromValueL( settingItem );
|
|
598 |
|
|
599 |
if ( iconId != KErrNotFound )
|
|
600 |
{
|
|
601 |
TCamAPGenericPluginIcon icon( iconId, iconId );
|
|
602 |
TPckgC<TCamAPGenericPluginIcon> iconPckg( icon );
|
|
603 |
package = iconPckg.AllocLC();
|
|
604 |
messageId = EAPGenericPluginChangeIcon;
|
|
605 |
}
|
|
606 |
}
|
|
607 |
}
|
|
608 |
break;
|
|
609 |
}
|
|
610 |
case ECamActivePaletteItemTypePreCaptureNonSetting:
|
|
611 |
{
|
|
612 |
settingItem.iSettingVal = DetermineNonSettingState( item );
|
|
613 |
|
|
614 |
if( !orientation ||
|
|
615 |
( orientation &&
|
|
616 |
settingItem.iSettingVal != iCurrentValSettingsItem[i].iSettingVal ) )
|
|
617 |
{
|
|
618 |
iIconId = GetBitmapIdFromValueL( settingItem );
|
|
619 |
PRINT1( _L("Camera <> CCamActivePaletteHandler::UpdateActivePaletteL icon id %d"), iIconId);
|
|
620 |
if( iIconId != KErrNotFound )
|
|
621 |
{
|
|
622 |
SetNonSettingItemTooltipL( item );
|
|
623 |
TCamAPGenericPluginParams params (
|
|
624 |
TCamAPGenericPluginParams::EGenericCustomResFile,
|
|
625 |
*iIconFileName, // bitmap filename
|
|
626 |
iIconId, // icon
|
|
627 |
iIconId, // mask
|
|
628 |
*iToolTipText, // text
|
|
629 |
item.iCmdId, // message ID
|
|
630 |
0 ); // Custom param
|
|
631 |
TPckg<TCamAPGenericPluginParams> paramsPckg( params );
|
|
632 |
package = paramsPckg.AllocLC();
|
|
633 |
messageId = EAPGenericPluginChangeParams;
|
|
634 |
}
|
|
635 |
}
|
|
636 |
break;
|
|
637 |
}
|
|
638 |
default:
|
|
639 |
{
|
|
640 |
PRINT( _L("Camera <> CCamActivePaletteHandler::UpdateActivePaletteL: Unknown item, PANIC!!!") );
|
|
641 |
__ASSERT_DEBUG( EFalse, CamPanic( ECamPanicInvalidActivePaletteItemType ) );
|
|
642 |
}
|
|
643 |
} // switch
|
|
644 |
if ( package )
|
|
645 |
{
|
|
646 |
// if the value of the AP item has changed update the local settings value cache
|
|
647 |
if ( orientation )
|
|
648 |
{
|
|
649 |
iCurrentValSettingsItem[i].iSettingVal = settingItem.iSettingVal;
|
|
650 |
}
|
|
651 |
|
|
652 |
// Change item by sending message to the generic plugin
|
|
653 |
iActivePalette->SendMessage( item.iCmdId, messageId, *package) ;
|
|
654 |
CleanupStack::PopAndDestroy( package );
|
|
655 |
package = NULL;
|
|
656 |
}
|
|
657 |
} // for
|
|
658 |
|
|
659 |
if ( iController.UiConfigManagerPtr()->IsXenonFlashSupported() )
|
|
660 |
{
|
|
661 |
CheckFlashItemVisibilityL();
|
|
662 |
}
|
|
663 |
|
|
664 |
}
|
|
665 |
|
|
666 |
PRINT( _L("Camera <= CCamActivePaletteHandler::UpdateActivePaletteL"))
|
|
667 |
}
|
|
668 |
|
|
669 |
// -----------------------------------------------------------------------------
|
|
670 |
// CCamActivePaletteHandler::SetView
|
|
671 |
// Set current view
|
|
672 |
// (other items were commented in a header).
|
|
673 |
// -----------------------------------------------------------------------------
|
|
674 |
//
|
|
675 |
void CCamActivePaletteHandler::SetView( CCamViewBase* aView )
|
|
676 |
{
|
|
677 |
iView = aView;
|
|
678 |
}
|
|
679 |
|
|
680 |
// -----------------------------------------------------------------------------
|
|
681 |
// CCamActivePaletteHandler::SetVisibility
|
|
682 |
// Set Active palette visiblity
|
|
683 |
// (other items were commented in a header).
|
|
684 |
// -----------------------------------------------------------------------------
|
|
685 |
//
|
|
686 |
void CCamActivePaletteHandler::SetVisibility( TBool aVisibility )
|
|
687 |
{
|
|
688 |
PRINT2(_L("Camera => CCamActivePaletteHandler::SetVisibility from %d to %d"), iVisible, aVisibility)
|
|
689 |
|
|
690 |
if ( !iController.IsTouchScreenSupported() )
|
|
691 |
{
|
|
692 |
// Only animate if we're moving to a different state
|
|
693 |
if ( iVisible != aVisibility && iActivePalette )
|
|
694 |
{
|
|
695 |
iVisible = aVisibility;
|
|
696 |
if ( ECamCapturing == iController.CurrentOperation() ||
|
|
697 |
(!iStarted &&
|
|
698 |
!iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported() ) ||
|
|
699 |
!aVisibility )
|
|
700 |
{
|
|
701 |
iActivePalette->SetPaletteVisibility(iVisible, EFalse);
|
|
702 |
iStarted = ETrue;
|
|
703 |
PRINT(_L("AP NO animation"));
|
|
704 |
}
|
|
705 |
else
|
|
706 |
{
|
|
707 |
iActivePalette->SetPaletteVisibility(iVisible,ETrue,100);
|
|
708 |
PRINT(_L("AP animation"));
|
|
709 |
}
|
|
710 |
|
|
711 |
PERF_MESSAGE_L2( EPerfMessageActivePaletteAnimationStarting );
|
|
712 |
PRINT(_L("AP animation started"));
|
|
713 |
}
|
|
714 |
|
|
715 |
if ( iController.IsTouchScreenSupported() )
|
|
716 |
{
|
|
717 |
if ( iActivePalette )
|
|
718 |
{
|
|
719 |
iActivePalette->SetPaletteVisibility( EFalse, EFalse );
|
|
720 |
}
|
|
721 |
}
|
|
722 |
}
|
|
723 |
|
|
724 |
PRINT(_L("Camera <= CCamActivePaletteHandler::SetVisibility"))
|
|
725 |
}
|
|
726 |
|
|
727 |
// -----------------------------------------------------------------------------
|
|
728 |
// CCamActivePaletteHandler::IsVisible
|
|
729 |
// Return Active palette visiblity
|
|
730 |
// (other items were commented in a header).
|
|
731 |
// -----------------------------------------------------------------------------
|
|
732 |
//
|
|
733 |
TBool CCamActivePaletteHandler::IsVisible() const
|
|
734 |
{
|
|
735 |
return iVisible;
|
|
736 |
}
|
|
737 |
|
|
738 |
// -----------------------------------------------------------------------------
|
|
739 |
// CCamActivePaletteHandler::SetVisibility
|
|
740 |
// Whether AP has requested item
|
|
741 |
// (other items were commented in a header).
|
|
742 |
// -----------------------------------------------------------------------------
|
|
743 |
//
|
|
744 |
TBool CCamActivePaletteHandler::AccessedViaAP() const
|
|
745 |
{
|
|
746 |
return iItemAccessedViaAP;
|
|
747 |
}
|
|
748 |
|
|
749 |
// -----------------------------------------------------------------------------
|
|
750 |
// CCamActivePaletteHandler::APOperationComplete
|
|
751 |
// Inform AP handler AP launched item has completed
|
|
752 |
// (other items were commented in a header).
|
|
753 |
// -----------------------------------------------------------------------------
|
|
754 |
//
|
|
755 |
void CCamActivePaletteHandler::APOperationComplete()
|
|
756 |
{
|
|
757 |
iItemAccessedViaAP = EFalse;
|
|
758 |
}
|
|
759 |
|
|
760 |
// -----------------------------------------------------------------------------
|
|
761 |
// CCamActivePaletteHandler::HandleAPKeyEventL
|
|
762 |
// Pass keys events to Active Palette
|
|
763 |
// (other items were commented in a header).
|
|
764 |
// -----------------------------------------------------------------------------
|
|
765 |
//
|
|
766 |
void
|
|
767 |
CCamActivePaletteHandler::HandleAPKeyEventL( const TKeyEvent& /* aKeyEvent */,
|
|
768 |
TEventCode /* aType */ )
|
|
769 |
{
|
|
770 |
}
|
|
771 |
|
|
772 |
// -----------------------------------------------------------------------------
|
|
773 |
// CCamActivePaletteHandler::CreateActivePaletteL
|
|
774 |
// Create the Active Palette
|
|
775 |
// (other items were commented in a header).
|
|
776 |
// -----------------------------------------------------------------------------
|
|
777 |
//
|
|
778 |
|
|
779 |
void
|
|
780 |
CCamActivePaletteHandler::CreateActivePaletteL(const CCoeControl &aContainerWindow,
|
|
781 |
MObjectProvider *aMopParent)
|
|
782 |
{
|
|
783 |
OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMACTIVEPALETTEHANDLER_CREATEACTIVEPALETTEL, "e_CCamActivePaletteHandler_CreateActivePaletteL 1" );
|
|
784 |
PRINT(_L("Camera => CCamActivePaletteHandler::CreateActivePaletteL"))
|
|
785 |
PERF_EVENT_START_L2( EPerfEventActivePaletteConstruction );
|
|
786 |
|
|
787 |
if ( !iController.IsTouchScreenSupported() )
|
|
788 |
{
|
|
789 |
if(!iActivePalette)
|
|
790 |
{
|
|
791 |
// Variate this according to usage of Direct Screen viewfinder
|
|
792 |
if ( iController.IsDirectScreenVFSupported() )
|
|
793 |
{
|
|
794 |
iActivePalette = ActivePalette2Factory::CreateActivePaletteUIL(EAP2DrawModeCheckerboard);
|
|
795 |
}
|
|
796 |
else
|
|
797 |
{
|
|
798 |
iActivePalette = ActivePalette2Factory::CreateActivePaletteUIL(KActivePaletteDrawMode);
|
|
799 |
}
|
|
800 |
iActivePalette->SetObserver(this);
|
|
801 |
}
|
|
802 |
else
|
|
803 |
{
|
|
804 |
ClearActivePalette();
|
|
805 |
}
|
|
806 |
iActivePalette->CoeControl()->SetContainerWindowL( aContainerWindow );
|
|
807 |
iActivePalette->CoeControl()->SetMopParent( aMopParent );
|
|
808 |
iActivePalette->LocateTo(APScreenLocation( TPoint(280, 30) ));
|
|
809 |
iActivePalette->SetPaletteVisibility(EFalse,EFalse);
|
|
810 |
iVisible=EFalse;
|
|
811 |
}
|
|
812 |
|
|
813 |
PERF_EVENT_END_L2( EPerfEventActivePaletteConstruction );
|
|
814 |
PRINT(_L("Camera <= CCamActivePaletteHandler::CreateActivePaletteL"))
|
|
815 |
OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP1_CCAMACTIVEPALETTEHANDLER_CREATEACTIVEPALETTEL, "e_CCamActivePaletteHandler_CreateActivePaletteL 0" );
|
|
816 |
}
|
|
817 |
|
|
818 |
// -----------------------------------------------------------------------------
|
|
819 |
// CCamActivePaletteHandler::DestroyActivePalette
|
|
820 |
// Deletes the Active Palette
|
|
821 |
// -----------------------------------------------------------------------------
|
|
822 |
//
|
|
823 |
void CCamActivePaletteHandler::DestroyActivePalette()
|
|
824 |
{
|
|
825 |
if ( !iController.IsTouchScreenSupported() )
|
|
826 |
{
|
|
827 |
delete iActivePalette;
|
|
828 |
iActivePalette = NULL;
|
|
829 |
}
|
|
830 |
}
|
|
831 |
|
|
832 |
//
|
|
833 |
// -----------------------------------------------------------------------------
|
|
834 |
// CCamActivePaletteHandler::NotifyItemFocused
|
|
835 |
// Handle a change of item focus in the active palette
|
|
836 |
// (other items were commented in a header)
|
|
837 |
// -----------------------------------------------------------------------------
|
|
838 |
//
|
|
839 |
void CCamActivePaletteHandler::NotifyItemFocused(TInt /*aPrevItem*/, TInt /*aFocusedItem*/)
|
|
840 |
{
|
|
841 |
// We don't care about changes in item focus.
|
|
842 |
}
|
|
843 |
|
|
844 |
|
|
845 |
//
|
|
846 |
//
|
|
847 |
// -----------------------------------------------------------------------------
|
|
848 |
// CCamActivePaletteHandler::NotifyItemSelected
|
|
849 |
// Pass keys events to Active Palette
|
|
850 |
// (other items were commented in a header).
|
|
851 |
// -----------------------------------------------------------------------------
|
|
852 |
//
|
|
853 |
void CCamActivePaletteHandler::NotifyItemSelected(const TActivePalette2EventData & aEvent)
|
|
854 |
{
|
|
855 |
PRINT1( _L("Camera => CCamActivePaletteHandler::NotifyItemSelected item (%d)"), aEvent.CurItem() );
|
|
856 |
|
|
857 |
if ( !iController.IsTouchScreenSupported() )
|
|
858 |
{
|
|
859 |
if( iView && iVisible )
|
|
860 |
{
|
|
861 |
TRAPD(ignore, iView->HandleCommandL( aEvent.CurItem()) );
|
|
862 |
|
|
863 |
// Handling a command implies a container switch, so we need to switch the activepalette back
|
|
864 |
// to the system Gc.
|
|
865 |
iActivePalette->SetGc();
|
|
866 |
|
|
867 |
// Error -14 (KErrInUse) must be handled here or it's ignored and there's no error note
|
|
868 |
if( ignore == KErrInUse )
|
|
869 |
{
|
|
870 |
PRINT( _L( "Camera <> CCamActivePaletteHandler::NotifyItemSelected KErrInUse" ) );
|
|
871 |
|
|
872 |
// Get the application caption (name)
|
|
873 |
RApaLsSession ls;
|
|
874 |
TApaAppInfo appInfo;
|
|
875 |
TRAPD(err1, ls.Connect() );
|
|
876 |
if( err1 != KErrNone)
|
|
877 |
{
|
|
878 |
ls.Close();
|
|
879 |
return;
|
|
880 |
}
|
|
881 |
TRAPD(err2, ls.GetAppInfo(appInfo, TUid::Uid(KCameraappUID)) );
|
|
882 |
if( err2 != KErrNone)
|
|
883 |
{
|
|
884 |
ls.Close();
|
|
885 |
return;
|
|
886 |
}
|
|
887 |
TApaAppCaption appCaption = appInfo.iCaption;
|
|
888 |
ls.Close();
|
|
889 |
|
|
890 |
// Get the correct error description
|
|
891 |
CTextResolver* iTextResolver = NULL;
|
|
892 |
|
|
893 |
TRAPD(err3, iTextResolver = CTextResolver::NewL());
|
|
894 |
if( err3 != KErrNone)
|
|
895 |
{
|
|
896 |
return;
|
|
897 |
}
|
|
898 |
TPtrC buf;
|
|
899 |
buf.Set( iTextResolver->ResolveErrorString( ignore, CTextResolver::ECtxNoCtxNoSeparator ) );
|
|
900 |
delete iTextResolver;
|
|
901 |
iTextResolver = NULL;
|
|
902 |
|
|
903 |
// Compose the full error message
|
|
904 |
TBuf<100> fullnote;
|
|
905 |
fullnote.Append(appCaption);
|
|
906 |
fullnote.Append(':');
|
|
907 |
fullnote.Append('\n');
|
|
908 |
fullnote.Append(buf);
|
|
909 |
|
|
910 |
// Display the error note
|
|
911 |
CAknErrorNote* dlg = new CAknErrorNote( ETrue );
|
|
912 |
if(dlg==NULL)
|
|
913 |
{
|
|
914 |
return;
|
|
915 |
}
|
|
916 |
TRAPD(err4, dlg->ExecuteLD( fullnote ));
|
|
917 |
if( err4 != KErrNone)
|
|
918 |
{
|
|
919 |
return;
|
|
920 |
}
|
|
921 |
}
|
|
922 |
iItemAccessedViaAP = ETrue;
|
|
923 |
}
|
|
924 |
}
|
|
925 |
PRINT( _L("Camera <= CCamActivePaletteHandler::NotifyItemSelected") );
|
|
926 |
}
|
|
927 |
|
|
928 |
// -----------------------------------------------------------------------------
|
|
929 |
// CCamActivePaletteHandler::NotifyItemComplete
|
|
930 |
//
|
|
931 |
// (other items were commented in a header).
|
|
932 |
// -----------------------------------------------------------------------------
|
|
933 |
//
|
|
934 |
void CCamActivePaletteHandler::NotifyItemComplete(const TActivePalette2EventData& /*aEvent*/,
|
|
935 |
const TDesC8& /*aDataDes*/,
|
|
936 |
TInt /*aDataInt*/)
|
|
937 |
{
|
|
938 |
}
|
|
939 |
|
|
940 |
// -----------------------------------------------------------------------------
|
|
941 |
// CCamActivePaletteHandler::NotifyMessage
|
|
942 |
//
|
|
943 |
// (other items were commented in a header).
|
|
944 |
// -----------------------------------------------------------------------------
|
|
945 |
//
|
|
946 |
void
|
|
947 |
CCamActivePaletteHandler::NotifyMessage(
|
|
948 |
const TActivePalette2EventData& /*aEvent*/,
|
|
949 |
TInt /*aMessageID*/,
|
|
950 |
const TDesC8& /*aDataDes*/,
|
|
951 |
TInt /*aDataInt*/ )
|
|
952 |
{
|
|
953 |
}
|
|
954 |
|
|
955 |
// -----------------------------------------------------------------------------
|
|
956 |
// CCamActivePaletteHandler::Redraw
|
|
957 |
//
|
|
958 |
// (other items were commented in a header)
|
|
959 |
// -----------------------------------------------------------------------------
|
|
960 |
void CCamActivePaletteHandler::Redraw(const TRect& aArea)
|
|
961 |
{
|
|
962 |
if ( iView )
|
|
963 |
{
|
|
964 |
iView->RedrawAPArea( aArea );
|
|
965 |
}
|
|
966 |
}
|
|
967 |
|
|
968 |
// -----------------------------------------------------------------------------
|
|
969 |
// CCamActivePaletteHandler::ActivePaletteUpdated
|
|
970 |
//
|
|
971 |
// (other items were commented in a header)
|
|
972 |
// -----------------------------------------------------------------------------
|
|
973 |
void CCamActivePaletteHandler::ActivePaletteUpdated()
|
|
974 |
{
|
|
975 |
}
|
|
976 |
|
|
977 |
// -----------------------------------------------------------------------------
|
|
978 |
// CCamActivePaletteHandler::LoadPostCaptureResourcesL
|
|
979 |
// Load resource for post-capture item
|
|
980 |
// -----------------------------------------------------------------------------
|
|
981 |
//
|
|
982 |
void CCamActivePaletteHandler::LoadPostCaptureResourcesL( TInt aResourceId )
|
|
983 |
{
|
|
984 |
if ( !iController.IsTouchScreenSupported() )
|
|
985 |
{
|
|
986 |
TResourceReader reader;
|
|
987 |
iEnv->CreateResourceReaderLC(reader, aResourceId);
|
|
988 |
|
|
989 |
// Store tooltip text and icon ID in member variables
|
|
990 |
TPtrC ptr = reader.ReadTPtrC();
|
|
991 |
delete iToolTipText;
|
|
992 |
iToolTipText = NULL;
|
|
993 |
iToolTipText = ptr.AllocL();
|
|
994 |
|
|
995 |
iIconId = reader.ReadInt16();
|
|
996 |
|
|
997 |
CleanupStack::PopAndDestroy(); // reader
|
|
998 |
}
|
|
999 |
}
|
|
1000 |
|
|
1001 |
// -----------------------------------------------------------------------------
|
|
1002 |
// CCamActivePaletteHandler::PreCaptureArrayId
|
|
1003 |
// Map settings item to CAM_CAPTURE_SETUP_MENU_ITEM_ARRAY type resource id
|
|
1004 |
// -----------------------------------------------------------------------------
|
|
1005 |
//
|
|
1006 |
TInt CCamActivePaletteHandler::PreCaptureArrayId( TInt aSettingItem )
|
|
1007 |
{
|
|
1008 |
PRINT( _L("Camera => CCamActivePaletteHandler::PreCaptureArrayId") );
|
|
1009 |
TBool extLightSensitivitySupported = EFalse;
|
|
1010 |
TInt resId = KErrNotFound;
|
|
1011 |
if ( !iController.IsTouchScreenSupported() )
|
|
1012 |
{
|
|
1013 |
switch( aSettingItem )
|
|
1014 |
{
|
|
1015 |
// -----------------------------------------------------
|
|
1016 |
case ECamSettingItemDynamicVideoScene:
|
|
1017 |
resId = R_CAM_CAPTURE_SETUP_MENU_VIDEO_SCENE_ARRAY;
|
|
1018 |
break;
|
|
1019 |
// -----------------------------------------------------
|
|
1020 |
case ECamSettingItemDynamicVideoWhiteBalance:
|
|
1021 |
resId = R_CAM_CAPTURE_SETUP_MENU_VIDEO_WHITE_BALANCE_ARRAY;
|
|
1022 |
break;
|
|
1023 |
// -----------------------------------------------------
|
|
1024 |
case ECamSettingItemDynamicVideoExposure:
|
|
1025 |
break;
|
|
1026 |
// -----------------------------------------------------
|
|
1027 |
// Replaced by ECamSettingItemDynamicVideoLightSensitivity
|
|
1028 |
// case ECamSettingItemDynamicVideoISO:
|
|
1029 |
// break;
|
|
1030 |
// -----------------------------------------------------
|
|
1031 |
case ECamSettingItemDynamicVideoColourFilter:
|
|
1032 |
resId = R_CAM_CAPTURE_SETUP_MENU_VIDEO_COLOURFILTER_ARRAY;
|
|
1033 |
break;
|
|
1034 |
// -----------------------------------------------------
|
|
1035 |
case ECamSettingItemDynamicVideoBrightness:
|
|
1036 |
break;
|
|
1037 |
// -----------------------------------------------------
|
|
1038 |
case ECamSettingItemDynamicVideoContrast:
|
|
1039 |
break;
|
|
1040 |
// -----------------------------------------------------
|
|
1041 |
case ECamSettingItemDynamicVideoColourSaturation:
|
|
1042 |
break;
|
|
1043 |
// -----------------------------------------------------
|
|
1044 |
case ECamSettingItemDynamicPhotoScene:
|
|
1045 |
resId = R_CAM_CAPTURE_SETUP_MENU_PHOTO_SCENE_ARRAY;
|
|
1046 |
break;
|
|
1047 |
// -----------------------------------------------------
|
|
1048 |
case ECamSettingItemDynamicPhotoWhiteBalance:
|
|
1049 |
resId = R_CAM_CAPTURE_SETUP_MENU_PHOTO_WHITE_BALANCE_ARRAY;
|
|
1050 |
break;
|
|
1051 |
// -----------------------------------------------------
|
|
1052 |
case ECamSettingItemDynamicPhotoExposure:
|
|
1053 |
resId = iEvCompRes;
|
|
1054 |
break;
|
|
1055 |
// -----------------------------------------------------
|
|
1056 |
// Replaced by ECamSettingItemDynamicPhotoLightSensitivity
|
|
1057 |
// case ECamSettingItemDynamicPhotoISO:
|
|
1058 |
// break;
|
|
1059 |
// -----------------------------------------------------
|
|
1060 |
case ECamSettingItemDynamicPhotoColourFilter:
|
|
1061 |
resId = R_CAM_CAPTURE_SETUP_MENU_PHOTO_COLOURFILTER_ARRAY;
|
|
1062 |
break;
|
|
1063 |
// -----------------------------------------------------
|
|
1064 |
case ECamSettingItemDynamicPhotoFlash:
|
|
1065 |
resId = R_CAM_CAPTURE_SETUP_MENU_PHOTO_FLASH_ARRAY;
|
|
1066 |
break;
|
|
1067 |
// -----------------------------------------------------
|
|
1068 |
case ECamSettingItemDynamicVideoFlash:
|
|
1069 |
resId = R_CAM_CAPTURE_SETUP_MENU_VIDEO_FLASH_ARRAY;
|
|
1070 |
break;
|
|
1071 |
// -----------------------------------------------------
|
|
1072 |
case ECamSettingItemDynamicPhotoBrightness:
|
|
1073 |
resId = R_CAM_CAPTURE_SETUP_MENU_PHOTO_BRIGHTNESS_ARRAY;
|
|
1074 |
break;
|
|
1075 |
// -----------------------------------------------------
|
|
1076 |
case ECamSettingItemDynamicPhotoContrast:
|
|
1077 |
resId = R_CAM_CAPTURE_SETUP_MENU_PHOTO_CONTRAST_ARRAY;
|
|
1078 |
break;
|
|
1079 |
// -----------------------------------------------------
|
|
1080 |
case ECamSettingItemDynamicPhotoImageSharpness:
|
|
1081 |
resId = R_CAM_CAPTURE_SETUP_MENU_PHOTO_IMAGESHARPNESS_ARRAY;
|
|
1082 |
break;
|
|
1083 |
// -----------------------------------------------------
|
|
1084 |
case ECamSettingItemDynamicPhotoColourSaturation:
|
|
1085 |
break;
|
|
1086 |
// -----------------------------------------------------
|
|
1087 |
case ECamSettingItemFaceTracking:
|
|
1088 |
resId = R_CAM_ACTIVE_PALETTE_PRECAPTURE_FACETRACKING_ARRAY;
|
|
1089 |
break;
|
|
1090 |
// -----------------------------------------------------
|
|
1091 |
case ECamSettingItemSequenceMode:
|
|
1092 |
resId = R_CAM_ACTIVE_PALETTE_PRECAPTURE_SEQUENCE_MODE_ARRAY;
|
|
1093 |
break;
|
|
1094 |
// -----------------------------------------------------
|
|
1095 |
case ECamSettingItemVideoModeSelect:
|
|
1096 |
resId = R_CAM_ACTIVE_PALETTE_PRECAPTURE_VIDEO_MODE_SELECT;
|
|
1097 |
break;
|
|
1098 |
// -----------------------------------------------------
|
|
1099 |
case ECamSettingItemImageModeSelect:
|
|
1100 |
resId = R_CAM_ACTIVE_PALETTE_PRECAPTURE_IMAGE_MODE_SELECT;
|
|
1101 |
break;
|
|
1102 |
case ECamSettingItemSwitchCamera:
|
|
1103 |
resId = R_CAM_ACTIVE_PALETTE_PRECAPTURE_SWITCH_CAMERA;
|
|
1104 |
break;
|
|
1105 |
// -----------------------------------------------------
|
|
1106 |
case ECamSettingItemDynamicSelfTimer:
|
|
1107 |
resId = R_CAM_ACTIVE_PALETTE_SELF_TIMER_SELECT;
|
|
1108 |
break;
|
|
1109 |
// -----------------------------------------------------
|
|
1110 |
case ECamSettingItemDynamicPhotoLightSensitivity:
|
|
1111 |
case ECamSettingItemDynamicVideoLightSensitivity:
|
|
1112 |
extLightSensitivitySupported =
|
|
1113 |
iController.UiConfigManagerPtr()->IsExtendedLightSensitivitySupported();
|
|
1114 |
if ( extLightSensitivitySupported )
|
|
1115 |
{
|
|
1116 |
resId = R_CAM_ACTIVE_PALETTE_EXTENDED_LIGHT_SENSITIVITY_SELECT;
|
|
1117 |
}
|
|
1118 |
else
|
|
1119 |
{
|
|
1120 |
resId = R_CAM_ACTIVE_PALETTE_LIGHT_SENSITIVITY_SELECT;
|
|
1121 |
}
|
|
1122 |
break;
|
|
1123 |
// -----------------------------------------------------
|
|
1124 |
case ECamSettingItemViewfinderGrid:
|
|
1125 |
resId = R_CAM_ACTIVE_PALETTE_VF_GRID_SET_ARRAY;
|
|
1126 |
break;
|
|
1127 |
// -----------------------------------------------------
|
|
1128 |
case ECamSettingItemGotoPhotos:
|
|
1129 |
resId = R_CAM_ACTIVE_PALETTE_GOTO_PHOTOS_SET_ARRAY;
|
|
1130 |
break;
|
|
1131 |
// -----------------------------------------------------
|
|
1132 |
default:
|
|
1133 |
break;
|
|
1134 |
// -----------------------------------------------------
|
|
1135 |
} // switch
|
|
1136 |
}
|
|
1137 |
|
|
1138 |
PRINT1( _L("Camera <= CCamActivePaletteHandler::PreCaptureArrayId, return:%d" ), resId )
|
|
1139 |
return resId;
|
|
1140 |
}
|
|
1141 |
|
|
1142 |
// -----------------------------------------------------------------------------
|
|
1143 |
// CCamActivePaletteHandler::GetBitmapIdFromValueL
|
|
1144 |
// Find bitmap id for specific settings value
|
|
1145 |
// -----------------------------------------------------------------------------
|
|
1146 |
//
|
|
1147 |
TInt CCamActivePaletteHandler::GetBitmapIdFromValueL( TCamAPSettingsItem& aItem )
|
|
1148 |
{
|
|
1149 |
PRINT( _L("Camera => CCamActivePaletteHandler::GetBitmapIdFromValueL") );
|
|
1150 |
|
|
1151 |
if ( !iController.IsTouchScreenSupported() )
|
|
1152 |
{
|
|
1153 |
TInt arrayId = PreCaptureArrayId( aItem.iSettingItem );
|
|
1154 |
|
|
1155 |
if ( arrayId == KErrNotFound )
|
|
1156 |
{
|
|
1157 |
return KErrNotFound;
|
|
1158 |
}
|
|
1159 |
|
|
1160 |
TInt bitmapId = KErrNotFound;
|
|
1161 |
|
|
1162 |
PRINT( _L("Camera <> CCamActivePaletteHandler: Looking for tooltip...") );
|
|
1163 |
|
|
1164 |
TResourceReader reader;
|
|
1165 |
iEnv->CreateResourceReaderLC( reader, arrayId );
|
|
1166 |
|
|
1167 |
// Settings model ID
|
|
1168 |
reader.ReadInt16();
|
|
1169 |
|
|
1170 |
// Tooltip text
|
|
1171 |
TPtrC ptr = reader.ReadTPtrC();
|
|
1172 |
|
|
1173 |
delete iToolTipText;
|
|
1174 |
iToolTipText = NULL;
|
|
1175 |
iToolTipText = ptr.AllocL();
|
|
1176 |
|
|
1177 |
TInt tmpVal = aItem.iSettingVal;
|
|
1178 |
|
|
1179 |
if ( iController.UiConfigManagerPtr()->IsContrastSupported() )
|
|
1180 |
{
|
|
1181 |
// For contrast setting map the value to bitmap value
|
|
1182 |
if ( aItem.iSettingItem == ECamSettingItemDynamicPhotoContrast ||
|
|
1183 |
aItem.iSettingItem == ECamSettingItemDynamicVideoContrast )
|
|
1184 |
{
|
|
1185 |
if ( tmpVal > 0 )
|
|
1186 |
{
|
|
1187 |
tmpVal = ECamContrastPlus;
|
|
1188 |
}
|
|
1189 |
else if ( tmpVal < 0 )
|
|
1190 |
{
|
|
1191 |
tmpVal = ECamContrastNeg;
|
|
1192 |
}
|
|
1193 |
else
|
|
1194 |
{
|
|
1195 |
tmpVal = ECamContrastNorm;
|
|
1196 |
}
|
|
1197 |
}
|
|
1198 |
}
|
|
1199 |
|
|
1200 |
if ( iController.UiConfigManagerPtr()->IsBrightnessSupported() )
|
|
1201 |
{
|
|
1202 |
// For brightness setting map the value to bitmap value
|
|
1203 |
if ( aItem.iSettingItem == ECamSettingItemDynamicPhotoBrightness ||
|
|
1204 |
aItem.iSettingItem == ECamSettingItemDynamicVideoBrightness )
|
|
1205 |
{
|
|
1206 |
if ( tmpVal > 0 )
|
|
1207 |
{
|
|
1208 |
tmpVal = ECamBrightnessPlus;
|
|
1209 |
}
|
|
1210 |
else if ( tmpVal < 0 )
|
|
1211 |
{
|
|
1212 |
tmpVal = ECamBrightnessNeg;
|
|
1213 |
}
|
|
1214 |
else
|
|
1215 |
{
|
|
1216 |
tmpVal = ECamBrightnessNorm;
|
|
1217 |
}
|
|
1218 |
}
|
|
1219 |
}
|
|
1220 |
|
|
1221 |
PRINT( _L("Camera <> CCamActivePaletteHandler: Looking for bitmap...") );
|
|
1222 |
const TInt count = reader.ReadInt16();
|
|
1223 |
|
|
1224 |
for( TInt i = 0; i < count; i++ )
|
|
1225 |
{
|
|
1226 |
if (reader.ReadInt16() == tmpVal )
|
|
1227 |
{
|
|
1228 |
bitmapId = reader.ReadInt16();
|
|
1229 |
break;
|
|
1230 |
}
|
|
1231 |
|
|
1232 |
// Skip these values if this isn't the one we're interested in.
|
|
1233 |
reader.ReadInt16(); // Bitmap ID
|
|
1234 |
reader.ReadTPtrC(); // Icon text
|
|
1235 |
}
|
|
1236 |
|
|
1237 |
CleanupStack::PopAndDestroy(); // reader
|
|
1238 |
|
|
1239 |
PRINT1( _L("Camera <= CCamActivePaletteHandler::GetBitmapIdFromValueL, return id:%d"), bitmapId );
|
|
1240 |
return bitmapId;
|
|
1241 |
}
|
|
1242 |
else
|
|
1243 |
{
|
|
1244 |
return KErrNotFound;
|
|
1245 |
}
|
|
1246 |
}
|
|
1247 |
|
|
1248 |
// -----------------------------------------------------------------------------
|
|
1249 |
// CCamActivePaletteHandler::PostCaptureItemId
|
|
1250 |
// Find resource ID for post capture item from command ID
|
|
1251 |
// -----------------------------------------------------------------------------
|
|
1252 |
//
|
|
1253 |
TInt CCamActivePaletteHandler::PostCaptureItemId( TInt aCommandId )
|
|
1254 |
{
|
|
1255 |
PRINT( _L("Camera => CCamActivePaletteHandler::PostCaptureItemId") );
|
|
1256 |
TInt resId = KErrNotFound;
|
|
1257 |
|
|
1258 |
if ( !iController.IsTouchScreenSupported() )
|
|
1259 |
{
|
|
1260 |
switch( aCommandId )
|
|
1261 |
{
|
|
1262 |
case ECamCmdPhotos:
|
|
1263 |
resId = R_CAM_AP_PHOTOS;
|
|
1264 |
break;
|
|
1265 |
case ECamCmdDelete:
|
|
1266 |
resId = R_CAM_AP_DELETE;
|
|
1267 |
break;
|
|
1268 |
case ECamCmdPlay:
|
|
1269 |
resId = R_CAM_AP_PLAY;
|
|
1270 |
break;
|
|
1271 |
case ECamCmdSend:
|
|
1272 |
resId = R_CAM_AP_SEND;
|
|
1273 |
break;
|
|
1274 |
case ECamCmdSendToCallerMultimedia:
|
|
1275 |
resId = R_CAM_AP_SEND_MULTIMEDIA;
|
|
1276 |
break;
|
|
1277 |
case ECamCmdOneClickUpload:
|
|
1278 |
resId = R_CAM_AP_ONE_CLICK_UPLOAD;
|
|
1279 |
break;
|
|
1280 |
case ECamCmdAddToAlbum:
|
|
1281 |
resId = R_CAM_AP_ADD_TO_ALBUM;
|
|
1282 |
break;
|
|
1283 |
case ECamCmdProperties:
|
|
1284 |
resId = R_CAM_AP_PROPERTIES;
|
|
1285 |
break;
|
|
1286 |
default:
|
|
1287 |
break;
|
|
1288 |
}
|
|
1289 |
}
|
|
1290 |
PRINT( _L("Camera <= CCamActivePaletteHandler::PostCaptureItemId") );
|
|
1291 |
return resId;
|
|
1292 |
}
|
|
1293 |
|
|
1294 |
// -----------------------------------------------------------------------------
|
|
1295 |
// CCamActivePaletteHandler::DetermineNonSettingState
|
|
1296 |
// Current state of a Non-Setting Item
|
|
1297 |
// -----------------------------------------------------------------------------
|
|
1298 |
//
|
|
1299 |
TInt
|
|
1300 |
CCamActivePaletteHandler
|
|
1301 |
::DetermineNonSettingState( const TCamActivePaletteItem& aItem ) const
|
|
1302 |
{
|
|
1303 |
__ASSERT_DEBUG( aItem.iType == ECamActivePaletteItemTypePreCaptureNonSetting,
|
|
1304 |
CamPanic( ECamPanicNonSettingActivePaletteTypeExpected ) );
|
|
1305 |
|
|
1306 |
TInt state = KErrNotFound;
|
|
1307 |
|
|
1308 |
if ( !iController.IsTouchScreenSupported() )
|
|
1309 |
{
|
|
1310 |
CCamAppUi* appUi = static_cast<CCamAppUi*>(iEnv->AppUi());
|
|
1311 |
|
|
1312 |
|
|
1313 |
switch( aItem.iItemId )
|
|
1314 |
{
|
|
1315 |
// -----------------------------------------------------
|
|
1316 |
case ECamSettingItemSequenceMode:
|
|
1317 |
{
|
|
1318 |
TBool burst = appUi->IsBurstEnabled();
|
|
1319 |
state = CamTimeLapseUtility::IntervalToEnum( iController.TimeLapseInterval(), burst );
|
|
1320 |
PRINT1( _L("Camera <> CCamActivePaletteHandler::DetermineNonSettingState Sequence Mode %d"), appUi->IsBurstEnabled());
|
|
1321 |
break;
|
|
1322 |
}
|
|
1323 |
// -----------------------------------------------------
|
|
1324 |
case ECamSettingItemImageModeSelect:
|
|
1325 |
case ECamSettingItemVideoModeSelect:
|
|
1326 |
case ECamSettingItemSwitchCamera:
|
|
1327 |
{
|
|
1328 |
state = 0;
|
|
1329 |
break;
|
|
1330 |
}
|
|
1331 |
// -----------------------------------------------------
|
|
1332 |
case ECamSettingItemViewfinderGrid:
|
|
1333 |
{
|
|
1334 |
state = iController.IntegerSettingValue( ECamSettingItemViewfinderGrid );
|
|
1335 |
break;
|
|
1336 |
}
|
|
1337 |
// -----------------------------------------------------
|
|
1338 |
case ECamSettingItemFaceTracking:
|
|
1339 |
{
|
|
1340 |
state = iController.IntegerSettingValue( ECamSettingItemFaceTracking );
|
|
1341 |
break;
|
|
1342 |
}
|
|
1343 |
// -----------------------------------------------------
|
|
1344 |
case ECamSettingItemDynamicVideoFlash:
|
|
1345 |
{
|
|
1346 |
state = iController.IntegerSettingValue( ECamSettingItemDynamicVideoFlash );
|
|
1347 |
break;
|
|
1348 |
}
|
|
1349 |
// -----------------------------------------------------
|
|
1350 |
default:
|
|
1351 |
{
|
|
1352 |
__ASSERT_DEBUG( EFalse, CamPanic( ECamPanicInvalidActivePaletteItemType ) );
|
|
1353 |
break;
|
|
1354 |
}
|
|
1355 |
// -----------------------------------------------------
|
|
1356 |
}
|
|
1357 |
}
|
|
1358 |
|
|
1359 |
return state;
|
|
1360 |
}
|
|
1361 |
|
|
1362 |
// -----------------------------------------------------------------------------
|
|
1363 |
// CCamActivePaletteHandler::SetNonSettingItemTooltipL
|
|
1364 |
// Change a Non-Setting Item's tooltip
|
|
1365 |
// -----------------------------------------------------------------------------
|
|
1366 |
//
|
|
1367 |
void CCamActivePaletteHandler::SetNonSettingItemTooltipL(const TCamActivePaletteItem& aItem)
|
|
1368 |
{
|
|
1369 |
if ( !iController.IsTouchScreenSupported() )
|
|
1370 |
{
|
|
1371 |
__ASSERT_DEBUG( aItem.iType == ECamActivePaletteItemTypePreCaptureNonSetting,
|
|
1372 |
CamPanic( ECamPanicNonSettingActivePaletteTypeExpected ) );
|
|
1373 |
|
|
1374 |
TInt resource = 0;
|
|
1375 |
switch ( aItem.iItemId )
|
|
1376 |
{
|
|
1377 |
// -----------------------------------------------------
|
|
1378 |
case ECamSettingItemSequenceMode:
|
|
1379 |
{
|
|
1380 |
resource = ( iController.TimeLapseSupported() )
|
|
1381 |
? R_CAM_ACTIVE_PALETTE_PRECAPTURE_ADVANCED_SEQUENCE_MODE_TOOLTIP_ARRAY
|
|
1382 |
: R_CAM_ACTIVE_PALETTE_PRECAPTURE_SEQUENCE_MODE_TOOLTIP_ARRAY;
|
|
1383 |
break;
|
|
1384 |
}
|
|
1385 |
// -----------------------------------------------------
|
|
1386 |
case ECamSettingItemViewfinderGrid:
|
|
1387 |
{
|
|
1388 |
resource = R_CAM_ACTIVE_PALETTE_VF_GRID_TOOLTIP_ARRAY;
|
|
1389 |
break;
|
|
1390 |
}
|
|
1391 |
// -----------------------------------------------------
|
|
1392 |
case ECamSettingItemDynamicVideoFlash:
|
|
1393 |
{
|
|
1394 |
resource = R_CAM_ACTIVE_PALETTE_VIDEO_FLASH_TOOLTIP_ARRAY;
|
|
1395 |
break;
|
|
1396 |
}
|
|
1397 |
// -----------------------------------------------------
|
|
1398 |
case ECamSettingItemFaceTracking:
|
|
1399 |
{
|
|
1400 |
resource = R_CAM_ACTIVE_PALETTE_FACETRACKING_TOOLTIP_ARRAY;
|
|
1401 |
break;
|
|
1402 |
}
|
|
1403 |
// -----------------------------------------------------
|
|
1404 |
default:
|
|
1405 |
{
|
|
1406 |
break;
|
|
1407 |
}
|
|
1408 |
// -----------------------------------------------------
|
|
1409 |
} // switch
|
|
1410 |
|
|
1411 |
if ( resource )
|
|
1412 |
{
|
|
1413 |
TResourceReader reader;
|
|
1414 |
iEnv->CreateResourceReaderLC(reader, resource);
|
|
1415 |
|
|
1416 |
// Current Item State
|
|
1417 |
TInt state = DetermineNonSettingState(aItem);
|
|
1418 |
|
|
1419 |
const TInt count = reader.ReadInt16();
|
|
1420 |
|
|
1421 |
for( TInt i = 0; i < count; i++ )
|
|
1422 |
{
|
|
1423 |
if (i == state)
|
|
1424 |
{
|
|
1425 |
TPtrC ptr = reader.ReadTPtrC();
|
|
1426 |
delete iToolTipText;
|
|
1427 |
iToolTipText = NULL;
|
|
1428 |
iToolTipText = ptr.AllocL();
|
|
1429 |
break;
|
|
1430 |
}
|
|
1431 |
// Skip these values if this isn't the one we're interested in.
|
|
1432 |
reader.ReadTPtrC(); // Tooltip text
|
|
1433 |
}
|
|
1434 |
CleanupStack::PopAndDestroy(); // reader
|
|
1435 |
}
|
|
1436 |
}
|
|
1437 |
}
|
|
1438 |
|
|
1439 |
|
|
1440 |
// -----------------------------------------------------------------------------
|
|
1441 |
// CCamActivePaletteHandler::SetItemVisible
|
|
1442 |
// Sets an icons visability
|
|
1443 |
// -----------------------------------------------------------------------------
|
|
1444 |
//
|
|
1445 |
TInt CCamActivePaletteHandler::SetItemVisible( const TInt aCommandId, const TBool aIsVisible )
|
|
1446 |
{
|
|
1447 |
PRINT( _L("Camera => CCamActivePaletteHandler::SetItemVisible"));
|
|
1448 |
TInt ret = 0;
|
|
1449 |
if ( !iController.IsTouchScreenSupported() )
|
|
1450 |
{
|
|
1451 |
if ( iActivePalette )
|
|
1452 |
{
|
|
1453 |
return iActivePalette->SetItemVisibility( aCommandId, aIsVisible );
|
|
1454 |
}
|
|
1455 |
else
|
|
1456 |
{
|
|
1457 |
return ret;
|
|
1458 |
}
|
|
1459 |
}
|
|
1460 |
else
|
|
1461 |
{
|
|
1462 |
return ret;
|
|
1463 |
}
|
|
1464 |
}
|
|
1465 |
|
|
1466 |
|
|
1467 |
// -----------------------------------------------------------------------------
|
|
1468 |
// CCamActivePaletteHandler::DisableUpdates
|
|
1469 |
// Disables / enables activepalette updates.
|
|
1470 |
// When updates are disabled, UpdateActivePaletteL does nothing.
|
|
1471 |
// -----------------------------------------------------------------------------
|
|
1472 |
//
|
|
1473 |
void CCamActivePaletteHandler::DisableUpdates( TBool aDisableUpdates )
|
|
1474 |
{
|
|
1475 |
PRINT1( _L("Camera => CCamActivePaletteHandler::DisableUpdates(%d)" ), aDisableUpdates );
|
|
1476 |
|
|
1477 |
iUpdatesDisabled = aDisableUpdates;
|
|
1478 |
|
|
1479 |
PRINT( _L("Camera <= CCamActivePaletteHandler::DisableUpdates" ) );
|
|
1480 |
}
|
|
1481 |
|
|
1482 |
// -----------------------------------------------------------------------------
|
|
1483 |
// CCamActivePaletteHandler::SetOneClickUploadTooltipL
|
|
1484 |
// -----------------------------------------------------------------------------
|
|
1485 |
//
|
|
1486 |
void CCamActivePaletteHandler::SetOneClickUploadTooltipL(
|
|
1487 |
const TDesC& aToolTip )
|
|
1488 |
{
|
|
1489 |
delete iOneClickUploadTooltip;
|
|
1490 |
iOneClickUploadTooltip = NULL;
|
|
1491 |
iOneClickUploadTooltip = aToolTip.AllocL();
|
|
1492 |
}
|
|
1493 |
|
|
1494 |
// -----------------------------------------------------------------------------
|
|
1495 |
// CCamActivePaletteHandler::ClearActivePalette
|
|
1496 |
// Deletes all items from the active palette without deleting the active palette
|
|
1497 |
// object itself, as this would cause problems for the containers that have
|
|
1498 |
// pointers to
|
|
1499 |
// -----------------------------------------------------------------------------
|
|
1500 |
//
|
|
1501 |
void CCamActivePaletteHandler::ClearActivePalette()
|
|
1502 |
{
|
|
1503 |
if ( !iController.IsTouchScreenSupported() )
|
|
1504 |
{
|
|
1505 |
RArray<TActivePalette2ItemVisible> itemArray;
|
|
1506 |
iActivePalette->GetItemList(itemArray);
|
|
1507 |
for(TInt i=0;i<itemArray.Count();i++)
|
|
1508 |
{
|
|
1509 |
iActivePalette->RemoveItem(itemArray[i].ItemId());
|
|
1510 |
}
|
|
1511 |
itemArray.Close();
|
|
1512 |
}
|
|
1513 |
}
|
|
1514 |
|
|
1515 |
|
|
1516 |
// -----------------------------------------------------------------------------
|
|
1517 |
// CCamActivePaletteHandler::ReadToolbarItemsFromResourceL
|
|
1518 |
// Load toolbar item resource content to argument array
|
|
1519 |
// -----------------------------------------------------------------------------
|
|
1520 |
//
|
|
1521 |
void
|
|
1522 |
CCamActivePaletteHandler::ReadToolbarItemsFromResourceL( TInt aResId,
|
|
1523 |
RArray<TCamActivePaletteItem>& aItems )
|
|
1524 |
{
|
|
1525 |
PRINT( _L("Camera => CCamActivePaletteHandler::ReadToolbarItemsFromResourceL" ) );
|
|
1526 |
if ( !iController.IsTouchScreenSupported() )
|
|
1527 |
{
|
|
1528 |
// Create resource reader
|
|
1529 |
TResourceReader apItemReader;
|
|
1530 |
iEnv->CreateResourceReaderLC( apItemReader, aResId );
|
|
1531 |
|
|
1532 |
// Read number of items
|
|
1533 |
TInt numItems = apItemReader.ReadInt16();
|
|
1534 |
PRINT1( _L("Camera <> CCamActivePaletteHandler::ReadToolbarItemsFromResourceL %d items"), numItems );
|
|
1535 |
|
|
1536 |
TInt currentPosition = 1;
|
|
1537 |
for( TInt i = 0; i < numItems; i++ )
|
|
1538 |
{
|
|
1539 |
TCamActivePaletteItem item;
|
|
1540 |
item.iItemId = apItemReader.ReadInt32();
|
|
1541 |
item.iCmdId = apItemReader.ReadInt32();
|
|
1542 |
|
|
1543 |
// NOTE:
|
|
1544 |
// !! Current AP2 implementation ignores the iPosition value
|
|
1545 |
// and the order is set by installing order !!!
|
|
1546 |
//
|
|
1547 |
// There are predefined "slots" for
|
|
1548 |
// each used item. The order in resource need not to be
|
|
1549 |
// the same as the order in Active Palette.
|
|
1550 |
// item.iPosition = apItemReader.ReadInt8();
|
|
1551 |
|
|
1552 |
apItemReader.ReadInt8(); // Read unused position value
|
|
1553 |
item.iPosition = currentPosition;
|
|
1554 |
currentPosition++;
|
|
1555 |
|
|
1556 |
item.iIsVisible = apItemReader.ReadInt8();
|
|
1557 |
item.iType = apItemReader.ReadInt8();
|
|
1558 |
|
|
1559 |
// Append to array of items
|
|
1560 |
aItems.AppendL( item );
|
|
1561 |
}
|
|
1562 |
|
|
1563 |
CleanupStack::PopAndDestroy(); // apItemReader
|
|
1564 |
PRINT( _L("Camera <= CCamActivePaletteHandler::ReadToolbarItemsFromResourceL" ) );
|
|
1565 |
}
|
|
1566 |
}
|
|
1567 |
|
|
1568 |
|
|
1569 |
// -----------------------------------------------------------------------------
|
|
1570 |
// CCamActivePaletteHandler::APDimensionConvertion()
|
|
1571 |
// -----------------------------------------------------------------------------
|
|
1572 |
//
|
|
1573 |
TPoint CCamActivePaletteHandler::APScreenLocation( TPoint aQvgaPoint )
|
|
1574 |
{
|
|
1575 |
TSize ScreenSize( 0, 0 );
|
|
1576 |
AknLayoutUtils::LayoutMetricsSize( AknLayoutUtils::EScreen, ScreenSize );
|
|
1577 |
TInt baseheight = 240;
|
|
1578 |
TInt lower = 0;
|
|
1579 |
if ( ScreenSize.iWidth < ScreenSize.iHeight )
|
|
1580 |
{
|
|
1581 |
lower = ScreenSize.iWidth;
|
|
1582 |
}
|
|
1583 |
else
|
|
1584 |
{
|
|
1585 |
lower = ScreenSize.iHeight;
|
|
1586 |
}
|
|
1587 |
TReal ratio = TReal(lower)/baseheight;
|
|
1588 |
TInt APHeightQvga = 240 - 2*aQvgaPoint.iY;
|
|
1589 |
TReal APHeightReal;
|
|
1590 |
Math::Round( APHeightReal, ratio*APHeightQvga, 0 );
|
|
1591 |
TInt APHeight = TInt(APHeightReal);
|
|
1592 |
TInt YValue = (ScreenSize.iHeight/2) - (APHeight/2);
|
|
1593 |
|
|
1594 |
TReal APXValueReal;
|
|
1595 |
TInt XValue;
|
|
1596 |
|
|
1597 |
// With full screen viewfinder, use this!
|
|
1598 |
TInt APXLengthQvga = 320 - aQvgaPoint.iX;
|
|
1599 |
Math::Round( APXValueReal, ratio*APXLengthQvga, 0 );
|
|
1600 |
TInt APXLength = TInt(APXValueReal);
|
|
1601 |
XValue = ScreenSize.iWidth - APXLength;
|
|
1602 |
|
|
1603 |
return TPoint( XValue, YValue );
|
|
1604 |
}
|
|
1605 |
|
|
1606 |
|
|
1607 |
// End of File
|