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