photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlervideoplayback.cpp
branchRCL_3
changeset 35 420f6808bf21
parent 32 78ad99c24f08
equal deleted inserted replaced
32:78ad99c24f08 35:420f6808bf21
    52  * @internal reviewed 11/06/2007 by Alex Birkett
    52  * @internal reviewed 11/06/2007 by Alex Birkett
    53  */
    53  */
    54 
    54 
    55 const TUid KVideoHelixPlaybackPluginUid = { 0x10282551 };
    55 const TUid KVideoHelixPlaybackPluginUid = { 0x10282551 };
    56 
    56 
    57 /**
       
    58  * Periodic interval for late construction.
       
    59  * GridView construction would take about 2 sec,
       
    60  * hence this can happen only after 2 secs 
       
    61  */
       
    62 const TTimeIntervalMicroSeconds32 KPeriodicInterval  = 2000000; // 2 sec
       
    63 
       
    64 #include "glxcommandfactory.h"
    57 #include "glxcommandfactory.h"
    65 
    58 
    66 // ---------------------------------------------------------------------------
    59 // ---------------------------------------------------------------------------
    67 // Two-phased constructor.
    60 // Two-phased constructor.
    68 // ---------------------------------------------------------------------------
    61 // ---------------------------------------------------------------------------
    97 void CGlxCommandHandlerVideoPlayback::ConstructL()
    90 void CGlxCommandHandlerVideoPlayback::ConstructL()
    98     {
    91     {
    99     iUiUtility = CGlxUiUtility::UtilityL();
    92     iUiUtility = CGlxUiUtility::UtilityL();
   100      
    93      
   101     iViewUtility = MMPXViewUtility::UtilityL(); 
    94     iViewUtility = MMPXViewUtility::UtilityL(); 
   102 
       
   103     //Start construct timer for late initialization of "MMPXPlaybackUtility"
       
   104     TCallBack callback(
       
   105             CGlxCommandHandlerVideoPlayback::LateConstructCallback, this);
       
   106     iPbUtilityConstructTimer = CPeriodic::NewL(CActive::EPriorityIdle);
       
   107     iPbUtilityConstructTimer->Start(KPeriodicInterval, 0, callback);
       
   108     
    95     
   109    	// Add supported commands
    96    	// Add supported commands
   110    	// Play videoplayback
    97    	// Play videoplayback
   111    	TCommandInfo info(EGlxCmdPlay);
    98    	TCommandInfo info(EGlxCmdPlay);
   112 	// filter out everything except videos
    99 	// filter out everything except videos
   130 
   117 
   131     if ( iViewUtility ) 
   118     if ( iViewUtility ) 
   132         { 
   119         { 
   133         iViewUtility->Close(); 
   120         iViewUtility->Close(); 
   134         } 
   121         } 
   135 
       
   136     if (iPbUtilityConstructTimer)
       
   137         {
       
   138         iPbUtilityConstructTimer->Cancel();
       
   139         delete iPbUtilityConstructTimer;
       
   140         }
       
   141     
   122     
   142     if ( iPlaybackUtility ) 
   123     if ( iPlaybackUtility ) 
   143         { 
   124         { 
   144         TRAP_IGNORE( iPlaybackUtility->CommandL( EPbCmdClose ) ); 
   125         TRAP_IGNORE( iPlaybackUtility->CommandL( EPbCmdClose ) ); 
   145         TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); 
   126         TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); 
   475     iViewUtility->ActivateViewL( array ); 
   456     iViewUtility->ActivateViewL( array ); 
   476     CleanupStack::PopAndDestroy( &array ); 
   457     CleanupStack::PopAndDestroy( &array ); 
   477     } 
   458     } 
   478 
   459 
   479 // -----------------------------------------------------------------------------
   460 // -----------------------------------------------------------------------------
   480 // CGlxCommandHandlerVideoPlayback::LateConstructCallback
       
   481 // -----------------------------------------------------------------------------
       
   482 TInt CGlxCommandHandlerVideoPlayback::LateConstructCallback(TAny* aPtr)
       
   483     {
       
   484     TRACER("CGlxCommandHandlerVideoPlayback::LateConstructCallback");
       
   485     static_cast<CGlxCommandHandlerVideoPlayback*>(aPtr)->DoLateConstruct();
       
   486     return KErrNone;
       
   487     }
       
   488 
       
   489 // -----------------------------------------------------------------------------
       
   490 // CGlxCommandHandlerVideoPlayback::DoLateConstruct
       
   491 // -----------------------------------------------------------------------------
       
   492 void CGlxCommandHandlerVideoPlayback::DoLateConstruct()
       
   493     {
       
   494     TRACER("CGlxCommandHandlerVideoPlayback::DoLateConstruct");
       
   495     //Cancel the periodic timer
       
   496     iPbUtilityConstructTimer->Cancel();
       
   497     //Start 'MMPXPlaybackUtility' construction
       
   498     TRAP_IGNORE( PlaybackUtilityL());
       
   499     }
       
   500 
       
   501 // -----------------------------------------------------------------------------
       
   502 // CGlxCommandHandlerVideoPlayback::PlaybackUtilityL
   461 // CGlxCommandHandlerVideoPlayback::PlaybackUtilityL
   503 // -----------------------------------------------------------------------------
   462 // -----------------------------------------------------------------------------
   504 void CGlxCommandHandlerVideoPlayback::PlaybackUtilityL()
   463 void CGlxCommandHandlerVideoPlayback::PlaybackUtilityL()
   505     {
   464     {
   506     TRACER("CGlxCommandHandlerVideoPlayback::PlaybackUtilityL");
   465     TRACER("CGlxCommandHandlerVideoPlayback::PlaybackUtilityL");