|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Part of the MVS Application for TechView |
|
15 // |
|
16 |
|
17 |
|
18 #include "MVSSetPlayWindowDialog.h" |
|
19 #include "MVSApp.hrh" |
|
20 #include "MVSAppUI.h" |
|
21 |
|
22 |
|
23 void CMVSSetPlayWindowDialog::SetupDialogLD(TTimeIntervalMicroSeconds aStart, |
|
24 TTimeIntervalMicroSeconds aEnd, |
|
25 TTimeIntervalMicroSeconds aMaxDuration, CMVSAppUi* aAppUi) |
|
26 { |
|
27 CMVSSetPlayWindowDialog* dialog = new (ELeave) CMVSSetPlayWindowDialog(aStart,aEnd, |
|
28 aMaxDuration, aAppUi); |
|
29 dialog->ExecuteLD(R_MVS_DIALOG_SETPLAYWINDOW); |
|
30 } |
|
31 |
|
32 void CMVSSetPlayWindowDialog::PreLayoutDynInitL() |
|
33 { |
|
34 // Get a downcasted pointer to the controls |
|
35 CEikNumberEditor* control = static_cast<CEikNumberEditor*> ( Control((TInt)EMVSCmdSetPlayWindowStart) ); |
|
36 control->SetMinimumAndMaximum(0, (iMaxDuration.Int64())); |
|
37 control->SetNumber(iStart.Int64()); |
|
38 control = static_cast<CEikNumberEditor*> ( Control((TInt)EMVSCmdSetPlayWindowEnd) ); |
|
39 control->SetMinimumAndMaximum(0, iMaxDuration.Int64()); |
|
40 control->SetNumber(iEnd.Int64()); |
|
41 } |
|
42 |
|
43 |
|
44 CMVSSetPlayWindowDialog::CMVSSetPlayWindowDialog(TTimeIntervalMicroSeconds aStart, |
|
45 TTimeIntervalMicroSeconds aEnd,TTimeIntervalMicroSeconds aMaxDuration, CMVSAppUi* aAppUi) |
|
46 : iStart(aStart), iEnd(aEnd), iMaxDuration(aMaxDuration), iAppUi(aAppUi) |
|
47 { |
|
48 |
|
49 } |
|
50 |
|
51 |
|
52 TKeyResponse CMVSSetPlayWindowDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) |
|
53 { |
|
54 if(aKeyEvent.iCode == EKeyEnter && aType == EEventKeyDown) |
|
55 { |
|
56 OkToExitL(EMVSButtonUpdate); |
|
57 } |
|
58 return CEikDialog::OfferKeyEventL(aKeyEvent,aType); |
|
59 } |
|
60 |
|
61 |
|
62 TBool CMVSSetPlayWindowDialog::OkToExitL(TInt aButtonId) |
|
63 { |
|
64 // Get a pointer to the progress bar control. |
|
65 // Downcast the returned CCoeControl* pointer to the correct type. |
|
66 CEikNumberEditor* controlstart = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetPlayWindowStart)); |
|
67 CEikNumberEditor* controlend = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetPlayWindowEnd)); |
|
68 TBool result = ETrue; |
|
69 switch(aButtonId) |
|
70 { |
|
71 case(EMVSButtonUpdate): |
|
72 { |
|
73 TInt positionstart = controlstart->Number(); |
|
74 TInt64 posstart64(positionstart); |
|
75 TInt positionend = controlend->Number(); |
|
76 TInt64 posend64(positionend); |
|
77 //Port these values over to the AppUi |
|
78 result = iAppUi->SetPlayWindow(TTimeIntervalMicroSeconds(posstart64), TTimeIntervalMicroSeconds(posend64)); |
|
79 //if the play window can not be set with the values, restore to previous values |
|
80 if(!result) |
|
81 { |
|
82 controlstart->SetNumber(iStart.Int64()); |
|
83 controlstart->DrawNow(); |
|
84 controlend->SetNumber(iEnd.Int64()); |
|
85 controlend->DrawNow(); |
|
86 } |
|
87 } |
|
88 break; |
|
89 |
|
90 default: |
|
91 break; |
|
92 } |
|
93 |
|
94 return result; |
|
95 } |
|
96 |