mmsharing/livecommsui/lcui/src/lcview.cpp
changeset 39 4bcc59142325
parent 34 01f0bb65bcf1
equal deleted inserted replaced
37:e9675fb210bd 39:4bcc59142325
    38 #include <qtimer.h>
    38 #include <qtimer.h>
    39 #include <hblineedit.h>
    39 #include <hblineedit.h>
    40 #include <dialpad.h>
    40 #include <dialpad.h>
    41 #include <hbtapgesture.h>
    41 #include <hbtapgesture.h>
    42 #include <DialpadVtKeyHandler.h>
    42 #include <DialpadVtKeyHandler.h>
    43 
    43 #include <hbvolumesliderpopup.h>
    44 
    44 
    45 
    45 
    46 #if ( defined __WINSCW__ ) || ( defined __WINS__ )
    46 
    47 const int inActivityTimeout = 5000; //5 secs
    47 //Inactivity timeout. Optimized according to other apps like camera.
    48 #else
    48 const int inActivityTimeout = 6000; //6 secs
    49 const int inActivityTimeout = 2000; //2 secs
    49 
    50 #endif
       
    51 
    50 
    52 // -----------------------------------------------------------------------------
    51 // -----------------------------------------------------------------------------
    53 // LcView::LcView
    52 // LcView::LcView
    54 // -----------------------------------------------------------------------------
    53 // -----------------------------------------------------------------------------
    55 //
    54 //
   215             SLOT( updateVideoRects() ), Qt::QueuedConnection );
   214             SLOT( updateVideoRects() ), Qt::QueuedConnection );
   216     }
   215     }
   217     
   216     
   218     //Subscribe to the Volume Change Events.
   217     //Subscribe to the Volume Change Events.
   219     connect( &mEngine, SIGNAL(volumeChanged(int)), 
   218     connect( &mEngine, SIGNAL(volumeChanged(int)), 
   220             this, SLOT(updateVolumeSlider(int)) );
   219             this, SLOT(showVolumeSlider(int)) );
   221     
   220     
   222     LC_QDEBUG( "livecomms [UI] <- LcView::init()" )
   221     LC_QDEBUG( "livecomms [UI] <- LcView::init()" )
   223 }
   222 }
   224 
   223 
   225 
   224 
   242         if ( mSharedVideoWidget ) {
   241         if ( mSharedVideoWidget ) {
   243             sharedContentRect = mSharedVideoWidget->geometry();  
   242             sharedContentRect = mSharedVideoWidget->geometry();  
   244             sharedContentRect.moveTop(
   243             sharedContentRect.moveTop(
   245                     sharedContentRect.y() + mapToParent(scenePos()).y());
   244                     sharedContentRect.y() + mapToParent(scenePos()).y());
   246             sharedContentRect = translateRectForOrientation(sharedContentRect);
   245             sharedContentRect = translateRectForOrientation(sharedContentRect);
   247             mEffectHandler->setVisibility(
       
   248                     mSharedVideoWidget, mEngine.isLocalPlayerPlaying());
       
   249         }
   246         }
   250         
   247         
   251         if ( mReceivedVideoWidget ) {
   248         if ( mReceivedVideoWidget ) {
   252             receivedContentRect = mReceivedVideoWidget->geometry();
   249             receivedContentRect = mReceivedVideoWidget->geometry();
   253             receivedContentRect.moveTop(
   250             receivedContentRect.moveTop(
   254                     receivedContentRect.y() + mapToParent(scenePos()).y());
   251                     receivedContentRect.y() + mapToParent(scenePos()).y());
   255             receivedContentRect = translateRectForOrientation(receivedContentRect);
   252             receivedContentRect = translateRectForOrientation(receivedContentRect);
   256             mEffectHandler->setVisibility(
       
   257                     mReceivedVideoWidget, mEngine.isRemotePlayerPlaying());
       
   258         }
   253         }
   259         
   254         
   260         mEngine.setContentAreas( sharedContentRect, receivedContentRect );
   255         mEngine.setContentAreas( sharedContentRect, receivedContentRect );
   261         mEngine.setOrientation( HbInstance::instance()->allMainWindows().at(0)->orientation() );
   256         mEngine.setOrientation( HbInstance::instance()->allMainWindows().at(0)->orientation() );
   262         mEngine.updateSession();
   257         mEngine.updateSession();
   379            mRecipient, SLOT(setPlainText(const QString &)) );
   374            mRecipient, SLOT(setPlainText(const QString &)) );
   380     }
   375     }
   381     
   376     
   382     if ( mSharedVideoWidget ) {
   377     if ( mSharedVideoWidget ) {
   383         connect( &mEngine, SIGNAL(localPlayerPlaying()), 
   378         connect( &mEngine, SIGNAL(localPlayerPlaying()), 
   384                  mEffectHandler, SLOT(showSendWindow()) );
   379                  this, SLOT(showSendVideo()) );
   385         connect( &mEngine, SIGNAL(localPlayerPaused()), 
       
   386                  mEffectHandler, SLOT(hideSendWindow()) );
       
   387         connect( &mEngine, SIGNAL(localPlayerPlaying()), 
   380         connect( &mEngine, SIGNAL(localPlayerPlaying()), 
   388                  this, SLOT(setCameraActionToDisable()));
   381                  this, SLOT(setCameraActionToDisable()));
   389         connect( &mEngine, SIGNAL(localPlayerPaused()), 
   382         connect( &mEngine, SIGNAL(localPlayerPaused()), 
   390                  this, SLOT(setCameraActionToEnable()));
   383                  this, SLOT(setCameraActionToEnable()));
   391         connect( &mEngine, SIGNAL(localPlayerUnavailable()), 
   384         connect( &mEngine, SIGNAL(localPlayerUnavailable()), 
   394                          this, SLOT(updateVideoRects()));
   387                          this, SLOT(updateVideoRects()));
   395     }
   388     }
   396 
   389 
   397     if ( mReceivedVideoWidget ) {
   390     if ( mReceivedVideoWidget ) {
   398         connect( &mEngine, SIGNAL(remotePlayerPlaying()), 
   391         connect( &mEngine, SIGNAL(remotePlayerPlaying()), 
   399                  mEffectHandler, SLOT(showReceiveWindow()) );
   392                  this, SLOT(showReceivedVideo()) );
   400         connect( &mEngine, SIGNAL(remotePlayerPaused()), 
       
   401                  mEffectHandler, SLOT(hideReceiveWindow()) );
       
   402         connect( &mEngine, SIGNAL(remotePlayerPlaying()), 
   393         connect( &mEngine, SIGNAL(remotePlayerPlaying()), 
   403                          this, SLOT(updateVideoRects()) );
   394                          this, SLOT(updateVideoRects()) );
   404     }
   395     }
   405     
   396     
   406     mEngine.setCurrentView(this);
   397     mEngine.setCurrentView(this);
   470 // -----------------------------------------------------------------------------
   461 // -----------------------------------------------------------------------------
   471 //
   462 //
   472 void LcView::disableCamera()
   463 void LcView::disableCamera()
   473 {
   464 {
   474     LC_QDEBUG( "livecomms [UI] -> LcView::disableCamera()" )
   465     LC_QDEBUG( "livecomms [UI] -> LcView::disableCamera()" )
   475  
   466 
   476     mEffectHandler->setDissappearEffect( LcEffectHandler::NormalDissappear );
       
   477     mEngine.toggleDisableCamera();
   467     mEngine.toggleDisableCamera();
   478     toFullScreen( mEngine.fullScreenMode() );
   468     toFullScreen( mEngine.fullScreenMode() );
   479     
   469     
   480     LC_QDEBUG( "livecomms [UI] <- LcView::disableCamera()" ) 
   470     LC_QDEBUG( "livecomms [UI] <- LcView::disableCamera()" ) 
   481 }
   471 }
   499 // -----------------------------------------------------------------------------
   489 // -----------------------------------------------------------------------------
   500 //
   490 //
   501 void LcView::changeCamera()
   491 void LcView::changeCamera()
   502 {
   492 {
   503     LC_QDEBUG( "livecomms [UI] -> LcView::changeCamera()" )
   493     LC_QDEBUG( "livecomms [UI] -> LcView::changeCamera()" )
   504    
   494 
   505     mEffectHandler->setDissappearEffect( LcEffectHandler::DissappearToFlip );
       
   506     mEngine.toggleCamera();
   495     mEngine.toggleCamera();
   507     toFullScreen( false );
   496     toFullScreen( false );
       
   497     
       
   498     // Change Camera may take some time run some affects.
       
   499     if ( mEffectHandler ) {
       
   500         mEffectHandler->startEffects();    
       
   501     }
   508         
   502         
   509     LC_QDEBUG( "livecomms [UI] <- LcView::changeCamera()" )
   503     LC_QDEBUG( "livecomms [UI] <- LcView::changeCamera()" )
   510 }
   504 }
   511 
   505 
   512 // -----------------------------------------------------------------------------
   506 // -----------------------------------------------------------------------------
  1002     mEngine.setFullScreenMode( fullscreen );    
   996     mEngine.setFullScreenMode( fullscreen );    
  1003     setTitleBarVisible( !fullscreen );
   997     setTitleBarVisible( !fullscreen );
  1004     setStatusBarVisible( !fullscreen );
   998     setStatusBarVisible( !fullscreen );
  1005     toolBar()->setVisible( !fullscreen );
   999     toolBar()->setVisible( !fullscreen );
  1006     setVisibility( mEndCallButton, !fullscreen );    
  1000     setVisibility( mEndCallButton, !fullscreen );    
  1007     setVisibility( mDuration, !fullscreen );
       
  1008     setVisibility( mRecipient, !fullscreen );
       
  1009     emit contentFullScreenChanged();
  1001     emit contentFullScreenChanged();
  1010 }
  1002 }
  1011 
  1003 
  1012 
  1004 
  1013 // -----------------------------------------------------------------------------
  1005 // -----------------------------------------------------------------------------
  1057     return isViewReady;    
  1049     return isViewReady;    
  1058 }
  1050 }
  1059 
  1051 
  1060 
  1052 
  1061 // -----------------------------------------------------------------------------
  1053 // -----------------------------------------------------------------------------
  1062 // LcView::updateVolumeSlider 
  1054 // LcView::showVolumeSlider 
  1063 // -----------------------------------------------------------------------------
  1055 // -----------------------------------------------------------------------------
  1064 //
  1056 //
  1065 void LcView::updateVolumeSlider( int aVolumeLevel )
  1057 void LcView::showVolumeSlider( int aVolumeLevel )
  1066 {
  1058 {
  1067     LC_QDEBUG("livecomms [UI] -> LcView::updateVolumeSlider()")
  1059     LC_QDEBUG("livecomms [UI] -> LcView::showVolumeSlider()")
  1068     //TBD: Show volume slider, with update volume level
  1060     LC_QDEBUG_2("livecomms [UI] Volume Level Is,",aVolumeLevel)
  1069     LC_QDEBUG_2("Volume Level Is,",aVolumeLevel)
  1061     mRepository.volumeSlider()->setValue(aVolumeLevel);
  1070     LC_QDEBUG("livecomms [UI] <- LcView::updateVolumeSlider()")   
  1062     mRepository.volumeSlider()->show();
       
  1063     LC_QDEBUG("livecomms [UI] <- LcView::showVolumeSlider()")   
       
  1064 }
       
  1065 
       
  1066 
       
  1067 // -----------------------------------------------------------------------------
       
  1068 // LcView::showSendVideo 
       
  1069 // -----------------------------------------------------------------------------
       
  1070 //
       
  1071 void LcView::showSendVideo()
       
  1072 {
       
  1073     // Showing Send Send Video Effects only occurs at the startup 
       
  1074     disconnect( &mEngine, SIGNAL(localPlayerPlaying()), 
       
  1075                 this, SLOT(showSendVideo()) );
       
  1076     mEffectHandler->showSendWindow();
       
  1077 }
       
  1078 
       
  1079 
       
  1080 // -----------------------------------------------------------------------------
       
  1081 // LcView::showReceivedVideo 
       
  1082 // -----------------------------------------------------------------------------
       
  1083 //
       
  1084 void LcView::showReceivedVideo()
       
  1085 {
       
  1086     // Showing Received Video Effects only occurs at the startup 
       
  1087     disconnect( &mEngine, SIGNAL(remotePlayerPlaying()), 
       
  1088              this, SLOT(showReceivedVideo()) );
       
  1089 
       
  1090     mEffectHandler->showReceiveWindow();
  1071 }
  1091 }
  1072 
  1092 
  1073 
  1093 
  1074 // End of file
  1094 // End of file