|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 //USER |
|
19 #include "lcuiengine_p.h" |
|
20 #include "lcuidefs.h" |
|
21 #include "lclogger.h" |
|
22 #include "lcactivitymanager.h" |
|
23 |
|
24 //SYSTEM |
|
25 #include <w32std.h> |
|
26 #include <e32err.h> |
|
27 #include <bacline.h> |
|
28 #include <coecntrl.h> |
|
29 #include <apgtask.h> |
|
30 #include <eikenv.h> |
|
31 |
|
32 #include <QTimer> |
|
33 #include <QChar> |
|
34 #include <hbdialog.h> |
|
35 #include <hbaction.h> |
|
36 #include <hblabel.h> |
|
37 #include <hblineedit.h> |
|
38 #include <hbinstance.h> |
|
39 #include <xqserviceutil.h> |
|
40 #include <QApplication> |
|
41 #include <hbview.h> |
|
42 #include <hbmessagebox.h> |
|
43 #include <hbprogressdialog.h> |
|
44 |
|
45 #include <lcvideoplayer.h> |
|
46 #include <lcwindow.h> |
|
47 #include <lcaudiocontrol.h> |
|
48 #include <lcsession.h> |
|
49 #include <lczoomcontrol.h> |
|
50 #include <lccameracontrol.h> |
|
51 |
|
52 |
|
53 #define LC_VTPLUGIN_NAME "Videotelephony"; |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // LcUiEnginePrivate::LcUiEnginePrivate |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 LcUiEnginePrivate::LcUiEnginePrivate(LcUiEngine& uiEngine, |
|
60 const QString& engineName, |
|
61 const QString& applicationDisplayName) |
|
62 : mEngineName( engineName.toUtf8() ), |
|
63 mSessionTitle( applicationDisplayName ), |
|
64 mViewLayout( Lc_IdleViewLayout ), |
|
65 mLiveCommsEngine( 0 ), |
|
66 mCloseTimer(0), |
|
67 mInvitingNote(0), |
|
68 mWaitingNote(0), |
|
69 mAcceptQuery(0), |
|
70 mRecipientQuery(0), |
|
71 mShareOwnVideoQuery(0), |
|
72 mBlocked(false), |
|
73 mFullScreen(false), |
|
74 mSessionDurationTimerId(0), |
|
75 mMainCamera(true), |
|
76 mUiEngine( uiEngine ), |
|
77 mIsMinimized(false), |
|
78 mFirstForegroundSwitch(true), |
|
79 mViewReadySimulationTimerId(0), |
|
80 mCurrentView(0), |
|
81 mActivityManager(0) |
|
82 { |
|
83 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::LcUiEnginePrivate()" ) |
|
84 |
|
85 mPendingAction.clear(); |
|
86 |
|
87 TPtrC8 name( reinterpret_cast< const TUint8* >( mEngineName.constData() ) ); |
|
88 // TODO: |
|
89 // Replace the TRAPs with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
90 TRAPD( err, mLiveCommsEngine = CLcEngine::NewL( name ) ); |
|
91 if ( err != KErrNone ) { |
|
92 // Cannot proceed with the execution, exit the application |
|
93 LC_QDEBUG_2( "livecomms [UI] <- LcUiEnginePrivate::LcUiEnginePrivate(), failed:", err ) |
|
94 qApp->exit(err); |
|
95 return; |
|
96 } |
|
97 |
|
98 mLiveCommsEngine->Session().SetLcSessionObserver( this ); |
|
99 mLiveCommsEngine->Session().SetLcUiProvider( this ); |
|
100 |
|
101 fillRemoteInfo( false ); |
|
102 |
|
103 if ( usingVideoTelephoneEngine() ) { |
|
104 mViewLayout = Lc_AllInOneViewLayout; |
|
105 } |
|
106 |
|
107 LC_QDEBUG( "livecomms [UI] Setting window for plug-in" ) |
|
108 CCoeControl* coeControl = |
|
109 reinterpret_cast<CCoeControl*>( |
|
110 HbInstance::instance()->allMainWindows().at(0)->winId()); |
|
111 if ( coeControl ) { |
|
112 TInt windowPtr = reinterpret_cast<TInt>(coeControl->DrawableWindow()); |
|
113 // Return value ignored as plugin may not be interested about window |
|
114 mLiveCommsEngine->Session().SetParameter(0,windowPtr); |
|
115 } |
|
116 |
|
117 mActivityManager = new LcActivityManager; |
|
118 |
|
119 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::LcUiEnginePrivate()" ) |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // LcUiEnginePrivate::~LcUiEnginePrivate |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 LcUiEnginePrivate::~LcUiEnginePrivate() |
|
127 { |
|
128 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::~LcUiEnginePrivate()" ) |
|
129 delete mLiveCommsEngine; |
|
130 delete mCloseTimer; |
|
131 delete mActivityManager; |
|
132 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::~LcUiEnginePrivate()" ) |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // LcUiEnginePrivate::zoom |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 void LcUiEnginePrivate::zoom( int value ) |
|
140 { |
|
141 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::zoom()" ) |
|
142 |
|
143 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
144 MLcZoomControl* zoom = zoomControl(); |
|
145 if ( zoom ) { |
|
146 TRAP_IGNORE( zoom->SetLcZoomValueL( value ) ); |
|
147 } |
|
148 |
|
149 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::zoom()" ) |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // LcUiEnginePrivate::stop |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 void LcUiEnginePrivate::stop() |
|
157 { |
|
158 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::stop()" ) |
|
159 |
|
160 mActivityManager->enableActivitySimulation(false); |
|
161 |
|
162 stopSessionDurationTimer(); |
|
163 cancelCloseTimer(); |
|
164 hideNotes( true ); |
|
165 |
|
166 // Start guard timer already before terminate call just in case |
|
167 // something goes horribly wrong in termination |
|
168 startStopGuardTimer(); |
|
169 |
|
170 int err = terminateSession(); |
|
171 |
|
172 if ( !err && session().LcSessionState() == MLcSession::EClosing ) { |
|
173 LC_QDEBUG( "livecomms [UI] not closing UI yet, waiting for session termination..." ) |
|
174 } else { |
|
175 LC_QDEBUG( "livecomms [UI] closing UI..." ) |
|
176 emit mUiEngine.stopped(); |
|
177 } |
|
178 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::stop()" ) |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // LcUiEnginePrivate::start |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 void LcUiEnginePrivate::start() |
|
186 { |
|
187 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::start()" ) |
|
188 |
|
189 mActivityManager->enableActivitySimulation(true); |
|
190 |
|
191 if ( session().LcSessionState() != MLcSession::EReceived ) { |
|
192 startLiveContent(); |
|
193 } else { |
|
194 //wait callback |
|
195 LC_QDEBUG( "livecomms [UI] MT start waiting callback" ) |
|
196 } |
|
197 |
|
198 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::start()" ) |
|
199 } |
|
200 |
|
201 // ----------------------------------------------------------------------------- |
|
202 // LcUiEnginePrivate::sessionTitle |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 const QString& LcUiEnginePrivate::sessionTitle() const |
|
206 { |
|
207 return mSessionTitle; |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // LcUiEnginePrivate::recipient |
|
212 // ----------------------------------------------------------------------------- |
|
213 // |
|
214 const QString& LcUiEnginePrivate::recipient() const |
|
215 { |
|
216 return ( mRecipient.isEmpty() ) ? mPhoneNumber : mRecipient; |
|
217 } |
|
218 |
|
219 // ----------------------------------------------------------------------------- |
|
220 // LcUiEnginePrivate::phoneNumber |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 const QString& LcUiEnginePrivate::phoneNumber() const |
|
224 { |
|
225 return mPhoneNumber; |
|
226 } |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // LcUiEnginePrivate::viewLayout |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 LcViewLayoutHint LcUiEnginePrivate::viewLayout() const |
|
233 { |
|
234 return mViewLayout; |
|
235 } |
|
236 |
|
237 // ----------------------------------------------------------------------------- |
|
238 // LcUiEnginePrivate::setContentAreas |
|
239 // ----------------------------------------------------------------------------- |
|
240 // |
|
241 void LcUiEnginePrivate::setContentAreas( const QRectF& sharedContent, |
|
242 const QRectF& receivedContent ) |
|
243 { |
|
244 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::setContentAreas()" ) |
|
245 LC_QDEBUG_2( "livecomms [UI] shared window: ", sharedContent ) |
|
246 LC_QDEBUG_2( "livecomms [UI] received window: ", receivedContent ) |
|
247 |
|
248 mLocalRect = TRect(); |
|
249 mRemoteRect = TRect(); |
|
250 |
|
251 if ( sharedContent.height() != 0 ) { |
|
252 mLocalRect.SetRect( sharedContent.topLeft().x(), |
|
253 sharedContent.topLeft().y(), |
|
254 sharedContent.bottomRight().x(), |
|
255 sharedContent.bottomRight().y() ); |
|
256 } |
|
257 |
|
258 if ( receivedContent.height() != 0 ) { |
|
259 mRemoteRect.SetRect( receivedContent.topLeft().x(), |
|
260 receivedContent.topLeft().y(), |
|
261 receivedContent.bottomRight().x(), |
|
262 receivedContent.bottomRight().y() ); |
|
263 } |
|
264 |
|
265 setWindowRect( session().LocalVideoPlayer(), mLocalRect ); |
|
266 setWindowRect( session().RemoteVideoPlayer(), mRemoteRect ); |
|
267 |
|
268 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::setContentAreas()" ) |
|
269 } |
|
270 |
|
271 // ----------------------------------------------------------------------------- |
|
272 // LcUiEnginePrivate::setOrientation |
|
273 // ----------------------------------------------------------------------------- |
|
274 // |
|
275 bool LcUiEnginePrivate::setOrientation( Qt::Orientation orientation ) |
|
276 { |
|
277 bool ok( false ); |
|
278 TInt error1( KErrNone ); |
|
279 TInt error2( KErrNone ); |
|
280 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
281 MLcVideoPlayer* remotePlayer = session().RemoteVideoPlayer(); |
|
282 |
|
283 MLcWindow::TLcWindowOrientation newOrientation( MLcWindow::EPortrait ); |
|
284 if ( orientation == Qt::Horizontal ) { |
|
285 newOrientation = MLcWindow::ELandscape; |
|
286 } |
|
287 |
|
288 if ( localPlayer && localPlayer->LcWindow() ) { |
|
289 TRAP(error1, localPlayer->LcWindow()->SetLcWindowOrientationL( newOrientation ) ); |
|
290 } |
|
291 if ( remotePlayer && remotePlayer->LcWindow() ) { |
|
292 TRAP(error2, remotePlayer->LcWindow()->SetLcWindowOrientationL( newOrientation )); |
|
293 } |
|
294 |
|
295 if ( (error1 == KErrNone) && (error2 == KErrNone) ) { |
|
296 ok = true; |
|
297 } |
|
298 |
|
299 return ok; |
|
300 } |
|
301 |
|
302 // ----------------------------------------------------------------------------- |
|
303 // LcUiEnginePrivate::setUiComponents |
|
304 // ----------------------------------------------------------------------------- |
|
305 // |
|
306 void LcUiEnginePrivate::setUiComponents( |
|
307 HbProgressDialog* invitingNote, |
|
308 HbProgressDialog* waitingNote, |
|
309 HbDialog* acceptQuery, |
|
310 HbDialog* recipientQuery, |
|
311 HbDialog* shareOwnVideoQuery ) |
|
312 { |
|
313 mInvitingNote = invitingNote; |
|
314 mWaitingNote = waitingNote; |
|
315 mAcceptQuery = acceptQuery; |
|
316 mRecipientQuery = recipientQuery; |
|
317 mShareOwnVideoQuery = shareOwnVideoQuery; |
|
318 |
|
319 if (mAcceptQuery && (mAcceptQuery->actions().size() == 2)) { |
|
320 connect(mAcceptQuery->actions().at(0), SIGNAL(triggered()), |
|
321 this, SLOT(startReceiving()) ); |
|
322 connect(mAcceptQuery->actions().at(1), SIGNAL(triggered()), |
|
323 this, SLOT(stop()) ); |
|
324 } |
|
325 |
|
326 if (mInvitingNote && (mInvitingNote->actions().size() == 1)) { |
|
327 connect(mInvitingNote->actions().at(0), SIGNAL(triggered()), |
|
328 this, SLOT(stop()) ); |
|
329 } |
|
330 if (mWaitingNote && (mWaitingNote->actions().size() == 1)) { |
|
331 connect(mWaitingNote->actions().at(0), SIGNAL(triggered()), |
|
332 this, SLOT(stop()) ); |
|
333 } |
|
334 if(mShareOwnVideoQuery && (mShareOwnVideoQuery->actions().size() == 2)) { |
|
335 connect(mShareOwnVideoQuery->actions().at(0), SIGNAL(triggered()), |
|
336 this, SLOT(startLocalVideo()) ); |
|
337 connect(mShareOwnVideoQuery->actions().at(1), SIGNAL(triggered()), |
|
338 this, SLOT(stopLocalVideo()) ); |
|
339 |
|
340 } |
|
341 } |
|
342 |
|
343 // ----------------------------------------------------------------------------- |
|
344 // LcUiEnginePrivate::toggleMute |
|
345 // ----------------------------------------------------------------------------- |
|
346 // |
|
347 void LcUiEnginePrivate::toggleMute() |
|
348 { |
|
349 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::toggleMute()" ) |
|
350 |
|
351 bool mute( !isMuted() ); |
|
352 muteMic( mute ); |
|
353 |
|
354 // Muting / unmuting the microphone is an asynchronous operation. |
|
355 // Assuming here that the operation will eventually succeed. |
|
356 if ( mute ) { |
|
357 completeAction( lcEngSignalNameMuted ); |
|
358 } else { |
|
359 completeAction( lcEngSignalNameUnmuted ); |
|
360 } |
|
361 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::toggleMute()" ) |
|
362 } |
|
363 |
|
364 // ----------------------------------------------------------------------------- |
|
365 // LcUiEnginePrivate::isMuted |
|
366 // ----------------------------------------------------------------------------- |
|
367 // |
|
368 bool LcUiEnginePrivate::isMuted() const |
|
369 { |
|
370 bool micMuted( false ); |
|
371 MLcAudioControl* audio = audioControl(); |
|
372 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
373 if ( audio ) { |
|
374 TRAP_IGNORE( micMuted = audio->IsLcMicMutedL() ); |
|
375 } |
|
376 return micMuted; |
|
377 } |
|
378 |
|
379 // ----------------------------------------------------------------------------- |
|
380 // LcUiEnginePrivate::toggleSpeaker |
|
381 // ----------------------------------------------------------------------------- |
|
382 // |
|
383 void LcUiEnginePrivate::toggleSpeaker() |
|
384 { |
|
385 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::toggleSpeaker()" ) |
|
386 |
|
387 bool enable( !isSpeakerOn() ); |
|
388 enableSpeaker( enable ); |
|
389 |
|
390 // Enabling / disabling the speaker is an asynchronous operation. |
|
391 // Assuming here that the operation will eventually succeed. |
|
392 if ( enable ) { |
|
393 completeAction( lcEngSignalNameSpeakerEnabled ); |
|
394 } else { |
|
395 completeAction( lcEngSignalNameSpeakerDisabled ); |
|
396 } |
|
397 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::toggleSpeaker()" ) |
|
398 } |
|
399 |
|
400 // ----------------------------------------------------------------------------- |
|
401 // LcUiEnginePrivate::isSpeakerOn |
|
402 // ----------------------------------------------------------------------------- |
|
403 // |
|
404 bool LcUiEnginePrivate::isSpeakerOn() const |
|
405 { |
|
406 return audioControl()->IsLcLoudspeakerEnabled(); |
|
407 } |
|
408 |
|
409 // ----------------------------------------------------------------------------- |
|
410 // LcUiEnginePrivate::zoomValues |
|
411 // ----------------------------------------------------------------------------- |
|
412 // |
|
413 int LcUiEnginePrivate::zoomValues( LcControlValues& values ) const |
|
414 { |
|
415 int err( -1 ); |
|
416 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
417 MLcZoomControl* zoom = zoomControl(); |
|
418 if ( zoom ) { |
|
419 TRAP( err, |
|
420 values.mMaxValue = zoom->MaxLcZoomL(); |
|
421 values.mMinValue = zoom->MinLcZoomL(); |
|
422 values.mValue = zoom->LcZoomValueL(); ); |
|
423 } |
|
424 return err; |
|
425 } |
|
426 |
|
427 // ----------------------------------------------------------------------------- |
|
428 // LcUiEnginePrivate::toggleEnableCamera |
|
429 // ----------------------------------------------------------------------------- |
|
430 // |
|
431 void LcUiEnginePrivate::toggleDisableCamera() |
|
432 { |
|
433 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::toggleDisableCamera()" ) |
|
434 MLcVideoPlayer* player = visibleLocalPlayer(); |
|
435 if( player ) { |
|
436 pause( session().LocalVideoPlayer() ); |
|
437 completeAction( lcEngSignalNameCameraDisabled ); |
|
438 } else { |
|
439 play( session().LocalVideoPlayer() ); |
|
440 completeAction( lcEngSignalNameCameraEnabled ); |
|
441 } |
|
442 emitViewLayoutChanged(); |
|
443 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::toggleDisableCamera()" ) |
|
444 } |
|
445 |
|
446 // ----------------------------------------------------------------------------- |
|
447 // LcUiEnginePrivate::setCameraMain |
|
448 // ----------------------------------------------------------------------------- |
|
449 // |
|
450 void LcUiEnginePrivate::setMainCamera(const bool aMainCamera) |
|
451 { |
|
452 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::setCameraMain()", aMainCamera ) |
|
453 mMainCamera = aMainCamera; |
|
454 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::setCameraMain()" ) |
|
455 } |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // LcUiEnginePrivate::cameraIndex |
|
459 // ----------------------------------------------------------------------------- |
|
460 // |
|
461 bool LcUiEnginePrivate::mainCamera() const |
|
462 { |
|
463 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::mainCamera()" ) |
|
464 LC_QDEBUG_2( "livecomms [UI] <- LcUiEnginePrivate::mainCamera()", mMainCamera ) |
|
465 return mMainCamera; |
|
466 } |
|
467 |
|
468 // ----------------------------------------------------------------------------- |
|
469 // LcUiEnginePrivate::toggleCamera |
|
470 // ----------------------------------------------------------------------------- |
|
471 // |
|
472 void LcUiEnginePrivate::toggleCamera() |
|
473 { |
|
474 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::toggleCamera()" ) |
|
475 |
|
476 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
477 |
|
478 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
479 if ( localPlayer && localPlayer->LcCameraControl() ) { |
|
480 TRAP_IGNORE( localPlayer->LcCameraControl()->ToggleLcCameraL() ); |
|
481 } |
|
482 |
|
483 setMainCamera( !mMainCamera ); |
|
484 |
|
485 // Enabling / disabling the camera is an asynchronous operation. |
|
486 // Assuming here that the operation will eventually succeed. |
|
487 if ( mMainCamera ) { |
|
488 completeAction( lcEngSignalNameCameraChangedToMain ); |
|
489 } else { |
|
490 completeAction( lcEngSignalNameCameraChangedToSecondary ); |
|
491 } |
|
492 |
|
493 LC_QDEBUG_2( "livecomms [UI] <- LcUiEnginePrivate::toggleCamera(), mainCamera:", mMainCamera ) |
|
494 } |
|
495 |
|
496 // ----------------------------------------------------------------------------- |
|
497 // LcUiEnginePrivate::fullScreenMode |
|
498 // ----------------------------------------------------------------------------- |
|
499 // |
|
500 bool LcUiEnginePrivate::fullScreenMode() |
|
501 { |
|
502 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::fullScreenMode()" ) |
|
503 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::fullScreenMode()" ) |
|
504 return mFullScreen; |
|
505 } |
|
506 |
|
507 // ----------------------------------------------------------------------------- |
|
508 // LcUiEnginePrivate::setFullScreenMode |
|
509 // ----------------------------------------------------------------------------- |
|
510 // |
|
511 void LcUiEnginePrivate::setFullScreenMode(bool aMode) |
|
512 { |
|
513 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::setFullScreenMode()" ) |
|
514 mFullScreen = aMode; |
|
515 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::setFullScreenMode()" ) |
|
516 } |
|
517 |
|
518 |
|
519 // ----------------------------------------------------------------------------- |
|
520 // LcUiEnginePrivate::updateSession |
|
521 // ----------------------------------------------------------------------------- |
|
522 // |
|
523 void LcUiEnginePrivate::updateSession() |
|
524 { |
|
525 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::updateSession()" ) |
|
526 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
527 TRAP_IGNORE( session().UpdateLcSessionL() ); |
|
528 |
|
529 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::updateSession()" ) |
|
530 } |
|
531 |
|
532 // ----------------------------------------------------------------------------- |
|
533 // LcUiEnginePrivate::isLocalPlayerPlaying |
|
534 // ----------------------------------------------------------------------------- |
|
535 // |
|
536 bool LcUiEnginePrivate::isLocalPlayerPlaying() const |
|
537 { |
|
538 MLcVideoPlayer* player = session().LocalVideoPlayer(); |
|
539 return ( player && |
|
540 player->LcVideoPlayerState() == MLcVideoPlayer::EPlaying ); |
|
541 } |
|
542 |
|
543 // ----------------------------------------------------------------------------- |
|
544 // LcUiEnginePrivate::isRemotePlayerPlaying |
|
545 // ----------------------------------------------------------------------------- |
|
546 // |
|
547 bool LcUiEnginePrivate::isRemotePlayerPlaying() const |
|
548 { |
|
549 MLcVideoPlayer* player = session().RemoteVideoPlayer(); |
|
550 return ( player && |
|
551 player->LcVideoPlayerState() == MLcVideoPlayer::EPlaying ); |
|
552 } |
|
553 |
|
554 // ----------------------------------------------------------------------------- |
|
555 // LcUiEnginePrivate::timerEvent |
|
556 // ----------------------------------------------------------------------------- |
|
557 // |
|
558 void LcUiEnginePrivate::timerEvent(QTimerEvent *event) |
|
559 { |
|
560 if ( event->timerId() == mSessionDurationTimerId ) { |
|
561 QTime curr(0, 0, 0, 0); |
|
562 curr = curr.addSecs( |
|
563 mSessionDurationStartTime.secsTo( QTime::currentTime() ) ); |
|
564 emit mUiEngine.sessionDurationChanged(curr.toString()); |
|
565 } else if ( event->timerId() == mViewReadySimulationTimerId ){ |
|
566 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::timerEvent(), viewReady simulation" ) |
|
567 handleEngineForegroundStatus(); |
|
568 } |
|
569 } |
|
570 // ----------------------------------------------------------------------------- |
|
571 // LcUiEnginePrivate::startReceiving |
|
572 // ----------------------------------------------------------------------------- |
|
573 // |
|
574 void LcUiEnginePrivate::startReceiving() |
|
575 { |
|
576 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startReceiving()" ) |
|
577 |
|
578 if ( mAcceptQuery ) { |
|
579 mAcceptQuery->hide(); |
|
580 } |
|
581 |
|
582 establishSession(); |
|
583 |
|
584 if ( mWaitingNote && featureSupported( CLcEngine::ELcShowWaitingNote ) ) { |
|
585 mWaitingNote->show(); |
|
586 } |
|
587 |
|
588 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startReceiving()" ) |
|
589 } |
|
590 |
|
591 // ----------------------------------------------------------------------------- |
|
592 // LcUiEnginePrivate::stopForcefully |
|
593 // ----------------------------------------------------------------------------- |
|
594 // |
|
595 void LcUiEnginePrivate::stopForcefully() |
|
596 { |
|
597 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::stopForcefully()" ) |
|
598 |
|
599 // This is only way to force exit in case CActiveScheduler is blocked |
|
600 // by engine plugin. |
|
601 User::Exit(0); |
|
602 |
|
603 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::stopForcefully()" ) |
|
604 } |
|
605 |
|
606 // ----------------------------------------------------------------------------- |
|
607 // LcUiEnginePrivate::StateChanged |
|
608 // ----------------------------------------------------------------------------- |
|
609 // |
|
610 void LcUiEnginePrivate::StateChanged( MLcSession& aSession ) |
|
611 { |
|
612 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::StateChanged( session )" ) |
|
613 |
|
614 MLcSession::TLcSessionState newState = MLcSession::EUninitialized; |
|
615 newState = aSession.LcSessionState(); |
|
616 |
|
617 LC_QDEBUG_2( "livecomms [UI] new state=", newState ) |
|
618 |
|
619 if ( newState == MLcSession::EOpen ) { |
|
620 LC_QDEBUG( "livecomms [UI] state is MLcSession::EOpen" ) |
|
621 cancelCloseTimer(); |
|
622 hideNotes( false ); |
|
623 if( isAllowedToShareVideo() ) { |
|
624 startLocalVideo(); |
|
625 } |
|
626 startRemoteVideo(); |
|
627 fillRemoteInfo( true ); |
|
628 emitViewLayoutChanged(); |
|
629 startSessionDurationTimer(); |
|
630 |
|
631 } else if ( newState == MLcSession::EReceived ) { |
|
632 LC_QDEBUG( "livecomms [UI] state is MLcSession::EReceived" ) |
|
633 mRecipient = DESC_TO_QSTRING( session().RemoteDisplayName() ); |
|
634 if ( mAcceptQuery && |
|
635 featureSupported( CLcEngine::ELcShowAcceptQuery ) ) { |
|
636 mAcceptQuery->show(); |
|
637 } else { |
|
638 startReceiving(); |
|
639 } |
|
640 } else if ( newState == MLcSession::EClosed ) { |
|
641 LC_QDEBUG( "livecomms [UI] state is MLcSession::EClosed, closing UI..." ) |
|
642 emit mUiEngine.stopped(); |
|
643 |
|
644 } else if ( newState == MLcSession::EOpening ){ |
|
645 LC_QDEBUG( "livecomms [UI] state is MLcSession::EOpening" ) |
|
646 } |
|
647 |
|
648 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::StateChanged( session )" ) |
|
649 } |
|
650 |
|
651 // ----------------------------------------------------------------------------- |
|
652 // LcUiEnginePrivate::StateChanged |
|
653 // ----------------------------------------------------------------------------- |
|
654 // |
|
655 void LcUiEnginePrivate::StateChanged( MLcVideoPlayer& aPlayer ) |
|
656 { |
|
657 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::StateChanged( player )" ) |
|
658 |
|
659 emitViewLayoutChanged(); |
|
660 |
|
661 if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPlaying ) { |
|
662 if ( &aPlayer == session().RemoteVideoPlayer() ) { |
|
663 if ( mWaitingNote ) { |
|
664 mWaitingNote->hide(); |
|
665 } |
|
666 emit mUiEngine.remotePlayerPlaying(); |
|
667 } |
|
668 if ( &aPlayer == session().LocalVideoPlayer() ) { |
|
669 emit mUiEngine.localPlayerPlaying(); |
|
670 } |
|
671 } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPreparing ) { |
|
672 if ( &aPlayer == session().RemoteVideoPlayer() ) { |
|
673 emit mUiEngine.remotePlayerPreparing(); |
|
674 } |
|
675 if ( &aPlayer == session().LocalVideoPlayer() ) { |
|
676 emit mUiEngine.localPlayerPreparing(); |
|
677 } |
|
678 } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EBuffering ) { |
|
679 if ( &aPlayer == session().RemoteVideoPlayer() ) { |
|
680 emit mUiEngine.remotePlayerBuffering(); |
|
681 } |
|
682 if ( &aPlayer == session().LocalVideoPlayer() ) { |
|
683 emit mUiEngine.localPlayerBuffering(); |
|
684 } |
|
685 } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPaused ) { |
|
686 if ( &aPlayer == session().RemoteVideoPlayer() ) { |
|
687 emit mUiEngine.remotePlayerPaused(); |
|
688 } |
|
689 if ( &aPlayer == session().LocalVideoPlayer() ) { |
|
690 emit mUiEngine.localPlayerPaused(); |
|
691 } |
|
692 } else if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EUnavailable ) { |
|
693 if ( &aPlayer == session().RemoteVideoPlayer() ) { |
|
694 emit mUiEngine.remotePlayerUnavailable(); |
|
695 } |
|
696 if ( &aPlayer == session().LocalVideoPlayer() ) { |
|
697 emit mUiEngine.localPlayerUnavailable(); |
|
698 } |
|
699 } |
|
700 |
|
701 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::StateChanged( player )" ) |
|
702 } |
|
703 |
|
704 // ----------------------------------------------------------------------------- |
|
705 // LcUiEnginePrivate::Updated |
|
706 // ----------------------------------------------------------------------------- |
|
707 // |
|
708 void LcUiEnginePrivate::Updated( MLcSession& /*aSession*/ ) |
|
709 { |
|
710 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Updated( session )" ) |
|
711 emitViewLayoutChanged(); |
|
712 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Updated( session )" ) |
|
713 } |
|
714 |
|
715 // ----------------------------------------------------------------------------- |
|
716 // LcUiEnginePrivate::Updated |
|
717 // ----------------------------------------------------------------------------- |
|
718 // |
|
719 void LcUiEnginePrivate::Updated( MLcVideoPlayer& /*aPlayer*/ ) |
|
720 { |
|
721 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Updated( player )" ) |
|
722 emitViewLayoutChanged(); |
|
723 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Updated( player )" ) |
|
724 } |
|
725 |
|
726 // ----------------------------------------------------------------------------- |
|
727 // LcUiEnginePrivate::Failed |
|
728 // ----------------------------------------------------------------------------- |
|
729 // |
|
730 void LcUiEnginePrivate::Failed( MLcSession& /*aSession*/, TInt /*aError*/ ) |
|
731 { |
|
732 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Failed( session )" ) |
|
733 stop(); |
|
734 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Failed( session )" ) |
|
735 } |
|
736 |
|
737 // ----------------------------------------------------------------------------- |
|
738 // LcUiEnginePrivate::Failed |
|
739 // ----------------------------------------------------------------------------- |
|
740 // |
|
741 void LcUiEnginePrivate::Failed( MLcVideoPlayer& /*aPlayer*/, TInt /*aError*/ ) |
|
742 { |
|
743 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Failed( player )" ) |
|
744 stop(); |
|
745 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Failed( player )" ) |
|
746 } |
|
747 |
|
748 // ----------------------------------------------------------------------------- |
|
749 // LcUiEnginePrivate::SessionTimeChanged |
|
750 // ----------------------------------------------------------------------------- |
|
751 // |
|
752 void LcUiEnginePrivate::SessionTimeChanged( MLcSession& /*aSession*/, |
|
753 const TTimeIntervalSeconds& /*aSeconds*/ ) |
|
754 { |
|
755 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::SessionTimeChanged()" ) |
|
756 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::SessionTimeChanged()" ) |
|
757 } |
|
758 |
|
759 // ----------------------------------------------------------------------------- |
|
760 // LcUiEnginePrivate::SelectRecipient |
|
761 // ----------------------------------------------------------------------------- |
|
762 // |
|
763 TBool LcUiEnginePrivate::SelectRecipient( MDesCArray& aRecipientAddresses, |
|
764 TDes& aSelectedRecipientAddress ) |
|
765 { |
|
766 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::SelectRecipient()" ) |
|
767 aSelectedRecipientAddress = aRecipientAddresses.MdcaPoint(0); |
|
768 mRecipient = DESC_TO_QSTRING( aSelectedRecipientAddress ); |
|
769 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::SelectRecipient()" ) |
|
770 return ETrue; |
|
771 } |
|
772 |
|
773 // ----------------------------------------------------------------------------- |
|
774 // LcUiEnginePrivate::SelectRecipient |
|
775 // ----------------------------------------------------------------------------- |
|
776 // |
|
777 TBool LcUiEnginePrivate::InputRecipient( TDes& aRecipientAddress ) |
|
778 { |
|
779 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::InputRecipient()" ) |
|
780 |
|
781 TBool answered( EFalse ); |
|
782 |
|
783 if ( mRecipientQuery ) { |
|
784 mRecipient = DESC_TO_QSTRING( aRecipientAddress ); |
|
785 HbLineEdit* lineEdit = new HbLineEdit( mRecipient ); |
|
786 mRecipientQuery->setContentWidget( lineEdit ); |
|
787 mRecipientQuery->open(); |
|
788 TPtrC16 textPtr( |
|
789 reinterpret_cast< const TUint16* >( mRecipient.utf16() ) ); |
|
790 aRecipientAddress.Copy( textPtr ); |
|
791 answered = ETrue; |
|
792 } |
|
793 |
|
794 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::InputRecipient()" ) |
|
795 return answered; |
|
796 } |
|
797 |
|
798 // ----------------------------------------------------------------------------- |
|
799 // LcUiEnginePrivate::HandleForegroundStatus |
|
800 // ----------------------------------------------------------------------------- |
|
801 // |
|
802 void LcUiEnginePrivate::HandleForegroundStatus( TBool aForeground ) |
|
803 { |
|
804 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::HandleForegroundStatus(), fg:", |
|
805 aForeground ) |
|
806 |
|
807 mActivityManager->enableActivitySimulation(aForeground); |
|
808 |
|
809 if ( aForeground && !HbInstance::instance()->allMainWindows().isEmpty() ){ |
|
810 HbInstance::instance()->allMainWindows().at(0)->show(); |
|
811 } |
|
812 XQServiceUtil::toBackground(!aForeground); |
|
813 |
|
814 mIsMinimized = !aForeground; |
|
815 |
|
816 handleEngineForegroundStatus(); |
|
817 |
|
818 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::HandleForegroundStatus()" ) |
|
819 } |
|
820 |
|
821 // ----------------------------------------------------------------------------- |
|
822 // LcUiEnginePrivate::BlockUi |
|
823 // ----------------------------------------------------------------------------- |
|
824 // |
|
825 void LcUiEnginePrivate::BlockUi( TBool aBlocked ) |
|
826 { |
|
827 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::BlockUi, blocked:", aBlocked ) |
|
828 mBlocked = aBlocked; |
|
829 |
|
830 if ( mBlocked ){ |
|
831 emit mUiEngine.blocked(); |
|
832 } |
|
833 else{ |
|
834 emit mUiEngine.unblocked(); |
|
835 completePendingAction(); |
|
836 } |
|
837 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::BlockUi()" ) |
|
838 } |
|
839 |
|
840 // ----------------------------------------------------------------------------- |
|
841 // LcUiEnginePrivate::setViewLayout |
|
842 // ----------------------------------------------------------------------------- |
|
843 // |
|
844 LcViewLayoutHint LcUiEnginePrivate::setViewLayout() |
|
845 { |
|
846 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::setViewLayout()" ) |
|
847 |
|
848 LcViewLayoutHint hint = (LcViewLayoutHint)Lc_NoViewLayout; |
|
849 |
|
850 MLcVideoPlayer* localPlayer = visibleLocalPlayer(); |
|
851 MLcVideoPlayer* remotePlayer = visibleRemotePlayer(); |
|
852 |
|
853 if ( usingVideoTelephoneEngine() ) { |
|
854 hint = Lc_AllInOneViewLayout; |
|
855 LC_QDEBUG( "livecomms [UI] use Lc_AllInOneViewLayout" ) |
|
856 } else if ( localPlayer && remotePlayer ) { |
|
857 hint = Lc_TwowayViewLayout; |
|
858 LC_QDEBUG( "livecomms [UI] use Lc_TwowayViewLayout" ) |
|
859 } else if ( localPlayer ) { |
|
860 hint = Lc_SharedViewLayout; |
|
861 LC_QDEBUG( "livecomms [UI] use Lc_SharedViewLayout" ) |
|
862 } else if ( remotePlayer && !session().LocalVideoPlayer() ) { |
|
863 hint = Lc_ReceivedOnlyViewLayout; |
|
864 LC_QDEBUG( "livecomms [UI] use Lc_ReceivedOnlyViewLayout" ) |
|
865 } else if ( remotePlayer ) { |
|
866 hint = Lc_ReceivedViewLayout; |
|
867 LC_QDEBUG( "livecomms [UI] use Lc_ReceivedViewLayout" ) |
|
868 } else { |
|
869 hint = Lc_IdleViewLayout; |
|
870 LC_QDEBUG( "livecomms [UI] ! no players ! use Lc_IdleViewLayout" ) |
|
871 } |
|
872 |
|
873 mViewLayout = hint; |
|
874 |
|
875 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::setViewLayout()" ) |
|
876 |
|
877 return viewLayout(); |
|
878 } |
|
879 |
|
880 // ----------------------------------------------------------------------------- |
|
881 // LcUiEnginePrivate::emitViewLayoutChanged |
|
882 // ----------------------------------------------------------------------------- |
|
883 // |
|
884 void LcUiEnginePrivate::emitViewLayoutChanged() |
|
885 { |
|
886 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::emitViewLayoutChanged()" ) |
|
887 |
|
888 LcViewLayoutHint oldLayout = viewLayout(); |
|
889 LcViewLayoutHint layout = setViewLayout(); |
|
890 |
|
891 if ( layout != oldLayout ) { |
|
892 LC_QDEBUG( "livecomms [UI] layout has changed. signal" ) |
|
893 emit mUiEngine.layoutChanged(); |
|
894 } |
|
895 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::emitViewLayoutChanged()" ) |
|
896 } |
|
897 |
|
898 // ----------------------------------------------------------------------------- |
|
899 // LcUiEnginePrivate::startLiveContent |
|
900 // ----------------------------------------------------------------------------- |
|
901 // |
|
902 void LcUiEnginePrivate::startLiveContent() |
|
903 { |
|
904 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startLiveContent()" ) |
|
905 |
|
906 if ( mInvitingNote && featureSupported( CLcEngine::ELcShowInvitingNote ) ) { |
|
907 mInvitingNote->show(); |
|
908 } |
|
909 enableSpeaker( true ); |
|
910 establishSession(); |
|
911 |
|
912 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startLiveContent()" ) |
|
913 } |
|
914 |
|
915 // ----------------------------------------------------------------------------- |
|
916 // LcUiEnginePrivate::startPlayback |
|
917 // Utility style function to start both local and remote players if available. |
|
918 // ----------------------------------------------------------------------------- |
|
919 // |
|
920 void LcUiEnginePrivate::startPlayback() |
|
921 { |
|
922 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startPlayback()" ) |
|
923 startLocalVideo(); |
|
924 startRemoteVideo(); |
|
925 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startPlayback()" ) |
|
926 } |
|
927 |
|
928 // ----------------------------------------------------------------------------- |
|
929 // LcUiEnginePrivate::startRemoteVideo |
|
930 // ----------------------------------------------------------------------------- |
|
931 // |
|
932 void LcUiEnginePrivate::startRemoteVideo() |
|
933 { |
|
934 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startRemotePlayback()" ) |
|
935 MLcVideoPlayer* remotePlayer = session().RemoteVideoPlayer(); |
|
936 if ( remotePlayer ) { |
|
937 LC_QDEBUG( "livecomms [UI] enable remote player window" ) |
|
938 enableWindow( remotePlayer, true ); |
|
939 } |
|
940 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startRemotePlayback()" ) |
|
941 } |
|
942 // ----------------------------------------------------------------------------- |
|
943 // LcUiEnginePrivate::startCloseTimer |
|
944 // ----------------------------------------------------------------------------- |
|
945 // |
|
946 void LcUiEnginePrivate::startCloseTimer() |
|
947 { |
|
948 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startCloseTimer()" ) |
|
949 delete mCloseTimer; |
|
950 mCloseTimer = 0; |
|
951 mCloseTimer = new QTimer(this); |
|
952 mCloseTimer->setSingleShot(true); |
|
953 connect(mCloseTimer, SIGNAL(timeout()), this, SLOT(stop())); |
|
954 mCloseTimer->start(60000); |
|
955 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startCloseTimer()" ) |
|
956 } |
|
957 |
|
958 // ----------------------------------------------------------------------------- |
|
959 // LcUiEnginePrivate::cancelCloseTimer |
|
960 // ----------------------------------------------------------------------------- |
|
961 // |
|
962 void LcUiEnginePrivate::cancelCloseTimer() |
|
963 { |
|
964 if ( mCloseTimer && mCloseTimer->isActive()) { |
|
965 mCloseTimer->stop(); |
|
966 } |
|
967 } |
|
968 |
|
969 // ----------------------------------------------------------------------------- |
|
970 // LcUiEnginePrivate::hideNotes |
|
971 // ----------------------------------------------------------------------------- |
|
972 // |
|
973 void LcUiEnginePrivate::hideNotes( bool hideWaitingNote ) |
|
974 { |
|
975 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::hideNotes()" ) |
|
976 if ( mAcceptQuery ) { |
|
977 mAcceptQuery->hide(); |
|
978 } |
|
979 if ( mWaitingNote && hideWaitingNote ) { |
|
980 mWaitingNote->hide(); |
|
981 } |
|
982 if ( mInvitingNote ) { |
|
983 mInvitingNote->hide(); |
|
984 } |
|
985 if ( mRecipientQuery ) { |
|
986 mRecipientQuery->hide(); |
|
987 } |
|
988 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::hideNotes()" ) |
|
989 } |
|
990 |
|
991 // ----------------------------------------------------------------------------- |
|
992 // LcUiEnginePrivate::completeAction |
|
993 // Completes method passed as argument. If engine is in blocked state |
|
994 // action completion will be delayed until unblock occurs. |
|
995 // ----------------------------------------------------------------------------- |
|
996 // |
|
997 void LcUiEnginePrivate::completeAction( const char* actionMethod ) |
|
998 { |
|
999 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::completeAction :", actionMethod ) |
|
1000 if ( mBlocked ) { |
|
1001 LC_QDEBUG( "livecomms [UI] Blocked, invoke later" ) |
|
1002 // store action and invoke it once unblocked |
|
1003 setPendingAction( actionMethod ); |
|
1004 } |
|
1005 else { |
|
1006 QMetaObject::invokeMethod( &mUiEngine, actionMethod ); |
|
1007 } |
|
1008 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::completeAction" ) |
|
1009 } |
|
1010 |
|
1011 // ----------------------------------------------------------------------------- |
|
1012 // LcUiEnginePrivate::setPendingAction |
|
1013 // ----------------------------------------------------------------------------- |
|
1014 // |
|
1015 void LcUiEnginePrivate::setPendingAction( const char* actionMethod ) |
|
1016 { |
|
1017 mPendingAction = actionMethod; |
|
1018 } |
|
1019 |
|
1020 // ----------------------------------------------------------------------------- |
|
1021 // LcUiEnginePrivate::completePendingAction |
|
1022 // ----------------------------------------------------------------------------- |
|
1023 // |
|
1024 void LcUiEnginePrivate::completePendingAction() |
|
1025 { |
|
1026 if ( !mPendingAction.isEmpty() ) { |
|
1027 completeAction( mPendingAction.toAscii().constData() ); |
|
1028 mPendingAction.clear(); |
|
1029 } |
|
1030 } |
|
1031 |
|
1032 // ----------------------------------------------------------------------------- |
|
1033 // LcUiEnginePrivate::videoTelephoneLayout |
|
1034 // ----------------------------------------------------------------------------- |
|
1035 // |
|
1036 bool LcUiEnginePrivate::usingVideoTelephoneEngine() |
|
1037 { |
|
1038 return mEngineName == LC_VTPLUGIN_NAME; |
|
1039 } |
|
1040 |
|
1041 // ----------------------------------------------------------------------------- |
|
1042 // LcUiEnginePrivate::session |
|
1043 // ----------------------------------------------------------------------------- |
|
1044 // |
|
1045 MLcSession& LcUiEnginePrivate::session() const |
|
1046 { |
|
1047 return mLiveCommsEngine->Session(); |
|
1048 } |
|
1049 |
|
1050 // ----------------------------------------------------------------------------- |
|
1051 // LcUiEnginePrivate::visibleLocalPlayer |
|
1052 // ----------------------------------------------------------------------------- |
|
1053 // |
|
1054 MLcVideoPlayer* LcUiEnginePrivate::visibleLocalPlayer() const |
|
1055 { |
|
1056 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1057 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
1058 if ( localPlayer ) { |
|
1059 bool playing( true ); |
|
1060 TRAP_IGNORE( playing = localPlayer->LcIsPlayingL() ); |
|
1061 if ( !playing ) { |
|
1062 localPlayer = 0; |
|
1063 } |
|
1064 } |
|
1065 return localPlayer; |
|
1066 } |
|
1067 |
|
1068 // ----------------------------------------------------------------------------- |
|
1069 // LcUiEnginePrivate::visibleRemotePlayer |
|
1070 // ----------------------------------------------------------------------------- |
|
1071 // |
|
1072 MLcVideoPlayer* LcUiEnginePrivate::visibleRemotePlayer() const |
|
1073 { |
|
1074 MLcVideoPlayer* remotePlayer = session().RemoteVideoPlayer(); |
|
1075 if ( remotePlayer && |
|
1076 remotePlayer->LcVideoPlayerState() == MLcVideoPlayer::EPaused ) { |
|
1077 remotePlayer = 0; |
|
1078 } |
|
1079 return remotePlayer; |
|
1080 } |
|
1081 |
|
1082 // ----------------------------------------------------------------------------- |
|
1083 // LcUiEnginePrivate::audioControl |
|
1084 // ----------------------------------------------------------------------------- |
|
1085 // |
|
1086 MLcAudioControl* LcUiEnginePrivate::audioControl() const |
|
1087 { |
|
1088 MLcAudioControl* audioControl( 0 ); |
|
1089 if ( session().LocalVideoPlayer() ) { |
|
1090 audioControl = session().LocalVideoPlayer()->LcAudioControl(); |
|
1091 } |
|
1092 if ( !audioControl && session().RemoteVideoPlayer() ) { |
|
1093 audioControl = session().RemoteVideoPlayer()->LcAudioControl(); |
|
1094 } |
|
1095 return audioControl; |
|
1096 } |
|
1097 |
|
1098 // ----------------------------------------------------------------------------- |
|
1099 // LcUiEnginePrivate::zoomControl |
|
1100 // ----------------------------------------------------------------------------- |
|
1101 // |
|
1102 MLcZoomControl* LcUiEnginePrivate::zoomControl() const |
|
1103 { |
|
1104 MLcZoomControl* zoomControl( 0 ); |
|
1105 if ( session().LocalVideoPlayer() ) { |
|
1106 zoomControl = session().LocalVideoPlayer()->LcZoomControl(); |
|
1107 } |
|
1108 return zoomControl; |
|
1109 } |
|
1110 |
|
1111 // ----------------------------------------------------------------------------- |
|
1112 // LcUiEnginePrivate::isFeatureSupported |
|
1113 // ----------------------------------------------------------------------------- |
|
1114 // |
|
1115 bool LcUiEnginePrivate::featureSupported( CLcEngine::TLcFeature feature ) |
|
1116 { |
|
1117 bool isSupported( false ); |
|
1118 if ( mLiveCommsEngine ) { |
|
1119 isSupported = mLiveCommsEngine->IsFeatureSupported( feature ); |
|
1120 } |
|
1121 return isSupported; |
|
1122 } |
|
1123 |
|
1124 // ----------------------------------------------------------------------------- |
|
1125 // LcUiEnginePrivate::startSessionDurationTimer |
|
1126 // ----------------------------------------------------------------------------- |
|
1127 // |
|
1128 void LcUiEnginePrivate::startSessionDurationTimer() |
|
1129 { |
|
1130 const int sessionDurationTimerIntervalInMs = 1000; |
|
1131 if ( !mSessionDurationTimerId ){ |
|
1132 mSessionDurationTimerId = startTimer( sessionDurationTimerIntervalInMs ); |
|
1133 LC_QDEBUG_2( "livecomms [UI] -> duration timer id:", mSessionDurationTimerId ) |
|
1134 mSessionDurationStartTime = QTime::currentTime(); |
|
1135 } |
|
1136 } |
|
1137 |
|
1138 // ----------------------------------------------------------------------------- |
|
1139 // LcUiEnginePrivate::stopSessionDurationTimer |
|
1140 // ----------------------------------------------------------------------------- |
|
1141 // |
|
1142 void LcUiEnginePrivate::stopSessionDurationTimer() |
|
1143 { |
|
1144 if ( mSessionDurationTimerId ){ |
|
1145 killTimer( mSessionDurationTimerId ); |
|
1146 mSessionDurationTimerId = 0; |
|
1147 } |
|
1148 } |
|
1149 |
|
1150 // ----------------------------------------------------------------------------- |
|
1151 // LcUiEnginePrivate::establishSession |
|
1152 // ----------------------------------------------------------------------------- |
|
1153 // |
|
1154 int LcUiEnginePrivate::establishSession() |
|
1155 { |
|
1156 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1157 TRAPD( err, mLiveCommsEngine->Session().EstablishLcSessionL() ); |
|
1158 if ( !err ) { |
|
1159 startCloseTimer(); |
|
1160 } |
|
1161 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::establishSession, err", err ) |
|
1162 return err; |
|
1163 } |
|
1164 |
|
1165 // ----------------------------------------------------------------------------- |
|
1166 // LcUiEnginePrivate::terminateSession |
|
1167 // ----------------------------------------------------------------------------- |
|
1168 // |
|
1169 int LcUiEnginePrivate::terminateSession() |
|
1170 { |
|
1171 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1172 TRAPD( err, mLiveCommsEngine->Session().TerminateLcSessionL() ); |
|
1173 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::terminateSession, err", err ) |
|
1174 return err; |
|
1175 } |
|
1176 |
|
1177 // ----------------------------------------------------------------------------- |
|
1178 // LcUiEnginePrivate::setWindowRect |
|
1179 // ----------------------------------------------------------------------------- |
|
1180 // |
|
1181 int LcUiEnginePrivate::setWindowRect( MLcVideoPlayer* player, TRect rect ) |
|
1182 { |
|
1183 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1184 int err( -1 ); |
|
1185 if ( player && |
|
1186 player->LcWindow() && |
|
1187 player->LcWindow()->LcWindowRect() != rect ) { |
|
1188 TRAP( err, player->LcWindow()->SetLcWindowRectL( rect ) ); |
|
1189 } |
|
1190 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::setWindowRect, err", err ) |
|
1191 return err; |
|
1192 } |
|
1193 |
|
1194 // ----------------------------------------------------------------------------- |
|
1195 // LcUiEnginePrivate::enableWindow |
|
1196 // ----------------------------------------------------------------------------- |
|
1197 // |
|
1198 int LcUiEnginePrivate::enableWindow( MLcVideoPlayer* player, bool enable ) |
|
1199 { |
|
1200 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1201 int err( -1 ); |
|
1202 if ( player && |
|
1203 player->LcWindow() ) { |
|
1204 TRAP( err, player->LcWindow()->EnableLcWindowL( enable ) ); |
|
1205 } |
|
1206 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::enableWindow, err", err ) |
|
1207 return err; |
|
1208 } |
|
1209 |
|
1210 // ----------------------------------------------------------------------------- |
|
1211 // LcUiEnginePrivate::play |
|
1212 // ----------------------------------------------------------------------------- |
|
1213 // |
|
1214 int LcUiEnginePrivate::play( MLcVideoPlayer* player ) |
|
1215 { |
|
1216 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1217 int err( -1 ); |
|
1218 if ( player ) { |
|
1219 TRAP( err, player->LcPlayL() ); |
|
1220 } |
|
1221 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::play, err", err ) |
|
1222 return err; |
|
1223 } |
|
1224 |
|
1225 // ----------------------------------------------------------------------------- |
|
1226 // LcUiEnginePrivate::pause |
|
1227 // ----------------------------------------------------------------------------- |
|
1228 // |
|
1229 int LcUiEnginePrivate::pause( MLcVideoPlayer* player ) |
|
1230 { |
|
1231 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1232 int err( -1 ); |
|
1233 if ( player ) { |
|
1234 TRAP( err, player->LcPauseL() ); |
|
1235 } |
|
1236 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::pause, err", err ) |
|
1237 return err; |
|
1238 } |
|
1239 |
|
1240 // ----------------------------------------------------------------------------- |
|
1241 // LcUiEnginePrivate::enableSpeaker |
|
1242 // ----------------------------------------------------------------------------- |
|
1243 // |
|
1244 int LcUiEnginePrivate::enableSpeaker( bool enable ) |
|
1245 { |
|
1246 int err( -1 ); |
|
1247 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1248 MLcAudioControl* audio = audioControl(); |
|
1249 if ( audio ) { |
|
1250 TRAP( err, audio->EnableLcLoudspeakerL( enable ) ); |
|
1251 } |
|
1252 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::enableSpeaker, err", err ) |
|
1253 return err; |
|
1254 } |
|
1255 |
|
1256 // ----------------------------------------------------------------------------- |
|
1257 // LcUiEnginePrivate::muteMic |
|
1258 // ----------------------------------------------------------------------------- |
|
1259 // |
|
1260 int LcUiEnginePrivate::muteMic( bool mute ) |
|
1261 { |
|
1262 int err( -1 ); |
|
1263 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1264 MLcAudioControl* audio = audioControl(); |
|
1265 if ( audio ) { |
|
1266 TRAP( err, audio->MuteLcMicL( mute ) ); |
|
1267 } |
|
1268 return err; |
|
1269 } |
|
1270 |
|
1271 // ----------------------------------------------------------------------------- |
|
1272 // LcUiEnginePrivate::fillRemoteInfo |
|
1273 // ----------------------------------------------------------------------------- |
|
1274 // |
|
1275 void LcUiEnginePrivate::fillRemoteInfo(bool informChanges) |
|
1276 { |
|
1277 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::fillRemoteInfo()" ) |
|
1278 |
|
1279 QString phoneNum = DESC_TO_QSTRING( session().RemoteDetails() ); |
|
1280 if ( phoneNum != mPhoneNumber) { |
|
1281 LC_QDEBUG_2( "remote number:", phoneNum ) |
|
1282 mPhoneNumber = phoneNum; |
|
1283 if ( informChanges ) { |
|
1284 emit mUiEngine.phoneNumberChanged(mPhoneNumber); |
|
1285 } |
|
1286 } |
|
1287 // If no recipient even at opened state and no phonenum, use unknown recipient |
|
1288 QString recipient = DESC_TO_QSTRING( session().RemoteDisplayName() ); |
|
1289 if ( recipient.isEmpty() ){ |
|
1290 recipient = mPhoneNumber; |
|
1291 } |
|
1292 if ( session().LcSessionState() == MLcSession::EOpen && recipient.isEmpty() ) { |
|
1293 recipient = hbTrId("txt_vt_custom_unknown_number"); |
|
1294 } |
|
1295 if ( recipient != mRecipient ){ |
|
1296 LC_QDEBUG_2( "remote name:", recipient ) |
|
1297 mRecipient = recipient; |
|
1298 if ( informChanges ) { |
|
1299 emit mUiEngine.recipientChanged(mRecipient); |
|
1300 } |
|
1301 } |
|
1302 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::fillRemoteInfo()" ) |
|
1303 } |
|
1304 |
|
1305 // ----------------------------------------------------------------------------- |
|
1306 // LcUiEnginePrivate::isMinimized |
|
1307 // ----------------------------------------------------------------------------- |
|
1308 // |
|
1309 bool LcUiEnginePrivate::isMinimized() const |
|
1310 { |
|
1311 return mIsMinimized; |
|
1312 } |
|
1313 |
|
1314 // ----------------------------------------------------------------------------- |
|
1315 // LcUiEnginePrivate::minimize |
|
1316 // ----------------------------------------------------------------------------- |
|
1317 // |
|
1318 void LcUiEnginePrivate::minimize() |
|
1319 { |
|
1320 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::minimize()" ) |
|
1321 |
|
1322 if ( !isMinimized() ){ |
|
1323 TRect emptyRect; |
|
1324 setWindowRect( session().LocalVideoPlayer(), emptyRect ); |
|
1325 setWindowRect( session().RemoteVideoPlayer(), emptyRect ); |
|
1326 HandleForegroundStatus(EFalse); |
|
1327 } |
|
1328 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::minimize()" ) |
|
1329 } |
|
1330 |
|
1331 // ----------------------------------------------------------------------------- |
|
1332 // LcUiEnginePrivate::maximize |
|
1333 // ----------------------------------------------------------------------------- |
|
1334 // |
|
1335 void LcUiEnginePrivate::maximize() |
|
1336 { |
|
1337 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::maximize()" ) |
|
1338 if ( isMinimized() ){ |
|
1339 setWindowRect( session().LocalVideoPlayer(), mLocalRect ); |
|
1340 setWindowRect( session().RemoteVideoPlayer(), mRemoteRect ); |
|
1341 HandleForegroundStatus(ETrue); |
|
1342 } |
|
1343 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::maximize()" ) |
|
1344 } |
|
1345 |
|
1346 // ----------------------------------------------------------------------------- |
|
1347 // LcUiEnginePrivate::setCurrentView |
|
1348 // ----------------------------------------------------------------------------- |
|
1349 // |
|
1350 void LcUiEnginePrivate::setCurrentView(HbView* view) |
|
1351 { |
|
1352 LC_QDEBUG( "livecomms [UI] <-> LcUiEnginePrivate::setCurrentView()" ) |
|
1353 mCurrentView = view; |
|
1354 } |
|
1355 |
|
1356 // ----------------------------------------------------------------------------- |
|
1357 // LcUiEnginePrivate::startStopGuardTimer |
|
1358 // ----------------------------------------------------------------------------- |
|
1359 // |
|
1360 void LcUiEnginePrivate::startStopGuardTimer() |
|
1361 { |
|
1362 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startStopGuardTimer()" ) |
|
1363 const int stoppingGuardTimerInMs = 5000; |
|
1364 QTimer::singleShot(stoppingGuardTimerInMs, this, SLOT(stopForcefully())); |
|
1365 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startStopGuardTimer()" ) |
|
1366 } |
|
1367 |
|
1368 // ----------------------------------------------------------------------------- |
|
1369 // LcUiEnginePrivate::handleEngineForegroundStatus |
|
1370 // ----------------------------------------------------------------------------- |
|
1371 // |
|
1372 void LcUiEnginePrivate::handleEngineForegroundStatus() |
|
1373 { |
|
1374 bool foreground = !mIsMinimized; |
|
1375 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::handleEngineForegroundStatus(), fg:", |
|
1376 foreground ) |
|
1377 if ( mLiveCommsEngine ){ |
|
1378 bool setStatusToEngine(true); |
|
1379 if ( foreground && mFirstForegroundSwitch ){ |
|
1380 // Have to wait that first paint has occured, otherwise video |
|
1381 // windows are shown too early. |
|
1382 // TODO: wk8 does not yet have viewReady signal so simulate it |
|
1383 // by using timer. Timer can be removed later. |
|
1384 if ( mCurrentView ){ |
|
1385 LC_QDEBUG( "livecomms [UI] Wait for first paint" ) |
|
1386 connect( mCurrentView, SIGNAL(viewReady()), |
|
1387 this, SLOT(handleEngineForegroundStatus()) ); |
|
1388 const int viewReadySimulationInMs = 2000; |
|
1389 mViewReadySimulationTimerId = startTimer( viewReadySimulationInMs ); |
|
1390 setStatusToEngine = false; |
|
1391 } |
|
1392 |
|
1393 } |
|
1394 if ( setStatusToEngine ) { |
|
1395 LC_QDEBUG( "livecomms [UI] Set fg status to engine plugin" ) |
|
1396 session().SetForegroundStatus(foreground); |
|
1397 |
|
1398 disconnect( mCurrentView, SIGNAL(viewReady()), |
|
1399 this, SLOT(handleEngineForegroundStatus()) ); |
|
1400 killTimer( mViewReadySimulationTimerId ); |
|
1401 mViewReadySimulationTimerId = 0; |
|
1402 } |
|
1403 mFirstForegroundSwitch = false; |
|
1404 } |
|
1405 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::handleEngineForegroundStatus()" ) |
|
1406 } |
|
1407 |
|
1408 |
|
1409 // ----------------------------------------------------------------------------- |
|
1410 // LcUiEnginePrivate::SendDialTone |
|
1411 // ----------------------------------------------------------------------------- |
|
1412 // |
|
1413 bool LcUiEnginePrivate::SendDialTone(const QChar aKey) |
|
1414 { |
|
1415 if ( mLiveCommsEngine ){ |
|
1416 const TChar dialChar = static_cast<TChar>(aKey.unicode()); |
|
1417 return mLiveCommsEngine->Session().SendDialTone(dialChar); |
|
1418 } |
|
1419 return false; |
|
1420 } |
|
1421 |
|
1422 // ----------------------------------------------------------------------------- |
|
1423 // LcUiEnginePrivate::isAllowedToShareVideo |
|
1424 // ----------------------------------------------------------------------------- |
|
1425 // |
|
1426 bool LcUiEnginePrivate::isAllowedToShareVideo() |
|
1427 { |
|
1428 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::isAllowedToShareVideo()" ) |
|
1429 if( featureSupported( CLcEngine::ELcSendVideoQuery ) && mShareOwnVideoQuery ){ |
|
1430 mShareOwnVideoQuery->show(); |
|
1431 return false; |
|
1432 } |
|
1433 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::isAllowedToShareVideo()" ) |
|
1434 return true; |
|
1435 } |
|
1436 |
|
1437 // ----------------------------------------------------------------------------- |
|
1438 // LcUiEnginePrivate::stopLocalVideo |
|
1439 // ----------------------------------------------------------------------------- |
|
1440 // |
|
1441 void LcUiEnginePrivate::stopLocalVideo() |
|
1442 { |
|
1443 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::stopLocalVideo()" ) |
|
1444 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
1445 if( localPlayer ){ |
|
1446 pause( localPlayer ); |
|
1447 enableWindow( localPlayer, false ); |
|
1448 } |
|
1449 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::stopLocalVideo()" ) |
|
1450 } |
|
1451 |
|
1452 // ----------------------------------------------------------------------------- |
|
1453 // LcUiEnginePrivate::startLocalVideo |
|
1454 // ----------------------------------------------------------------------------- |
|
1455 // |
|
1456 void LcUiEnginePrivate::startLocalVideo() |
|
1457 { |
|
1458 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startLocalVideo()" ) |
|
1459 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
1460 if( localPlayer ){ |
|
1461 play( localPlayer ); |
|
1462 enableWindow( localPlayer, true ); |
|
1463 } |
|
1464 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startLocalVideo()" ) |
|
1465 } |
|
1466 // End of File |