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 "MVSAudioSettingDialog.h"
|
sl@0
|
19 |
#include "MVSApp.hrh"
|
sl@0
|
20 |
|
sl@0
|
21 |
|
sl@0
|
22 |
void CMVSAudioSettingDialog::SetupDialogLD(TInt aNoRepeats,
|
sl@0
|
23 |
TTimeIntervalMicroSeconds aTrailingSilence,TInt aAudioPriority,
|
sl@0
|
24 |
TMdaPriorityPreference aPriorityPreference, TInt& aMaxFileBuf,
|
sl@0
|
25 |
CMVSAppUi* aAppUi)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
CMVSAudioSettingDialog* dialog = new (ELeave) CMVSAudioSettingDialog(aNoRepeats,
|
sl@0
|
28 |
aTrailingSilence,aAudioPriority, aPriorityPreference, aMaxFileBuf, aAppUi);
|
sl@0
|
29 |
dialog->ExecuteLD(R_NEW_MVS_DIALOG_AUDIOSETTING);
|
sl@0
|
30 |
}
|
sl@0
|
31 |
|
sl@0
|
32 |
void CMVSAudioSettingDialog::PreLayoutDynInitL()
|
sl@0
|
33 |
{
|
sl@0
|
34 |
CEikNumberEditor* repeatControl = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetRepeats));
|
sl@0
|
35 |
CEikNumberEditor* myTrSilenceControl = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetTrailingSilence));
|
sl@0
|
36 |
iMaxFileSizeCtrl = static_cast<CEikNumberEditor*>(Control(EMVSCmdSetMaxFileSizeNum));
|
sl@0
|
37 |
|
sl@0
|
38 |
if(iMaxFileBuf>0)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
iMaxFileSizeCtrl->SetNumber(iMaxFileBuf);
|
sl@0
|
41 |
}
|
sl@0
|
42 |
else
|
sl@0
|
43 |
{
|
sl@0
|
44 |
iMaxFileSizeCtrl->SetNumber(0);
|
sl@0
|
45 |
}
|
sl@0
|
46 |
//Now seed the controls with appropriate values
|
sl@0
|
47 |
if(repeatControl)
|
sl@0
|
48 |
{
|
sl@0
|
49 |
repeatControl->SetNumber(iNoRepeats);
|
sl@0
|
50 |
}
|
sl@0
|
51 |
if(myTrSilenceControl)
|
sl@0
|
52 |
{
|
sl@0
|
53 |
myTrSilenceControl->SetNumber(I64INT(iTrailingSilence.Int64()/1000000));
|
sl@0
|
54 |
}
|
sl@0
|
55 |
// Get a downcasted pointer to the controls
|
sl@0
|
56 |
CEikChoiceList* audioPriority = static_cast<CEikChoiceList*>(Control(EMVSCmdSetAudioPriority));
|
sl@0
|
57 |
|
sl@0
|
58 |
CEikChoiceList* audioPriorityPref = static_cast<CEikChoiceList*>(Control(EMVSCmdSetAudioPriorityPreference));
|
sl@0
|
59 |
|
sl@0
|
60 |
|
sl@0
|
61 |
if(audioPriority)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
//Set the current item based on the argument passed to the object
|
sl@0
|
64 |
switch (iAudioPriority)
|
sl@0
|
65 |
{
|
sl@0
|
66 |
case(EMdaPriorityMin):
|
sl@0
|
67 |
audioPriority->SetCurrentItem(0);
|
sl@0
|
68 |
break;
|
sl@0
|
69 |
|
sl@0
|
70 |
case(EMdaPriorityMax):
|
sl@0
|
71 |
audioPriority->SetCurrentItem(2);
|
sl@0
|
72 |
break;
|
sl@0
|
73 |
|
sl@0
|
74 |
case(EMdaPriorityNormal):
|
sl@0
|
75 |
default:
|
sl@0
|
76 |
audioPriority->SetCurrentItem(1);
|
sl@0
|
77 |
break;
|
sl@0
|
78 |
}
|
sl@0
|
79 |
}
|
sl@0
|
80 |
if(audioPriorityPref)
|
sl@0
|
81 |
{
|
sl@0
|
82 |
//Set the priority preference based on the argument passed to the object
|
sl@0
|
83 |
switch (iPriorityPreference)
|
sl@0
|
84 |
{
|
sl@0
|
85 |
case(EMdaPriorityPreferenceTime):
|
sl@0
|
86 |
audioPriorityPref->SetCurrentItem(1);
|
sl@0
|
87 |
break;
|
sl@0
|
88 |
|
sl@0
|
89 |
case(EMdaPriorityPreferenceQuality):
|
sl@0
|
90 |
audioPriorityPref->SetCurrentItem(2);
|
sl@0
|
91 |
break;
|
sl@0
|
92 |
|
sl@0
|
93 |
case(EMdaPriorityPreferenceTimeAndQuality):
|
sl@0
|
94 |
audioPriorityPref->SetCurrentItem(3);
|
sl@0
|
95 |
break;
|
sl@0
|
96 |
|
sl@0
|
97 |
case(EMdaPriorityPreferenceNone):
|
sl@0
|
98 |
default:
|
sl@0
|
99 |
audioPriorityPref->SetCurrentItem(0);
|
sl@0
|
100 |
}
|
sl@0
|
101 |
}
|
sl@0
|
102 |
}
|
sl@0
|
103 |
|
sl@0
|
104 |
|
sl@0
|
105 |
CMVSAudioSettingDialog::CMVSAudioSettingDialog(TInt aNoRepeats,
|
sl@0
|
106 |
TTimeIntervalMicroSeconds aTrailingSilence,TInt aAudioPriority,
|
sl@0
|
107 |
TMdaPriorityPreference aPriorityPreference, TInt& aMaxFileBuf,
|
sl@0
|
108 |
CMVSAppUi* aAppUi)
|
sl@0
|
109 |
: iAppUi(aAppUi),iAudioPriority(aAudioPriority), iPriorityPreference (aPriorityPreference),
|
sl@0
|
110 |
iNoRepeats(aNoRepeats),iTrailingSilence(aTrailingSilence), iMaxFileBuf(aMaxFileBuf)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
|
sl@0
|
113 |
}
|
sl@0
|
114 |
|
sl@0
|
115 |
TKeyResponse CMVSAudioSettingDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
|
sl@0
|
116 |
{
|
sl@0
|
117 |
if(aKeyEvent.iCode == EKeyEnter && aType == EEventKeyDown)
|
sl@0
|
118 |
{
|
sl@0
|
119 |
OkToExitL(EMVSButtonUpdate);
|
sl@0
|
120 |
}
|
sl@0
|
121 |
else if(aKeyEvent.iCode == EKeyEscape && aType == EEventKeyDown)
|
sl@0
|
122 |
{
|
sl@0
|
123 |
OkToExitL(EMVSButtonCancel);
|
sl@0
|
124 |
}
|
sl@0
|
125 |
return CEikDialog::OfferKeyEventL(aKeyEvent,aType);
|
sl@0
|
126 |
}
|
sl@0
|
127 |
|
sl@0
|
128 |
TBool CMVSAudioSettingDialog::OkToExitL(TInt aButtonId)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
// Get a pointer to the progress bar control.
|
sl@0
|
131 |
// Downcast the returned CCoeControl* pointer to the correct type.
|
sl@0
|
132 |
CEikChoiceList* audioPriority = static_cast<CEikChoiceList*>(Control(EMVSCmdSetAudioPriority));
|
sl@0
|
133 |
|
sl@0
|
134 |
CEikChoiceList* audioPriorityPref = static_cast<CEikChoiceList*>(Control(EMVSCmdSetAudioPriorityPreference));
|
sl@0
|
135 |
|
sl@0
|
136 |
iMaxFileBuf = iMaxFileSizeCtrl->Number();
|
sl@0
|
137 |
iAppUi->SetMaxFileSize(iMaxFileBuf);
|
sl@0
|
138 |
//Identify current Audio Priority item, and set that
|
sl@0
|
139 |
if(audioPriority)
|
sl@0
|
140 |
{
|
sl@0
|
141 |
switch (audioPriority->CurrentItem())
|
sl@0
|
142 |
{
|
sl@0
|
143 |
case 0:
|
sl@0
|
144 |
iAudioPriority = EMdaPriorityMin;
|
sl@0
|
145 |
break;
|
sl@0
|
146 |
|
sl@0
|
147 |
case 1:
|
sl@0
|
148 |
iAudioPriority = EMdaPriorityNormal;
|
sl@0
|
149 |
break;
|
sl@0
|
150 |
|
sl@0
|
151 |
case 2:
|
sl@0
|
152 |
iAudioPriority = EMdaPriorityMax;
|
sl@0
|
153 |
break;
|
sl@0
|
154 |
|
sl@0
|
155 |
default:
|
sl@0
|
156 |
iAudioPriority = EMdaPriorityNormal;
|
sl@0
|
157 |
break;
|
sl@0
|
158 |
}
|
sl@0
|
159 |
}
|
sl@0
|
160 |
|
sl@0
|
161 |
//Now do the same for the Priority Preference.
|
sl@0
|
162 |
if(audioPriorityPref)
|
sl@0
|
163 |
{
|
sl@0
|
164 |
switch (audioPriorityPref->CurrentItem())
|
sl@0
|
165 |
{
|
sl@0
|
166 |
case 1:
|
sl@0
|
167 |
iPriorityPreference = EMdaPriorityPreferenceTime;
|
sl@0
|
168 |
break;
|
sl@0
|
169 |
|
sl@0
|
170 |
case 2:
|
sl@0
|
171 |
iPriorityPreference = EMdaPriorityPreferenceQuality;
|
sl@0
|
172 |
break;
|
sl@0
|
173 |
|
sl@0
|
174 |
case 3:
|
sl@0
|
175 |
iPriorityPreference = EMdaPriorityPreferenceTimeAndQuality;
|
sl@0
|
176 |
break;
|
sl@0
|
177 |
|
sl@0
|
178 |
case 0:
|
sl@0
|
179 |
default:
|
sl@0
|
180 |
iPriorityPreference = EMdaPriorityPreferenceNone;
|
sl@0
|
181 |
break;
|
sl@0
|
182 |
}
|
sl@0
|
183 |
}
|
sl@0
|
184 |
iNoRepeats = static_cast<CEikNumberEditor*>
|
sl@0
|
185 |
(Control(EMVSCmdSetRepeats))->Number();
|
sl@0
|
186 |
|
sl@0
|
187 |
//Update the trailing silence from the control.
|
sl@0
|
188 |
TInt64 silence64 = (static_cast<CEikNumberEditor*>
|
sl@0
|
189 |
(Control(EMVSCmdSetTrailingSilence))->Number());
|
sl@0
|
190 |
TInt silence = I64INT(silence64*1000000);
|
sl@0
|
191 |
TTimeIntervalMicroSeconds theSilence(silence);
|
sl@0
|
192 |
|
sl@0
|
193 |
switch(aButtonId)
|
sl@0
|
194 |
{
|
sl@0
|
195 |
case(EMVSButtonUpdate):
|
sl@0
|
196 |
iAppUi->SetPriorityL(iAudioPriority, iPriorityPreference);
|
sl@0
|
197 |
iAppUi->SetRepeats(iNoRepeats, theSilence);
|
sl@0
|
198 |
return ETrue;
|
sl@0
|
199 |
|
sl@0
|
200 |
case(EMVSButtonCancel):
|
sl@0
|
201 |
return ETrue;
|
sl@0
|
202 |
default:
|
sl@0
|
203 |
break;
|
sl@0
|
204 |
}
|
sl@0
|
205 |
return ETrue;
|
sl@0
|
206 |
}
|