os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSSetPlayWindowDialog.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Part of the MVS Application for TechView
sl@0
    15
//
sl@0
    16
sl@0
    17
sl@0
    18
#include "MVSSetPlayWindowDialog.h"
sl@0
    19
#include "MVSApp.hrh"
sl@0
    20
#include "MVSAppUI.h"
sl@0
    21
sl@0
    22
sl@0
    23
void CMVSSetPlayWindowDialog::SetupDialogLD(TTimeIntervalMicroSeconds aStart,
sl@0
    24
                                  TTimeIntervalMicroSeconds aEnd,
sl@0
    25
                                  TTimeIntervalMicroSeconds aMaxDuration, CMVSAppUi* aAppUi)
sl@0
    26
	{
sl@0
    27
    CMVSSetPlayWindowDialog* dialog = new (ELeave) CMVSSetPlayWindowDialog(aStart,aEnd,
sl@0
    28
                                                       aMaxDuration, aAppUi);
sl@0
    29
    dialog->ExecuteLD(R_MVS_DIALOG_SETPLAYWINDOW);
sl@0
    30
    }
sl@0
    31
sl@0
    32
void CMVSSetPlayWindowDialog::PreLayoutDynInitL()
sl@0
    33
    {
sl@0
    34
    // Get a downcasted pointer to the controls
sl@0
    35
    CEikNumberEditor* control = static_cast<CEikNumberEditor*> ( Control((TInt)EMVSCmdSetPlayWindowStart) );        
sl@0
    36
	control->SetMinimumAndMaximum(0, (iMaxDuration.Int64()));
sl@0
    37
	control->SetNumber(iStart.Int64());
sl@0
    38
    control = static_cast<CEikNumberEditor*> ( Control((TInt)EMVSCmdSetPlayWindowEnd) );
sl@0
    39
    control->SetMinimumAndMaximum(0, iMaxDuration.Int64());
sl@0
    40
    control->SetNumber(iEnd.Int64());
sl@0
    41
    }
sl@0
    42
sl@0
    43
sl@0
    44
CMVSSetPlayWindowDialog::CMVSSetPlayWindowDialog(TTimeIntervalMicroSeconds aStart,
sl@0
    45
                             TTimeIntervalMicroSeconds aEnd,TTimeIntervalMicroSeconds aMaxDuration, CMVSAppUi* aAppUi)
sl@0
    46
: iStart(aStart), iEnd(aEnd), iMaxDuration(aMaxDuration), iAppUi(aAppUi)
sl@0
    47
    {
sl@0
    48
    
sl@0
    49
    }
sl@0
    50
sl@0
    51
sl@0
    52
TKeyResponse CMVSSetPlayWindowDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
sl@0
    53
	{
sl@0
    54
	if(aKeyEvent.iCode == EKeyEnter && aType == EEventKeyDown)
sl@0
    55
		{
sl@0
    56
		OkToExitL(EMVSButtonUpdate);
sl@0
    57
		}
sl@0
    58
	return CEikDialog::OfferKeyEventL(aKeyEvent,aType);
sl@0
    59
	}
sl@0
    60
	
sl@0
    61
sl@0
    62
TBool CMVSSetPlayWindowDialog::OkToExitL(TInt aButtonId)
sl@0
    63
    {
sl@0
    64
    // Get a pointer to the progress bar control.
sl@0
    65
    // Downcast the returned CCoeControl* pointer to the correct type.
sl@0
    66
    CEikNumberEditor* controlstart = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetPlayWindowStart));
sl@0
    67
	CEikNumberEditor* controlend = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetPlayWindowEnd));
sl@0
    68
	TBool result = ETrue;
sl@0
    69
    switch(aButtonId)
sl@0
    70
    	{
sl@0
    71
        case(EMVSButtonUpdate):
sl@0
    72
        	{
sl@0
    73
        	TInt positionstart = controlstart->Number();
sl@0
    74
    		TInt64 posstart64(positionstart);
sl@0
    75
    		TInt positionend = controlend->Number();
sl@0
    76
    		TInt64 posend64(positionend);
sl@0
    77
            //Port these values over to the AppUi
sl@0
    78
            result = iAppUi->SetPlayWindow(TTimeIntervalMicroSeconds(posstart64), TTimeIntervalMicroSeconds(posend64));
sl@0
    79
            //if the play window can not be set with the values, restore to previous values
sl@0
    80
            if(!result)
sl@0
    81
            	{
sl@0
    82
            	controlstart->SetNumber(iStart.Int64());
sl@0
    83
            	controlstart->DrawNow();
sl@0
    84
            	controlend->SetNumber(iEnd.Int64());
sl@0
    85
            	controlend->DrawNow();
sl@0
    86
            	}
sl@0
    87
        	}
sl@0
    88
        	break;
sl@0
    89
sl@0
    90
        default:
sl@0
    91
        	break;
sl@0
    92
        }
sl@0
    93
     
sl@0
    94
    return result;
sl@0
    95
    }
sl@0
    96