os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSVolumeDialog.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSVolumeDialog.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,130 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Part of the MVS Application for TechView
1.18 +//
1.19 +
1.20 +#include "MVSVolumeDialog.h"
1.21 +#include "MVSApp.hrh"
1.22 +#include "MVSAppUI.h"
1.23 +
1.24 +
1.25 +void CMVSVolumeDialog::SetupDialogLD(TInt aVolume, TTimeIntervalMicroSeconds aRamp,
1.26 + TTimeIntervalMicroSeconds aClipLength, TBool aPlayback, CMVSAppUi* aAppUi)
1.27 + {
1.28 + CMVSVolumeDialog* dialog = new (ELeave) CMVSVolumeDialog(aVolume, aRamp, aClipLength, aPlayback, aAppUi);
1.29 + dialog->ExecuteLD(R_MVS_DIALOG_SETVOLUME);
1.30 + }
1.31 +
1.32 +
1.33 +void CMVSVolumeDialog::PreLayoutDynInitL()
1.34 + {
1.35 + _LIT(KTitle1,"SetVolume");
1.36 + _LIT(KTitle2,"SetGain");
1.37 + if(iPlayback)
1.38 + {
1.39 + SetTitleL(KTitle1);
1.40 + }
1.41 + else
1.42 + {
1.43 + SetTitleL(KTitle2);
1.44 + }
1.45 + // Get a downcasted pointer to the controls
1.46 + CCoeControl* myControlPtr = this->Control(EMVSCmdSetVolume);
1.47 + iProgInfo = static_cast<CEikProgressInfo*>(myControlPtr);
1.48 + //Initial Volume
1.49 + iProgInfo->SetAndDraw(iVolume);
1.50 + //Initial VolumeRamp
1.51 + InitControl((TInt)EMVSCmdSetVolumeRamp, I64INT(iRamp.Int64())/1000, 0, I64INT(iClipLength.Int64())/1000);
1.52 + }
1.53 +
1.54 +
1.55 +CMVSVolumeDialog::CMVSVolumeDialog(TInt aVolume, TTimeIntervalMicroSeconds aRamp,
1.56 + TTimeIntervalMicroSeconds aClipLength, TBool aPlayback, CMVSAppUi* aAppUi)
1.57 +: iVolume(aVolume), iRamp(aRamp), iClipLength(aClipLength), iPlayback(aPlayback), iAppUi(aAppUi), iOldVolume(aVolume)
1.58 + {
1.59 + }
1.60 +
1.61 +
1.62 +TKeyResponse CMVSVolumeDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
1.63 + {
1.64 + if(aKeyEvent.iCode == EKeyEscape && aType == EEventKeyDown)
1.65 + {
1.66 + OkToExitL(EMVSButtonCancel);
1.67 + }
1.68 + else if(aKeyEvent.iCode == EKeyRightArrow)
1.69 + {
1.70 + OkToExitL(EMVSButtonUp);
1.71 + }
1.72 + else if(aKeyEvent.iCode == EKeyLeftArrow)
1.73 + {
1.74 + OkToExitL(EMVSButtonDown);
1.75 + }
1.76 +
1.77 + return CEikDialog::OfferKeyEventL(aKeyEvent,aType);
1.78 + }
1.79 +
1.80 +
1.81 +TBool CMVSVolumeDialog::OkToExitL(TInt aButtonId)
1.82 + {
1.83 + // Get a pointer to the progress bar control.
1.84 + // Downcast the returned CCoeControl* pointer to the correct type.
1.85 + CCoeControl* myControlPtr = this->Control(EMVSCmdSetVolume);
1.86 + iProgInfo = static_cast<CEikProgressInfo*>(myControlPtr);
1.87 + CEikNumberEditor* control = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetVolumeRamp));
1.88 + switch(aButtonId)
1.89 + {
1.90 + case (EMVSButtonCancel):
1.91 + iAppUi->SetVolumeL(iOldVolume, iRamp);
1.92 + return ETrue;
1.93 +
1.94 + case(EMVSButtonDown):
1.95 + if(iProgInfo)
1.96 + {
1.97 + iProgInfo->IncrementAndDraw(-5);
1.98 + iVolume = iProgInfo->CurrentValue();
1.99 + iRamp = control->Number()*1000;
1.100 + iAppUi->SetVolumeL(iVolume, iRamp);
1.101 + }
1.102 + break;
1.103 +
1.104 + case(EMVSButtonUp):
1.105 + if(iProgInfo)
1.106 + {
1.107 + iProgInfo->IncrementAndDraw(5);
1.108 + iVolume = iProgInfo->CurrentValue();
1.109 + iRamp = control->Number()*1000;
1.110 + iAppUi->SetVolumeL(iVolume, iRamp);
1.111 + }
1.112 + break;
1.113 +
1.114 + case(EMVSButtonOk):
1.115 + default:
1.116 + return ETrue;
1.117 + }
1.118 +
1.119 + return EFalse;
1.120 + }
1.121 +
1.122 +
1.123 +
1.124 +void CMVSVolumeDialog::InitControl( const TInt aId, const TInt aRamp, const TInt aStart, const TInt aFinish )
1.125 + {
1.126 + CEikNumberEditor* control = static_cast<CEikNumberEditor*> ( Control(aId) );
1.127 + if(control)
1.128 + {
1.129 + control->SetNumber(aRamp);
1.130 + control->SetMinimumAndMaximum( aStart, aFinish );
1.131 + }
1.132 +
1.133 + }