|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include "createFileSourceDialog.h" |
|
21 #include "CMCETestUIEngineAudioStream.h" |
|
22 #include "CMCETestUIEngineVideoStream.h" |
|
23 #include "CMCETestUIEngineSource.h" |
|
24 #include "CMCETestUIEngineVideoSource.h" |
|
25 #include <MCEAudioStream.h> |
|
26 #include <MCEVideoStream.h> |
|
27 #include <MCEFileSource.h> |
|
28 #include <MCEMediaSource.h> |
|
29 #include <MCEMediaStream.h> |
|
30 #include "mcetestuiengineconstants.h" |
|
31 |
|
32 // CONSTANTS |
|
33 const TInt KBufLength = 300; |
|
34 // ============================ MEMBER FUNCTIONS ============================== |
|
35 |
|
36 // ---------------------------------------------------------------------------- |
|
37 // CCreateAudioFileSourceDialog::CCreateAudioFileSourceDialog( ) |
|
38 // . |
|
39 // ---------------------------------------------------------------------------- |
|
40 // |
|
41 CCreateAudioFileSourceDialog::CCreateAudioFileSourceDialog( |
|
42 CMCETestUIEngineAudioStream& aStream, TInt aIndex ) : |
|
43 iStream(aStream),iSourceIndex( aIndex ) |
|
44 { |
|
45 |
|
46 // No implementation required |
|
47 } |
|
48 |
|
49 // ---------------------------------------------------------------------------- |
|
50 // CCreateAudioFileSourceDialog::PreLayoutDynInitL() |
|
51 // . |
|
52 // ---------------------------------------------------------------------------- |
|
53 // |
|
54 void CCreateAudioFileSourceDialog::PreLayoutDynInitL() |
|
55 { |
|
56 CAknForm::PreLayoutDynInitL(); |
|
57 const RPointerArray<CMCETestUIEngineSource>& sources = |
|
58 iStream.SourcesL(); |
|
59 |
|
60 CMceMediaSource& mediaSource = static_cast<CMceMediaSource&>(sources[iSourceIndex]->Source()); |
|
61 CMceFileSource& fileSource = static_cast<CMceFileSource&>(mediaSource); |
|
62 |
|
63 TBuf<KBufLength> sourceFileName; |
|
64 sourceFileName.Copy(_L("None")); |
|
65 CEikEdwin* sourceFile = static_cast<CEikEdwin*>( |
|
66 Control( EFileSourceAudioFileUpdating ) ); |
|
67 sourceFile->SetTextL(&sourceFileName); |
|
68 |
|
69 CEikNumberEditor* fileposition = static_cast<CEikNumberEditor*>( |
|
70 Control( EFileSourceAudioFilePosition ) ); |
|
71 TTimeIntervalMicroSeconds time1 = fileSource.PositionL(); |
|
72 fileposition->SetNumber(time1.Int64()/1000000); |
|
73 iPosition = time1.Int64()/1000000; |
|
74 |
|
75 CEikNumberEditor* fileduration = static_cast<CEikNumberEditor*>( |
|
76 Control( EFileSourceAudioFileDuration ) ); |
|
77 TTimeIntervalMicroSeconds time2 = fileSource.DurationL(); |
|
78 fileduration->SetNumber(time2.Int64()/1000000); |
|
79 |
|
80 CAknPopupFieldText* popupFieldText1 = |
|
81 static_cast <CAknPopupFieldText*> (Control(EFileSourceAudioFileFastForward)); |
|
82 |
|
83 CAknPopupFieldText* popupFieldText2 = |
|
84 static_cast <CAknPopupFieldText*> (Control(EFileSourceAudioFileFastRewind)); |
|
85 |
|
86 CEikNumberEditor* fileTransProgress = static_cast<CEikNumberEditor*>( |
|
87 Control( EFileSourceAudioFileTransProgress ) ); |
|
88 fileTransProgress->SetNumber(fileSource.TranscodingProgressL()); |
|
89 |
|
90 CEikNumberEditor* mediaelementCount = static_cast<CEikNumberEditor*>( |
|
91 Control( EFileSourceAudioFileMediaElementCount ) ); |
|
92 mediaelementCount->SetNumber(fileSource.MediaElementCountL(1)); |
|
93 |
|
94 CEikNumberEditor* currentmediaElement = static_cast<CEikNumberEditor*>( |
|
95 Control( EFileSourceAudioFileCurrentMediaElement ) ); |
|
96 currentmediaElement->SetNumber(fileSource.CurrentMediaElement(1)); |
|
97 } |
|
98 |
|
99 // ---------------------------------------------------------------------------- |
|
100 // CCreateAudioFileSourceDialog::OkToExitL( TInt ) |
|
101 // . |
|
102 // ---------------------------------------------------------------------------- |
|
103 // |
|
104 |
|
105 TBool CCreateAudioFileSourceDialog::OkToExitL( TInt aKey ) |
|
106 { |
|
107 if ( aKey == EEikCmdCanceled ) |
|
108 { |
|
109 // Cancel pressed. Just exit. |
|
110 return ETrue; |
|
111 } |
|
112 const RPointerArray<CMCETestUIEngineSource>& sources = |
|
113 iStream.SourcesL(); |
|
114 |
|
115 if(sources[iSourceIndex]->Type() == KMceFileSource) |
|
116 { |
|
117 CMceMediaSource& mediaSource = static_cast<CMceMediaSource&>(sources[iSourceIndex]->Source()); |
|
118 CMceFileSource& fileSource = static_cast<CMceFileSource&>(mediaSource); |
|
119 TBuf<KBufLength> buffer; |
|
120 CEikEdwin* sourceFile = static_cast<CEikEdwin*>( |
|
121 Control( EFileSourceAudioFileUpdating ) ); |
|
122 sourceFile->GetText(buffer); |
|
123 if(buffer.Compare(KNone)) |
|
124 { |
|
125 fileSource.UpdateL(buffer); |
|
126 } |
|
127 |
|
128 |
|
129 CEikNumberEditor* fileposition = static_cast<CEikNumberEditor*>( |
|
130 Control( EFileSourceAudioFilePosition ) ); |
|
131 |
|
132 if(iPosition != fileposition->Number()) |
|
133 { |
|
134 fileSource.SetPositionL(fileposition->Number()*1000000); |
|
135 } |
|
136 |
|
137 |
|
138 /* CAknPopupFieldText* popupFieldText1 = |
|
139 static_cast <CAknPopupFieldText*> (Control(EFileSourceAudioFileFastForward)); |
|
140 if(popupFieldText1->CurrentValueIndex()) |
|
141 { |
|
142 fileSource.SetFastForwardL(ETrue); |
|
143 } |
|
144 else |
|
145 { |
|
146 fileSource.SetFastForwardL(EFalse); |
|
147 } |
|
148 |
|
149 CAknPopupFieldText* popupFieldText2 = |
|
150 static_cast <CAknPopupFieldText*> (Control(EFileSourceAudioFileFastRewind)); |
|
151 if(popupFieldText2->CurrentValueIndex()) |
|
152 { |
|
153 fileSource.SetFastRewindL(ETrue); |
|
154 } |
|
155 else |
|
156 { |
|
157 fileSource.SetFastRewindL(EFalse); |
|
158 } |
|
159 */ |
|
160 CEikNumberEditor* currentmediaElement = static_cast<CEikNumberEditor*>( |
|
161 Control( EFileSourceAudioFileCurrentMediaElement ) ); |
|
162 |
|
163 fileSource.SetCurrentMediaElementL(1,currentmediaElement->Number()); |
|
164 } |
|
165 |
|
166 |
|
167 return ETrue; |
|
168 } |
|
169 |
|
170 // ---------------------------------------------------------------------------- |
|
171 // CCreateAudioFileSourceDialog::~CCreateAudioFileSourceDialog) |
|
172 // . |
|
173 // ---------------------------------------------------------------------------- |
|
174 // |
|
175 CCreateAudioFileSourceDialog::~CCreateAudioFileSourceDialog() |
|
176 { |
|
177 return; |
|
178 } |
|
179 |
|
180 |
|
181 // ============================ MEMBER FUNCTIONS ============================== |
|
182 |
|
183 // ---------------------------------------------------------------------------- |
|
184 // CCreateVideoFileSourceDialog::CCreateVideoFileSourceDialog( ) |
|
185 // . |
|
186 // ---------------------------------------------------------------------------- |
|
187 // |
|
188 CCreateVideoFileSourceDialog::CCreateVideoFileSourceDialog( |
|
189 CMCETestUIEngineVideoStream& aStream, TInt aIndex ) : |
|
190 iStream(aStream),iSourceIndex( aIndex ) |
|
191 { |
|
192 |
|
193 // No implementation required |
|
194 } |
|
195 |
|
196 // ---------------------------------------------------------------------------- |
|
197 // CCreateVideoFileSourceDialog::PreLayoutDynInitL() |
|
198 // . |
|
199 // ---------------------------------------------------------------------------- |
|
200 // |
|
201 void CCreateVideoFileSourceDialog::PreLayoutDynInitL() |
|
202 { |
|
203 CAknForm::PreLayoutDynInitL(); |
|
204 const RPointerArray<CMCETestUIEngineVideoSource>& sources = |
|
205 iStream.SourcesL(); |
|
206 |
|
207 CMceMediaSource& mediaSource = static_cast<CMceMediaSource&>(sources[iSourceIndex]->Source()); |
|
208 CMceFileSource& fileSource = static_cast<CMceFileSource&>(mediaSource); |
|
209 |
|
210 TBuf<KBufLength> sourceFileName; |
|
211 sourceFileName.Copy(_L("None")); |
|
212 CEikEdwin* sourceFile = static_cast<CEikEdwin*>( |
|
213 Control( EFileSourceVideoFileUpdating ) ); |
|
214 sourceFile->SetTextL(&sourceFileName); |
|
215 |
|
216 CEikNumberEditor* fileposition = static_cast<CEikNumberEditor*>( |
|
217 Control( EFileSourceVideoFilePosition ) ); |
|
218 TTimeIntervalMicroSeconds time1 = fileSource.PositionL(); |
|
219 fileposition->SetNumber(time1.Int64()/1000000); |
|
220 iPosition = time1.Int64()/1000000; |
|
221 |
|
222 CEikNumberEditor* fileduration = static_cast<CEikNumberEditor*>( |
|
223 Control( EFileSourceVideoFileDuration ) ); |
|
224 TTimeIntervalMicroSeconds time2 = fileSource.DurationL(); |
|
225 fileduration->SetNumber(time2.Int64()/1000000); |
|
226 |
|
227 CAknPopupFieldText* popupFieldText1 = |
|
228 static_cast <CAknPopupFieldText*> (Control(EFileSourceVideoFileFastForward)); |
|
229 |
|
230 CAknPopupFieldText* popupFieldText2 = |
|
231 static_cast <CAknPopupFieldText*> (Control(EFileSourceVideoFileFastRewind)); |
|
232 |
|
233 // CEikNumberEditor* fileTransProgress = static_cast<CEikNumberEditor*>( |
|
234 // Control( EFileSourceVideoFileTransProgress ) ); |
|
235 // TInt streamState = iStream.State(); |
|
236 // if(streamState == CMceMediaStream::ETranscodingRequired) |
|
237 // { |
|
238 // fileposition->SetNumber(fileSource.TranscodingProgressL()); |
|
239 // } |
|
240 |
|
241 CEikNumberEditor* mediaelementCount = static_cast<CEikNumberEditor*>( |
|
242 Control( EFileSourceVideoFileMediaElementCount ) ); |
|
243 mediaelementCount->SetNumber(fileSource.MediaElementCountL(2)); |
|
244 |
|
245 CEikNumberEditor* currentmediaElement = static_cast<CEikNumberEditor*>( |
|
246 Control( EFileSourceVideoFileCurrentMediaElement ) ); |
|
247 currentmediaElement->SetNumber(fileSource.CurrentMediaElement(2)); |
|
248 } |
|
249 |
|
250 // ---------------------------------------------------------------------------- |
|
251 // CCreateVideoFileSourceDialog::OkToExitL( TInt ) |
|
252 // . |
|
253 // ---------------------------------------------------------------------------- |
|
254 // |
|
255 |
|
256 TBool CCreateVideoFileSourceDialog::OkToExitL( TInt aKey ) |
|
257 { |
|
258 if ( aKey == EEikCmdCanceled ) |
|
259 { |
|
260 // Cancel pressed. Just exit. |
|
261 return ETrue; |
|
262 } |
|
263 const RPointerArray<CMCETestUIEngineVideoSource>& sources = |
|
264 iStream.SourcesL(); |
|
265 |
|
266 if(sources[iSourceIndex]->Type() == KMceFileSource) |
|
267 { |
|
268 CMceMediaSource& mediaSource = static_cast<CMceMediaSource&>(sources[iSourceIndex]->Source()); |
|
269 CMceFileSource& fileSource = static_cast<CMceFileSource&>(mediaSource); |
|
270 TBuf<KBufLength> buffer; |
|
271 CEikEdwin* sourceFile = static_cast<CEikEdwin*>( |
|
272 Control( EFileSourceVideoFileUpdating ) ); |
|
273 sourceFile->GetText(buffer); |
|
274 if(buffer.Compare(KNone)) |
|
275 { |
|
276 fileSource.UpdateL(buffer); |
|
277 } |
|
278 |
|
279 CEikNumberEditor* fileposition = static_cast<CEikNumberEditor*>( |
|
280 Control( EFileSourceVideoFilePosition ) ); |
|
281 if(iPosition != fileposition->Number()) |
|
282 { |
|
283 fileSource.SetPositionL(fileposition->Number()*1000000); |
|
284 } |
|
285 |
|
286 CAknPopupFieldText* popupFieldText1 = |
|
287 static_cast <CAknPopupFieldText*> (Control(EFileSourceVideoFileFastForward)); |
|
288 if(popupFieldText1->CurrentValueIndex()) |
|
289 { |
|
290 fileSource.SetFastForwardL(ETrue); |
|
291 } |
|
292 else |
|
293 { |
|
294 fileSource.SetFastForwardL(EFalse); |
|
295 } |
|
296 |
|
297 CAknPopupFieldText* popupFieldText2 = |
|
298 static_cast <CAknPopupFieldText*> (Control(EFileSourceVideoFileFastRewind)); |
|
299 if(popupFieldText2->CurrentValueIndex()) |
|
300 { |
|
301 fileSource.SetFastRewindL(ETrue); |
|
302 } |
|
303 else |
|
304 { |
|
305 fileSource.SetFastRewindL(EFalse); |
|
306 } |
|
307 CEikNumberEditor* currentmediaElement = static_cast<CEikNumberEditor*>( |
|
308 Control( EFileSourceVideoFileCurrentMediaElement ) ); |
|
309 TInt index = fileSource.CurrentMediaElement(2); |
|
310 fileSource.SetCurrentMediaElementL(2,currentmediaElement->Number()); |
|
311 } |
|
312 |
|
313 |
|
314 |
|
315 return ETrue; |
|
316 } |
|
317 |
|
318 // ---------------------------------------------------------------------------- |
|
319 // CCreateVideoFileSourceDialog::~CCreateVideoFileSourceDialog) |
|
320 // . |
|
321 // ---------------------------------------------------------------------------- |
|
322 // |
|
323 CCreateVideoFileSourceDialog::~CCreateVideoFileSourceDialog() |
|
324 { |
|
325 return; |
|
326 } |
|
327 |
|
328 // End of File |