|
1 /* |
|
2 * Copyright (c) 2002 - 2006 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 * A compound control class. It is responsible for owning CVRButtonPanel |
|
16 * and CVRStateInfoPanel. It also handles the changing of softkeys, menubar |
|
17 * and volume control. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 |
|
24 #include <eikenv.h> |
|
25 #include <bldvariant.hrh> |
|
26 |
|
27 #include <aknnavi.h> |
|
28 #include <aknnavide.h> |
|
29 #include <eikspane.h> |
|
30 #include <avkon.rsg> |
|
31 #include <avkon.hrh> |
|
32 #include <aknappui.h> |
|
33 #include <aknsoundsystem.h> |
|
34 #include <aknview.h> |
|
35 #include <eikbtgpc.h> |
|
36 #include <eikmenub.h> |
|
37 #include <AknUtils.h> |
|
38 #include <AknsUtils.h> |
|
39 #include <AknsDrawUtils.h> |
|
40 #include <AknsBasicBackgroundControlContext.h> |
|
41 #include <akncontext.h> |
|
42 #include <applayout.cdl.h> |
|
43 #include <voicerecorder.rsg> |
|
44 #include <AknDef.h> // For layout change event definitions |
|
45 #include <AknVolumePopup.h> |
|
46 #include <featmgr.h> // Feature manager |
|
47 |
|
48 #include "CVRRecViewContainer.h" |
|
49 #include "CVRButtonPanel.h" |
|
50 #include "CVRStateInfoPanel.h" |
|
51 #include "MVRDecoratorModel.h" |
|
52 #include "MVRVolumeChangeObserver.h" |
|
53 #include "CVRRecView.h" |
|
54 #include "MVRKeyObserver.h" |
|
55 #include "CVRRemConObserver.h" |
|
56 #include "VRConsts.h" |
|
57 |
|
58 #include <VoiceRecorderUID.h> |
|
59 |
|
60 #include "VRUtils.h" |
|
61 |
|
62 // ================= MEMBER FUNCTIONS ========================================= |
|
63 |
|
64 // ---------------------------------------------------------------------------- |
|
65 // CVRRecViewContainer::CVRRecViewContainer |
|
66 // |
|
67 // ---------------------------------------------------------------------------- |
|
68 // |
|
69 CVRRecViewContainer::CVRRecViewContainer() |
|
70 { |
|
71 } |
|
72 |
|
73 |
|
74 // ---------------------------------------------------------------------------- |
|
75 // CVRRecViewContainer::~CVRRecViewContainer |
|
76 // |
|
77 // ---------------------------------------------------------------------------- |
|
78 // |
|
79 CVRRecViewContainer::~CVRRecViewContainer() |
|
80 { |
|
81 if ( iModel ) |
|
82 { |
|
83 iModel->SetDecoratorObserver( NULL ); |
|
84 } |
|
85 delete iButtonPanel; |
|
86 delete iStateInfoPanel; |
|
87 delete iIhfVolumeControl; |
|
88 delete iEarPieceVolumeControl; |
|
89 |
|
90 delete iBackgroundSkinContext; |
|
91 |
|
92 delete iRemConObserver; |
|
93 |
|
94 } |
|
95 |
|
96 |
|
97 // ---------------------------------------------------------------------------- |
|
98 // CVRRecViewContainer::ConstructL |
|
99 // |
|
100 // ---------------------------------------------------------------------------- |
|
101 // |
|
102 void CVRRecViewContainer::ConstructL( const TRect& aRect, |
|
103 MVRButtonPanelModel* aButtonModel, |
|
104 MVRDecoratorModel* aDecoratorModel, |
|
105 MVRStateInfoModel* aStateInfoModel, |
|
106 CVRRecView* aOwningView ) |
|
107 { |
|
108 CreateWindowL(); |
|
109 |
|
110 iRemConObserver = CVRRemConObserver::NewL( this ); |
|
111 |
|
112 // Get the skin instance |
|
113 iSkinInstance = AknsUtils::SkinInstance(); |
|
114 if ( !iSkinInstance ) |
|
115 { |
|
116 User::Leave( KErrNoMemory ); |
|
117 } |
|
118 |
|
119 // Create background control context for skinning the background |
|
120 iBackgroundSkinContext = CAknsBasicBackgroundControlContext::NewL( |
|
121 KAknsIIDQsnBgAreaMain, aRect, ETrue ); |
|
122 |
|
123 // Refer to Series 60 European Application LAF for coordinate descriptions |
|
124 iButtonPanel = new( ELeave ) CVRButtonPanel( aButtonModel, |
|
125 aOwningView->Id() ); |
|
126 iButtonPanel->SetContainerWindowL( *this ); |
|
127 iButtonPanel->ConstructL(); |
|
128 iButtonPanel->SetMopParent( this ); |
|
129 TAknWindowLineLayout buttonPanelLayout = AppLayout::grid_vorec_pane(); |
|
130 AknLayoutUtils::LayoutControl( iButtonPanel, Rect(), buttonPanelLayout ); |
|
131 |
|
132 // Refer to Series 60 European Application LAF for coordinate descriptions |
|
133 iStateInfoPanel = new( ELeave ) CVRStateInfoPanel( aStateInfoModel, |
|
134 aOwningView->Id() ); |
|
135 iStateInfoPanel->SetContainerWindowL( *this ); |
|
136 iStateInfoPanel->ConstructL(); |
|
137 iStateInfoPanel->SetRect( TRect( TPoint( 0,0 ), aRect.Size() ) ); |
|
138 |
|
139 // Set state info panel's MOP-parent so that it can get hold of the bg |
|
140 // control context |
|
141 iStateInfoPanel->SetMopParent( this ); |
|
142 |
|
143 iNaviPane = static_cast< CAknNavigationControlContainer* >( |
|
144 iEikonEnv->AppUiFactory()->StatusPane()->ControlL( |
|
145 TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
146 |
|
147 |
|
148 // Volume indicator with IHF icon |
|
149 iIhfVolumeControl = iNaviPane->CreateVolumeIndicatorL( |
|
150 R_AVKON_NAVI_PANE_VOLUME_INDICATOR ); |
|
151 // when touch UI is enabled |
|
152 if ( AknLayoutUtils::PenEnabled() ) |
|
153 { |
|
154 static_cast<CAknVolumeControl*> |
|
155 ( iIhfVolumeControl->DecoratedControl() )->SetObserver( this ); |
|
156 } |
|
157 |
|
158 iEarPieceVolumeControl = iNaviPane->CreateVolumeIndicatorL( |
|
159 R_AVKON_NAVI_PANE_EARPIECE_VOLUME_INDICATOR ); |
|
160 |
|
161 // when touch UI is enabled |
|
162 if ( AknLayoutUtils::PenEnabled() ) |
|
163 { |
|
164 static_cast<CAknVolumeControl*> |
|
165 ( iEarPieceVolumeControl->DecoratedControl() )->SetObserver( this ); |
|
166 } |
|
167 |
|
168 iIhfVolumeControl->MakeVisible( ETrue ); |
|
169 iEarPieceVolumeControl->MakeVisible( ETrue ); |
|
170 |
|
171 iModel = aDecoratorModel; |
|
172 iModel->SetDecoratorObserver( this ); |
|
173 |
|
174 iOwningView = aOwningView; |
|
175 |
|
176 SetRect( aRect ); |
|
177 // Update child control rects and other co-ordinates for current |
|
178 // layout ( Euro/APAC/Arabic&Hebrew ) |
|
179 UpdateLayoutL(); |
|
180 } |
|
181 |
|
182 |
|
183 // ---------------------------------------------------------------------------- |
|
184 // CVRRecViewContainer::GetHelpContext |
|
185 // |
|
186 // ---------------------------------------------------------------------------- |
|
187 // |
|
188 void CVRRecViewContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
189 { |
|
190 aContext.iMajor = TUid::Uid( KVoiceRecorderAppUID3 ); |
|
191 if ( iModel ) |
|
192 { |
|
193 iModel->GetHelpContext( aContext ); |
|
194 } |
|
195 } |
|
196 |
|
197 |
|
198 // ---------------------------------------------------------------------------- |
|
199 // CVRRecViewContainer::CountComponentControls |
|
200 // |
|
201 // ---------------------------------------------------------------------------- |
|
202 // |
|
203 TInt CVRRecViewContainer::CountComponentControls() const |
|
204 { |
|
205 return 2; |
|
206 |
|
207 } |
|
208 |
|
209 |
|
210 // ---------------------------------------------------------------------------- |
|
211 // CVRRecViewContainer::ComponentControl |
|
212 // |
|
213 // ---------------------------------------------------------------------------- |
|
214 // |
|
215 CCoeControl* CVRRecViewContainer::ComponentControl( TInt aIndex ) const |
|
216 { |
|
217 switch ( aIndex ) |
|
218 { |
|
219 case 0: |
|
220 { |
|
221 return iButtonPanel; |
|
222 } |
|
223 case 1: |
|
224 { |
|
225 return iStateInfoPanel; |
|
226 } |
|
227 |
|
228 case 2: |
|
229 { |
|
230 return iIhfVolumeControl->DecoratedControl(); |
|
231 } |
|
232 case 3: |
|
233 { |
|
234 return iEarPieceVolumeControl->DecoratedControl(); |
|
235 } |
|
236 |
|
237 default: |
|
238 { |
|
239 return NULL; |
|
240 } |
|
241 } |
|
242 } |
|
243 |
|
244 |
|
245 |
|
246 // ---------------------------------------------------------------------------- |
|
247 // CVRRecViewContainer::OfferKeyEventL |
|
248 // |
|
249 // ---------------------------------------------------------------------------- |
|
250 // |
|
251 TKeyResponse CVRRecViewContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
252 TEventCode aType ) |
|
253 { |
|
254 TBool consumed( EFalse ); |
|
255 |
|
256 if ( aType == EEventKeyDown ) |
|
257 { |
|
258 aType = aType; |
|
259 } |
|
260 |
|
261 if ( iKeyObserver ) |
|
262 { |
|
263 consumed = iKeyObserver->ProcessKeyEventL( aKeyEvent, aType ); |
|
264 } |
|
265 |
|
266 if ( !consumed ) |
|
267 { |
|
268 if ( iActiveVolumeControl && iVolumeChangeObserver->CanSetVolume() && |
|
269 !FeatureManager::FeatureSupported( KFeatureIdSideVolumeKeys ) ) |
|
270 { |
|
271 if ( ( aKeyEvent.iCode == EKeyLeftArrow ) || |
|
272 ( aKeyEvent.iCode == EKeyRightArrow ) ) |
|
273 { |
|
274 HandleVolumeChangeL( aKeyEvent, aType ); |
|
275 } |
|
276 } |
|
277 |
|
278 return iButtonPanel->OfferKeyEventL( aKeyEvent, aType ); |
|
279 } |
|
280 |
|
281 return EKeyWasNotConsumed; |
|
282 |
|
283 } |
|
284 |
|
285 |
|
286 // ---------------------------------------------------------------------------- |
|
287 // CVRRecViewContainer::SizeChanged |
|
288 // |
|
289 // ---------------------------------------------------------------------------- |
|
290 // |
|
291 void CVRRecViewContainer::SizeChanged() |
|
292 { |
|
293 iStateInfoPanel->SetRect( Rect() ); |
|
294 |
|
295 TRect bgRect; |
|
296 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, bgRect); |
|
297 iBackgroundSkinContext->SetRect( bgRect ); |
|
298 |
|
299 TAknWindowLineLayout buttonPanelLayout = AppLayout::grid_vorec_pane(); |
|
300 AknLayoutUtils::LayoutControl( iButtonPanel, Rect(), buttonPanelLayout ); |
|
301 |
|
302 TAknWindowLineLayout statusPaneLayout = |
|
303 AknLayout::status_pane( Rect(), 0 ); |
|
304 |
|
305 TAknLayoutRect statusPanelRect; |
|
306 statusPanelRect.LayoutRect( Rect(), statusPaneLayout ); |
|
307 |
|
308 TAknWindowLineLayout verticalLineLayout = |
|
309 AppLayout::Voice_Recorder_elements_Line_2(); |
|
310 |
|
311 iVerticalLineRect.LayoutRect( statusPanelRect.Rect(), verticalLineLayout ); |
|
312 |
|
313 TAknWindowLineLayout horizontalLineLayout = |
|
314 AppLayout::Voice_Recorder_elements_Line_3(); |
|
315 |
|
316 iHorizontalLineRect.LayoutRect( statusPanelRect.Rect(), |
|
317 horizontalLineLayout ); |
|
318 } |
|
319 |
|
320 |
|
321 |
|
322 // ---------------------------------------------------------------------------- |
|
323 // CVRRecViewContainer::Draw |
|
324 // |
|
325 // ---------------------------------------------------------------------------- |
|
326 // |
|
327 void CVRRecViewContainer::Draw( const TRect& /*aRect*/ ) const |
|
328 { |
|
329 CWindowGc& gc = SystemGc(); |
|
330 |
|
331 // Fill the background with the background bitmap from the skin |
|
332 // Note: if the skin doesn't define a background the area is simply |
|
333 // cleared (which is OK for us). |
|
334 AknsDrawUtils::Background( iSkinInstance, iBackgroundSkinContext, |
|
335 this, gc, Rect() ); |
|
336 |
|
337 iVerticalLineRect.DrawRect( gc ); |
|
338 iHorizontalLineRect.DrawRect( gc ); |
|
339 } |
|
340 |
|
341 |
|
342 // ---------------------------------------------------------------------------- |
|
343 // CVRRecViewContainer::SetKeyObserver |
|
344 // |
|
345 // ---------------------------------------------------------------------------- |
|
346 // |
|
347 void CVRRecViewContainer::SetKeyObserver( MVRKeyObserver* aObserver ) |
|
348 { |
|
349 iKeyObserver = aObserver; |
|
350 } |
|
351 |
|
352 |
|
353 // ---------------------------------------------------------------------------- |
|
354 // CVRRecViewContainer::SetVolumeChangeObserver |
|
355 // |
|
356 // ---------------------------------------------------------------------------- |
|
357 // |
|
358 void CVRRecViewContainer::SetVolumeChangeObserver( |
|
359 MVRVolumeChangeObserver* aObserver ) |
|
360 { |
|
361 iVolumeChangeObserver = aObserver; |
|
362 } |
|
363 |
|
364 |
|
365 // ---------------------------------------------------------------------------- |
|
366 // CVRRecViewContainer::Update |
|
367 // |
|
368 // ---------------------------------------------------------------------------- |
|
369 // |
|
370 void CVRRecViewContainer::Update( TVRUpdateCommand aCommand ) |
|
371 { |
|
372 |
|
373 if ( aCommand == EVRUpdateCBA ) |
|
374 { |
|
375 UpdateCBA(); |
|
376 return; |
|
377 } |
|
378 |
|
379 // Change menubar |
|
380 iOwningView->MenuBar()->SetMenuTitleResourceId( |
|
381 iModel->MenuBarResourceId() ); |
|
382 |
|
383 // error ignored, this rarely leaves but just to make sure |
|
384 TRAP_IGNORE( iNaviPane = static_cast< CAknNavigationControlContainer* >(iEikonEnv->AppUiFactory()->StatusPane()->ControlL( // CSI: 42 # |
|
385 TUid::Uid( EEikStatusPaneUidNavi ) ) ) ); |
|
386 |
|
387 iNaviPane->DrawNow(); |
|
388 |
|
389 UpdateCBA(); |
|
390 |
|
391 TRAP_IGNORE( UpdateVolumeControlL() ); |
|
392 } |
|
393 |
|
394 |
|
395 // ---------------------------------------------------------------------------- |
|
396 // CVRRecViewContainer::UpdateCBA |
|
397 // Updates the CBA buttons (LSK, MSK & RSK) according to the current state and |
|
398 // draws them |
|
399 // ---------------------------------------------------------------------------- |
|
400 // |
|
401 void CVRRecViewContainer::UpdateCBA() |
|
402 { |
|
403 // Change CBA buttons |
|
404 // Ignore any errors. SetCommandSetL() will leave if there is |
|
405 // not enough memory |
|
406 CEikButtonGroupContainer* cba = iOwningView->Cba(); |
|
407 |
|
408 // e.g. recording is about to start and options menu shouldn't be opened |
|
409 if ( iModel->CbaResourceId() == R_VR_SOFTKEYS_OPTIONS_EXIT_SELECT && |
|
410 !iModel->CBAEnabled() ) |
|
411 { |
|
412 // Same texts remain but disables LSK and RSK use |
|
413 TRAP_IGNORE( cba->SetCommandSetL( |
|
414 R_VR_SOFTKEYS_OPTIONS_EXIT_SELECT_NO_COMMAND ) ); |
|
415 } |
|
416 |
|
417 // jeffery: added for CR to disable "Pause" key, will remove it later when plugin is updatedd |
|
418 |
|
419 #ifdef __AAC_ENCODER_PLUGIN |
|
420 if (!iOwningView->IsEmbedded() && (iOwningView->Quality() == EQualityHigh) && (iOwningView->GetStateId() == EStateRecording )) |
|
421 |
|
422 { |
|
423 TRAP_IGNORE(cba->SetCommandSetL(R_VR_SOFTKEYS_STOP_SELECT)); |
|
424 } |
|
425 #endif |
|
426 |
|
427 else |
|
428 { |
|
429 // Normal behaviour |
|
430 TRAP_IGNORE( cba->SetCommandSetL( iModel->CbaResourceId() ) ); |
|
431 } |
|
432 |
|
433 cba->DrawNow(); |
|
434 } |
|
435 |
|
436 |
|
437 // ---------------------------------------------------------------------------- |
|
438 // CVRRecViewContainer::UpdateVolumeControlL |
|
439 // |
|
440 // ---------------------------------------------------------------------------- |
|
441 // |
|
442 void CVRRecViewContainer::UpdateVolumeControlL() |
|
443 { |
|
444 TVRVolumeControlState state; |
|
445 TInt volume; |
|
446 |
|
447 // Get volume control data from model |
|
448 iModel->GetVolumeControlState( state, volume ); |
|
449 |
|
450 if ( iActiveVolumeControl ) |
|
451 { |
|
452 // pop the previous volume control if there was one |
|
453 iNaviPane->Pop(); |
|
454 } |
|
455 |
|
456 switch ( state ) |
|
457 { |
|
458 case EDisabled: |
|
459 { |
|
460 iActiveVolumeControl = NULL; |
|
461 break; |
|
462 } |
|
463 |
|
464 case EIhf: |
|
465 { |
|
466 |
|
467 iActiveVolumeControl = iIhfVolumeControl; |
|
468 |
|
469 break; |
|
470 } |
|
471 |
|
472 case EEarPiece: |
|
473 { |
|
474 |
|
475 iActiveVolumeControl = iEarPieceVolumeControl; |
|
476 break; |
|
477 } |
|
478 } |
|
479 |
|
480 if ( state != EDisabled ) |
|
481 if(iActiveVolumeControl != NULL) |
|
482 { |
|
483 iNaviPane->PushL( *iActiveVolumeControl ); |
|
484 CAknVolumeControl* control = static_cast< CAknVolumeControl* >( |
|
485 iActiveVolumeControl->DecoratedControl() ); |
|
486 |
|
487 |
|
488 control->SetValue( volume ); |
|
489 } |
|
490 } |
|
491 |
|
492 |
|
493 // ---------------------------------------------------------------------------- |
|
494 // CVRRecViewContainer::UpdateLayoutL |
|
495 // |
|
496 // ---------------------------------------------------------------------------- |
|
497 // |
|
498 void CVRRecViewContainer::UpdateLayoutL() |
|
499 { |
|
500 SizeChanged(); |
|
501 } |
|
502 |
|
503 |
|
504 // ---------------------------------------------------------------------------- |
|
505 // CVRRecViewContainer::MopSupplyObject |
|
506 // |
|
507 // ---------------------------------------------------------------------------- |
|
508 // |
|
509 TTypeUid::Ptr CVRRecViewContainer::MopSupplyObject(TTypeUid aId) |
|
510 { |
|
511 if ( aId.iUid == MAknsControlContext::ETypeId ) |
|
512 { |
|
513 // Return the control context for the childs |
|
514 return MAknsControlContext::SupplyMopObject( aId, iBackgroundSkinContext ); |
|
515 } |
|
516 return CCoeControl::MopSupplyObject( aId ); |
|
517 } |
|
518 |
|
519 |
|
520 // ---------------------------------------------------------------------------- |
|
521 // CVRRecViewContainer::HandleResourceChangeL |
|
522 // |
|
523 // ---------------------------------------------------------------------------- |
|
524 // |
|
525 void CVRRecViewContainer::HandleResourceChangeL( TInt aType ) |
|
526 { |
|
527 CCoeControl::HandleResourceChange( aType ); |
|
528 |
|
529 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
530 { |
|
531 UpdateLayoutL(); |
|
532 } |
|
533 else if ( aType == KAknsMessageSkinChange ) |
|
534 { |
|
535 // New skin instance is loaded |
|
536 iSkinInstance = AknsUtils::SkinInstance(); |
|
537 } |
|
538 |
|
539 // Inform other controls |
|
540 iButtonPanel->HandleResourceChangeL( aType ); |
|
541 iStateInfoPanel->HandleResourceChangeL( aType ); |
|
542 |
|
543 } |
|
544 |
|
545 |
|
546 // ---------------------------------------------------------------------------- |
|
547 // CVRRecViewContainer::HandleVolumeChangeL |
|
548 // |
|
549 // ---------------------------------------------------------------------------- |
|
550 // |
|
551 TInt CVRRecViewContainer::HandleVolumeChangeL( const TKeyEvent& aKeyEvent, |
|
552 TEventCode aType ) |
|
553 { |
|
554 |
|
555 if( iActiveVolumeControl == NULL || iVolumeChangeObserver == NULL || !iVolumeChangeObserver->CanSetVolume() ) |
|
556 { |
|
557 // Can't process volume change yet |
|
558 return KErrNotReady; |
|
559 } |
|
560 |
|
561 CAknAppUi* appUi = static_cast< CAknAppUi* >( |
|
562 iEikonEnv->EikAppUi() ); |
|
563 CAknVolumeControl* control = static_cast< CAknVolumeControl* > |
|
564 ( iActiveVolumeControl->DecoratedControl() ); |
|
565 |
|
566 TInt prevLevel( control->Value() ); |
|
567 |
|
568 control->OfferKeyEventL( aKeyEvent, aType ); |
|
569 |
|
570 // Values range from 1 to 10 so the cast is ok |
|
571 TUint8 newValue( ( TUint8 ) control->Value() ); |
|
572 |
|
573 if ( iVolumeChangeObserver ) |
|
574 { |
|
575 iVolumeChangeObserver->SetVolume( newValue, |
|
576 KVRMaxVolumeSteps ); |
|
577 } |
|
578 |
|
579 // determine if the volume was already at either end |
|
580 // (of the scale) |
|
581 // play a system sound in that case. |
|
582 if ( prevLevel == control->Value() ) |
|
583 { |
|
584 TInt sid( EAvkonSIDVolumeMaxTone ); |
|
585 if ( prevLevel == 1 ) |
|
586 { |
|
587 sid = EAvkonSIDVolumeMinTone; |
|
588 } |
|
589 appUi->KeySounds()->PlaySound( sid ); |
|
590 return KErrTooBig; |
|
591 } |
|
592 |
|
593 return KErrNone; |
|
594 } |
|
595 |
|
596 |
|
597 // --------------------------------------------------------------------------- |
|
598 // CVRRecViewContainer::HandlePointerEventL |
|
599 // Handles pointer events by passing them on to controls |
|
600 // --------------------------------------------------------------------------- |
|
601 // |
|
602 void CVRRecViewContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
603 { |
|
604 if( AknLayoutUtils::PenEnabled() ) |
|
605 { |
|
606 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
607 iButtonPanel->HandlePointerEventL(aPointerEvent); |
|
608 |
|
609 if ( iActiveVolumeControl && iVolumeChangeObserver->CanSetVolume() ) |
|
610 { |
|
611 if ( (iOwningView->GetStateId() == EStatePlayingPaused ) || (iOwningView->GetStateId() == EStatePlaying ) ) |
|
612 { |
|
613 // pop the previous volume control if there was one |
|
614 CAknVolumeControl* control = static_cast< CAknVolumeControl* > |
|
615 ( iActiveVolumeControl->DecoratedControl() ); |
|
616 CAknVolumePopup* popup = static_cast<CAknVolumePopup*> ( control->Parent() ); |
|
617 TRect volumePopupRect( popup->Rect() ); |
|
618 volumePopupRect.Move( popup->Position() ); |
|
619 if( volumePopupRect.Contains(aPointerEvent.iParentPosition) ) |
|
620 { |
|
621 TRAP_IGNORE( popup->ShowVolumePopupL() ); |
|
622 } |
|
623 } |
|
624 } |
|
625 } |
|
626 } |
|
627 |
|
628 // --------------------------------------------------------------------------- |
|
629 // CVRRecViewContainer::FocusedButton |
|
630 // Returns the currently focused button in Button Panel |
|
631 // --------------------------------------------------------------------------- |
|
632 // |
|
633 TInt CVRRecViewContainer::FocusedButton() const |
|
634 { |
|
635 return iButtonPanel->FocusedButton(); |
|
636 } |
|
637 |
|
638 |
|
639 // --------------------------------------------------------------------------- |
|
640 // CVRRecViewContainer::UpdateButtonPanel |
|
641 // Gives the update command to Button Panel |
|
642 // --------------------------------------------------------------------------- |
|
643 // |
|
644 void CVRRecViewContainer::UpdateButtonPanel( TVRUpdateCommand aCommand ) |
|
645 { |
|
646 iButtonPanel->Update( aCommand ); |
|
647 } |
|
648 |
|
649 |
|
650 // ---------------------------------------------------------------------------- |
|
651 // void CVRRecViewContainer::HandleControlEventL |
|
652 // ---------------------------------------------------------------------------- |
|
653 // |
|
654 void CVRRecViewContainer::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) |
|
655 { |
|
656 // Added for touch UI to adjust volume |
|
657 if( AknLayoutUtils::PenEnabled() ) |
|
658 { |
|
659 switch( aEventType ) |
|
660 { |
|
661 case EEventStateChanged: |
|
662 { |
|
663 if ( iActiveVolumeControl && aControl == static_cast< CAknVolumeControl*>(iActiveVolumeControl->DecoratedControl())) |
|
664 { |
|
665 if(iVolumeChangeObserver == NULL || !iVolumeChangeObserver->CanSetVolume() ) |
|
666 { |
|
667 // Can't process volume change yet |
|
668 User::Leave(KErrNotReady); |
|
669 } |
|
670 |
|
671 CAknAppUi* appUi = static_cast< CAknAppUi* >(iEikonEnv->EikAppUi() ); |
|
672 CAknVolumeControl* control = static_cast< CAknVolumeControl* >(iActiveVolumeControl->DecoratedControl() ); |
|
673 |
|
674 TInt prevLevel( control->Value() ); |
|
675 |
|
676 // Values range from 1 to 10 so the cast is ok |
|
677 TUint8 newValue( ( TUint8 ) control->Value() ); |
|
678 |
|
679 if ( iVolumeChangeObserver ) |
|
680 { |
|
681 iVolumeChangeObserver->SetVolume( newValue, KVRMaxVolumeSteps ); |
|
682 } |
|
683 |
|
684 TInt sid( EAvkonSIDStandardKeyClick ); |
|
685 |
|
686 if ( prevLevel <= KVRVolumeControlMin ) |
|
687 { |
|
688 sid = EAvkonSIDVolumeMinTone; |
|
689 } |
|
690 else if ( prevLevel >= KVRVolumeControlMax ) |
|
691 { |
|
692 sid = EAvkonSIDVolumeMaxTone; |
|
693 } |
|
694 appUi->KeySounds()->PlaySound( sid ); |
|
695 User::Leave(KErrTooBig); |
|
696 |
|
697 } |
|
698 else if(iActiveVolumeControl == NULL) |
|
699 { |
|
700 User::Leave(KErrNotReady); |
|
701 } |
|
702 } |
|
703 default: |
|
704 break; |
|
705 } |
|
706 } |
|
707 } |