os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSVolumeDialog.cpp
Update contrib.
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Part of the MVS Application for TechView
17 #include "MVSVolumeDialog.h"
22 void CMVSVolumeDialog::SetupDialogLD(TInt aVolume, TTimeIntervalMicroSeconds aRamp,
23 TTimeIntervalMicroSeconds aClipLength, TBool aPlayback, CMVSAppUi* aAppUi)
25 CMVSVolumeDialog* dialog = new (ELeave) CMVSVolumeDialog(aVolume, aRamp, aClipLength, aPlayback, aAppUi);
26 dialog->ExecuteLD(R_MVS_DIALOG_SETVOLUME);
30 void CMVSVolumeDialog::PreLayoutDynInitL()
32 _LIT(KTitle1,"SetVolume");
33 _LIT(KTitle2,"SetGain");
42 // Get a downcasted pointer to the controls
43 CCoeControl* myControlPtr = this->Control(EMVSCmdSetVolume);
44 iProgInfo = static_cast<CEikProgressInfo*>(myControlPtr);
46 iProgInfo->SetAndDraw(iVolume);
48 InitControl((TInt)EMVSCmdSetVolumeRamp, I64INT(iRamp.Int64())/1000, 0, I64INT(iClipLength.Int64())/1000);
52 CMVSVolumeDialog::CMVSVolumeDialog(TInt aVolume, TTimeIntervalMicroSeconds aRamp,
53 TTimeIntervalMicroSeconds aClipLength, TBool aPlayback, CMVSAppUi* aAppUi)
54 : iVolume(aVolume), iRamp(aRamp), iClipLength(aClipLength), iPlayback(aPlayback), iAppUi(aAppUi), iOldVolume(aVolume)
59 TKeyResponse CMVSVolumeDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
61 if(aKeyEvent.iCode == EKeyEscape && aType == EEventKeyDown)
63 OkToExitL(EMVSButtonCancel);
65 else if(aKeyEvent.iCode == EKeyRightArrow)
67 OkToExitL(EMVSButtonUp);
69 else if(aKeyEvent.iCode == EKeyLeftArrow)
71 OkToExitL(EMVSButtonDown);
74 return CEikDialog::OfferKeyEventL(aKeyEvent,aType);
78 TBool CMVSVolumeDialog::OkToExitL(TInt aButtonId)
80 // Get a pointer to the progress bar control.
81 // Downcast the returned CCoeControl* pointer to the correct type.
82 CCoeControl* myControlPtr = this->Control(EMVSCmdSetVolume);
83 iProgInfo = static_cast<CEikProgressInfo*>(myControlPtr);
84 CEikNumberEditor* control = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetVolumeRamp));
87 case (EMVSButtonCancel):
88 iAppUi->SetVolumeL(iOldVolume, iRamp);
94 iProgInfo->IncrementAndDraw(-5);
95 iVolume = iProgInfo->CurrentValue();
96 iRamp = control->Number()*1000;
97 iAppUi->SetVolumeL(iVolume, iRamp);
104 iProgInfo->IncrementAndDraw(5);
105 iVolume = iProgInfo->CurrentValue();
106 iRamp = control->Number()*1000;
107 iAppUi->SetVolumeL(iVolume, iRamp);
121 void CMVSVolumeDialog::InitControl( const TInt aId, const TInt aRamp, const TInt aStart, const TInt aFinish )
123 CEikNumberEditor* control = static_cast<CEikNumberEditor*> ( Control(aId) );
126 control->SetNumber(aRamp);
127 control->SetMinimumAndMaximum( aStart, aFinish );