|
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 //USER |
|
18 #include "lcview.h" |
|
19 #include "lclogger.h" |
|
20 #include "lcuiengine.h" |
|
21 #include "lcuidefs.h" |
|
22 #include "lcuicomponentrepository.h" |
|
23 #include "lceffecthandler.h" |
|
24 #include "lcvideowidget.h" |
|
25 |
|
26 //SYSTEM |
|
27 #include <hblabel.h> |
|
28 #include <hbdialog.h> |
|
29 #include <hbtransparentwindow.h> |
|
30 #include <hbmessagebox.h> |
|
31 #include <hbaction.h> |
|
32 #include <hbmenu.h> |
|
33 #include <hbpushbutton.h> |
|
34 #include <hbtoolbar.h> |
|
35 #include <hbinstance.h> |
|
36 #include <hbzoomsliderpopup.h> |
|
37 #include <hbeffect.h> |
|
38 #include <qgraphicssceneevent.h> |
|
39 #include <qtimer.h> |
|
40 #include <hblineedit.h> |
|
41 #include <dialpad.h> |
|
42 #include <HbTapGesture> |
|
43 |
|
44 |
|
45 |
|
46 #if ( defined __WINSCW__ ) || ( defined __WINS__ ) |
|
47 const int inActivityTimeout = 5000; //5 secs |
|
48 #else |
|
49 const int inActivityTimeout = 2000; //2 secs |
|
50 #endif |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // LcView::LcView |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 LcView::LcView(LcUiEngine& engine, LcUiComponentRepository& repository) |
|
57 : HbView(0), |
|
58 mEngine(engine), |
|
59 mRepository(repository), |
|
60 mRecipient(0), |
|
61 mDuration(0), |
|
62 mContactIcon(0), |
|
63 mBrandIcon(0), |
|
64 mSharedVideoWidget(0), |
|
65 mReceivedVideoWidget(0), |
|
66 mChangeCameraAction(0), |
|
67 mMuteAction(0), |
|
68 mSpeakerAction(0), |
|
69 mDisableCameraAction(0), |
|
70 mDisableCameraMenuAction(0), |
|
71 mNotSupportedNote(0), |
|
72 mZoomSlider(0), |
|
73 mEndCallButton(0), |
|
74 mReceivedVideoEffectOverlay(0), |
|
75 mSharedVideoEffectOverlay(0), |
|
76 mEffectHandler(0), |
|
77 mItemContextMenu(0), |
|
78 mLandscapeTimer(0), |
|
79 mIsOptionMenuOpen(false), |
|
80 mSoftKeyBackAction(0), |
|
81 mDialpad(0) |
|
82 { |
|
83 LC_QDEBUG( "livecomms [UI] -> LcView::LcView()" ) |
|
84 |
|
85 createNotSupportedNote(); |
|
86 |
|
87 // For LiveComms views Dock Wiget Item is explicitly hidden. |
|
88 hideItems(Hb::DockWidgetItem); |
|
89 |
|
90 //Subscribe to the gesture events. |
|
91 grabGesture(Qt::TapGesture); |
|
92 |
|
93 LC_QDEBUG( "livecomms [UI] <- LcView::LcView()" ) |
|
94 } |
|
95 |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // LcView::~LcView |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 LcView::~LcView() |
|
102 { |
|
103 LC_QDEBUG( "livecomms [UI] -> LcView::~LcView()" ) |
|
104 |
|
105 // Un-subscribe to the gesture events. |
|
106 ungrabGesture(Qt::TapGesture); |
|
107 |
|
108 delete mEffectHandler; |
|
109 delete mLandscapeTimer; |
|
110 delete mNotSupportedNote; |
|
111 |
|
112 LC_QDEBUG( "livecomms [UI] <- LcView::~LcView()" ) |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // LcView::init |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 void LcView::init() |
|
120 { |
|
121 LC_QDEBUG( "livecomms [UI] -> LcView::init()" ) |
|
122 //find member widgets from repository |
|
123 //( can be also found by browsing this view itself ) |
|
124 |
|
125 //due stubs in unit tests, qobject_cast cannot be used. Using static_cast instead |
|
126 mRecipient = |
|
127 static_cast<HbLabel*>( mRepository.findWidget( lcLabelRecipientId ) ); |
|
128 mDuration = |
|
129 static_cast<HbLabel*>( mRepository.findWidget( lcLabelDurationId ) ); |
|
130 mContactIcon = |
|
131 static_cast<HbLabel*>( mRepository.findWidget( lcIconContactId ) ); |
|
132 mBrandIcon = |
|
133 static_cast<HbLabel*>( mRepository.findWidget( lcIconBrandId ) ); |
|
134 mSharedVideoWidget = |
|
135 static_cast<LcVideoWidget*>( |
|
136 mRepository.findWidget( lcWidgetSendVideoId ) ); |
|
137 mReceivedVideoWidget = |
|
138 static_cast<LcVideoWidget*>( |
|
139 mRepository.findWidget( lcWidgetRecvVideoId ) ); |
|
140 mChangeCameraAction = |
|
141 static_cast<HbAction*>( mRepository.findObject( lcActChangeCameraId ) ); |
|
142 mMuteAction = |
|
143 static_cast<HbAction*>( mRepository.findObject( lcActMuteId ) ); |
|
144 mSpeakerAction = |
|
145 static_cast<HbAction*>( mRepository.findObject( lcActSpeakerId ) ); |
|
146 mDisableCameraAction = |
|
147 static_cast<HbAction*>( mRepository.findObject( lcActDisableCameraId ) ); |
|
148 |
|
149 mDisableCameraMenuAction = |
|
150 static_cast<HbAction*>( mRepository.findObject( lcActMenuDisableCameraId ) ); |
|
151 |
|
152 mEndCallButton = |
|
153 static_cast<HbPushButton*>( mRepository.findObject( lcButtonEndCall ) ); |
|
154 |
|
155 if ( mEndCallButton ) { |
|
156 connect( mEndCallButton, SIGNAL(clicked()), SLOT(endVideoSession())); |
|
157 } |
|
158 |
|
159 if ( mSharedVideoWidget ) { |
|
160 mZoomSlider = mRepository.zoomSlider(); |
|
161 mSharedVideoEffectOverlay = static_cast<LcVideoWidget*>( |
|
162 mRepository.findWidget( lcWidgetSendVideoId2 ) ); |
|
163 if ( mSharedVideoEffectOverlay ) { |
|
164 mSharedVideoEffectOverlay->show(); |
|
165 } |
|
166 } |
|
167 |
|
168 mReceivedVideoEffectOverlay = |
|
169 static_cast<LcVideoWidget*>( mRepository.findWidget( lcWidgetRecvVideoId2 ) ); |
|
170 |
|
171 if ( mReceivedVideoEffectOverlay ) { |
|
172 mReceivedVideoEffectOverlay->show(); |
|
173 } |
|
174 |
|
175 mEffectHandler = new LcEffectHandler( mEngine, |
|
176 mSharedVideoWidget, mSharedVideoEffectOverlay, |
|
177 mReceivedVideoWidget, mReceivedVideoEffectOverlay); |
|
178 connect( mEffectHandler, SIGNAL(swapCompleted()), this, SLOT(updateVideoRects()) ); |
|
179 |
|
180 connect( mEffectHandler, SIGNAL(loadSwapLayout()), this, SLOT(updateSwapLayout()) ); |
|
181 |
|
182 mLandscapeTimer = new QTimer(); |
|
183 connect( mLandscapeTimer, SIGNAL(timeout()), this, SLOT(landscapeTimerTimeout()) ); |
|
184 |
|
185 updateUiElements(); |
|
186 |
|
187 if ( menu()) { |
|
188 connect( menu(), SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()) ); |
|
189 connect( menu(), SIGNAL(aboutToHide()), this, SLOT(menuAboutToHide()) ); |
|
190 } |
|
191 |
|
192 mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this); |
|
193 connect(mSoftKeyBackAction, SIGNAL(triggered()), SLOT(back())); |
|
194 |
|
195 LC_QDEBUG( "livecomms [UI] <- LcView::init()" ) |
|
196 } |
|
197 |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // LcView::updateVideoRects |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 void LcView::updateVideoRects() |
|
204 { |
|
205 LC_QDEBUG( "livecomms [UI] -> LcView::updateVideoRects()" ) |
|
206 |
|
207 QRectF sharedContentRect; |
|
208 QRectF receivedContentRect; |
|
209 |
|
210 if ( mSharedVideoWidget ) { |
|
211 sharedContentRect = mSharedVideoWidget->geometry(); |
|
212 sharedContentRect.moveTop( |
|
213 sharedContentRect.y() + mapToParent(scenePos()).y()); |
|
214 sharedContentRect = translateRectForOrientation(sharedContentRect); |
|
215 mEffectHandler->setVisibility( |
|
216 mSharedVideoWidget, mEngine.isLocalPlayerPlaying()); |
|
217 } |
|
218 |
|
219 if ( mReceivedVideoWidget ) { |
|
220 receivedContentRect = mReceivedVideoWidget->geometry(); |
|
221 receivedContentRect.moveTop( |
|
222 receivedContentRect.y() + mapToParent(scenePos()).y()); |
|
223 receivedContentRect = translateRectForOrientation(receivedContentRect); |
|
224 mEffectHandler->setVisibility( |
|
225 mReceivedVideoWidget, mEngine.isRemotePlayerPlaying()); |
|
226 } |
|
227 |
|
228 mEngine.setContentAreas( sharedContentRect, receivedContentRect ); |
|
229 mEngine.setOrientation( HbInstance::instance()->allMainWindows().at(0)->orientation() ); |
|
230 mEngine.updateSession(); |
|
231 |
|
232 LC_QDEBUG( "livecomms [UI] <- LcView::updateVideoRects()" ) |
|
233 } |
|
234 |
|
235 // ----------------------------------------------------------------------------- |
|
236 // LcView::swap |
|
237 // ----------------------------------------------------------------------------- |
|
238 // |
|
239 void LcView::swap() |
|
240 { |
|
241 LC_QDEBUG( "livecomms [UI] -> LcView::swap()" ) |
|
242 if ( mEffectHandler ){ |
|
243 mEffectHandler->swap(); |
|
244 } |
|
245 LC_QDEBUG( "livecomms [UI] <- LcView::swap()" ) |
|
246 } |
|
247 |
|
248 |
|
249 // ----------------------------------------------------------------------------- |
|
250 // LcView::updateSwapLayout |
|
251 // ----------------------------------------------------------------------------- |
|
252 // |
|
253 |
|
254 void LcView::updateSwapLayout() |
|
255 { |
|
256 mRepository.loadLayout( currentLayout() ); |
|
257 |
|
258 if ( isLandscapeOrientation() ){ |
|
259 if ( mEngine.fullScreenMode() ){ |
|
260 hideControl(); |
|
261 } else { |
|
262 showControl(); |
|
263 } |
|
264 } |
|
265 } |
|
266 |
|
267 // ----------------------------------------------------------------------------- |
|
268 // LcView::updateUiElements |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 void LcView::updateUiElements() |
|
272 { |
|
273 LC_QDEBUG( "livecomms [UI] -> LcView::updateUiElements()" ) |
|
274 |
|
275 if ( isLandscapeOrientation() ) { |
|
276 setContentFullScreen( true ); |
|
277 deActivateFullScreen(); |
|
278 } else { |
|
279 setContentFullScreen( false ); |
|
280 activatePortrait(); |
|
281 } |
|
282 LC_QDEBUG( "livecomms [UI] <- LcView::updateUiElements()" ) |
|
283 } |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // LcView::activated |
|
287 // ----------------------------------------------------------------------------- |
|
288 // |
|
289 void LcView::activated() |
|
290 { |
|
291 LC_QDEBUG( "livecomms [UI] -> LcView::activated()" ) |
|
292 |
|
293 if ( navigationAction() != mSoftKeyBackAction ) { |
|
294 setNavigationAction(mSoftKeyBackAction); |
|
295 } |
|
296 |
|
297 updateVideoRects(); |
|
298 |
|
299 //synchronize with engine |
|
300 |
|
301 if ( mEngine.mainCamera() ) { |
|
302 setCameraActionToSecondary(); |
|
303 } else { |
|
304 setCameraActionToMain(); |
|
305 } |
|
306 |
|
307 if ( mEngine.isMuted() ) { |
|
308 setMuteActionToUnmute(); |
|
309 } else { |
|
310 setMuteActionToMute(); |
|
311 } |
|
312 |
|
313 if ( mEngine.isSpeakerOn() ) { |
|
314 setSpeakerActionToHandset(); |
|
315 } else { |
|
316 setSpeakerActionToSpeaker(); |
|
317 } |
|
318 |
|
319 if ( mChangeCameraAction ) { |
|
320 connect( |
|
321 &mEngine, SIGNAL(cameraChangedToMain()), |
|
322 this, SLOT(setCameraActionToSecondary()) ); |
|
323 connect( |
|
324 &mEngine, SIGNAL(cameraChangedToSecondary()), |
|
325 this, SLOT(setCameraActionToMain())); |
|
326 } |
|
327 |
|
328 if ( mMuteAction ) { |
|
329 connect( |
|
330 &mEngine, SIGNAL(muted()), |
|
331 this, SLOT(setMuteActionToUnmute()) ); |
|
332 connect( |
|
333 &mEngine, SIGNAL(unmuted()), |
|
334 this, SLOT(setMuteActionToMute())); |
|
335 } |
|
336 |
|
337 if ( mSpeakerAction ) { |
|
338 connect( &mEngine, SIGNAL(speakerEnabled()), |
|
339 this, SLOT(setSpeakerActionToHandset()) ); |
|
340 connect( &mEngine, SIGNAL(speakerDisabled()), |
|
341 this, SLOT(setSpeakerActionToSpeaker()) ); |
|
342 } |
|
343 |
|
344 if ( mDisableCameraAction ) { |
|
345 connect( |
|
346 &mEngine, SIGNAL(cameraDisabled()), |
|
347 this, SLOT(setCameraActionToEnable()) ); |
|
348 connect( |
|
349 &mEngine, SIGNAL(cameraEnabled()), |
|
350 this, SLOT(setCameraActionToDisable())); |
|
351 } |
|
352 |
|
353 connect( &mEngine, SIGNAL(blocked()), this, SLOT(disableControls()) ); |
|
354 connect( &mEngine, SIGNAL(unblocked()), this, SLOT(enableControls()) ); |
|
355 |
|
356 if ( mDuration ) { |
|
357 // TODO: clearing is needed for label in order to |
|
358 // get text changed. Seems like bug in orbit side. |
|
359 // This causes that duration is not changed. Workaround |
|
360 // would be to call clear always when duration changes. |
|
361 mDuration->clear(); |
|
362 connect( |
|
363 &mEngine, SIGNAL(sessionDurationChanged(const QString &)), |
|
364 mDuration, SLOT(setPlainText(const QString &)) ); |
|
365 } |
|
366 |
|
367 if ( mRecipient ){ |
|
368 mRecipient->clear(); |
|
369 mRecipient->setPlainText( mEngine.recipient() ); |
|
370 connect( |
|
371 &mEngine, SIGNAL(recipientChanged(const QString &)), |
|
372 mRecipient, SLOT(setPlainText(const QString &)) ); |
|
373 } |
|
374 |
|
375 if ( mSharedVideoWidget ) { |
|
376 connect( &mEngine, SIGNAL(localPlayerPlaying()), |
|
377 mEffectHandler, SLOT(showSendWindow()) ); |
|
378 connect( &mEngine, SIGNAL(localPlayerPaused()), |
|
379 mEffectHandler, SLOT(hideSendWindow()) ); |
|
380 } |
|
381 |
|
382 if ( mReceivedVideoWidget ) { |
|
383 connect( &mEngine, SIGNAL(remotePlayerPlaying()), |
|
384 mEffectHandler, SLOT(showReceiveWindow()) ); |
|
385 connect( &mEngine, SIGNAL(remotePlayerPaused()), |
|
386 mEffectHandler, SLOT(hideReceiveWindow()) ); |
|
387 } |
|
388 |
|
389 mEngine.setCurrentView(this); |
|
390 |
|
391 LC_QDEBUG( "livecomms [UI] <- LcView::activated()" ) |
|
392 } |
|
393 |
|
394 // ----------------------------------------------------------------------------- |
|
395 // LcView::deactivated |
|
396 // ----------------------------------------------------------------------------- |
|
397 // |
|
398 void LcView::deactivated() |
|
399 { |
|
400 LC_QDEBUG( "livecomms [UI] -> LcView::deactivated()" ) |
|
401 QRectF sharedContentRect;//null area |
|
402 QRectF receivedContentRect;//null area |
|
403 |
|
404 mEngine.setContentAreas( sharedContentRect, receivedContentRect ); |
|
405 disconnect( &mEngine, 0, this, 0 ); |
|
406 |
|
407 LC_QDEBUG( "livecomms [UI] <- LcView::deactivated()" ) |
|
408 } |
|
409 |
|
410 // ----------------------------------------------------------------------------- |
|
411 // LcView::notSupported |
|
412 // ----------------------------------------------------------------------------- |
|
413 // |
|
414 void LcView::notSupported() |
|
415 { |
|
416 LC_QDEBUG( "livecomms [UI] -> LcView::notSupported()" ) |
|
417 |
|
418 mNotSupportedNote->show(); |
|
419 resetLandscapeTimer(); |
|
420 |
|
421 LC_QDEBUG( "livecomms [UI] <- LcView::notSupported()" ) |
|
422 } |
|
423 |
|
424 // ----------------------------------------------------------------------------- |
|
425 // LcView::shareImage |
|
426 // ----------------------------------------------------------------------------- |
|
427 // |
|
428 void LcView::shareImage() |
|
429 { |
|
430 LC_QDEBUG( "livecomms [UI] -> LcView::shareImage()" ) |
|
431 const char localImageName[] = "c:\\data\\local.jpg"; |
|
432 QString fileName = QString::fromAscii(localImageName); |
|
433 mEngine.shareImage(fileName); |
|
434 LC_QDEBUG( "livecomms [UI] <- LcView::shareImage()" ) |
|
435 } |
|
436 |
|
437 // ----------------------------------------------------------------------------- |
|
438 // LcView::changeOrientation_Temporary |
|
439 // ----------------------------------------------------------------------------- |
|
440 // |
|
441 void LcView::changeOrientation_Temporary() |
|
442 { |
|
443 LC_QDEBUG( "livecomms [UI] -> LcView::changeOrientation_Temporary()" ) |
|
444 |
|
445 if ( isLandscapeOrientation() ) { |
|
446 HbInstance::instance()->allMainWindows().at(0)->setOrientation( Qt::Vertical ); |
|
447 } else { |
|
448 HbInstance::instance()->allMainWindows().at(0)->setOrientation( Qt::Horizontal ); |
|
449 } |
|
450 |
|
451 LC_QDEBUG( "livecomms [UI] <- LcView::changeOrientation_Temporary()" ) |
|
452 } |
|
453 |
|
454 |
|
455 // ----------------------------------------------------------------------------- |
|
456 // LcView::endVideoSession |
|
457 // ----------------------------------------------------------------------------- |
|
458 // |
|
459 void LcView::endVideoSession() |
|
460 { |
|
461 LC_QDEBUG( "livecomms [UI] -> LcView::endVideoSession()" ) |
|
462 |
|
463 mEngine.stop(); |
|
464 |
|
465 LC_QDEBUG( "livecomms [UI] <- LcView::endVideoSession()" ) |
|
466 |
|
467 } |
|
468 |
|
469 // ----------------------------------------------------------------------------- |
|
470 // LcView::disableCamera |
|
471 // ----------------------------------------------------------------------------- |
|
472 // |
|
473 void LcView::disableCamera() |
|
474 { |
|
475 LC_QDEBUG( "livecomms [UI] -> LcView::disableCamera()" ) |
|
476 |
|
477 mEffectHandler->setDissappearEffect( LcEffectHandler::NormalDissappear ); |
|
478 mEngine.toggleDisableCamera(); |
|
479 resetLandscapeTimer(); |
|
480 |
|
481 LC_QDEBUG( "livecomms [UI] <- LcView::disableCamera()" ) |
|
482 } |
|
483 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // LcView::mute |
|
486 // ----------------------------------------------------------------------------- |
|
487 // |
|
488 void LcView::mute() |
|
489 { |
|
490 LC_QDEBUG( "livecomms [UI] -> LcView::mute()" ) |
|
491 |
|
492 mEngine.toggleMute(); |
|
493 resetLandscapeTimer(); |
|
494 |
|
495 LC_QDEBUG( "livecomms [UI] <- LcView::mute()" ) |
|
496 } |
|
497 |
|
498 // ----------------------------------------------------------------------------- |
|
499 // LcView::changeCamera |
|
500 // ----------------------------------------------------------------------------- |
|
501 // |
|
502 void LcView::changeCamera() |
|
503 { |
|
504 LC_QDEBUG( "livecomms [UI] -> LcView::changeCamera()" ) |
|
505 |
|
506 mEffectHandler->setDissappearEffect( LcEffectHandler::DissappearToFlip ); |
|
507 mEngine.toggleCamera(); |
|
508 resetLandscapeTimer(); |
|
509 |
|
510 LC_QDEBUG( "livecomms [UI] <- LcView::changeCamera()" ) |
|
511 } |
|
512 |
|
513 // ----------------------------------------------------------------------------- |
|
514 // LcView::switchToVoiceCall |
|
515 // ----------------------------------------------------------------------------- |
|
516 // |
|
517 void LcView::switchToVoiceCall() |
|
518 { |
|
519 LC_QDEBUG( "livecomms [UI] -> LcView::switchToVoiceCall()" ) |
|
520 |
|
521 mEngine.stop(); |
|
522 |
|
523 LC_QDEBUG( "livecomms [UI] <- LcView::switchToVoiceCall()" ) |
|
524 } |
|
525 |
|
526 // ----------------------------------------------------------------------------- |
|
527 // LcView::speaker |
|
528 // ----------------------------------------------------------------------------- |
|
529 // |
|
530 void LcView::speaker() |
|
531 { |
|
532 LC_QDEBUG( "livecomms [UI] -> LcView::speaker()" ) |
|
533 |
|
534 mEngine.toggleSpeaker(); |
|
535 resetLandscapeTimer(); |
|
536 |
|
537 LC_QDEBUG( "livecomms [UI] <- LcView::speaker()" ) |
|
538 } |
|
539 |
|
540 // ----------------------------------------------------------------------------- |
|
541 // LcView::showZoom |
|
542 // ----------------------------------------------------------------------------- |
|
543 // |
|
544 void LcView::showZoom() |
|
545 { |
|
546 LC_QDEBUG("livecomms [UI] -> LcView::showZoom()") |
|
547 |
|
548 if ( !mZoomSlider ) { |
|
549 return; |
|
550 } |
|
551 |
|
552 LcControlValues values; |
|
553 mEngine.zoomValues(values); |
|
554 LC_QDEBUG_2("livecomms [UI] MinValue: ", values.mMinValue) |
|
555 LC_QDEBUG_2("livecomms [UI] MaxValue: ", values.mMaxValue) |
|
556 LC_QDEBUG_2("livecomms [UI] CurrentValue: ", values.mValue) |
|
557 |
|
558 mZoomSlider->setRange(values.mMinValue, values.mMaxValue); |
|
559 mZoomSlider->setValue(values.mValue); |
|
560 mZoomSlider->setSingleStep(1); |
|
561 mZoomSlider->setVisible(true); |
|
562 |
|
563 LC_QDEBUG("livecomms [UI] <- LcView::showZoom()") |
|
564 } |
|
565 |
|
566 // ----------------------------------------------------------------------------- |
|
567 // LcView::setCameraActionToMain |
|
568 // ----------------------------------------------------------------------------- |
|
569 // |
|
570 void LcView::setCameraActionToMain() |
|
571 { |
|
572 LC_QDEBUG( "livecomms [UI] -> LcView::setCameraActionToMain()" ) |
|
573 |
|
574 if ( mChangeCameraAction ){ |
|
575 mChangeCameraAction->setIcon (HbIcon( lcIconNameMainCamera )); |
|
576 } |
|
577 LC_QDEBUG( "livecomms [UI] <- LcView::setCameraActionToMain()" ) |
|
578 } |
|
579 |
|
580 // ----------------------------------------------------------------------------- |
|
581 // LcView::setCameraActionToSecondary |
|
582 // ----------------------------------------------------------------------------- |
|
583 // |
|
584 void LcView::setCameraActionToSecondary() |
|
585 { |
|
586 LC_QDEBUG( "livecomms [UI] -> LcView::setCameraActionToSecondary()" ) |
|
587 |
|
588 if ( mChangeCameraAction ){ |
|
589 mChangeCameraAction->setIcon (HbIcon( lcIconNameSecondaryCamera )); |
|
590 } |
|
591 LC_QDEBUG( "livecomms [UI] <- LcView::setCameraActionToSecondary()" ) |
|
592 } |
|
593 |
|
594 // ----------------------------------------------------------------------------- |
|
595 // LcView::setMuteActionToUnmute |
|
596 // ----------------------------------------------------------------------------- |
|
597 // |
|
598 void LcView::setMuteActionToUnmute() |
|
599 { |
|
600 LC_QDEBUG( "livecomms [UI] -> LcView::setMuteActionToUnmute()" ) |
|
601 |
|
602 if ( mMuteAction ){ |
|
603 mMuteAction->setIcon (HbIcon( lcIconNameUnmuteMic )); |
|
604 } |
|
605 LC_QDEBUG( "livecomms [UI] <- LcView::setMuteActionToUnmute()" ) |
|
606 } |
|
607 |
|
608 // ----------------------------------------------------------------------------- |
|
609 // LcView::setMuteActionToMute |
|
610 // ----------------------------------------------------------------------------- |
|
611 // |
|
612 void LcView::setMuteActionToMute() |
|
613 { |
|
614 LC_QDEBUG( "livecomms [UI] -> LcView::setMuteActionToMute()" ) |
|
615 if ( mMuteAction ){ |
|
616 mMuteAction->setIcon (HbIcon( lcIconNameMuteMic )); |
|
617 } |
|
618 LC_QDEBUG( "livecomms [UI] <- LcView::setMuteActionToMute()" ) |
|
619 } |
|
620 |
|
621 // ----------------------------------------------------------------------------- |
|
622 // LcView::setSpeakerActionToHandset |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 void LcView::setSpeakerActionToHandset() |
|
626 { |
|
627 LC_QDEBUG( "livecomms [UI] -> LcView::setSpeakerActionToHandset()" ) |
|
628 if ( mSpeakerAction ){ |
|
629 mSpeakerAction->setIcon (HbIcon( lcIconNameHandset )); |
|
630 } |
|
631 LC_QDEBUG( "livecomms [UI] <- LcView::setSpeakerActionToHandset()" ) |
|
632 } |
|
633 |
|
634 // ----------------------------------------------------------------------------- |
|
635 // LcView::setSpeakerActionToSpeaker |
|
636 // ----------------------------------------------------------------------------- |
|
637 // |
|
638 void LcView::setSpeakerActionToSpeaker() |
|
639 { |
|
640 LC_QDEBUG( "livecomms [UI] -> LcView::setSpeakerActionToSpeaker()" ) |
|
641 if ( mSpeakerAction ){ |
|
642 mSpeakerAction->setIcon( HbIcon( lcIconNameLoudspeaker )); |
|
643 } |
|
644 LC_QDEBUG( "livecomms [UI] <- LcView::setSpeakerActionToSpeaker()" ) |
|
645 } |
|
646 |
|
647 // ----------------------------------------------------------------------------- |
|
648 // LcView::setCameraActionToEnable |
|
649 // ----------------------------------------------------------------------------- |
|
650 // |
|
651 void LcView::setCameraActionToEnable() |
|
652 { |
|
653 LC_QDEBUG( "livecomms [UI] -> LcView::setCameraActionToEnable()" ) |
|
654 |
|
655 if ( mDisableCameraAction ){ |
|
656 mDisableCameraAction->setIcon( HbIcon( lcIconNameEnableCamera )); |
|
657 } |
|
658 if ( mDisableCameraMenuAction ){ |
|
659 // TODO: get text from repository as loc id is not the same for mus |
|
660 mDisableCameraMenuAction->setText( hbTrId( "txt_vt_menu_enable_camera" )); |
|
661 } |
|
662 |
|
663 LC_QDEBUG( "livecomms [UI] <- LcView::setCameraActionToEnable()" ) |
|
664 } |
|
665 |
|
666 // ----------------------------------------------------------------------------- |
|
667 // LcView::setCameraActionToDisable |
|
668 // ----------------------------------------------------------------------------- |
|
669 // |
|
670 void LcView::setCameraActionToDisable() |
|
671 { |
|
672 LC_QDEBUG( "livecomms [UI] -> LcView::setCameraActionToDisable()" ) |
|
673 |
|
674 if ( mDisableCameraAction ){ |
|
675 mDisableCameraAction->setIcon (HbIcon( lcIconNameDisableCamera )); |
|
676 } |
|
677 if ( mDisableCameraMenuAction ){ |
|
678 // TODO: get text from repository as loc id is not the same for mus |
|
679 mDisableCameraMenuAction->setText( hbTrId( "txt_vt_menu_disable_camera" )); |
|
680 } |
|
681 |
|
682 LC_QDEBUG( "livecomms [UI] <- LcView::setCameraActionToDisable()" ) |
|
683 } |
|
684 |
|
685 // ----------------------------------------------------------------------------- |
|
686 // LcView::disableControls |
|
687 // ----------------------------------------------------------------------------- |
|
688 // |
|
689 void LcView::disableControls() |
|
690 { |
|
691 LC_QDEBUG( "livecomms [UI] -> LcView::disableControls()" ) |
|
692 menu()->setEnabled( false ); |
|
693 toolBar()->setEnabled( false ); |
|
694 LC_QDEBUG( "livecomms [UI] <- LcView::disableControls()" ) |
|
695 } |
|
696 |
|
697 // ----------------------------------------------------------------------------- |
|
698 // LcView::enableControls |
|
699 // ----------------------------------------------------------------------------- |
|
700 // |
|
701 void LcView::enableControls() |
|
702 { |
|
703 LC_QDEBUG( "livecomms [UI] -> LcView::enableControls()" ) |
|
704 menu()->setEnabled( true ); |
|
705 toolBar()->setEnabled( true ); |
|
706 LC_QDEBUG( "livecomms [UI] <- LcView::enableControls()" ) |
|
707 } |
|
708 |
|
709 // ----------------------------------------------------------------------------- |
|
710 // LcView::gestureEvent |
|
711 // ----------------------------------------------------------------------------- |
|
712 // |
|
713 void LcView::gestureEvent(QGestureEvent *event) |
|
714 { |
|
715 LC_QDEBUG( "livecomms [UI] -> LcView::gestureEvent()" ) |
|
716 if(HbTapGesture *tap = static_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) { |
|
717 |
|
718 if ((tap->state() == Qt::GestureUpdated) && |
|
719 (tap->tapStyleHint() == HbTapGesture::TapAndHold)) { |
|
720 |
|
721 gestureLongPress(translatePointForOrientation(tap->position())); |
|
722 } |
|
723 |
|
724 else if ( (tap->state() == Qt::GestureFinished ) && |
|
725 ( tap->tapStyleHint() == HbTapGesture::Tap)) { |
|
726 |
|
727 gestureShortPress(); |
|
728 } |
|
729 } |
|
730 LC_QDEBUG( "livecomms [UI] <- LcView::gestureEvent()" ) |
|
731 } |
|
732 |
|
733 |
|
734 // ----------------------------------------------------------------------------- |
|
735 // LcView::gestureLongPress |
|
736 // ----------------------------------------------------------------------------- |
|
737 // |
|
738 void LcView::gestureLongPress(QPointF coords) |
|
739 { |
|
740 LC_QDEBUG_2( "livecomms [UI] -> LcView::gestureLongPress(), coords:", coords ) |
|
741 |
|
742 bool sharedHit = false; |
|
743 |
|
744 if ( mSharedVideoWidget && mSharedVideoWidget->windowFrameGeometry().contains(coords) ) { |
|
745 LC_QDEBUG( "livecomms [UI] LcView mapped to mSharedVideoWidget" ) |
|
746 sharedHit = true; |
|
747 } |
|
748 |
|
749 if ( sharedHit ) { |
|
750 LC_QDEBUG( "livecomms [UI] LcView mapped to mSharedVideoWidget" ) |
|
751 |
|
752 createContextMenu(); |
|
753 mRepository.sharedVideoContextMenuActions( mItemContextMenu, *this ); |
|
754 |
|
755 if ( mItemContextMenu->actions().count() > 0 ) { |
|
756 mItemContextMenu->open(this); |
|
757 } |
|
758 } |
|
759 |
|
760 LC_QDEBUG( "livecomms [UI] <- LcView::gestureLongPress()" ) |
|
761 } |
|
762 |
|
763 |
|
764 |
|
765 // ----------------------------------------------------------------------------- |
|
766 // LcView::gestureShortPress |
|
767 // ----------------------------------------------------------------------------- |
|
768 // |
|
769 void LcView::gestureShortPress() |
|
770 { |
|
771 if ( isLandscapeOrientation() ) { |
|
772 if ( mEngine.fullScreenMode() ) { |
|
773 deActivateFullScreen(); |
|
774 } else { |
|
775 activateFullScreen(); |
|
776 } |
|
777 } |
|
778 } |
|
779 |
|
780 |
|
781 // ----------------------------------------------------------------------------- |
|
782 // LcView::landscapeTimerTimeout |
|
783 // ----------------------------------------------------------------------------- |
|
784 // |
|
785 void LcView::landscapeTimerTimeout() |
|
786 { |
|
787 LC_QDEBUG( "livecomms [UI] -> LcView::landscapeTimerTimeout()" ) |
|
788 if (!mIsOptionMenuOpen && isLandscapeOrientation() ) |
|
789 activateFullScreen(); |
|
790 LC_QDEBUG( "livecomms [UI] <- LcView::landscapeTimerTimeout()" ) |
|
791 } |
|
792 |
|
793 // ----------------------------------------------------------------------------- |
|
794 // LcView::createNotSupportedNote |
|
795 // ----------------------------------------------------------------------------- |
|
796 // |
|
797 void LcView::createNotSupportedNote() |
|
798 { |
|
799 LC_QDEBUG( "livecomms [UI] -> LcView::createNotSupportedNote()" ) |
|
800 |
|
801 if ( !mNotSupportedNote ){ |
|
802 mNotSupportedNote = new HbMessageBox(QString("Not supported")); |
|
803 mNotSupportedNote->setTimeout(HbDialog::StandardTimeout); |
|
804 mNotSupportedNote->setZValue(LC_NOTE_ON_TOP); |
|
805 mNotSupportedNote->hide(); |
|
806 } |
|
807 |
|
808 LC_QDEBUG( "livecomms [UI] <- LcView::createNotSupportedNote()" ) |
|
809 } |
|
810 |
|
811 |
|
812 |
|
813 // ----------------------------------------------------------------------------- |
|
814 // LcView::createContextMenu |
|
815 // ----------------------------------------------------------------------------- |
|
816 // |
|
817 void LcView::createContextMenu() |
|
818 { |
|
819 LC_QDEBUG( "livecomms [UI] -> LcView::createContextMenu()" ) |
|
820 |
|
821 // mItemContextMenu is destroyed upon close |
|
822 mItemContextMenu = new HbMenu(); |
|
823 mItemContextMenu->setDismissPolicy(HbDialog::TapOutside); |
|
824 mItemContextMenu->setTimeout(HbDialog::ContextMenuTimeout); |
|
825 mItemContextMenu->setAttribute(Qt::WA_DeleteOnClose); |
|
826 |
|
827 LC_QDEBUG( "livecomms [UI] <- LcView::createContextMenu()" ) |
|
828 } |
|
829 |
|
830 // ----------------------------------------------------------------------------- |
|
831 // LcView::activateFullScreen |
|
832 // ----------------------------------------------------------------------------- |
|
833 // |
|
834 void LcView::activateFullScreen() |
|
835 { |
|
836 LC_QDEBUG( "livecomms [UI] -> LcView::activateFullScreen()" ) |
|
837 |
|
838 if ( mLandscapeTimer ) { |
|
839 mLandscapeTimer->stop(); |
|
840 mEngine.setFullScreenMode(true); |
|
841 hideControl(); |
|
842 } |
|
843 |
|
844 LC_QDEBUG( "livecomms [UI] <- LcView::activateFullScreen()" ) |
|
845 } |
|
846 |
|
847 |
|
848 // ----------------------------------------------------------------------------- |
|
849 // LcView::deActivateFullScreen |
|
850 // ----------------------------------------------------------------------------- |
|
851 // |
|
852 void LcView::deActivateFullScreen() |
|
853 { |
|
854 LC_QDEBUG( "livecomms [UI] -> LcView::deActivateFullScreen()" ) |
|
855 |
|
856 if ( mLandscapeTimer ) { |
|
857 mLandscapeTimer->stop(); |
|
858 |
|
859 mEngine.setFullScreenMode(false); |
|
860 |
|
861 showControl(); |
|
862 mLandscapeTimer->start( inActivityTimeout ); |
|
863 } |
|
864 LC_QDEBUG( "livecomms [UI] <- LcView::deActivateFullScreen()" ) |
|
865 } |
|
866 |
|
867 // ----------------------------------------------------------------------------- |
|
868 // LcView::activateFullScreen |
|
869 // ----------------------------------------------------------------------------- |
|
870 // |
|
871 void LcView::activatePortrait() |
|
872 { |
|
873 LC_QDEBUG( "livecomms [UI] -> LcView::activatePortrait()" ) |
|
874 |
|
875 if ( mLandscapeTimer ) { |
|
876 mLandscapeTimer->stop(); |
|
877 mEngine.setFullScreenMode(false); |
|
878 showControl(); |
|
879 } |
|
880 |
|
881 LC_QDEBUG( "livecomms [UI] <- LcView::activatePortrait()" ) |
|
882 } |
|
883 |
|
884 |
|
885 // ----------------------------------------------------------------------------- |
|
886 // LcView::hideControl |
|
887 // ----------------------------------------------------------------------------- |
|
888 // |
|
889 void LcView::hideControl() |
|
890 { |
|
891 if( mDialpad && mDialpad->isOpen()) { |
|
892 return; |
|
893 } |
|
894 toolBar()->hide(); |
|
895 setTitleBarVisible(false); |
|
896 setVisibility(mEndCallButton, false); |
|
897 setVisibility(mBrandIcon, false); |
|
898 setVisibility(mDuration, false); |
|
899 setVisibility(mRecipient, false); |
|
900 } |
|
901 |
|
902 |
|
903 // ----------------------------------------------------------------------------- |
|
904 // LcView::showControl |
|
905 // ----------------------------------------------------------------------------- |
|
906 // |
|
907 void LcView::showControl() |
|
908 { |
|
909 if( mDialpad && mDialpad->isOpen()) { |
|
910 return; |
|
911 } |
|
912 setTitleBarVisible(true); |
|
913 toolBar()->show(); |
|
914 setVisibility(mEndCallButton, true); |
|
915 setVisibility(mBrandIcon, true); |
|
916 setVisibility(mDuration, true); |
|
917 setVisibility(mRecipient, true); |
|
918 } |
|
919 |
|
920 |
|
921 // ----------------------------------------------------------------------------- |
|
922 // LcView::currentLayout |
|
923 // ----------------------------------------------------------------------------- |
|
924 // |
|
925 QString LcView::currentLayout() |
|
926 { |
|
927 QString layout( lcLayoutPortraitDefaultId ); |
|
928 |
|
929 if ( !isLandscapeOrientation() ) { |
|
930 if ( mEffectHandler->isSwapInProgress() && |
|
931 mSharedVideoWidget && |
|
932 mReceivedVideoWidget && |
|
933 mSharedVideoWidget->geometry().top() > mReceivedVideoWidget->geometry().top() ) { |
|
934 |
|
935 layout = lcLayoutPortraitSwappedId; |
|
936 } else { |
|
937 layout = lcLayoutPortraitDefaultId; |
|
938 } |
|
939 } else { |
|
940 if ( mEffectHandler->isSwapInProgress() && |
|
941 mSharedVideoWidget && |
|
942 mReceivedVideoWidget && |
|
943 mSharedVideoWidget->geometry().left() > mReceivedVideoWidget->geometry().left() ) { |
|
944 |
|
945 layout = lcLayoutLandscapeSwappedId; |
|
946 } else { |
|
947 layout = lcLayoutLandscapeDefaultId; |
|
948 } |
|
949 } |
|
950 LC_QDEBUG_2( "livecomms [UI] -> LcView::currentLayout()", layout ) |
|
951 return layout; |
|
952 } |
|
953 |
|
954 |
|
955 // ----------------------------------------------------------------------------- |
|
956 // LcView::menuAboutToShow |
|
957 // ----------------------------------------------------------------------------- |
|
958 // |
|
959 void LcView::menuAboutToShow() |
|
960 { |
|
961 LC_QDEBUG( "livecomms [UI] -> LcView::menuAboutToShow()" ) |
|
962 mIsOptionMenuOpen = true; |
|
963 if( mLandscapeTimer ){ |
|
964 mLandscapeTimer->stop(); |
|
965 } |
|
966 LC_QDEBUG( "livecomms [UI] <- LcView::menuAboutToShow()" ) |
|
967 } |
|
968 |
|
969 // ----------------------------------------------------------------------------- |
|
970 // LcView::menuAboutToHide |
|
971 // ----------------------------------------------------------------------------- |
|
972 // |
|
973 void LcView::menuAboutToHide() |
|
974 { |
|
975 LC_QDEBUG( "livecomms [UI] -> LcView::menuAboutToHide()" ) |
|
976 mIsOptionMenuOpen = false; |
|
977 if( mLandscapeTimer ){ |
|
978 mLandscapeTimer->start( inActivityTimeout ); |
|
979 } |
|
980 LC_QDEBUG( "livecomms [UI] <- LcView::menuAboutToHide()" ) |
|
981 } |
|
982 |
|
983 // ----------------------------------------------------------------------------- |
|
984 // LcView::isLandscapeOrientation |
|
985 // ----------------------------------------------------------------------------- |
|
986 // |
|
987 bool LcView::isLandscapeOrientation() |
|
988 { |
|
989 return ( !HbInstance::instance()->allMainWindows().isEmpty() && |
|
990 HbInstance::instance()->allMainWindows().at(0)->orientation() == Qt::Horizontal ); |
|
991 } |
|
992 |
|
993 // ----------------------------------------------------------------------------- |
|
994 // LcView::translateRectForOrientation |
|
995 // Video windows at engine side do not change their coordinate system |
|
996 // when orientation at orbit UI changes. Therefore we need to convert video |
|
997 // rects from landscape coordinate system to portait coordinate system. |
|
998 // NOTE: Landscape orientation has different rotation in emulator than in HW. |
|
999 // ----------------------------------------------------------------------------- |
|
1000 // |
|
1001 QRectF LcView::translateRectForOrientation(const QRectF& origRect) |
|
1002 { |
|
1003 if ( !isLandscapeOrientation() ){ |
|
1004 return origRect; |
|
1005 } |
|
1006 QRectF newRect = origRect; |
|
1007 QMatrix m; |
|
1008 #if ( defined __WINSCW__ ) || ( defined __WINS__ ) |
|
1009 m.rotate(270); |
|
1010 newRect = m.mapRect(newRect); |
|
1011 newRect.translate(0,HbInstance::instance()->allMainWindows().at(0)->rect().height()); |
|
1012 #else |
|
1013 m.rotate(90); |
|
1014 newRect = m.mapRect(newRect); |
|
1015 newRect.translate(HbInstance::instance()->allMainWindows().at(0)->rect().width(),0); |
|
1016 #endif |
|
1017 return newRect; |
|
1018 } |
|
1019 |
|
1020 // ----------------------------------------------------------------------------- |
|
1021 // |
|
1022 // ----------------------------------------------------------------------------- |
|
1023 // |
|
1024 QPointF LcView::translatePointForOrientation(const QPointF& origPoint) |
|
1025 { |
|
1026 if ( !isLandscapeOrientation() ) { |
|
1027 return origPoint; |
|
1028 } |
|
1029 QPointF newPoint = origPoint; |
|
1030 QMatrix m; |
|
1031 #if ( defined __WINSCW__ ) || ( defined __WINS__ ) |
|
1032 m.translate(HbInstance::instance()->allMainWindows().at(0)->rect().height(),0); |
|
1033 m.rotate(90); |
|
1034 newPoint = m.map(newPoint); |
|
1035 #else |
|
1036 m.translate(0,HbInstance::instance()->allMainWindows().at(0)->rect().width()); |
|
1037 m.rotate(270); |
|
1038 newPoint = m.map(newPoint); |
|
1039 #endif |
|
1040 return newPoint; |
|
1041 } |
|
1042 |
|
1043 // ----------------------------------------------------------------------------- |
|
1044 // |
|
1045 // ----------------------------------------------------------------------------- |
|
1046 // |
|
1047 void LcView::setVisibility( QGraphicsItem* item, bool visible ) |
|
1048 { |
|
1049 if ( item ) { |
|
1050 item->setVisible(visible); |
|
1051 } |
|
1052 } |
|
1053 |
|
1054 // ----------------------------------------------------------------------------- |
|
1055 // |
|
1056 // ----------------------------------------------------------------------------- |
|
1057 // |
|
1058 void LcView::resetLandscapeTimer() |
|
1059 { |
|
1060 if ( mLandscapeTimer && mLandscapeTimer->isActive() ) { |
|
1061 mLandscapeTimer->stop(); |
|
1062 mLandscapeTimer->start( inActivityTimeout ); |
|
1063 } |
|
1064 } |
|
1065 |
|
1066 void LcView::addOptionsMenuActions() |
|
1067 { |
|
1068 HbAction* swapAction = static_cast<HbAction*>( |
|
1069 mRepository.findObject(lcActSwapViewsId)); |
|
1070 menu()->addAction(swapAction); |
|
1071 |
|
1072 HbAction* openKeypadAction = static_cast<HbAction*>( |
|
1073 mRepository.findObject(lcActOpenKeypadId)); |
|
1074 menu()->addAction(openKeypadAction); |
|
1075 } |
|
1076 |
|
1077 // ----------------------------------------------------------------------------- |
|
1078 // LcView::openDialpad() |
|
1079 // ----------------------------------------------------------------------------- |
|
1080 // |
|
1081 void LcView::openDialpad() |
|
1082 { |
|
1083 LC_QDEBUG("livecomms [UI] -> LcView::openDialpad()") |
|
1084 // stop the auto full screen timer. |
|
1085 if( mLandscapeTimer ){ |
|
1086 mLandscapeTimer->stop(); |
|
1087 } |
|
1088 mEngine.setFullScreenMode( false ); |
|
1089 |
|
1090 // load dialpad layout |
|
1091 mRepository.loadLayout( lcLayoutLandscapeDialpadId ); |
|
1092 updateVideoRects(); |
|
1093 |
|
1094 // construct dialpad and connect signals. |
|
1095 mDialpad = static_cast<Dialpad*> ( mRepository.findWidget("lc_label_dialpad") ); |
|
1096 connect( mDialpad, SIGNAL(aboutToClose()), SLOT(dialpadClosed()) ); |
|
1097 connect( mDialpad, SIGNAL(aboutToOpen()), SLOT(dialpadOpened()) ); |
|
1098 connect( &mDialpad->editor(), SIGNAL( contentsChanged() ), this, |
|
1099 SLOT( dialpadEditorTextChanged() ) ); |
|
1100 // open dialpad |
|
1101 mDialpad->openDialpad(); |
|
1102 |
|
1103 menu()->clearActions(); |
|
1104 |
|
1105 if ( mEffectHandler ){ |
|
1106 mEffectHandler->startEffects(); |
|
1107 } |
|
1108 LC_QDEBUG("livecomms [UI] <- LcView::openDialpad()") |
|
1109 } |
|
1110 |
|
1111 // ----------------------------------------------------------------------------- |
|
1112 // LcView::dialpadOpened() |
|
1113 // ----------------------------------------------------------------------------- |
|
1114 // |
|
1115 void LcView::dialpadOpened() |
|
1116 { |
|
1117 LC_QDEBUG("livecomms [UI] <-> LcView::dialpadOpened()") |
|
1118 } |
|
1119 |
|
1120 // ----------------------------------------------------------------------------- |
|
1121 // LcView::dialpadClosed() |
|
1122 // ----------------------------------------------------------------------------- |
|
1123 // |
|
1124 void LcView::dialpadClosed() |
|
1125 { |
|
1126 LC_QDEBUG("livecomms [UI] -> LcView::dialpadClosed()") |
|
1127 disconnect( &mDialpad->editor(), SIGNAL( contentsChanged() ), this, |
|
1128 SLOT( dialpadEditorTextChanged() ) ); |
|
1129 disconnect( mDialpad, SIGNAL(aboutToClose()), this, SLOT(dialpadClosed()) ); |
|
1130 disconnect( mDialpad, SIGNAL(aboutToOpen()), this, SLOT(dialpadOpened()) ); |
|
1131 |
|
1132 mDialpad = 0; // do not delete it since it is not owned. |
|
1133 |
|
1134 addOptionsMenuActions(); |
|
1135 |
|
1136 // switch back to the previous layout |
|
1137 QString pLayout = mRepository.previousLayout(); |
|
1138 QString layout; |
|
1139 bool isSwapped = ( pLayout == lcLayoutPortraitDefaultId || |
|
1140 pLayout == lcLayoutLandscapeDefaultId ) |
|
1141 ? false : true; |
|
1142 // take care orientation changes |
|
1143 bool isLandscape = isLandscapeOrientation(); |
|
1144 if ( isLandscape ){ |
|
1145 layout = ( isSwapped ) ? lcLayoutLandscapeSwappedId |
|
1146 : lcLayoutLandscapeDefaultId; |
|
1147 |
|
1148 } |
|
1149 else { |
|
1150 layout = ( isSwapped ) ? lcLayoutPortraitSwappedId |
|
1151 : lcLayoutPortraitDefaultId; |
|
1152 } |
|
1153 // load the layout |
|
1154 mRepository.loadLayout( layout ); |
|
1155 // update the videoplayer hole |
|
1156 updateVideoRects(); |
|
1157 // now do some effects |
|
1158 if ( mEffectHandler ){ |
|
1159 mEffectHandler->startEffects(); |
|
1160 } |
|
1161 // deactivate full screen untill inactivity timeout happens. |
|
1162 if ( isLandscape ){ |
|
1163 deActivateFullScreen(); |
|
1164 } |
|
1165 |
|
1166 LC_QDEBUG("livecomms [UI] <- LcView::dialpadClosed()") |
|
1167 } |
|
1168 |
|
1169 // ----------------------------------------------------------------------------- |
|
1170 // LcView::dialpadEditorTextChanged() |
|
1171 // ----------------------------------------------------------------------------- |
|
1172 // |
|
1173 void LcView::dialpadEditorTextChanged() |
|
1174 { |
|
1175 LC_QDEBUG_2("livecomms [UI] -> Dial Pad Field ", mDialpad->editor().text()); |
|
1176 LC_QDEBUG_2("livecomms [UI] -> Last Dialled Charcter ", mDialpad->editor().text().right(1)); |
|
1177 bool dialPadStatus = mEngine.SendDialTone(mDialpad->editor().text().right(1).at(0)); |
|
1178 LC_QDEBUG_2("livecomms [UI] -> Dialpad Send Tone Status ",dialPadStatus) |
|
1179 } |
|
1180 |
|
1181 // ----------------------------------------------------------------------------- |
|
1182 // LcView::enableDialpadCallButton() |
|
1183 // ----------------------------------------------------------------------------- |
|
1184 // |
|
1185 void LcView::enableDialpadCallButton( bool enable ) |
|
1186 { |
|
1187 LC_QDEBUG_2("livecomms [UI] -> Enable callbutton, emergency call ",enable) |
|
1188 mDialpad->setCallButtonEnabled( enable ); |
|
1189 } |
|
1190 |
|
1191 // ----------------------------------------------------------------------------- |
|
1192 // LcView::back |
|
1193 // ----------------------------------------------------------------------------- |
|
1194 // |
|
1195 void LcView::back() |
|
1196 { |
|
1197 LC_QDEBUG("livecomms [UI] -> LcView::back()") |
|
1198 if ( mDialpad && mDialpad->isOpen()) { |
|
1199 LC_QDEBUG("livecomms [UI] - Closing dialpad") |
|
1200 mDialpad->closeDialpad(); |
|
1201 } else { |
|
1202 mEngine.minimize(); |
|
1203 } |
|
1204 |
|
1205 LC_QDEBUG("livecomms [UI] <- LcView::back()") |
|
1206 } |
|
1207 |
|
1208 // End of file |