1 /* |
|
2 * Copyright (c) 2004 - 2008 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: Implementation of the CVtUiAppUi application UI class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "videotelui.hrh" |
|
22 #include "CVtUiAppUi.h" |
|
23 #include "CVtUiMainControl.h" |
|
24 #include "CVtUiContextControl.h" |
|
25 #include "CVtUiNumberEntryActivationControl.h" |
|
26 #include "CVtUiNaviPane.h" |
|
27 #include "VtUiLayout.h" |
|
28 #include "MVtUiEngineCommandManager.h" |
|
29 #include "CVtUiExecuteCmdDialog.h" |
|
30 #include "CVtUiAllowVideoDialog.h" |
|
31 #include "CVtUiBlankControl.h" |
|
32 #include "VtUiLayout.h" |
|
33 #include "VtUiUtility.h" |
|
34 #include "VtUiPanic.h" |
|
35 #include "CVtUiActivateBtHfDialog.h" |
|
36 #include "CVtUiRemoteVideoControl.h" |
|
37 #include <csxhelp/incl.hlp.hrh> |
|
38 |
|
39 |
|
40 #include <aknincallbubblenotify.h> |
|
41 #include <aknslayeredbackgroundcontrolcontext.h> |
|
42 #include <aknutils.h> |
|
43 #include <aknnavi.h> |
|
44 #include <akntitle.h> |
|
45 #include <akndlgshut.h> |
|
46 #include <aknnotedialog.h> |
|
47 #include <aknnotewrappers.h> |
|
48 #include <akncontext.h> |
|
49 #include <eikspane.h> |
|
50 #include <eikmenup.h> |
|
51 #include <eikmenub.h> |
|
52 #include <apgcli.h> |
|
53 #include <featmgr.h> |
|
54 #include <videotelui.rsg> |
|
55 #include <hlplch.h> |
|
56 #include <apgwgnam.h> |
|
57 #include <stringloader.h> |
|
58 #include <akndef.h> |
|
59 #include <aknconsts.h> |
|
60 |
|
61 |
|
62 #include <e32property.h> |
|
63 #include <ecom/ecom.h> |
|
64 #include <coreapplicationuisdomainpskeys.h> |
|
65 #include <uikoninternalpskeys.h> |
|
66 #include <centralrepository.h> |
|
67 #include <videotelephonyinternalcrkeys.h> |
|
68 #include <settingsinternalcrkeys.h> |
|
69 #include <e32property.h> |
|
70 #include <telcommsinfopskeys.h> |
|
71 #include <telinformationpskeys.h> |
|
72 #include <activeidle2domainpskeys.h> |
|
73 #include <ctsydomainpskeys.h> |
|
74 |
|
75 #include <aknquerydialog.h> |
|
76 #include <aknglobalnote.h> |
|
77 #include <aknsoundsystem.h> |
|
78 |
|
79 |
|
80 #include <cvtlogger.h> |
|
81 #include <cvtengmodel.h> |
|
82 #include <mvtengeventobserver.h> |
|
83 #include <mvtengcommandobserver.h> |
|
84 #include <mvtengcommandhandler.h> |
|
85 #include <mvtengframeobserver.h> |
|
86 #include <mvtengaudio.h> |
|
87 #include <mvtengsessioninfo.h> |
|
88 #include <vtengevents.h> |
|
89 #include <mvtengmedia.h> |
|
90 |
|
91 #include "CVtUiBitmapManager.h" |
|
92 |
|
93 #include <mgfetch.h> |
|
94 #include <mmgfetchverifier.h> |
|
95 #include <caf/manager.h> |
|
96 #include <caf/virtualpathptr.h> |
|
97 |
|
98 #include "cvtuifeaturemanager.h" |
|
99 #include "cvtuicomponentmanager.h" |
|
100 #include "cvtuicommandmanager.h" |
|
101 #include "tvtuistates.h" |
|
102 #include "cvtuimenus.h" |
|
103 #include "cvtuisoftkeys.h" |
|
104 #include "cvtuitoolbarbase.h" |
|
105 #include "cvtuiwhitebalance.h" |
|
106 #include "cvtuicolortone.h" |
|
107 #include "cvtuibrightness.h" |
|
108 #include "cvtuicontrast.h" |
|
109 #include <remconinterfaceselector.h> |
|
110 #include <remconcoreapitarget.h> |
|
111 #include <remconcoreapitargetobserver.h> |
|
112 #include "tvtuiwsevent.h" |
|
113 #include "mvtuinumbersource.h" |
|
114 #include "tVtuifeaturevariation.h" |
|
115 #include "cvtuidialer.h" |
|
116 #include "tvtuiappstates.h" |
|
117 #include "cvtuivolume.h" |
|
118 #include "cvtuizoom.h" |
|
119 #include "cvtuivolumecontrol.h" |
|
120 |
|
121 using namespace ContentAccess; |
|
122 |
|
123 // CONSTANTS |
|
124 |
|
125 // Engine orientation to application orientation map |
|
126 const CVtUiAppUi::TAppUiOrientation engToAppOrientation[] = { |
|
127 CVtUiAppUi::EAppUiOrientationLandscape, |
|
128 CVtUiAppUi::EAppUiOrientationPortrait, |
|
129 CVtUiAppUi::EAppUiOrientationUnspecified }; |
|
130 |
|
131 // Amount of help contexts. |
|
132 const TInt KVtUiHelpContextAmount = 1; |
|
133 |
|
134 // UID of Video Telephone application. |
|
135 const TUid KVtUiAppUid = { KVtUiAppUidValue }; |
|
136 |
|
137 // Granularity of command observer array. |
|
138 const TInt KVtUiCommandObserverArrayGranularity = 5; |
|
139 |
|
140 // Default call index. |
|
141 const TInt KVtUiDefaultCallId = 1; |
|
142 |
|
143 // Control priority for the blank control. Above all other controls. |
|
144 const TInt KVtUiBlankControlPriority = |
|
145 ECoeStackPriorityEnvironmentFilter + 100; |
|
146 |
|
147 // Exit timeout. |
|
148 const TInt KVtUiExitTimeout = 10000000; |
|
149 |
|
150 // UID of the main telephone application |
|
151 const TUid KVtUiTelephoneUid = { 0x100058B3 }; |
|
152 |
|
153 // Reset value for volume |
|
154 const TInt KVolumeResetValue = -1; |
|
155 |
|
156 |
|
157 // Name of the EIKON server window group. |
|
158 _LIT( KVtUiEikonServer, "EikonServer" ); |
|
159 |
|
160 // Name of the AknCapServer window group. |
|
161 _LIT( KVtUiAknCapServer, "*akncapserver*" ); |
|
162 |
|
163 // Name of the AknNotifierServer window group. |
|
164 _LIT( KVtUiAknNotifierServer, "*aknnfysrv*" ); |
|
165 |
|
166 // Volume repeat delay. |
|
167 const TInt KVtUiVolumeRepeatDelay = KAknStandardKeyboardRepeatRate; |
|
168 |
|
169 // Volume repeat long delay. |
|
170 const TInt KVtUiVolumeRepeatLongDelay = KAknKeyboardRepeatInitialDelay; |
|
171 |
|
172 // Start time for toolbar timer |
|
173 const TTimeIntervalMicroSeconds32 KStartTime( 600000 ); |
|
174 |
|
175 // period time for toolbar timer |
|
176 const TTimeIntervalMicroSeconds32 KPeriodTime( 300000 ); |
|
177 |
|
178 // The maximum frequency that user can swap image places. |
|
179 const TInt64 KVtUiMaxSwapImagesFreq( 1000000 ); |
|
180 |
|
181 // Enumerates methods used in event handling. This enumeration MUST |
|
182 // match with methodArray local array. |
|
183 enum TVtUiHandleEvents |
|
184 { |
|
185 // Refresh states |
|
186 EVtUiRefreshStates = 1 << 0, |
|
187 // Handle remote problem. |
|
188 EVtUiHandleVideoFrameRemoteProblem = 1 << 1, |
|
189 // Handle local problem. |
|
190 EVtUiHandleVideoFrameLocalProblem = 1 << 2, |
|
191 // Refresh navipane. |
|
192 EVtUiRefreshNaviPane = 1 << 3, |
|
193 // Refresh softkeys. |
|
194 EVtUiRefreshSoftkeys = 1 << 4, |
|
195 // Refresh blind icon status. |
|
196 EVtUiRefreshBlind = 1 << 5, |
|
197 // Stop showing waiting image text. |
|
198 EVtUiStopWaitingImage = 1 << 6, |
|
199 // Rx resolution changed. |
|
200 EVtUiChangeRemoteVideoLayout = 1 << 7, |
|
201 // Show initializing image progress |
|
202 EVtUiShowImageInitializingProgress = 1 << 8, |
|
203 // Hide initializing image progress |
|
204 EVtUiHideImageInitializingProgress = 1 << 9, |
|
205 // Set camera orientation |
|
206 EVtUiSetOrientation = 1 << 10, |
|
207 //Handle media status change |
|
208 EVtUiMediaStateChanged = 1 << 11, |
|
209 //Show decoding error note |
|
210 EVtUiShowDecodingError = 1 << 12, |
|
211 // Stop the white balance and color tone |
|
212 EVtUiStopWBOrColortone = 1 << 13, |
|
213 // refresh Menu |
|
214 EVtUiRefreshMenu = 1 << 14, |
|
215 // Stop brightness and contrast slider |
|
216 EVtUiStopBrightnessOrContrast = 1 << 15, |
|
217 // refresh zoom popup |
|
218 EVtUiRefreshZoomPopup = 1 << 16 |
|
219 }; |
|
220 |
|
221 // Enumerates states for CVtUiActiveExec. |
|
222 enum |
|
223 { |
|
224 // Operation finished. Must equal to zero. |
|
225 EVtUiAppUiNone, |
|
226 |
|
227 // Active execution states for iActiveExec: |
|
228 |
|
229 // Startup (prepare engine): |
|
230 EVtUiAppUiStartup = 100, // 100 |
|
231 // Close dialogs. |
|
232 EVtUiAppUiStartupCloseDialogs = EVtUiAppUiStartup, // 100 |
|
233 // Initialise engine. |
|
234 EVtUiAppUiStartupInitEngine, // 101 |
|
235 // Prepare viewfinder. |
|
236 EVtUiAppUiStartupPrepareViewfinder, // 102 |
|
237 // Prepare remote render. |
|
238 EVtUiAppUiStartupPrepareRemoteRender, // 103 |
|
239 // Remove blank. |
|
240 EVtUiAppUiStartupRemoveBlank, // 104 |
|
241 |
|
242 // Shutdown (reset engine): |
|
243 EVtUiAppUiShutdown = 300, // 300 |
|
244 // Close dialogs. |
|
245 EVtUiAppUiShutdownCloseDialogs = EVtUiAppUiShutdown, // 300 |
|
246 // Hide application. |
|
247 EVtUiAppUiShutdownHideApplication, // 301 |
|
248 // Reset engine. |
|
249 EVtUiAppUiShutdownResetEngine, // 302 |
|
250 // Remove blank. |
|
251 EVtUiAppUiShutdownRemoveBlank, // 303 |
|
252 |
|
253 // Answered: |
|
254 EVtUiAppUiAnswered = 500, // 500 |
|
255 // Show blank dialog. |
|
256 EVtUiAppUiAnsweredStart = EVtUiAppUiAnswered, // 500 |
|
257 // Refresh navipane. |
|
258 EVtUiAppUiAnsweredRefreshNavi, // 501 |
|
259 // Refresh softkeys. |
|
260 EVtUiAppUiAnsweredRefreshSoftkeys, // 502 |
|
261 // Start remote render. |
|
262 EVtUiAppUiAnsweredStartRemoteRender, // 503 |
|
263 |
|
264 // Prepares camera |
|
265 EVtUiAppUiAnsweredCheckCamera, // 504 |
|
266 // Choose if it's needed to show query or directly activate camera. |
|
267 EVtUiAppUiAnsweredChoose, // 505 |
|
268 // Set still image as source. |
|
269 EVtUiAppUiAnsweredQuerySetupStill, // 506 |
|
270 // Set none as source. |
|
271 EVtUiAppUiAnsweredQuerySetupNone, // 507 |
|
272 // Start viewfinder. |
|
273 EVtUiAppUiAnsweredQuerySetupStart, // 508 |
|
274 // Show "allow video image" query. |
|
275 EVtUiAppUiAnsweredQueryShow, // 509 |
|
276 // Check if user allowed video image. |
|
277 EVtUiAppUiAnsweredQueryDecide, // 510 |
|
278 // Select camera as source. |
|
279 EVtUiAppUiAnsweredQuerySelectCamera, // 511 |
|
280 // Select still image as source. |
|
281 EVtUiAppUiAnsweredQuerySelectStill, // 512 |
|
282 // Select none as source. |
|
283 EVtUiAppUiAnsweredQuerySelectNone, // 513 |
|
284 // Start viewfinder. |
|
285 EVtUiAppUiAnsweredQueryStartViewfinder, // 514 |
|
286 // Finish. |
|
287 EVtUiAppUiAnsweredQueryFinish, // 515 |
|
288 // Select camera as source. |
|
289 EVtUiAppUiAnsweredSelectCamera, // 516 |
|
290 // Select still image as source. |
|
291 EVtUiAppUiAnsweredSelectStill, // 517 |
|
292 // Select none as source. |
|
293 EVtUiAppUiAnsweredSelectNone, // 518 |
|
294 // Start viewfinder. |
|
295 EVtUiAppUiAnsweredStartViewfinder, // 519 |
|
296 // Finish. |
|
297 EVtUiAppUiAnsweredFinish, // 520 |
|
298 |
|
299 // Prepares camera |
|
300 EVtUiAppUiAnsweredDoPrepareCamera // 521 |
|
301 }; |
|
302 |
|
303 /** |
|
304 * Enumerates background layers |
|
305 */ |
|
306 enum TVtUiBackgroundLayers |
|
307 { |
|
308 // Idle state background. |
|
309 EVtUiLayerBackground = 0, |
|
310 // Wallpaper layout. |
|
311 EVtUiLayerWallpaper = 1, |
|
312 // Amount of layers. |
|
313 EVtUiLayerCount = 2 |
|
314 }; |
|
315 |
|
316 // MODULE DATA STRUCTURES |
|
317 |
|
318 /** |
|
319 * Asynchronous command executor that does not use dialog for waiting the |
|
320 * execution completion. |
|
321 * @since Series 60 5.0 |
|
322 */ |
|
323 class CVtEngCmdExec : public CBase, private MVtEngCommandObserver |
|
324 { |
|
325 |
|
326 public: |
|
327 /** |
|
328 * Static constructor. |
|
329 */ |
|
330 static CVtEngCmdExec* NewL( MVtEngCommandHandler& aCommandHandler, |
|
331 MVtUiEngineCommandManager& aCommandManager, |
|
332 CEikButtonGroupContainer& aCBA ); |
|
333 |
|
334 /** |
|
335 * Executes given command asynchronously, waiting the command completion. |
|
336 */ |
|
337 void ExecuteCmdLD( const TVtEngCommandId aCommandId ); |
|
338 |
|
339 /** |
|
340 * Destructor. |
|
341 */ |
|
342 ~CVtEngCmdExec(); |
|
343 |
|
344 private: // from MVtEngCommandObserver |
|
345 |
|
346 /** |
|
347 * @see MVtEngCommandObserver::HandleVTCommandPerformedL |
|
348 */ |
|
349 void HandleVTCommandPerformedL( TVtEngCommandId aCommand, |
|
350 const TInt aError ); |
|
351 |
|
352 private: |
|
353 |
|
354 /** |
|
355 * Constructor. |
|
356 */ |
|
357 CVtEngCmdExec( MVtEngCommandHandler& aCommandHandler, |
|
358 MVtUiEngineCommandManager& aCommandManager, |
|
359 CEikButtonGroupContainer& aCBA ); |
|
360 |
|
361 private: |
|
362 |
|
363 CActiveSchedulerWait iWait; |
|
364 |
|
365 MVtEngCommandHandler& iCommandHandler; |
|
366 |
|
367 MVtUiEngineCommandManager& iCommandManager; |
|
368 |
|
369 TVtEngCommandId iCommandId; |
|
370 |
|
371 CEikButtonGroupContainer& iCBA; |
|
372 |
|
373 }; |
|
374 |
|
375 // ----------------------------------------------------------------------------- |
|
376 // CVtEngCmdExec::NewL |
|
377 // ----------------------------------------------------------------------------- |
|
378 // |
|
379 CVtEngCmdExec* CVtEngCmdExec::NewL( MVtEngCommandHandler& aCommandHandler, |
|
380 MVtUiEngineCommandManager& aCommandManager, CEikButtonGroupContainer& aCBA ) |
|
381 { |
|
382 CVtEngCmdExec* self = new ( ELeave ) CVtEngCmdExec( aCommandHandler, |
|
383 aCommandManager, aCBA ); |
|
384 return self; |
|
385 } |
|
386 |
|
387 // ----------------------------------------------------------------------------- |
|
388 // CVtEngCmdExec::ExecuteCmdLD |
|
389 // ----------------------------------------------------------------------------- |
|
390 // |
|
391 void CVtEngCmdExec::ExecuteCmdLD( const TVtEngCommandId aCommandId ) |
|
392 { |
|
393 __VTPRINTENTER("CVtEngCmdExec::ExecuteCmdLD") |
|
394 CleanupStack::PushL( this ); |
|
395 iCommandId = aCommandId; |
|
396 iCommandManager.AddObserverL( *this ); |
|
397 iCommandHandler.ExecuteL( aCommandId, NULL ); |
|
398 iCBA.SetCommandSetL( R_VIDEOTELUI_SOFTKEYS_EMPTY ); |
|
399 iCBA.DrawNow(); |
|
400 iWait.Start(); |
|
401 CleanupStack::PopAndDestroy(); // this |
|
402 __VTPRINTEXIT("CVtEngCmdExec::ExecuteCmdLD") |
|
403 } |
|
404 |
|
405 // ----------------------------------------------------------------------------- |
|
406 // CVtEngCmdExec::~CVtEngCmdExec |
|
407 // ----------------------------------------------------------------------------- |
|
408 // |
|
409 CVtEngCmdExec::~CVtEngCmdExec() |
|
410 { |
|
411 __VTPRINTENTER("CVtEngCmdExec::~CVtEngCmdExec") |
|
412 if ( iWait.IsStarted()) |
|
413 { |
|
414 __VTPRINT(DEBUG_GEN, "CVtEngCmdExec::~CVtEngCmdExec AsyncStop") |
|
415 iWait.AsyncStop(); |
|
416 } |
|
417 iCommandManager.RemoveObserver( *this ); |
|
418 __VTPRINTEXIT("CVtEngCmdExec::~CVtEngCmdExec") |
|
419 } |
|
420 |
|
421 // ----------------------------------------------------------------------------- |
|
422 // CVtEngCmdExec::HandleVTCommandPerformedL |
|
423 // ----------------------------------------------------------------------------- |
|
424 // |
|
425 void CVtEngCmdExec::HandleVTCommandPerformedL( TVtEngCommandId aCommand, |
|
426 const TInt aError ) |
|
427 { |
|
428 __VTPRINTENTER("CVtEngCmdExec::HandleVTCommandPerformedL") |
|
429 if ( iCommandId == aCommand ) |
|
430 { |
|
431 if ( iWait.IsStarted()) |
|
432 { |
|
433 __VTPRINT(DEBUG_GEN, "CVtEngCmdExec::HandleVTCommandPerformedL AsyncStop") |
|
434 iWait.AsyncStop(); |
|
435 } |
|
436 else |
|
437 { |
|
438 // request already completed |
|
439 } |
|
440 } |
|
441 else |
|
442 { |
|
443 // wrong command ID |
|
444 } |
|
445 __VTPRINTEXIT("CVtEngCmdExec::HandleVTCommandPerformedL") |
|
446 } |
|
447 |
|
448 // ----------------------------------------------------------------------------- |
|
449 // CVtEngCmdExec::CVtEngCmdExec |
|
450 // ----------------------------------------------------------------------------- |
|
451 // |
|
452 CVtEngCmdExec::CVtEngCmdExec( MVtEngCommandHandler& aCommandHandler, |
|
453 MVtUiEngineCommandManager& aCommandManager, CEikButtonGroupContainer& aCBA ) |
|
454 : iCommandHandler( aCommandHandler ), |
|
455 iCommandManager( aCommandManager ), iCBA( aCBA ) |
|
456 { |
|
457 } |
|
458 |
|
459 /** |
|
460 * Encapsulates all instances related to user interface. |
|
461 * @since Series 60 2.6 |
|
462 */ |
|
463 class CVtUiAppUi::CInstance |
|
464 : public CBase |
|
465 { |
|
466 public: // Constructors and destructors |
|
467 |
|
468 /** |
|
469 * Two-phased constructor. |
|
470 * @param aAppUi reference to application UI. |
|
471 */ |
|
472 static CInstance* NewL( CVtUiAppUi& aAppUi ); |
|
473 |
|
474 /** |
|
475 * Destructor. |
|
476 */ |
|
477 ~CInstance(); |
|
478 |
|
479 /** |
|
480 * Called when side volume key is pressed. |
|
481 */ |
|
482 void VolumeKeyPressedL(); |
|
483 |
|
484 /** |
|
485 * Create remote video control. |
|
486 */ |
|
487 void CreateRemoteVideoControl(); |
|
488 |
|
489 private: |
|
490 |
|
491 /** |
|
492 * Constructor. |
|
493 */ |
|
494 CInstance( CVtUiAppUi& aAppUi ); |
|
495 |
|
496 /** |
|
497 * Symbian OS constructor. |
|
498 */ |
|
499 void ConstructL(); |
|
500 |
|
501 /** |
|
502 * Relayout controls. |
|
503 */ |
|
504 void LayoutChanged(); |
|
505 |
|
506 private: |
|
507 |
|
508 // Parent can access members. |
|
509 friend class CVtUiAppUi; |
|
510 |
|
511 // Ref to application UI. |
|
512 CVtUiAppUi& iAppUi; |
|
513 |
|
514 // Owned bitmap manager. |
|
515 CVtUiBitmapManager* iBitmapManager; |
|
516 |
|
517 // ETrue if iMainControl has been added to stack. |
|
518 TBool iMainControlInStack; |
|
519 |
|
520 // Owned main pane control. |
|
521 CVtUiMainControl* iMainControl; |
|
522 |
|
523 // ETrue if iContextControl has been added to stack. |
|
524 TBool iContextControlInStack; |
|
525 |
|
526 // Owned context pane control. |
|
527 CVtUiContextControl* iContextControl; |
|
528 |
|
529 // Owned remote video control. |
|
530 CVtUiRemoteVideoControl* iRemoteVideoControl; |
|
531 |
|
532 //ETrue if iRemoteVideoControl has been added to stack. |
|
533 TBool iRemoteVideoControlInStack; |
|
534 |
|
535 // Owned navi pane controller. |
|
536 CVtUiNaviPane* iNaviPane; |
|
537 |
|
538 // ETrue if number entry has been added to stack. |
|
539 TBool iNumberEntryInStack; |
|
540 |
|
541 // Owned number entry activation control. |
|
542 CVtUiNumberEntryActivationControl* iNumberEntryActivation; |
|
543 |
|
544 }; |
|
545 |
|
546 /** |
|
547 * Encapsulates event handling. |
|
548 * @since Series 60 2.6 |
|
549 */ |
|
550 class CVtUiAppUi::CEventObserver |
|
551 : public CBase, |
|
552 public MVtUiEngineCommandManager, |
|
553 public MVtEngEventObserver, |
|
554 public MVtEngCommandObserver, |
|
555 public MVtEngFrameObserver, |
|
556 private MBeating, |
|
557 private MRemConCoreApiTargetObserver |
|
558 { |
|
559 public: // Constructors and destructors |
|
560 |
|
561 /** |
|
562 * Two-phased constructor. |
|
563 * @param aAppUi application UI. |
|
564 */ |
|
565 static CEventObserver* NewL( CVtUiAppUi& aAppUi ); |
|
566 |
|
567 /** |
|
568 * Destructor. |
|
569 */ |
|
570 ~CEventObserver(); |
|
571 |
|
572 public: // New functions |
|
573 |
|
574 /** |
|
575 * Returns engine model. |
|
576 * @return model instance. |
|
577 */ |
|
578 inline CVtEngModel& Model(); |
|
579 |
|
580 /** |
|
581 * Creates remote control framework session. |
|
582 */ |
|
583 void CreateRemConSessionL(); |
|
584 |
|
585 /** |
|
586 * Deletes remote control framework session. |
|
587 */ |
|
588 void DeleteRemConSession(); |
|
589 |
|
590 /** |
|
591 * Checks if command is supported by engine. |
|
592 * @param aCommandId command. |
|
593 * @return ETrue if supported, EFalse otherwise. |
|
594 */ |
|
595 TBool CommandSupported( const TInt aCommandId ) const; |
|
596 |
|
597 /** |
|
598 * Checks if command is supported and synchronous. |
|
599 * @param aCommandId command. |
|
600 * @return ETrue if synchronous & supported, EFalse otherwise. |
|
601 */ |
|
602 TBool CommandSupportedAndSynchronous( |
|
603 const TInt aCommandId ) const; |
|
604 |
|
605 /** |
|
606 * Starts heartbeat timer. |
|
607 */ |
|
608 void StartBeatL(); |
|
609 |
|
610 /** |
|
611 * Stops heartbeat timer. |
|
612 */ |
|
613 void StopBeat(); |
|
614 |
|
615 /** |
|
616 * Stops volume repeat handling timer. |
|
617 */ |
|
618 void StopVolumeRepeatTimer(); |
|
619 |
|
620 /** |
|
621 * Sends response to prepare. |
|
622 * @param aResult result code. |
|
623 */ |
|
624 void SendPrepareResponse( const TInt aResult ); |
|
625 |
|
626 public: // Functions from base classes |
|
627 |
|
628 /** |
|
629 * @see MVtUiCommandManager::AddObserverL. |
|
630 */ |
|
631 virtual void AddObserverL( MVtEngCommandObserver& aObserver ); |
|
632 |
|
633 /** |
|
634 * @see MVtUiCommandManager::RemoveObserver. |
|
635 */ |
|
636 virtual void RemoveObserver( MVtEngCommandObserver& aObserver ); |
|
637 |
|
638 /** |
|
639 * @see MVtEngEventObserver::HandleVtEventL. |
|
640 */ |
|
641 virtual void HandleVtEventL( TInt aEvent ); |
|
642 |
|
643 /** |
|
644 * @see MVtEngCommandObserver::HandleVTCommandPerformedL. |
|
645 */ |
|
646 virtual void HandleVTCommandPerformedL( |
|
647 TVtEngCommandId aCommand, |
|
648 const TInt aError ); |
|
649 |
|
650 /** |
|
651 * @see MVtEngFrameObserver::vtHandleFrameL. |
|
652 */ |
|
653 virtual void vtHandleFrameL( TFrameType aType, CFbsBitmap* aBitmap ); |
|
654 |
|
655 /** |
|
656 * @see MVtEngFrameObserver::vtSetFrame |
|
657 */ |
|
658 virtual void vtSetFrame( TFrameType aType, CFbsBitmap* aBitmap ); |
|
659 |
|
660 /** |
|
661 * @see MBeating::Beat. |
|
662 */ |
|
663 virtual void Beat(); |
|
664 |
|
665 /** |
|
666 * @see MBeating::Synchronize. |
|
667 */ |
|
668 virtual void Synchronize(); |
|
669 |
|
670 |
|
671 private: |
|
672 |
|
673 /** |
|
674 * Constructor. |
|
675 * @param aAppUi application UI. |
|
676 */ |
|
677 CEventObserver( CVtUiAppUi& aAppUi ); |
|
678 |
|
679 /** |
|
680 * Symbian OS constructor. |
|
681 */ |
|
682 void ConstructL(); |
|
683 |
|
684 /** |
|
685 * Executes CVtUiAppUi methods. |
|
686 * @param aBits sum of subset of TVtUiHandleEvents. |
|
687 */ |
|
688 void DoExecuteL( TInt aBits ); |
|
689 /** |
|
690 * Handles volume change. |
|
691 * @param aButtonAct button action. |
|
692 */ |
|
693 void HandleVolumeChange( |
|
694 TRemConCoreApiButtonAction aButtonAct ); |
|
695 /** |
|
696 * Handles mute change. |
|
697 * @param aButtonAct button action. |
|
698 */ |
|
699 void HandleRemMuteChange( |
|
700 TRemConCoreApiButtonAction aButtonAct ); |
|
701 /** |
|
702 * @see MRemConCoreApiTargetObserver::MrccatoCommand. |
|
703 */ |
|
704 virtual void MrccatoCommand( |
|
705 TRemConCoreApiOperationId aOperationId, |
|
706 TRemConCoreApiButtonAction aButtonAct ); |
|
707 |
|
708 /** |
|
709 * Callback function to handle volume repeat. |
|
710 * @param aAny pointer to an instance of this class. |
|
711 * @return KErrNone. |
|
712 */ |
|
713 static TInt DoHandleVolumeRepeat( TAny* aAny ); |
|
714 |
|
715 private: |
|
716 |
|
717 // Type definition for CVtUiAppUi member functions. |
|
718 typedef void (CVtUiAppUi::*TMethodL)(); |
|
719 |
|
720 // Ref to application ui. |
|
721 CVtUiAppUi& iAppUi; |
|
722 |
|
723 // Engine model. |
|
724 CVtEngModel* iModel; |
|
725 |
|
726 // ETrue when command events are being sent. |
|
727 TBool iInCommandPerformed; |
|
728 |
|
729 // Owned array of observers. |
|
730 RPointerArray< MVtEngCommandObserver > iCommandObservers; |
|
731 |
|
732 // Owned heart beat timer to update call duration. |
|
733 CHeartbeat* iBeat; |
|
734 |
|
735 |
|
736 // Owned interface selector instance. |
|
737 CRemConInterfaceSelector* iRemConInterfaceSelector; |
|
738 |
|
739 // Pointer to target instance. Owned by iRemConInterfaceSelector. |
|
740 CRemConCoreApiTarget* iRemConCoreApiTarget; |
|
741 |
|
742 // Owned timer for volume repeat handling. |
|
743 CPeriodic* iRemConVolumeRepeatTimer; |
|
744 |
|
745 // Rencon operation id |
|
746 TRemConCoreApiOperationId iRCCAOperationId; |
|
747 |
|
748 }; |
|
749 |
|
750 /** |
|
751 * Verifies objects fetched using media gallery. Only non DRM protected |
|
752 * objects are allowed. |
|
753 * @since Series 60 3.1 |
|
754 */ |
|
755 class CVtUiAppUi::CVtUiAppUiMGVerifier : |
|
756 public CBase, |
|
757 public MMGFetchVerifier |
|
758 { |
|
759 public: |
|
760 |
|
761 /** |
|
762 * Static constructor, pushes created instance into cleanup stack. |
|
763 */ |
|
764 static CVtUiAppUiMGVerifier* NewLC( |
|
765 CVtUiAppUi& aAppUi, CCoeEnv& aCoeEnv ); |
|
766 |
|
767 /** |
|
768 * Destructor. |
|
769 */ |
|
770 ~CVtUiAppUiMGVerifier(); |
|
771 |
|
772 public: // from MMGFetchVerifier |
|
773 |
|
774 /** |
|
775 * @see MMGFetchVerifier::VerifySelectionL |
|
776 */ |
|
777 TBool VerifySelectionL( const MDesCArray* aSelectedFiles ); |
|
778 |
|
779 private: |
|
780 |
|
781 /** |
|
782 * 2nd constructor in two phase construction. |
|
783 */ |
|
784 void ConstructL(); |
|
785 |
|
786 /** |
|
787 * Constructor. |
|
788 */ |
|
789 CVtUiAppUiMGVerifier( CVtUiAppUi& aAppUi, CCoeEnv& aCoeEnv ); |
|
790 |
|
791 private: |
|
792 |
|
793 // Reference to Application UI |
|
794 CVtUiAppUi& iAppUi; |
|
795 |
|
796 // Pointer to COE |
|
797 CCoeEnv* iCoeEnv; |
|
798 |
|
799 // Pointer to CManager which manages files and content access agents |
|
800 CManager* iManager; |
|
801 }; |
|
802 |
|
803 // ============================ MEMBER FUNCTIONS =============================== |
|
804 |
|
805 // ----------------------------------------------------------------------------- |
|
806 // CVtUiAppUi::CVtUiAppUi |
|
807 // C++ default constructor can NOT contain any code, that |
|
808 // might leave. |
|
809 // ----------------------------------------------------------------------------- |
|
810 // |
|
811 CVtUiAppUi::CVtUiAppUi() |
|
812 : iRenderingMode( ERenderingModeDefault ), |
|
813 iLoudspeakerVolume( KVolumeResetValue ), |
|
814 iHandsetVolume( KVolumeResetValue ), |
|
815 iActiveCommands( 1 ), |
|
816 iLayoutChg( EFalse ), |
|
817 iDelayedCmd( 0 ) |
|
818 { |
|
819 } |
|
820 |
|
821 // ----------------------------------------------------------------------------- |
|
822 // CVtUiAppUi::ConstructL |
|
823 // Symbian 2nd phase constructor. |
|
824 // ----------------------------------------------------------------------------- |
|
825 // |
|
826 void CVtUiAppUi::ConstructL() |
|
827 { |
|
828 VTLOGINIT |
|
829 __VTPRINTENTER( "VtUi.ConstructL" ) |
|
830 |
|
831 FeatureManager::InitializeLibL(); |
|
832 BaseConstructL( EAknEnableSkin | EAknEnableMSK ); |
|
833 |
|
834 iCba = Cba(); |
|
835 // Must be done before creating features |
|
836 iVTVariation.ReadL(); |
|
837 |
|
838 iEventObserver = CEventObserver::NewL( *this ); |
|
839 iUiStates = new ( ELeave ) TVtUiStates( iEventObserver->Model() ); |
|
840 iUiStates->Update(); |
|
841 iUiStates->SetViewFindersInitialPlaceContextPane( ETrue ); |
|
842 |
|
843 TVtUiAppStateBase::SetInitialStateL( *this, *iUiStates ); |
|
844 |
|
845 iCommandManager = CVtUiCommandManager::NewL( *iUiStates, *this ); |
|
846 |
|
847 iComponentManager = CVtUiComponentManager::NewL(); |
|
848 |
|
849 iFeatureManager = CVtUiFeatureManager::NewL( *this, *iUiStates, |
|
850 *iCommandManager, *iComponentManager ); |
|
851 |
|
852 iInstance = CInstance::NewL( *this ); |
|
853 |
|
854 CEikMenuBar* menu = iEikonEnv->AppUiFactory()->MenuBar(); |
|
855 menu->SetContextMenuTitleResourceId( R_VIDEOTELUI_OK_MENUBAR ); |
|
856 |
|
857 |
|
858 |
|
859 CEikonEnv& eikEnv = *( iEikonEnv ); |
|
860 eikEnv.SetSystem( ETrue ); |
|
861 eikEnv.WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); |
|
862 |
|
863 iThisApplicationWgId = eikEnv.RootWin().Identifier(); |
|
864 iEikonServerWgId = |
|
865 eikEnv.WsSession().FindWindowGroupIdentifier( 0, KVtUiEikonServer ); |
|
866 iAknCapServerWgId = |
|
867 eikEnv.WsSession().FindWindowGroupIdentifier( 0, KVtUiAknCapServer ); |
|
868 iAknNfyServerWgId = |
|
869 eikEnv.WsSession().FindWindowGroupIdentifier( 0, |
|
870 KVtUiAknNotifierServer ); |
|
871 |
|
872 __ASSERT_ALWAYS( |
|
873 iEikonServerWgId != KErrNotFound, |
|
874 VtUiPanic::Panic( EVtUiPanicEikonServerNotFound ) ); |
|
875 (void)eikEnv.RootWin().EnableFocusChangeEvents(); |
|
876 |
|
877 |
|
878 iUplinkWindow = iInstance->iContextControl; |
|
879 iDownlinkWindow = iInstance->iMainControl; |
|
880 |
|
881 |
|
882 if ( iCba ) |
|
883 { |
|
884 CCoeControl* control = iCba->ButtonGroup()->AsControl(); |
|
885 static_cast< CEikCba* >( control )-> |
|
886 SetSkinBackgroundId( KAknsIIDQsnBgAreaControlIdle ); |
|
887 } |
|
888 |
|
889 iBlankControl = new ( ELeave ) CVtUiBlankControl; |
|
890 iBlankControl->ConstructL( ClientRect() ); |
|
891 AddToStackL( |
|
892 iBlankControl, |
|
893 KVtUiBlankControlPriority, |
|
894 ECoeStackFlagRefusesFocus ); |
|
895 |
|
896 iUiStates->SetBlankControlAdded( ETrue ); |
|
897 |
|
898 iActiveExec = |
|
899 new ( ELeave ) CVtUiActiveExec( CActive::EPriorityHigh ); |
|
900 SetCallIdL( KVtUiDefaultCallId ); |
|
901 |
|
902 iExitTimer = CPeriodic::NewL( CActive::EPriorityHigh ); |
|
903 CheckEngineFunctionality(); |
|
904 |
|
905 iAsyncCallback = |
|
906 new ( ELeave ) CAsyncCallBack ( |
|
907 TCallBack( &AsyncViewFinderToMainPaneAndShare, this ), |
|
908 CActive::EPriorityStandard ); |
|
909 |
|
910 iLayoutChangeCallback = |
|
911 new ( ELeave ) CAsyncCallBack( |
|
912 TCallBack( &DelayedHandleLayoutChanged, this ), |
|
913 CActive::EPriorityStandard ); |
|
914 |
|
915 iCurrentCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch; |
|
916 |
|
917 GetCameraOrientations(); |
|
918 |
|
919 SetInitialCameraOrientationL(); |
|
920 |
|
921 iVolCtrl= new ( ELeave )CVtUiVolumeControl( |
|
922 Model().CommandHandler(), |
|
923 Model().Audio(), |
|
924 *iEventObserver, |
|
925 *iFeatureManager); |
|
926 iVolCtrl->ConstructL(); |
|
927 |
|
928 iIncallBubble = CAknIncallBubble::NewL(); |
|
929 |
|
930 iIsWaitingCallState = EFalse; |
|
931 |
|
932 __VTPRINTEXIT( "VtUi.ConstructL" ) |
|
933 } |
|
934 |
|
935 // ----------------------------------------------------------------------------- |
|
936 // CVtUiAppUi::~CVtUiAppUi |
|
937 // ----------------------------------------------------------------------------- |
|
938 // |
|
939 CVtUiAppUi::~CVtUiAppUi() |
|
940 { |
|
941 __VTPRINTENTER( "VtUi.~" ) |
|
942 |
|
943 iActiveCommands.Close(); |
|
944 |
|
945 delete iLayoutChangeCallback; |
|
946 delete iAsyncCallback; |
|
947 |
|
948 if ( iUiStates && iUiStates->IsBlankControlAdded() ) |
|
949 { |
|
950 RemoveFromStack( iBlankControl ); |
|
951 } |
|
952 TInt lightsValue = 0; |
|
953 if ( RProperty::Get( KPSUidCoreApplicationUIs, |
|
954 KLightsVTForcedLightsOn, lightsValue ) == KErrNone ) |
|
955 { |
|
956 if ( lightsValue == EForcedLightsOn ) |
|
957 { |
|
958 __VTPRINT( DEBUG_GEN, "VtUi.~ Good night!" ) |
|
959 (void) RProperty::Set( |
|
960 KPSUidCoreApplicationUIs, |
|
961 KLightsVTForcedLightsOn, |
|
962 EForcedLightsOff ); |
|
963 } |
|
964 } |
|
965 delete iActiveExec; |
|
966 delete iInstance; |
|
967 delete iBlankControl; |
|
968 // Delete volume control before its dependencies are deleted. |
|
969 delete iVolCtrl; |
|
970 delete iEventObserver; |
|
971 delete iExitTimer; |
|
972 // Featuremanager must be destructed |
|
973 // before componentmanager and commandmanager |
|
974 delete iFeatureManager; |
|
975 delete iComponentManager; |
|
976 delete iCommandManager; |
|
977 delete iUiStates; |
|
978 |
|
979 if ( iTbPeriodic ) |
|
980 { |
|
981 iTbPeriodic->Cancel(); |
|
982 } |
|
983 delete iTbPeriodic; |
|
984 |
|
985 if ( iIncallBubble ) |
|
986 { |
|
987 TRAP_IGNORE( iIncallBubble->SetIncallBubbleAllowedInUsualL( ETrue ) ) |
|
988 } |
|
989 delete iIncallBubble; |
|
990 |
|
991 // Close all RComm sessions to prevent memory leaks. |
|
992 REComSession::FinalClose(); |
|
993 |
|
994 FeatureManager::UnInitializeLib(); |
|
995 __VTPRINTEXIT( "VtUi.~" ) |
|
996 VTLOGUNINIT |
|
997 } |
|
998 |
|
999 // ----------------------------------------------------------- |
|
1000 // CVtUiAppUi::SwitchLayoutToFlatStatusPaneL |
|
1001 // ----------------------------------------------------------- |
|
1002 // |
|
1003 void CVtUiAppUi::SwitchLayoutToFlatStatusPaneL( TBool aSwitch ) |
|
1004 { |
|
1005 __VTPRINTENTER( "VtUi.SwitchLayoutToFlatStatusPaneL" ) |
|
1006 CEikStatusPane* statusPane = StatusPane(); |
|
1007 |
|
1008 const TInt idleResId( |
|
1009 VtUiLayout::IsLandscapeOrientation() ? |
|
1010 R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL : |
|
1011 R_AVKON_STATUS_PANE_LAYOUT_USUAL ); |
|
1012 |
|
1013 const TBool isStatusPaneFlat( |
|
1014 ( statusPane->CurrentLayoutResId() == |
|
1015 R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ) || |
|
1016 ( statusPane->CurrentLayoutResId() == |
|
1017 R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ) ); |
|
1018 |
|
1019 if ( aSwitch ) |
|
1020 { |
|
1021 if ( isStatusPaneFlat && VtUiLayout::IsLandscapeOrientation() ) |
|
1022 { |
|
1023 __VTPRINT( DEBUG_GEN, |
|
1024 "VtUi.SwitchLayoutToFlatStatusPaneL LAYOUT USUAL" ); |
|
1025 NaviPaneL()->Pop(); |
|
1026 statusPane->SwitchLayoutL( idleResId ); |
|
1027 } |
|
1028 else if ( !isStatusPaneFlat && !VtUiLayout::IsLandscapeOrientation() ) |
|
1029 { |
|
1030 __VTPRINT( DEBUG_GEN, |
|
1031 "VtUi.SwitchLayoutToFlatStatusPaneL USUAL FLAT" ); |
|
1032 NaviPaneL()->PushDefaultL(); |
|
1033 statusPane->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ); |
|
1034 } |
|
1035 } |
|
1036 else |
|
1037 { |
|
1038 if ( isStatusPaneFlat ) |
|
1039 { |
|
1040 __VTPRINT( DEBUG_GEN, |
|
1041 "VtUi.SwitchLayoutToFlatStatusPaneL LAYOUT IDLE" ); |
|
1042 NaviPaneL()->Pop(); |
|
1043 statusPane->SwitchLayoutL( idleResId ); |
|
1044 } |
|
1045 } |
|
1046 // ApplyCurrentSettingsL is called whenever statuspane |
|
1047 // visibility status or pane layout changes. |
|
1048 statusPane->ApplyCurrentSettingsL(); |
|
1049 statusPane->DrawNow(); |
|
1050 // Make sure whole control is fully updated |
|
1051 iInstance->iMainControl->DrawNow(); |
|
1052 __VTPRINTEXIT( "VtUi.SwitchLayoutToFlatStatusPaneL" ) |
|
1053 } |
|
1054 |
|
1055 // ----------------------------------------------------------------------------- |
|
1056 // CVtUiAppUi::RefreshL |
|
1057 // ----------------------------------------------------------------------------- |
|
1058 // |
|
1059 void CVtUiAppUi::RefreshL() |
|
1060 { |
|
1061 __VTPRINTENTER( "VtUi.Refresh" ) |
|
1062 RefreshBlind(); |
|
1063 RefreshNaviPaneL(); |
|
1064 __VTPRINTEXIT( "VtUi.Refresh" ) |
|
1065 } |
|
1066 |
|
1067 // ----------------------------------------------------------------------------- |
|
1068 // CVtUiAppUi::RefreshNaviPaneL |
|
1069 // ----------------------------------------------------------------------------- |
|
1070 // |
|
1071 void CVtUiAppUi::RefreshNaviPaneL() |
|
1072 { |
|
1073 // Update only if navi pane exists |
|
1074 if ( iInstance ) |
|
1075 { |
|
1076 __VTPRINT( DEBUG_GEN, "VtUi.RefreshNavi" ) |
|
1077 CVtUiNaviPane* navi = iInstance->iNaviPane; |
|
1078 |
|
1079 // Refresh muted state |
|
1080 MVtEngMedia& media = Model().Media(); |
|
1081 TInt mediaAvail; |
|
1082 VtUiUtility::GetOutgoingMediaState( media, mediaAvail ); |
|
1083 mediaAvail = ~mediaAvail; |
|
1084 navi->SetMuted( mediaAvail & MVtEngMedia::EMediaAudio ); |
|
1085 |
|
1086 // Refresh call duration |
|
1087 MVtEngSessionInfo& session = Model().Session(); |
|
1088 MVtEngSessionInfo::TDuration duration; |
|
1089 TBool enabled; |
|
1090 if ( session.GetDuration( duration, enabled ) != KErrNone ) |
|
1091 { |
|
1092 enabled = EFalse; |
|
1093 } |
|
1094 navi->SetCallDuration( duration, enabled ); |
|
1095 |
|
1096 // Update all changes |
|
1097 navi->CommitL(); |
|
1098 |
|
1099 CheckBeatL( enabled ); |
|
1100 } |
|
1101 } |
|
1102 |
|
1103 void CVtUiAppUi::StopBrightnessOrContrast() |
|
1104 { |
|
1105 |
|
1106 MVtUiFeature* br = iFeatureManager->GetFeatureById( EVtUiFeatureIdBrightness ); |
|
1107 if ( br ) |
|
1108 { |
|
1109 __VTPRINT( DEBUG_GEN, "VtUi.StopBrightness" ) |
|
1110 if ( br->State() == MVtUiFeature::EActive ) |
|
1111 { |
|
1112 __VTPRINT( DEBUG_GEN, "VtUi.StopBrightnessOrContrast br->STOP" ) |
|
1113 br->Stop(); |
|
1114 } |
|
1115 } |
|
1116 |
|
1117 MVtUiFeature* cr = iFeatureManager->GetFeatureById( EVtUiFeatureIdContrast ); |
|
1118 if ( cr ) |
|
1119 { |
|
1120 __VTPRINT( DEBUG_GEN, "VtUi.StopContrast" ) |
|
1121 if ( cr->State() == MVtUiFeature::EActive ) |
|
1122 { |
|
1123 __VTPRINT( DEBUG_GEN, "VtUi.StopBrightnessOrContrast cr->STOP" ) |
|
1124 cr->Stop(); |
|
1125 } |
|
1126 } |
|
1127 } |
|
1128 |
|
1129 // ----------------------------------------------------------------------------- |
|
1130 // CVtUiAppUi::RefreshZoomPopupL() |
|
1131 // ----------------------------------------------------------------------------- |
|
1132 // |
|
1133 void CVtUiAppUi::RefreshZoomPopupL() |
|
1134 { |
|
1135 CVtUiZoom* zm = static_cast< CVtUiZoom* >( |
|
1136 iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom ) ); |
|
1137 if( zm && iUiStates->IsZoomModeOn()) |
|
1138 zm->RefreshL(); |
|
1139 } |
|
1140 // ----------------------------------------------------------------------------- |
|
1141 // CVtUiAppUi::RefreshMenuL() |
|
1142 // ----------------------------------------------------------------------------- |
|
1143 // |
|
1144 void CVtUiAppUi::RefreshMenuL() |
|
1145 { |
|
1146 |
|
1147 CVtUiMenus* menus = static_cast< CVtUiMenus* >( |
|
1148 iFeatureManager->GetFeatureById( EVtUiFeatureIdMenu ) ); |
|
1149 if ( menus ) |
|
1150 { |
|
1151 iUiStates->Update(); |
|
1152 __VTPRINT( DEBUG_GEN, "VtUi.RefreshMenuL" ) |
|
1153 menus->RefreshL(); |
|
1154 CAknAppUi::ProcessCommandL( EEikCmdCanceled ); // does not leave |
|
1155 } |
|
1156 } |
|
1157 |
|
1158 // ----------------------------------------------------------------------------- |
|
1159 // CVtUiAppUi::RefreshSoftkeysL |
|
1160 // ----------------------------------------------------------------------------- |
|
1161 // |
|
1162 void CVtUiAppUi::RefreshSoftkeysL() |
|
1163 { |
|
1164 if ( iUiStates->IsThisApplicationForeground() ) |
|
1165 { |
|
1166 CVtUiSoftkeys* sk = static_cast< CVtUiSoftkeys* >( |
|
1167 iFeatureManager->GetFeatureById( EVtUiFeatureIdSoftkey ) ); |
|
1168 if ( sk ) |
|
1169 { |
|
1170 sk->RefreshL(); |
|
1171 } |
|
1172 } |
|
1173 } |
|
1174 |
|
1175 // ----------------------------------------------------------------------------- |
|
1176 // CVtUiAppUi::RefreshBlind |
|
1177 // ----------------------------------------------------------------------------- |
|
1178 // |
|
1179 void CVtUiAppUi::RefreshBlind() |
|
1180 { |
|
1181 if ( iInstance && !iUiStates->IsDisableBlindSetting() ) |
|
1182 { |
|
1183 __VTPRINTENTER( "VtUi.RefreshBlind" ) |
|
1184 TInt avail; |
|
1185 MVtEngMedia& media = Model().Media(); |
|
1186 |
|
1187 // Update blind flags.for outgoing media: |
|
1188 VtUiUtility::GetOutgoingMediaState( media, avail ); |
|
1189 avail = ~avail; |
|
1190 TBool noVideo( avail & MVtEngMedia::EMediaVideo ); |
|
1191 const TBool isFrozen( VtUiUtility::GetFreezeState ( media ) ); |
|
1192 MVtEngMedia::TMediaSource source( MVtEngMedia::EMediaNone ); |
|
1193 media.GetSource( source ); |
|
1194 if ( noVideo && !isFrozen && |
|
1195 ( source != MVtEngMedia::EMediaStillImage ) ) |
|
1196 { |
|
1197 iUplinkWindow->SetStreamBitmap( NULL ); |
|
1198 } |
|
1199 |
|
1200 iUplinkWindow->SetBlind( noVideo ); |
|
1201 iUplinkWindow->SetWaiting( EFalse ); |
|
1202 |
|
1203 if ( iUiStates->IsThisApplicationForeground() ) |
|
1204 { |
|
1205 // Update blind flags for incoming media: |
|
1206 VtUiUtility::GetIncomingMediaState( media, avail ); |
|
1207 avail = ~avail; |
|
1208 noVideo = ( avail & MVtEngMedia::EMediaVideo ); |
|
1209 if ( noVideo ) |
|
1210 { |
|
1211 iDownlinkWindow->SetStreamBitmap( NULL ); |
|
1212 } |
|
1213 iDownlinkWindow->SetBlind( noVideo ); |
|
1214 } |
|
1215 iDownlinkWindow->SetWaiting( iUiStates->IsWaitingForFirstFrame() ); |
|
1216 __VTPRINTEXIT( "VtUi.RefreshBlind" ) |
|
1217 } |
|
1218 } |
|
1219 |
|
1220 // ----------------------------------------------------------------------------- |
|
1221 // CVtUiAppUi::OpenNumberEntryL |
|
1222 // ----------------------------------------------------------------------------- |
|
1223 // |
|
1224 TBool CVtUiAppUi::OpenNumberEntryL() |
|
1225 { |
|
1226 __VTPRINTENTER( "VtUi.OpenNumberEntryL" ) |
|
1227 |
|
1228 CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar(); |
|
1229 if ( IsDisplayingDialog() || ( menuBar && menuBar->IsDisplayed() ) ) |
|
1230 { |
|
1231 __VTPRINTEXIT( "VtUi.OpenNumberEntryL" ) |
|
1232 return EFalse; |
|
1233 } |
|
1234 |
|
1235 TInt error( KErrNotFound ); |
|
1236 |
|
1237 MVtUiFeature* numberEntry = |
|
1238 iFeatureManager->GetFeatureById( EVtUiFeatureIdNumberEntry ); |
|
1239 |
|
1240 MVtUiFeature* dialer = |
|
1241 iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ); |
|
1242 |
|
1243 const TBool dialerActive( dialer && |
|
1244 ( dialer->State() == MVtUiFeature::EActive ) ); |
|
1245 |
|
1246 if ( numberEntry && !dialerActive ) |
|
1247 { |
|
1248 TRAP( error, numberEntry->StartL() ); |
|
1249 } |
|
1250 |
|
1251 const TBool result( !error ); |
|
1252 |
|
1253 if ( result ) |
|
1254 { |
|
1255 __VTPRINT( DEBUG_GEN, "VtUi.NumberEntry.StopZ" ) |
|
1256 RefreshSoftkeysL(); |
|
1257 } |
|
1258 |
|
1259 __VTPRINTEXITR( "VtUi.OpenNumberEntryL %d", result ) |
|
1260 return result; |
|
1261 } |
|
1262 |
|
1263 // ----------------------------------------------------------------------------- |
|
1264 // CVtUiAppUi::HandlePhoneSendKeyL |
|
1265 // Handles EKeyPhoneSend key events. |
|
1266 // ----------------------------------------------------------------------------- |
|
1267 // |
|
1268 TKeyResponse CVtUiAppUi::HandlePhoneSendKeyL( const TKeyEvent& /*aKeyEvent*/, |
|
1269 TEventCode aType ) |
|
1270 { |
|
1271 __VTPRINTENTER( "VtUi.HandlePhoneSendKeyL" ) |
|
1272 CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar(); |
|
1273 if ( !( IsDisplayingDialog() || ( menuBar && menuBar->IsDisplayed() ) ) ) |
|
1274 { |
|
1275 const TBool isNumberSource( iUiStates->IsNumberEntryOpen() || |
|
1276 iUiStates->IsDialerOpen() ); |
|
1277 if ( ( aType == EEventKey ) && isNumberSource ) |
|
1278 { |
|
1279 ProcessCommandL( EVtUiCmdDialEmergency ); |
|
1280 } |
|
1281 } |
|
1282 __VTPRINTEXIT( "VtUi.HandlePhoneSendKeyL" ) |
|
1283 return EKeyWasConsumed; |
|
1284 } |
|
1285 |
|
1286 // ----------------------------------------------------------------------------- |
|
1287 // CVtUiAppUi::StartDtmfTone |
|
1288 // ----------------------------------------------------------------------------- |
|
1289 // |
|
1290 void CVtUiAppUi::StartDtmfTone( const TChar& aTone ) |
|
1291 { |
|
1292 // should be called only through current application state |
|
1293 iDtmfTone = aTone; |
|
1294 __VTPRINT2( DEBUG_GEN, "VtUi.DTMF.Start.%d", iDtmfTone() ) |
|
1295 if ( Execute( KVtEngStartDtmfTone, &iDtmfTone ) != KErrNone ) |
|
1296 { |
|
1297 iDtmfTone = 0; |
|
1298 } |
|
1299 } |
|
1300 |
|
1301 // ----------------------------------------------------------------------------- |
|
1302 // CVtUiAppUi::StopDtmfTone |
|
1303 // ----------------------------------------------------------------------------- |
|
1304 // |
|
1305 void CVtUiAppUi::StopDtmfTone() |
|
1306 { |
|
1307 // should be called only through current application state |
|
1308 if ( iDtmfTone() ) |
|
1309 { |
|
1310 __VTPRINT( DEBUG_GEN, "VtUi.DTMF.STOP" ) |
|
1311 (void) Execute( KVtEngStopDtmfTone, NULL ); |
|
1312 iDtmfTone = 0; |
|
1313 } |
|
1314 } |
|
1315 |
|
1316 // ----------------------------------------------------------------------------- |
|
1317 // CVtUiAppUi::HandleWsEventL |
|
1318 // ----------------------------------------------------------------------------- |
|
1319 // |
|
1320 void CVtUiAppUi::HandleWsEventL( |
|
1321 const TWsEvent& aEvent, |
|
1322 CCoeControl* aDestination ) |
|
1323 { |
|
1324 __VTPRINTENTER( "VtUi.HandleWsEventL" ) |
|
1325 const TInt type = aEvent.Type(); |
|
1326 __VTPRINT2( DEBUG_GEN, "VtUi.HandleWsEventL type = %d", type ); |
|
1327 |
|
1328 // Zoom-in and Zoom-out keys need specific handling because keyup and |
|
1329 // keydown events cannot be checked from iCode field of TKeyEvent |
|
1330 if ( PreHandleKeyEventL( aEvent ) ) |
|
1331 { |
|
1332 __VTPRINTEXIT( "VtUi.HandleWsEventL (PreHandleKeyEventL)" ) |
|
1333 return; |
|
1334 } |
|
1335 |
|
1336 // Zoom mode is dismissed if some interrupting event happens prior timeout. |
|
1337 // Zoom mode can be interrupted with a keypress i.e. any keypress, except |
|
1338 // keys that are reserved for adjusting zoom dismiss zoom mode. Also any |
|
1339 // system event e.g. note or waiting call dismiss zoom mode. |
|
1340 if ( iUiStates->IsZoomModeOn() ) |
|
1341 { |
|
1342 if ( ProcessWsEventIfZoomModeIsActiveL( aEvent ) ) |
|
1343 { |
|
1344 __VTPRINTEXIT( "VtUi.HandleWsEventL (IsZoomModeOn)" ) |
|
1345 return; |
|
1346 } |
|
1347 } |
|
1348 // Zoom mode can be also activated with up and down arrow keys. |
|
1349 switch ( type ) |
|
1350 { |
|
1351 case EEventKey: |
|
1352 case EEventKeyUp: |
|
1353 case EEventKeyDown: |
|
1354 { |
|
1355 const TKeyEvent* keyEvent = aEvent.Key(); |
|
1356 const TBool isHwZoomKey( |
|
1357 keyEvent->iCode == EKeyZoomIn || |
|
1358 keyEvent->iCode == EKeyZoomOut ); |
|
1359 const TBool isZoomKey( |
|
1360 keyEvent->iScanCode == EStdKeyUpArrow || |
|
1361 keyEvent->iScanCode == EStdKeyDownArrow || |
|
1362 isHwZoomKey ); |
|
1363 |
|
1364 // Zoom mode can be also activated with up and down arrow keys. |
|
1365 if ( isZoomKey ) |
|
1366 { |
|
1367 const TBool isZoomAllowed( |
|
1368 !iEikonEnv->AppUiFactory()->MenuBar()->IsDisplayed() && |
|
1369 !iUiStates->MediaState().IsSharing() && |
|
1370 !iUiStates->MediaState().IsFrozen() && |
|
1371 !iUiStates->IsSelectingShare() && |
|
1372 VtUiUtility::IsZoomAllowed( Model().Media() ) && |
|
1373 !( iUiStates->IsNumberEntryOpen() && ShowNumberEntry() ) && |
|
1374 //there must not be the command which may switch provider to None |
|
1375 !IsActiveCommand( EVtUiCmdDisableVideo )&& |
|
1376 !IsActiveCommand( EVtUiCmdDisableBoth )&& |
|
1377 !IsActiveCommand( EVtUiCmdUsePrimaryCamera )&& |
|
1378 !IsActiveCommand( EVtUiCmdUseSecondaryCamera) ); |
|
1379 |
|
1380 if ( isZoomAllowed ) |
|
1381 { |
|
1382 // If menu is open, toolbar is available, video is frozen, |
|
1383 // sharing is on or user is selecting a file to be shared |
|
1384 // do not set zoom mode on. If HW zoom key was pressed, |
|
1385 // then zoom mode is activated even if toolbar is present. |
|
1386 if ( isHwZoomKey || !iUiStates->IsToolbarAvailable() ) |
|
1387 { |
|
1388 SetZoomModeL( ETrue ); |
|
1389 } |
|
1390 } |
|
1391 } |
|
1392 } |
|
1393 break; |
|
1394 default: |
|
1395 break; |
|
1396 } |
|
1397 |
|
1398 TBool partialForeGroundlost( EFalse ); |
|
1399 switch ( type ) |
|
1400 { |
|
1401 // Enter new rendering mode |
|
1402 case EVtUiWsEventBeginRenderingMode: |
|
1403 { |
|
1404 const TVtUiWsEvent< TRenderingMode >& event( |
|
1405 static_cast< const TVtUiWsEvent< TRenderingMode >& > |
|
1406 ( aEvent ) ); |
|
1407 MVtUiDialer* dialer = static_cast< CVtUiDialer* > ( |
|
1408 iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ) ); |
|
1409 __ASSERT_ALWAYS( dialer, |
|
1410 VtUiPanic::Panic( EVtUiPanicRendererNotFound ) ); |
|
1411 iInstance->iContextControl->MakeVisible( EFalse ); |
|
1412 SetRenderingModeL( *event.Data(), &dialer->VideoWindow() ); |
|
1413 } |
|
1414 break; |
|
1415 |
|
1416 // End rendering mode -> revert to previous |
|
1417 case EVtUiWsEventEndRenderingMode: |
|
1418 { |
|
1419 SetRenderingModeL( ERenderingModeDefault, iStoredDownlinkWindow ); |
|
1420 iInstance->iContextControl->MakeVisible( ETrue ); |
|
1421 iStoredDownlinkWindow = NULL; |
|
1422 } |
|
1423 break; |
|
1424 |
|
1425 // New number source have been activated |
|
1426 case EVtUiWsEventNumberSourceActivate: |
|
1427 { |
|
1428 const TVtUiWsEvent< MVtUiNumberSource >& event( |
|
1429 static_cast< const TVtUiWsEvent< MVtUiNumberSource >& > |
|
1430 ( aEvent ) ); |
|
1431 iNumberSource = event.Data(); |
|
1432 } |
|
1433 break; |
|
1434 |
|
1435 case EVtUiWsEventNumberSourceDeactivate: |
|
1436 { |
|
1437 const TVtUiWsEvent< MVtUiNumberSource >& event( |
|
1438 static_cast< const TVtUiWsEvent< MVtUiNumberSource >& > |
|
1439 ( aEvent ) ); |
|
1440 if ( iNumberSource == event.Data() ) |
|
1441 { |
|
1442 iNumberSource = NULL; |
|
1443 } |
|
1444 } |
|
1445 break; |
|
1446 |
|
1447 |
|
1448 // VT goes background e.g. selected application from fastswap |
|
1449 case KAknFullOrPartialForegroundLost: |
|
1450 { |
|
1451 // If capture mode is on stop it |
|
1452 if ( iUiStates->IsCaptureModeOn() ) |
|
1453 { |
|
1454 CmdCancelCaptureL(); |
|
1455 } |
|
1456 SetIncallBubbleAllowedInUsualL( ETrue ); |
|
1457 const TInt windowGroupId = |
|
1458 iCoeEnv->WsSession().GetFocusWindowGroup(); |
|
1459 |
|
1460 // In S60 5.0 we get PartialFocusLost also for some notes and |
|
1461 // overally items that are somehow overlapping screen instead of |
|
1462 // FocusLost. In those cases we should not put app to background. |
|
1463 if( ( windowGroupId != iThisApplicationWgId ) && |
|
1464 ( windowGroupId != iEikonServerWgId ) && |
|
1465 ( windowGroupId != iAknCapServerWgId ) && |
|
1466 ( windowGroupId != iAknNfyServerWgId ) ) |
|
1467 { |
|
1468 partialForeGroundlost = ETrue; |
|
1469 } |
|
1470 |
|
1471 // Fall through to EEventFocusLost event |
|
1472 } |
|
1473 case EEventFocusLost: |
|
1474 { |
|
1475 // If focus window group is not this application nor window server, |
|
1476 // then this application can not be in focus. |
|
1477 const TInt windowGroupId = |
|
1478 iCoeEnv->WsSession().GetFocusWindowGroup(); |
|
1479 |
|
1480 if ( ( windowGroupId != iThisApplicationWgId ) && |
|
1481 ( windowGroupId != iEikonServerWgId ) && |
|
1482 ( windowGroupId != iAknCapServerWgId ) && |
|
1483 ( windowGroupId != iAknNfyServerWgId ) || partialForeGroundlost ) |
|
1484 { |
|
1485 iCoeEnv->RootWin().DisableFocusChangeEvents(); |
|
1486 |
|
1487 TBool old = iUiStates->IsThisApplicationForeground(); |
|
1488 if ( old ) |
|
1489 { |
|
1490 TRAP_IGNORE( HandleForegroundChangedL( EFalse ) ); |
|
1491 } |
|
1492 } |
|
1493 } |
|
1494 break; |
|
1495 |
|
1496 case KAknFullOrPartialForegroundGained: |
|
1497 { |
|
1498 SetIncallBubbleAllowedInUsualL( EFalse ); |
|
1499 // Now this application is focused. |
|
1500 (void)iCoeEnv->RootWin().EnableFocusChangeEvents(); |
|
1501 TBool old = iUiStates->IsThisApplicationForeground(); |
|
1502 |
|
1503 if ( !old ) |
|
1504 { |
|
1505 (void) HandleLayoutChanged(); |
|
1506 TRAP_IGNORE( HandleForegroundChangedL( ETrue ) ); |
|
1507 } |
|
1508 } |
|
1509 break; |
|
1510 |
|
1511 case EEventKey: |
|
1512 case EEventKeyUp: |
|
1513 case EEventKeyDown: |
|
1514 { |
|
1515 // Key events with EModifierSpecial are received via FEP. |
|
1516 const TKeyEvent* keyEvent = aEvent.Key(); |
|
1517 if ( keyEvent->iModifiers & EModifierSpecial ) |
|
1518 { |
|
1519 TChar dtmfTone; |
|
1520 if ( VtUiUtility::IsDTMFEvent( *keyEvent, dtmfTone ) ) |
|
1521 { |
|
1522 if ( type == EEventKey ) |
|
1523 { |
|
1524 StartDtmfTone( dtmfTone ); |
|
1525 } |
|
1526 else if ( type == EEventKeyUp ) |
|
1527 { |
|
1528 StopDtmfTone(); |
|
1529 } |
|
1530 } |
|
1531 } |
|
1532 } |
|
1533 break; |
|
1534 |
|
1535 default: |
|
1536 break; |
|
1537 } |
|
1538 // Offer event to component manager |
|
1539 iComponentManager->HandleWsEventL( aEvent, aDestination ); |
|
1540 |
|
1541 // All events are sent to base class. |
|
1542 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
1543 __VTPRINTEXIT( "VtUi.HandleWsEventL" ) |
|
1544 } |
|
1545 |
|
1546 // ----------------------------------------------------------------------------- |
|
1547 // CVtUiAppUi::PreHandleKeyEventL |
|
1548 // |
|
1549 // ----------------------------------------------------------------------------- |
|
1550 // |
|
1551 TBool CVtUiAppUi::PreHandleKeyEventL( const TWsEvent& aEvent ) |
|
1552 { |
|
1553 __VTPRINTENTER( "VtUi.PreHandleKeyEventL" ) |
|
1554 TBool consumed( EFalse ); |
|
1555 switch( aEvent.Type() ) |
|
1556 { |
|
1557 |
|
1558 case EEventKey: |
|
1559 { |
|
1560 // when both these are set, then it's our simulated key press |
|
1561 const TInt |
|
1562 modifiers( EModifierKeypad | EModifierSpecial ); |
|
1563 |
|
1564 const TKeyEvent* ptrKeyEventC = |
|
1565 aEvent.Key(); |
|
1566 |
|
1567 const TBool isHwZoomKey( |
|
1568 ptrKeyEventC->iCode == EKeyZoomIn || |
|
1569 ptrKeyEventC->iCode == EKeyZoomOut ); |
|
1570 |
|
1571 if ( isHwZoomKey && |
|
1572 ( ptrKeyEventC->iModifiers & modifiers ) != modifiers ) |
|
1573 { |
|
1574 __VTPRINT3( DEBUG_GEN, "VtUi.PreHandleKeyEventL keyc=%d scanc=%d", |
|
1575 ptrKeyEventC->iCode, ptrKeyEventC->iScanCode ) |
|
1576 consumed = ETrue; |
|
1577 |
|
1578 // Send EEventKeyDown only when iRepeats is 0 |
|
1579 if ( !ptrKeyEventC->iRepeats ) |
|
1580 { |
|
1581 TKeyEvent keyDownEvent( *ptrKeyEventC ); |
|
1582 keyDownEvent.iRepeats = 0; |
|
1583 iCoeEnv->SimulateKeyEventL( keyDownEvent, EEventKeyDown ); |
|
1584 } |
|
1585 |
|
1586 // Send EEventKey always |
|
1587 TKeyEvent keyEvent( *ptrKeyEventC ); |
|
1588 keyEvent.iModifiers |= modifiers; |
|
1589 iCoeEnv->SimulateKeyEventL( keyEvent, EEventKey ); |
|
1590 |
|
1591 // Que EEventKeyUp |
|
1592 TKeyEvent keyUpEvent( *ptrKeyEventC ); |
|
1593 keyUpEvent.iRepeats = 0; |
|
1594 StoreKeyEventL( keyUpEvent ); |
|
1595 } |
|
1596 else if ( ( ptrKeyEventC->iModifiers & modifiers ) == modifiers ) |
|
1597 { |
|
1598 __VTPRINT( DEBUG_GEN, |
|
1599 "VtUi.PreHandleKeyEventL own event spotted, removing mods" ) |
|
1600 // event is generated by us, remove modifiers |
|
1601 TKeyEvent* ptrKeyEvent = const_cast< TKeyEvent* >( ptrKeyEventC ); |
|
1602 ptrKeyEvent->iModifiers &= ~modifiers; |
|
1603 } |
|
1604 } |
|
1605 break; |
|
1606 |
|
1607 case EEventKeyUp: |
|
1608 if ( iIsStoredKeyEvent ) |
|
1609 { |
|
1610 if ( iStoredKeyEvent.iScanCode == aEvent.Key()->iScanCode ) |
|
1611 { |
|
1612 consumed = ETrue; |
|
1613 SimulateStoredKeyEventL( EEventKeyUp ); |
|
1614 } |
|
1615 } |
|
1616 break; |
|
1617 |
|
1618 default: |
|
1619 break; |
|
1620 |
|
1621 } |
|
1622 |
|
1623 __VTPRINTEXITR( "VtUi.PreHandleKeyEventL %d", consumed ) |
|
1624 return consumed; |
|
1625 } |
|
1626 |
|
1627 // ----------------------------------------------------------------------------- |
|
1628 // CVtUiAppUi::SimulateStoredKeyEventL |
|
1629 // |
|
1630 // ----------------------------------------------------------------------------- |
|
1631 // |
|
1632 void CVtUiAppUi::SimulateStoredKeyEventL( const TEventCode aEventCode ) |
|
1633 { |
|
1634 __VTPRINTENTER( "VtUi.SimulateStoredKeyEventL" ) |
|
1635 if ( iIsStoredKeyEvent ) |
|
1636 { |
|
1637 // Reset flag first because SimulateKeyEventL() is synchronous |
|
1638 iIsStoredKeyEvent = EFalse; |
|
1639 iCoeEnv->SimulateKeyEventL( iStoredKeyEvent, aEventCode ); |
|
1640 } |
|
1641 __VTPRINTEXITR( "VtUi.SimulateStoredKeyEventL %d", iIsStoredKeyEvent ) |
|
1642 } |
|
1643 |
|
1644 // ----------------------------------------------------------------------------- |
|
1645 // CVtUiAppUi::StoreKeyEventL |
|
1646 // |
|
1647 // ----------------------------------------------------------------------------- |
|
1648 // |
|
1649 void CVtUiAppUi::StoreKeyEventL( const TKeyEvent& aKeyEvent ) |
|
1650 { |
|
1651 __VTPRINTENTER( "VtUi.StoreKeyEventL" ) |
|
1652 if ( iIsStoredKeyEvent && ( iStoredKeyEvent.iCode != aKeyEvent.iCode ) ) |
|
1653 { |
|
1654 SimulateStoredKeyEventL( EEventKeyUp ); |
|
1655 } |
|
1656 |
|
1657 if ( !iIsStoredKeyEvent ) |
|
1658 { |
|
1659 iIsStoredKeyEvent = ETrue; |
|
1660 iStoredKeyEvent = aKeyEvent; |
|
1661 } |
|
1662 __VTPRINTEXITR( "VtUi.StoreKeyEventL %d", iIsStoredKeyEvent ) |
|
1663 } |
|
1664 |
|
1665 // ----------------------------------------------------------------------------- |
|
1666 // CVtUiAppUi::DoTryToStartTb |
|
1667 // ----------------------------------------------------------------------------- |
|
1668 // |
|
1669 TInt CVtUiAppUi::DoTryToStartTbL( TAny* aAny ) |
|
1670 { |
|
1671 CVtUiAppUi* self = static_cast< CVtUiAppUi* >( aAny ); |
|
1672 self->TryToStartTbL(); |
|
1673 return KErrNone; |
|
1674 } |
|
1675 |
|
1676 // ----------------------------------------------------------------------------- |
|
1677 // CVtUiAppUi::UpdateVBSettingL |
|
1678 // ----------------------------------------------------------------------------- |
|
1679 // |
|
1680 void CVtUiAppUi::UpdateVBSettingL() |
|
1681 { |
|
1682 // If white balance or color tone setting |
|
1683 // feauture exists update setting |
|
1684 CVtUiWhiteBalance* wb = static_cast< CVtUiWhiteBalance* >( |
|
1685 iFeatureManager->GetFeatureById( EVtUiFeatureIdWhiteBalance ) ); |
|
1686 |
|
1687 CVtUiColorTone* ct = static_cast< CVtUiColorTone* >( |
|
1688 iFeatureManager->GetFeatureById( EVtUiFeatureIdColourTone ) ); |
|
1689 |
|
1690 // If brightness or contrast slider |
|
1691 // feauture exists update them |
|
1692 CVtUiBrightness* br = static_cast< CVtUiBrightness* >( |
|
1693 iFeatureManager->GetFeatureById( EVtUiFeatureIdBrightness ) ); |
|
1694 |
|
1695 CVtUiContrast* contr = static_cast< CVtUiContrast* >( |
|
1696 iFeatureManager->GetFeatureById( EVtUiFeatureIdContrast ) ); |
|
1697 |
|
1698 |
|
1699 |
|
1700 if ( wb && iUiStates->IsWhiteBalanceSettingAvailable() ) |
|
1701 { |
|
1702 __VTPRINT( DEBUG_GEN,"VtUi.UpdateVBSettingL WB update" ) |
|
1703 wb->UpdateSettingL(); |
|
1704 } |
|
1705 |
|
1706 if ( ct && iUiStates->IsColorToneSettingAvailable() ) |
|
1707 { |
|
1708 __VTPRINT( DEBUG_GEN,"VtUi.UpdateVBSettingL CT update" ) |
|
1709 ct->UpdateSettingL(); |
|
1710 } |
|
1711 |
|
1712 if ( br && iUiStates->IsBrightnessSettingAvailable() ) |
|
1713 { |
|
1714 __VTPRINT( DEBUG_GEN,"VtUi.UpdateVBSettingL br update" ) |
|
1715 br->UpdateSlider(); |
|
1716 } |
|
1717 |
|
1718 if ( contr && iUiStates->IsContrastSettingAvailable() ) |
|
1719 { |
|
1720 __VTPRINT( DEBUG_GEN,"VtUi.UpdateVBSettingL contract update" ) |
|
1721 contr->UpdateSlider(); |
|
1722 } |
|
1723 } |
|
1724 |
|
1725 // ----------------------------------------------------------------------------- |
|
1726 // CVtUiAppUi::TryToStartTb |
|
1727 // ----------------------------------------------------------------------------- |
|
1728 // |
|
1729 void CVtUiAppUi::TryToStartTbL() |
|
1730 { |
|
1731 __VTPRINTENTER( "VtUi.TryToStartTbL" ) |
|
1732 CVtUiToolbarBase* tb = static_cast< CVtUiToolbarBase* >( |
|
1733 iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ) ); |
|
1734 if ( tb ) |
|
1735 { |
|
1736 // If menu, dialog or dialer is displayed do not start the toolbar, |
|
1737 // but let the timer run another round |
|
1738 CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar(); |
|
1739 if ( !( menuBar && menuBar->IsDisplayed() ) && |
|
1740 !IsDisplayingDialog() && |
|
1741 !( |
|
1742 iUiStates->IsDialerActivating() || |
|
1743 iUiStates->IsDialerOpen() || |
|
1744 iUiStates->IsWhiteBalanceModeOn() || |
|
1745 iUiStates->IsColorToneModeOn() || |
|
1746 iUiStates->IsBrightnessModeOn() || |
|
1747 iUiStates->IsContrastModeOn() || |
|
1748 iUiStates->IsZoomModeOn() || |
|
1749 iUiStates->IsVolumeModeOn() || |
|
1750 iUiStates->IsCaptureModeOn() ) |
|
1751 ) |
|
1752 { |
|
1753 if ( iTbPeriodic ) |
|
1754 { |
|
1755 iTbPeriodic->Cancel(); |
|
1756 } |
|
1757 tb->StartL(); |
|
1758 } |
|
1759 } |
|
1760 __VTPRINTEXIT( "VtUi.TryToStartTbL" ) |
|
1761 } |
|
1762 |
|
1763 // ----------------------------------------------------------------------------- |
|
1764 // CVtUiAppUi::SetRenderingModeL |
|
1765 // ----------------------------------------------------------------------------- |
|
1766 // |
|
1767 void CVtUiAppUi::SetRenderingModeL( const TRenderingMode aMode, |
|
1768 MVtUiVideoWindow* aNewDownlink ) |
|
1769 { |
|
1770 __VTPRINTENTER( "VtUi.SetRenderingModeL" ) |
|
1771 __VTPRINT2( DEBUG_GEN, "VtUi.SetRenderingModeL=%d", aMode ); |
|
1772 iRenderingMode = aMode; |
|
1773 if ( aNewDownlink ) |
|
1774 { |
|
1775 if ( iDownlinkWindow != aNewDownlink ) |
|
1776 { |
|
1777 iStoredDownlinkWindow = iDownlinkWindow; |
|
1778 iDownlinkWindow = aNewDownlink; |
|
1779 iStoredDownlinkWindow->SetRemoteVideoControl(NULL); |
|
1780 iDownlinkWindow->SetRemoteVideoControl(iInstance->iRemoteVideoControl); |
|
1781 iDownlinkWindow->LayoutRemoteVideo(); |
|
1782 } |
|
1783 } |
|
1784 RefreshBlind(); |
|
1785 UpdateRenderingParametersL(); |
|
1786 __VTPRINTEXIT( "VtUi.SetRenderingModeL" ) |
|
1787 } |
|
1788 |
|
1789 // ----------------------------------------------------------------------------- |
|
1790 // CVtUiAppUi::UpdateRenderingParametersL |
|
1791 // ----------------------------------------------------------------------------- |
|
1792 // |
|
1793 void CVtUiAppUi::UpdateRenderingParametersL() |
|
1794 { |
|
1795 __VTPRINTENTER( "VtUi.UpdateRenderingParametersL" ) |
|
1796 |
|
1797 MVtEngMedia& media = Model().Media(); |
|
1798 const TBool viewFinderStarted = |
|
1799 media.RenderingStarted( MVtEngMedia::EMediaOutgoing ); |
|
1800 const TBool remoteRenderStarted = |
|
1801 media.RenderingStarted( MVtEngMedia::EMediaIncoming ); |
|
1802 |
|
1803 // Clear bitmaps |
|
1804 iInstance->iContextControl->SetStreamBitmap( NULL ); |
|
1805 iInstance->iMainControl->SetStreamBitmap( NULL ); |
|
1806 |
|
1807 // Stop viewfinder & remote render. |
|
1808 if( viewFinderStarted ) |
|
1809 { |
|
1810 ExecuteCmdL( KVtEngStopViewFinder ); |
|
1811 } |
|
1812 ExecuteCmdL( KVtEngStopRenderRemote ); |
|
1813 |
|
1814 // Re-layout the remote video |
|
1815 iDownlinkWindow->LayoutRemoteVideo(); |
|
1816 |
|
1817 const TBool uplinkWindowEqualsContextControl = |
|
1818 ( iUplinkWindow == iInstance->iContextControl ); |
|
1819 |
|
1820 // Prepare viewfinder. |
|
1821 TVtEngRenderingOptions configViewfinder( |
|
1822 uplinkWindowEqualsContextControl ? |
|
1823 DetermineContextControlOptions() : |
|
1824 DetermineMainControlOptions( EFalse ) ); |
|
1825 ExecuteCmdL( KVtEngPrepareViewFinder, configViewfinder ); |
|
1826 |
|
1827 // Prepare remote render. |
|
1828 TRAPD ( err, { |
|
1829 TVtEngRenderingOptionsNGA configRemoteRenderNGA( |
|
1830 DetermineRemoteVideoControlOptionsNGA() ); |
|
1831 ExecuteCmdL( |
|
1832 KVtEngPrepareRemoteRenderNGA, |
|
1833 configRemoteRenderNGA ); |
|
1834 } ); |
|
1835 if ( err != KErrNone ) |
|
1836 { |
|
1837 if ( viewFinderStarted ) |
|
1838 { |
|
1839 // Start viewfinder. |
|
1840 ExecuteCmdL( KVtEngStartViewFinder ); |
|
1841 } |
|
1842 User::Leave ( err ); |
|
1843 } |
|
1844 |
|
1845 // Start remote render. |
|
1846 TRAP_IGNORE( ExecuteCmdL( KVtEngStartRenderRemote ) ); |
|
1847 |
|
1848 if ( viewFinderStarted ) |
|
1849 { |
|
1850 // Start viewfinder. |
|
1851 ExecuteCmdL( KVtEngStartViewFinder ); |
|
1852 } |
|
1853 |
|
1854 // Redraw remote video last frame to make sure that in layout change |
|
1855 // situation we still have something on screen. |
|
1856 iDownlinkWindow->Redraw(); |
|
1857 __VTPRINTEXIT( "VtUi.UpdateRenderingParametersL" ) |
|
1858 } |
|
1859 |
|
1860 // ----------------------------------------------------------------------------- |
|
1861 // CVtUiAppUi::MediaStateChangedL |
|
1862 // ----------------------------------------------------------------------------- |
|
1863 // |
|
1864 void CVtUiAppUi::MediaStateChangedL() |
|
1865 { |
|
1866 CEikMenuBar* menuBar = iEikonEnv->AppUiFactory()->MenuBar(); |
|
1867 // close menu if it is shown |
|
1868 if ( menuBar && menuBar->IsDisplayed() ) |
|
1869 { |
|
1870 TKeyEvent keyEvent; |
|
1871 keyEvent.iCode = EKeyEscape; |
|
1872 menuBar->OfferKeyEventL( keyEvent, EEventKey ); |
|
1873 } |
|
1874 // Refresh toolbar |
|
1875 CVtUiToolbarBase* tb = static_cast< CVtUiToolbarBase* >( |
|
1876 iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ) ); |
|
1877 if ( tb ) |
|
1878 { |
|
1879 tb->RefreshL(); |
|
1880 } |
|
1881 } |
|
1882 |
|
1883 // ----------------------------------------------------------------------------- |
|
1884 // CVtUiAppUi::ProcessCommandL |
|
1885 // Processes commands. |
|
1886 // ----------------------------------------------------------------------------- |
|
1887 // |
|
1888 void CVtUiAppUi::ProcessCommandL( |
|
1889 TInt aCommand ) |
|
1890 { |
|
1891 __VTPRINTENTER( "VtUi.ProcessCommandL" ) |
|
1892 |
|
1893 // delay mute cmd received during layout change |
|
1894 if ( aCommand == EAknSoftkeyOptions ) |
|
1895 { |
|
1896 if ( iLayoutChg ) |
|
1897 { |
|
1898 iDelayedCmd = EAknSoftkeyOptions; |
|
1899 __VTPRINTEXIT( "VtUi.ProcessCommandL mute delayed due to LayoutChange" ) |
|
1900 return; |
|
1901 } |
|
1902 } |
|
1903 |
|
1904 MVtEngCommandHandler& command = Model().CommandHandler(); |
|
1905 command.ExecuteL( KVtEngRequestLastRemoteFrame, NULL ); |
|
1906 |
|
1907 // only with fixed toolbar |
|
1908 if ( AknLayoutUtils::PenEnabled() ) |
|
1909 { |
|
1910 if ( iUiStates->IsFixedToolbarVisible()) |
|
1911 { |
|
1912 // When option menu is opened fixed toolbar should |
|
1913 // be set hidden |
|
1914 iUiStates->SetIsFixedToolbarVisible( EFalse ); |
|
1915 // Stop toolbar |
|
1916 MVtUiFeature* tb = |
|
1917 iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ); |
|
1918 if ( tb ) |
|
1919 { |
|
1920 // timer could be active |
|
1921 if ( iTbPeriodic ) |
|
1922 { |
|
1923 iTbPeriodic->Cancel(); |
|
1924 } |
|
1925 tb->Stop(); |
|
1926 } |
|
1927 if ( !iTbPeriodic ) |
|
1928 { |
|
1929 iTbPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
1930 } |
|
1931 // Toolbar doesn't come visible until options menu is closed. |
|
1932 iTbPeriodic->Start( KStartTime, KPeriodTime, TCallBack( DoTryToStartTbL, this ) ); |
|
1933 } |
|
1934 } |
|
1935 else |
|
1936 { |
|
1937 StopSliders(); |
|
1938 } |
|
1939 |
|
1940 iInstance->iMainControl->SetSize( iInstance->iMainControl->Size() ); |
|
1941 iInstance->iMainControl->DrawNow(); |
|
1942 |
|
1943 // Handle OK options menu. |
|
1944 const TInt menuResource = |
|
1945 iUiStates->IsLaunchOkOptionsMenu() ? |
|
1946 R_VIDEOTELUI_OK_MENUBAR : |
|
1947 R_VIDEOTELUI_MENUBAR; |
|
1948 |
|
1949 iUiStates->SetLaunchOkOptionsMenu( EFalse ); |
|
1950 |
|
1951 CEikMenuBar* menu = iEikonEnv->AppUiFactory()->MenuBar(); |
|
1952 if ( menu ) |
|
1953 { |
|
1954 menu->SetMenuTitleResourceId( menuResource ); |
|
1955 //Here we again set back the type of menu to "Options" when pressed LSK |
|
1956 menu->SetMenuType( CEikMenuBar::EMenuOptions ); |
|
1957 } |
|
1958 CAknAppUi::ProcessCommandL( aCommand ); |
|
1959 } |
|
1960 |
|
1961 // ----------------------------------------------------------------------------- |
|
1962 // CVtUiAppUi::IsActiveCommand |
|
1963 // ----------------------------------------------------------------------------- |
|
1964 // |
|
1965 TBool CVtUiAppUi::IsActiveCommand( TInt aCommand ) const |
|
1966 { |
|
1967 return ( iActiveCommands.FindInOrder( aCommand ) != KErrNotFound ); |
|
1968 } |
|
1969 |
|
1970 // ----------------------------------------------------------------------------- |
|
1971 // CVtUiAppUi::State |
|
1972 // ----------------------------------------------------------------------------- |
|
1973 // |
|
1974 TVtUiAppStateBase& CVtUiAppUi::State() |
|
1975 { |
|
1976 return *iState; |
|
1977 } |
|
1978 |
|
1979 // ----------------------------------------------------------------------------- |
|
1980 // CVtUiAppUi::BitmapManager |
|
1981 // ----------------------------------------------------------------------------- |
|
1982 // |
|
1983 CVtUiBitmapManager& CVtUiAppUi::BitmapManager() |
|
1984 { |
|
1985 return *iInstance->iBitmapManager; |
|
1986 } |
|
1987 |
|
1988 // ----------------------------------------------------------------------------- |
|
1989 // CVtUiAppUi::TActiveCommand::TActiveCommand |
|
1990 // ----------------------------------------------------------------------------- |
|
1991 // |
|
1992 CVtUiAppUi::TActiveCommand::TActiveCommand( RArray< TInt >& aActiveCommands, |
|
1993 TInt aCommandId ) |
|
1994 : iActiveCommands( aActiveCommands ), iCommandId( aCommandId ) |
|
1995 { |
|
1996 } |
|
1997 |
|
1998 // ----------------------------------------------------------------------------- |
|
1999 // CVtUiAppUi::TActiveCommand::~TActiveCommand |
|
2000 // ----------------------------------------------------------------------------- |
|
2001 // |
|
2002 CVtUiAppUi::TActiveCommand::~TActiveCommand() |
|
2003 { |
|
2004 Close(); |
|
2005 } |
|
2006 |
|
2007 // ----------------------------------------------------------------------------- |
|
2008 // CVtUiAppUi::TActiveCommand::OpenL |
|
2009 // ----------------------------------------------------------------------------- |
|
2010 // |
|
2011 void CVtUiAppUi::TActiveCommand::OpenL() |
|
2012 { |
|
2013 iActiveCommands.InsertInOrderL( iCommandId ); |
|
2014 } |
|
2015 |
|
2016 // ----------------------------------------------------------------------------- |
|
2017 // CVtUiAppUi::TActiveCommand::Close |
|
2018 // ----------------------------------------------------------------------------- |
|
2019 // |
|
2020 void CVtUiAppUi::TActiveCommand::Close() |
|
2021 { |
|
2022 TInt index( iActiveCommands.FindInOrder( iCommandId ) ); |
|
2023 if ( index != KErrNotFound ) |
|
2024 { |
|
2025 iActiveCommands.Remove( index ); |
|
2026 } |
|
2027 } |
|
2028 |
|
2029 // ----------------------------------------------------------------------------- |
|
2030 // CVtUiAppUi::HandleCommandL |
|
2031 // Handles commands. |
|
2032 // ----------------------------------------------------------------------------- |
|
2033 // |
|
2034 void CVtUiAppUi::HandleCommandL( |
|
2035 TInt aCommand ) |
|
2036 { |
|
2037 __VTPRINTENTER( "VtUi.HandleCommand" ) |
|
2038 |
|
2039 // Check if same command is already being performed. |
|
2040 if ( IsActiveCommand( aCommand ) || ( iState && |
|
2041 iState->HandleCommandL( aCommand ) == |
|
2042 TVtUiAppStateBase::EEventHandled ) ) |
|
2043 { |
|
2044 __VTPRINTEXIT( "VtUi.HandleCommand <silently ignoring> 0" ) |
|
2045 return; |
|
2046 } |
|
2047 |
|
2048 // Check if command is allowed to be performed. |
|
2049 if ( !IsCommandAllowedL( aCommand ) ) |
|
2050 { |
|
2051 ShowNotAllowedNoteL(); |
|
2052 __VTPRINTEXITR( "VtUi.HandleCommand %d", KErrAccessDenied ) |
|
2053 return; |
|
2054 } |
|
2055 |
|
2056 // delay mute cmd received during layout change (EGWG-7QQ3GZ) |
|
2057 if ( (aCommand == EVtUiCmdDisableAudio) || (aCommand == EVtUiCmdUsePrimaryCamera) |
|
2058 ||(aCommand == EVtUiCmdUseSecondaryCamera) |
|
2059 ||(aCommand == EVtUiCmdDisableVideo) ) |
|
2060 { |
|
2061 if ( iLayoutChg ) |
|
2062 { |
|
2063 iDelayedCmd = aCommand; |
|
2064 __VTPRINTEXIT( "VtUi.HandleCommand mute delayed due to LayoutChange" ) |
|
2065 return; |
|
2066 } |
|
2067 } |
|
2068 |
|
2069 TActiveCommand activeCommand( iActiveCommands, aCommand ); |
|
2070 // Close() will be called by the destructor, when instance goes out of |
|
2071 // scope |
|
2072 activeCommand.OpenL(); |
|
2073 |
|
2074 TBool refresh = EFalse; |
|
2075 CleanupPushRefreshL(); |
|
2076 |
|
2077 // Execute command |
|
2078 switch ( aCommand ) |
|
2079 { |
|
2080 case EAknCmdHelp: |
|
2081 CmdHelpL(); |
|
2082 break; |
|
2083 |
|
2084 case EVtUiCmdOkOptions: |
|
2085 iUiStates->SetLaunchOkOptionsMenu( ETrue ); |
|
2086 ProcessCommandL( EAknSoftkeyOptions ); |
|
2087 break; |
|
2088 |
|
2089 case EVtUiCmdEnableMain: |
|
2090 case EVtUiCmdDisableMain: |
|
2091 // Submenu is opened automatically. |
|
2092 break; |
|
2093 |
|
2094 case EVtUiCmdEnableVideo: |
|
2095 { |
|
2096 MVtEngMedia::TShareObjectState shareObjectState; |
|
2097 VtUiUtility::GetObjectSharingState( Model().Media(), |
|
2098 shareObjectState ); |
|
2099 if( shareObjectState != MVtEngMedia::ESharingImage ) |
|
2100 { |
|
2101 refresh = ETrue; |
|
2102 EnableCommandActivatingAndCleanupPushL(); |
|
2103 CmdEnableVideoL(); |
|
2104 CleanupStack::PopAndDestroy(); |
|
2105 } |
|
2106 else |
|
2107 { |
|
2108 CmdStopShareImageL( refresh ); |
|
2109 EnableCommandActivatingAndCleanupPushL(); |
|
2110 CmdEnableVideoL(); |
|
2111 CleanupStack::PopAndDestroy(); |
|
2112 } |
|
2113 } |
|
2114 break; |
|
2115 |
|
2116 case EVtUiCmdEnableAudio: |
|
2117 refresh = ETrue; |
|
2118 CmdEnableAudioL(); |
|
2119 break; |
|
2120 |
|
2121 case EVtUiCmdEnableBoth: |
|
2122 EnableCommandActivatingAndCleanupPushL(); |
|
2123 CmdEnableAudioL(); |
|
2124 MVtEngMedia::TShareObjectState shareObjectState; |
|
2125 VtUiUtility::GetObjectSharingState( Model().Media(), |
|
2126 shareObjectState ); |
|
2127 if( shareObjectState != MVtEngMedia::ESharingImage ) |
|
2128 { |
|
2129 refresh = ETrue; |
|
2130 CmdEnableVideoL(); |
|
2131 } |
|
2132 else |
|
2133 { |
|
2134 CmdStopShareImageL( refresh ); |
|
2135 CmdEnableVideoL(); |
|
2136 } |
|
2137 // EnableCommandActivatingAndCleanupPushL |
|
2138 CleanupStack::PopAndDestroy(); |
|
2139 break; |
|
2140 |
|
2141 case EVtUiCmdDisableVideo: |
|
2142 refresh = ETrue; |
|
2143 EnableCommandActivatingAndCleanupPushL(); |
|
2144 CmdDisableVideoL(); |
|
2145 CleanupStack::PopAndDestroy(); |
|
2146 break; |
|
2147 |
|
2148 case EVtUiCmdDisableAudio: |
|
2149 refresh = ETrue; |
|
2150 EnableCommandActivatingAndCleanupPushL(); |
|
2151 CmdDisableAudioL(); |
|
2152 CleanupStack::PopAndDestroy(); |
|
2153 break; |
|
2154 |
|
2155 case EVtUiCmdDisableBoth: |
|
2156 HandleCommandL( EVtUiCmdDisableAudio ); |
|
2157 HandleCommandL( EVtUiCmdDisableVideo ); |
|
2158 break; |
|
2159 |
|
2160 case EVtUiCmdActivateBT: |
|
2161 refresh = ETrue; |
|
2162 EnableCommandActivatingAndCleanupPushL(); |
|
2163 CmdActivateBtL(); |
|
2164 CleanupStack::PopAndDestroy(); |
|
2165 break; |
|
2166 |
|
2167 case EVtUiCmdDeactivateBT: |
|
2168 refresh = ETrue; |
|
2169 EnableCommandActivatingAndCleanupPushL(); |
|
2170 CmdDeactivateBtL(); |
|
2171 CleanupStack::PopAndDestroy(); |
|
2172 break; |
|
2173 |
|
2174 case EVtUiCmdActivateLoudspeaker: |
|
2175 case EVtUiCmdSwitchFromBTToIHF: |
|
2176 refresh = ETrue; |
|
2177 EnableCommandActivatingAndCleanupPushL(); |
|
2178 CmdActivateLoudspeakerL(); |
|
2179 CleanupStack::PopAndDestroy(); |
|
2180 break; |
|
2181 |
|
2182 case EVtUiCmdDeactivateLoudspeaker: |
|
2183 refresh = ETrue; |
|
2184 EnableCommandActivatingAndCleanupPushL(); |
|
2185 CmdDeactivateLoudspeakerL(); |
|
2186 CleanupStack::PopAndDestroy(); |
|
2187 break; |
|
2188 |
|
2189 case EVtUiCmdUsePrimaryCamera: |
|
2190 refresh = ETrue; |
|
2191 CmdUseCameraL( ETrue ); |
|
2192 break; |
|
2193 |
|
2194 case EVtUiCmdUseSecondaryCamera: |
|
2195 refresh = ETrue; |
|
2196 CmdUseCameraL( EFalse ); |
|
2197 break; |
|
2198 |
|
2199 case EVtUiCmdSwapImagesPlaces: |
|
2200 refresh = ETrue; |
|
2201 CleanupPushEnableBlindL(); |
|
2202 iUiStates->SetDisableBlindSetting( ETrue ); |
|
2203 CmdSwapImagesPlacesL(); |
|
2204 |
|
2205 MVtEngMedia& media = Model().Media(); |
|
2206 if ( VtUiUtility::GetFreezeState( media ) ) |
|
2207 { |
|
2208 TBool isViewFinderInContextPane = IsViewFinderInContextPane(); |
|
2209 iUiStates->SetViewFindersInitialPlaceContextPane( isViewFinderInContextPane ); |
|
2210 } |
|
2211 |
|
2212 CleanupStack::PopAndDestroy(); // CleanupPushEnableBlindL |
|
2213 break; |
|
2214 |
|
2215 case EVtUiCmdZoom: |
|
2216 refresh = ETrue; |
|
2217 // Toolbar uses this same command to set zoom on and off |
|
2218 // therefore this works as a toggle button |
|
2219 SetZoomModeL( !iUiStates->IsZoomModeOn() ); |
|
2220 |
|
2221 break; |
|
2222 |
|
2223 case EAknSoftkeyBack: |
|
2224 { |
|
2225 refresh = ETrue; |
|
2226 MVtUiFeature* numberEntry = |
|
2227 iFeatureManager->GetFeatureById( EVtUiFeatureIdNumberEntry ); |
|
2228 if ( numberEntry ) |
|
2229 { |
|
2230 numberEntry->Stop(); |
|
2231 } |
|
2232 } |
|
2233 break; |
|
2234 |
|
2235 case EVtUiCmdSnapshot: |
|
2236 EnableCommandActivatingAndCleanupPushL(); |
|
2237 CmdSnapshotL(); |
|
2238 // EnableCommandActivatingAndCleanupPushL |
|
2239 CleanupStack::PopAndDestroy(); |
|
2240 break; |
|
2241 |
|
2242 case EVtUiCmdCapture: |
|
2243 CmdCaptureL(); |
|
2244 break; |
|
2245 |
|
2246 case EVtUiCmdCancelCapture: |
|
2247 CmdCancelCaptureL(); |
|
2248 break; |
|
2249 |
|
2250 case EVtUiCmdGoToIdle: |
|
2251 CmdGoToIdleL(); |
|
2252 break; |
|
2253 |
|
2254 // Object sharing related |
|
2255 |
|
2256 case EVtUiCmdShareObjectImage: |
|
2257 CmdInitializeShareImageL( refresh ); |
|
2258 break; |
|
2259 |
|
2260 case EVtUiCmdStopSharingObjectImage: |
|
2261 EnableCommandActivatingAndCleanupPushL(); |
|
2262 CmdStopShareImageL( refresh ); |
|
2263 // EnableCommandActivatingAndCleanupPushL |
|
2264 CleanupStack::PopAndDestroy(); |
|
2265 break; |
|
2266 |
|
2267 case EVtUiCmdAdjustVideoVideoQuality: |
|
2268 case EVtUiCmdAdjustVideoWhiteBalance: |
|
2269 case EVtUiCmdAdjustVideoBrightness: |
|
2270 case EVtUiCmdAdjustVideoContrast: |
|
2271 case EVtUiCmdAdjustVideoColourTone: |
|
2272 __VTPRINT( DEBUG_GEN, "VtUiHandleCommand.CmdAdjustVideoL" ); |
|
2273 CmdAdjustVideoL( aCommand ); |
|
2274 break; |
|
2275 |
|
2276 case EAknSoftkeyExit: |
|
2277 case EAknCmdExit: |
|
2278 case EEikCmdExit: |
|
2279 // handled by state |
|
2280 break; |
|
2281 |
|
2282 default: |
|
2283 iCommandManager->HandleCommandL( aCommand ); |
|
2284 break; |
|
2285 } |
|
2286 |
|
2287 if ( refresh ) |
|
2288 { |
|
2289 CleanupStack::PopAndDestroy(); // CleanupPushRefreshL |
|
2290 } |
|
2291 else |
|
2292 { |
|
2293 CleanupStack::Pop(); // CleanupPushRefreshL |
|
2294 } |
|
2295 __VTPRINTEXITR( "VtUi.HandleCommand %d", KErrNone ) |
|
2296 } |
|
2297 |
|
2298 // ----------------------------------------------------------------------------- |
|
2299 // CVtUiAppUi::DynInitMenuPaneL |
|
2300 // Initialises menu pane dynamically. |
|
2301 // ----------------------------------------------------------------------------- |
|
2302 // |
|
2303 void CVtUiAppUi::DynInitMenuPaneL( |
|
2304 TInt, |
|
2305 CEikMenuPane* aMenuPane ) |
|
2306 { |
|
2307 __VTPRINTENTER( "VtUi.DynInitMenuPaneL" ) |
|
2308 |
|
2309 CVtUiMenus* menus = static_cast< CVtUiMenus* >( |
|
2310 iFeatureManager->GetFeatureById( EVtUiFeatureIdMenu ) ); |
|
2311 if ( menus ) |
|
2312 { |
|
2313 iUiStates->Update(); |
|
2314 menus->SetMenuPane( aMenuPane ); |
|
2315 menus->RefreshL(); |
|
2316 } |
|
2317 __VTPRINTEXIT( "VtUi.DynInitMenuPaneL" ) |
|
2318 } |
|
2319 |
|
2320 // ----------------------------------------------------------------------------- |
|
2321 // CVtUiAppUi::HandleKeyEventL |
|
2322 // Handles key events. |
|
2323 // ----------------------------------------------------------------------------- |
|
2324 // |
|
2325 TKeyResponse CVtUiAppUi::HandleKeyEventL( |
|
2326 const TKeyEvent& aKeyEvent, |
|
2327 TEventCode aType ) |
|
2328 { |
|
2329 __VTPRINTENTER( "VtUi.HandleKeyEventL" ) |
|
2330 |
|
2331 TKeyResponse resp( EKeyWasNotConsumed ); |
|
2332 |
|
2333 if ( !iUiStates->IsNumberEntryOpen() || |
|
2334 ( iUiStates->IsNumberEntryOpen() && !ShowNumberEntry() ) ) |
|
2335 { |
|
2336 __VTPRINT( DEBUG_GEN, "VtUi.ToZoom" ) |
|
2337 |
|
2338 const TBool isHwZoomKey( aKeyEvent.iCode == EKeyZoomIn || |
|
2339 aKeyEvent.iCode == EKeyZoomOut ); |
|
2340 |
|
2341 // if outgoing video is frozen disable zoom |
|
2342 MVtEngMedia& media = Model().Media(); |
|
2343 if ( VtUiUtility::GetFreezeState ( media ) ) |
|
2344 { |
|
2345 if ( aKeyEvent.iScanCode == EStdKeyUpArrow || |
|
2346 aKeyEvent.iScanCode == EStdKeyDownArrow || |
|
2347 isHwZoomKey ) |
|
2348 { |
|
2349 __VTPRINTEXITR( "VtUi.HandleKeyEventL %d", EKeyWasConsumed ) |
|
2350 return EKeyWasConsumed; |
|
2351 } |
|
2352 } |
|
2353 |
|
2354 // Handle volume up & down |
|
2355 |
|
2356 } |
|
2357 |
|
2358 // If key event it not yet consumed, offer it to component manager |
|
2359 if ( resp == EKeyWasNotConsumed ) |
|
2360 { |
|
2361 resp = iComponentManager->OfferKeyEventL( aKeyEvent, aType ); |
|
2362 } |
|
2363 |
|
2364 __VTPRINTEXITR( "VtUi.HandleKeyEventL %d", resp ) |
|
2365 return resp; |
|
2366 } |
|
2367 |
|
2368 // ----------------------------------------------------------------------------- |
|
2369 // CVtUiAppUi::HandleResourceChangeL |
|
2370 // Handles change of a resource. |
|
2371 // ----------------------------------------------------------------------------- |
|
2372 // |
|
2373 void CVtUiAppUi::HandleResourceChangeL( |
|
2374 TInt aType ) |
|
2375 { |
|
2376 __VTPRINTENTER( "VtUi.HandleResourceChangeL" ) |
|
2377 const TBool layoutChange = |
|
2378 aType == KEikDynamicLayoutVariantSwitch || |
|
2379 aType == KAknsMessageSkinChange; |
|
2380 if ( iInstance && layoutChange ) |
|
2381 { |
|
2382 iInstance->iBitmapManager->InvalidateBitmaps(); |
|
2383 } |
|
2384 |
|
2385 CAknAppUi::HandleResourceChangeL( aType ); |
|
2386 |
|
2387 if ( iInstance ) |
|
2388 { |
|
2389 if ( layoutChange ) |
|
2390 { |
|
2391 CVtUiToolbarBase* tb = static_cast< CVtUiToolbarBase* >( |
|
2392 iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ) ); |
|
2393 if( tb ) |
|
2394 { |
|
2395 tb->HandleLayoutChangeL(); |
|
2396 } |
|
2397 // Relayout controls |
|
2398 iBlankControl->SetRect( ClientRect() ); |
|
2399 iInstance->LayoutChanged(); |
|
2400 } |
|
2401 if ( iInstance->iNaviPane ) |
|
2402 { |
|
2403 iInstance->iNaviPane->HandleResourceChange( aType ); |
|
2404 } |
|
2405 if ( layoutChange ) |
|
2406 { |
|
2407 (void) HandleLayoutChanged(); |
|
2408 } |
|
2409 } |
|
2410 |
|
2411 iComponentManager->HandleResourceChangeL( aType ); |
|
2412 |
|
2413 __VTPRINTEXIT( "VtUi.HandleResourceChangeL"); |
|
2414 } |
|
2415 |
|
2416 // ----------------------------------------------------------------------------- |
|
2417 // CVtUiAppUi::HandleForegroundEventL |
|
2418 // Handles foreground status change. |
|
2419 // ----------------------------------------------------------------------------- |
|
2420 // |
|
2421 void CVtUiAppUi::HandleForegroundEventL( TBool aForeground ) |
|
2422 { |
|
2423 CAknAppUi::HandleForegroundEventL( aForeground ); |
|
2424 |
|
2425 if ( !aForeground ) |
|
2426 { |
|
2427 StopDtmfTone(); |
|
2428 } |
|
2429 } |
|
2430 |
|
2431 // ----------------------------------------------------------------------------- |
|
2432 // CVtUiAppUi::GetEikonEnv |
|
2433 // ----------------------------------------------------------------------------- |
|
2434 // |
|
2435 CEikonEnv* CVtUiAppUi::GetEikonEnv() |
|
2436 { |
|
2437 return iEikonEnv; |
|
2438 } |
|
2439 |
|
2440 // ----------------------------------------------------------------------------- |
|
2441 // CVtUiAppUi::GetCba |
|
2442 // ----------------------------------------------------------------------------- |
|
2443 // |
|
2444 CEikButtonGroupContainer* CVtUiAppUi::GetCba() |
|
2445 { |
|
2446 return iCba; |
|
2447 } |
|
2448 |
|
2449 // |
|
2450 // ----------------------------------------------------------------------------- |
|
2451 // CVtUiAppUi::SetZoomModeL |
|
2452 // ----------------------------------------------------------------------------- |
|
2453 // |
|
2454 void CVtUiAppUi::SetZoomModeL( const TBool aEnableZoomMode, |
|
2455 const TBool aIsPermanent ) |
|
2456 { |
|
2457 __VTPRINTENTER( "VtUi.SetZoomModeL" ) |
|
2458 __VTPRINT2( DEBUG_GEN, "VtUi.SetZoomMo=%d", aEnableZoomMode ); |
|
2459 // If capture mode is on zoom mode cannot be changed |
|
2460 if ( iUiStates->IsCaptureModeOn() ) |
|
2461 { |
|
2462 __VTPRINTEXIT( "VtUi.SetZoomModeL.CaptureOn" ) |
|
2463 return; |
|
2464 } |
|
2465 CVtUiZoom* zoom = static_cast< CVtUiZoom* >( |
|
2466 iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom ) ); |
|
2467 if ( zoom ) |
|
2468 { |
|
2469 if ( aEnableZoomMode ) |
|
2470 { |
|
2471 if( aIsPermanent ) |
|
2472 { |
|
2473 zoom->SetPermanenVisibility( aEnableZoomMode ); |
|
2474 } |
|
2475 zoom->StartL(); |
|
2476 } |
|
2477 else |
|
2478 { |
|
2479 if( aIsPermanent ) |
|
2480 { |
|
2481 zoom->SetPermanenVisibility( aEnableZoomMode ); |
|
2482 } |
|
2483 zoom->Stop(); |
|
2484 } |
|
2485 } |
|
2486 iUiStates->SetZoomModeOn( aEnableZoomMode ); |
|
2487 CVtUiToolbarBase* tb = static_cast< CVtUiToolbarBase* >( |
|
2488 iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ) ); |
|
2489 if ( tb ) |
|
2490 { |
|
2491 tb->RefreshL(); |
|
2492 } |
|
2493 |
|
2494 __VTPRINTEXIT( "VtUi.SetZoomModeL" ) |
|
2495 } |
|
2496 |
|
2497 // ----------------------------------------------------------------------------- |
|
2498 // CVtUiAppUi::HelpContextL |
|
2499 // Returns help context array. |
|
2500 // ----------------------------------------------------------------------------- |
|
2501 // |
|
2502 CArrayFix<TCoeHelpContext>* CVtUiAppUi::HelpContextL() const |
|
2503 { |
|
2504 CArrayFix<TCoeHelpContext>* array = |
|
2505 new ( ELeave ) CArrayFixFlat<TCoeHelpContext>( KVtUiHelpContextAmount ); |
|
2506 CleanupStack::PushL( array ); |
|
2507 |
|
2508 array->AppendL( |
|
2509 TCoeHelpContext( |
|
2510 KVtUiTelephoneUid, |
|
2511 KINCAL_HLP_VIDEO_CALL ) ); |
|
2512 |
|
2513 CleanupStack::Pop( array ); |
|
2514 return array; |
|
2515 } |
|
2516 |
|
2517 // ----------------------------------------------------------------------------- |
|
2518 // CVtUiAppUi::ActiveExecExecuteL |
|
2519 // ----------------------------------------------------------------------------- |
|
2520 // |
|
2521 TBool CVtUiAppUi::ActiveExecExecuteL( |
|
2522 CVtUiActiveExec& /*aActiveExec*/, |
|
2523 const TInt aState, |
|
2524 TInt& aNextState, |
|
2525 TRequestStatus& aRequest ) |
|
2526 { |
|
2527 return ActiveExecInitExecuteL( |
|
2528 aState, |
|
2529 aNextState, |
|
2530 aRequest ); |
|
2531 } |
|
2532 |
|
2533 // ----------------------------------------------------------------------------- |
|
2534 // CVtUiAppUi::ActiveExecContinue |
|
2535 // ----------------------------------------------------------------------------- |
|
2536 // |
|
2537 TBool CVtUiAppUi::ActiveExecContinue( |
|
2538 CVtUiActiveExec& /*aActiveExec*/, |
|
2539 TInt& aState, |
|
2540 const TInt aError ) |
|
2541 { |
|
2542 return ActiveExecInitContinue( aState, aError ); |
|
2543 } |
|
2544 |
|
2545 // ----------------------------------------------------------------------------- |
|
2546 // CVtUiAppUi::ActiveExecCancel |
|
2547 // ----------------------------------------------------------------------------- |
|
2548 // |
|
2549 void CVtUiAppUi::ActiveExecCancel( |
|
2550 CVtUiActiveExec& /*aActiveExec*/, |
|
2551 TInt aState ) |
|
2552 { |
|
2553 ActiveExecInitCancel( aState ); |
|
2554 } |
|
2555 |
|
2556 // ----------------------------------------------------------------------------- |
|
2557 // CVtUiAppUi::ActiveExecDone |
|
2558 // ----------------------------------------------------------------------------- |
|
2559 // |
|
2560 void CVtUiAppUi::ActiveExecDone( |
|
2561 CVtUiActiveExec& /*aActiveExec*/, |
|
2562 const TInt aInitialState ) |
|
2563 { |
|
2564 ActiveExecInitDone( aInitialState ); |
|
2565 } |
|
2566 |
|
2567 // state object service handlers |
|
2568 |
|
2569 |
|
2570 // ----------------------------------------------------------------------------- |
|
2571 // CVtUiAppUi::ShutdownL |
|
2572 // ----------------------------------------------------------------------------- |
|
2573 // |
|
2574 void CVtUiAppUi::ShutdownL() |
|
2575 { |
|
2576 __VTPRINTENTER( "VtUi.ShutdownL" ) |
|
2577 |
|
2578 CVtUiWhiteBalance* wb = static_cast< CVtUiWhiteBalance* >( |
|
2579 iFeatureManager->GetFeatureById( EVtUiFeatureIdWhiteBalance ) ); |
|
2580 CVtUiColorTone* ct = static_cast< CVtUiColorTone* >( |
|
2581 iFeatureManager->GetFeatureById( EVtUiFeatureIdColourTone ) ); |
|
2582 |
|
2583 if ( wb && wb->State() == MVtUiFeature::EActive ) |
|
2584 { |
|
2585 __VTPRINT( DEBUG_GEN, "CVtUiWhiteBalance::DoDeactivateL" ); |
|
2586 wb->DoDeactivateL (); |
|
2587 } |
|
2588 if ( ct && ct->State() == MVtUiFeature::EActive ) |
|
2589 { |
|
2590 __VTPRINT( DEBUG_GEN, "CVtUiColorTone::DoDeactivateL" ); |
|
2591 ct->DoDeactivateL( ); |
|
2592 } |
|
2593 |
|
2594 // close volume slider |
|
2595 CVtUiVolume* volume = static_cast< CVtUiVolume* >( |
|
2596 iFeatureManager->GetFeatureById( EVtUiFeatureIdVolume ) ); |
|
2597 if ( volume ) |
|
2598 { |
|
2599 volume->Stop(); |
|
2600 } |
|
2601 // if capture mode is on stop the zoom |
|
2602 if ( iUiStates->IsCaptureModeOn() ) |
|
2603 { |
|
2604 CVtUiZoom* zoom = static_cast< CVtUiZoom* >( |
|
2605 iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom ) ); |
|
2606 if ( zoom ) |
|
2607 { |
|
2608 zoom->Stop(); |
|
2609 } |
|
2610 } |
|
2611 |
|
2612 iActiveExec->Start( EVtUiAppUiShutdown, *this ); |
|
2613 __VTPRINTEXIT( "VtUi.ShutdownL" ) |
|
2614 } |
|
2615 |
|
2616 // ----------------------------------------------------------------------------- |
|
2617 // CVtUiAppUi::StartupPhase1L |
|
2618 // ----------------------------------------------------------------------------- |
|
2619 // |
|
2620 void CVtUiAppUi::StartupPhase1L() |
|
2621 { |
|
2622 __VTPRINTENTER( "VtUi.StartupPhase1L" ) |
|
2623 iActiveExec->Start( EVtUiAppUiStartup, *this ); |
|
2624 __VTPRINTEXIT( "VtUi.StartupPhase1L" ) |
|
2625 } |
|
2626 |
|
2627 // ----------------------------------------------------------------------------- |
|
2628 // CVtUiAppUi::StartupPhase2L |
|
2629 // ----------------------------------------------------------------------------- |
|
2630 // |
|
2631 void CVtUiAppUi::StartupPhase2L() |
|
2632 { |
|
2633 __VTPRINTENTER( "VtUi.StartupPhase2L" ) |
|
2634 iActiveExec->Start( EVtUiAppUiAnswered, *this ); |
|
2635 __VTPRINTEXIT( "VtUi.StartupPhase2L" ) |
|
2636 } |
|
2637 |
|
2638 // ----------------------------------------------------------------------------- |
|
2639 // CVtUiAppUi::ChangeState |
|
2640 // ----------------------------------------------------------------------------- |
|
2641 // |
|
2642 void CVtUiAppUi::ChangeState( TVtUiAppStateBase* aState ) |
|
2643 { |
|
2644 __VTPRINTENTER( "VtUi.ChangeState" ) |
|
2645 iState = aState; |
|
2646 __VTPRINTEXIT( "VtUi.ChangeState" ) |
|
2647 } |
|
2648 |
|
2649 // ----------------------------------------------------------------------------- |
|
2650 // CVtUiAppUi::IsCommandAllowedL |
|
2651 // ----------------------------------------------------------------------------- |
|
2652 // |
|
2653 TBool CVtUiAppUi::IsCommandAllowedL( const TInt aCommand ) |
|
2654 { |
|
2655 return iCommandManager->IsCommandAllowedL( aCommand ); |
|
2656 } |
|
2657 |
|
2658 // ----------------------------------------------------------------------------- |
|
2659 // CVtUiAppUi::RefreshDisabledFlagsL |
|
2660 // ----------------------------------------------------------------------------- |
|
2661 // |
|
2662 void CVtUiAppUi::RefreshDisabledFlagsL() |
|
2663 { |
|
2664 // Refresh iDisabledFlags according to the current state. |
|
2665 TInt avail; |
|
2666 MVtEngMedia& media = Model().Media(); |
|
2667 VtUiUtility::GetOutgoingMediaState( media, avail ); |
|
2668 avail = ~avail; |
|
2669 |
|
2670 iDisabledFlags = 0; |
|
2671 if ( avail & MVtEngMedia::EMediaAudio ) |
|
2672 { |
|
2673 iDisabledFlags |= EDisabledAudio; |
|
2674 } |
|
2675 if ( avail & MVtEngMedia::EMediaVideo ) |
|
2676 { |
|
2677 iDisabledFlags |= EDisabledVideo; |
|
2678 } |
|
2679 |
|
2680 // If there are not cameras, then video options should be disabled. |
|
2681 if ( !VtUiUtility::HasCameras( media ) ) |
|
2682 { |
|
2683 iDisabledFlags |= EVideoOptionsDisabled; |
|
2684 } |
|
2685 } |
|
2686 |
|
2687 // ----------------------------------------------------------------------------- |
|
2688 // CVtUiAppUi::RefreshCameraOptionAvailability |
|
2689 // ----------------------------------------------------------------------------- |
|
2690 // |
|
2691 void CVtUiAppUi::RefreshCameraOptionAvailability( |
|
2692 TBool& aUsePrimaryCameraNotAllowed, |
|
2693 TBool& aUseSecondaryCameraNotAllowed ) |
|
2694 { |
|
2695 aUsePrimaryCameraNotAllowed = ETrue; |
|
2696 aUseSecondaryCameraNotAllowed = ETrue; |
|
2697 |
|
2698 // Check sources caps and current camera to see which |
|
2699 // items should be included to the menu. |
|
2700 |
|
2701 TInt sourcesCaps = 0; |
|
2702 MVtEngMedia& media = Model().Media(); |
|
2703 (void) media.GetSourcesCaps( sourcesCaps ); |
|
2704 |
|
2705 MVtEngMedia::TCameraId cameraId; |
|
2706 const TBool hasCameraId = |
|
2707 ( media.GetCurrentCameraId( cameraId ) == KErrNone ); |
|
2708 |
|
2709 if ( hasCameraId ) |
|
2710 { |
|
2711 // Camera is in use. Now selected camera is not included |
|
2712 // to the menu. |
|
2713 switch ( cameraId ) |
|
2714 { |
|
2715 case MVtEngMedia::EPrimaryCamera: |
|
2716 sourcesCaps &= |
|
2717 ~MVtEngMedia::ESourceCapsPrimaryCamera; |
|
2718 break; |
|
2719 |
|
2720 case MVtEngMedia::ESecondaryCamera: |
|
2721 sourcesCaps &= |
|
2722 ~MVtEngMedia::ESourceCapsSecondaryCamera; |
|
2723 break; |
|
2724 |
|
2725 default: |
|
2726 sourcesCaps = 0; |
|
2727 break; |
|
2728 } |
|
2729 } |
|
2730 else |
|
2731 { |
|
2732 // If camera is not in use, then the "enable video" option |
|
2733 // will automatically use one of the existing cameras. |
|
2734 // However, if there are two cameras, then we need |
|
2735 // to include secondary to the menu. |
|
2736 |
|
2737 const TInt bothCameras = |
|
2738 ( MVtEngMedia::ESourceCapsPrimaryCamera | |
|
2739 MVtEngMedia::ESourceCapsSecondaryCamera ); |
|
2740 sourcesCaps &= ~bothCameras; |
|
2741 if ( sourcesCaps == bothCameras ) |
|
2742 { |
|
2743 sourcesCaps &= |
|
2744 ~MVtEngMedia::ESourceCapsPrimaryCamera; |
|
2745 } |
|
2746 else |
|
2747 { |
|
2748 sourcesCaps = 0; |
|
2749 } |
|
2750 } |
|
2751 |
|
2752 sourcesCaps = ~sourcesCaps; |
|
2753 aUsePrimaryCameraNotAllowed = |
|
2754 ( sourcesCaps & MVtEngMedia::ESourceCapsPrimaryCamera ); |
|
2755 aUseSecondaryCameraNotAllowed = |
|
2756 ( sourcesCaps & MVtEngMedia::ESourceCapsSecondaryCamera ); |
|
2757 } |
|
2758 |
|
2759 // ----------------------------------------------------------------------------- |
|
2760 // VtUiAppUi::CmdCaptureL |
|
2761 // ----------------------------------------------------------------------------- |
|
2762 // |
|
2763 void CVtUiAppUi::CmdCaptureL() |
|
2764 { |
|
2765 //firstly need to know if underlying provider supports KVtEngFreeze |
|
2766 MVtEngCommandHandler& command = Model().CommandHandler(); |
|
2767 const TInt caps = command.GetCommandCaps( KVtEngFreeze ); |
|
2768 if ( (caps & MVtEngCommandHandler::EAttribEnabled) == 0) |
|
2769 { |
|
2770 return; |
|
2771 } |
|
2772 // end capture mode, image captured |
|
2773 iUiStates->SetCaptureModeOn( EFalse ); |
|
2774 // end zoom mode |
|
2775 SetZoomModeL( EFalse, ETrue ); |
|
2776 // freeze outgoing video |
|
2777 ExecuteCmdL( KVtEngFreeze ); |
|
2778 RefreshBlind(); |
|
2779 } |
|
2780 |
|
2781 // ----------------------------------------------------------------------------- |
|
2782 // VtUiAppUi::CmdSnapshotL |
|
2783 // ----------------------------------------------------------------------------- |
|
2784 // |
|
2785 void CVtUiAppUi::CmdSnapshotL() |
|
2786 { |
|
2787 __VTPRINTENTER( "VtUi.CmdSnapshotL" ) |
|
2788 |
|
2789 // zoom mode must be set on before capture mode is set on |
|
2790 SetZoomModeL( ETrue, ETrue ); |
|
2791 |
|
2792 // if outgoing video is already frozen |
|
2793 MVtEngMedia& media = Model().Media(); |
|
2794 const TBool isFrozen( VtUiUtility::GetFreezeState( media ) ); |
|
2795 if ( isFrozen ) |
|
2796 { |
|
2797 ExecuteCmdL( KVtEngUnfreeze ); |
|
2798 } |
|
2799 if ( !IsViewFinderInMainPane() ) |
|
2800 { |
|
2801 SwitchViewFinderToMainPaneL( !isFrozen ); |
|
2802 } |
|
2803 else if ( !isFrozen ) |
|
2804 { |
|
2805 iUiStates->SetViewFindersInitialPlaceContextPane( EFalse ); |
|
2806 } |
|
2807 |
|
2808 // set capture mode on |
|
2809 |
|
2810 iUiStates->SetCaptureModeOn( ETrue ); |
|
2811 RefreshStatesL(); |
|
2812 RefreshBlind(); |
|
2813 __VTPRINTEXIT( "VtUi.CmdSnapshotL" ) |
|
2814 } |
|
2815 |
|
2816 // ----------------------------------------------------------------------------- |
|
2817 // VtUiAppUi::CmdCancelCaptureL |
|
2818 // ----------------------------------------------------------------------------- |
|
2819 // |
|
2820 void CVtUiAppUi::CmdCancelCaptureL() |
|
2821 { |
|
2822 __VTPRINTENTER( "VtUi.CmdCancelCaptureL" ) |
|
2823 // end capture mode, image capture canceled |
|
2824 iUiStates->SetCaptureModeOn( EFalse ); |
|
2825 SetZoomModeL( EFalse, ETrue ); |
|
2826 RefreshStatesL(); |
|
2827 RestoreViewFinderL(); |
|
2828 RefreshBlind(); |
|
2829 __VTPRINTEXIT( "VtUi.CmdCancelCaptureL" ) |
|
2830 } |
|
2831 |
|
2832 // ----------------------------------------------------------------------------- |
|
2833 // CVtUiAppUi::CmdEnableVideoL |
|
2834 // ----------------------------------------------------------------------------- |
|
2835 // |
|
2836 void CVtUiAppUi::CmdEnableVideoL() |
|
2837 { |
|
2838 // if outgoing video is frozen |
|
2839 MVtEngMedia& media = Model().Media(); |
|
2840 if ( VtUiUtility::GetFreezeState( media ) ) |
|
2841 { |
|
2842 ExecuteCmdL( KVtEngUnfreeze ); |
|
2843 // swap images if needed |
|
2844 RestoreViewFinderL(); |
|
2845 } |
|
2846 else |
|
2847 { |
|
2848 ExecuteCmdL( KVtEngStopViewFinder ); |
|
2849 iUplinkWindow->SetStreamBitmap( NULL ); |
|
2850 MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaCamera; |
|
2851 ExecuteCmdL( KVtEngSetSource, source ); |
|
2852 MVtEngMedia::TCameraId id; |
|
2853 if ( Model().Media().GetCurrentCameraId( id ) == KErrInUse ) |
|
2854 { |
|
2855 ShowCameraInUseNoteL(); |
|
2856 } |
|
2857 ExecuteCmdL( KVtEngStartViewFinder ); |
|
2858 } |
|
2859 // update VB settings |
|
2860 UpdateVBSettingL(); |
|
2861 } |
|
2862 |
|
2863 // ----------------------------------------------------------------------------- |
|
2864 // CVtUiAppUi::CmdEnableAudioL |
|
2865 // ----------------------------------------------------------------------------- |
|
2866 // |
|
2867 void CVtUiAppUi::CmdEnableAudioL() |
|
2868 { |
|
2869 ExecuteCmdL( KVtEngUnmuteOutgoingAudio ); |
|
2870 } |
|
2871 |
|
2872 // ----------------------------------------------------------------------------- |
|
2873 // CVtUiAppUi::CmdDisableVideoL |
|
2874 // ----------------------------------------------------------------------------- |
|
2875 // |
|
2876 void CVtUiAppUi::CmdDisableVideoL() |
|
2877 { |
|
2878 |
|
2879 if( iUiStates->IsZoomModeOn() ) |
|
2880 { |
|
2881 // if zoom feature is active, stop that |
|
2882 MVtUiFeature* zm = iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom ); |
|
2883 if ( zm ) |
|
2884 { |
|
2885 if ( zm->State() == MVtUiFeature::EActive ) |
|
2886 { |
|
2887 __VTPRINT( DEBUG_GEN, "VtUi.CmdDisableVideoL zm->STOP" ) |
|
2888 zm->Stop(); |
|
2889 } |
|
2890 } |
|
2891 } |
|
2892 |
|
2893 ExecuteCmdL( KVtEngStopViewFinder ); |
|
2894 |
|
2895 iUplinkWindow->SetStreamBitmap( NULL ); |
|
2896 |
|
2897 TInt err = KErrNotFound; |
|
2898 if ( VtUiUtility::HasStillImage( Model().Media() ) ) |
|
2899 { |
|
2900 __VTPRINT( DEBUG_GEN, "VtUi.:CmdDisableVideoL.HasStill" ) |
|
2901 MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaStillImage; |
|
2902 TRAP( err, ExecuteCmdL( KVtEngSetSource, source ) ); |
|
2903 } |
|
2904 if ( ( err != KErrNone ) ) |
|
2905 { |
|
2906 __VTPRINT( DEBUG_GEN, "VtUi.:CmdDisableVideoL.MediaNone" ) |
|
2907 MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaNone; |
|
2908 ExecuteCmdL( KVtEngSetSource, source ); |
|
2909 } |
|
2910 |
|
2911 ExecuteCmdL( KVtEngStartViewFinder ); |
|
2912 } |
|
2913 |
|
2914 // ----------------------------------------------------------------------------- |
|
2915 // CVtUiAppUi::CmdDisableAudioL |
|
2916 // ----------------------------------------------------------------------------- |
|
2917 // |
|
2918 void CVtUiAppUi::CmdDisableAudioL() |
|
2919 { |
|
2920 ExecuteCmdL( KVtEngMuteOutgoingAudio ); |
|
2921 } |
|
2922 |
|
2923 // ----------------------------------------------------------------------------- |
|
2924 // CVtUiAppUi::CmdActivateBtL |
|
2925 // ----------------------------------------------------------------------------- |
|
2926 // |
|
2927 void CVtUiAppUi::CmdActivateBtL() |
|
2928 { |
|
2929 TInt error = KErrNone; |
|
2930 CVtUiActivateBtHfDialog* dialog = |
|
2931 new ( ELeave ) CVtUiActivateBtHfDialog( |
|
2932 NULL, |
|
2933 &error, |
|
2934 Model().CommandHandler(), |
|
2935 *iEventObserver ); |
|
2936 dialog->ExecuteDialogLD(); |
|
2937 |
|
2938 if ( error != KErrCancel ) |
|
2939 { |
|
2940 switch ( error ) |
|
2941 { |
|
2942 case KErrNone: |
|
2943 break; |
|
2944 |
|
2945 case KErrNoMemory: |
|
2946 case KErrNotSupported: |
|
2947 // Clear failure - to be handled in active scheduler. |
|
2948 User::Leave( error ); |
|
2949 break; |
|
2950 |
|
2951 default: |
|
2952 // Failed - still show local information note in error situation. |
|
2953 { |
|
2954 HBufC* prompt = |
|
2955 StringLoader::LoadLC( |
|
2956 R_VIDEOTELUI_QTN_BT_DEVICE_NOT_AVAIL ); |
|
2957 CAknInformationNote* note = |
|
2958 new ( ELeave ) CAknInformationNote( ETrue ); |
|
2959 note->ExecuteLD( *prompt ); |
|
2960 CleanupStack::PopAndDestroy( prompt ); |
|
2961 } |
|
2962 break; |
|
2963 } |
|
2964 } |
|
2965 } |
|
2966 |
|
2967 // ----------------------------------------------------------------------------- |
|
2968 // CVtUiAppUi::CmdDeactivateBtL |
|
2969 // ----------------------------------------------------------------------------- |
|
2970 // |
|
2971 void CVtUiAppUi::CmdDeactivateBtL() |
|
2972 { |
|
2973 // Command to Video tel engine |
|
2974 MVtEngAudio::TVtEngRoutingSetting audioSetting = |
|
2975 MVtEngAudio::EDeactivateBT; |
|
2976 |
|
2977 ExecuteCmdL( KVtEngSetAudioRouting, audioSetting ); |
|
2978 } |
|
2979 |
|
2980 // ----------------------------------------------------------------------------- |
|
2981 // CVtUiAppUi::CmdActivateLoudspeakerL |
|
2982 // ----------------------------------------------------------------------------- |
|
2983 // |
|
2984 void CVtUiAppUi::CmdActivateLoudspeakerL() |
|
2985 { |
|
2986 MVtEngAudio::TVtEngRoutingSetting audioSetting = |
|
2987 MVtEngAudio::EActivateHandsfree; |
|
2988 ExecuteCmdL( KVtEngSetAudioRouting, audioSetting ); |
|
2989 } |
|
2990 |
|
2991 // ----------------------------------------------------------------------------- |
|
2992 // CVtUiAppUi::CmdDeactivateLoudspeakerL |
|
2993 // ----------------------------------------------------------------------------- |
|
2994 // |
|
2995 void CVtUiAppUi::CmdDeactivateLoudspeakerL() |
|
2996 { |
|
2997 MVtEngAudio::TVtEngRoutingSetting audioSetting = |
|
2998 MVtEngAudio::EDeactivateHansfree; |
|
2999 ExecuteCmdL( KVtEngSetAudioRouting, audioSetting ); |
|
3000 } |
|
3001 |
|
3002 // ----------------------------------------------------------------------------- |
|
3003 // CVtUiAppUi::CmdSwapImagesPlacesL |
|
3004 // ----------------------------------------------------------------------------- |
|
3005 // |
|
3006 void CVtUiAppUi::CmdSwapImagesPlacesL() |
|
3007 { |
|
3008 __VTPRINTENTER( "VtUi.Swap" ) |
|
3009 |
|
3010 MVtEngMedia& media = Model().Media(); |
|
3011 const TBool viewFinderStarted = |
|
3012 media.RenderingStarted( MVtEngMedia::EMediaOutgoing ); |
|
3013 const TBool remoteRenderStarted = |
|
3014 media.RenderingStarted( MVtEngMedia::EMediaIncoming ); |
|
3015 |
|
3016 if ( viewFinderStarted ) |
|
3017 { |
|
3018 // Stop viewfinder. |
|
3019 __VTPRINT( DEBUG_GEN, "VtUi.Swap.VF.down" ) |
|
3020 ExecuteCmdL( KVtEngStopViewFinder ); |
|
3021 } |
|
3022 // Stop remote render. |
|
3023 __VTPRINT( DEBUG_GEN, "VtUi.Swap.RR.down" ) |
|
3024 ExecuteCmdL( KVtEngStopRenderRemote ); |
|
3025 |
|
3026 // Clear windows. |
|
3027 iUplinkWindow->Reset(); |
|
3028 iDownlinkWindow->Reset(); |
|
3029 |
|
3030 const TBool uplinkWindowEqualsContextControl = |
|
3031 ( iUplinkWindow == iInstance->iContextControl ); |
|
3032 |
|
3033 // Prepare viewfinder. |
|
3034 __VTPRINT( DEBUG_GEN, "VtUi.Swap.VF.upd" ) |
|
3035 TVtEngRenderingOptions configViewfinder( |
|
3036 uplinkWindowEqualsContextControl ? |
|
3037 DetermineMainControlOptions( EFalse ) : |
|
3038 DetermineContextControlOptions() ); |
|
3039 ExecuteCmdL( KVtEngPrepareViewFinder, configViewfinder ); |
|
3040 |
|
3041 // Swap windows. |
|
3042 if ( ERenderingModeDialer == iRenderingMode ) |
|
3043 { |
|
3044 MVtUiVideoWindow* tmpWindow = iUplinkWindow; |
|
3045 iUplinkWindow = iStoredDownlinkWindow; |
|
3046 iStoredDownlinkWindow = tmpWindow; |
|
3047 } |
|
3048 else |
|
3049 { |
|
3050 MVtUiVideoWindow* tmpWindow = iUplinkWindow; |
|
3051 iUplinkWindow = iDownlinkWindow; |
|
3052 iDownlinkWindow = tmpWindow; |
|
3053 } |
|
3054 iUplinkWindow->SetRemoteVideoControl(NULL); |
|
3055 iDownlinkWindow->SetRemoteVideoControl(iInstance->iRemoteVideoControl); |
|
3056 iDownlinkWindow->LayoutRemoteVideo(); |
|
3057 |
|
3058 // Prepare remote render. |
|
3059 __VTPRINT( DEBUG_GEN, "VtUi.Swap.RR.upd" ) |
|
3060 TRAPD ( err, { |
|
3061 TVtEngRenderingOptionsNGA configRemoteRenderNGA( |
|
3062 DetermineRemoteVideoControlOptionsNGA() ); |
|
3063 ExecuteCmdL( |
|
3064 KVtEngPrepareRemoteRenderNGA, |
|
3065 configRemoteRenderNGA ); |
|
3066 } ); |
|
3067 |
|
3068 if ( err != KErrNone ) |
|
3069 { |
|
3070 if ( viewFinderStarted ) |
|
3071 { |
|
3072 // Start viewfinder. |
|
3073 ExecuteCmdL( KVtEngStartViewFinder ); |
|
3074 } |
|
3075 User::Leave ( err ); |
|
3076 } |
|
3077 // Start remote render. |
|
3078 __VTPRINT( DEBUG_GEN, "VtUi.Swap.RR.up" ) |
|
3079 if ( remoteRenderStarted ) |
|
3080 { |
|
3081 ExecuteCmdL( KVtEngStartRenderRemote ); |
|
3082 } |
|
3083 |
|
3084 __VTPRINT( DEBUG_GEN, "VtUi.Swap.VF.up" ) |
|
3085 if ( viewFinderStarted ) |
|
3086 { |
|
3087 // Start viewfinder. |
|
3088 ExecuteCmdL( KVtEngStartViewFinder ); |
|
3089 } |
|
3090 |
|
3091 iDownlinkWindow->Redraw(); |
|
3092 |
|
3093 // Refresh blind & waiting will be handled in HandleCommandL. |
|
3094 __VTPRINTEXIT( "VtUi.Swap" ) |
|
3095 } |
|
3096 |
|
3097 // ----------------------------------------------------------------------------- |
|
3098 // CVtUiAppUi::CmdUseCameraL |
|
3099 // ----------------------------------------------------------------------------- |
|
3100 // |
|
3101 void CVtUiAppUi::CmdUseCameraL( const TBool aPrimaryCamera ) |
|
3102 { |
|
3103 EnableCommandActivatingAndCleanupPushL(); |
|
3104 MVtEngMedia& media = Model().Media(); |
|
3105 |
|
3106 MVtEngMedia::TMediaSource selectedSource = |
|
3107 ( aPrimaryCamera ) ? |
|
3108 MVtEngMedia::EMediaCameraPri : MVtEngMedia::EMediaCameraSec; |
|
3109 |
|
3110 TInt available = 0; |
|
3111 VtUiUtility::GetOutgoingMediaState( media, available ); |
|
3112 if ( available & MVtEngMedia::EMediaVideo ) |
|
3113 { |
|
3114 ExecuteCmdL( KVtEngStopViewFinder ); |
|
3115 |
|
3116 iUplinkWindow->SetStreamBitmap( NULL ); |
|
3117 TRAPD( err, ExecuteCmdL( KVtEngSetSource, selectedSource ) ); |
|
3118 |
|
3119 if ( err == KErrNone ) |
|
3120 { |
|
3121 ExecuteCmdL( KVtEngStartViewFinder ); |
|
3122 } |
|
3123 else |
|
3124 { |
|
3125 ShowOtherCameraNotUsableNoteL(); |
|
3126 } |
|
3127 } |
|
3128 else |
|
3129 { |
|
3130 MVtEngMedia::TPrepareCameraParams params; |
|
3131 params.iMediaSource = selectedSource; |
|
3132 params.iInitialize = EFalse; |
|
3133 TRAPD( err, ExecuteCmdL( KVtEngPrepareCamera, params ) ); |
|
3134 if ( err != KErrNone ) |
|
3135 { |
|
3136 ShowOtherCameraNotUsableNoteL(); |
|
3137 } |
|
3138 } |
|
3139 CleanupStack::PopAndDestroy(); // EnableCommandActivatingAndCleanupPushL |
|
3140 } |
|
3141 |
|
3142 // ----------------------------------------------------------------------------- |
|
3143 // CVtUiAppUi::CmdHelpL |
|
3144 // Launches help application. |
|
3145 // ----------------------------------------------------------------------------- |
|
3146 // |
|
3147 void CVtUiAppUi::CmdHelpL() |
|
3148 { |
|
3149 HlpLauncher::LaunchHelpApplicationL( |
|
3150 iEikonEnv->WsSession(), |
|
3151 AppHelpContextL() ); |
|
3152 } |
|
3153 |
|
3154 // ----------------------------------------------------------------------------- |
|
3155 // CVtUiAppUi::PrepareExitL |
|
3156 // ----------------------------------------------------------------------------- |
|
3157 // |
|
3158 void CVtUiAppUi::PrepareExitL() |
|
3159 { |
|
3160 __VTPRINTENTER( "VtUi.PrepareExitL" ) |
|
3161 // Cancel progress dialog |
|
3162 HideProgressDialogL(); |
|
3163 // Cancel menu. |
|
3164 CAknAppUi::ProcessCommandL( EEikCmdCanceled ); // does not leave |
|
3165 |
|
3166 if ( !iExitTimer->IsActive() ) |
|
3167 { |
|
3168 __VTPRINT( DEBUG_GEN, "VtUi.Exit.Timer.Go" ) |
|
3169 iExitTimer->Start( |
|
3170 KVtUiExitTimeout, |
|
3171 KVtUiExitTimeout, |
|
3172 TCallBack( DoHandleExitTimeout, this ) ); |
|
3173 } |
|
3174 |
|
3175 // Asynchronous shutdown - execute command. |
|
3176 iBlankControl->SetActive( ETrue ); |
|
3177 __VTPRINTEXIT( "VtUi.PrepareExitL" ) |
|
3178 } |
|
3179 |
|
3180 // ----------------------------------------------------------------------------- |
|
3181 // CVtUiAppUi::CmdUpdateZoomL |
|
3182 // This method is called to update zoom step to the Video Telephone engine |
|
3183 // side from the HandleKeyEventL method. |
|
3184 // ----------------------------------------------------------------------------- |
|
3185 // |
|
3186 void CVtUiAppUi::CmdUpdateZoomL() |
|
3187 { |
|
3188 __VTPRINTENTER( "VtUi.UpdZm" ) |
|
3189 |
|
3190 __VTPRINTEXIT( "VtUi.UpdZm" ) |
|
3191 } |
|
3192 |
|
3193 // ----------------------------------------------------------------------------- |
|
3194 // CVtUiAppUi::SetZoomFactorL |
|
3195 // ----------------------------------------------------------------------------- |
|
3196 // |
|
3197 void CVtUiAppUi::SetZoomFactorL( TInt aZoomStep ) |
|
3198 { |
|
3199 __VTPRINTENTER( "VtUi.SetZoomFactorL" ) |
|
3200 MVtEngMedia& media = Model().Media(); |
|
3201 if ( VtUiUtility::IsZoomAllowed( media ) ) |
|
3202 { |
|
3203 ExecuteCmdL( KVtEngSetZoomStep, aZoomStep ); |
|
3204 } |
|
3205 __VTPRINTEXIT( "VtUi.SetZoomFactorL" ) |
|
3206 } |
|
3207 |
|
3208 |
|
3209 // ----------------------------------------------------------------------------- |
|
3210 // CVtUiAppUi::CmdUpdateVolumeL |
|
3211 // This method is called to update volume to the Video Telephone engine |
|
3212 // side |
|
3213 // ----------------------------------------------------------------------------- |
|
3214 // |
|
3215 void CVtUiAppUi::CmdUpdateVolumeL( MVtEngAudio::TVtEngOutputVolume aVolume ) |
|
3216 { |
|
3217 __VTPRINTENTER( "VtUi.CmdUpdateVolumeL" ) |
|
3218 iVolCtrl->AdjustVolumeL( aVolume ); |
|
3219 __VTPRINTEXIT( "VtUi.CmdUpdateVolumeL" ) |
|
3220 } |
|
3221 |
|
3222 // ----------------------------------------------------------------------------- |
|
3223 // CVtUiAppUi::CmdGoToIdleL |
|
3224 // ----------------------------------------------------------------------------- |
|
3225 // |
|
3226 void CVtUiAppUi::CmdGoToIdleL() |
|
3227 { |
|
3228 __VTPRINTENTER( "VtUi.CmdGoToIdleL" ) |
|
3229 TInt idleUid = 0; |
|
3230 if ( RProperty::Get( |
|
3231 KPSUidAiInformation, |
|
3232 KActiveIdleUid, |
|
3233 idleUid ) == KErrNone ) |
|
3234 { |
|
3235 __VTPRINT2( DEBUG_GEN, "Idle UID: %d", idleUid ) |
|
3236 TApaTaskList taskList( iEikonEnv->WsSession() ); |
|
3237 TApaTask task = taskList.FindApp( TUid::Uid( idleUid ) ); |
|
3238 if ( task.Exists() ) |
|
3239 { |
|
3240 __VTPRINT( DEBUG_GEN, "Idle task found") |
|
3241 RProperty::Set( KPSUidUikon, KUikVideoCallTopApp, KVtUiAppUid.iUid ); |
|
3242 task.BringToForeground(); |
|
3243 } |
|
3244 } |
|
3245 __VTPRINTEXIT( "VtUi.CmdGoToIdleL" ) |
|
3246 } |
|
3247 |
|
3248 // ----------------------------------------------------------------------------- |
|
3249 // CVtUiAppUi::CmdInitializeShareImageL |
|
3250 // ----------------------------------------------------------------------------- |
|
3251 // |
|
3252 void CVtUiAppUi::CmdInitializeShareImageL( TBool& aNeedRefresh ) |
|
3253 { |
|
3254 __VTPRINTENTER( "VtUi.CmdInitializeShareImageL" ) |
|
3255 EnableCommandActivatingAndCleanupPushL(); |
|
3256 |
|
3257 MVtUiFeature* tb = |
|
3258 iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ); |
|
3259 if ( tb ) |
|
3260 { |
|
3261 // timer could be active |
|
3262 if ( iTbPeriodic ) |
|
3263 { |
|
3264 iTbPeriodic->Cancel(); |
|
3265 } |
|
3266 tb->Stop(); |
|
3267 } |
|
3268 CDesCArray* selectedFiles = new ( ELeave ) CDesCArrayFlat( 1 ); |
|
3269 CleanupStack::PushL( selectedFiles ); |
|
3270 CVtUiAppUi::CVtUiAppUiMGVerifier* verifier = |
|
3271 CVtUiAppUi::CVtUiAppUiMGVerifier::NewLC( *this, *iCoeEnv ); |
|
3272 |
|
3273 // number erntry is not availabe while media gallery is open |
|
3274 iInstance->iNumberEntryActivation->SetActive( EFalse ); |
|
3275 iUiStates->SetSelectingShare( ETrue ); |
|
3276 |
|
3277 TBool result( EFalse ); |
|
3278 TRAPD( err, result = |
|
3279 MGFetch::RunL( *selectedFiles, EImageFile, EFalse, verifier ) ); |
|
3280 |
|
3281 // leave occured |
|
3282 if ( err != KErrNone ) |
|
3283 { |
|
3284 if ( iUiStates->ExecState() == TVtUiStates::EExecStateRunning ) |
|
3285 { |
|
3286 ShowUnableToOpenNoteL(); |
|
3287 } |
|
3288 else |
|
3289 { |
|
3290 __VTPRINTEXIT( "VtUi.CmdInitializeShareImageL 1" ) |
|
3291 Exit(); |
|
3292 } |
|
3293 } |
|
3294 |
|
3295 if ( result && ( selectedFiles->Count() > 0 ) ) |
|
3296 { |
|
3297 MVtEngMedia::TShareObjectState shareObjectState; |
|
3298 VtUiUtility::GetObjectSharingState( Model().Media(), shareObjectState ); |
|
3299 iUiStates->SetViewFinderToMainPane( |
|
3300 shareObjectState == MVtEngMedia::ENotSharing ); |
|
3301 MVtEngMedia::TShareObjectImageParameters |
|
3302 parameters( selectedFiles->operator[]( 0 ) ); |
|
3303 ExecuteCmdL( KVtEngInitializeShareImage, parameters ); |
|
3304 aNeedRefresh = ETrue; |
|
3305 } |
|
3306 else // selection canceled start toolbar timer |
|
3307 { |
|
3308 if ( !iTbPeriodic ) |
|
3309 { |
|
3310 iTbPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
3311 } |
|
3312 iTbPeriodic->Cancel(); |
|
3313 iTbPeriodic->Start( KStartTime, KPeriodTime, TCallBack( DoTryToStartTbL, this ) ); |
|
3314 } |
|
3315 CleanupStack::PopAndDestroy( 2 ); // selectedFiles, verifier |
|
3316 // number entry is availabe again |
|
3317 iInstance->iNumberEntryActivation->SetActive( ETrue ); |
|
3318 iUiStates->SetSelectingShare( EFalse ); |
|
3319 CleanupStack::PopAndDestroy(); // EnableCommandActivatingAndCleanupPushL(); |
|
3320 |
|
3321 __VTPRINTEXIT( "VtUi.CmdInitializeShareImageL 0" ) |
|
3322 } |
|
3323 |
|
3324 // ----------------------------------------------------------------------------- |
|
3325 // CVtUiAppUi::CmdShareImageL |
|
3326 // ----------------------------------------------------------------------------- |
|
3327 // |
|
3328 void CVtUiAppUi::CmdShareImageL() |
|
3329 { |
|
3330 ExecuteCmdL( KVtEngStartShareImage ); |
|
3331 } |
|
3332 |
|
3333 // ----------------------------------------------------------------------------- |
|
3334 // CVtUiAppUi::CmdStopShareImageL |
|
3335 // ----------------------------------------------------------------------------- |
|
3336 // |
|
3337 void CVtUiAppUi::CmdStopShareImageL( TBool& aNeedRefresh ) |
|
3338 { |
|
3339 ExecuteCmdL( KVtEngStopShareImage ); |
|
3340 RestoreViewFinderL(); |
|
3341 aNeedRefresh = ETrue; |
|
3342 // update VB settings |
|
3343 UpdateVBSettingL(); |
|
3344 } |
|
3345 |
|
3346 // ----------------------------------------------------------------------------- |
|
3347 // CVtUiAppUi::HandleWaitingStateChange |
|
3348 // ----------------------------------------------------------------------------- |
|
3349 // |
|
3350 void CVtUiAppUi::HandleWaitingStateChange( TBool aIsWaiting ) |
|
3351 { |
|
3352 // Dialer must be closed in case of waiting call |
|
3353 MVtUiFeature* dialer = |
|
3354 iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ); |
|
3355 if ( dialer ) |
|
3356 { |
|
3357 dialer->Stop(); |
|
3358 } |
|
3359 iUiStates->SetWaitingCall( aIsWaiting ); |
|
3360 if (aIsWaiting == EFalse && |
|
3361 iIsWaitingCallState != EFalse && |
|
3362 !iUiStates->IsThisApplicationForeground() ) |
|
3363 { |
|
3364 iIsWaitingCallState = EFalse; |
|
3365 ChangeApplicationFocus( ETrue ); |
|
3366 TRAP_IGNORE ( SetHiddenL( EFalse ) ); |
|
3367 } |
|
3368 } |
|
3369 |
|
3370 // ----------------------------------------------------------------------------- |
|
3371 // CVtUiAppUi::ActiveExecInitExecuteL |
|
3372 // ----------------------------------------------------------------------------- |
|
3373 // |
|
3374 TBool CVtUiAppUi::ActiveExecInitExecuteL( |
|
3375 const TInt aState, |
|
3376 TInt& aNextState, |
|
3377 TRequestStatus& aRequest ) |
|
3378 { |
|
3379 __VTPRINTENTER( "VtUi.InitExec" ) |
|
3380 __VTPRINT2( DEBUG_GEN, "VtUi.InitExec.st=%d", aState ) |
|
3381 |
|
3382 TBool synch = EFalse; |
|
3383 |
|
3384 switch ( aState ) |
|
3385 { |
|
3386 // Startup chain: |
|
3387 case EVtUiAppUiStartupCloseDialogs: |
|
3388 // Close all dialogs. |
|
3389 iBlankControl->SetActive( EFalse ); |
|
3390 AknDialogShutter::ShutDialogsL( *iEikonEnv ); |
|
3391 iBlankControl->SetActive( ETrue ); |
|
3392 |
|
3393 synch = ETrue; |
|
3394 aNextState = EVtUiAppUiStartupInitEngine; |
|
3395 break; |
|
3396 |
|
3397 case EVtUiAppUiStartupInitEngine: |
|
3398 iUplinkWindow = iInstance->iContextControl; |
|
3399 iDownlinkWindow = iInstance->iMainControl; |
|
3400 ActiveExecInitExecuteCommandL( KVtEngInitializeEngine, aRequest ); |
|
3401 aNextState = EVtUiAppUiStartupPrepareViewfinder; |
|
3402 break; |
|
3403 |
|
3404 case EVtUiAppUiStartupPrepareViewfinder: |
|
3405 ActiveExecInitPrepareViewFinderL( aRequest ); |
|
3406 iUplinkWindow->SetStreamBitmap( NULL ); |
|
3407 aNextState = EVtUiAppUiStartupPrepareRemoteRender; |
|
3408 break; |
|
3409 |
|
3410 case EVtUiAppUiStartupPrepareRemoteRender: |
|
3411 |
|
3412 iInstance->CreateRemoteVideoControl(); |
|
3413 ActiveExecInitPrepareRemoteRenderL( aRequest ); |
|
3414 iDownlinkWindow->SetStreamBitmap( NULL ); |
|
3415 aNextState = EVtUiAppUiStartupRemoveBlank; |
|
3416 break; |
|
3417 |
|
3418 case EVtUiAppUiStartupRemoveBlank: |
|
3419 // Finally remove blank control. |
|
3420 iBlankControl->SetActive( EFalse ); |
|
3421 aNextState = EVtUiAppUiNone; |
|
3422 synch = ETrue; |
|
3423 break; |
|
3424 |
|
3425 // Shutdown chain: |
|
3426 case EVtUiAppUiShutdownCloseDialogs: |
|
3427 { |
|
3428 // Close all dialogs. |
|
3429 iBlankControl->SetActive( EFalse ); |
|
3430 AknDialogShutter::ShutDialogsL( *iEikonEnv ); |
|
3431 iBlankControl->SetActive( ETrue ); |
|
3432 |
|
3433 MVtUiFeature* numberEntry = iFeatureManager->GetFeatureById( |
|
3434 EVtUiFeatureIdNumberEntry ); |
|
3435 // Number entry may be active if its deactivation timer is still |
|
3436 // pending. Stop performs some cleanup which is needed before AppUi |
|
3437 // cleanup. |
|
3438 if ( numberEntry ) |
|
3439 { |
|
3440 numberEntry->Stop(); |
|
3441 } |
|
3442 |
|
3443 synch = ETrue; |
|
3444 aNextState = EVtUiAppUiShutdownHideApplication; |
|
3445 } |
|
3446 break; |
|
3447 |
|
3448 case EVtUiAppUiShutdownHideApplication: |
|
3449 if ( iUiStates->IsThisApplicationForeground() ) |
|
3450 { |
|
3451 BringTelephoneToForeground(); |
|
3452 } |
|
3453 else |
|
3454 { |
|
3455 ChangeApplicationFocus( EFalse ); |
|
3456 } |
|
3457 iDownlinkWindow->SetStreamBitmap( NULL ); |
|
3458 iUplinkWindow->SetStreamBitmap( NULL ); |
|
3459 SetHiddenL( ETrue ); |
|
3460 iEventObserver->DeleteRemConSession(); |
|
3461 |
|
3462 synch = ETrue; |
|
3463 aNextState = EVtUiAppUiShutdownResetEngine; |
|
3464 break; |
|
3465 |
|
3466 case EVtUiAppUiShutdownResetEngine: |
|
3467 { |
|
3468 aRequest = KRequestPending; |
|
3469 |
|
3470 MVtEngCommandHandler& command = Model().CommandHandler(); |
|
3471 // There should not be any commands ongoing because |
|
3472 // we have canceled all dialogs (and this should |
|
3473 // be the only command without dialog). |
|
3474 command.CancelCommand( command.PendingCommand() ); // ignore error |
|
3475 command.ExecuteL( KVtEngResetEngine, NULL ); |
|
3476 iShutdownRequest = &aRequest; |
|
3477 |
|
3478 aNextState = EVtUiAppUiShutdownRemoveBlank; |
|
3479 } |
|
3480 break; |
|
3481 |
|
3482 case EVtUiAppUiShutdownRemoveBlank: |
|
3483 // Finally remove blank control. |
|
3484 iBlankControl->SetActive( EFalse ); |
|
3485 |
|
3486 synch = ETrue; |
|
3487 aNextState = EVtUiAppUiNone; |
|
3488 break; |
|
3489 |
|
3490 // Answered chain: |
|
3491 case EVtUiAppUiAnsweredStart: |
|
3492 { |
|
3493 CVtUiBlankDialog* dialog = |
|
3494 new ( ELeave ) CVtUiBlankDialog( &iExecBlankDialog ); |
|
3495 dialog->ExecuteDialogNoWaitLD(); |
|
3496 iExecBlankDialog = dialog; |
|
3497 |
|
3498 synch = ETrue; |
|
3499 if ( iUiStates->IsLayoutChangeNeeded() ) |
|
3500 { |
|
3501 (void) HandleLayoutChanged(); |
|
3502 } |
|
3503 aNextState = EVtUiAppUiAnsweredRefreshNavi; |
|
3504 } |
|
3505 break; |
|
3506 |
|
3507 case EVtUiAppUiAnsweredRefreshNavi: |
|
3508 RefreshNaviPaneL(); |
|
3509 iEventObserver->CreateRemConSessionL(); |
|
3510 |
|
3511 synch = ETrue; |
|
3512 aNextState = EVtUiAppUiAnsweredRefreshSoftkeys; |
|
3513 break; |
|
3514 |
|
3515 case EVtUiAppUiAnsweredRefreshSoftkeys: |
|
3516 RefreshSoftkeysL(); |
|
3517 |
|
3518 synch = ETrue; |
|
3519 aNextState = EVtUiAppUiAnsweredStartRemoteRender; |
|
3520 break; |
|
3521 |
|
3522 case EVtUiAppUiAnsweredStartRemoteRender: |
|
3523 { |
|
3524 // Set waiting text to main control and start remote rendering. |
|
3525 // Video Telephone application should get KVtEngRemoteVideoStarted |
|
3526 // event when the first frame is received. |
|
3527 iDownlinkWindow->SetWaiting( ETrue ); |
|
3528 iUiStates->SetWaitingForFirstFrame( ETrue ); |
|
3529 //Must check if orientation changed between prepare remote render and start remote render |
|
3530 //If changed, update render parameter firstly |
|
3531 if ( iIsLandScapeOrientation != VtUiLayout::IsLandscapeOrientation() ) |
|
3532 { |
|
3533 __VTPRINT( DEBUG_GEN, "layout has been changed before start RemoteRender" ) |
|
3534 UpdateRenderingParametersL(); |
|
3535 } |
|
3536 |
|
3537 ActiveExecInitExecuteCommandL( KVtEngStartRenderRemote, |
|
3538 aRequest ); |
|
3539 |
|
3540 aNextState = EVtUiAppUiAnsweredCheckCamera; |
|
3541 } |
|
3542 break; |
|
3543 |
|
3544 case EVtUiAppUiAnsweredCheckCamera: |
|
3545 { |
|
3546 MVtEngMedia& media = Model().Media(); |
|
3547 if ( VtUiUtility::HasCameras( media ) ) |
|
3548 { |
|
3549 aNextState = EVtUiAppUiAnsweredChoose; |
|
3550 synch = ETrue; |
|
3551 } |
|
3552 else |
|
3553 { |
|
3554 if ( VtUiUtility::HasStillImage( media ) ) |
|
3555 { |
|
3556 aNextState = EVtUiAppUiAnsweredSelectStill; |
|
3557 } |
|
3558 else |
|
3559 { |
|
3560 aNextState = EVtUiAppUiAnsweredSelectNone; |
|
3561 } |
|
3562 |
|
3563 synch = ETrue; |
|
3564 } |
|
3565 } |
|
3566 break; |
|
3567 |
|
3568 case EVtUiAppUiAnsweredChoose: |
|
3569 { |
|
3570 // If camera is in use, then show note, |
|
3571 // select still image, stop. |
|
3572 // |
|
3573 // If call is mobile terminated, then show query. |
|
3574 // If user answers 'yes' to the query, |
|
3575 // then activate camera. |
|
3576 // If user answers 'no' to the query, |
|
3577 // then choose still image. |
|
3578 // |
|
3579 // If call is mobile originated, then select camera. |
|
3580 // |
|
3581 // If selecting a camera fails, then select still image. |
|
3582 // If selecting still image fails, then select none. |
|
3583 // |
|
3584 CVtEngModel& model = Model(); |
|
3585 MVtEngSessionInfo& session = model.Session(); |
|
3586 MVtEngMedia& media = model.Media(); |
|
3587 |
|
3588 MVtEngMedia::TCameraId id; |
|
3589 TInt cameraErr = model.Media().GetCurrentCameraId( id ); |
|
3590 if ( cameraErr == KErrInUse ) |
|
3591 { |
|
3592 // Camera is in use. |
|
3593 iUiStates->SetExecShowCameraInUse( ETrue ); |
|
3594 |
|
3595 if ( VtUiUtility::HasStillImage( media ) ) |
|
3596 { |
|
3597 aNextState = EVtUiAppUiAnsweredSelectStill; |
|
3598 } |
|
3599 else |
|
3600 { |
|
3601 aNextState = EVtUiAppUiAnsweredSelectNone; |
|
3602 } |
|
3603 } |
|
3604 else |
|
3605 { |
|
3606 // Check the direction of the call. |
|
3607 iUiStates->SetExecShowCameraInUse( EFalse ); |
|
3608 MVtEngSessionInfo::TDirection direction; |
|
3609 if ( session.GetDirection( direction ) != KErrNone ) |
|
3610 { |
|
3611 direction = MVtEngSessionInfo::EDirectionMT; |
|
3612 } |
|
3613 |
|
3614 if ( direction == MVtEngSessionInfo::EDirectionMT ) |
|
3615 { |
|
3616 // Start steps towards the "Allow video" query. |
|
3617 if ( VtUiUtility::HasStillImage( media ) ) |
|
3618 { |
|
3619 aNextState = EVtUiAppUiAnsweredQuerySetupStill; |
|
3620 } |
|
3621 else |
|
3622 { |
|
3623 aNextState = EVtUiAppUiAnsweredQuerySetupNone; |
|
3624 } |
|
3625 } |
|
3626 else |
|
3627 { |
|
3628 aNextState = EVtUiAppUiAnsweredDoPrepareCamera; |
|
3629 } |
|
3630 } |
|
3631 synch = ETrue; |
|
3632 } |
|
3633 break; |
|
3634 |
|
3635 case EVtUiAppUiAnsweredQuerySetupStill: |
|
3636 ActiveExecInitSetSourceL( MVtEngMedia::EMediaStillImage, aRequest ); |
|
3637 aNextState = EVtUiAppUiAnsweredQuerySetupStart; |
|
3638 break; |
|
3639 |
|
3640 case EVtUiAppUiAnsweredQuerySetupNone: |
|
3641 ActiveExecInitSetSourceL( MVtEngMedia::EMediaNone, aRequest ); |
|
3642 aNextState = EVtUiAppUiAnsweredQuerySetupStart; |
|
3643 break; |
|
3644 |
|
3645 case EVtUiAppUiAnsweredQuerySetupStart: |
|
3646 ActiveExecInitExecuteCommandL( KVtEngStartViewFinder, aRequest ); |
|
3647 aNextState = EVtUiAppUiAnsweredQueryShow; |
|
3648 break; |
|
3649 |
|
3650 case EVtUiAppUiAnsweredQueryShow: |
|
3651 { |
|
3652 RefreshL(); |
|
3653 TInt state = EPSCTsyCallStateUninitialized; |
|
3654 TInt err = RProperty::Get( |
|
3655 KPSUidCtsyCallInformation, |
|
3656 KCTsyCallState, |
|
3657 state ); |
|
3658 __VTPRINT3( DEBUG_GEN, "VtUi.InitExec WaitingCall State=%d, err=%d", |
|
3659 state, err ) |
|
3660 if ( EPSCTsyCallStateRinging != state ) |
|
3661 { |
|
3662 ChangeApplicationFocus( ETrue ); |
|
3663 SetHiddenL( EFalse ); |
|
3664 } |
|
3665 else |
|
3666 { |
|
3667 iIsWaitingCallState = ETrue; |
|
3668 } |
|
3669 |
|
3670 // User selectable call answer mute. |
|
3671 // In GS one can set call ansewer status |
|
3672 // eighter to query user, allways show, allways mute. |
|
3673 // GS values are checked from CR key ( KSettingsVTVideoSending ) |
|
3674 // (default value is 0 = allways query). |
|
3675 TVtUiGsMuteVariation camute; |
|
3676 __VTPRINT2( DEBUG_GEN, "VtUi.InitExe GS CR key KSettingsVTVideoSending querystate=%d", camute.GsMuteState() ) |
|
3677 if ( camute.GsMuteState() == KAllwaysQuery && !iUiStates->IsDeviceLockOn() && EPSCTsyCallStateRinging != state) |
|
3678 { |
|
3679 CVtUiAllowVideoDialog* dialog = |
|
3680 new ( ELeave ) CVtUiAllowVideoDialog( |
|
3681 &iExecDialog, |
|
3682 CAknQueryDialog::ENoTone ); |
|
3683 dialog->ExecuteDialogLD( aRequest ); |
|
3684 iExecDialog = dialog; |
|
3685 aNextState = EVtUiAppUiAnsweredQueryDecide; |
|
3686 } |
|
3687 else if ( camute.GsMuteState() == KAllwaysAllow ) |
|
3688 { |
|
3689 aNextState = EVtUiAppUiAnsweredDoPrepareCamera; |
|
3690 synch = ETrue; |
|
3691 } |
|
3692 else |
|
3693 { |
|
3694 aNextState = EVtUiAppUiNone; |
|
3695 synch = ETrue; |
|
3696 } |
|
3697 |
|
3698 } |
|
3699 break; |
|
3700 |
|
3701 case EVtUiAppUiAnsweredQueryDecide: |
|
3702 { |
|
3703 delete iExecDialog; |
|
3704 iExecDialog = NULL; |
|
3705 |
|
3706 if ( iActiveExec->RequestStatus() == |
|
3707 CVtUiAllowVideoDialog::EUserAllowed ) |
|
3708 { |
|
3709 aNextState = EVtUiAppUiAnsweredDoPrepareCamera; |
|
3710 } |
|
3711 else |
|
3712 { |
|
3713 aNextState = EVtUiAppUiNone; |
|
3714 } |
|
3715 |
|
3716 synch = ETrue; |
|
3717 } |
|
3718 break; |
|
3719 |
|
3720 case EVtUiAppUiAnsweredDoPrepareCamera: |
|
3721 { |
|
3722 MVtEngMedia& media = Model().Media(); |
|
3723 MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaCamera; |
|
3724 ActiveExecInitPrepareCameraL( source, aRequest ); |
|
3725 aNextState = EVtUiAppUiAnsweredSelectCamera; |
|
3726 } |
|
3727 break; |
|
3728 |
|
3729 case EVtUiAppUiAnsweredQuerySelectCamera: |
|
3730 case EVtUiAppUiAnsweredSelectCamera: |
|
3731 ActiveExecInitSetSourceL( MVtEngMedia::EMediaCamera, aRequest ); |
|
3732 if ( aState == EVtUiAppUiAnsweredSelectCamera ) |
|
3733 { |
|
3734 aNextState = EVtUiAppUiAnsweredStartViewfinder; |
|
3735 } |
|
3736 else |
|
3737 { |
|
3738 aNextState = EVtUiAppUiAnsweredQueryStartViewfinder; |
|
3739 } |
|
3740 break; |
|
3741 |
|
3742 case EVtUiAppUiAnsweredQuerySelectStill: |
|
3743 case EVtUiAppUiAnsweredSelectStill: |
|
3744 ActiveExecInitSetSourceL( MVtEngMedia::EMediaStillImage, aRequest ); |
|
3745 |
|
3746 if ( aState == EVtUiAppUiAnsweredSelectStill ) |
|
3747 { |
|
3748 aNextState = EVtUiAppUiAnsweredStartViewfinder; |
|
3749 } |
|
3750 else |
|
3751 { |
|
3752 aNextState = EVtUiAppUiAnsweredQueryStartViewfinder; |
|
3753 } |
|
3754 break; |
|
3755 |
|
3756 case EVtUiAppUiAnsweredQuerySelectNone: |
|
3757 case EVtUiAppUiAnsweredSelectNone: |
|
3758 ActiveExecInitSetSourceL( MVtEngMedia::EMediaNone, aRequest ); |
|
3759 |
|
3760 if ( aState == EVtUiAppUiAnsweredSelectNone ) |
|
3761 { |
|
3762 aNextState = EVtUiAppUiAnsweredStartViewfinder; |
|
3763 } |
|
3764 else |
|
3765 { |
|
3766 aNextState = EVtUiAppUiAnsweredQueryStartViewfinder; |
|
3767 } |
|
3768 break; |
|
3769 |
|
3770 case EVtUiAppUiAnsweredQueryStartViewfinder: |
|
3771 case EVtUiAppUiAnsweredStartViewfinder: |
|
3772 ActiveExecInitExecuteCommandL( KVtEngStartViewFinder, aRequest ); |
|
3773 |
|
3774 if ( aState == EVtUiAppUiAnsweredStartViewfinder ) |
|
3775 { |
|
3776 aNextState = EVtUiAppUiAnsweredFinish; |
|
3777 } |
|
3778 else |
|
3779 { |
|
3780 aNextState = EVtUiAppUiAnsweredQueryFinish; |
|
3781 } |
|
3782 break; |
|
3783 |
|
3784 case EVtUiAppUiAnsweredQueryFinish: |
|
3785 case EVtUiAppUiAnsweredFinish: |
|
3786 RefreshL(); |
|
3787 if ( iUiStates->IsExecShowCameraInUse() ) |
|
3788 { |
|
3789 ShowCameraInUseNoteL(); |
|
3790 } |
|
3791 |
|
3792 if ( aState != EVtUiAppUiAnsweredQueryFinish ) |
|
3793 { |
|
3794 ChangeApplicationFocus( ETrue ); |
|
3795 } |
|
3796 SetHiddenL( EFalse ); |
|
3797 |
|
3798 synch = ETrue; |
|
3799 aNextState = EVtUiAppUiNone; |
|
3800 break; |
|
3801 |
|
3802 default: |
|
3803 User::Leave( KErrNotSupported ); |
|
3804 break; |
|
3805 } |
|
3806 |
|
3807 __VTPRINT2( DEBUG_GEN, "VtUi.InitExec.sync=%d", synch ) |
|
3808 __VTPRINT2( DEBUG_GEN, "VtUi.InitExec.next=%d", aNextState ) |
|
3809 __VTPRINTEXITR( "VtUi.InitExec %d", synch ) |
|
3810 return synch; |
|
3811 } |
|
3812 |
|
3813 // ----------------------------------------------------------------------------- |
|
3814 // CVtUiAppUi::ActiveExecInitContinue |
|
3815 // ----------------------------------------------------------------------------- |
|
3816 // |
|
3817 TBool CVtUiAppUi::ActiveExecInitContinue( |
|
3818 TInt& aState, |
|
3819 const TInt aError ) |
|
3820 { |
|
3821 __VTPRINTENTER( "VtUi.InitExecCont" ) |
|
3822 __VTPRINT2( DEBUG_GEN, "VtUi.InitExecCont.st=%d", aState ) |
|
3823 //__VTPRINT2( DEBUG_GEN, "VtUi.InitExecCont.err=%d", aError ) |
|
3824 |
|
3825 const TInt state = aState; |
|
3826 switch ( state ) |
|
3827 { |
|
3828 case EVtUiAppUiStartupCloseDialogs: |
|
3829 case EVtUiAppUiStartupInitEngine: |
|
3830 case EVtUiAppUiStartupPrepareViewfinder: |
|
3831 case EVtUiAppUiStartupPrepareRemoteRender: |
|
3832 case EVtUiAppUiStartupRemoveBlank: |
|
3833 // Prepare failed. |
|
3834 break; |
|
3835 |
|
3836 case EVtUiAppUiShutdownCloseDialogs: |
|
3837 if( KErrNotReady == aError ) |
|
3838 { |
|
3839 aState = EVtUiAppUiShutdownHideApplication; |
|
3840 break; |
|
3841 } |
|
3842 case EVtUiAppUiShutdownResetEngine: |
|
3843 case EVtUiAppUiShutdownRemoveBlank: |
|
3844 // shutdown failed |
|
3845 break; |
|
3846 |
|
3847 case EVtUiAppUiShutdownHideApplication: |
|
3848 aState = EVtUiAppUiShutdownResetEngine; |
|
3849 break; |
|
3850 |
|
3851 |
|
3852 case EVtUiAppUiAnsweredStart: |
|
3853 aState = EVtUiAppUiAnsweredRefreshNavi; |
|
3854 break; |
|
3855 |
|
3856 case EVtUiAppUiAnsweredRefreshNavi: |
|
3857 aState = EVtUiAppUiAnsweredRefreshSoftkeys; |
|
3858 break; |
|
3859 |
|
3860 case EVtUiAppUiAnsweredRefreshSoftkeys: |
|
3861 aState = EVtUiAppUiAnsweredStartRemoteRender; |
|
3862 break; |
|
3863 |
|
3864 case EVtUiAppUiAnsweredStartRemoteRender: |
|
3865 case EVtUiAppUiAnsweredStartViewfinder: |
|
3866 case EVtUiAppUiAnsweredSelectNone: |
|
3867 case EVtUiAppUiAnsweredFinish: |
|
3868 case EVtUiAppUiAnsweredQueryStartViewfinder: |
|
3869 case EVtUiAppUiAnsweredQuerySelectNone: |
|
3870 case EVtUiAppUiAnsweredQueryFinish: |
|
3871 // Answered failed. |
|
3872 break; |
|
3873 |
|
3874 case EVtUiAppUiAnsweredCheckCamera: |
|
3875 aState = EVtUiAppUiAnsweredChoose; |
|
3876 break; |
|
3877 |
|
3878 case EVtUiAppUiAnsweredChoose: |
|
3879 aState = EVtUiAppUiAnsweredQuerySetupStill; |
|
3880 break; |
|
3881 |
|
3882 case EVtUiAppUiAnsweredQuerySetupStill: |
|
3883 aState = EVtUiAppUiAnsweredQuerySetupNone; |
|
3884 break; |
|
3885 |
|
3886 case EVtUiAppUiAnsweredQuerySetupStart: |
|
3887 case EVtUiAppUiAnsweredQuerySetupNone: |
|
3888 aState = EVtUiAppUiAnsweredQueryShow; |
|
3889 break; |
|
3890 |
|
3891 case EVtUiAppUiAnsweredQueryShow: |
|
3892 case EVtUiAppUiAnsweredQueryDecide: |
|
3893 case EVtUiAppUiAnsweredSelectCamera: |
|
3894 aState = EVtUiAppUiAnsweredSelectStill; |
|
3895 break; |
|
3896 |
|
3897 case EVtUiAppUiAnsweredQuerySelectCamera: |
|
3898 aState = EVtUiAppUiAnsweredQuerySelectStill; |
|
3899 break; |
|
3900 |
|
3901 case EVtUiAppUiAnsweredQuerySelectStill: |
|
3902 aState = EVtUiAppUiAnsweredQuerySelectNone; |
|
3903 break; |
|
3904 |
|
3905 case EVtUiAppUiAnsweredSelectStill: |
|
3906 aState = EVtUiAppUiAnsweredSelectNone; |
|
3907 break; |
|
3908 |
|
3909 default: |
|
3910 break; |
|
3911 } |
|
3912 |
|
3913 const TBool cont = ( aState != state ); |
|
3914 __VTPRINT2( DEBUG_GEN, "VtUi.InitExecCont.cont=%d", cont ) |
|
3915 |
|
3916 if ( !cont ) |
|
3917 { |
|
3918 delete iExecBlankDialog; |
|
3919 iExecBlankDialog = NULL; |
|
3920 // Operation failed. |
|
3921 if ( iState ) |
|
3922 { |
|
3923 TRAP_IGNORE( iState->AppUiStartupFailedL() ); |
|
3924 } |
|
3925 } |
|
3926 __VTPRINTEXITR( "VtUi.InitExecCont %d", cont ) |
|
3927 return cont; |
|
3928 } |
|
3929 |
|
3930 // ----------------------------------------------------------------------------- |
|
3931 // CVtUiAppUi::ActiveExecInitCancel |
|
3932 // ----------------------------------------------------------------------------- |
|
3933 // |
|
3934 void CVtUiAppUi::ActiveExecInitCancel( |
|
3935 const TInt /*aState*/ ) |
|
3936 { |
|
3937 __VTPRINTENTER( "VtUi.InitExecCancel" ) |
|
3938 |
|
3939 iBlankControl->SetActive( EFalse ); |
|
3940 delete iExecDialog; |
|
3941 delete iExecBlankDialog; |
|
3942 |
|
3943 if ( iShutdownRequest ) |
|
3944 { |
|
3945 User::RequestComplete( iShutdownRequest, KErrCancel ); |
|
3946 iShutdownRequest = NULL; |
|
3947 } |
|
3948 __VTPRINTEXIT( "VtUi.InitExecCancel" ) |
|
3949 } |
|
3950 |
|
3951 // ----------------------------------------------------------------------------- |
|
3952 // CVtUiAppUi::ActiveExecInitDone |
|
3953 // ----------------------------------------------------------------------------- |
|
3954 // |
|
3955 void CVtUiAppUi::ActiveExecInitDone( |
|
3956 const TInt aInitialState ) |
|
3957 { |
|
3958 __VTPRINTENTER( "VtUi.ExecInitDone" ) |
|
3959 __VTPRINT2( DEBUG_GEN, "VtUi.InitExecDone.ini=%d", aInitialState ) |
|
3960 delete iExecBlankDialog; |
|
3961 iExecBlankDialog = NULL; |
|
3962 // Operation succeeded |
|
3963 |
|
3964 // Now we have finished. |
|
3965 if ( iState ) |
|
3966 { |
|
3967 if ( aInitialState == EVtUiAppUiAnswered ) |
|
3968 { |
|
3969 TRAP_IGNORE( iState->AppUiStartupPhase2DoneL() ); |
|
3970 TRAP_IGNORE( AppUiInitDoneDoPostInitL() ); |
|
3971 } |
|
3972 else if ( aInitialState == EVtUiAppUiShutdown ) |
|
3973 { |
|
3974 TRAP_IGNORE( iState->ShutdownDoneL() ); |
|
3975 } |
|
3976 else // EVtUiAppUiStartup |
|
3977 { |
|
3978 TRAP_IGNORE( iState->AppUiStartupPhase1DoneL() ); |
|
3979 } |
|
3980 } |
|
3981 __VTPRINTEXIT( "VtUi.ExecInitDone" ) |
|
3982 } |
|
3983 |
|
3984 // ----------------------------------------------------------------------------- |
|
3985 // CVtUiAppUi::ActiveExecInitExecuteCommandL |
|
3986 // ----------------------------------------------------------------------------- |
|
3987 // |
|
3988 void CVtUiAppUi::ActiveExecInitExecuteCommandL( |
|
3989 const TVtEngCommandId aCommand, |
|
3990 TRequestStatus& aRequest ) |
|
3991 { |
|
3992 iExecDialog = |
|
3993 ExecuteCmdAsyncL( |
|
3994 &iExecDialog, |
|
3995 aCommand, |
|
3996 aRequest ); |
|
3997 } |
|
3998 |
|
3999 // ----------------------------------------------------------------------------- |
|
4000 // CVtUiAppUi::ActiveExecInitExecuteCommandL |
|
4001 // ----------------------------------------------------------------------------- |
|
4002 // |
|
4003 template < class T > |
|
4004 void CVtUiAppUi::ActiveExecInitExecuteCommandL( |
|
4005 const TVtEngCommandId aCommand, |
|
4006 T& aParam, |
|
4007 TRequestStatus& aRequest ) |
|
4008 { |
|
4009 iExecDialog = |
|
4010 ExecuteCmdAsyncL( |
|
4011 &iExecDialog, |
|
4012 aCommand, |
|
4013 aParam, |
|
4014 aRequest ); |
|
4015 } |
|
4016 |
|
4017 // ----------------------------------------------------------------------------- |
|
4018 // CVtUiAppUi::ActiveExecInitPrepareCameraL |
|
4019 // ----------------------------------------------------------------------------- |
|
4020 // |
|
4021 void CVtUiAppUi::ActiveExecInitPrepareCameraL( |
|
4022 const MVtEngMedia::TMediaSource aSource, |
|
4023 TRequestStatus& aRequest ) |
|
4024 { |
|
4025 MVtEngMedia::TPrepareCameraParams params; |
|
4026 params.iMediaSource = aSource; |
|
4027 params.iInitialize = ETrue; |
|
4028 iExecDialog = |
|
4029 ExecuteCmdAsyncL( |
|
4030 &iExecDialog, |
|
4031 KVtEngPrepareCamera, |
|
4032 params, |
|
4033 aRequest ); |
|
4034 } |
|
4035 |
|
4036 // ----------------------------------------------------------------------------- |
|
4037 // CVtUiAppUi::ActiveExecInitSetSourceL |
|
4038 // ----------------------------------------------------------------------------- |
|
4039 // |
|
4040 void CVtUiAppUi::ActiveExecInitSetSourceL( |
|
4041 const MVtEngMedia::TMediaSource aSource, |
|
4042 TRequestStatus& aRequest ) |
|
4043 { |
|
4044 MVtEngMedia::TMediaSource source = |
|
4045 aSource; |
|
4046 iExecDialog = |
|
4047 ExecuteCmdAsyncL( |
|
4048 &iExecDialog, |
|
4049 KVtEngSetSource, |
|
4050 source, |
|
4051 aRequest ); |
|
4052 } |
|
4053 |
|
4054 // ----------------------------------------------------------------------------- |
|
4055 // CVtUiAppUi::ActiveExecInitPrepareViewFinderL |
|
4056 // ----------------------------------------------------------------------------- |
|
4057 // |
|
4058 void CVtUiAppUi::ActiveExecInitPrepareViewFinderL( |
|
4059 TRequestStatus& aRequest ) |
|
4060 { |
|
4061 // Configure view finder to context pane. |
|
4062 if ( iEventObserver->CommandSupported( KVtEngPrepareViewFinder ) ) |
|
4063 { |
|
4064 TVtEngRenderingOptions configViewfinder( |
|
4065 DetermineContextControlOptions() ); |
|
4066 |
|
4067 iExecDialog = |
|
4068 ExecuteCmdAsyncL( |
|
4069 &iExecDialog, |
|
4070 KVtEngPrepareViewFinder, |
|
4071 configViewfinder, |
|
4072 aRequest ); |
|
4073 } |
|
4074 else |
|
4075 { |
|
4076 // Viewfinder does not support DSA - panic. |
|
4077 VtUiPanic::Panic( EVtUiPanicPrepareViewFinderNotSupported ); |
|
4078 } |
|
4079 } |
|
4080 |
|
4081 // ----------------------------------------------------------------------------- |
|
4082 // CVtUiAppUi::ActiveExecInitPrepareRemoteRenderL |
|
4083 // ----------------------------------------------------------------------------- |
|
4084 // |
|
4085 void CVtUiAppUi::ActiveExecInitPrepareRemoteRenderL( |
|
4086 TRequestStatus& aRequest ) |
|
4087 { |
|
4088 if ( iEventObserver->CommandSupported( KVtEngPrepareRemoteRenderNGA ) ) |
|
4089 { |
|
4090 // Cropping is performed when we draw the picture. |
|
4091 TVtEngRenderingOptionsNGA configRemoteRenderNGA( |
|
4092 DetermineRemoteVideoControlOptionsNGA() ); |
|
4093 |
|
4094 iExecDialog = |
|
4095 ExecuteCmdAsyncL( |
|
4096 &iExecDialog, |
|
4097 KVtEngPrepareRemoteRenderNGA, |
|
4098 configRemoteRenderNGA, |
|
4099 aRequest ); |
|
4100 } |
|
4101 else |
|
4102 { |
|
4103 // Neither supported - panic. |
|
4104 VtUiPanic::Panic( EVtUiPanicPrepareRemoteRenderNotSupported ); |
|
4105 } |
|
4106 } |
|
4107 |
|
4108 // ----------------------------------------------------------------------------- |
|
4109 // CVtUiAppUi::ActiveExecCmdExecuteCommandL |
|
4110 // ----------------------------------------------------------------------------- |
|
4111 // |
|
4112 void CVtUiAppUi::ActiveExecCmdExecuteCommandL( |
|
4113 const TVtEngCommandId aCommand, |
|
4114 TRequestStatus& aRequest ) |
|
4115 { |
|
4116 iCmdExecDialog = |
|
4117 ExecuteCmdAsyncL( |
|
4118 &iCmdExecDialog, |
|
4119 aCommand, |
|
4120 aRequest ); |
|
4121 } |
|
4122 |
|
4123 // ----------------------------------------------------------------------------- |
|
4124 // CVtUiAppUi::ActiveExecCmdSetSourceL |
|
4125 // ----------------------------------------------------------------------------- |
|
4126 // |
|
4127 void CVtUiAppUi::ActiveExecCmdSetSourceL( |
|
4128 const MVtEngMedia::TMediaSource aSource, |
|
4129 TRequestStatus& aRequest ) |
|
4130 { |
|
4131 MVtEngMedia::TMediaSource source = aSource; |
|
4132 iCmdExecDialog = |
|
4133 ExecuteCmdAsyncL( |
|
4134 &iCmdExecDialog, |
|
4135 KVtEngSetSource, |
|
4136 source, |
|
4137 aRequest ); |
|
4138 } |
|
4139 |
|
4140 // ----------------------------------------------------------------------------- |
|
4141 // CVtUiAppUi::ActiveExecCmdPrepareCameraL |
|
4142 // ----------------------------------------------------------------------------- |
|
4143 // |
|
4144 void CVtUiAppUi::ActiveExecCmdPrepareCameraL( |
|
4145 const MVtEngMedia::TMediaSource aSource, |
|
4146 TRequestStatus& aRequest ) |
|
4147 { |
|
4148 MVtEngMedia::TPrepareCameraParams params; |
|
4149 params.iMediaSource = aSource; |
|
4150 params.iInitialize = ETrue; |
|
4151 iCmdExecDialog = |
|
4152 ExecuteCmdAsyncL( |
|
4153 &iCmdExecDialog, |
|
4154 KVtEngPrepareCamera, |
|
4155 params, |
|
4156 aRequest ); |
|
4157 } |
|
4158 |
|
4159 // ----------------------------------------------------------------------------- |
|
4160 // CVtUiAppUi::DetermineMainControlOptions |
|
4161 // ----------------------------------------------------------------------------- |
|
4162 // |
|
4163 TVtEngRenderingOptions |
|
4164 CVtUiAppUi::DetermineMainControlOptions( TBool aRemoteVideo ) |
|
4165 { |
|
4166 // Determine main pane options. |
|
4167 TRect screen; |
|
4168 TAknWindowLineLayout stream; |
|
4169 TAknLayoutRect rect; |
|
4170 |
|
4171 screen = iInstance->iMainControl->Rect(); |
|
4172 VtUiLayout::GetSecondWindowStreamWholeLayout( |
|
4173 stream, aRemoteVideo && iUiStates->IsUseSQCif() ); |
|
4174 |
|
4175 rect.LayoutRect( screen, stream ); |
|
4176 screen = rect.Rect(); |
|
4177 |
|
4178 return TVtEngRenderingOptions( *iEventObserver, screen.Size() ); |
|
4179 } |
|
4180 |
|
4181 // ----------------------------------------------------------------------------- |
|
4182 // CVtUiAppUi::DetermineContextControlOptions |
|
4183 // ----------------------------------------------------------------------------- |
|
4184 // |
|
4185 TVtEngRenderingOptions CVtUiAppUi::DetermineContextControlOptions() |
|
4186 { |
|
4187 // Determine context pane options. |
|
4188 TRect screen; |
|
4189 TRect clip; |
|
4190 TAknWindowLineLayout stream; |
|
4191 TAknLayoutRect rect; |
|
4192 |
|
4193 VtUiLayout::GetApplicationParentRect( screen ); |
|
4194 VtUiLayout::GetFirstWindowBackgroundLayout( stream ); |
|
4195 rect.LayoutRect( screen, stream ); |
|
4196 TRect background = rect.Rect(); |
|
4197 |
|
4198 VtUiLayout::GetFirstWindowStreamLayout( stream ); |
|
4199 rect.LayoutRect( screen, stream ); |
|
4200 |
|
4201 // No cropping is performed, thus clip == screen. |
|
4202 clip = rect.Rect(); |
|
4203 clip.iTl -= background.iTl; |
|
4204 clip.iBr -= background.iTl; |
|
4205 |
|
4206 screen = clip; |
|
4207 |
|
4208 return |
|
4209 TVtEngRenderingOptions( |
|
4210 *iEventObserver, |
|
4211 screen.Size() ); |
|
4212 } |
|
4213 |
|
4214 // ----------------------------------------------------------------------------- |
|
4215 // CVtUiAppUi::DetermineDialerControlOptions |
|
4216 // ----------------------------------------------------------------------------- |
|
4217 // |
|
4218 TVtEngRenderingOptions CVtUiAppUi::DetermineDialerControlOptions() |
|
4219 { |
|
4220 MVtUiDialer* dialer = static_cast< CVtUiDialer* > ( |
|
4221 iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ) ); |
|
4222 |
|
4223 __ASSERT_ALWAYS( dialer, VtUiPanic::Panic( EVtUiPanicRendererNotFound ) ); |
|
4224 |
|
4225 return |
|
4226 TVtEngRenderingOptions( |
|
4227 *iEventObserver, |
|
4228 dialer->VideoControl().Size() ); |
|
4229 } |
|
4230 |
|
4231 // ----------------------------------------------------------------------------- |
|
4232 // CVtUiAppUi::DetermineMainControlOptions |
|
4233 // ----------------------------------------------------------------------------- |
|
4234 // |
|
4235 TVtEngRenderingOptionsDSA |
|
4236 CVtUiAppUi::DetermineMainControlOptionsDSA( TBool aRemoteVideo ) |
|
4237 { |
|
4238 // Determine main pane options. |
|
4239 TRect screen; |
|
4240 TRect clip; |
|
4241 TAknWindowLineLayout stream; |
|
4242 TAknLayoutRect rect; |
|
4243 const TBool usesSQCif( aRemoteVideo && iUiStates->IsUseSQCif() ); |
|
4244 screen = iInstance->iMainControl->Rect(); |
|
4245 VtUiLayout::GetSecondWindowStreamLayout( stream, |
|
4246 iUiStates->IsToolbarAvailable(), usesSQCif ); |
|
4247 rect.LayoutRect( screen, stream ); |
|
4248 clip = rect.Rect(); |
|
4249 |
|
4250 VtUiLayout::GetSecondWindowStreamWholeLayout( stream, |
|
4251 iUiStates->IsToolbarAvailable(), usesSQCif ); |
|
4252 rect.LayoutRect( screen, stream ); |
|
4253 screen = rect.Rect(); |
|
4254 |
|
4255 return |
|
4256 TVtEngRenderingOptionsDSA( |
|
4257 *iEventObserver, |
|
4258 iEikonEnv->WsSession(), |
|
4259 *( iEikonEnv->ScreenDevice() ), |
|
4260 *( iInstance->iMainControl->DrawableWindow() ), |
|
4261 clip, |
|
4262 screen ); |
|
4263 } |
|
4264 |
|
4265 // ----------------------------------------------------------------------------- |
|
4266 // CVtUiAppUi::DetermineContextControlOptionsDSA |
|
4267 // ----------------------------------------------------------------------------- |
|
4268 // |
|
4269 TVtEngRenderingOptionsDSA CVtUiAppUi::DetermineContextControlOptionsDSA() |
|
4270 { |
|
4271 // Determine context pane options. |
|
4272 TRect screen; |
|
4273 TRect clip; |
|
4274 TAknWindowLineLayout stream; |
|
4275 TAknLayoutRect rect; |
|
4276 |
|
4277 VtUiLayout::GetApplicationParentRect( screen ); |
|
4278 VtUiLayout::GetFirstWindowBackgroundLayout( stream ); |
|
4279 rect.LayoutRect( screen, stream ); |
|
4280 TRect background = rect.Rect(); |
|
4281 |
|
4282 VtUiLayout::GetFirstWindowStreamLayout( stream ); |
|
4283 rect.LayoutRect( screen, stream ); |
|
4284 |
|
4285 // No cropping is performed, thus clip == screen. |
|
4286 clip = rect.Rect(); |
|
4287 clip.iTl -= background.iTl; |
|
4288 clip.iBr -= background.iTl; |
|
4289 |
|
4290 screen = clip; |
|
4291 |
|
4292 return |
|
4293 TVtEngRenderingOptionsDSA( |
|
4294 *iEventObserver, |
|
4295 iEikonEnv->WsSession(), |
|
4296 *( iEikonEnv->ScreenDevice() ), |
|
4297 *( iInstance->iContextControl->DrawableWindow() ), |
|
4298 screen, |
|
4299 clip ); |
|
4300 } |
|
4301 |
|
4302 // ----------------------------------------------------------------------------- |
|
4303 // CVtUiAppUi::DetermineDialerControlOptionsDSA |
|
4304 // ----------------------------------------------------------------------------- |
|
4305 // |
|
4306 TVtEngRenderingOptionsDSA CVtUiAppUi::DetermineDialerControlOptionsDSA() |
|
4307 { |
|
4308 MVtUiDialer* dialer = static_cast< CVtUiDialer* > ( |
|
4309 iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ) ); |
|
4310 |
|
4311 __ASSERT_ALWAYS( dialer, VtUiPanic::Panic( EVtUiPanicRendererNotFound ) ); |
|
4312 |
|
4313 CCoeControl& videoWindow( dialer->VideoControl() ); |
|
4314 |
|
4315 return |
|
4316 TVtEngRenderingOptionsDSA( |
|
4317 *iEventObserver, |
|
4318 iEikonEnv->WsSession(), |
|
4319 *( iEikonEnv->ScreenDevice() ), |
|
4320 *( videoWindow.DrawableWindow() ), |
|
4321 videoWindow.Rect(), |
|
4322 videoWindow.Rect() ); |
|
4323 } |
|
4324 |
|
4325 // ----------------------------------------------------------------------------- |
|
4326 // CVtUiAppUi::DetermineMainControlOptionsDP |
|
4327 // ----------------------------------------------------------------------------- |
|
4328 // |
|
4329 TVtEngRenderingOptionsDP |
|
4330 CVtUiAppUi::DetermineMainControlOptionsDP( TBool aRemoteVideo ) |
|
4331 { |
|
4332 // Determine main pane options. |
|
4333 const TRect screen( iInstance->iMainControl->Rect() ); |
|
4334 TAknWindowLineLayout stream; |
|
4335 const TBool usesSQCif( aRemoteVideo && iUiStates->IsUseSQCif() ); |
|
4336 |
|
4337 // Even if the name is whole layout, this layout is (due to problem |
|
4338 // in layouts) video stream layout |
|
4339 TAknLayoutRect whole; |
|
4340 VtUiLayout::GetSecondWindowStreamWholeLayout( stream, |
|
4341 iUiStates->IsToolbarAvailable(), usesSQCif ); |
|
4342 whole.LayoutRect( screen, stream ); |
|
4343 |
|
4344 // Even if the name is actual layout, this layout is (due to problem |
|
4345 // in layouts) whole == clipping layout |
|
4346 TAknLayoutRect actual; |
|
4347 VtUiLayout::GetSecondWindowStreamLayout( stream, |
|
4348 iUiStates->IsToolbarAvailable(), usesSQCif ); |
|
4349 actual.LayoutRect( screen, stream ); |
|
4350 |
|
4351 return |
|
4352 TVtEngRenderingOptionsDP( |
|
4353 *iEventObserver, |
|
4354 iEikonEnv->WsSession(), |
|
4355 *( iEikonEnv->ScreenDevice() ), |
|
4356 *( iInstance->iMainControl->DrawableWindow() ), |
|
4357 actual.Rect(), |
|
4358 whole.Rect(), |
|
4359 iInstance->iMainControl->PositionRelativeToScreen() ); |
|
4360 } |
|
4361 |
|
4362 // ----------------------------------------------------------------------------- |
|
4363 // CVtUiAppUi::DetermineContextControlOptionsDP |
|
4364 // ----------------------------------------------------------------------------- |
|
4365 // |
|
4366 TVtEngRenderingOptionsDP CVtUiAppUi::DetermineContextControlOptionsDP() |
|
4367 { |
|
4368 // Determine context pane options. |
|
4369 TAknWindowLineLayout stream; |
|
4370 TAknLayoutRect rect; |
|
4371 |
|
4372 TRect screen; |
|
4373 VtUiLayout::GetApplicationParentRect( screen ); |
|
4374 VtUiLayout::GetFirstWindowBackgroundLayout( stream ); |
|
4375 rect.LayoutRect( screen, stream ); |
|
4376 const TRect background( rect.Rect() ); |
|
4377 |
|
4378 VtUiLayout::GetFirstWindowStreamLayout( stream ); |
|
4379 rect.LayoutRect( screen, stream ); |
|
4380 |
|
4381 // No cropping is performed, thus clip == screen. |
|
4382 TRect clip( rect.Rect() ); |
|
4383 clip.iTl -= background.iTl; |
|
4384 clip.iBr -= background.iTl; |
|
4385 |
|
4386 return |
|
4387 TVtEngRenderingOptionsDP( |
|
4388 *iEventObserver, |
|
4389 iEikonEnv->WsSession(), |
|
4390 *( iEikonEnv->ScreenDevice() ), |
|
4391 *( iInstance->iContextControl->DrawableWindow() ), |
|
4392 clip, |
|
4393 clip, |
|
4394 iInstance->iContextControl->PositionRelativeToScreen() ); |
|
4395 } |
|
4396 |
|
4397 // ----------------------------------------------------------------------------- |
|
4398 // CVtUiAppUi::DetermineDialerControlOptionsDP |
|
4399 // ----------------------------------------------------------------------------- |
|
4400 // |
|
4401 TVtEngRenderingOptionsDP CVtUiAppUi::DetermineDialerControlOptionsDP() |
|
4402 { |
|
4403 MVtUiDialer* dialer = static_cast< CVtUiDialer* > ( |
|
4404 iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ) ); |
|
4405 |
|
4406 __ASSERT_ALWAYS( dialer, VtUiPanic::Panic( EVtUiPanicRendererNotFound ) ); |
|
4407 |
|
4408 CCoeControl& videoWindow( dialer->VideoControl() ); |
|
4409 |
|
4410 TPoint offs( videoWindow.DrawableWindow()->AbsPosition() ); |
|
4411 TRect rect( videoWindow.Rect() ); |
|
4412 return |
|
4413 TVtEngRenderingOptionsDP( |
|
4414 *iEventObserver, |
|
4415 iEikonEnv->WsSession(), |
|
4416 *( iEikonEnv->ScreenDevice() ), |
|
4417 *( videoWindow.DrawableWindow() ), |
|
4418 rect, |
|
4419 rect, |
|
4420 offs ); |
|
4421 } |
|
4422 // ----------------------------------------------------------------------------- |
|
4423 // CVtUiAppUi::DetermineRemoteVideoControlOptionsNGA |
|
4424 // ----------------------------------------------------------------------------- |
|
4425 // |
|
4426 TVtEngRenderingOptionsNGA |
|
4427 CVtUiAppUi::DetermineRemoteVideoControlOptionsNGA() |
|
4428 { |
|
4429 return TVtEngRenderingOptionsNGA( *iEventObserver, |
|
4430 iInstance->iRemoteVideoControl ->GetRWindow() , iEikonEnv->WsSession()); |
|
4431 } |
|
4432 // ----------------------------------------------------------------------------- |
|
4433 // CVtUiAppUi::ExecuteCmdL |
|
4434 // ----------------------------------------------------------------------------- |
|
4435 // |
|
4436 void CVtUiAppUi::ExecuteCmdL( const TVtEngCommandId aCommand ) |
|
4437 { |
|
4438 DoExecuteCmdL( aCommand, NULL ); |
|
4439 } |
|
4440 |
|
4441 // ----------------------------------------------------------------------------- |
|
4442 // CVtUiAppUi::ExecuteCmdL |
|
4443 // ----------------------------------------------------------------------------- |
|
4444 // |
|
4445 template< class T > |
|
4446 void CVtUiAppUi::ExecuteCmdL( |
|
4447 const TVtEngCommandId aCommand, |
|
4448 T& aParam ) |
|
4449 { |
|
4450 TPtrC8 params( reinterpret_cast< TUint8* >( &aParam ), sizeof( T ) ); |
|
4451 DoExecuteCmdL( aCommand, ¶ms ); |
|
4452 } |
|
4453 |
|
4454 // ----------------------------------------------------------------------------- |
|
4455 // CVtUiAppUi::DoExecuteCmdL |
|
4456 // ----------------------------------------------------------------------------- |
|
4457 // |
|
4458 void CVtUiAppUi::DoExecuteCmdL( |
|
4459 const TVtEngCommandId aCommand, |
|
4460 TDesC8* aParams ) |
|
4461 { |
|
4462 __VTPRINT2( DEBUG_GEN, "VtUi.DoExec.cmd=%d", aCommand ) |
|
4463 MVtEngCommandHandler& command = Model().CommandHandler(); |
|
4464 const TInt caps = command.GetCommandCaps( aCommand ); |
|
4465 |
|
4466 if ( caps >= KErrNone ) |
|
4467 { |
|
4468 const TBool asynchronous = |
|
4469 ( caps & MVtEngCommandHandler::EAttribAsync ); |
|
4470 |
|
4471 if ( asynchronous ) |
|
4472 { |
|
4473 if ( aCommand == KVtEngHandleLayoutChange ) |
|
4474 { |
|
4475 CVtEngCmdExec* cmdExec = CVtEngCmdExec::NewL( |
|
4476 Model().CommandHandler(), *iEventObserver, *GetCba() ); |
|
4477 cmdExec->ExecuteCmdLD( aCommand ); |
|
4478 } |
|
4479 else |
|
4480 { |
|
4481 CVtUiExecuteCmdDialog* dlg = |
|
4482 new ( ELeave ) CVtUiExecuteCmdDialog( |
|
4483 NULL, |
|
4484 Model().CommandHandler(), |
|
4485 *iEventObserver ); |
|
4486 dlg->ExecuteCmdLD( aCommand, aParams, NULL ); |
|
4487 } |
|
4488 } |
|
4489 else |
|
4490 { |
|
4491 command.ExecuteL( aCommand, aParams ); |
|
4492 RefreshStatesL(); |
|
4493 } |
|
4494 } |
|
4495 else |
|
4496 { |
|
4497 // Failed. |
|
4498 User::Leave( caps ); |
|
4499 } |
|
4500 } |
|
4501 |
|
4502 // ----------------------------------------------------------------------------- |
|
4503 // CVtUiAppUi::HandleShutdownReady |
|
4504 // ----------------------------------------------------------------------------- |
|
4505 // |
|
4506 void CVtUiAppUi::HandleShutdownReady() |
|
4507 { |
|
4508 __VTPRINTENTER( "VtUi.HandleShutdownReady" ) |
|
4509 |
|
4510 if(iAsyncCallback->IsActive()) |
|
4511 { |
|
4512 iAsyncCallback->Cancel(); |
|
4513 } |
|
4514 |
|
4515 iAsyncCallback->Set( |
|
4516 TCallBack( &DoExit, this ) ); |
|
4517 iAsyncCallback->CallBack(); |
|
4518 __VTPRINTEXIT( "VtUi.HandleShutdownReady" ) |
|
4519 } |
|
4520 |
|
4521 // ----------------------------------------------------------------------------- |
|
4522 // CVtUiAppUi::ContextControl |
|
4523 // ----------------------------------------------------------------------------- |
|
4524 // |
|
4525 CVtUiContextControl& CVtUiAppUi::ContextControl() |
|
4526 { |
|
4527 __VTPRINTENTER( "VtUi.ContextControl" ) |
|
4528 __VTPRINTEXIT( "VtUi.ContextControl" ) |
|
4529 return *iInstance->iContextControl; |
|
4530 } |
|
4531 |
|
4532 // ----------------------------------------------------------------------------- |
|
4533 // CVtUiAppUi::MainControl |
|
4534 // ----------------------------------------------------------------------------- |
|
4535 // |
|
4536 CVtUiMainControl& CVtUiAppUi::MainControl() |
|
4537 { |
|
4538 __VTPRINTENTER( "VtUi.MainControl" ) |
|
4539 __VTPRINTEXIT( "VtUi.MainControl" ) |
|
4540 return *iInstance->iMainControl; |
|
4541 } |
|
4542 |
|
4543 // ----------------------------------------------------------------------------- |
|
4544 // CVtUiAppUi::RemoteVideoControl |
|
4545 // ----------------------------------------------------------------------------- |
|
4546 // |
|
4547 CVtUiRemoteVideoControl& CVtUiAppUi::RemoteVideoControl() |
|
4548 { |
|
4549 __VTPRINTENTER( "VtUi.RemoteVideoControl" ) |
|
4550 __VTPRINTEXIT( "VtUi.RemoteVideoControl" ) |
|
4551 return *iInstance->iRemoteVideoControl; |
|
4552 } |
|
4553 |
|
4554 // ----------------------------------------------------------------------------- |
|
4555 // CVtUiAppUi::DoExit |
|
4556 // ----------------------------------------------------------------------------- |
|
4557 // |
|
4558 TInt CVtUiAppUi::DoExit( TAny* aAppUi ) |
|
4559 { |
|
4560 __VTPRINTENTER( "VtUi.DoExit" ) |
|
4561 CVtUiAppUi* self = static_cast< CVtUiAppUi* >( aAppUi ); |
|
4562 self->iAsyncCallback->Cancel(); |
|
4563 // Before exiting ensure there are no pending actions. |
|
4564 self->ActiveExecInitCancel( 0 ); |
|
4565 self->Exit(); |
|
4566 __VTPRINTEXIT( "VtUi.DoExit" ) |
|
4567 return KErrNone; |
|
4568 } |
|
4569 |
|
4570 // ----------------------------------------------------------------------------- |
|
4571 // CVtUiAppUi::ExecuteCmdAsyncL |
|
4572 // ----------------------------------------------------------------------------- |
|
4573 // |
|
4574 CEikDialog* CVtUiAppUi::ExecuteCmdAsyncL( |
|
4575 CEikDialog** aDialogPtr, |
|
4576 const TVtEngCommandId aCommand, |
|
4577 TRequestStatus& aStatus ) |
|
4578 { |
|
4579 return DoExecuteCmdAsyncL( aDialogPtr, aCommand, NULL, aStatus ); |
|
4580 } |
|
4581 |
|
4582 // ----------------------------------------------------------------------------- |
|
4583 // CVtUiAppUi::ExecuteCmdAsyncL |
|
4584 // ----------------------------------------------------------------------------- |
|
4585 // |
|
4586 template< class T > |
|
4587 CEikDialog* CVtUiAppUi::ExecuteCmdAsyncL( |
|
4588 CEikDialog** aDialogPtr, |
|
4589 const TVtEngCommandId aCommand, |
|
4590 T& aParam, |
|
4591 TRequestStatus& aStatus ) |
|
4592 { |
|
4593 TPtrC8 params( reinterpret_cast< TUint8* >( &aParam ), sizeof( T ) ); |
|
4594 return DoExecuteCmdAsyncL( aDialogPtr, aCommand, ¶ms, aStatus ); |
|
4595 } |
|
4596 |
|
4597 // ----------------------------------------------------------------------------- |
|
4598 // CVtUiAppUi::DoExecuteCmdAsyncL |
|
4599 // ----------------------------------------------------------------------------- |
|
4600 // |
|
4601 CEikDialog* CVtUiAppUi::DoExecuteCmdAsyncL( |
|
4602 CEikDialog** aDialogPtr, |
|
4603 const TVtEngCommandId aCommand, |
|
4604 TDesC8* aParams, |
|
4605 TRequestStatus& aStatus ) |
|
4606 { |
|
4607 __VTPRINT2( DEBUG_GEN, "VtUi.DoExecAsync.cmd=%d", aCommand ) |
|
4608 MVtEngCommandHandler& command = Model().CommandHandler(); |
|
4609 const TInt caps = command.GetCommandCaps( aCommand ); |
|
4610 |
|
4611 if ( caps >= KErrNone ) |
|
4612 { |
|
4613 const TBool asynchronous = |
|
4614 ( caps & MVtEngCommandHandler::EAttribAsync ); |
|
4615 |
|
4616 if ( asynchronous ) |
|
4617 { |
|
4618 CVtUiExecuteCmdDialog* dlg = |
|
4619 new ( ELeave ) CVtUiExecuteCmdDialog( |
|
4620 aDialogPtr, |
|
4621 Model().CommandHandler(), |
|
4622 *iEventObserver ); |
|
4623 dlg->ExecuteCmdLD( aCommand, aParams, &aStatus ); |
|
4624 return dlg; |
|
4625 } |
|
4626 else |
|
4627 { |
|
4628 command.ExecuteL( aCommand, aParams ); |
|
4629 RefreshStatesL(); |
|
4630 TRequestStatus* status = &aStatus; |
|
4631 User::RequestComplete( status, KErrNone ); |
|
4632 } |
|
4633 } |
|
4634 else |
|
4635 { |
|
4636 // Failed. |
|
4637 User::Leave( caps ); |
|
4638 } |
|
4639 |
|
4640 return NULL; |
|
4641 } |
|
4642 |
|
4643 // ----------------------------------------------------------------------------- |
|
4644 // CVtUiAppUi::Execute |
|
4645 // ----------------------------------------------------------------------------- |
|
4646 // |
|
4647 TInt CVtUiAppUi::Execute( const TVtEngCommandId aCommand, TDesC8* aParam ) |
|
4648 { |
|
4649 MVtEngCommandHandler& command = Model().CommandHandler(); |
|
4650 TRAPD( err, command.ExecuteL( aCommand, aParam ) ); |
|
4651 #ifdef VTDEBUG |
|
4652 if ( err != KErrNone ) |
|
4653 { |
|
4654 __VTPRINT3( DEBUG_GEN, "VtUi.Execute.Nok.cmd=%d,err=%d", aCommand, err ) |
|
4655 } |
|
4656 #endif // VTDEBUG |
|
4657 return err; |
|
4658 } |
|
4659 |
|
4660 // ----------------------------------------------------------------------------- |
|
4661 // CVtUiAppUi::HandleForegroundChangedL |
|
4662 // ----------------------------------------------------------------------------- |
|
4663 // |
|
4664 void CVtUiAppUi::HandleForegroundChangedL( |
|
4665 TBool aIsForeground ) |
|
4666 { |
|
4667 __VTPRINTENTER( "VtUi.HandleForegroundChangedL" ) |
|
4668 __VTPRINT2( DEBUG_GEN, "VtUi.foreground=%d", (TInt) aIsForeground ) |
|
4669 |
|
4670 |
|
4671 // Let the Engine know that Application's foregorund |
|
4672 // has changed. Then Engine can do some initalize/uninitalize |
|
4673 // before rendering due to the foreground state. |
|
4674 iState->PreHandleForegroundChangedL(aIsForeground); |
|
4675 |
|
4676 // These operations must be done before |
|
4677 // sending KVtEngSetUIForeground command to engine i.e. calling |
|
4678 // iState->HandleForegroundChangedL( aIsForeground ) |
|
4679 if ( !aIsForeground ) |
|
4680 { |
|
4681 // if capture mode is on stop it |
|
4682 if ( iUiStates->IsCaptureModeOn() ) |
|
4683 { |
|
4684 CmdCancelCaptureL(); |
|
4685 } |
|
4686 // if brightness or contrast feature is active stop those |
|
4687 MVtUiFeature* br = iFeatureManager->GetFeatureById( EVtUiFeatureIdBrightness ); |
|
4688 if ( br ) |
|
4689 { |
|
4690 __VTPRINT( DEBUG_GEN, "VtUi.HandleForegroundChangedL br" ) |
|
4691 if ( br->State() == MVtUiFeature::EActive ) |
|
4692 { |
|
4693 __VTPRINT( DEBUG_GEN, "VtUi.HandleForegroundChangedL br->STOP" ) |
|
4694 br->Stop(); |
|
4695 } |
|
4696 } |
|
4697 |
|
4698 MVtUiFeature* cr = iFeatureManager->GetFeatureById( EVtUiFeatureIdContrast ); |
|
4699 if ( cr ) |
|
4700 { |
|
4701 __VTPRINT( DEBUG_GEN, "VtUi.HandleForegroundChangedL cr" ) |
|
4702 if ( cr->State() == MVtUiFeature::EActive ) |
|
4703 { |
|
4704 __VTPRINT( DEBUG_GEN, "VtUi.HandleForegroundChangedL cr->STOP" ) |
|
4705 cr->Stop(); |
|
4706 } |
|
4707 } |
|
4708 |
|
4709 } |
|
4710 |
|
4711 TBool foregroundAndReady = EFalse; |
|
4712 if ( iState ) |
|
4713 { |
|
4714 foregroundAndReady = iState->HandleForegroundChangedL( aIsForeground ); |
|
4715 iUiStates->SetThisApplicationForeground( aIsForeground ); |
|
4716 } |
|
4717 if ( foregroundAndReady ) |
|
4718 { |
|
4719 // Refresh navi pane. This will start call duration updating |
|
4720 // if necessary. |
|
4721 RefreshNaviPaneL(); |
|
4722 } |
|
4723 else if ( !aIsForeground ) |
|
4724 { |
|
4725 |
|
4726 |
|
4727 iEventObserver->StopBeat(); |
|
4728 } |
|
4729 SetIncallBubbleAllowedInUsualL( !foregroundAndReady ); |
|
4730 __VTPRINTEXIT( "VtUi.HandleForegroundChangedL" ) |
|
4731 } |
|
4732 |
|
4733 // ----------------------------------------------------------------------------- |
|
4734 // CVtUiAppUi::RefreshL |
|
4735 // ----------------------------------------------------------------------------- |
|
4736 // |
|
4737 void CVtUiAppUi::RefreshL( const TInt aRefreshFlags ) |
|
4738 { |
|
4739 if ( aRefreshFlags & EUiStates ) |
|
4740 { |
|
4741 RefreshNaviPaneL(); |
|
4742 } |
|
4743 if ( aRefreshFlags & EBlind ) |
|
4744 { |
|
4745 RefreshBlind(); |
|
4746 } |
|
4747 if ( aRefreshFlags & ENaviPane ) |
|
4748 { |
|
4749 RefreshNaviPaneL(); |
|
4750 } |
|
4751 if ( aRefreshFlags & ESoftkeys ) |
|
4752 { |
|
4753 RefreshSoftkeysL(); |
|
4754 } |
|
4755 } |
|
4756 |
|
4757 // ----------------------------------------------------------------------------- |
|
4758 // CVtUiAppUi::HandleEngineResetL |
|
4759 // ----------------------------------------------------------------------------- |
|
4760 // |
|
4761 void CVtUiAppUi::HandleEngineResetL() |
|
4762 { |
|
4763 __VTPRINTENTER( "VtUi.HandleEngineResetL" ) |
|
4764 if ( iShutdownRequest ) |
|
4765 { |
|
4766 __VTPRINT( DEBUG_GEN, " VtUi.HandleEngineResetL shutdown" ) |
|
4767 User::RequestComplete( iShutdownRequest, KErrNone ); |
|
4768 iShutdownRequest = NULL; |
|
4769 } |
|
4770 __VTPRINTEXIT( "VtUi.HandleEngineResetL" ) |
|
4771 } |
|
4772 |
|
4773 // ----------------------------------------------------------------------------- |
|
4774 // CVtUiAppUi::StopWaitingImage |
|
4775 // ----------------------------------------------------------------------------- |
|
4776 // |
|
4777 void CVtUiAppUi::StopWaitingImage() |
|
4778 { |
|
4779 if ( iInstance ) |
|
4780 { |
|
4781 iDownlinkWindow->SetWaiting( EFalse ); |
|
4782 iUiStates->SetWaitingForFirstFrame( EFalse ); |
|
4783 RemoteVideoControl().MakeVisible(ETrue); |
|
4784 } |
|
4785 } |
|
4786 |
|
4787 void CVtUiAppUi::StopWhiteBalanceOrColortone() |
|
4788 { |
|
4789 if( iEventObserver ) |
|
4790 { |
|
4791 MVtEngMedia::TCameraId currentCamId; |
|
4792 //CVtEngMediaHandler& mediaHandler = iEventObserver->Model().Media(); |
|
4793 ///mediaHandler.GetCurrentCameraId( currentCamId ); |
|
4794 iEventObserver->Model().Media().GetCurrentCameraId( currentCamId ); |
|
4795 __VTPRINT2( DEBUG_GEN, " CVtUiAppUi::StopWhiteBalance currentCamId is %d", currentCamId); |
|
4796 |
|
4797 CVtUiWhiteBalance* wb = static_cast< CVtUiWhiteBalance* >( |
|
4798 iFeatureManager->GetFeatureById( EVtUiFeatureIdWhiteBalance ) ); |
|
4799 CVtUiColorTone* ct = static_cast< CVtUiColorTone* >( |
|
4800 iFeatureManager->GetFeatureById( EVtUiFeatureIdColourTone ) ); |
|
4801 |
|
4802 // only when the current camera switch to the Primary to stop the wb |
|
4803 if( currentCamId == MVtEngMedia::EPrimaryCamera ) |
|
4804 { |
|
4805 |
|
4806 if( wb && ( wb->State() == MVtUiFeature::EActive ) ) |
|
4807 { |
|
4808 |
|
4809 wb->Stop(); |
|
4810 } |
|
4811 |
|
4812 if( ct && ( ct->State() == MVtUiFeature::EActive ) ) |
|
4813 { |
|
4814 ct->Stop(); |
|
4815 } |
|
4816 |
|
4817 return; |
|
4818 } |
|
4819 if( currentCamId == MVtEngMedia::ESecondaryCamera ) |
|
4820 { |
|
4821 if( wb && wb->IsPendingCmd() ) |
|
4822 wb->HandlePendingCmdL(); |
|
4823 if( ct && ct->IsPendingCmd() ) |
|
4824 ct->HandlePendingCmdL(); |
|
4825 } |
|
4826 } |
|
4827 } |
|
4828 // ----------------------------------------------------------------------------- |
|
4829 // CVtUiAppUi::HandleLayoutChanged |
|
4830 // ----------------------------------------------------------------------------- |
|
4831 // |
|
4832 TInt CVtUiAppUi::HandleLayoutChanged() |
|
4833 { |
|
4834 iLayoutChangeCallback->CallBack(); |
|
4835 return KErrNone; |
|
4836 } |
|
4837 |
|
4838 // ----------------------------------------------------------------------------- |
|
4839 // CVtUiAppUi::DelayedHandleLayoutChanged |
|
4840 // ----------------------------------------------------------------------------- |
|
4841 // |
|
4842 TInt CVtUiAppUi::DelayedHandleLayoutChanged( TAny* aPtr ) |
|
4843 { |
|
4844 CVtUiAppUi* self = reinterpret_cast< CVtUiAppUi* > ( aPtr ); |
|
4845 self->iUiStates->SetDisableBlindSetting( ETrue ); |
|
4846 TRAPD( err, self->HandleLayoutChangedL() ); |
|
4847 self->iUiStates->SetDisableBlindSetting( EFalse ); |
|
4848 self->RefreshBlind(); |
|
4849 return err; |
|
4850 } |
|
4851 |
|
4852 // ----------------------------------------------------------------------------- |
|
4853 // CVtUiAppUi::HandleLayoutChangedL |
|
4854 // ----------------------------------------------------------------------------- |
|
4855 // |
|
4856 void CVtUiAppUi::HandleLayoutChangedL() |
|
4857 { |
|
4858 __VTPRINTENTER( "VtUi.LayoutChg" ) |
|
4859 if ( iState ) |
|
4860 { |
|
4861 iState->HandleLayoutChangedL(); |
|
4862 } |
|
4863 __VTPRINTEXIT( "VtUi.LayoutChg" ) |
|
4864 } |
|
4865 |
|
4866 // ----------------------------------------------------------------------------- |
|
4867 // CVtUiAppUi::DoHandleLayoutChangedL |
|
4868 // ----------------------------------------------------------------------------- |
|
4869 // |
|
4870 void CVtUiAppUi::DoHandleLayoutChangedL() |
|
4871 { |
|
4872 __VTPRINTENTER( "VtUi.DoLayoutChg" ) |
|
4873 // Fully update rendering parameters |
|
4874 UpdateRenderingParametersL(); |
|
4875 // Notify engine about layout change |
|
4876 iLayoutChg = ETrue; |
|
4877 TRAPD( error, ExecuteCmdL( KVtEngHandleLayoutChange ) ); |
|
4878 iLayoutChg = EFalse; |
|
4879 |
|
4880 // Not ready error is allowed to happen (e.g. when sharing) |
|
4881 if ( error && ( error != KErrNotReady ) ) |
|
4882 { |
|
4883 User::Leave( error ); |
|
4884 } |
|
4885 else |
|
4886 { |
|
4887 __VTPRINT( DEBUG_GEN, |
|
4888 "VtUi.DoLayoutChg KVtEngHandleLayoutChange == KErrNotReady (ok)" ) |
|
4889 TVtEngCommandId pendingCommand = Model().CommandHandler().PendingCommand(); |
|
4890 if ( pendingCommand == KVtEngMuteOutgoingAudio || |
|
4891 pendingCommand == KVtEngUnmuteOutgoingAudio || |
|
4892 pendingCommand == KVtEngSetAudioRouting || |
|
4893 pendingCommand == KVtEngSetAudioVolume || |
|
4894 pendingCommand == KVtEngSetSource || |
|
4895 pendingCommand == KVtEngPrepareCamera || |
|
4896 pendingCommand == KVtEngUnfreeze ) |
|
4897 { |
|
4898 iUiStates->SetLayoutChangeNeeded( ETrue ); |
|
4899 } |
|
4900 } |
|
4901 // Notify component manager |
|
4902 iComponentManager->HandleLayoutChangeL(); |
|
4903 MVtUiFeature* dialer = |
|
4904 iFeatureManager->GetFeatureById( EVtUiFeatureIdDialer ); |
|
4905 const TBool dialerActive( dialer && |
|
4906 ( dialer->State() == MVtUiFeature::EActive ) ); |
|
4907 SwitchLayoutToFlatStatusPaneL( dialerActive ); |
|
4908 |
|
4909 // Update the cam's whiteBalance and colorTone cause layoutchange will renew the camera,so |
|
4910 // restore the last user setting |
|
4911 UpdateVBSettingL(); |
|
4912 |
|
4913 |
|
4914 if ( iDelayedCmd != 0 ) |
|
4915 { |
|
4916 __VTPRINT2( DEBUG_GEN, "VtUi.DoLayoutChg reexecute the delayed cmd=%d", iDelayedCmd); |
|
4917 if( iDelayedCmd == EAknSoftkeyOptions ) |
|
4918 { |
|
4919 ProcessCommandL( iDelayedCmd ); |
|
4920 } |
|
4921 else |
|
4922 { |
|
4923 HandleCommandL( iDelayedCmd ); |
|
4924 } |
|
4925 iDelayedCmd = 0; |
|
4926 } |
|
4927 __VTPRINTEXIT( "VtUi.DoLayoutChg" ) |
|
4928 } |
|
4929 |
|
4930 // ----------------------------------------------------------------------------- |
|
4931 // CVtUiAppUi::HandleVideoFrameL |
|
4932 // ----------------------------------------------------------------------------- |
|
4933 // |
|
4934 void CVtUiAppUi::HandleVideoFrameL( |
|
4935 const TBool aLocal, |
|
4936 CFbsBitmap* aBitmap ) |
|
4937 { |
|
4938 if ( aLocal ) |
|
4939 { |
|
4940 iUplinkWindow->SetStreamBitmap( aBitmap ); |
|
4941 |
|
4942 if ( aBitmap ) |
|
4943 { |
|
4944 // If white balance or color tone setting feauture is |
|
4945 // active update feature's setting page's background. |
|
4946 CVtUiWhiteBalance* wb = static_cast< CVtUiWhiteBalance* >( |
|
4947 iFeatureManager->GetFeatureById( EVtUiFeatureIdWhiteBalance ) ); |
|
4948 |
|
4949 CVtUiColorTone* ct = static_cast< CVtUiColorTone* >( |
|
4950 iFeatureManager->GetFeatureById( EVtUiFeatureIdColourTone ) ); |
|
4951 |
|
4952 if ( wb ) |
|
4953 { |
|
4954 __VTPRINT( DEBUG_GEN,"VtUi.HandleVideoFrameL WB" ) |
|
4955 if ( wb->State() == MVtUiFeature::EActive ) |
|
4956 { |
|
4957 __VTPRINT( DEBUG_GEN,"VtUi.HandleVideoFrameL WB update" ) |
|
4958 wb->UpdateBackground( aBitmap ); |
|
4959 } |
|
4960 } |
|
4961 if ( ct ) |
|
4962 { |
|
4963 __VTPRINT( DEBUG_GEN,"VtUi.HandleVideoFrameL CT" ) |
|
4964 if (ct->State() == MVtUiFeature::EActive) |
|
4965 { |
|
4966 __VTPRINT( DEBUG_GEN,"VtUi.HandleVideoFrameL CT update" ) |
|
4967 ct->UpdateBackground( aBitmap ); |
|
4968 } |
|
4969 } |
|
4970 } |
|
4971 } |
|
4972 else |
|
4973 { |
|
4974 iDownlinkWindow->SetStreamBitmap( aBitmap ); |
|
4975 } |
|
4976 } |
|
4977 |
|
4978 // ----------------------------------------------------------------------------- |
|
4979 // CVtUiAppUi::SetVideoFrame |
|
4980 // ----------------------------------------------------------------------------- |
|
4981 // |
|
4982 void CVtUiAppUi::SetVideoFrame( |
|
4983 const TBool aLocal, |
|
4984 CFbsBitmap* aBitmap ) |
|
4985 { |
|
4986 if ( aLocal ) |
|
4987 { |
|
4988 } |
|
4989 else |
|
4990 { |
|
4991 iDownlinkWindow->SetStreamBitmapReserve( aBitmap ); |
|
4992 } |
|
4993 } |
|
4994 |
|
4995 // ----------------------------------------------------------------------------- |
|
4996 // CVtUiAppUi::HandleVideoFrameRemoteProblemL |
|
4997 // ----------------------------------------------------------------------------- |
|
4998 // |
|
4999 void CVtUiAppUi::HandleVideoFrameRemoteProblemL() |
|
5000 { |
|
5001 __VTPRINTENTER( "VtUi.HandleRemote" ) |
|
5002 HandleVideoFrameL( EFalse, NULL ); |
|
5003 __VTPRINTEXIT( "VtUi.HandleRemote" ) |
|
5004 } |
|
5005 |
|
5006 // ----------------------------------------------------------------------------- |
|
5007 // CVtUiAppUi::HandleVideoFrameLocalProblemL |
|
5008 // ----------------------------------------------------------------------------- |
|
5009 // |
|
5010 void CVtUiAppUi::HandleVideoFrameLocalProblemL() |
|
5011 { |
|
5012 __VTPRINTENTER( "VtUi.HandleLocal" ) |
|
5013 // Camera might have changed - better to stop zoom. |
|
5014 HandleVideoFrameL( ETrue, NULL ); |
|
5015 __VTPRINTEXIT( "VtUi.HandleLocal" ) |
|
5016 } |
|
5017 |
|
5018 // ----------------------------------------------------------------------------- |
|
5019 // CVtUiAppUi::RemoteVideoIsSQCif |
|
5020 // ----------------------------------------------------------------------------- |
|
5021 // |
|
5022 void CVtUiAppUi::RemoteVideoIsSQCif( TBool aIsSQCif ) |
|
5023 { |
|
5024 iUiStates->SetUseSQCif( aIsSQCif ); |
|
5025 if ( iDownlinkWindow == iInstance->iMainControl ) |
|
5026 { |
|
5027 ControlUsesSQCif( aIsSQCif ); |
|
5028 } |
|
5029 } |
|
5030 |
|
5031 // ----------------------------------------------------------------------------- |
|
5032 // CVtUiAppUi::ControlUsesSQCif |
|
5033 // ----------------------------------------------------------------------------- |
|
5034 // |
|
5035 void CVtUiAppUi::ControlUsesSQCif( TBool aIsSQCif ) |
|
5036 { |
|
5037 iInstance->iMainControl->SupportSQCif( aIsSQCif ); |
|
5038 } |
|
5039 |
|
5040 // ----------------------------------------------------------------------------- |
|
5041 // CVtUiAppUi::ChangeRemoteVideoLayoutL |
|
5042 // ----------------------------------------------------------------------------- |
|
5043 // |
|
5044 void CVtUiAppUi::ChangeRemoteVideoLayoutL() |
|
5045 { |
|
5046 HandleLayoutChanged(); |
|
5047 if ( iDownlinkWindow == iInstance->iMainControl ) |
|
5048 { |
|
5049 iDownlinkWindow->SetBlind( EFalse ); |
|
5050 StopWaitingImage(); |
|
5051 iInstance->iMainControl->DrawNow(); |
|
5052 } |
|
5053 } |
|
5054 |
|
5055 // ----------------------------------------------------------------------------- |
|
5056 // CVtUiAppUi::ShowImageInitializeProgressL |
|
5057 // ----------------------------------------------------------------------------- |
|
5058 // |
|
5059 void CVtUiAppUi::ShowImageInitializeProgressL() |
|
5060 { |
|
5061 __VTPRINTENTER( "VtUi.ShowImageInitializeProgressL" ) |
|
5062 ShowProgressDialogL( R_PROGRESS_DECODING_IMAGE_WAIT_NOTE, this ); |
|
5063 __VTPRINTEXIT( "VtUi.ShowImageInitializeProgressL" ) |
|
5064 } |
|
5065 |
|
5066 // ----------------------------------------------------------------------------- |
|
5067 // CVtUiAppUi::HideImageInitializeProgressL |
|
5068 // ----------------------------------------------------------------------------- |
|
5069 // |
|
5070 void CVtUiAppUi::HideImageInitializeProgressL() |
|
5071 { |
|
5072 __VTPRINTENTER( "VtUi.HideImageInitializeProgressL" ) |
|
5073 // if volume slider is visible hide it |
|
5074 CVtUiVolume* volume = static_cast< CVtUiVolume* >( |
|
5075 iFeatureManager->GetFeatureById( EVtUiFeatureIdVolume ) ); |
|
5076 if ( volume ) |
|
5077 { |
|
5078 volume->Stop(); |
|
5079 } |
|
5080 HideProgressDialogL(); |
|
5081 __VTPRINTEXIT( "VtUi.HideImageInitializeProgressL" ) |
|
5082 } |
|
5083 |
|
5084 // ----------------------------------------------------------------------------- |
|
5085 // CVtUiAppUi::CheckBeatL |
|
5086 // ----------------------------------------------------------------------------- |
|
5087 // |
|
5088 void CVtUiAppUi::CheckBeatL( const TBool aCallDurationEnabled ) |
|
5089 { |
|
5090 // Update call duration periodically if necessary. |
|
5091 const MVtEngSessionInfo::TSessionState state = Model().Session().State( EFalse ); |
|
5092 const TBool timerEnable = |
|
5093 ( aCallDurationEnabled ) && |
|
5094 ( ( state == MVtEngSessionInfo::EConnected ) || |
|
5095 ( state == MVtEngSessionInfo::ENegotiating ) || |
|
5096 ( state == MVtEngSessionInfo::EOpen ) ); |
|
5097 |
|
5098 if ( timerEnable && iUiStates->IsThisApplicationForeground() ) |
|
5099 { |
|
5100 iEventObserver->StartBeatL(); |
|
5101 } |
|
5102 else |
|
5103 { |
|
5104 iEventObserver->StopBeat(); |
|
5105 } |
|
5106 } |
|
5107 |
|
5108 // ----------------------------------------------------------------------------- |
|
5109 // CVtUiAppUi::HandleBeat |
|
5110 // ----------------------------------------------------------------------------- |
|
5111 // |
|
5112 void CVtUiAppUi::HandleBeat() |
|
5113 { |
|
5114 TRAP_IGNORE( RefreshNaviPaneL(); ); |
|
5115 } |
|
5116 |
|
5117 // ----------------------------------------------------------------------------- |
|
5118 // CVtUiAppUi::ShowCameraInUseNoteL |
|
5119 // ----------------------------------------------------------------------------- |
|
5120 // |
|
5121 void CVtUiAppUi::ShowCameraInUseNoteL() const |
|
5122 { |
|
5123 // The note must not be blocking. |
|
5124 |
|
5125 CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( NULL ); |
|
5126 |
|
5127 dlg->PrepareLC( R_VIDEOTELUI_INFORMATION_NOTE ); |
|
5128 dlg->ButtonGroupContainer().SetCommandSetL( R_AVKON_SOFTKEYS_OK_EMPTY ); |
|
5129 |
|
5130 HBufC* buf = StringLoader::LoadLC( R_VIDEOTELUI_QTN_INCAL_CLOSE_CAMCORDER ); |
|
5131 dlg->SetTextL( *buf ); |
|
5132 CleanupStack::PopAndDestroy( buf ); |
|
5133 |
|
5134 dlg->SetTone( CAknNoteDialog::EConfirmationTone ); |
|
5135 dlg->SetTimeout( CAknNoteDialog::EUndefinedTimeout ); |
|
5136 dlg->RunLD(); |
|
5137 } |
|
5138 |
|
5139 // ----------------------------------------------------------------------------- |
|
5140 // CVtUiAppUi::ShowNotAllowedNoteL |
|
5141 // ----------------------------------------------------------------------------- |
|
5142 // |
|
5143 void CVtUiAppUi::ShowNotAllowedNoteL() const |
|
5144 { |
|
5145 HBufC* prompt = |
|
5146 StringLoader::LoadLC( |
|
5147 R_VIDEOTELUI_TEXT_NOT_ALLOWED ); |
|
5148 |
|
5149 CAknInformationNote* note = |
|
5150 new ( ELeave ) CAknInformationNote( ETrue ); |
|
5151 note->ExecuteLD( *prompt ); |
|
5152 CleanupStack::PopAndDestroy( prompt ); |
|
5153 } |
|
5154 |
|
5155 // ----------------------------------------------------------------------------- |
|
5156 // CVtUiAppUi::ShowCallNotAllowedNoteL |
|
5157 // ----------------------------------------------------------------------------- |
|
5158 // |
|
5159 void CVtUiAppUi::ShowCallNotAllowedNoteL() const |
|
5160 { |
|
5161 HBufC* prompt = |
|
5162 StringLoader::LoadLC( |
|
5163 R_VIDEOTELUI_TEXT_CALL_NOT_ALLOWED ); |
|
5164 |
|
5165 CAknInformationNote* note = |
|
5166 new ( ELeave ) CAknInformationNote( ETrue ); |
|
5167 note->ExecuteLD( *prompt ); |
|
5168 CleanupStack::PopAndDestroy( prompt ); |
|
5169 } |
|
5170 |
|
5171 // ----------------------------------------------------------------------------- |
|
5172 // CVtUiAppUi::ShowOtherCameraNotUsableNoteL |
|
5173 // ----------------------------------------------------------------------------- |
|
5174 // |
|
5175 void CVtUiAppUi::ShowOtherCameraNotUsableNoteL() const |
|
5176 { |
|
5177 HBufC* prompt = |
|
5178 StringLoader::LoadLC( |
|
5179 R_VIDEOTELUI_QTN_ERR_CAM_SWAP ); |
|
5180 |
|
5181 CAknInformationNote* note = |
|
5182 new ( ELeave ) CAknInformationNote( ETrue ); |
|
5183 note->ExecuteLD( *prompt ); |
|
5184 CleanupStack::PopAndDestroy( prompt ); |
|
5185 } |
|
5186 |
|
5187 // ----------------------------------------------------------------------------- |
|
5188 // CVtUiAppUi::ShowUnableToOpenNoteL |
|
5189 // ----------------------------------------------------------------------------- |
|
5190 // |
|
5191 void CVtUiAppUi::ShowUnableToOpenNoteL() const |
|
5192 { |
|
5193 HBufC* prompt = |
|
5194 StringLoader::LoadLC( |
|
5195 R_VIDEOTELUI_QTN_ERR_UNABLE_TO_OPEN_IMAGE ); |
|
5196 CAknInformationNote* note = |
|
5197 new ( ELeave ) CAknInformationNote( ETrue ); |
|
5198 note->ExecuteLD( *prompt ); |
|
5199 CleanupStack::PopAndDestroy( prompt ); |
|
5200 } |
|
5201 |
|
5202 // ----------------------------------------------------------------------------- |
|
5203 // ----------------------------------------------------------------------------- |
|
5204 // |
|
5205 void CVtUiAppUi::ShowImageDecodingErrorNoteL() |
|
5206 { |
|
5207 HBufC* prompt = |
|
5208 StringLoader::LoadLC( |
|
5209 R_VIDEOTELUI_QTN_INCAL_NOTE_DECODING_FAILED ); |
|
5210 CAknInformationNote* note = |
|
5211 new ( ELeave ) CAknInformationNote( ETrue ); |
|
5212 note->ExecuteLD( *prompt ); |
|
5213 CleanupStack::PopAndDestroy( prompt ); |
|
5214 } |
|
5215 |
|
5216 // ----------------------------------------------------------------------------- |
|
5217 // CVtUiAppUi::ShowDRMNotAllowedNoteL |
|
5218 // ----------------------------------------------------------------------------- |
|
5219 // |
|
5220 void CVtUiAppUi::ShowDRMNotAllowedNoteL() const |
|
5221 { |
|
5222 HBufC* prompt = |
|
5223 StringLoader::LoadLC( |
|
5224 R_VIDEOTELUI_QTN_ERR_DRM_NOT_ALLOWED ); |
|
5225 CAknInformationNote* note = |
|
5226 new ( ELeave ) CAknInformationNote( ETrue ); |
|
5227 note->ExecuteLD( *prompt ); |
|
5228 CleanupStack::PopAndDestroy( prompt ); |
|
5229 } |
|
5230 |
|
5231 // ----------------------------------------------------------------------------- |
|
5232 // CVtUiAppUi::SetSoftkeysL |
|
5233 // ----------------------------------------------------------------------------- |
|
5234 // |
|
5235 void CVtUiAppUi::SetSoftkeysL( const TInt aSoftkeyResourceId ) |
|
5236 { |
|
5237 if ( iCurrentSoftkeys != aSoftkeyResourceId ) |
|
5238 { |
|
5239 if ( iCba ) |
|
5240 { |
|
5241 iCba->SetCommandSetL( aSoftkeyResourceId ); |
|
5242 iCba->DrawNow(); |
|
5243 } |
|
5244 iCurrentSoftkeys = aSoftkeyResourceId; |
|
5245 } |
|
5246 } |
|
5247 |
|
5248 // ----------------------------------------------------------------------------- |
|
5249 // CVtUiAppUi::SetHiddenL |
|
5250 // Makes application visible / invisible in fast swap window. |
|
5251 // ----------------------------------------------------------------------------- |
|
5252 // |
|
5253 void CVtUiAppUi::SetHiddenL( |
|
5254 const TBool aHidden ) |
|
5255 { |
|
5256 CEikonEnv* eikonEnv = iEikonEnv; |
|
5257 CApaWindowGroupName* windowGroupName = |
|
5258 CApaWindowGroupName::NewLC( |
|
5259 eikonEnv->WsSession(), |
|
5260 iThisApplicationWgId ); |
|
5261 windowGroupName->SetHidden( aHidden ); |
|
5262 User::LeaveIfError( |
|
5263 windowGroupName->SetWindowGroupName( |
|
5264 eikonEnv->RootWin() ) ); |
|
5265 CleanupStack::PopAndDestroy( windowGroupName ); |
|
5266 |
|
5267 // Update application UID. |
|
5268 TUid applicationUid = KVtUiAppUid; |
|
5269 if ( aHidden ) |
|
5270 { |
|
5271 applicationUid.iUid = KVtUiTelephoneUid.iUid; |
|
5272 } |
|
5273 __VTPRINT2( DEBUG_GEN, "VtUi.SetHiddenL applicationUid.iUid=%x", |
|
5274 applicationUid.iUid ) |
|
5275 // Set application that is "default top application" |
|
5276 TInt originalTopAppUid = 0; |
|
5277 TInt err = RProperty::Get( |
|
5278 KPSUidUikon, |
|
5279 KUikVideoCallTopApp, |
|
5280 originalTopAppUid ); |
|
5281 __VTPRINT3( DEBUG_GEN, "VtUi.SetHiddenL orig. topApp=%x, err=%d", |
|
5282 originalTopAppUid, err ) |
|
5283 if ( originalTopAppUid != applicationUid.iUid && |
|
5284 iUiStates->IsDetailsReceived() ) |
|
5285 { |
|
5286 __VTPRINT( DEBUG_GEN, "VtUi.SetHiddenL Do write KUikVideoCallTopApp" ) |
|
5287 // Update key only if differs from original value and call |
|
5288 // has been answered |
|
5289 RProperty::Set( |
|
5290 KPSUidUikon, |
|
5291 KUikVideoCallTopApp, |
|
5292 applicationUid.iUid ); |
|
5293 } |
|
5294 } |
|
5295 |
|
5296 // ----------------------------------------------------------------------------- |
|
5297 // CVtUiAppUi::SetCallIdL |
|
5298 // ----------------------------------------------------------------------------- |
|
5299 // |
|
5300 void CVtUiAppUi::SetCallIdL( const TInt aCallId ) |
|
5301 { |
|
5302 HBufC* titlePane = |
|
5303 StringLoader::LoadLC( R_VIDEOTELUI_QTN_CALL_NUMBER_VIDEO, aCallId ); |
|
5304 TPtr ptr = titlePane->Des(); |
|
5305 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); |
|
5306 TitlePaneL()->SetText( titlePane ); |
|
5307 CleanupStack::Pop( titlePane ); |
|
5308 } |
|
5309 |
|
5310 // ----------------------------------------------------------------------------- |
|
5311 // CVtUiAppUi::SetCallNameL |
|
5312 // ----------------------------------------------------------------------------- |
|
5313 // |
|
5314 TBool CVtUiAppUi::SetCallNameL( const TDesC& aName ) |
|
5315 { |
|
5316 HBufC* nameBuf = aName.Alloc(); |
|
5317 if ( nameBuf ) |
|
5318 { |
|
5319 TPtr ptr = nameBuf->Des(); |
|
5320 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr ); |
|
5321 TitlePaneL()->SetText( nameBuf ); |
|
5322 } |
|
5323 |
|
5324 return ( nameBuf != NULL ); |
|
5325 } |
|
5326 |
|
5327 // ----------------------------------------------------------------------------- |
|
5328 // CVtUiAppUi::BringTelephoneForeground |
|
5329 // ----------------------------------------------------------------------------- |
|
5330 // |
|
5331 void CVtUiAppUi::BringTelephoneToForeground() |
|
5332 { |
|
5333 __VTPRINTENTER( "VtUi.BringTelephoneToForeground" ) |
|
5334 // If Telephone application is running, then |
|
5335 // bring it to the foreground. |
|
5336 const TInt windowGroupId = TelephoneApplicationWgId(); |
|
5337 if ( windowGroupId ) |
|
5338 { |
|
5339 CEikonEnv* eikonEnv = iEikonEnv; |
|
5340 TApaTask task( eikonEnv->WsSession() ); |
|
5341 task.SetWgId( windowGroupId ); |
|
5342 task.BringToForeground(); |
|
5343 } |
|
5344 |
|
5345 // In any case, send this application to the background. |
|
5346 ChangeApplicationFocus( EFalse ); |
|
5347 __VTPRINTEXIT( "VtUi.BringTelephoneToForeground" ) |
|
5348 } |
|
5349 |
|
5350 // ----------------------------------------------------------------------------- |
|
5351 // CVtUiAppUi::ChangeApplicationFocus |
|
5352 // ----------------------------------------------------------------------------- |
|
5353 // |
|
5354 void CVtUiAppUi::ChangeApplicationFocus( const TBool aForeground ) |
|
5355 { |
|
5356 __VTPRINTENTER( "VtUi.ChangeApplicationFocus" ) |
|
5357 CEikonEnv* eikonEnv = iEikonEnv; |
|
5358 TApaTask task( eikonEnv->WsSession() ); |
|
5359 task.SetWgId( iThisApplicationWgId ); |
|
5360 if ( !aForeground ) |
|
5361 { |
|
5362 task.SendToBackground(); |
|
5363 } |
|
5364 else if ( !iUiStates->IsDeviceLockOn() ) |
|
5365 { |
|
5366 task.BringToForeground(); |
|
5367 } |
|
5368 __VTPRINTEXIT( "VtUi.ChangeApplicationFocus" ) |
|
5369 } |
|
5370 |
|
5371 // ----------------------------------------------------------------------------- |
|
5372 // CVtUiAppUi::TelephoneApplicationWgId |
|
5373 // ----------------------------------------------------------------------------- |
|
5374 // |
|
5375 TInt CVtUiAppUi::TelephoneApplicationWgId() |
|
5376 { |
|
5377 TInt resultWgId = 0; |
|
5378 |
|
5379 TApaTaskList taskList( iEikonEnv->WsSession() ); |
|
5380 TInt appUid = 0; |
|
5381 |
|
5382 // Try first Telephone application. |
|
5383 if ( RProperty::Get( |
|
5384 KPSUidTelInformation, |
|
5385 KTelPhoneUid, |
|
5386 appUid ) == KErrNone ) |
|
5387 { |
|
5388 TApaTask task = taskList.FindApp( TUid::Uid( appUid ) ); |
|
5389 if ( task.Exists() ) |
|
5390 { |
|
5391 resultWgId = task.WgId(); |
|
5392 } |
|
5393 } |
|
5394 |
|
5395 // Then Idle application. |
|
5396 if ( !resultWgId && |
|
5397 ( RProperty::Get( |
|
5398 KPSUidAiInformation, |
|
5399 KActiveIdleUid, |
|
5400 appUid ) == KErrNone ) ) |
|
5401 { |
|
5402 TApaTask task = taskList.FindApp( TUid::Uid( appUid ) ); |
|
5403 if ( task.Exists() ) |
|
5404 { |
|
5405 resultWgId = task.WgId(); |
|
5406 } |
|
5407 } |
|
5408 |
|
5409 return resultWgId; |
|
5410 } |
|
5411 |
|
5412 // ----------------------------------------------------------------------------- |
|
5413 // CVtUiAppUi::ShowNumberEntry |
|
5414 // ----------------------------------------------------------------------------- |
|
5415 // |
|
5416 inline TBool CVtUiAppUi::ShowNumberEntry() const |
|
5417 { |
|
5418 return EFalse; |
|
5419 } |
|
5420 |
|
5421 // ----------------------------------------------------------------------------- |
|
5422 // CVtUiAppUi::IsActiveIdleEnabledL |
|
5423 // ----------------------------------------------------------------------------- |
|
5424 // |
|
5425 TBool CVtUiAppUi::IsActiveIdleEnabledL() const |
|
5426 { |
|
5427 TVtUiActiveIdleVariation activeIdleVariation; |
|
5428 return activeIdleVariation.IsActiveIdleEnabled(); |
|
5429 } |
|
5430 |
|
5431 // ----------------------------------------------------------------------------- |
|
5432 // CVtUiAppUi::CheckEngineFunctionality |
|
5433 // ----------------------------------------------------------------------------- |
|
5434 // |
|
5435 void CVtUiAppUi::CheckEngineFunctionality() |
|
5436 { |
|
5437 const TBool prepareViewFinder = |
|
5438 iEventObserver->CommandSupportedAndSynchronous( |
|
5439 KVtEngPrepareViewFinder ); |
|
5440 const TBool prepareRemoteRender = |
|
5441 iEventObserver->CommandSupportedAndSynchronous( |
|
5442 KVtEngPrepareRemoteRender ); |
|
5443 const TBool prepareRemoteRenderDSA = |
|
5444 iEventObserver->CommandSupportedAndSynchronous( |
|
5445 KVtEngPrepareRemoteRenderDSA ); |
|
5446 const TBool prepareRemoteRenderDP = |
|
5447 iEventObserver->CommandSupportedAndSynchronous( |
|
5448 KVtEngPrepareRemoteRenderDP ); |
|
5449 const TBool stopViewFinder = |
|
5450 iEventObserver->CommandSupportedAndSynchronous( |
|
5451 KVtEngStopViewFinder ); |
|
5452 const TBool startViewFinder = |
|
5453 iEventObserver->CommandSupportedAndSynchronous( |
|
5454 KVtEngStartViewFinder ); |
|
5455 const TBool stopRemoteRender = |
|
5456 iEventObserver->CommandSupportedAndSynchronous( |
|
5457 KVtEngStopRenderRemote ); |
|
5458 const TBool startRemoteRender = |
|
5459 iEventObserver->CommandSupportedAndSynchronous( |
|
5460 KVtEngStartRenderRemote ); |
|
5461 const TBool setUIForeground = |
|
5462 iEventObserver->CommandSupportedAndSynchronous( |
|
5463 KVtEngSetUIForeground ); |
|
5464 |
|
5465 TVtUiDPVariation dpvariation; |
|
5466 TBool dpSupported( dpvariation.IsDPSupported() ); |
|
5467 |
|
5468 if ( !prepareViewFinder || |
|
5469 ( !prepareRemoteRender && !prepareRemoteRenderDSA && !dpSupported ) || |
|
5470 ( !prepareRemoteRender && !prepareRemoteRenderDP && dpSupported ) || |
|
5471 !stopViewFinder || |
|
5472 !startViewFinder || |
|
5473 !stopRemoteRender || |
|
5474 !startRemoteRender || |
|
5475 !setUIForeground ) |
|
5476 { |
|
5477 // Not supported - should never occur. |
|
5478 __VTPRINT( DEBUG_GEN, "VtUi.EngineFunc.ASSERT" ) |
|
5479 VtUiPanic::Panic( EVtUiPanicEngineFunctionalityAssert ); |
|
5480 } |
|
5481 } |
|
5482 |
|
5483 // ----------------------------------------------------------------------------- |
|
5484 // CVtUiAppUi::Model |
|
5485 // ----------------------------------------------------------------------------- |
|
5486 // |
|
5487 CVtEngModel& CVtUiAppUi::Model() |
|
5488 { |
|
5489 return iEventObserver->Model(); |
|
5490 } |
|
5491 |
|
5492 // ----------------------------------------------------------------------------- |
|
5493 // CVtUiAppUi::VideoTelephonyVariation |
|
5494 // ----------------------------------------------------------------------------- |
|
5495 // |
|
5496 const TVtUiVideoTelephonyVariation& CVtUiAppUi::VideoTelephonyVariation() const |
|
5497 { |
|
5498 return iVTVariation; |
|
5499 } |
|
5500 |
|
5501 // ----------------------------------------------------------------------------- |
|
5502 // CVtUiAppUi::NumberSource |
|
5503 // ----------------------------------------------------------------------------- |
|
5504 // |
|
5505 MVtUiNumberSource* CVtUiAppUi::NumberSource() const |
|
5506 { |
|
5507 return iNumberSource; |
|
5508 } |
|
5509 |
|
5510 // ----------------------------------------------------------------------------- |
|
5511 // CVtUiAppUi::NaviPaneL |
|
5512 // ----------------------------------------------------------------------------- |
|
5513 // |
|
5514 inline CAknNavigationControlContainer* CVtUiAppUi::NaviPaneL() |
|
5515 { |
|
5516 return |
|
5517 static_cast< CAknNavigationControlContainer* > |
|
5518 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
5519 } |
|
5520 |
|
5521 // ----------------------------------------------------------------------------- |
|
5522 // CVtUiAppUi::TitlePaneL |
|
5523 // ----------------------------------------------------------------------------- |
|
5524 // |
|
5525 inline CAknTitlePane* CVtUiAppUi::TitlePaneL() |
|
5526 { |
|
5527 return |
|
5528 static_cast< CAknTitlePane* > |
|
5529 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
5530 } |
|
5531 |
|
5532 // ----------------------------------------------------------------------------- |
|
5533 // CVtUiAppUi::CleanupPushRefreshL |
|
5534 // ----------------------------------------------------------------------------- |
|
5535 // |
|
5536 inline void CVtUiAppUi::CleanupPushRefreshL() |
|
5537 { |
|
5538 CleanupStack::PushL( |
|
5539 TCleanupItem( DoRefresh, this ) ); |
|
5540 } |
|
5541 |
|
5542 // ----------------------------------------------------------------------------- |
|
5543 // CVtUiAppUi::CleanupPushEnableBlindL |
|
5544 // ----------------------------------------------------------------------------- |
|
5545 // |
|
5546 inline void CVtUiAppUi::CleanupPushEnableBlindL() |
|
5547 { |
|
5548 CleanupStack::PushL( |
|
5549 TCleanupItem( DoEnableBlindSetting, this ) ); |
|
5550 } |
|
5551 |
|
5552 // ----------------------------------------------------------------------------- |
|
5553 // CVtUiAppUi::EnableCommandActivatingAndCleanupPushL |
|
5554 // ----------------------------------------------------------------------------- |
|
5555 // |
|
5556 void CVtUiAppUi::EnableCommandActivatingAndCleanupPushL() |
|
5557 { |
|
5558 __VTPRINTENTER( "VtUi.EnableCommandActivatingAndCleanupPushL" ) |
|
5559 // add anyway to cleanup stack to avoid caring about stack balance |
|
5560 CleanupStack::PushL( |
|
5561 TCleanupItem( DoDisableCommandActivating, this ) ); |
|
5562 // but in case of consecutive calls on this don't refresh (avoid flicker) |
|
5563 const TBool alreadyActivating( iUiStates->IsCommandActivating() ); |
|
5564 // increases ref.count if alread set as activating |
|
5565 iUiStates->SetIsCommandActivating( ETrue ); |
|
5566 if ( !alreadyActivating ) |
|
5567 { |
|
5568 // refresh only when ref.count incremented from zero. |
|
5569 iCommandManager->RefreshL(); |
|
5570 } |
|
5571 __VTPRINTEXIT( "VtUi.EnableCommandActivatingAndCleanupPushL" ) |
|
5572 } |
|
5573 |
|
5574 // ----------------------------------------------------------------------------- |
|
5575 // CVtUiAppUi::DoDisableCommandActivating |
|
5576 // ----------------------------------------------------------------------------- |
|
5577 // |
|
5578 void CVtUiAppUi::DoDisableCommandActivating( TAny* aAny ) |
|
5579 { |
|
5580 CVtUiAppUi* self = |
|
5581 reinterpret_cast< CVtUiAppUi* >( aAny ); |
|
5582 TRAP_IGNORE( self->HandleCommandDeactivationL() ); |
|
5583 } |
|
5584 |
|
5585 // ----------------------------------------------------------------------------- |
|
5586 // CVtUiAppUi::HandleCommandDeactivationL |
|
5587 // ----------------------------------------------------------------------------- |
|
5588 // |
|
5589 void CVtUiAppUi::HandleCommandDeactivationL() |
|
5590 { |
|
5591 __VTPRINTENTER( "VtUi.HandleCommandDeactivationL" ) |
|
5592 iUiStates->SetIsCommandActivating( EFalse ); |
|
5593 if ( !iUiStates->IsCommandActivating() ) |
|
5594 { |
|
5595 RefreshStatesL(); |
|
5596 } |
|
5597 __VTPRINTEXIT( "VtUi.HandleCommandDeactivationL" ) |
|
5598 } |
|
5599 |
|
5600 // ----------------------------------------------------------------------------- |
|
5601 // CVtUiAppUi::DoEnableBlindSetting |
|
5602 // ----------------------------------------------------------------------------- |
|
5603 // |
|
5604 void CVtUiAppUi::DoEnableBlindSetting( TAny* aAny ) |
|
5605 { |
|
5606 CVtUiAppUi* self = |
|
5607 reinterpret_cast< CVtUiAppUi* >( aAny ); |
|
5608 self->iUiStates->SetDisableBlindSetting( EFalse ); |
|
5609 } |
|
5610 |
|
5611 // ----------------------------------------------------------------------------- |
|
5612 // CVtUiAppUi::DoRefresh |
|
5613 // ----------------------------------------------------------------------------- |
|
5614 // |
|
5615 void CVtUiAppUi::DoRefresh( TAny* aAny ) |
|
5616 { |
|
5617 CVtUiAppUi* self = |
|
5618 reinterpret_cast< CVtUiAppUi* >( aAny ); |
|
5619 TRAP_IGNORE( self->RefreshL() ); |
|
5620 } |
|
5621 |
|
5622 // ----------------------------------------------------------------------------- |
|
5623 // CVtUiAppUi::DoHandleExitTimeout |
|
5624 // ----------------------------------------------------------------------------- |
|
5625 // |
|
5626 TInt CVtUiAppUi::DoHandleExitTimeout( TAny* /*aAny*/ ) |
|
5627 { |
|
5628 __VTPRINT( DEBUG_GEN, "VtUi.Exit.Timer.EXPIRED!" ) |
|
5629 VtUiPanic::Panic( EVtUiPanicApplicationShutdownTimeout ); |
|
5630 |
|
5631 return KErrNone; |
|
5632 } |
|
5633 |
|
5634 // ----------------------------------------------------------------------------- |
|
5635 // VtUiAppUi::IsViewFinderInMainPane |
|
5636 // ----------------------------------------------------------------------------- |
|
5637 // |
|
5638 TBool CVtUiAppUi::IsViewFinderInMainPane() const |
|
5639 { |
|
5640 return !( IsViewFinderInContextPane() ); |
|
5641 } |
|
5642 |
|
5643 // ----------------------------------------------------------------------------- |
|
5644 // VtUiAppUi::IsViewFinderInContextPane |
|
5645 // ----------------------------------------------------------------------------- |
|
5646 // |
|
5647 TBool CVtUiAppUi::IsViewFinderInContextPane() const |
|
5648 { |
|
5649 return ( iUplinkWindow == iInstance->iContextControl ); |
|
5650 } |
|
5651 |
|
5652 // ----------------------------------------------------------------------------- |
|
5653 // VtUiAppUi::SwitchViewFinderToMainPaneL |
|
5654 // ----------------------------------------------------------------------------- |
|
5655 // |
|
5656 void CVtUiAppUi::SwitchViewFinderToMainPaneL( TBool aUpdateState ) |
|
5657 { |
|
5658 __VTPRINTENTER( "VtUi.SwitchViewFinderToMainPaneL" ) |
|
5659 //change local video in to main pane |
|
5660 if( IsViewFinderInContextPane() ) |
|
5661 { |
|
5662 //flag indicates the initial position of uplink window before freeze |
|
5663 if ( aUpdateState ) |
|
5664 { |
|
5665 iUiStates->SetViewFindersInitialPlaceContextPane( ETrue ); |
|
5666 } |
|
5667 HandleCommandL( EVtUiCmdSwapImagesPlaces ); |
|
5668 } |
|
5669 else |
|
5670 { |
|
5671 if ( aUpdateState ) |
|
5672 { |
|
5673 iUiStates->SetViewFindersInitialPlaceContextPane( EFalse ); |
|
5674 } |
|
5675 } |
|
5676 __VTPRINTEXIT( "VtUi.SwitchViewFinderToMainPaneL" ) |
|
5677 } |
|
5678 |
|
5679 // ----------------------------------------------------------------------------- |
|
5680 // VtUiAppUi::SwitchViewFinderToContextPaneL |
|
5681 // ----------------------------------------------------------------------------- |
|
5682 // |
|
5683 void CVtUiAppUi::SwitchViewFinderToContextPaneL( TBool aUpdateState ) |
|
5684 { |
|
5685 __VTPRINTENTER( "VtUi.SwitchViewFinderToContextPaneL" ) |
|
5686 //change local video in to context pane |
|
5687 if( !IsViewFinderInContextPane() ) |
|
5688 { |
|
5689 //flag indicates the initial position of uplink window before freeze |
|
5690 if ( aUpdateState ) |
|
5691 { |
|
5692 iUiStates->SetViewFindersInitialPlaceContextPane( EFalse ); |
|
5693 } |
|
5694 HandleCommandL( EVtUiCmdSwapImagesPlaces ); |
|
5695 } |
|
5696 else |
|
5697 { |
|
5698 if ( aUpdateState ) |
|
5699 { |
|
5700 iUiStates->SetViewFindersInitialPlaceContextPane( ETrue ); |
|
5701 } |
|
5702 } |
|
5703 __VTPRINTEXIT( "VtUi.SwitchViewFinderToContextPaneL" ) |
|
5704 } |
|
5705 |
|
5706 // ----------------------------------------------------------------------------- |
|
5707 // VtUiAppUi::RestoreViewFinderL |
|
5708 // ----------------------------------------------------------------------------- |
|
5709 // |
|
5710 void CVtUiAppUi::RestoreViewFinderL() |
|
5711 { |
|
5712 __VTPRINTENTER( "VtUi.RestoreViewFinderL" ) |
|
5713 if( IsViewFinderInContextPane() ) |
|
5714 { |
|
5715 if( !iUiStates->IsViewFindersInitialPlaceContextPane() ) |
|
5716 { |
|
5717 SwitchViewFinderToMainPaneL( EFalse ); |
|
5718 } |
|
5719 } |
|
5720 else |
|
5721 { |
|
5722 if( iUiStates->IsViewFindersInitialPlaceContextPane() ) |
|
5723 { |
|
5724 SwitchViewFinderToContextPaneL( EFalse ); |
|
5725 } |
|
5726 } |
|
5727 __VTPRINTEXIT( "VtUi.RestoreViewFinderL" ) |
|
5728 } |
|
5729 |
|
5730 // ----------------------------------------------------------------------------- |
|
5731 // CVtUiAppUi::DialogDismissedL |
|
5732 // ----------------------------------------------------------------------------- |
|
5733 // |
|
5734 void CVtUiAppUi::DialogDismissedL( TInt ) |
|
5735 { |
|
5736 __VTPRINTENTER( "VtUi.DialogDismissedL" ) |
|
5737 MVtUiFeature* tb = |
|
5738 iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ); |
|
5739 if ( tb ) |
|
5740 { |
|
5741 if ( !iTbPeriodic ) |
|
5742 { |
|
5743 iTbPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
5744 } |
|
5745 iTbPeriodic->Cancel(); |
|
5746 // try to strat toolbar feature immediately |
|
5747 iTbPeriodic->Start( 0, KPeriodTime, TCallBack( DoTryToStartTbL, this ) ); |
|
5748 } |
|
5749 __VTPRINTEXIT( "VtUi.DialogDismissedL" ) |
|
5750 } |
|
5751 |
|
5752 // ----------------------------------------------------------------------------- |
|
5753 // CVtUiAppUi::UpdateContextPaneIconL |
|
5754 // ----------------------------------------------------------------------------- |
|
5755 // |
|
5756 void CVtUiAppUi::UpdateContextPaneIconL() |
|
5757 { |
|
5758 CEikStatusPane* statusPane = StatusPane(); |
|
5759 |
|
5760 if ( statusPane ) |
|
5761 { |
|
5762 if ( statusPane->PaneCapabilities( |
|
5763 TUid::Uid( EEikStatusPaneUidContext ) ).IsPresent() ) |
|
5764 { |
|
5765 CAknContextPane* contextPane = NULL; |
|
5766 TRAPD ( err, contextPane = static_cast<CAknContextPane*> ( |
|
5767 statusPane->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ) ) ); |
|
5768 if ( err != KErrNone || ! contextPane ) |
|
5769 { |
|
5770 return; |
|
5771 } |
|
5772 |
|
5773 // Set a new context pane icon |
|
5774 CFbsBitmap* newBitmap = new(ELeave) CFbsBitmap; |
|
5775 CleanupStack::PushL( newBitmap ); |
|
5776 User::LeaveIfError( newBitmap->Create( TSize( 1, 1 ), EGray2 ) ); |
|
5777 |
|
5778 CFbsBitmap* newMask = new(ELeave) CFbsBitmap; |
|
5779 CleanupStack::PushL( newMask ); |
|
5780 User::LeaveIfError( newMask->Create( TSize( 1, 1 ), EGray2 ) ); |
|
5781 |
|
5782 // create an off-screen device and context |
|
5783 CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( newMask ); |
|
5784 CleanupStack::PushL( bitmapDevice ); |
|
5785 CFbsBitGc* maskGc = NULL; |
|
5786 User::LeaveIfError( bitmapDevice->CreateContext( maskGc ) ); |
|
5787 User::LeaveIfNull( maskGc ); |
|
5788 CleanupStack::PushL( maskGc ); |
|
5789 maskGc->SetPenStyle( CGraphicsContext::ENullPen ); |
|
5790 maskGc->SetBrushColor( TRgb::Gray2( 1 ) ); // transparency |
|
5791 maskGc->SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
5792 maskGc->Clear(); |
|
5793 CleanupStack::PopAndDestroy( 2 ); // maskGc, bitmapDevice |
|
5794 |
|
5795 // newBitmap, new Mask ownership transfer |
|
5796 contextPane->SetPicture( newBitmap, newMask ); |
|
5797 CleanupStack::Pop( 2 ); // newBitmap, newMask |
|
5798 } |
|
5799 } |
|
5800 } |
|
5801 |
|
5802 // ----------------------------------------------------------------------------- |
|
5803 // CVtUiAppUi::SetIncallBubbleAllowedInUsualL |
|
5804 // ----------------------------------------------------------------------------- |
|
5805 // |
|
5806 void CVtUiAppUi::SetIncallBubbleAllowedInUsualL( TBool aAllowed ) |
|
5807 { |
|
5808 __VTPRINT2( DEBUG_GEN, "Ui.SetIncallBubbleAllowedInUsualL: %d", aAllowed ) |
|
5809 |
|
5810 // If call is being disconnected, we do not want to show in-call bubble |
|
5811 // anymore but dismiss it. |
|
5812 if( iUiStates->ExecState() == TVtUiStates::EExecStateResetting || |
|
5813 iUiStates->ExecState() == TVtUiStates:: EExecStateFinalized ) |
|
5814 { |
|
5815 __VTPRINT2( DEBUG_GEN, "Ui.SetIncallBubbleAllowedInUsualL forced to false: %d", aAllowed ) |
|
5816 aAllowed = EFalse; |
|
5817 } |
|
5818 |
|
5819 if ( iIncallBubble ) |
|
5820 { |
|
5821 iIncallBubble->SetIncallBubbleAllowedInUsualL( aAllowed ); |
|
5822 } |
|
5823 __VTPRINT( DEBUG_GEN, "Ui.SetIncallBubbleAllowedInUsualL>" ) |
|
5824 } |
|
5825 |
|
5826 // ----------------------------------------------------------------------------- |
|
5827 // CVtUiAppUi::ShowProgressDialogL |
|
5828 // ----------------------------------------------------------------------------- |
|
5829 // |
|
5830 void CVtUiAppUi::ShowProgressDialogL( TInt aResourceId, |
|
5831 MProgressDialogCallback* aCallback ) |
|
5832 { |
|
5833 __VTPRINTENTER( "VtUi.ShowProgressDialogL" ) |
|
5834 if( iProgressDlg ) |
|
5835 { |
|
5836 User::Leave( KErrNotReady ); |
|
5837 } |
|
5838 iProgressDlg = new ( ELeave ) CAknProgressDialog( |
|
5839 reinterpret_cast< CEikDialog** >( &iProgressDlg ), ETrue ); |
|
5840 iProgressDlg->SetCallback( aCallback ); |
|
5841 iProgressDlg->ExecuteLD( aResourceId ); |
|
5842 __VTPRINTEXIT( "VtUi.ShowProgressDialogL" ) |
|
5843 } |
|
5844 |
|
5845 // ----------------------------------------------------------------------------- |
|
5846 // CVtUiAppUi::HideProgressDialogL |
|
5847 // ----------------------------------------------------------------------------- |
|
5848 // |
|
5849 void CVtUiAppUi::HideProgressDialogL() |
|
5850 { |
|
5851 __VTPRINTENTER( "VtUi.HideProgressDialogL" ) |
|
5852 if( iProgressDlg ) |
|
5853 { |
|
5854 iProgressDlg->ProcessFinishedL(); |
|
5855 } |
|
5856 __VTPRINTEXIT( "VtUi.HideProgressDialogL" ) |
|
5857 } |
|
5858 |
|
5859 // ----------------------------------------------------------------------------- |
|
5860 // CVtUiAppUi::AsyncViewFinderToMainPaneAndShare |
|
5861 // ----------------------------------------------------------------------------- |
|
5862 // |
|
5863 TInt CVtUiAppUi::AsyncViewFinderToMainPaneAndShare( TAny* aPtr ) |
|
5864 { |
|
5865 __VTPRINTENTER( "VtUi.AsyncViewFinderToMainPaneAndShare" ) |
|
5866 CVtUiAppUi* self = reinterpret_cast< CVtUiAppUi* >( aPtr ); |
|
5867 |
|
5868 TRAPD( result, { self->SwitchViewFinderToMainPaneL(); |
|
5869 self->CmdShareImageL();} ); |
|
5870 __VTPRINTEXITR( "VtUi.AsyncViewFinderToMainPaneAndShare %d", result ) |
|
5871 return result; |
|
5872 } |
|
5873 |
|
5874 // ----------------------------------------------------------------------------- |
|
5875 // CVtUiAppUi::AsyncShare |
|
5876 // ----------------------------------------------------------------------------- |
|
5877 // |
|
5878 TInt CVtUiAppUi::AsyncShare( TAny* aPtr ) |
|
5879 { |
|
5880 __VTPRINTENTER( "VtUi.AsyncShare" ) |
|
5881 CVtUiAppUi* self = reinterpret_cast< CVtUiAppUi* >( aPtr ); |
|
5882 TRAPD( result, self->CmdShareImageL() ); |
|
5883 __VTPRINTEXITR( "VtUi.AsyncShare %d", result ) |
|
5884 return result; |
|
5885 } |
|
5886 |
|
5887 // ----------------------------------------------------------------------------- |
|
5888 // CVtUiAppUi::AsyncShowErrorAndRestartShare |
|
5889 // ----------------------------------------------------------------------------- |
|
5890 // |
|
5891 TInt CVtUiAppUi::AsyncShowErrorAndRestartShare( TAny* aPtr ) |
|
5892 { |
|
5893 __VTPRINTENTER( "VtUi.AsyncShowErrorAndRestartShare" ) |
|
5894 CVtUiAppUi* self = reinterpret_cast< CVtUiAppUi* >( aPtr ); |
|
5895 TRAPD( result, { self->ShowUnableToOpenNoteL(); |
|
5896 self->HandleCommandL( EVtUiCmdShareObjectImage ); } ); |
|
5897 __VTPRINTEXITR( "VtUi.AsyncShowErrorAndRestartShare %d", result ) |
|
5898 return result; |
|
5899 } |
|
5900 |
|
5901 // ----------------------------------------------------------------------------- |
|
5902 // CVtUiAppUi::GetCameraOrientations |
|
5903 // ----------------------------------------------------------------------------- |
|
5904 // |
|
5905 void CVtUiAppUi::GetCameraOrientations() |
|
5906 { |
|
5907 __VTPRINTENTER( "VtUi.GetCameraOrientations" ) |
|
5908 MVtEngMedia& media = Model().Media(); |
|
5909 media.GetCameraOrientations( iPrimaryCameraOrientation, |
|
5910 iSecondaryCameraOrientation ); |
|
5911 __VTPRINTEXIT( "VtUi.GetCameraOrientations" ) |
|
5912 } |
|
5913 |
|
5914 // ----------------------------------------------------------------------------- |
|
5915 // CVtUiAppUi::SetInitialCameraOrientationL |
|
5916 // ----------------------------------------------------------------------------- |
|
5917 // |
|
5918 void CVtUiAppUi::SetInitialCameraOrientationL() |
|
5919 { |
|
5920 __VTPRINTENTER( "VtUi.SetInitialCameraOrientationL" ) |
|
5921 MVtEngMedia::TCameraId cameraId; |
|
5922 MVtEngMedia& media( Model().Media() ); |
|
5923 media.GetCurrentCameraId( cameraId ); |
|
5924 MVtEngMedia::TCameraOrientation targetOrientation( |
|
5925 cameraId == MVtEngMedia::EPrimaryCamera ? |
|
5926 iPrimaryCameraOrientation : |
|
5927 ( cameraId == MVtEngMedia::ESecondaryCamera ? |
|
5928 iSecondaryCameraOrientation : |
|
5929 iCurrentCameraOrientation ) ); |
|
5930 if ( iCurrentCameraOrientation != targetOrientation ) |
|
5931 { |
|
5932 __VTPRINT3( DEBUG_GEN, |
|
5933 "VtUi.SetInitialCameraOrientationL Old=%d New=%d", |
|
5934 iCurrentCameraOrientation, |
|
5935 targetOrientation ) |
|
5936 SetOrientationL( engToAppOrientation[ targetOrientation ] ); |
|
5937 iCurrentCameraOrientation = targetOrientation; |
|
5938 } |
|
5939 __VTPRINTEXIT( "VtUi.SetInitialCameraOrientationL" ) |
|
5940 } |
|
5941 |
|
5942 // ----------------------------------------------------------------------------- |
|
5943 // CVtUiAppUi::SetCameraOrientationL |
|
5944 // ----------------------------------------------------------------------------- |
|
5945 // |
|
5946 void CVtUiAppUi::SetCameraOrientationL() |
|
5947 { |
|
5948 __VTPRINTENTER( "VtUi.SetCameraOrientationL" ) |
|
5949 MVtEngMedia::TCameraOrientation newOrientation = iCurrentCameraOrientation; |
|
5950 MVtEngMedia::TCameraId cameraId; |
|
5951 MVtEngMedia& media = Model().Media(); |
|
5952 if ( media.GetCurrentCameraId( cameraId ) == KErrNone ) |
|
5953 { |
|
5954 switch ( cameraId ) |
|
5955 { |
|
5956 case MVtEngMedia::EPrimaryCamera: |
|
5957 __VTPRINT( DEBUG_GEN, "VtUi.SetCameraOrient.Primary") |
|
5958 if( iCurrentCameraOrientation != iPrimaryCameraOrientation ) |
|
5959 { |
|
5960 newOrientation = iPrimaryCameraOrientation; |
|
5961 } |
|
5962 break; |
|
5963 |
|
5964 case MVtEngMedia::ESecondaryCamera: |
|
5965 __VTPRINT( DEBUG_GEN, "VtUi.SetCameraOrient.Secondary") |
|
5966 if ( iCurrentCameraOrientation != iSecondaryCameraOrientation ) |
|
5967 { |
|
5968 newOrientation = iSecondaryCameraOrientation; |
|
5969 } |
|
5970 break; |
|
5971 |
|
5972 default: |
|
5973 break; |
|
5974 } |
|
5975 } |
|
5976 |
|
5977 __VTPRINT2( DEBUG_GEN, "VtUi.SetCameraOrient.Cur=%d", |
|
5978 iCurrentCameraOrientation ) |
|
5979 __VTPRINT2( DEBUG_GEN, "VtUi.SetCameraOrient.New=%d", |
|
5980 newOrientation ) |
|
5981 |
|
5982 if ( iCurrentCameraOrientation != newOrientation ) |
|
5983 { |
|
5984 // map camera orientation to appui layout orientation |
|
5985 TAppUiOrientation newAppUiOrientation; |
|
5986 if ( newOrientation == MVtEngMedia::EOrientationLandscape ) |
|
5987 { |
|
5988 __VTPRINT( DEBUG_GEN, "VtUi.SetCameraOrient=LS") |
|
5989 newAppUiOrientation = EAppUiOrientationLandscape; |
|
5990 } |
|
5991 else if ( newOrientation == MVtEngMedia::EOrientationPortrait ) |
|
5992 { |
|
5993 __VTPRINT( DEBUG_GEN, "VtUi.SetCameraOrient=PR") |
|
5994 newAppUiOrientation = EAppUiOrientationPortrait; |
|
5995 } |
|
5996 else |
|
5997 { |
|
5998 __VTPRINT( DEBUG_GEN, "VtUi.SetCameraOrient=OL") |
|
5999 newAppUiOrientation = EAppUiOrientationUnspecified; |
|
6000 } |
|
6001 SetOrientationL( newAppUiOrientation ); |
|
6002 } |
|
6003 __VTPRINTEXIT( "VtUi.SetCameraOrientationL" ) |
|
6004 } |
|
6005 |
|
6006 // ----------------------------------------------------------------------------- |
|
6007 // CVtUiAppUi::RefreshStatesL |
|
6008 // ----------------------------------------------------------------------------- |
|
6009 // |
|
6010 void CVtUiAppUi::RefreshStatesL() |
|
6011 { |
|
6012 __VTPRINTENTER( "VtUi.RefreshStatesL" ) |
|
6013 // If transaction (set of commands) is pending refresh in delayed until |
|
6014 // all of them are processed. |
|
6015 if ( !iUiStates->IsCommandActivating() ) |
|
6016 { |
|
6017 iUiStates->Update(); |
|
6018 if ( iUiStates->IsThisApplicationForeground() ) |
|
6019 { |
|
6020 iCommandManager->RefreshL(); |
|
6021 } |
|
6022 } |
|
6023 __VTPRINTEXIT( "VtUi.RefreshStatesL" ) |
|
6024 } |
|
6025 |
|
6026 // ----------------------------------------------------------------------------- |
|
6027 // CVtUiAppUi::CmdAdjustVideoL |
|
6028 // ----------------------------------------------------------------------------- |
|
6029 // |
|
6030 void CVtUiAppUi::CmdAdjustVideoL( TInt aCommand ) |
|
6031 { |
|
6032 __VTPRINTENTER( "VtUi.CmdAdjustVideoL" ) |
|
6033 TInt featureId( -1 ); |
|
6034 switch ( aCommand ) |
|
6035 { |
|
6036 case EVtUiCmdAdjustVideoVideoQuality: |
|
6037 featureId = EVtUiFeatureIdVideoQuality; |
|
6038 break; |
|
6039 case EVtUiCmdAdjustVideoWhiteBalance: |
|
6040 featureId = EVtUiFeatureIdWhiteBalance; |
|
6041 break; |
|
6042 case EVtUiCmdAdjustVideoBrightness: |
|
6043 featureId = EVtUiFeatureIdBrightness; |
|
6044 break; |
|
6045 case EVtUiCmdAdjustVideoContrast: |
|
6046 featureId = EVtUiFeatureIdContrast; |
|
6047 break; |
|
6048 case EVtUiCmdAdjustVideoColourTone: |
|
6049 featureId = EVtUiFeatureIdColourTone; |
|
6050 break; |
|
6051 default: |
|
6052 break; |
|
6053 } |
|
6054 MVtUiFeature* vb = iFeatureManager->GetFeatureById( featureId ); |
|
6055 if ( vb ) |
|
6056 { |
|
6057 __VTPRINT( DEBUG_GEN, "VtUi.CmdAdjustVideoL.StartL" ); |
|
6058 vb->StartL(); |
|
6059 } |
|
6060 __VTPRINTEXIT( "VtUi.CmdAdjustVideoL" ) |
|
6061 } |
|
6062 |
|
6063 // ----------------------------------------------------------------------------- |
|
6064 // CVtUiAppUi::AppUiInitDoneDoPostInitL |
|
6065 // ----------------------------------------------------------------------------- |
|
6066 // |
|
6067 void CVtUiAppUi::AppUiInitDoneDoPostInitL() |
|
6068 { |
|
6069 MVtUiFeature* tb = iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ); |
|
6070 if ( tb ) |
|
6071 { |
|
6072 if ( !iTbPeriodic ) |
|
6073 { |
|
6074 iTbPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
6075 } |
|
6076 iTbPeriodic->Cancel(); |
|
6077 // try to strat toolbar feature immediately |
|
6078 iTbPeriodic->Start( 0, KPeriodTime, TCallBack( DoTryToStartTbL, this ) ); |
|
6079 } |
|
6080 } |
|
6081 |
|
6082 // ----------------------------------------------------------------------------- |
|
6083 // CVtUiAppUi::ProcessWsEventIfZoomModeIsActiveL |
|
6084 // ----------------------------------------------------------------------------- |
|
6085 // |
|
6086 TBool CVtUiAppUi::ProcessWsEventIfZoomModeIsActiveL( const TWsEvent& aEvent ) |
|
6087 { |
|
6088 __VTPRINTENTER( "VtUi.ProWsEvtIfZoomActivedL" ) |
|
6089 const TInt type = aEvent.Type(); |
|
6090 switch( type ) |
|
6091 { |
|
6092 case EEventKey: |
|
6093 case EEventKeyUp: |
|
6094 case EEventKeyDown: |
|
6095 { |
|
6096 const TKeyEvent* keyEvent = aEvent.Key(); |
|
6097 |
|
6098 |
|
6099 // Up and down arrow key events does the zooming, |
|
6100 // and should be forwarded to appui's key event handler. |
|
6101 // Also ETrue must be returned, so that other controls |
|
6102 // would not get these key events. |
|
6103 TEventCode eventCode = (TEventCode)aEvent.Type(); |
|
6104 if ( keyEvent->iScanCode == EStdKeyUpArrow || |
|
6105 keyEvent->iScanCode == EStdKeyDownArrow || |
|
6106 keyEvent->iCode == EKeyZoomIn || |
|
6107 keyEvent->iCode == EKeyZoomOut ) |
|
6108 { |
|
6109 HandleKeyEventL( *keyEvent, eventCode ); |
|
6110 __VTPRINTEXIT( "VtUi.ProWsEvtIfZoomActivedL" ) |
|
6111 return ETrue; |
|
6112 } |
|
6113 __VTPRINT( DEBUG_GEN, "VtUi.HandleWsEventL zoom mode set" ); |
|
6114 // If user selects zoom mode from options menu EEventKeyUp |
|
6115 // will be generated after that. Therefore this event must be |
|
6116 // ignored. Also EEventKeyDown are ignored. This means that |
|
6117 // only EEventKey events can dismiss the zoom mode. |
|
6118 if ( type != EEventKeyUp && type != EEventKeyDown ) |
|
6119 { |
|
6120 // If zoom mode is on only zoom mode button is available in |
|
6121 // toolbar. Pressing the zoom mode button in toolbar |
|
6122 // should not dismiss the zoom mode, that is why this events |
|
6123 // are ignored. If toolbar is not available and |
|
6124 // also EKeyDevice3 (selection key) event should dismiss |
|
6125 // the zoom mode. |
|
6126 if ( keyEvent->iCode != EKeyDevice3 || |
|
6127 ( keyEvent->iCode == EKeyDevice3 && |
|
6128 !iUiStates->IsToolbarAvailable() ) ) |
|
6129 { |
|
6130 __VTPRINT( DEBUG_GEN, "VtUi.ProWsEvtIfZoomActivedL.EKeyDevice3" ); |
|
6131 SetZoomModeL( EFalse ); |
|
6132 } |
|
6133 } |
|
6134 } |
|
6135 break; |
|
6136 |
|
6137 case EEventPointer: |
|
6138 __VTPRINT( DEBUG_GEN, "VtUi.ProWsEvtIfZoomActivedL.EEventPointer" ); |
|
6139 break; |
|
6140 |
|
6141 case KAknHardwareLayoutSwitch: |
|
6142 // Window server event used when layout changes |
|
6143 __VTPRINT( DEBUG_GEN, "VtUi.ProcessWsEventIfZoomModeIsActiveL.LayoutSwitch" ); |
|
6144 break; |
|
6145 |
|
6146 case EEventScreenDeviceChanged: |
|
6147 // The screen size mode has changed, for instance when the cover on a phone |
|
6148 // that supports screen flipping is opened or closed. |
|
6149 __VTPRINT( DEBUG_GEN, "VtUi.ProcessWsEventIfZoomModeIsActiveL.ScreenChanged" ); |
|
6150 break; |
|
6151 |
|
6152 case EVtUiWsEventNumberSourceDeactivate: |
|
6153 // Number source deactivated |
|
6154 __VTPRINT( DEBUG_GEN, "VtUi.ProWsEvtIfZoomActivedL.NumberDeactivate" ); |
|
6155 break; |
|
6156 |
|
6157 default: |
|
6158 __VTPRINT( DEBUG_GEN, "VtUi.ProWsEvtIfZoomActivedL.default" ); |
|
6159 // EVtUiWsEventNumberSourceActivate could be generated through number buttons |
|
6160 // and execution runs to default statement |
|
6161 SetZoomModeL( EFalse ); |
|
6162 break; |
|
6163 } |
|
6164 __VTPRINTEXIT( "VtUi.ProWsEvtIfZoomActivedL2" ) |
|
6165 return EFalse; |
|
6166 } |
|
6167 |
|
6168 // ----------------------------------------------------------------------------- |
|
6169 // CVtUiAppUi::StopSliders() |
|
6170 // ----------------------------------------------------------------------------- |
|
6171 // |
|
6172 void CVtUiAppUi::StopSliders() |
|
6173 { |
|
6174 __VTPRINTENTER( "VtUi.StopSliders" ) |
|
6175 if( iUiStates->IsBrightnessModeOn() ) |
|
6176 { |
|
6177 // if brightness feature is active, stop that |
|
6178 MVtUiFeature* br = iFeatureManager->GetFeatureById( EVtUiFeatureIdBrightness ); |
|
6179 if ( br ) |
|
6180 { |
|
6181 if ( br->State() == MVtUiFeature::EActive ) |
|
6182 { |
|
6183 __VTPRINT( DEBUG_GEN, "VtUi.StopSliders br->STOP" ) |
|
6184 br->Stop(); |
|
6185 } |
|
6186 } |
|
6187 } |
|
6188 // if contrast feature is active, stop that |
|
6189 if( iUiStates->IsContrastModeOn() ) |
|
6190 { |
|
6191 // if contrast feature is active, stop that |
|
6192 MVtUiFeature* cr = iFeatureManager->GetFeatureById( EVtUiFeatureIdContrast ); |
|
6193 if ( cr ) |
|
6194 { |
|
6195 if ( cr->State() == MVtUiFeature::EActive ) |
|
6196 { |
|
6197 __VTPRINT( DEBUG_GEN, "VtUi.StopSliders cr->STOP" ) |
|
6198 cr->Stop(); |
|
6199 } |
|
6200 } |
|
6201 } |
|
6202 // if volume feature is active, stop that |
|
6203 if( iUiStates->IsVolumeModeOn() ) |
|
6204 { |
|
6205 // if volume feature is active, stop that |
|
6206 MVtUiFeature* vl = iFeatureManager->GetFeatureById( EVtUiFeatureIdVolume ); |
|
6207 if ( vl ) |
|
6208 { |
|
6209 if ( vl->State() == MVtUiFeature::EActive ) |
|
6210 { |
|
6211 __VTPRINT( DEBUG_GEN, "VtUi.StopSliders vl->STOP" ) |
|
6212 vl->Stop(); |
|
6213 } |
|
6214 } |
|
6215 } |
|
6216 // if zoom feature is active, stop that |
|
6217 if( iUiStates->IsZoomModeOn() ) |
|
6218 { |
|
6219 // if zoom feature is active, stop that |
|
6220 MVtUiFeature* zm = iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom ); |
|
6221 if ( zm ) |
|
6222 { |
|
6223 if ( zm->State() == MVtUiFeature::EActive ) |
|
6224 { |
|
6225 __VTPRINT( DEBUG_GEN, "VtUi.StopSliders zm->STOP" ) |
|
6226 zm->Stop(); |
|
6227 } |
|
6228 } |
|
6229 } |
|
6230 __VTPRINTEXIT( "VtUi.StopSliders" ) |
|
6231 } |
|
6232 |
|
6233 // ----------------------------------------------------------------------------- |
|
6234 // CVtUiAppUi::CanSwapImagePlaces() |
|
6235 // ----------------------------------------------------------------------------- |
|
6236 // |
|
6237 TBool CVtUiAppUi::CanSwapImagePlaces() |
|
6238 { |
|
6239 __VTPRINTENTER( "VtUi.CanSwapImagePlaces" ) |
|
6240 TTime now; |
|
6241 now.HomeTime(); |
|
6242 // User can swap image places if the frequency is lower than maximum frequency. |
|
6243 if ( now.MicroSecondsFrom( iLastSwapTime ).Int64() >= KVtUiMaxSwapImagesFreq ) |
|
6244 { |
|
6245 __VTPRINT( DEBUG_GEN, "VtUi.Swap can swap image" ) |
|
6246 iLastSwapTime = now; |
|
6247 return ETrue; |
|
6248 } |
|
6249 else |
|
6250 { |
|
6251 __VTPRINT( DEBUG_GEN, "VtUi.Swap can not swap image" ) |
|
6252 return EFalse; |
|
6253 } |
|
6254 __VTPRINTEXIT( "VtUi.CanSwapImagePlaces" ) |
|
6255 } |
|
6256 |
|
6257 // Implementation of CVtUiAppUi::CInstance |
|
6258 |
|
6259 // ----------------------------------------------------------------------------- |
|
6260 // CVtUiAppUi::CInstance::CInstance |
|
6261 // ----------------------------------------------------------------------------- |
|
6262 // |
|
6263 CVtUiAppUi::CInstance::CInstance( CVtUiAppUi& aAppUi ) |
|
6264 : iAppUi( aAppUi ) |
|
6265 { |
|
6266 } |
|
6267 |
|
6268 void CVtUiAppUi::CInstance::CreateRemoteVideoControl() |
|
6269 { |
|
6270 iRemoteVideoControl = CVtUiRemoteVideoControl::NewL( iAppUi ); |
|
6271 iRemoteVideoControl->MakeVisible(EFalse); |
|
6272 iMainControl->SetRemoteVideoControl( iRemoteVideoControl ); |
|
6273 iMainControl->LayoutRemoteVideo(); |
|
6274 |
|
6275 iAppUi.AddToStackL( iRemoteVideoControl ); |
|
6276 |
|
6277 iRemoteVideoControlInStack = ETrue; |
|
6278 |
|
6279 } |
|
6280 |
|
6281 // ----------------------------------------------------------------------------- |
|
6282 // CVtUiAppUi::CInstance::ConstructL |
|
6283 // ----------------------------------------------------------------------------- |
|
6284 // |
|
6285 void CVtUiAppUi::CInstance::ConstructL() |
|
6286 { |
|
6287 iBitmapManager = new ( ELeave ) CVtUiBitmapManager; |
|
6288 |
|
6289 TRect parent; |
|
6290 TAknWindowLineLayout control; |
|
6291 |
|
6292 VtUiLayout::GetApplicationParentRect( parent ); |
|
6293 iMainControl = CVtUiMainControl::NewL( *iBitmapManager, |
|
6294 *iAppUi.iUiStates ); |
|
6295 |
|
6296 VtUiLayout::GetMainPaneLayout( control ); |
|
6297 AknLayoutUtils::LayoutControl( iMainControl, parent, control ); |
|
6298 |
|
6299 iAppUi.AddToStackL( iMainControl ); |
|
6300 iMainControlInStack = ETrue; |
|
6301 |
|
6302 TAknLayoutRect layout; |
|
6303 layout.LayoutRect( parent, control ); |
|
6304 iNumberEntryActivation = |
|
6305 new ( ELeave ) CVtUiNumberEntryActivationControl( iAppUi ); |
|
6306 iNumberEntryActivation->ConstructL( layout.Rect() ); |
|
6307 |
|
6308 iContextControl = CVtUiContextControl::NewL( |
|
6309 *iBitmapManager, |
|
6310 iAppUi, |
|
6311 *iAppUi.iUiStates ); |
|
6312 |
|
6313 VtUiLayout::GetFirstWindowBackgroundLayout( |
|
6314 control ); |
|
6315 AknLayoutUtils::LayoutControl( iContextControl, parent, control ); |
|
6316 iAppUi.AddToStackL( iContextControl ); |
|
6317 iContextControlInStack = ETrue; |
|
6318 |
|
6319 iNaviPane = |
|
6320 CVtUiNaviPane::NewL( |
|
6321 *( iAppUi.NaviPaneL() ), |
|
6322 iAppUi ); |
|
6323 |
|
6324 } |
|
6325 |
|
6326 // ----------------------------------------------------------------------------- |
|
6327 // CVtUiAppUi::CInstance::LayoutChanged |
|
6328 // ----------------------------------------------------------------------------- |
|
6329 // |
|
6330 void CVtUiAppUi::CInstance::LayoutChanged() |
|
6331 { |
|
6332 // Layout controls. |
|
6333 TRect parent; |
|
6334 TAknWindowLineLayout control; |
|
6335 VtUiLayout::GetApplicationParentRect( parent ); |
|
6336 VtUiLayout::GetMainPaneLayout( control ); |
|
6337 AknLayoutUtils::LayoutControl( iMainControl, parent, control ); |
|
6338 if(iMainControl) |
|
6339 iMainControl->LayoutRemoteVideo(); |
|
6340 AknLayoutUtils::LayoutControl( iNumberEntryActivation, parent, control ); |
|
6341 VtUiLayout::GetFirstWindowBackgroundLayout( control ); |
|
6342 AknLayoutUtils::LayoutControl( iContextControl, parent, control ); |
|
6343 if(iContextControl) |
|
6344 iContextControl->LayoutRemoteVideo(); |
|
6345 |
|
6346 } |
|
6347 |
|
6348 // ----------------------------------------------------------------------------- |
|
6349 // CVtUiAppUi::CInstance::VolumeKeyPressedL |
|
6350 // ----------------------------------------------------------------------------- |
|
6351 // |
|
6352 void CVtUiAppUi::CInstance::VolumeKeyPressedL() |
|
6353 { |
|
6354 __VTPRINTENTER( "CVtUiAppUi.VolumeKeyPressedL" ) |
|
6355 // if the application is in foreground show volume sliders |
|
6356 if ( iAppUi.IsForeground() ) |
|
6357 { |
|
6358 // If application is shutting down, no need to show volume popup |
|
6359 if ( iAppUi.iState == NULL || |
|
6360 iAppUi.iState == |
|
6361 TVtUiStateResetting::InstanceL( iAppUi, *iAppUi.iUiStates ) ) |
|
6362 { |
|
6363 return; |
|
6364 } |
|
6365 |
|
6366 CVtUiVolume* volume = static_cast< CVtUiVolume* >( |
|
6367 iAppUi.iFeatureManager->GetFeatureById( EVtUiFeatureIdVolume ) ); |
|
6368 if ( volume ) |
|
6369 { |
|
6370 // If the capture mode is on we should |
|
6371 // end the capture mode |
|
6372 if( iAppUi.iUiStates->IsCaptureModeOn() ) |
|
6373 { |
|
6374 iAppUi.CmdCancelCaptureL(); |
|
6375 } |
|
6376 volume->StartL(); |
|
6377 } |
|
6378 } |
|
6379 __VTPRINTEXIT( "CVtUiAppUi.VolumeKeyPressedL" ) |
|
6380 } |
|
6381 |
|
6382 // ----------------------------------------------------------------------------- |
|
6383 // CVtUiAppUi::CInstance::NewL |
|
6384 // ----------------------------------------------------------------------------- |
|
6385 // |
|
6386 CVtUiAppUi::CInstance* CVtUiAppUi::CInstance::NewL( CVtUiAppUi& aAppUi ) |
|
6387 { |
|
6388 CInstance* self = new ( ELeave ) CInstance( aAppUi ); |
|
6389 CleanupStack::PushL( self ); |
|
6390 self->ConstructL(); |
|
6391 CleanupStack::Pop( self ); |
|
6392 |
|
6393 return self; |
|
6394 } |
|
6395 |
|
6396 // ----------------------------------------------------------------------------- |
|
6397 // CVtUiAppUi::CInstance::~CInstance |
|
6398 // ----------------------------------------------------------------------------- |
|
6399 // |
|
6400 CVtUiAppUi::CInstance::~CInstance() |
|
6401 { |
|
6402 if ( iMainControl && iMainControlInStack ) |
|
6403 { |
|
6404 iAppUi.RemoveFromStack( iMainControl ); |
|
6405 } |
|
6406 if ( iContextControl && iContextControlInStack ) |
|
6407 { |
|
6408 iAppUi.RemoveFromStack( iContextControl ); |
|
6409 } |
|
6410 if(iRemoteVideoControl &&iRemoteVideoControlInStack) |
|
6411 { |
|
6412 iAppUi.RemoveFromStack( iRemoteVideoControl ); |
|
6413 } |
|
6414 delete iMainControl; |
|
6415 delete iContextControl; |
|
6416 delete iRemoteVideoControl; |
|
6417 delete iNumberEntryActivation; |
|
6418 delete iNaviPane; |
|
6419 delete iBitmapManager; |
|
6420 } |
|
6421 |
|
6422 // Implementation of CVtUiAppUi::CEventObserver |
|
6423 |
|
6424 // ----------------------------------------------------------------------------- |
|
6425 // CVtUiAppUi::CEventObserver::CEventObserver |
|
6426 // ----------------------------------------------------------------------------- |
|
6427 // |
|
6428 CVtUiAppUi::CEventObserver::CEventObserver( CVtUiAppUi& aAppUi ) |
|
6429 : iAppUi( aAppUi ), |
|
6430 iCommandObservers( KVtUiCommandObserverArrayGranularity ) |
|
6431 { |
|
6432 } |
|
6433 |
|
6434 // ----------------------------------------------------------------------------- |
|
6435 // CVtUiAppUi::CEventObserver::ConstructL |
|
6436 // ----------------------------------------------------------------------------- |
|
6437 // |
|
6438 void CVtUiAppUi::CEventObserver::ConstructL() |
|
6439 { |
|
6440 iModel = CVtEngModel::NewL( *this, *this ); |
|
6441 |
|
6442 } |
|
6443 |
|
6444 // ----------------------------------------------------------------------------- |
|
6445 // CVtUiAppUi::CEventObserver::NewL |
|
6446 // ----------------------------------------------------------------------------- |
|
6447 // |
|
6448 CVtUiAppUi::CEventObserver* CVtUiAppUi::CEventObserver::NewL( |
|
6449 CVtUiAppUi& aAppUi ) |
|
6450 { |
|
6451 CEventObserver* self = new ( ELeave ) CEventObserver( aAppUi ); |
|
6452 CleanupStack::PushL( self ); |
|
6453 self->ConstructL(); |
|
6454 CleanupStack::Pop( self ); |
|
6455 return self; |
|
6456 } |
|
6457 |
|
6458 // ----------------------------------------------------------------------------- |
|
6459 // CVtUiAppUi::CEventObserver::~CEventObserver |
|
6460 // ----------------------------------------------------------------------------- |
|
6461 // |
|
6462 CVtUiAppUi::CEventObserver::~CEventObserver() |
|
6463 { |
|
6464 iCommandObservers.Close(); |
|
6465 |
|
6466 delete iModel; |
|
6467 delete iBeat; |
|
6468 |
|
6469 delete iRemConInterfaceSelector; |
|
6470 iRemConCoreApiTarget = NULL; // not owned. |
|
6471 } |
|
6472 |
|
6473 // ----------------------------------------------------------------------------- |
|
6474 // CVtUiAppUi::CEventObserver::Model |
|
6475 // ----------------------------------------------------------------------------- |
|
6476 // |
|
6477 inline CVtEngModel& CVtUiAppUi::CEventObserver::Model() |
|
6478 { |
|
6479 return *iModel; |
|
6480 } |
|
6481 |
|
6482 // ----------------------------------------------------------------------------- |
|
6483 // CVtUiAppUi::CEventObserver::CreateRemConSessionL |
|
6484 // ----------------------------------------------------------------------------- |
|
6485 // |
|
6486 void CVtUiAppUi::CEventObserver::CreateRemConSessionL() |
|
6487 { |
|
6488 __VTPRINTENTER( "VtUiComms.CreateRemCon" ) |
|
6489 // If one of the iRemCon* pointers equals to NULL, then all of them are |
|
6490 // NULL. |
|
6491 if ( !iRemConInterfaceSelector ) |
|
6492 { |
|
6493 CRemConInterfaceSelector* interfaceSelector = |
|
6494 CRemConInterfaceSelector::NewL(); |
|
6495 CleanupStack::PushL( interfaceSelector ); |
|
6496 |
|
6497 CRemConCoreApiTarget* coreApiTarget = |
|
6498 CRemConCoreApiTarget::NewL( *interfaceSelector, *this ); |
|
6499 // The coreApiTarget instance is owned by interfaceSelector instance. |
|
6500 // This instance must implement MRemConCoreApiTargetObserver interface. |
|
6501 CleanupStack::PushL( coreApiTarget ); |
|
6502 interfaceSelector->OpenTargetL(); |
|
6503 |
|
6504 iRemConVolumeRepeatTimer = CPeriodic::NewL( CActive::EPriorityHigh ); |
|
6505 |
|
6506 CleanupStack::Pop( coreApiTarget ); |
|
6507 CleanupStack::Pop( interfaceSelector ); |
|
6508 |
|
6509 iRemConInterfaceSelector = interfaceSelector; |
|
6510 iRemConCoreApiTarget = coreApiTarget; |
|
6511 } |
|
6512 __VTPRINTEXIT( "VtUiComms.CreateRemCon" ) |
|
6513 } |
|
6514 |
|
6515 // ----------------------------------------------------------------------------- |
|
6516 // CVtUiAppUi::CEventObserver::DeleteRemConSession |
|
6517 // ----------------------------------------------------------------------------- |
|
6518 // |
|
6519 void CVtUiAppUi::CEventObserver::DeleteRemConSession() |
|
6520 { |
|
6521 delete iRemConVolumeRepeatTimer; |
|
6522 iRemConVolumeRepeatTimer = NULL; |
|
6523 |
|
6524 delete iRemConInterfaceSelector; |
|
6525 iRemConInterfaceSelector = NULL; |
|
6526 |
|
6527 iRemConCoreApiTarget = NULL; // not owned. |
|
6528 } |
|
6529 |
|
6530 // ----------------------------------------------------------------------------- |
|
6531 // CVtUiAppUi::CEventObserver::CommandSupported |
|
6532 // ----------------------------------------------------------------------------- |
|
6533 // |
|
6534 TBool CVtUiAppUi::CEventObserver::CommandSupported( |
|
6535 const TInt aCommandId ) const |
|
6536 { |
|
6537 const TInt caps = iModel->CommandHandler().GetCommandCaps( aCommandId ); |
|
6538 return |
|
6539 ( caps >= KErrNone ) && |
|
6540 ( caps & MVtEngCommandHandler::EAttribSupported ); |
|
6541 } |
|
6542 |
|
6543 // ----------------------------------------------------------------------------- |
|
6544 // CVtUiAppUi::CEventObserver::CommandSupportedAndSynchronous |
|
6545 // ----------------------------------------------------------------------------- |
|
6546 // |
|
6547 TBool CVtUiAppUi::CEventObserver::CommandSupportedAndSynchronous( |
|
6548 const TInt aCommandId ) const |
|
6549 { |
|
6550 const TInt caps = iModel->CommandHandler().GetCommandCaps( aCommandId ); |
|
6551 return |
|
6552 ( caps >= KErrNone ) && |
|
6553 ( caps & MVtEngCommandHandler::EAttribSupported ) && |
|
6554 ( ~caps & MVtEngCommandHandler::EAttribAsync ); |
|
6555 } |
|
6556 |
|
6557 // ----------------------------------------------------------------------------- |
|
6558 // CVtUiAppUi::CEventObserver::AddObserverL |
|
6559 // ----------------------------------------------------------------------------- |
|
6560 // |
|
6561 void CVtUiAppUi::CEventObserver::AddObserverL( |
|
6562 MVtEngCommandObserver& aObserver ) |
|
6563 { |
|
6564 User::LeaveIfError( |
|
6565 iCommandObservers.Append( &aObserver ) ); |
|
6566 } |
|
6567 |
|
6568 // ----------------------------------------------------------------------------- |
|
6569 // CVtUiAppUi::CEventObserver::RemoveObserver |
|
6570 // ----------------------------------------------------------------------------- |
|
6571 // |
|
6572 void CVtUiAppUi::CEventObserver::RemoveObserver( |
|
6573 MVtEngCommandObserver& aObserver ) |
|
6574 { |
|
6575 const TInt pos = iCommandObservers.Find( &aObserver ); |
|
6576 if ( pos != KErrNotFound ) |
|
6577 { |
|
6578 if ( !iInCommandPerformed ) |
|
6579 { |
|
6580 iCommandObservers.Remove( pos ); |
|
6581 } |
|
6582 else |
|
6583 { |
|
6584 iCommandObservers[ pos ] = NULL; |
|
6585 } |
|
6586 } |
|
6587 } |
|
6588 |
|
6589 // ----------------------------------------------------------------------------- |
|
6590 // CVtUiAppUi::CEventObserver::StartBeatL |
|
6591 // ----------------------------------------------------------------------------- |
|
6592 // |
|
6593 void CVtUiAppUi::CEventObserver::StartBeatL() |
|
6594 { |
|
6595 if ( !iBeat ) |
|
6596 { |
|
6597 iBeat = CHeartbeat::NewL( CActive::EPriorityStandard ); |
|
6598 } |
|
6599 |
|
6600 if ( !iBeat->IsActive() ) |
|
6601 { |
|
6602 iBeat->Start( ETwelveOClock, this ); |
|
6603 } |
|
6604 } |
|
6605 |
|
6606 // ----------------------------------------------------------------------------- |
|
6607 // CVtUiAppUi::CEventObserver::StopBeat |
|
6608 // ----------------------------------------------------------------------------- |
|
6609 // |
|
6610 void CVtUiAppUi::CEventObserver::StopBeat() |
|
6611 { |
|
6612 delete iBeat; |
|
6613 iBeat = NULL; |
|
6614 } |
|
6615 |
|
6616 // ----------------------------------------------------------------------------- |
|
6617 // CVtUiAppUi::CEventObserver::StopVolumeRepeatTimer |
|
6618 // ----------------------------------------------------------------------------- |
|
6619 // |
|
6620 void CVtUiAppUi::CEventObserver::StopVolumeRepeatTimer() |
|
6621 { |
|
6622 iRemConVolumeRepeatTimer->Cancel(); |
|
6623 } |
|
6624 |
|
6625 // ----------------------------------------------------------------------------- |
|
6626 // CVtUiAppUi::CEventObserver::HandleVtEventL |
|
6627 // ----------------------------------------------------------------------------- |
|
6628 // |
|
6629 void CVtUiAppUi::CEventObserver::HandleVtEventL( |
|
6630 TInt aEvent ) |
|
6631 { |
|
6632 __VTPRINTENTER( "VtUiComms.HandleVtEventL" ) |
|
6633 __VTPRINT2( DEBUG_GEN, "VtUi.HandleEvt=%d", aEvent ) |
|
6634 |
|
6635 /** Allow application state to handle event first. It may also deny further |
|
6636 * handling by indicating the event was handled */ |
|
6637 if ( iAppUi.iState && |
|
6638 iAppUi.iState->HandleVtEventL( aEvent ) |
|
6639 == TVtUiAppStateBase::EEventHandled ) |
|
6640 { |
|
6641 __VTPRINTEXITR( "VtUiComms.HandleVtEventL %d", 0 ) |
|
6642 return; |
|
6643 } |
|
6644 |
|
6645 TInt callBits = EVtUiRefreshStates; |
|
6646 |
|
6647 // New camera orientation |
|
6648 switch( aEvent ) |
|
6649 { |
|
6650 case KVtEngSourceChanged: |
|
6651 callBits |= EVtUiSetOrientation; |
|
6652 break; |
|
6653 default: |
|
6654 break; |
|
6655 } |
|
6656 |
|
6657 switch( aEvent ) |
|
6658 { |
|
6659 case KVtEngSourceChanged: |
|
6660 callBits |= EVtUiStopWBOrColortone; |
|
6661 break; |
|
6662 default: |
|
6663 break; |
|
6664 } |
|
6665 |
|
6666 switch( aEvent ) |
|
6667 { |
|
6668 case KVtEngSessionWaitingCallActive: |
|
6669 case KVtEngSessionWaitingCallInactive: |
|
6670 iAppUi.HandleWaitingStateChange( |
|
6671 aEvent == KVtEngSessionWaitingCallActive ); |
|
6672 break; |
|
6673 default: |
|
6674 break; |
|
6675 } |
|
6676 switch( aEvent ) |
|
6677 { |
|
6678 case KVtEngShareImageInitializeBegin: |
|
6679 callBits |= EVtUiShowImageInitializingProgress; |
|
6680 break; |
|
6681 |
|
6682 case KVtEngShareImageInitializeEnd: |
|
6683 callBits |= EVtUiHideImageInitializingProgress; |
|
6684 break; |
|
6685 |
|
6686 case KVtEngShareImageDecodingError: |
|
6687 callBits |= EVtUiShowDecodingError; |
|
6688 break; |
|
6689 |
|
6690 default: |
|
6691 break; |
|
6692 } |
|
6693 |
|
6694 // Handle rendering problems. |
|
6695 switch ( aEvent ) |
|
6696 { |
|
6697 case KVtEngRemoteRenderingProblem: |
|
6698 callBits |= EVtUiHandleVideoFrameRemoteProblem; |
|
6699 break; |
|
6700 |
|
6701 case KVtEngViewFinderStopped: |
|
6702 case KVtEngLocalRenderingProblem: |
|
6703 callBits |= EVtUiHandleVideoFrameLocalProblem; |
|
6704 break; |
|
6705 |
|
6706 default: |
|
6707 break; |
|
6708 } |
|
6709 |
|
6710 // Refresh navipane. |
|
6711 switch ( aEvent ) |
|
6712 { |
|
6713 case KVtEngSourceChanged: |
|
6714 case KVtEngCameraChanged: |
|
6715 case KVtEngSessionStateChanged: |
|
6716 case KVtEngDurationSettingChanged: |
|
6717 case KVtEngAudioOutputVolumeChanged: |
|
6718 case KVtEngAudioRoutingChanged: |
|
6719 case KVtEngAudioMuted: |
|
6720 case KVtEngAudioUnmuted: |
|
6721 callBits |= EVtUiRefreshNaviPane; |
|
6722 break; |
|
6723 |
|
6724 default: |
|
6725 break; |
|
6726 } |
|
6727 |
|
6728 // Refresh softkeys. |
|
6729 switch ( aEvent ) |
|
6730 { |
|
6731 case KVtEngSourceChanged: |
|
6732 case KVtEngSourceCapsChanged: |
|
6733 case KVtEngSessionAnswerPossible: |
|
6734 case KVtEngSessionStateChanged: |
|
6735 case KVtEngAudioRoutingChanged: |
|
6736 case KVtEngAudioRoutingAvailabilityChanged: |
|
6737 case KVtEngAudioMuted: |
|
6738 case KVtEngAudioUnmuted: |
|
6739 case KVtEngLCHProviderSwitchDone: |
|
6740 callBits |= EVtUiRefreshSoftkeys; |
|
6741 break; |
|
6742 |
|
6743 default: |
|
6744 break; |
|
6745 } |
|
6746 |
|
6747 // Refresh blind status |
|
6748 switch ( aEvent ) |
|
6749 { |
|
6750 case KVtEngSourceChanged: |
|
6751 case KVtEngRemoteVideoPaused: |
|
6752 case KVtEngRemoteVideoResumed: |
|
6753 case KVtEngRemoteVideoStarted: |
|
6754 case KVtEngRemoteVideoStopped: |
|
6755 case KVtEngLCHProviderSwitchDone: |
|
6756 callBits |= EVtUiRefreshBlind; |
|
6757 break; |
|
6758 |
|
6759 default: |
|
6760 break; |
|
6761 } |
|
6762 |
|
6763 // Check if it's required to stop "waiting image" display. |
|
6764 switch ( aEvent ) |
|
6765 { |
|
6766 case KVtEngRemoteVideoResumed: |
|
6767 case KVtEngRemoteVideoStarted: |
|
6768 callBits |= EVtUiStopWaitingImage; |
|
6769 break; |
|
6770 |
|
6771 default: |
|
6772 break; |
|
6773 } |
|
6774 |
|
6775 // Check if it is needed to set a new layout for remote renderer. |
|
6776 switch ( aEvent ) |
|
6777 { |
|
6778 case KVtEngResolutionToQCIF: |
|
6779 callBits |= EVtUiChangeRemoteVideoLayout; |
|
6780 iAppUi.RemoteVideoIsSQCif( EFalse ); |
|
6781 break; |
|
6782 case KVtEngResolutionToSQCIF: |
|
6783 callBits |= EVtUiChangeRemoteVideoLayout; |
|
6784 iAppUi.RemoteVideoIsSQCif( ETrue ); |
|
6785 break; |
|
6786 default: |
|
6787 break; |
|
6788 } |
|
6789 |
|
6790 switch ( aEvent ) |
|
6791 { |
|
6792 case KVtEngAudioRoutingChanged: |
|
6793 case KVtEngAudioRoutingAvailabilityChanged: |
|
6794 case KVtEngMediaOutgoingVideoChannelStatusChanged: |
|
6795 case KVtEngMediaOutgoingAudioChannelStatusChanged: |
|
6796 callBits |= EVtUiMediaStateChanged; |
|
6797 break; |
|
6798 |
|
6799 case KVtEngAudioVolumeMin: |
|
6800 iAppUi.KeySounds()->PlaySound( EAvkonSIDVolumeMinTone ); |
|
6801 break; |
|
6802 |
|
6803 case KVtEngAudioVolumeMax: |
|
6804 iAppUi.KeySounds()->PlaySound( EAvkonSIDVolumeMaxTone ); |
|
6805 break; |
|
6806 |
|
6807 default: |
|
6808 break; |
|
6809 } |
|
6810 |
|
6811 // Refresh Menu. |
|
6812 switch ( aEvent ) |
|
6813 { |
|
6814 case KVtEngSourceChanged: |
|
6815 callBits |= EVtUiRefreshMenu; |
|
6816 callBits |= EVtUiStopBrightnessOrContrast; |
|
6817 callBits |= EVtUiRefreshZoomPopup; |
|
6818 break; |
|
6819 default: |
|
6820 break; |
|
6821 } |
|
6822 |
|
6823 TRAP_IGNORE ( DoExecuteL( callBits ) ); |
|
6824 __VTPRINTEXITR( "VtUiComms.HandleVtEventL %d", 1 ) |
|
6825 } |
|
6826 |
|
6827 // ----------------------------------------------------------------------------- |
|
6828 // CVtUiAppUi::CEventObserver::HandleVTCommandPerformedL |
|
6829 // ----------------------------------------------------------------------------- |
|
6830 // |
|
6831 void CVtUiAppUi::CEventObserver::HandleVTCommandPerformedL( |
|
6832 TVtEngCommandId aCommand, |
|
6833 const TInt aError ) |
|
6834 { |
|
6835 __VTPRINTENTER( "VtUiComms.HandleVTCommandPerformedL" ) |
|
6836 |
|
6837 if ( iAppUi.iState && |
|
6838 iAppUi.iState->HandleVTCommandPerformedL( aCommand, aError ) == |
|
6839 TVtUiAppStateBase::EEventHandled ) |
|
6840 { |
|
6841 // state didn't allow further processing of command completion |
|
6842 __VTPRINTEXITR( "VtUiComms.HandleVTCommandPerformedL %d", 0 ) |
|
6843 return; |
|
6844 } |
|
6845 iAppUi.RefreshStatesL(); |
|
6846 |
|
6847 if ( aCommand == KVtEngMuteOutgoingAudio || |
|
6848 aCommand == KVtEngUnmuteOutgoingAudio ) |
|
6849 { |
|
6850 iAppUi.RefreshL(); |
|
6851 } |
|
6852 |
|
6853 const TInt count = iCommandObservers.Count(); |
|
6854 TInt nullPosition = KErrNotFound; |
|
6855 |
|
6856 iInCommandPerformed = ETrue; |
|
6857 |
|
6858 // iInCommandPerformed equals ETrue while inside the following loop; |
|
6859 // Exceptions must not be raised. |
|
6860 for ( TInt index = 0; index < count; index++ ) |
|
6861 { |
|
6862 MVtEngCommandObserver* obs = iCommandObservers[ index ]; |
|
6863 if ( obs ) |
|
6864 { |
|
6865 TRAP_IGNORE( obs->HandleVTCommandPerformedL( aCommand, aError ) ); |
|
6866 } |
|
6867 else |
|
6868 { |
|
6869 // We store only one position; eventually all NULL elements of the |
|
6870 // array will be removed. |
|
6871 nullPosition = index; |
|
6872 } |
|
6873 } |
|
6874 iInCommandPerformed = EFalse; |
|
6875 |
|
6876 if ( nullPosition != KErrNotFound ) |
|
6877 { |
|
6878 iCommandObservers.Remove( nullPosition ); |
|
6879 } |
|
6880 |
|
6881 // Specific handling of some commands: |
|
6882 if ( aCommand == KVtEngResetEngine ) // Engine has been reset |
|
6883 { |
|
6884 __ASSERT_ALWAYS( !aError, VtUiPanic::Panic( EVtUiPanicResetFailed ) ); |
|
6885 iAppUi.HandleEngineResetL(); |
|
6886 } |
|
6887 else if ( ( aCommand == KVtEngInitializeShareImage ) || |
|
6888 ( aCommand == KVtEngStartShareImage ) ) |
|
6889 { |
|
6890 __VTPRINT3( DEBUG_GEN, |
|
6891 "VtUi.HandleVTCommandPerformedL cmd=%d err=%d", aCommand, aError ); |
|
6892 if( aError != KErrNone ) |
|
6893 { |
|
6894 // stop toolbar feature to prevent drawing over error dialog |
|
6895 MVtUiFeature* tb = iAppUi.iFeatureManager-> |
|
6896 GetFeatureById( EVtUiFeatureIdToolbar ); |
|
6897 if ( tb ) |
|
6898 { |
|
6899 tb->Stop(); |
|
6900 } |
|
6901 iAppUi.iAsyncCallback->Set( |
|
6902 TCallBack( &AsyncShowErrorAndRestartShare, &iAppUi ) ); |
|
6903 iAppUi.iAsyncCallback->CallBack(); |
|
6904 } |
|
6905 else if( aCommand == KVtEngInitializeShareImage ) |
|
6906 { |
|
6907 if ( iAppUi.iUiStates->IsViewFinderToMainPane() ) |
|
6908 { |
|
6909 iAppUi.iAsyncCallback->Set( |
|
6910 TCallBack( &AsyncViewFinderToMainPaneAndShare, &iAppUi ) ); |
|
6911 } |
|
6912 else |
|
6913 { |
|
6914 iAppUi.iAsyncCallback->Set( |
|
6915 TCallBack( &AsyncShare, &iAppUi ) ); |
|
6916 } |
|
6917 iAppUi.iAsyncCallback->CallBack(); |
|
6918 } |
|
6919 } |
|
6920 else if ( iAppUi.iUiStates->IsLayoutChangeNeeded() && |
|
6921 ( aCommand == KVtEngMuteOutgoingAudio || |
|
6922 aCommand == KVtEngUnmuteOutgoingAudio || |
|
6923 aCommand == KVtEngSetAudioRouting || |
|
6924 aCommand == KVtEngSetAudioVolume || |
|
6925 aCommand == KVtEngSetSource || |
|
6926 aCommand == KVtEngPrepareCamera || |
|
6927 aCommand == KVtEngUnfreeze ) ) |
|
6928 { |
|
6929 iAppUi.iUiStates->SetLayoutChangeNeeded( EFalse ); |
|
6930 iAppUi.DoHandleLayoutChangedL(); |
|
6931 } |
|
6932 __VTPRINTEXITR( "VtUiComms.HandleVTCommandPerformedL %d", 1 ) |
|
6933 } |
|
6934 |
|
6935 // ----------------------------------------------------------------------------- |
|
6936 // CVtUiAppUi::CEventObserver::vtHandleFrameL |
|
6937 // ----------------------------------------------------------------------------- |
|
6938 // |
|
6939 void CVtUiAppUi::CEventObserver::vtHandleFrameL( |
|
6940 TFrameType aType, |
|
6941 CFbsBitmap* aBitmap ) |
|
6942 { |
|
6943 static TUint32 lastTick = 0; |
|
6944 static TBool flag = EFalse; |
|
6945 |
|
6946 |
|
6947 CEikMenuBar* menuBar = (STATIC_CAST(CEikonEnv*, this->iAppUi.iCoeEnv))->AppUiFactory()->MenuBar(); |
|
6948 if ( menuBar && menuBar->IsDisplayed() ) |
|
6949 { |
|
6950 if ( !flag ) |
|
6951 { |
|
6952 flag = ETrue; |
|
6953 lastTick = User::NTickCount(); |
|
6954 } |
|
6955 else |
|
6956 { |
|
6957 TUint32 newTick = User::NTickCount(); |
|
6958 |
|
6959 //don't consider time wrap |
|
6960 //one frame per 200ms |
|
6961 if ( newTick - lastTick < 400 ) |
|
6962 { |
|
6963 __VTPRINTEXITR( "CVtUiAppUi::CEventObserver::vtSetFrame %d", 0 ) |
|
6964 return; |
|
6965 } |
|
6966 else |
|
6967 { |
|
6968 lastTick = newTick; |
|
6969 } |
|
6970 } |
|
6971 } |
|
6972 else |
|
6973 { |
|
6974 flag = EFalse; |
|
6975 } |
|
6976 |
|
6977 TBool local = EFalse; |
|
6978 switch ( aType ) |
|
6979 { |
|
6980 case ELocalVideoFrame: |
|
6981 local = ETrue; |
|
6982 break; |
|
6983 |
|
6984 case ERemoteVideoFrame: |
|
6985 default: |
|
6986 break; |
|
6987 } |
|
6988 |
|
6989 iAppUi.HandleVideoFrameL( local, aBitmap ); |
|
6990 } |
|
6991 |
|
6992 // ----------------------------------------------------------------------------- |
|
6993 // CVtUiAppUi::CEventObserver::vtSetFrame |
|
6994 // ----------------------------------------------------------------------------- |
|
6995 // |
|
6996 void CVtUiAppUi::CEventObserver::vtSetFrame( |
|
6997 TFrameType aType, |
|
6998 CFbsBitmap* aBitmap ) |
|
6999 { |
|
7000 TBool local = EFalse; |
|
7001 switch ( aType ) |
|
7002 { |
|
7003 case ELocalVideoFrame: |
|
7004 local = ETrue; |
|
7005 break; |
|
7006 |
|
7007 case ERemoteVideoFrame: |
|
7008 default: |
|
7009 break; |
|
7010 } |
|
7011 |
|
7012 iAppUi.SetVideoFrame( local, aBitmap ); |
|
7013 } |
|
7014 |
|
7015 // ----------------------------------------------------------------------------- |
|
7016 // CVtUiAppUi::CEventObserver::Beat |
|
7017 // ----------------------------------------------------------------------------- |
|
7018 // |
|
7019 void CVtUiAppUi::CEventObserver::Beat() |
|
7020 { |
|
7021 iAppUi.HandleBeat(); |
|
7022 } |
|
7023 |
|
7024 // ----------------------------------------------------------------------------- |
|
7025 // CVtUiAppUi::CEventObserver::Synchronize |
|
7026 // ----------------------------------------------------------------------------- |
|
7027 // |
|
7028 void CVtUiAppUi::CEventObserver::Synchronize() |
|
7029 { |
|
7030 iAppUi.HandleBeat(); |
|
7031 } |
|
7032 |
|
7033 // ----------------------------------------------------------------------------- |
|
7034 // CVtUiAppUi::CEventObserver::DoExecuteL |
|
7035 // ----------------------------------------------------------------------------- |
|
7036 // |
|
7037 void CVtUiAppUi::CEventObserver::DoExecuteL( TInt aBits ) |
|
7038 { |
|
7039 __VTPRINT2( DEBUG_GEN, "VtUi.DoExec.bits=%d", aBits ) |
|
7040 |
|
7041 // Array of methods - leaving methods are allowed. |
|
7042 const TMethodL methodArray[] = |
|
7043 { |
|
7044 &CVtUiAppUi::RefreshStatesL, |
|
7045 &CVtUiAppUi::HandleVideoFrameRemoteProblemL, |
|
7046 &CVtUiAppUi::HandleVideoFrameLocalProblemL, |
|
7047 &CVtUiAppUi::RefreshNaviPaneL, |
|
7048 &CVtUiAppUi::RefreshSoftkeysL, |
|
7049 &CVtUiAppUi::RefreshBlind, |
|
7050 &CVtUiAppUi::StopWaitingImage, |
|
7051 &CVtUiAppUi::ChangeRemoteVideoLayoutL, |
|
7052 &CVtUiAppUi::ShowImageInitializeProgressL, |
|
7053 &CVtUiAppUi::HideImageInitializeProgressL, |
|
7054 &CVtUiAppUi::SetCameraOrientationL, |
|
7055 &CVtUiAppUi::MediaStateChangedL, |
|
7056 &CVtUiAppUi::ShowImageDecodingErrorNoteL, |
|
7057 &CVtUiAppUi::StopWhiteBalanceOrColortone, |
|
7058 &CVtUiAppUi::RefreshMenuL, |
|
7059 &CVtUiAppUi::StopBrightnessOrContrast, |
|
7060 &CVtUiAppUi::RefreshZoomPopupL |
|
7061 }; |
|
7062 const TInt count = ( sizeof( methodArray ) / sizeof ( TMethodL ) ); |
|
7063 |
|
7064 // Execute selected methods. |
|
7065 while ( aBits ) |
|
7066 { |
|
7067 for ( TInt index = 0; ( index < count ) && aBits; index++ ) |
|
7068 { |
|
7069 const TInt mask = ( 1 << index ); |
|
7070 if ( aBits & mask ) |
|
7071 { |
|
7072 // Bit is set if corresponding method |
|
7073 // is wanted to be executed. |
|
7074 |
|
7075 aBits &= ~mask; |
|
7076 TMethodL method = methodArray[ index ]; |
|
7077 ( iAppUi.*method )(); // may leave |
|
7078 } |
|
7079 } |
|
7080 aBits = 0; // for loop executed successfully. |
|
7081 } |
|
7082 } |
|
7083 |
|
7084 // ----------------------------------------------------------------------------- |
|
7085 // CVtUiAppUi::CEventObserver::HandleVolumeChange |
|
7086 // ----------------------------------------------------------------------------- |
|
7087 // |
|
7088 void CVtUiAppUi::CEventObserver::HandleVolumeChange( |
|
7089 TRemConCoreApiButtonAction aButtonAct ) |
|
7090 { |
|
7091 __VTPRINTENTER( "VtUi.HandleVolumeChange" ) |
|
7092 // Order of the events is as follows: |
|
7093 // Click - Immediately when key is pressed down |
|
7094 // Press - After 0.6 seconds |
|
7095 // Release - When key is released after 0.6 seconds |
|
7096 // |
|
7097 // Thus, the following sequences are possible from single keypress: |
|
7098 // <Click> |
|
7099 // <Click> <0.6 sec pause> <Press> <indefinite pause> <Release> |
|
7100 |
|
7101 switch ( aButtonAct ) |
|
7102 { |
|
7103 case ERemConCoreApiButtonPress: |
|
7104 __VTPRINT( DEBUG_GEN, "VtUi.HandleVolumeChange.ButtonPress" ) |
|
7105 TRAP_IGNORE( iAppUi.AdjustVolumeL( iRCCAOperationId ) ); |
|
7106 TRAP_IGNORE( iAppUi.RefreshVolumeL() ); |
|
7107 TRAP_IGNORE( iAppUi.iInstance->VolumeKeyPressedL() ); |
|
7108 |
|
7109 iRemConVolumeRepeatTimer->Start( |
|
7110 KVtUiVolumeRepeatLongDelay, |
|
7111 KVtUiVolumeRepeatDelay, |
|
7112 TCallBack( DoHandleVolumeRepeat, this ) ); |
|
7113 |
|
7114 break; |
|
7115 |
|
7116 case ERemConCoreApiButtonRelease: |
|
7117 __VTPRINT( DEBUG_GEN, "VtUi.HandleVolumeChange.ButtonRelease" ) |
|
7118 iRCCAOperationId = ENop; |
|
7119 TRAP_IGNORE( iAppUi.iInstance->VolumeKeyPressedL() ); |
|
7120 break; |
|
7121 |
|
7122 case ERemConCoreApiButtonClick: |
|
7123 __VTPRINT( DEBUG_GEN, "VtUi.HandleVolumeChange.ButtonClick" ) |
|
7124 TRAP_IGNORE( iAppUi.AdjustVolumeL( iRCCAOperationId ) ); |
|
7125 TRAP_IGNORE( iAppUi.RefreshVolumeL() ); |
|
7126 TRAP_IGNORE( iAppUi.iInstance->VolumeKeyPressedL() ); |
|
7127 break; |
|
7128 |
|
7129 default: |
|
7130 break; |
|
7131 } |
|
7132 __VTPRINTEXIT( "VtUi.HandleVolumeChange" ) |
|
7133 } |
|
7134 |
|
7135 // ----------------------------------------------------------------------------- |
|
7136 // CVtUiAppUi::CEventObserver::HandleRemMuteChange |
|
7137 // ----------------------------------------------------------------------------- |
|
7138 // |
|
7139 void CVtUiAppUi::CEventObserver::HandleRemMuteChange( |
|
7140 TRemConCoreApiButtonAction aButtonAct ) |
|
7141 { |
|
7142 __VTPRINTENTER( "VtUi.EventObserver.HandleRemMuteChange" ) |
|
7143 TBool AudioEn (EFalse ); |
|
7144 AudioEn = iAppUi.iUiStates->AudioState().IsAudio(); |
|
7145 if( AudioEn ) |
|
7146 iAppUi.HandleCommandL( EVtUiCmdDisableAudio ); |
|
7147 else |
|
7148 iAppUi.HandleCommandL( EVtUiCmdEnableAudio ); |
|
7149 __VTPRINTEXIT( "VtUi.EventObserver.HandleRemMuteChange" ) |
|
7150 } |
|
7151 // ----------------------------------------------------------------------------- |
|
7152 // CVtUiAppUi::CEventObserver::DoHandleVolumeRepeat |
|
7153 // ----------------------------------------------------------------------------- |
|
7154 // |
|
7155 TInt CVtUiAppUi::CEventObserver::DoHandleVolumeRepeat( TAny* aAny ) |
|
7156 { |
|
7157 __VTPRINTENTER( "VtUi.SvkRpt" ) |
|
7158 CEventObserver* self = reinterpret_cast< CEventObserver* >( aAny ); |
|
7159 TRAP_IGNORE( self->iAppUi.AdjustVolumeL( self->iRCCAOperationId ) ); |
|
7160 TRAP_IGNORE( self->iAppUi.RefreshVolumeL() ); |
|
7161 __VTPRINTEXIT( "VtUi.SvkRpt" ) |
|
7162 return KErrNone; |
|
7163 } |
|
7164 |
|
7165 // ----------------------------------------------------------------------------- |
|
7166 // CVtUiAppUi::RefreshVolumeL |
|
7167 // ----------------------------------------------------------------------------- |
|
7168 // |
|
7169 void CVtUiAppUi::RefreshVolumeL() |
|
7170 { |
|
7171 __VTPRINTENTER( "VtUi.RefreshVolumeL" ) |
|
7172 // Refresh volume |
|
7173 CVtUiVolume* volume = static_cast< CVtUiVolume* >( |
|
7174 iFeatureManager->GetFeatureById( EVtUiFeatureIdVolume ) ); |
|
7175 if ( volume ) |
|
7176 { |
|
7177 volume->RefreshL(); |
|
7178 } |
|
7179 __VTPRINTEXIT( "VtUi.RefreshVolumeL" ) |
|
7180 } |
|
7181 |
|
7182 // ----------------------------------------------------------------------------- |
|
7183 // CVtUiAppUi::AdjustVolumeL |
|
7184 // ----------------------------------------------------------------------------- |
|
7185 // |
|
7186 void CVtUiAppUi::AdjustVolumeL( TRemConCoreApiOperationId aOperationId ) |
|
7187 { |
|
7188 __VTPRINTENTER( "VtUi.AdjustVolumeL" ) |
|
7189 __VTPRINT2( DEBUG_GEN, |
|
7190 "VtUi.AdjustVolumeL aOperationId = %d", aOperationId ) |
|
7191 TInt command( KVtEngCommandNone ); |
|
7192 switch ( aOperationId ) |
|
7193 { |
|
7194 case ERemConCoreApiVolumeDown: |
|
7195 command = KVtEngDecreaseAudioVolume; |
|
7196 break; |
|
7197 |
|
7198 case ERemConCoreApiVolumeUp: |
|
7199 command = KVtEngIncreaseAudioVolume; |
|
7200 break; |
|
7201 |
|
7202 default: |
|
7203 break; |
|
7204 } |
|
7205 |
|
7206 if ( command != KVtEngCommandNone ) |
|
7207 { |
|
7208 ExecuteCmdL( command ); |
|
7209 } |
|
7210 __VTPRINTEXIT( "VtUi.AdjustVolumeL" ) |
|
7211 } |
|
7212 |
|
7213 // ----------------------------------------------------------------------------- |
|
7214 // CVtUiAppUi::CEventObserver::MrccatoCommand |
|
7215 // ----------------------------------------------------------------------------- |
|
7216 // |
|
7217 void CVtUiAppUi::CEventObserver::MrccatoCommand( |
|
7218 TRemConCoreApiOperationId aOperationId, |
|
7219 TRemConCoreApiButtonAction aButtonAct ) |
|
7220 { |
|
7221 __VTPRINTENTER( "VtUi.MrccatoCommand" ) |
|
7222 // Side volume keys will also dismiss zoom mode if zoom mode is active |
|
7223 if ( iAppUi.iUiStates->IsZoomModeOn() ) |
|
7224 { |
|
7225 __VTPRINT( DEBUG_GEN, "VtUi.MrccatoCommand1" ) |
|
7226 TRAP_IGNORE( iAppUi.SetZoomModeL( EFalse )); |
|
7227 } |
|
7228 |
|
7229 iRemConVolumeRepeatTimer->Cancel(); |
|
7230 iRCCAOperationId = aOperationId; |
|
7231 switch ( aOperationId ) |
|
7232 { |
|
7233 case ERemConCoreApiVolumeUp: |
|
7234 // if volume in maximum value and volume up is pressed |
|
7235 // volume indicator must still be shown for a while if |
|
7236 // muted or call duration is shown in navipane |
|
7237 __VTPRINT( DEBUG_GEN, "VtUi.MrccatoCommand ERemConCoreApiVolumeUp" ) |
|
7238 HandleVolumeChange( aButtonAct ); |
|
7239 break; |
|
7240 |
|
7241 case ERemConCoreApiVolumeDown: |
|
7242 // if volume in minimun value and volume down is pressed |
|
7243 // volume indicator must still be shown for a while if |
|
7244 // muted or call duration is shown in navipane |
|
7245 __VTPRINT( DEBUG_GEN, "VtUi.MrccatoCommand ERemConCoreApiVolumeDown" ) |
|
7246 HandleVolumeChange( aButtonAct ); |
|
7247 break; |
|
7248 case ERemConCoreApiMute: |
|
7249 __VTPRINT( DEBUG_GEN, "VtUi.MrccatoCommand ERemConCoreApiMute" ) |
|
7250 HandleRemMuteChange( aButtonAct ); |
|
7251 default: |
|
7252 // Other commands ignored. |
|
7253 break; |
|
7254 } |
|
7255 __VTPRINTEXIT( "VtUi.MrccatoCommand" ) |
|
7256 } |
|
7257 |
|
7258 // Implementation of CVtUiAppUi::CVtUiAppUiMGVerifier |
|
7259 |
|
7260 // ----------------------------------------------------------------------------- |
|
7261 // CVtUiAppUi::CVtUiAppUiMGVerifier::NewLC |
|
7262 // ----------------------------------------------------------------------------- |
|
7263 // |
|
7264 CVtUiAppUi::CVtUiAppUiMGVerifier* CVtUiAppUi::CVtUiAppUiMGVerifier::NewLC( |
|
7265 CVtUiAppUi& aAppUi, CCoeEnv& aCoeEnv ) |
|
7266 { |
|
7267 CVtUiAppUiMGVerifier* self = new ( ELeave ) |
|
7268 CVtUiAppUiMGVerifier( aAppUi, aCoeEnv ); |
|
7269 CleanupStack::PushL( self ); |
|
7270 self->ConstructL(); |
|
7271 return self; |
|
7272 } |
|
7273 |
|
7274 // ----------------------------------------------------------------------------- |
|
7275 // CVtUiAppUi::CVtUiAppUiMGVerifier::~CVtUiAppUiMGVerifier |
|
7276 // ----------------------------------------------------------------------------- |
|
7277 // |
|
7278 CVtUiAppUi::CVtUiAppUiMGVerifier::~CVtUiAppUiMGVerifier() |
|
7279 { |
|
7280 delete iManager; |
|
7281 } |
|
7282 |
|
7283 // ----------------------------------------------------------------------------- |
|
7284 // CVtUiAppUi::CVtUiAppUiMGVerifier::VerifySelectionL |
|
7285 // ----------------------------------------------------------------------------- |
|
7286 // |
|
7287 TBool CVtUiAppUi::CVtUiAppUiMGVerifier::VerifySelectionL( |
|
7288 const MDesCArray* aSelectedFiles ) |
|
7289 { |
|
7290 TBool isOk( EFalse ); |
|
7291 if ( aSelectedFiles->MdcaCount() > 0 ) |
|
7292 { |
|
7293 TVirtualPathPtr virtualPath( |
|
7294 aSelectedFiles->MdcaPoint( 0 ), KDefaultContentObject ); |
|
7295 |
|
7296 // not ptotected by default |
|
7297 TInt isProtected = 0; |
|
7298 |
|
7299 TInt err = iManager->GetAttribute( EIsProtected, |
|
7300 isProtected, virtualPath ); |
|
7301 if ( isProtected ) |
|
7302 { |
|
7303 iAppUi.ShowDRMNotAllowedNoteL(); |
|
7304 } |
|
7305 if ( err == KErrNone ) |
|
7306 { |
|
7307 isOk = !isProtected; |
|
7308 } |
|
7309 } |
|
7310 return isOk; |
|
7311 } |
|
7312 |
|
7313 // ----------------------------------------------------------------------------- |
|
7314 // CVtUiAppUi::CVtUiAppUiMGVerifier::ConstructL |
|
7315 // ----------------------------------------------------------------------------- |
|
7316 // |
|
7317 void CVtUiAppUi::CVtUiAppUiMGVerifier::ConstructL() |
|
7318 { |
|
7319 iManager = CManager::NewL(); |
|
7320 } |
|
7321 |
|
7322 // ----------------------------------------------------------------------------- |
|
7323 // CVtUiAppUi::CVtUiAppUiMGVerifier::CVtUiAppUiMGVerifier |
|
7324 // ----------------------------------------------------------------------------- |
|
7325 // |
|
7326 CVtUiAppUi::CVtUiAppUiMGVerifier::CVtUiAppUiMGVerifier( |
|
7327 CVtUiAppUi& aAppUi, CCoeEnv& aCoeEnv ) |
|
7328 : iAppUi( aAppUi ), iCoeEnv( &aCoeEnv ) |
|
7329 { |
|
7330 } |
|
7331 |
|
7332 // End of File |
|