mmsharing/livecommsui/lcui/src/lcview.cpp
changeset 25 53c1c4459a94
parent 22 496ad160a278
child 26 5554410e16f5
equal deleted inserted replaced
22:496ad160a278 25:53c1c4459a94
    72    mZoomSlider(0),
    72    mZoomSlider(0),
    73    mEndCallButton(0),
    73    mEndCallButton(0),
    74    mReceivedVideoEffectOverlay(0),
    74    mReceivedVideoEffectOverlay(0),
    75    mSharedVideoEffectOverlay(0),
    75    mSharedVideoEffectOverlay(0),
    76    mEffectHandler(0),
    76    mEffectHandler(0),
    77    mItemContextMenu(0),
    77    mItemContextMenu(0),   
    78    mLandscapeTimer(0),
       
    79    mIsOptionMenuOpen(false),
    78    mIsOptionMenuOpen(false),
    80    mSoftKeyBackAction(0),
    79    mSoftKeyBackAction(0),
    81    mDialpad(0)
    80    mDialpad(0),
       
    81    timerId(0)
    82 {
    82 {
    83     LC_QDEBUG( "livecomms [UI] -> LcView::LcView()" )
    83     LC_QDEBUG( "livecomms [UI] -> LcView::LcView()" )
    84     
    84     
    85     createNotSupportedNote();
    85     createNotSupportedNote();
    86 
    86 
   103     LC_QDEBUG( "livecomms [UI] -> LcView::~LcView()" )
   103     LC_QDEBUG( "livecomms [UI] -> LcView::~LcView()" )
   104 
   104 
   105     // Un-subscribe to the gesture events.
   105     // Un-subscribe to the gesture events.
   106     ungrabGesture(Qt::TapGesture);        
   106     ungrabGesture(Qt::TapGesture);        
   107 
   107 
   108     delete mEffectHandler;
   108     delete mEffectHandler;    
   109     delete mLandscapeTimer;
       
   110     delete mNotSupportedNote;
   109     delete mNotSupportedNote;
   111 
   110 
   112     LC_QDEBUG( "livecomms [UI] <- LcView::~LcView()" )
   111     LC_QDEBUG( "livecomms [UI] <- LcView::~LcView()" )
   113 }
   112 }
   114 
   113 
   170         
   169         
   171     if ( mReceivedVideoEffectOverlay ) {
   170     if ( mReceivedVideoEffectOverlay ) {
   172         mReceivedVideoEffectOverlay->show();
   171         mReceivedVideoEffectOverlay->show();
   173     }
   172     }
   174 
   173 
       
   174     // swap
   175     mEffectHandler = new LcEffectHandler( mEngine,
   175     mEffectHandler = new LcEffectHandler( mEngine,
   176             mSharedVideoWidget, mSharedVideoEffectOverlay, 
   176             mSharedVideoWidget, mSharedVideoEffectOverlay, 
   177             mReceivedVideoWidget, mReceivedVideoEffectOverlay);
   177             mReceivedVideoWidget, mReceivedVideoEffectOverlay);
   178     connect( mEffectHandler, SIGNAL(swapCompleted()), this, SLOT(updateVideoRects()) );
   178     connect( mEffectHandler, SIGNAL(swapCompleted()), this, SLOT(updateVideoRects()) );
   179 
       
   180     connect( mEffectHandler, SIGNAL(loadSwapLayout()), this, SLOT(updateSwapLayout()) );
   179     connect( mEffectHandler, SIGNAL(loadSwapLayout()), this, SLOT(updateSwapLayout()) );
   181     
   180     
   182     mLandscapeTimer = new QTimer();
   181     // menu
   183     connect( mLandscapeTimer, SIGNAL(timeout()), this, SLOT(landscapeTimerTimeout()) );
       
   184 
       
   185     updateUiElements();
       
   186 
       
   187     if ( menu()) {
   182     if ( menu()) {
   188         connect( menu(), SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()) );
   183         connect( menu(), SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()) );
   189         connect( menu(), SIGNAL(aboutToHide()), this, SLOT(menuAboutToHide()) );
   184         connect( menu(), SIGNAL(aboutToHide()), this, SLOT(watchInactivity()) );        
   190     }
   185     }     
   191      
       
   192     mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this);    
   186     mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this);    
   193     connect(mSoftKeyBackAction, SIGNAL(triggered()), SLOT(back()));
   187     connect(mSoftKeyBackAction, SIGNAL(triggered()), SLOT(back()));
       
   188     
       
   189     // dialpad
       
   190     mDialpad = static_cast<Dialpad*> ( mRepository.findWidget("lc_label_dialpad") );
       
   191     connect( mDialpad, SIGNAL(aboutToClose()), SLOT(dialpadClosed()) );
       
   192     connect( mDialpad, SIGNAL(aboutToOpen()), SLOT(dialpadOpened()) );
       
   193     connect( &mDialpad->editor(), SIGNAL( contentsChanged() ), SLOT( dialpadEditorTextChanged() ) );
   194         
   194         
       
   195     // inactivity
       
   196     timerId = this->startTimer( inActivityTimeout );    
       
   197     connect( this, SIGNAL( contentFullScreenChanged() ), SLOT( watchInactivity() ) ) ;
       
   198     
       
   199     // activate fullscreen at beginning if inactivity timesout
       
   200     toFullScreen( true );
       
   201     
   195     LC_QDEBUG( "livecomms [UI] <- LcView::init()" )
   202     LC_QDEBUG( "livecomms [UI] <- LcView::init()" )
   196 }
   203 }
   197 
   204 
   198 
   205 
   199 // -----------------------------------------------------------------------------
   206 // -----------------------------------------------------------------------------
   252 //
   259 //
   253 
   260 
   254 void LcView::updateSwapLayout()
   261 void LcView::updateSwapLayout()
   255 {
   262 {
   256     mRepository.loadLayout( currentLayout() );
   263     mRepository.loadLayout( currentLayout() );
   257 
   264     toFullScreen( true );
   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 }
   265 }
   284 
   266 
   285 // -----------------------------------------------------------------------------
   267 // -----------------------------------------------------------------------------
   286 // LcView::activated
   268 // LcView::activated
   287 // -----------------------------------------------------------------------------
   269 // -----------------------------------------------------------------------------
   414 void LcView::notSupported()
   396 void LcView::notSupported()
   415 {
   397 {
   416     LC_QDEBUG( "livecomms [UI] -> LcView::notSupported()" )
   398     LC_QDEBUG( "livecomms [UI] -> LcView::notSupported()" )
   417     
   399     
   418     mNotSupportedNote->show();
   400     mNotSupportedNote->show();
   419     resetLandscapeTimer();
   401     toFullScreen( false );
   420     
   402     
   421     LC_QDEBUG( "livecomms [UI] <- LcView::notSupported()" )
   403     LC_QDEBUG( "livecomms [UI] <- LcView::notSupported()" )
   422 }
   404 }
   423 
   405 
   424 // -----------------------------------------------------------------------------
   406 // -----------------------------------------------------------------------------
   433     mEngine.shareImage(fileName);
   415     mEngine.shareImage(fileName);
   434     LC_QDEBUG( "livecomms [UI] <- LcView::shareImage()" )
   416     LC_QDEBUG( "livecomms [UI] <- LcView::shareImage()" )
   435 }
   417 }
   436 
   418 
   437 // -----------------------------------------------------------------------------
   419 // -----------------------------------------------------------------------------
   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
   420 // LcView::endVideoSession
   457 // -----------------------------------------------------------------------------
   421 // -----------------------------------------------------------------------------
   458 //
   422 //
   459 void LcView::endVideoSession()
   423 void LcView::endVideoSession()
   460 {
   424 {
   474 {
   438 {
   475     LC_QDEBUG( "livecomms [UI] -> LcView::disableCamera()" )
   439     LC_QDEBUG( "livecomms [UI] -> LcView::disableCamera()" )
   476  
   440  
   477     mEffectHandler->setDissappearEffect( LcEffectHandler::NormalDissappear );
   441     mEffectHandler->setDissappearEffect( LcEffectHandler::NormalDissappear );
   478     mEngine.toggleDisableCamera();
   442     mEngine.toggleDisableCamera();
   479     resetLandscapeTimer();
   443     toFullScreen( false );
   480     
   444     
   481     LC_QDEBUG( "livecomms [UI] <- LcView::disableCamera()" ) 
   445     LC_QDEBUG( "livecomms [UI] <- LcView::disableCamera()" ) 
   482 }
   446 }
   483 
   447 
   484 // -----------------------------------------------------------------------------
   448 // -----------------------------------------------------------------------------
   488 void LcView::mute()
   452 void LcView::mute()
   489 {
   453 {
   490     LC_QDEBUG( "livecomms [UI] -> LcView::mute()" )
   454     LC_QDEBUG( "livecomms [UI] -> LcView::mute()" )
   491     
   455     
   492     mEngine.toggleMute();
   456     mEngine.toggleMute();
   493     resetLandscapeTimer();
   457     toFullScreen( false );
   494     
   458     
   495     LC_QDEBUG( "livecomms [UI] <- LcView::mute()" )
   459     LC_QDEBUG( "livecomms [UI] <- LcView::mute()" )
   496 }
   460 }
   497 
   461 
   498 // -----------------------------------------------------------------------------
   462 // -----------------------------------------------------------------------------
   503 {
   467 {
   504     LC_QDEBUG( "livecomms [UI] -> LcView::changeCamera()" )
   468     LC_QDEBUG( "livecomms [UI] -> LcView::changeCamera()" )
   505    
   469    
   506     mEffectHandler->setDissappearEffect( LcEffectHandler::DissappearToFlip );
   470     mEffectHandler->setDissappearEffect( LcEffectHandler::DissappearToFlip );
   507     mEngine.toggleCamera();
   471     mEngine.toggleCamera();
   508     resetLandscapeTimer();
   472     toFullScreen( false );
   509         
   473         
   510     LC_QDEBUG( "livecomms [UI] <- LcView::changeCamera()" )
   474     LC_QDEBUG( "livecomms [UI] <- LcView::changeCamera()" )
   511 }
   475 }
   512 
   476 
   513 // -----------------------------------------------------------------------------
   477 // -----------------------------------------------------------------------------
   530 void LcView::speaker()
   494 void LcView::speaker()
   531 {
   495 {
   532     LC_QDEBUG( "livecomms [UI] -> LcView::speaker()" )
   496     LC_QDEBUG( "livecomms [UI] -> LcView::speaker()" )
   533 
   497 
   534     mEngine.toggleSpeaker();
   498     mEngine.toggleSpeaker();
   535     resetLandscapeTimer();
   499     toFullScreen( false );
   536     
   500     
   537     LC_QDEBUG( "livecomms [UI] <- LcView::speaker()" )    
   501     LC_QDEBUG( "livecomms [UI] <- LcView::speaker()" )    
   538 }
   502 }
   539 
   503 
   540 // -----------------------------------------------------------------------------
   504 // -----------------------------------------------------------------------------
   711 // -----------------------------------------------------------------------------
   675 // -----------------------------------------------------------------------------
   712 //
   676 //
   713 void LcView::gestureEvent(QGestureEvent *event)
   677 void LcView::gestureEvent(QGestureEvent *event)
   714 {
   678 {
   715     LC_QDEBUG( "livecomms [UI] -> LcView::gestureEvent()" )
   679     LC_QDEBUG( "livecomms [UI] -> LcView::gestureEvent()" )
   716     if(HbTapGesture *tap = static_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) {
   680     if(HbTapGesture *tap = static_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) {        
   717     
       
   718         if ((tap->state() == Qt::GestureUpdated) &&
   681         if ((tap->state() == Qt::GestureUpdated) &&
   719             (tap->tapStyleHint() == HbTapGesture::TapAndHold)) {
   682             (tap->tapStyleHint() == HbTapGesture::TapAndHold)) {            
   720           
       
   721             gestureLongPress(translatePointForOrientation(tap->position()));
   683             gestureLongPress(translatePointForOrientation(tap->position()));
   722         } 
   684         } 
   723         
   685         
   724         else if ( (tap->state() == Qt::GestureFinished ) &&
   686         else if ( (tap->state() == Qt::GestureFinished ) &&
   725                 ( tap->tapStyleHint() == HbTapGesture::Tap)) {
   687                 ( tap->tapStyleHint() == HbTapGesture::Tap)) {
   726         
   688         
   727             gestureShortPress();
   689             gestureShortPress();
   728         }
   690         }        
   729     }
   691     }
   730     LC_QDEBUG( "livecomms [UI] <- LcView::gestureEvent()" )
   692     LC_QDEBUG( "livecomms [UI] <- LcView::gestureEvent()" )
   731 }
   693 }
   732 
   694 
   733 
   695 
   766 // LcView::gestureShortPress
   728 // LcView::gestureShortPress
   767 // -----------------------------------------------------------------------------
   729 // -----------------------------------------------------------------------------
   768 //
   730 //
   769 void LcView::gestureShortPress()
   731 void LcView::gestureShortPress()
   770 {
   732 {
   771     if ( isLandscapeOrientation() ) {    
   733     LC_QDEBUG( "livecomms [UI] -> LcView::gestureShortPress()" )
   772         if ( mEngine.fullScreenMode() ) {
   734     toFullScreen( !mEngine.fullScreenMode() );
   773             deActivateFullScreen();
   735     LC_QDEBUG( "livecomms [UI] <- LcView::gestureShortPress()" )
   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 }
   736 }
   792 
   737 
   793 // -----------------------------------------------------------------------------
   738 // -----------------------------------------------------------------------------
   794 // LcView::createNotSupportedNote
   739 // LcView::createNotSupportedNote
   795 // -----------------------------------------------------------------------------
   740 // -----------------------------------------------------------------------------
   824     mItemContextMenu->setTimeout(HbDialog::ContextMenuTimeout);
   769     mItemContextMenu->setTimeout(HbDialog::ContextMenuTimeout);
   825     mItemContextMenu->setAttribute(Qt::WA_DeleteOnClose);
   770     mItemContextMenu->setAttribute(Qt::WA_DeleteOnClose);
   826     
   771     
   827     LC_QDEBUG( "livecomms [UI] <- LcView::createContextMenu()" )
   772     LC_QDEBUG( "livecomms [UI] <- LcView::createContextMenu()" )
   828 }
   773 }
   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     
   774     
   921 // -----------------------------------------------------------------------------
   775 // -----------------------------------------------------------------------------
   922 // LcView::currentLayout
   776 // LcView::currentLayout
   923 // -----------------------------------------------------------------------------
   777 // -----------------------------------------------------------------------------
   924 //
   778 //
   957 // -----------------------------------------------------------------------------
   811 // -----------------------------------------------------------------------------
   958 //
   812 //
   959 void LcView::menuAboutToShow()
   813 void LcView::menuAboutToShow()
   960 {
   814 {
   961     LC_QDEBUG( "livecomms [UI] -> LcView::menuAboutToShow()" )
   815     LC_QDEBUG( "livecomms [UI] -> LcView::menuAboutToShow()" )
   962     mIsOptionMenuOpen  = true;
   816     toFullScreen( false );
   963     if( mLandscapeTimer ){
       
   964         mLandscapeTimer->stop();
       
   965     }    
       
   966     LC_QDEBUG( "livecomms [UI] <- LcView::menuAboutToShow()" )
   817     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 }
   818 }
   982 
   819 
   983 // -----------------------------------------------------------------------------
   820 // -----------------------------------------------------------------------------
   984 // LcView::isLandscapeOrientation
   821 // LcView::isLandscapeOrientation
   985 // -----------------------------------------------------------------------------
   822 // -----------------------------------------------------------------------------
  1053 
   890 
  1054 // -----------------------------------------------------------------------------
   891 // -----------------------------------------------------------------------------
  1055 //
   892 //
  1056 // -----------------------------------------------------------------------------
   893 // -----------------------------------------------------------------------------
  1057 //
   894 //
  1058 void LcView::resetLandscapeTimer()
       
  1059 {
       
  1060     if ( mLandscapeTimer && mLandscapeTimer->isActive() ) {
       
  1061         mLandscapeTimer->stop();
       
  1062         mLandscapeTimer->start( inActivityTimeout );
       
  1063     }
       
  1064 }
       
  1065 
       
  1066 void LcView::addOptionsMenuActions()
   895 void LcView::addOptionsMenuActions()
  1067 {
   896 {
  1068     HbAction* swapAction = static_cast<HbAction*>(
   897     HbAction* swapAction = static_cast<HbAction*>(
  1069         mRepository.findObject(lcActSwapViewsId));
   898         mRepository.findObject(lcActSwapViewsId));
  1070     menu()->addAction(swapAction);
   899     menu()->addAction(swapAction);
  1079 // -----------------------------------------------------------------------------
   908 // -----------------------------------------------------------------------------
  1080 //
   909 //
  1081 void LcView::openDialpad()
   910 void LcView::openDialpad()
  1082 {    
   911 {    
  1083     LC_QDEBUG("livecomms [UI] -> LcView::openDialpad()")
   912     LC_QDEBUG("livecomms [UI] -> LcView::openDialpad()")
  1084     // stop the auto full screen timer.
   913     mRepository.loadLayout( lcLayoutLandscapeDialpadId ); 
  1085     if( mLandscapeTimer ){
   914     if ( mEffectHandler )mEffectHandler->startEffects();    
  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();
   915     mDialpad->openDialpad();
  1102 
   916     mDialpad->setCallButtonEnabled(false);
  1103     menu()->clearActions();
   917     menu()->clearActions();    
  1104     
       
  1105     if ( mEffectHandler ){
       
  1106         mEffectHandler->startEffects();
       
  1107     }
       
  1108     LC_QDEBUG("livecomms [UI] <- LcView::openDialpad()")
   918     LC_QDEBUG("livecomms [UI] <- LcView::openDialpad()")
  1109 }
   919 }
  1110 
   920 
  1111 // -----------------------------------------------------------------------------
   921 // -----------------------------------------------------------------------------
  1112 // LcView::dialpadOpened()
   922 // LcView::dialpadOpened()
  1113 // -----------------------------------------------------------------------------
   923 // -----------------------------------------------------------------------------
  1114 //
   924 //
  1115 void LcView::dialpadOpened()
   925 void LcView::dialpadOpened()
  1116 {
   926 {
  1117     LC_QDEBUG("livecomms [UI] <-> LcView::dialpadOpened()")    
   927     LC_QDEBUG("livecomms [UI] <-> LcView::dialpadOpened()")   
       
   928     toolBar()->setVisible( false );
       
   929     setTitleBarVisible( true );
  1118 }
   930 }
  1119 
   931 
  1120 // -----------------------------------------------------------------------------
   932 // -----------------------------------------------------------------------------
  1121 // LcView::dialpadClosed()
   933 // LcView::dialpadClosed()
  1122 // -----------------------------------------------------------------------------
   934 // -----------------------------------------------------------------------------
  1123 //
   935 //
  1124 void LcView::dialpadClosed()
   936 void LcView::dialpadClosed()
  1125 {
   937 {
  1126     LC_QDEBUG("livecomms [UI] -> LcView::dialpadClosed()")
   938     LC_QDEBUG("livecomms [UI] -> LcView::dialpadClosed()")    
  1127     disconnect( &mDialpad->editor(), SIGNAL( contentsChanged() ), this,
   939     addOptionsMenuActions();    
  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
   940     // switch back to the previous layout
  1137     QString pLayout = mRepository.previousLayout();
   941     QString pLayout = mRepository.previousLayout();
  1138     QString layout;
   942     QString layout;
  1139     bool isSwapped = ( pLayout == lcLayoutPortraitDefaultId || 
   943     bool isSwapped = ( pLayout == lcLayoutPortraitDefaultId || 
  1140                        pLayout == lcLayoutLandscapeDefaultId )
   944                        pLayout == lcLayoutLandscapeDefaultId )
  1147         
   951         
  1148     }
   952     }
  1149     else {
   953     else {
  1150         layout = ( isSwapped ) ? lcLayoutPortraitSwappedId 
   954         layout = ( isSwapped ) ? lcLayoutPortraitSwappedId 
  1151                                : lcLayoutPortraitDefaultId;
   955                                : lcLayoutPortraitDefaultId;
  1152     }
   956     }    
  1153     // load the layout
       
  1154     mRepository.loadLayout( layout );    
   957     mRepository.loadLayout( layout );    
  1155     // update the videoplayer hole           
       
  1156     updateVideoRects();
       
  1157     // now do some effects
       
  1158     if ( mEffectHandler ){
   958     if ( mEffectHandler ){
  1159         mEffectHandler->startEffects();
   959         mEffectHandler->startEffects();
  1160     }
   960     }
  1161     // deactivate full screen untill inactivity timeout happens.
   961     toFullScreen(false);
  1162     if ( isLandscape ){
       
  1163         deActivateFullScreen();
       
  1164     }
       
  1165         
       
  1166     LC_QDEBUG("livecomms [UI] <- LcView::dialpadClosed()")
   962     LC_QDEBUG("livecomms [UI] <- LcView::dialpadClosed()")
  1167 }
   963 }
  1168 
   964 
  1169 // -----------------------------------------------------------------------------
   965 // -----------------------------------------------------------------------------
  1170 // LcView::dialpadEditorTextChanged()
   966 // LcView::dialpadEditorTextChanged()
  1177     bool dialPadStatus = mEngine.SendDialTone(mDialpad->editor().text().right(1).at(0));
   973     bool dialPadStatus = mEngine.SendDialTone(mDialpad->editor().text().right(1).at(0));
  1178     LC_QDEBUG_2("livecomms [UI] -> Dialpad Send Tone Status ",dialPadStatus)
   974     LC_QDEBUG_2("livecomms [UI] -> Dialpad Send Tone Status ",dialPadStatus)
  1179 }
   975 }
  1180 
   976 
  1181 // -----------------------------------------------------------------------------
   977 // -----------------------------------------------------------------------------
  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
   978 // LcView::back
  1193 // -----------------------------------------------------------------------------
   979 // -----------------------------------------------------------------------------
  1194 //
   980 //
  1195 void LcView::back()
   981 void LcView::back()
  1196 {
   982 {
  1203     }
   989     }
  1204     
   990     
  1205     LC_QDEBUG("livecomms [UI] <- LcView::back()")
   991     LC_QDEBUG("livecomms [UI] <- LcView::back()")
  1206 }
   992 }
  1207 
   993 
       
   994 // -----------------------------------------------------------------------------
       
   995 // LcView::timerEvent
       
   996 // -----------------------------------------------------------------------------
       
   997 //
       
   998 void LcView::timerEvent( QTimerEvent * event )
       
   999 {    
       
  1000     if ( event->timerId() == timerId ){
       
  1001         LC_QDEBUG("livecomms [UI] -> LcView::timerEvent() inActivity Timeout")
       
  1002         killTimer( timerId );
       
  1003         toFullScreen(true);
       
  1004     }    
       
  1005 }
       
  1006 
       
  1007 // -----------------------------------------------------------------------------
       
  1008 // LcView::watchInactivity
       
  1009 // -----------------------------------------------------------------------------
       
  1010 //
       
  1011 void LcView::watchInactivity()
       
  1012 {    
       
  1013     if( !mEngine.fullScreenMode()){
       
  1014         LC_QDEBUG("livecomms [UI] - LcView::watchInactivity() start watching inactivity") 
       
  1015         killTimer( timerId );
       
  1016         timerId = startTimer( inActivityTimeout );
       
  1017     }    
       
  1018 }
       
  1019 
       
  1020 // -----------------------------------------------------------------------------
       
  1021 // LcView::toFullScreen utility function
       
  1022 // -----------------------------------------------------------------------------
       
  1023 //
       
  1024 void LcView::toFullScreen( bool fullscreen )
       
  1025 {
       
  1026     LC_QDEBUG_2("livecomms [UI] - LcView::toFullScreen(),",fullscreen)
       
  1027     if( menu()->isVisible() || mDialpad && mDialpad->isOpen() ) return;
       
  1028     mEngine.setFullScreenMode( fullscreen );    
       
  1029     setTitleBarVisible( !fullscreen );
       
  1030     toolBar()->setVisible( !fullscreen );
       
  1031     setVisibility( mEndCallButton, !fullscreen );
       
  1032     setVisibility( mBrandIcon, !fullscreen );
       
  1033     setVisibility( mDuration, !fullscreen );
       
  1034     setVisibility( mRecipient, !fullscreen );
       
  1035     emit contentFullScreenChanged();
       
  1036 }
  1208 // End of file
  1037 // End of file