vtuis/videotelui/src/CVtUiAppUi.cpp
branchRCL_3
changeset 18 e1a893011fac
parent 17 9ec13d39cc2e
child 20 b95d12697049
equal deleted inserted replaced
17:9ec13d39cc2e 18:e1a893011fac
  1826         }
  1826         }
  1827     __VTPRINTEXIT( "VtUi.TryToStartTbL" )
  1827     __VTPRINTEXIT( "VtUi.TryToStartTbL" )
  1828     }
  1828     }
  1829 
  1829 
  1830 // -----------------------------------------------------------------------------
  1830 // -----------------------------------------------------------------------------
       
  1831 // CVtUiAppUi::ReTryToStartTbL
       
  1832 // -----------------------------------------------------------------------------
       
  1833 //
       
  1834 void CVtUiAppUi::RetryToStartTbL()
       
  1835     {
       
  1836     // only with fixed toolbar
       
  1837     if ( AknLayoutUtils::PenEnabled() )
       
  1838         {
       
  1839         if ( iUiStates->IsFixedToolbarVisible())
       
  1840             {
       
  1841             // When option menu is opened fixed toolbar should
       
  1842             // be set hidden
       
  1843             iUiStates->SetIsFixedToolbarVisible( EFalse );
       
  1844             // Stop toolbar
       
  1845             MVtUiFeature* tb =
       
  1846                 iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar );
       
  1847             if ( tb )
       
  1848                 {
       
  1849                 // timer could be active
       
  1850                 if ( iTbPeriodic )
       
  1851                     {
       
  1852                     iTbPeriodic->Cancel();
       
  1853                     }
       
  1854                 tb->Stop();
       
  1855                 }
       
  1856             if ( !iTbPeriodic )
       
  1857                 {
       
  1858                 iTbPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
       
  1859                 }
       
  1860             // Toolbar doesn't come visible until options menu is closed.
       
  1861             iTbPeriodic->Start( KStartTime, KPeriodTime, TCallBack( DoTryToStartTbL, this ) );
       
  1862             }
       
  1863         }
       
  1864     else
       
  1865         {
       
  1866         StopSliders(); 
       
  1867         }
       
  1868     }
       
  1869 
       
  1870 // -----------------------------------------------------------------------------
  1831 // CVtUiAppUi::SetRenderingModeL
  1871 // CVtUiAppUi::SetRenderingModeL
  1832 // -----------------------------------------------------------------------------
  1872 // -----------------------------------------------------------------------------
  1833 //
  1873 //
  1834 void CVtUiAppUi::SetRenderingModeL( const TRenderingMode aMode,
  1874 void CVtUiAppUi::SetRenderingModeL( const TRenderingMode aMode,
  1835     MVtUiVideoWindow* aNewDownlink )
  1875     MVtUiVideoWindow* aNewDownlink )
  1997         }
  2037         }
  1998     
  2038     
  1999     MVtEngCommandHandler& command = Model().CommandHandler();
  2039     MVtEngCommandHandler& command = Model().CommandHandler();
  2000     command.ExecuteL( KVtEngRequestLastRemoteFrame, NULL );
  2040     command.ExecuteL( KVtEngRequestLastRemoteFrame, NULL );
  2001     
  2041     
  2002     // only with fixed toolbar
  2042     RetryToStartTbL();
  2003     if ( AknLayoutUtils::PenEnabled() )
       
  2004         {
       
  2005         if ( iUiStates->IsFixedToolbarVisible())
       
  2006             {
       
  2007             // When option menu is opened fixed toolbar should
       
  2008             // be set hidden
       
  2009             iUiStates->SetIsFixedToolbarVisible( EFalse );
       
  2010             // Stop toolbar
       
  2011             MVtUiFeature* tb =
       
  2012             iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar );
       
  2013             if ( tb )
       
  2014                 {
       
  2015                 // timer could be active
       
  2016                 if ( iTbPeriodic )
       
  2017                     {
       
  2018                     iTbPeriodic->Cancel();
       
  2019                     }
       
  2020                 tb->Stop();
       
  2021                 }
       
  2022             if ( !iTbPeriodic )
       
  2023                 {
       
  2024                 iTbPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
       
  2025                 }
       
  2026             // Toolbar doesn't come visible until options menu is closed.
       
  2027             iTbPeriodic->Start( KStartTime, KPeriodTime, TCallBack( DoTryToStartTbL, this ) );
       
  2028             }
       
  2029         }
       
  2030     else
       
  2031         {
       
  2032         StopSliders(); 
       
  2033         }
       
  2034 
  2043 
  2035     iInstance->iMainControl->SetSize( iInstance->iMainControl->Size() );
  2044     iInstance->iMainControl->SetSize( iInstance->iMainControl->Size() );
  2036     iInstance->iMainControl->DrawNow();
  2045     iInstance->iMainControl->DrawNow();
  2037         
  2046         
  2038     // Handle OK options menu.
  2047     // Handle OK options menu.
  2128 //
  2137 //
  2129 void CVtUiAppUi::HandleCommandL(
  2138 void CVtUiAppUi::HandleCommandL(
  2130         TInt aCommand )
  2139         TInt aCommand )
  2131     {
  2140     {
  2132     __VTPRINTENTER( "VtUi.HandleCommand" )
  2141     __VTPRINTENTER( "VtUi.HandleCommand" )
  2133 
  2142     __VTPRINT2( DEBUG_GEN, "VtUi.HandleCommand.Cmd=%d", aCommand );
  2134     // Check if same command is already being performed.
  2143     // Check if same command is already being performed.
  2135     if ( IsActiveCommand( aCommand ) || ( iState &&
  2144     if ( IsActiveCommand( aCommand ) || ( iState &&
  2136          iState->HandleCommandL( aCommand ) ==
  2145          iState->HandleCommandL( aCommand ) ==
  2137          TVtUiAppStateBase::EEventHandled ) )
  2146          TVtUiAppStateBase::EEventHandled ) )
  2138         {
  2147         {
  2246             CmdDisableAudioL();
  2255             CmdDisableAudioL();
  2247             CleanupStack::PopAndDestroy();
  2256             CleanupStack::PopAndDestroy();
  2248             break;
  2257             break;
  2249 
  2258 
  2250         case EVtUiCmdDisableBoth:
  2259         case EVtUiCmdDisableBoth:
  2251             HandleCommandL( EVtUiCmdDisableAudio );
  2260             refresh = ETrue;
  2252             HandleCommandL( EVtUiCmdDisableVideo );
  2261             EnableCommandActivatingAndCleanupPushL();
       
  2262             CmdDisableVideoL();
       
  2263             CmdDisableAudioL();
       
  2264             CleanupStack::PopAndDestroy();
  2253             break;
  2265             break;
  2254 
  2266 
  2255         case EVtUiCmdActivateBT:
  2267         case EVtUiCmdActivateBT:
  2256             refresh = ETrue;
  2268             refresh = ETrue;
  2257             EnableCommandActivatingAndCleanupPushL();
  2269             EnableCommandActivatingAndCleanupPushL();
  2982 // CVtUiAppUi::CmdDisableVideoL
  2994 // CVtUiAppUi::CmdDisableVideoL
  2983 // -----------------------------------------------------------------------------
  2995 // -----------------------------------------------------------------------------
  2984 //
  2996 //
  2985 void CVtUiAppUi::CmdDisableVideoL()
  2997 void CVtUiAppUi::CmdDisableVideoL()
  2986     {
  2998     {
  2987         
  2999     iDisableVideoOngoing = ETrue;
  2988         if( iUiStates->IsZoomModeOn() )
  3000     if( iUiStates->IsZoomModeOn() )
  2989             {
  3001         {
  2990             // if zoom feature is active, stop that
  3002         // if zoom feature is active, stop that
  2991             MVtUiFeature* zm = iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom );
  3003         MVtUiFeature* zm = iFeatureManager->GetFeatureById( EVtUiFeatureIdZoom );
  2992             if ( zm )
  3004         if ( zm )
  2993                 {
  3005             {
  2994                 if ( zm->State() ==  MVtUiFeature::EActive )
  3006             if ( zm->State() ==  MVtUiFeature::EActive )
  2995                     {
  3007                 {
  2996                     __VTPRINT( DEBUG_GEN, "VtUi.CmdDisableVideoL zm->STOP" )
  3008                 __VTPRINT( DEBUG_GEN, "VtUi.CmdDisableVideoL zm->STOP" )
  2997                     zm->Stop();
  3009                 zm->Stop();
  2998                     }
  3010                 }
  2999                 }
  3011             }
  3000             }
  3012         }
  3001         
  3013         
  3002     ExecuteCmdL( KVtEngStopViewFinder );
  3014     ExecuteCmdL( KVtEngStopViewFinder );
  3003 
  3015 
  3004     iUplinkWindow->SetStreamBitmap( NULL );
  3016     iUplinkWindow->SetStreamBitmap( NULL );
  3005 
  3017 
  3016         MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaNone;
  3028         MVtEngMedia::TMediaSource source = MVtEngMedia::EMediaNone;
  3017         ExecuteCmdL( KVtEngSetSource, source );
  3029         ExecuteCmdL( KVtEngSetSource, source );
  3018         }
  3030         }
  3019 
  3031 
  3020     ExecuteCmdL( KVtEngStartViewFinder );
  3032     ExecuteCmdL( KVtEngStartViewFinder );
       
  3033     iDisableVideoOngoing = EFalse;
  3021     }
  3034     }
  3022 
  3035 
  3023 // -----------------------------------------------------------------------------
  3036 // -----------------------------------------------------------------------------
  3024 // CVtUiAppUi::CmdDisableAudioL
  3037 // CVtUiAppUi::CmdDisableAudioL
  3025 // -----------------------------------------------------------------------------
  3038 // -----------------------------------------------------------------------------
  3391     CDesCArray* selectedFiles = new ( ELeave ) CDesCArrayFlat( 1 );
  3404     CDesCArray* selectedFiles = new ( ELeave ) CDesCArrayFlat( 1 );
  3392     CleanupStack::PushL( selectedFiles );
  3405     CleanupStack::PushL( selectedFiles );
  3393     CVtUiAppUi::CVtUiAppUiMGVerifier* verifier =
  3406     CVtUiAppUi::CVtUiAppUiMGVerifier* verifier =
  3394         CVtUiAppUi::CVtUiAppUiMGVerifier::NewLC( *this, *iCoeEnv );
  3407         CVtUiAppUi::CVtUiAppUiMGVerifier::NewLC( *this, *iCoeEnv );
  3395 
  3408 
  3396      // number erntry is not availabe while media gallery is open
  3409     // number erntry is not availabe while media gallery is open
  3397     iInstance->iNumberEntryActivation->SetActive( EFalse );
  3410     iInstance->iNumberEntryActivation->SetActive( EFalse );
  3398     iUiStates->SetSelectingShare( ETrue );
  3411     iUiStates->SetSelectingShare( ETrue );
  3399 
  3412 
  3400     TBool result( EFalse );
  3413     TBool result( EFalse );
  3401     TRAPD( err, result =
  3414     TRAPD( err, result =
  4799         TBool aIsForeground )
  4812         TBool aIsForeground )
  4800     {
  4813     {
  4801     __VTPRINTENTER( "VtUi.HandleForegroundChangedL" )
  4814     __VTPRINTENTER( "VtUi.HandleForegroundChangedL" )
  4802     __VTPRINT2( DEBUG_GEN, "VtUi.foreground=%d", (TInt) aIsForeground )
  4815     __VTPRINT2( DEBUG_GEN, "VtUi.foreground=%d", (TInt) aIsForeground )
  4803 
  4816 
  4804 
       
  4805     // Let the Engine know that Application's foregorund
  4817     // Let the Engine know that Application's foregorund
  4806     // has changed. Then Engine can do some initalize/uninitalize
  4818     // has changed. Then Engine can do some initalize/uninitalize
  4807     // before rendering due to the foreground state.
  4819     // before rendering due to the foreground state.
  4808     iState->PreHandleForegroundChangedL(aIsForeground);
  4820     iState->PreHandleForegroundChangedL( aIsForeground );
  4809 
  4821 
       
  4822     // The availability of number entry depends on application is
       
  4823     // foreground or not
       
  4824     iInstance->iNumberEntryActivation->SetActive( aIsForeground );
       
  4825     
  4810     // These operations must be done before
  4826     // These operations must be done before
  4811     // sending KVtEngSetUIForeground command to engine i.e. calling
  4827     // sending KVtEngSetUIForeground command to engine i.e. calling
  4812     // iState->HandleForegroundChangedL( aIsForeground )
  4828     // iState->HandleForegroundChangedL( aIsForeground )
  4813     if ( !aIsForeground  )
  4829     if ( !aIsForeground  )
  4814         {
  4830         {
  4837                {
  4853                {
  4838                __VTPRINT( DEBUG_GEN, "VtUi.HandleForegroundChangedL cr->STOP" )
  4854                __VTPRINT( DEBUG_GEN, "VtUi.HandleForegroundChangedL cr->STOP" )
  4839                cr->Stop();
  4855                cr->Stop();
  4840                }
  4856                }
  4841             }
  4857             }
  4842 
       
  4843         }
  4858         }
  4844 
  4859 
  4845     TBool foregroundAndReady = EFalse;
  4860     TBool foregroundAndReady = EFalse;
  4846     if ( iState )
  4861     if ( iState )
  4847         {
  4862         {
  4854         // if necessary.
  4869         // if necessary.
  4855         RefreshNaviPaneL();
  4870         RefreshNaviPaneL();
  4856         }
  4871         }
  4857     else if ( !aIsForeground )
  4872     else if ( !aIsForeground )
  4858         {
  4873         {
  4859 
       
  4860 
       
  4861         iEventObserver->StopBeat();
  4874         iEventObserver->StopBeat();
  4862         }
  4875         }
  4863     SetIncallBubbleAllowedInUsualL( !foregroundAndReady );
  4876     SetIncallBubbleAllowedInUsualL( !foregroundAndReady );
  4864     __VTPRINTEXIT( "VtUi.HandleForegroundChangedL" )
  4877     __VTPRINTEXIT( "VtUi.HandleForegroundChangedL" )
  4865     }
  4878     }
  5003 // -----------------------------------------------------------------------------
  5016 // -----------------------------------------------------------------------------
  5004 //
  5017 //
  5005 void CVtUiAppUi::DoHandleLayoutChangedL()
  5018 void CVtUiAppUi::DoHandleLayoutChangedL()
  5006     {
  5019     {
  5007     __VTPRINTENTER( "VtUi.DoLayoutChg" )
  5020     __VTPRINTENTER( "VtUi.DoLayoutChg" )
       
  5021     TInt error;
  5008     // Fully update rendering parameters
  5022     // Fully update rendering parameters
  5009     UpdateRenderingParametersL();
  5023     UpdateRenderingParametersL();
  5010     // Notify engine about layout change
  5024     // Notify engine about layout change
  5011     iLayoutChg = ETrue;
  5025     iLayoutChg = ETrue;
  5012     TRAPD( error, ExecuteCmdL( KVtEngHandleLayoutChange ) );
  5026     if( iDisableVideoOngoing )
       
  5027         {
       
  5028         error = KErrNotReady;
       
  5029         }
       
  5030     else
       
  5031         {
       
  5032         TRAP( error, ExecuteCmdL( KVtEngHandleLayoutChange ) );
       
  5033         }
  5013     iLayoutChg = EFalse;
  5034     iLayoutChg = EFalse;
  5014 
  5035 
  5015     // Not ready error is allowed to happen (e.g. when sharing)
  5036     // Not ready error is allowed to happen (e.g. when sharing)
  5016     if ( error && ( error != KErrNotReady ) )
  5037     if ( error && ( error != KErrNotReady ) )
  5017         {
  5038         {
  5038                 pendingCommand  == KVtEngPrepareCamera ||
  5059                 pendingCommand  == KVtEngPrepareCamera ||
  5039                 pendingCommand  == KVtEngUnfreeze ||
  5060                 pendingCommand  == KVtEngUnfreeze ||
  5040                 invalidCommand  == KVtEngHandleLayoutChange )
  5061                 invalidCommand  == KVtEngHandleLayoutChange )
  5041             {
  5062             {
  5042             iPendingCmd = pendingCommand;
  5063             iPendingCmd = pendingCommand;
       
  5064             iUiStates->SetLayoutChangeNeeded( ETrue );
       
  5065             }
       
  5066         if( iDisableVideoOngoing && pendingCommand == KVtEngCommandNone )
       
  5067             {
       
  5068             iPendingCmd = KVtEngSetSource;
  5043             iUiStates->SetLayoutChangeNeeded( ETrue );
  5069             iUiStates->SetLayoutChangeNeeded( ETrue );
  5044             }
  5070             }
  5045         }
  5071         }
  5046     // Notify component manager
  5072     // Notify component manager
  5047     iComponentManager->HandleLayoutChangeL();
  5073     iComponentManager->HandleLayoutChangeL();
  5737     iUiStates->SetIsCommandActivating( EFalse );
  5763     iUiStates->SetIsCommandActivating( EFalse );
  5738     if ( !iUiStates->IsCommandActivating() )
  5764     if ( !iUiStates->IsCommandActivating() )
  5739         {
  5765         {
  5740         RefreshStatesL();
  5766         RefreshStatesL();
  5741         }
  5767         }
       
  5768     iDisableVideoOngoing = EFalse;
  5742     __VTPRINTEXIT( "VtUi.HandleCommandDeactivationL" )
  5769     __VTPRINTEXIT( "VtUi.HandleCommandDeactivationL" )
  5743     }
  5770     }
  5744 
  5771 
  5745 // -----------------------------------------------------------------------------
  5772 // -----------------------------------------------------------------------------
  5746 // CVtUiAppUi::DoEnableBlindSetting
  5773 // CVtUiAppUi::DoEnableBlindSetting
  6544                         __VTPRINT( DEBUG_GEN, "CVtUiAppUi.VolumeKeyPressedL zm->STOP" )
  6571                         __VTPRINT( DEBUG_GEN, "CVtUiAppUi.VolumeKeyPressedL zm->STOP" )
  6545                         zm->Stop();
  6572                         zm->Stop();
  6546                         }
  6573                         }
  6547                     }
  6574                     }
  6548                 }
  6575                 }
       
  6576             
       
  6577             iAppUi.RetryToStartTbL();
  6549             volume->StartL();
  6578             volume->StartL();
  6550             
  6579             
  6551             // Toolbar needs to be refreshed if zoom, contrat and brightness were dismissed
  6580             // Toolbar needs to be refreshed if zoom, contrat and brightness were dismissed
  6552             CVtUiToolbarBase* tb = static_cast< CVtUiToolbarBase* >(
  6581             CVtUiToolbarBase* tb = static_cast< CVtUiToolbarBase* >(
  6553             iAppUi.iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ) );
  6582             iAppUi.iFeatureManager->GetFeatureById( EVtUiFeatureIdToolbar ) );