os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSSetPlayWindowDialog.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSSetPlayWindowDialog.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,96 @@
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 +
1.21 +#include "MVSSetPlayWindowDialog.h"
1.22 +#include "MVSApp.hrh"
1.23 +#include "MVSAppUI.h"
1.24 +
1.25 +
1.26 +void CMVSSetPlayWindowDialog::SetupDialogLD(TTimeIntervalMicroSeconds aStart,
1.27 + TTimeIntervalMicroSeconds aEnd,
1.28 + TTimeIntervalMicroSeconds aMaxDuration, CMVSAppUi* aAppUi)
1.29 + {
1.30 + CMVSSetPlayWindowDialog* dialog = new (ELeave) CMVSSetPlayWindowDialog(aStart,aEnd,
1.31 + aMaxDuration, aAppUi);
1.32 + dialog->ExecuteLD(R_MVS_DIALOG_SETPLAYWINDOW);
1.33 + }
1.34 +
1.35 +void CMVSSetPlayWindowDialog::PreLayoutDynInitL()
1.36 + {
1.37 + // Get a downcasted pointer to the controls
1.38 + CEikNumberEditor* control = static_cast<CEikNumberEditor*> ( Control((TInt)EMVSCmdSetPlayWindowStart) );
1.39 + control->SetMinimumAndMaximum(0, (iMaxDuration.Int64()));
1.40 + control->SetNumber(iStart.Int64());
1.41 + control = static_cast<CEikNumberEditor*> ( Control((TInt)EMVSCmdSetPlayWindowEnd) );
1.42 + control->SetMinimumAndMaximum(0, iMaxDuration.Int64());
1.43 + control->SetNumber(iEnd.Int64());
1.44 + }
1.45 +
1.46 +
1.47 +CMVSSetPlayWindowDialog::CMVSSetPlayWindowDialog(TTimeIntervalMicroSeconds aStart,
1.48 + TTimeIntervalMicroSeconds aEnd,TTimeIntervalMicroSeconds aMaxDuration, CMVSAppUi* aAppUi)
1.49 +: iStart(aStart), iEnd(aEnd), iMaxDuration(aMaxDuration), iAppUi(aAppUi)
1.50 + {
1.51 +
1.52 + }
1.53 +
1.54 +
1.55 +TKeyResponse CMVSSetPlayWindowDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
1.56 + {
1.57 + if(aKeyEvent.iCode == EKeyEnter && aType == EEventKeyDown)
1.58 + {
1.59 + OkToExitL(EMVSButtonUpdate);
1.60 + }
1.61 + return CEikDialog::OfferKeyEventL(aKeyEvent,aType);
1.62 + }
1.63 +
1.64 +
1.65 +TBool CMVSSetPlayWindowDialog::OkToExitL(TInt aButtonId)
1.66 + {
1.67 + // Get a pointer to the progress bar control.
1.68 + // Downcast the returned CCoeControl* pointer to the correct type.
1.69 + CEikNumberEditor* controlstart = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetPlayWindowStart));
1.70 + CEikNumberEditor* controlend = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetPlayWindowEnd));
1.71 + TBool result = ETrue;
1.72 + switch(aButtonId)
1.73 + {
1.74 + case(EMVSButtonUpdate):
1.75 + {
1.76 + TInt positionstart = controlstart->Number();
1.77 + TInt64 posstart64(positionstart);
1.78 + TInt positionend = controlend->Number();
1.79 + TInt64 posend64(positionend);
1.80 + //Port these values over to the AppUi
1.81 + result = iAppUi->SetPlayWindow(TTimeIntervalMicroSeconds(posstart64), TTimeIntervalMicroSeconds(posend64));
1.82 + //if the play window can not be set with the values, restore to previous values
1.83 + if(!result)
1.84 + {
1.85 + controlstart->SetNumber(iStart.Int64());
1.86 + controlstart->DrawNow();
1.87 + controlend->SetNumber(iEnd.Int64());
1.88 + controlend->DrawNow();
1.89 + }
1.90 + }
1.91 + break;
1.92 +
1.93 + default:
1.94 + break;
1.95 + }
1.96 +
1.97 + return result;
1.98 + }
1.99 +