author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:09:54 +0300 | |
branch | RCL_3 |
changeset 67 | 756ad29ed18e |
parent 57 | 2c87b2808fd7 |
permissions | -rw-r--r-- |
54 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Setting page for Image/Video quality.* |
|
15 |
*/ |
|
16 |
||
17 |
#include "CamInfoListBoxContainer.h" |
|
18 |
#include "CamUtility.h" |
|
19 |
#include <AknBidiTextUtils.h> |
|
20 |
#include <AknsUtils.h> |
|
21 |
#include <AknsDrawUtils.h> |
|
22 |
#include <AknUtils.h> |
|
23 |
#include <barsread.h> // resource reader |
|
24 |
#include <aknview.h> |
|
25 |
#include <aknlayoutscalable_apps.cdl.h> |
|
26 |
#include <touchfeedback.h> |
|
27 |
#include <akntoolbar.h> |
|
28 |
||
29 |
||
30 |
#include "CamAppUi.h" |
|
31 |
||
32 |
#include "CamInfoListBox.h" |
|
33 |
#include "CamInfoListBoxModel.h" |
|
34 |
#include "CamPanic.h" |
|
35 |
#include <AknInfoPopupNoteController.h> // CAknInfoPopupNoteController |
|
36 |
||
37 |
#include <cameraapp.rsg> |
|
38 |
#include <vgacamsettings.rsg> |
|
39 |
||
40 |
// CONSTANTS |
|
41 |
const TInt KInfoTooltipDelay = 0; // time (milliseconds) delay when showing the tooltip |
|
42 |
const TInt KInfoTooltipDisplayTime = 5000; // maximum time (milliseconds) the tooltip is displayed |
|
43 |
const TInt KExplTxtGranularity = 6; |
|
44 |
const TUint32 KToolbarExtensionBgColor = 0x00000000; |
|
45 |
const TInt KToolBarExtensionBgAlpha = 0x7F; |
|
46 |
||
47 |
// ================= MEMBER FUNCTIONS ======================= |
|
48 |
||
49 |
// --------------------------------------------------------------------------- |
|
50 |
// CCamInfoListBoxContainer::NewL |
|
51 |
// Symbian OS two-phased constructor |
|
52 |
// --------------------------------------------------------------------------- |
|
53 |
// |
|
54 |
CCamInfoListBoxContainer* CCamInfoListBoxContainer::NewL( const TRect& aRect, |
|
55 |
CAknView& aView, |
|
56 |
CCamAppController& aController, |
|
57 |
TInt aListBoxResource, |
|
58 |
TInt aSummaryResource, |
|
59 |
TInt aSettingValue, |
|
60 |
TInt aTitleResource, |
|
61 |
TBool aSkinnedBackGround ) |
|
62 |
{ |
|
63 |
CCamInfoListBoxContainer* self = |
|
64 |
new( ELeave ) CCamInfoListBoxContainer( aController, |
|
65 |
aView, |
|
66 |
aSettingValue, |
|
67 |
aSkinnedBackGround ); |
|
68 |
CleanupStack::PushL( self ); |
|
69 |
self->ConstructL( aRect, aListBoxResource, aSummaryResource, aTitleResource); |
|
70 |
CleanupStack::Pop( self ); |
|
71 |
return self; |
|
72 |
} |
|
73 |
||
74 |
// --------------------------------------------------------------------------- |
|
75 |
// CCamInfoListBoxContainer::~CCamInfoListBoxContainer |
|
76 |
// Destructor |
|
77 |
// --------------------------------------------------------------------------- |
|
78 |
// |
|
79 |
CCamInfoListBoxContainer::~CCamInfoListBoxContainer() |
|
80 |
{ |
|
81 |
PRINT( _L( "Camera => ~CCamInfoListBoxContainer" ) ); |
|
82 |
||
83 |
iSummaryBitmapArray.ResetAndDestroy(); |
|
84 |
iTitleArray.ResetAndDestroy(); |
|
85 |
iDescArray.ResetAndDestroy(); |
|
86 |
iExplTxtLinesLayout.Close(); |
|
87 |
||
88 |
delete iListBox; |
|
89 |
||
90 |
if ( iTooltipController ) |
|
91 |
{ |
|
92 |
delete iTooltipController; |
|
93 |
iTooltipController = NULL; |
|
94 |
} |
|
95 |
||
96 |
if ( iListboxTitle ) |
|
97 |
{ |
|
98 |
delete iListboxTitle; |
|
99 |
iListboxTitle = NULL; |
|
100 |
} |
|
101 |
||
102 |
if ( iCurrentDescLineArray ) |
|
103 |
{ |
|
104 |
iCurrentDescLineArray->Reset(); |
|
105 |
delete iCurrentDescLineArray; |
|
106 |
} |
|
107 |
||
108 |
PRINT( _L( "Camera <= ~CCamInfoListBoxContainer" ) ); |
|
109 |
} |
|
110 |
||
111 |
// --------------------------------------------------------- |
|
112 |
// CCamInfoListBoxContainer::ConstructL |
|
113 |
// Symbian OS 2nd phase constructor |
|
114 |
// --------------------------------------------------------- |
|
115 |
// |
|
116 |
void CCamInfoListBoxContainer::ConstructL( const TRect& aRect, TInt aListBoxResource, TInt aSummaryResource, TInt aTitleResource ) |
|
117 |
{ |
|
118 |
PRINT(_L("Camera => CCamInfoListBoxContainer::ConstructL") ) |
|
119 |
||
120 |
CCamContainerBase::BaseConstructL( aRect ); |
|
121 |
||
122 |
if ( iController.IsTouchScreenSupported() ) |
|
123 |
{ |
|
124 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
125 |
CAknToolbar* fixedToolbar = appUi->CurrentFixedToolbar(); |
|
126 |
if ( fixedToolbar ) |
|
127 |
{ |
|
128 |
// Hide toolbar from Light sensitivity etc. settings view |
|
129 |
fixedToolbar->SetToolbarVisibility( EFalse ); |
|
130 |
} |
|
131 |
} |
|
132 |
||
133 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, |
|
134 |
iLayoutAreaRect ); |
|
135 |
||
136 |
// layout area rectangle contains the area, where components need to be |
|
137 |
// drawn to. the container size is the whole screen, but the layouts are |
|
138 |
// for the client area. aRect is the container size that might include or |
|
139 |
// might not include statuspane area. calculating area self will |
|
140 |
// go around the problem |
|
141 |
||
142 |
// Construct the listbox |
|
143 |
iListBox = new( ELeave ) CCamInfoListBox( this, iController ); |
|
144 |
iListBox->ConstructL( iController, this, iTitleArray, iDescArray, aListBoxResource, |
|
145 |
iSkinnedBackGround ); |
|
146 |
iListBox->DisableSingleClick( ETrue ); |
|
147 |
||
148 |
// Highlight the currently active setting value |
|
149 |
iListBox->InitializeL( iSettingValue ); |
|
150 |
||
151 |
iListBox->SetContainerWindowL( *this ); |
|
152 |
iListBox->CreateScrollBarFrameL( ETrue ); |
|
153 |
||
154 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
155 |
TRect listboxRect; |
|
67
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
156 |
if ( CamUtility::IsNhdDevice() ) |
54 | 157 |
{ |
158 |
listboxRect = TouchLayout(); |
|
159 |
} |
|
160 |
else |
|
161 |
{ |
|
162 |
iCurrentDescLineArray = |
|
163 |
new( ELeave ) CArrayFixFlat<TPtrC>( KExplTxtGranularity ); |
|
164 |
appUi->StatusPane()->MakeVisible( ETrue ); |
|
165 |
SetRect( appUi->ClientRect() ); |
|
166 |
listboxRect = NonTouchLayout(); |
|
167 |
} |
|
168 |
ConstructSummaryDetailsFromResourceL( aSummaryResource ); |
|
169 |
||
170 |
// Determine the height of the listbox; |
|
171 |
// Height needs to be based on the number of items, because the layout |
|
172 |
// height (maxListBoxHeight )might be different |
|
173 |
// than combined height of the max visible listbox items |
|
174 |
||
175 |
CEikScrollBarFrame::TScrollBarVisibility visibility = |
|
176 |
CEikScrollBarFrame::EOff; |
|
177 |
TInt listBoxHeight = iListBox->CalcHeightBasedOnNumOfItems( |
|
178 |
iListBox->Model()->NumberOfItems() ); |
|
179 |
if ( listboxRect.Height() < listBoxHeight ) |
|
180 |
{ |
|
181 |
// there are more items than would fit to the listbox rectangle |
|
182 |
||
183 |
// the maximum height is the total height of items |
|
184 |
// that can fit to the maxlistboxheight |
|
185 |
TInt itemHeight = iListBox->ItemHeight(); |
|
186 |
TInt itemsVisible = listboxRect.Height() / itemHeight; |
|
187 |
listBoxHeight = itemsVisible * itemHeight; |
|
188 |
||
189 |
// the scrollbar needs to be turned on |
|
190 |
visibility = CEikScrollBarFrame::EOn; |
|
191 |
} |
|
192 |
||
193 |
// calculate the layout for the listbox with changed height |
|
194 |
const AknLayoutUtils::SAknLayoutControl listboxLayout = |
|
195 |
{ ELayoutEmpty, listboxRect.iTl.iX, listboxRect.iTl.iY, |
|
196 |
ELayoutEmpty, ELayoutEmpty, |
|
197 |
iListboxLayoutRect.Rect().Width(), listBoxHeight }; |
|
198 |
||
199 |
AknLayoutUtils::LayoutControl( iListBox, iLayoutAreaRect, listboxLayout); |
|
200 |
||
201 |
// set scrollbars for the listbox |
|
202 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, |
|
203 |
visibility ); |
|
204 |
iListBox->MakeVisible( ETrue ); |
|
205 |
iListBox->SetFocus( EFalse, ENoDrawNow ); |
|
206 |
iListBox->UpdateScrollBarsL(); |
|
207 |
iListBox->ScrollBarFrame()->DrawScrollBarsNow(); |
|
208 |
iListBox->SetListBoxObserver(this); |
|
209 |
appUi->SetActivePaletteVisibility( EFalse ); |
|
210 |
||
211 |
// Prevents the system filling invalidated areas with the background colour - |
|
212 |
// helps reduce flicker. |
|
213 |
Window().SetBackgroundColor(); |
|
214 |
||
215 |
ConstructContainerTitleFromResourceL( aTitleResource ); |
|
216 |
||
217 |
if ( !iTooltipController ) |
|
218 |
{ |
|
219 |
iTooltipController = CAknInfoPopupNoteController::NewL(); |
|
220 |
} |
|
221 |
||
222 |
iTooltipController->SetTimeDelayBeforeShow( KInfoTooltipDelay ); |
|
223 |
iTooltipController->SetTimePopupInView( KInfoTooltipDisplayTime ); |
|
224 |
||
225 |
// Position the tooltip |
|
226 |
TPoint position; |
|
227 |
if ( AknsUtils::GetControlPosition( this, position ) != KErrNone ) |
|
228 |
{ |
|
229 |
position = PositionRelativeToScreen(); |
|
230 |
} |
|
231 |
TRect rect( position, Size() ); |
|
232 |
TPoint center = rect.Center(); |
|
233 |
iTooltipController->SetPositionAndAlignment( TPoint( center.iX, rect.iTl.iY ), EHLeftVBottom ); |
|
234 |
||
235 |
iTooltipController->SetTimeDelayBeforeShow( KInfoTooltipDelay ); |
|
236 |
iTooltipController->SetTimePopupInView( KInfoTooltipDisplayTime ); |
|
237 |
||
238 |
iController.SetViewfinderWindowHandle( &Window() ); |
|
239 |
PRINT(_L("Camera <= CCamInfoListBoxContainer::ConstructL") ) |
|
240 |
} |
|
241 |
||
242 |
// --------------------------------------------------------------------------- |
|
243 |
// CCamInfoListBoxContainer::CCamInfoListBoxContainer |
|
244 |
// C++ constructor |
|
245 |
// --------------------------------------------------------------------------- |
|
246 |
// |
|
247 |
CCamInfoListBoxContainer::CCamInfoListBoxContainer( CCamAppController& aController, |
|
248 |
CAknView& aView, |
|
249 |
TInt aSettingValue, |
|
250 |
TBool aSkinnedBackGround ) |
|
251 |
: CCamContainerBase( aController, aView ), iSettingValue( aSettingValue ), |
|
252 |
iTooltipController(NULL), |
|
253 |
iShowTooltip(EFalse), |
|
254 |
iTooltipIndex(-1), |
|
255 |
iActivateOnTouchRelease(EFalse), |
|
256 |
iSkinnedBackGround(aSkinnedBackGround) |
|
257 |
||
258 |
{ |
|
259 |
} |
|
260 |
||
261 |
||
262 |
// ----------------------------------------------------------------------------- |
|
263 |
// CCamInfoListBoxContainer::CurrentSettingItemValue |
|
264 |
// Returns the Current item's setting value ID |
|
265 |
// ----------------------------------------------------------------------------- |
|
266 |
TInt CCamInfoListBoxContainer::CurrentSettingItemValue() const |
|
267 |
{ |
|
268 |
return static_cast<MCamListboxModel*>(iListBox->Model())->ItemValue(iListBox->CurrentItemIndex()); |
|
269 |
} |
|
270 |
||
271 |
||
272 |
TBool CCamInfoListBoxContainer::SettingValueChanged() const |
|
273 |
{ |
|
274 |
return CurrentSettingItemValue() != iSettingValue; |
|
275 |
} |
|
276 |
||
277 |
// ----------------------------------------------------------------------------- |
|
278 |
// CCamInfoListBoxContainer::IndexForValueId() const |
|
279 |
// Returns the index of the item in the array with the specified ValueId |
|
280 |
// ----------------------------------------------------------------------------- |
|
281 |
TInt |
|
282 |
CCamInfoListBoxContainer::IndexForValueId( TInt aValueId ) const |
|
283 |
{ |
|
284 |
return static_cast<MCamListboxModel*>( iListBox->Model() )->ValueIndex( aValueId ); |
|
285 |
} |
|
286 |
||
287 |
// ----------------------------------------------------------------------------- |
|
288 |
// CCamInfoListBoxContainer::HandleSettingValueUpdateL |
|
289 |
// Handles a change to the setting value of the slider |
|
290 |
// ----------------------------------------------------------------------------- |
|
291 |
// |
|
292 |
void CCamInfoListBoxContainer::HandleSettingValueUpdateL( TInt aNewValue ) |
|
293 |
{ |
|
294 |
iController.PreviewSettingChangeL( ECamSettingItemDynamicPhotoLightSensitivity, aNewValue ); |
|
295 |
} |
|
296 |
||
297 |
// --------------------------------------------------------- |
|
298 |
// CCamInfoListBoxContainer::CountComponentControls |
|
299 |
// Returns the number of controls owned |
|
300 |
// --------------------------------------------------------- |
|
301 |
// |
|
302 |
TInt CCamInfoListBoxContainer::CountComponentControls() const |
|
303 |
{ |
|
304 |
return CCamContainerBase::CountComponentControls() + 1; |
|
305 |
} |
|
306 |
||
307 |
// --------------------------------------------------------- |
|
308 |
// CCamInfoListBoxContainer::ComponentControl |
|
309 |
// Returns the requested component control |
|
310 |
// --------------------------------------------------------- |
|
311 |
// |
|
312 |
CCoeControl* CCamInfoListBoxContainer::ComponentControl( TInt aIndex ) const |
|
313 |
{ |
|
314 |
CCoeControl* control = CCamContainerBase::ComponentControl( aIndex ); |
|
315 |
if( control == NULL) |
|
316 |
{ |
|
317 |
control = iListBox; |
|
318 |
} |
|
319 |
return control; |
|
320 |
} |
|
321 |
||
322 |
// --------------------------------------------------------- |
|
323 |
// CCamInfoListBoxContainer::Draw |
|
324 |
// Draw control |
|
325 |
// ---------------------------------------------------------- |
|
326 |
// |
|
327 |
void CCamInfoListBoxContainer::Draw( const TRect& aRect ) const |
|
328 |
{ |
|
329 |
PRINT(_L("Camera => CCamInfoListBoxContainer::Draw") ) |
|
330 |
||
331 |
CWindowGc& gc = SystemGc(); |
|
67
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
332 |
if ( CamUtility::IsNhdDevice() ) |
54 | 333 |
{ |
334 |
TRgb color; |
|
335 |
if( iSkinnedBackGround ) |
|
336 |
{ |
|
337 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
338 |
AknsDrawUtils::Background( skin, iBgContext, gc, aRect ); |
|
339 |
// draw the title text |
|
340 |
AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, |
|
341 |
EAknsCIQsnTextColorsCG6 ); |
|
342 |
} |
|
343 |
else |
|
344 |
{ |
|
345 |
// Fill control with transparency bg colour |
|
346 |
gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
347 |
gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
348 |
color = TRgb( 0,0 ); |
|
349 |
gc.SetBrushColor( color ); |
|
350 |
gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
351 |
gc.DrawRect( aRect ); |
|
352 |
gc.SetBrushColor( color ); |
|
353 |
gc.DrawRect( iTitleTextRectLayout.TextRect() ); |
|
354 |
// Reset the brush after use (otherwise anything drawn |
|
355 |
// after the viewfinder will also show viewfinder frames) |
|
356 |
||
357 |
gc.SetBrushColor( TRgb( KToolbarExtensionBgColor, KToolBarExtensionBgAlpha ) ); |
|
358 |
gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
359 |
gc.DrawRect( TRect( iLayoutAreaRect.iTl.iX, |
|
360 |
iLayoutAreaRect.iTl.iY, |
|
361 |
iLayoutAreaRect.iBr.iX, |
|
362 |
iTitleTextRectLayout.TextRect().iBr.iY ) ); |
|
363 |
||
364 |
gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
365 |
||
366 |
||
367 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
368 |
appUi->StatusPane()->MakeVisible( EFalse ); |
|
369 |
||
370 |
color = TRgb( KRgbWhite ); |
|
371 |
} |
|
372 |
iTitleTextRectLayout.DrawText( gc, *iListboxTitle, ETrue, color ); |
|
373 |
} |
|
374 |
else |
|
375 |
{ |
|
376 |
TRAP_IGNORE( DrawSummaryTextL( gc ) ); |
|
377 |
} |
|
378 |
||
379 |
PRINT(_L("Camera <= CCamInfoListBoxContainer::Draw") ) |
|
380 |
} |
|
381 |
||
382 |
// ---------------------------------------------------------------- |
|
383 |
// CCamInfoListBoxContainer::OfferKeyEventL |
|
384 |
// Handles this application view's command keys. Forwards other |
|
385 |
// keys to child control(s). |
|
386 |
// ---------------------------------------------------------------- |
|
387 |
// |
|
388 |
TKeyResponse CCamInfoListBoxContainer::OfferKeyEventL( |
|
389 |
const TKeyEvent& aKeyEvent, |
|
390 |
TEventCode aType ) |
|
391 |
{ |
|
392 |
if( iController.CurrentMode() == ECamControllerIdle || |
|
393 |
iController.CurrentMode() == ECamControllerShutdown ) |
|
394 |
{ |
|
395 |
if( !iController.IsViewFinding() && !iSkinnedBackGround |
|
396 |
&& ( IsCaptureKeyL( aKeyEvent, aType ) |
|
397 |
|| IsShutterKeyL( aKeyEvent, aType ) ) ) |
|
398 |
{ |
|
399 |
PRINT( _L("Camera <> CCamInfoListBoxContainer::OfferKeyEventL coming back from standby" )) |
|
400 |
ReserveAndStartVF(); |
|
401 |
} |
|
402 |
return EKeyWasNotConsumed; |
|
403 |
} |
|
404 |
iController.StartIdleTimer(); |
|
405 |
||
406 |
// If the Ok button or shutter key is pressed, select the current item |
|
407 |
if ( ( aKeyEvent.iCode == EKeyOK && aKeyEvent.iRepeats == 0 && aType == EEventKey ) || |
|
408 |
( aType == EEventKey && |
|
409 |
( IsCaptureKeyL( aKeyEvent, aType ) || IsShutterKeyL( aKeyEvent, aType ) ) ) ) |
|
410 |
{ |
|
411 |
TKeyResponse response = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
412 |
iView.HandleCommandL( EAknSoftkeySelect ); |
|
413 |
return response; |
|
414 |
} |
|
415 |
||
416 |
TKeyResponse returnvalue = iListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
417 |
||
418 |
if ( EStdKeyUpArrow == aKeyEvent.iScanCode || |
|
419 |
EStdKeyDownArrow == aKeyEvent.iScanCode ) |
|
420 |
{ |
|
421 |
ShowTooltipL(); |
|
422 |
} |
|
423 |
else // No tooltip |
|
424 |
{ |
|
425 |
DrawDeferred(); // Update explanation text |
|
426 |
} |
|
427 |
||
428 |
return returnvalue; |
|
429 |
} |
|
430 |
||
431 |
// ----------------------------------------------------------------- |
|
432 |
// CCamInfoListBoxContainer::ConstructSummaryDetailsFromResourceL |
|
433 |
// Sets up the layouts of the summary items |
|
434 |
// ----------------------------------------------------------------- |
|
435 |
void CCamInfoListBoxContainer::ConstructSummaryDetailsFromResourceL(TInt aResourceId) |
|
436 |
{ |
|
437 |
// Find the name and path of the MBM file for bitmaps |
|
438 |
TFileName mbmFileName; |
|
439 |
CamUtility::ResourceFileName( mbmFileName ); |
|
440 |
||
441 |
TResourceReader reader; |
|
442 |
iEikonEnv->CreateResourceReaderLC( reader, aResourceId ); |
|
443 |
const TInt count = reader.ReadInt16(); |
|
444 |
||
445 |
TInt i; |
|
446 |
TInt bitmapId; |
|
447 |
||
448 |
// Read all of the summary entries from the resource file |
|
449 |
for ( i = 0; i < count; i++ ) |
|
450 |
{ |
|
451 |
reader.ReadInt16(); // The current item enum is not needed |
|
452 |
bitmapId = reader.ReadInt32(); |
|
453 |
User::LeaveIfError( iSummaryBitmapArray.Append( AknIconUtils::CreateIconL( mbmFileName, bitmapId ) ) ); |
|
454 |
||
455 |
User::LeaveIfError( iTitleArray.Append( reader.ReadHBufC16L() ) ); |
|
456 |
User::LeaveIfError( iDescArray.Append( reader.ReadHBufC16L() ) ); |
|
457 |
} |
|
458 |
||
459 |
CleanupStack::PopAndDestroy(); |
|
460 |
} |
|
461 |
||
462 |
||
463 |
// -------------------------------------------------------------------------- |
|
464 |
// CCamInfoListBoxContainer::HandlePointerEventL |
|
465 |
// -------------------------------------------------------------------------- |
|
466 |
// |
|
467 |
void CCamInfoListBoxContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
468 |
{ |
|
469 |
||
470 |
RDebug::Print(_L("CCamInfoListBoxContainer::HandlePointerEventL iType=%d iPosition=(%d, %d)"), |
|
471 |
aPointerEvent.iType, |
|
472 |
aPointerEvent.iPosition.iX, |
|
473 |
aPointerEvent.iPosition.iY ); |
|
474 |
||
475 |
if( !iController.IsViewFinding() && !iSkinnedBackGround ) |
|
476 |
{ |
|
477 |
PRINT ( _L("Camera <> CCamInfoListBoxContainer::HandlePointerEventL start viewfinder") ); |
|
478 |
ReserveAndStartVF(); |
|
479 |
} |
|
480 |
else |
|
481 |
{ |
|
482 |
PRINT ( _L("Camera <> CCamInfoListBoxContainer::HandlePointerEventL handle selected item") ); |
|
483 |
iListBox->HandlePointerEventL(aPointerEvent); |
|
484 |
} |
|
485 |
||
486 |
/*TInt oldListItemIndex = -1; |
|
487 |
TInt newListItemIndex = -1; |
|
488 |
TBool handleItemActivation = EFalse; |
|
489 |
||
490 |
if ( iListBox ) |
|
491 |
{ |
|
492 |
oldListItemIndex = iListBox->CurrentItemIndex(); |
|
493 |
} |
|
494 |
||
495 |
// send to coecontrol -> will inform controls in this container about pointer events |
|
496 |
// (listbox will handle focus changes and scrolling) |
|
497 |
CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
498 |
||
499 |
if ( iListBox ) |
|
500 |
{ |
|
501 |
newListItemIndex = iListBox->CurrentItemIndex(); |
|
502 |
} |
|
503 |
||
504 |
// figure out if item was activated by touch down + release combination on same item |
|
505 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
506 |
{ |
|
507 |
||
508 |
if ( iListBox->Rect().Contains( aPointerEvent.iPosition ) ) |
|
509 |
{ |
|
510 |
if ( newListItemIndex != oldListItemIndex ) |
|
511 |
{ |
|
512 |
iActivateOnTouchRelease = EFalse; |
|
513 |
} |
|
514 |
else |
|
515 |
{ |
|
516 |
// set the current item to be activated on touch release |
|
517 |
iActivateOnTouchRelease = ETrue; |
|
518 |
} |
|
519 |
||
520 |
// show tooltip always when touch event down happens inside listbox |
|
521 |
ShowTooltipL(); |
|
522 |
} |
|
523 |
else |
|
524 |
{ |
|
525 |
iActivateOnTouchRelease = EFalse; |
|
526 |
} |
|
527 |
||
528 |
||
529 |
} |
|
530 |
else if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
531 |
{ |
|
532 |
if ( iActivateOnTouchRelease && ( newListItemIndex == oldListItemIndex ) ) |
|
533 |
{ |
|
534 |
// only if list item index has not changed during event |
|
535 |
// and iActivateOnTouchRelease is true |
|
536 |
TInt pointedItemIndex = 0; |
|
537 |
TBool focusableItemPointed = |
|
538 |
iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, |
|
539 |
pointedItemIndex ); |
|
540 |
// check that pointer is in focusable area |
|
541 |
if ( focusableItemPointed ) |
|
542 |
{ |
|
543 |
handleItemActivation = ETrue; |
|
544 |
iActivateOnTouchRelease = EFalse; |
|
545 |
} |
|
546 |
else |
|
547 |
{ |
|
548 |
iActivateOnTouchRelease = EFalse; |
|
549 |
} |
|
550 |
} |
|
551 |
} |
|
552 |
else |
|
553 |
{ |
|
554 |
// aPointerEvent.iType == TPointerEvent::EDrag |
|
555 |
||
556 |
if ( newListItemIndex != oldListItemIndex ) |
|
557 |
{ |
|
558 |
// change only when drag event changes the listitem index |
|
559 |
iActivateOnTouchRelease = EFalse; |
|
560 |
||
561 |
// with drag always update the tooltip |
|
562 |
ShowTooltipL(); |
|
563 |
} |
|
564 |
||
565 |
} |
|
566 |
||
567 |
||
568 |
if ( handleItemActivation ) |
|
569 |
{ |
|
570 |
iView.HandleCommandL( EAknSoftkeySelect ); |
|
571 |
}*/ |
|
572 |
} |
|
573 |
||
574 |
// -------------------------------------------------------------------------- |
|
575 |
// CCamInfoListBoxContainer::HandleListBoxEventL |
|
576 |
// Handles Listbox events |
|
577 |
// -------------------------------------------------------------------------- |
|
578 |
// |
|
579 |
||
580 |
void CCamInfoListBoxContainer::HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ) |
|
581 |
{ |
|
582 |
switch( aEventType ) |
|
583 |
{ |
|
584 |
case EEventItemDoubleClicked: |
|
585 |
{ |
|
586 |
iView.HandleCommandL( EAknSoftkeySelect ); |
|
587 |
} |
|
588 |
break; |
|
589 |
||
590 |
case EEventPenDownOnItem: |
|
591 |
{ |
|
592 |
ShowTooltipL(); |
|
593 |
} |
|
594 |
break; |
|
595 |
||
596 |
case EEventItemClicked: |
|
597 |
case EEventItemSingleClicked: |
|
598 |
{ |
|
599 |
TInt settingValue = CurrentSettingItemValue(); |
|
67
756ad29ed18e
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
57
diff
changeset
|
600 |
iController.PreviewSettingChangeL( ECamSettingItemDynamicPhotoLightSensitivity, settingValue ); |
54 | 601 |
} |
602 |
break; |
|
603 |
default: |
|
604 |
break; |
|
605 |
} |
|
606 |
} |
|
607 |
||
608 |
// -------------------------------------------------------------------------- |
|
609 |
// CCamInfoListBoxContainer::ShowTooltipL |
|
610 |
// -------------------------------------------------------------------------- |
|
611 |
// |
|
612 |
void CCamInfoListBoxContainer::ShowTooltipL() |
|
613 |
{ |
|
614 |
||
615 |
if ( !iTooltipController || ( iDescArray[iListBox->CurrentItemIndex()]->Length() <= 0 ) ) |
|
616 |
{ |
|
617 |
return; |
|
618 |
} |
|
619 |
||
620 |
if ( iTooltipIndex != iListBox->CurrentItemIndex() ) |
|
621 |
{ |
|
622 |
// make sure that possible already open tooltip is hidden |
|
623 |
iTooltipController->HideInfoPopupNote(); |
|
624 |
||
625 |
iTooltipController->SetTextL( *iDescArray[iListBox->CurrentItemIndex()] ); |
|
626 |
TRect hl = iListBox->HighlightRect(); |
|
627 |
TPoint tt = hl.Center(); |
|
628 |
if ( AknLayoutUtils::LayoutMirrored() ) |
|
629 |
{ |
|
630 |
tt.iX -= hl.Width(); |
|
631 |
} |
|
632 |
iTooltipController->SetPositionAndAlignment( tt, EHLeftVBottom ); |
|
633 |
||
634 |
iTooltipIndex = iListBox->CurrentItemIndex(); |
|
635 |
} |
|
636 |
||
637 |
||
638 |
iTooltipController->ShowInfoPopupNote(); |
|
639 |
||
640 |
} |
|
641 |
||
642 |
||
643 |
// -------------------------------------------------------------------------- |
|
644 |
// CCamInfoListBoxContainer::ConstructContainerTitleFromResourceL |
|
645 |
// -------------------------------------------------------------------------- |
|
646 |
// |
|
647 |
void CCamInfoListBoxContainer::ConstructContainerTitleFromResourceL( TInt aResourceId ) |
|
648 |
{ |
|
649 |
TResourceReader reader; |
|
650 |
iEikonEnv->CreateResourceReaderLC( reader, aResourceId ); // cleanupstack |
|
651 |
||
652 |
iListboxTitle = reader.ReadHBufC16L(); |
|
653 |
||
654 |
CleanupStack::PopAndDestroy(); // reader |
|
655 |
} |
|
656 |
||
657 |
||
658 |
// ----------------------------------------------------------------- |
|
659 |
// CCamInfoListBoxContainer::DrawSummaryText (ISO setting) |
|
660 |
// Draws summary title and description text |
|
661 |
// ----------------------------------------------------------------- |
|
662 |
||
663 |
void CCamInfoListBoxContainer::DrawSummaryTextL( CWindowGc& aGc ) const |
|
664 |
{ |
|
665 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( iEikonEnv->AppUi() ); |
|
666 |
appUi->SetTitleL( *iListboxTitle ); |
|
667 |
||
668 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
669 |
AknsDrawUtils::Background( skin, iBgContext, aGc, Rect() ); |
|
670 |
||
671 |
// Draw summary frame |
|
672 |
TRect explTxtRect = iExplanationRect; |
|
673 |
TInt border = iExplIconLayout.Rect().iTl.iX - iExplanationRect.iTl.iX; |
|
674 |
explTxtRect.Shrink( border/2 , border/2 ); |
|
675 |
AknsDrawUtils::DrawFrame( skin, aGc, iExplanationRect, explTxtRect, |
|
676 |
KAknsIIDQsnFrInput, KAknsIIDNone ); //frame |
|
677 |
||
678 |
AknIconUtils::SetSize( iSummaryBitmapArray[iListBox->CurrentItemIndex()], |
|
679 |
iExplIconLayout.Rect().Size() ); |
|
680 |
iExplIconLayout.DrawImage( aGc, |
|
681 |
iSummaryBitmapArray[ iListBox->CurrentItemIndex() ], NULL ); |
|
682 |
||
683 |
TRgb explTitleTxtColor; // same as list highlight text |
|
684 |
TRgb explTxtColor; // same as main area text |
|
685 |
AknsUtils::GetCachedColor( skin, explTitleTxtColor, KAknsIIDQsnTextColors, |
|
686 |
EAknsCIQsnTextColorsCG10 ); |
|
687 |
AknsUtils::GetCachedColor( skin, explTxtColor, KAknsIIDQsnTextColors, |
|
688 |
EAknsCIQsnTextColorsCG6 ); |
|
689 |
iExplTitleLayout.DrawText( aGc, |
|
690 |
iTitleArray[ iListBox->CurrentItemIndex() ]->Des(), |
|
691 |
ETrue, explTitleTxtColor ); |
|
692 |
AknTextUtils::WrapToArrayL( *iDescArray[iListBox->CurrentItemIndex()], |
|
693 |
iExplTxtLinesLayout[0].TextRect().Width(), |
|
694 |
*iExplTxtLinesLayout[0].Font(), |
|
695 |
*iCurrentDescLineArray ); |
|
696 |
TInt lCount = Min( iExplLineCount, iCurrentDescLineArray->Count() ); |
|
697 |
for ( TInt i = 0; i < lCount; i++ ) |
|
698 |
{ |
|
699 |
iExplTxtLinesLayout[i].DrawText( aGc, (*iCurrentDescLineArray)[i], |
|
700 |
ETrue, explTxtColor ); |
|
701 |
} |
|
702 |
} |
|
703 |
||
704 |
// -------------------------------------------------------------------------- |
|
705 |
// CCamInfoListBoxContainer::TouchLayout |
|
706 |
// -------------------------------------------------------------------------- |
|
707 |
// |
|
708 |
TRect CCamInfoListBoxContainer::TouchLayout() |
|
709 |
{ |
|
710 |
TRect statusPaneRect; |
|
711 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, |
|
712 |
statusPaneRect ); |
|
713 |
iLayoutAreaRect.BoundingRect( statusPaneRect ); |
|
714 |
// get the rect size for listbox in the layout |
|
715 |
TAknLayoutRect wholeListboxLayoutRect; |
|
716 |
wholeListboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
717 |
AknLayoutScalable_Apps::main_cset_listscroll_pane( 3 ) ); |
|
718 |
TInt listBoxHeight = iListBox->CalcHeightBasedOnNumOfItems( |
|
719 |
iListBox->Model()->NumberOfItems() ); |
|
720 |
// get layout for the listbox rect |
|
721 |
if ( wholeListboxLayoutRect.Rect().Height() < listBoxHeight ) |
|
722 |
{ |
|
723 |
// if scrollbars are used, use scrollbar layout |
|
724 |
iListboxLayoutRect.LayoutRect( wholeListboxLayoutRect.Rect(), |
|
725 |
AknLayoutScalable_Apps::main_cset_list_pane( 0 ) ); |
|
726 |
} |
|
727 |
else |
|
728 |
{ |
|
729 |
iListboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
730 |
AknLayoutScalable_Apps::main_cset_listscroll_pane( 2 ) ); //Same as WB |
|
731 |
} |
|
732 |
||
733 |
iTitleTextRectLayout.LayoutText( iLayoutAreaRect, |
|
734 |
AknLayoutScalable_Apps::main_cam_set_pane_t1( 3 ) ); |
|
735 |
||
736 |
return iListboxLayoutRect.Rect(); |
|
737 |
} |
|
738 |
||
739 |
// -------------------------------------------------------------------------- |
|
740 |
// CCamInfoListBoxContainer::NonTouchLayout |
|
741 |
// -------------------------------------------------------------------------- |
|
742 |
// |
|
743 |
TRect CCamInfoListBoxContainer::NonTouchLayout() |
|
744 |
{ |
|
745 |
TAknLayoutRect wholeListboxLayoutRect; |
|
746 |
wholeListboxLayoutRect.LayoutRect( iLayoutAreaRect, |
|
747 |
AknLayoutScalable_Apps::main_cset6_listscroll_pane( 3 ) ); |
|
748 |
TAknLayoutRect listLayoutRect; |
|
749 |
listLayoutRect.LayoutRect( iLayoutAreaRect, //1 |
|
750 |
AknLayoutScalable_Apps::main_cset6_listscroll_pane( 4 ) ); |
|
751 |
TInt listBoxHeight = iListBox->CalcHeightBasedOnNumOfItems( |
|
752 |
iListBox->Model()->NumberOfItems() ); |
|
753 |
if ( wholeListboxLayoutRect.Rect().Height() < listBoxHeight ) |
|
754 |
{ |
|
755 |
// if scrollbars are used, use scrollbar layout |
|
756 |
iListboxLayoutRect.LayoutRect( listLayoutRect.Rect(), |
|
757 |
AknLayoutScalable_Apps::main_cset_list_pane_copy1( 0 ) ); |
|
758 |
AknLayoutUtils::LayoutVerticalScrollBar( iListBox->ScrollBarFrame(), |
|
759 |
listLayoutRect.Rect(), |
|
760 |
AknLayoutScalable_Apps::scroll_pane_cp028_copy1( 0 ) ); |
|
761 |
} |
|
762 |
else |
|
763 |
{ |
|
764 |
iListboxLayoutRect.LayoutRect( listLayoutRect.Rect(), |
|
765 |
AknLayoutScalable_Apps::main_cset_list_pane_copy1( 1 ) ); |
|
766 |
} |
|
767 |
||
768 |
// Explanation ikon, title, and text layout |
|
769 |
TAknLayoutRect explParent; |
|
770 |
explParent.LayoutRect( iLayoutAreaRect,//2 |
|
771 |
AknLayoutScalable_Apps::main_cset6_text2_pane( 0 ) ); |
|
772 |
TAknLayoutRect explLayoutRect; |
|
773 |
explLayoutRect.LayoutRect( explParent.Rect(), |
|
774 |
AknLayoutScalable_Apps::bg_popup_preview_window_pane_cp03( 0 ) ); |
|
775 |
iExplanationRect = explLayoutRect.Rect(); |
|
776 |
||
777 |
TRect statusPaneRect; |
|
778 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, |
|
779 |
statusPaneRect ); |
|
780 |
iExplanationRect.Move( 0, -statusPaneRect.Height() ); |
|
781 |
||
782 |
iExplIconLayout.LayoutRect( iExplanationRect, |
|
783 |
AknLayoutScalable_Apps::main_cset6_text2_pane_g1( 0 ) ); |
|
784 |
iExplTitleLayout.LayoutText( iExplanationRect, |
|
785 |
AknLayoutScalable_Apps::main_cset6_text2_pane_t1( 0 ) ); |
|
786 |
iExplTitleLayout.LayoutText( iExplanationRect, |
|
787 |
AknLayoutScalable_Apps::main_cset6_text2_pane_t1( 0 ) ); |
|
788 |
||
789 |
TAknLayoutRect explTxtParent; |
|
790 |
explTxtParent.LayoutRect( iExplanationRect, |
|
791 |
AknLayoutScalable_Apps::list_cset_text2_pane(0) ); |
|
792 |
TAknLayoutScalableParameterLimits listLimits = |
|
793 |
AknLayoutScalable_Apps::list_cset_text2_pane_t1_ParamLimits( 0 ); |
|
794 |
iExplLineCount = listLimits.LastRow() + 1; |
|
795 |
for ( TInt i = 0; i < iExplLineCount; i++ ) |
|
796 |
{ |
|
797 |
TAknLayoutText layoutText; |
|
798 |
layoutText.LayoutText( explTxtParent.Rect(), |
|
799 |
AknLayoutScalable_Apps::list_cset_text2_pane_t1( 0, 0, i ) ); |
|
800 |
(void) iExplTxtLinesLayout.Append( layoutText ); // Errors are ignored |
|
801 |
} |
|
802 |
||
803 |
TRect ret = wholeListboxLayoutRect.Rect(); |
|
804 |
// Non-touch has a visible title & status panes |
|
805 |
TRect titlePaneRect; |
|
806 |
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ETitlePane, |
|
807 |
titlePaneRect ); |
|
808 |
ret.Move( 0, -titlePaneRect.Height() - statusPaneRect.Height() ); |
|
809 |
return ret; |
|
810 |
} |
|
811 |
// End of File |