mediasettings/gsvideoplugin/src/GSVideoPlugin.cpp
branchRCL_3
changeset 8 ce5ada96ab30
parent 1 6711b85517b7
equal deleted inserted replaced
6:7d91903f795f 8:ce5ada96ab30
    13 *
    13 *
    14 * Description:   GSVideoPlugin.cpp*
    14 * Description:   GSVideoPlugin.cpp*
    15 */
    15 */
    16 
    16 
    17 
    17 
    18 // Version : %version: 8 %
    18 // Version : %version: 10 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 // INCLUDES
    22 // INCLUDES
    23 #include "MPSettingsModelForROP.h"
    23 #include "MPSettingsModelForROP.h"
    24 #include "GSVideoPlugin.h"
    24 #include "GSVideoPlugin.h"
    25 #include "MPSettingsConstants.h"
    25 #include "MPSettingsConstants.h"
    26 #include "MPSettingsMainView.h"
    26 #include "MPSettingsMainView.h"
    27 #include "MPSettingsProxyView.h"
       
    28 #include "MPSettingsNetworkView.h"
       
    29 #include "MPSettingsPluginView.h"
    27 #include "MPSettingsPluginView.h"
    30 #include "MPSettingsAdvancedBwView.h"
    28 #include "MPSettingsAdvancedBwView.h"
    31 #include "MPSettingsMainContainer.h" 
    29 #include "MPSettingsMainContainer.h" 
       
    30 #include "MPSettingsStreamingContainer.h" 
    32 #include "mediasettings.hrh"
    31 #include "mediasettings.hrh"
    33 #include "gstabhelper.h"
    32 #include "gstabhelper.h"
    34 #include "GSMediaPlayerVideoView.h"
    33 #include "GSMediaPlayerVideoView.h"
    35 #include "GSMediaPlayerStreamingView.h"
    34 #include "GSMediaPlayerStreamingView.h"
    36 #include "feedsettingsview.h"
       
    37 #include "mpxlog.h"
    35 #include "mpxlog.h"
    38 
    36 
    39 #include <coeaui.h>
    37 #include <coeaui.h>
    40 #include <hlplch.h>             // For HlpLauncher
    38 #include <hlplch.h>             // For HlpLauncher
    41 #include <aknview.h>
    39 #include <aknview.h>
    42 #include <aknViewAppUi.h>
    40 #include <aknViewAppUi.h>
    43 #include <featmgr.h>
    41 #include <featmgr.h>
    44 #include <bautils.h>
       
    45 #include <StringLoader.h>     //for StringLoader
    42 #include <StringLoader.h>     //for StringLoader
    46 #include <gsprivatepluginproviderids.h>
    43 #include <gsprivatepluginproviderids.h>
    47 #include <gsmainview.h>
    44 #include <gsmainview.h>
    48 #include <mediasettings.mbg>
    45 #include <mediasettings.mbg>
    49 #include <gsfwviewuids.h>     //for KGSMainViewUid
       
    50 #include <MediaSettings.rsg>
    46 #include <MediaSettings.rsg>
    51 #include <eiktxlbm.h>
    47 #include <eiktxlbm.h>
    52 #include <eikmenup.h> 
    48 #include <eikmenup.h> 
    53 
    49 
       
    50 #include <centralrepository.h>
       
    51 #include "MediaPlayerPrivateCRKeys.h"
       
    52 #include "MediaPlayerVariant.hrh" 
       
    53 
    54 // CONSTANTS
    54 // CONSTANTS
    55 const TInt KGSRopSettViewIdArrayGranularity = 3;
    55 const TInt KGSRopSettViewIdArrayGranularity = 2;
    56 const TInt KGSRopSettTopItemIndex = 0;
    56 const TInt KGSRopSettTopItemIndex = 0;
    57 
    57 
    58 // ========================= MEMBER FUNCTIONS ================================
    58 // ========================= MEMBER FUNCTIONS ================================
    59 
    59 
    60 // ---------------------------------------------------------------------------
    60 // ---------------------------------------------------------------------------
    79     {
    79     {
    80     MPX_FUNC("#MS# CGSVideoPlugin::~CGSVideoPlugin()");
    80     MPX_FUNC("#MS# CGSVideoPlugin::~CGSVideoPlugin()");
    81     FeatureManager::UnInitializeLib();
    81     FeatureManager::UnInitializeLib();
    82     iImplInfoArray.ResetAndDestroy();   
    82     iImplInfoArray.ResetAndDestroy();   
    83     
    83     
    84     if ( iTabHelper ) 
       
    85         {
       
    86         delete iTabHelper;
       
    87         }
       
    88 
       
    89     iResources.Close();
    84     iResources.Close();
    90     
    85     
    91     if ( iViewIds )
    86     if ( iViewIds )
    92         {
    87         {
    93         delete iViewIds;
    88         delete iViewIds;
   114 //
   109 //
   115 void CGSVideoPlugin::ConstructL()
   110 void CGSVideoPlugin::ConstructL()
   116     {
   111     {
   117     MPX_FUNC("#MS# CGSVideoPlugin::ConstructL()");
   112     MPX_FUNC("#MS# CGSVideoPlugin::ConstructL()");
   118     FeatureManager::InitializeLibL();
   113     FeatureManager::InitializeLibL();
   119     iViewArray = new (ELeave) CArrayPtrFlat<MGSTabbedView>( 3 ); 
   114 
   120 
   115     iVideoViewAvailable = VideoContrastIsSupportedL();
       
   116     if ( iVideoViewAvailable )
       
   117         {
       
   118         iViewArray = new (ELeave) CArrayPtrFlat<MGSTabbedView>( KGSRopSettViewIdArrayGranularity ); 
       
   119         }
   121     TFileName fileName;
   120     TFileName fileName;
   122     LocateFilePathL( fileName, EFalse );    
   121     LocateFilePathL( fileName, EFalse );    
   123     OpenLocalizedResourceFileL( fileName, iResources );
   122     OpenLocalizedResourceFileL( fileName, iResources );
   124         
   123     
   125     BaseConstructL(R_GS_MEDIASETTING_VIEW);
   124     TInt ctorResource = ( iVideoViewAvailable ? R_GS_MEDIASETTING_VIEW :
   126 
   125                                                 R_GS_MPSETT_STREAMING_VIEW );
   127     iTabHelper = CGSTabHelper::NewL();
   126     
       
   127     BaseConstructL( ctorResource );
   128     }
   128     }
   129    
   129    
   130 // ---------------------------------------------------------------------------
   130 // ---------------------------------------------------------------------------
   131 // CGSVideoPlugin::NewL()
   131 // CGSVideoPlugin::NewL()
   132 // Static constructor
   132 // Static constructor
   194         {
   194         {
   195         CreateLocalViewsL();        
   195         CreateLocalViewsL();        
   196         }
   196         }
   197     CreateContainerL();
   197     CreateContainerL();
   198     AppUi()->AddToViewStackL( *this, iContainer );
   198     AppUi()->AddToViewStackL( *this, iContainer );
   199     iContainer->ListBox()->SetListBoxObserver( this ) ;
   199     if ( iVideoViewAvailable )
       
   200         {
       
   201         iContainer->ListBox()->SetListBoxObserver( this ) ;
       
   202         }
   200     ResetSelectedItemIndex();
   203     ResetSelectedItemIndex();
   201     }
   204     }
   202 
   205 
   203 // ---------------------------------------------------------------------------
   206 // ---------------------------------------------------------------------------
   204 // CGSVideoPlugin::DoDeactivate
   207 // CGSVideoPlugin::DoDeactivate
   227     {
   230     {
   228     MPX_FUNC("#MS# CGSVideoPlugin::HandleCommandL()");
   231     MPX_FUNC("#MS# CGSVideoPlugin::HandleCommandL()");
   229     switch ( aCommand )
   232     switch ( aCommand )
   230         {
   233         {
   231         case EMPSettCmdOpen:
   234         case EMPSettCmdOpen:
   232             HandleListBoxSelectionL();
       
   233             break;          
   235             break;          
   234         case EAknSoftkeyBack:
   236         case EAknSoftkeyBack:
   235             SetCurrentItem(EGSMediaSettingsVideoIndex);
   237             SetCurrentItem(EGSMediaSettingsVideoIndex);
   236             AppUi()->ActivateLocalViewL( KGSAppsPluginUid );
   238             AppUi()->ActivateLocalViewL( KGSAppsPluginUid );
   237             break;
   239             break;
       
   240         case EMPSettCmdAdvancedSett:
       
   241             AppUi()->ActivateLocalViewL( KMPSettAdvancedBwViewId );
       
   242             break;                    
   238         case EMPSettCmdHelp:
   243         case EMPSettCmdHelp:
   239             {
   244             {
   240             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
   245             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
   241                 {
   246                 {
   242                 HlpLauncher::LaunchHelpApplicationL(
   247                 HlpLauncher::LaunchHelpApplicationL(
   289 // ---------------------------------------------------------------------------
   294 // ---------------------------------------------------------------------------
   290 //
   295 //
   291 void CGSVideoPlugin::NewContainerL()
   296 void CGSVideoPlugin::NewContainerL()
   292     {
   297     {
   293     MPX_FUNC("#MS# CGSVideoPlugin::NewContainerL()");
   298     MPX_FUNC("#MS# CGSVideoPlugin::NewContainerL()");
   294     iContainer = new( ELeave ) CMPSettingsMainContainer;
   299     if ( iVideoViewAvailable )
   295     }
   300         {
   296 
   301         iContainer = new( ELeave ) CMPSettingsMainContainer;
       
   302         }
       
   303     else    
       
   304         {
       
   305         iContainer = new( ELeave ) CMPSettingsStreamingContainer( iModel );
       
   306         }
       
   307     }
       
   308     
   297 // ---------------------------------------------------------------------------
   309 // ---------------------------------------------------------------------------
   298 // CGSVideoPlugin::HandleListBoxSelectionL
   310 // CGSVideoPlugin::HandleListBoxSelectionL
   299 // 
   311 // 
   300 // Handle any user actions while in the list view.
   312 // Handle any user actions while in the list view.
   301 // ---------------------------------------------------------------------------
   313 // ---------------------------------------------------------------------------
   320         else if (i == 1) //second item of the list is Streaming view
   332         else if (i == 1) //second item of the list is Streaming view
   321             {
   333             {
   322             streamingView = static_cast<CGSMediaPlayerStreamingView*>(AppUi()->View(iViewIds->At(i)));
   334             streamingView = static_cast<CGSMediaPlayerStreamingView*>(AppUi()->View(iViewIds->At(i)));
   323             streamingView->SetCurrentItem(KGSRopSettTopItemIndex);        
   335             streamingView->SetCurrentItem(KGSRopSettTopItemIndex);        
   324             }
   336             }
   325         // Third item of the list is "Video service selection"
       
   326         }
   337         }
   327          
   338          
   328     AppUi()->ActivateLocalViewL(iViewIds->At(iCurrentItem));
   339     AppUi()->ActivateLocalViewL(iViewIds->At(iCurrentItem));
   329     }
   340     }
   330 
   341 
   375     MPX_FUNC("#MS# CGSVideoPlugin::CreateLocalViewsL()");
   386     MPX_FUNC("#MS# CGSVideoPlugin::CreateLocalViewsL()");
   376     // model creation
   387     // model creation
   377     iModel = CMPSettingsModelForROP::NewL();
   388     iModel = CMPSettingsModelForROP::NewL();
   378 
   389 
   379     // Create vector which contains view id's for all setting folders. 
   390     // Create vector which contains view id's for all setting folders. 
   380     iViewIds = new(ELeave) CArrayFixFlat<TUid>(KGSRopSettViewIdArrayGranularity);
   391     iViewIds = new(ELeave) CArrayFixFlat<TUid>( KGSRopSettViewIdArrayGranularity );
   381     iViewIds->AppendL(KMPSettVideoViewId);
   392     if ( iVideoViewAvailable )
   382     iViewIds->AppendL(KMPSettStreamingViewId);
   393         {
   383     iViewIds->AppendL(KMPSettFeedsViewId);
   394         iViewIds->AppendL( KMPSettVideoViewId );
       
   395         }
       
   396     iViewIds->AppendL( KMPSettStreamingViewId );
       
   397   
   384     CAknView* view;  
   398     CAknView* view;  
   385 
   399 
   386     view = CMPSettingsMainView::NewLC(iViewIds,iModel,iConstructAsGsPlugin); 
   400     if ( iVideoViewAvailable )
   387     AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
   401         {
   388     CleanupStack::Pop();    // view
   402         view = CMPSettingsMainView::NewLC(iViewIds,iModel,iConstructAsGsPlugin); 
   389 
   403         AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
   390     // iMainView is not owned, i.e. it is not deleted in the destructor ->
   404         CleanupStack::Pop();    // view
   391     // main view cannot be directly creted to iMainView, as it's against the coding
   405 
   392     // conventions to place class' pointers to cleanup stack => static_cast.
   406         // iMainView is not owned, i.e. it is not deleted in the destructor ->
   393     iMainView = static_cast<CMPSettingsMainView*>(view);
   407         // main view cannot be directly creted to iMainView, as it's against the coding
   394 
   408         // conventions to place class' pointers to cleanup stack => static_cast.
   395     view = CGSMediaPlayerVideoView::NewLC(iModel,iViewArray);
   409         iMainView = static_cast<CMPSettingsMainView*>(view);
   396     AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
   410         
   397     CleanupStack::Pop();    // view
   411         view = CGSMediaPlayerVideoView::NewLC(iModel,iViewArray);
   398 
   412         AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
       
   413         CleanupStack::Pop();    // view
       
   414         }
       
   415         
   399     view = CGSMediaPlayerStreamingView::NewLC(iModel,iViewArray);
   416     view = CGSMediaPlayerStreamingView::NewLC(iModel,iViewArray);
   400     AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
       
   401     CleanupStack::Pop();    // view 
       
   402 
       
   403     view = CVcxNsSettingsView::NewLC( iViewArray );
       
   404     AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
       
   405     CleanupStack::Pop();    // view
       
   406     
       
   407     view = CMPSettingsProxyView::NewLC(iModel,iConstructAsGsPlugin);
       
   408     AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
       
   409     CleanupStack::Pop();    // view 
       
   410 
       
   411     view = CMPSettingsNetworkView::NewLC(iModel,iConstructAsGsPlugin);
       
   412     AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
   417     AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
   413     CleanupStack::Pop();    // view 
   418     CleanupStack::Pop();    // view 
   414 
   419 
   415     view = CMPSettingsAdvancedBwView::NewLC(iModel,iConstructAsGsPlugin);
   420     view = CMPSettingsAdvancedBwView::NewLC(iModel,iConstructAsGsPlugin);
   416     AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
   421     AppUi()->AddViewL(view);      // transfer ownership to CAknViewAppUi
   535 // -----------------------------------------------------------------------------
   540 // -----------------------------------------------------------------------------
   536 //
   541 //
   537 void CGSVideoPlugin::LocateFilePathL( TFileName& aFileName, TBool aBitmapFile )
   542 void CGSVideoPlugin::LocateFilePathL( TFileName& aFileName, TBool aBitmapFile )
   538     {
   543     {
   539     _LIT( KGSResourceFileName, "mediasettings.rsc" );
   544     _LIT( KGSResourceFileName, "mediasettings.rsc" );
   540     //_LIT( KGSIconFileName, "mediasettings.mbm");
       
   541     _LIT( KGSIconFileName, "mediasettings.mif");
   545     _LIT( KGSIconFileName, "mediasettings.mif");
   542     
   546     
   543     TParse parse;
   547     TParse parse;
   544     TFileName temp;
   548     TFileName temp;
   545                 
   549                 
   590             }
   594             }
   591         }
   595         }
   592         MPX_DEBUG3(_L("#MS# CGSVideoPlugin::LocateFilePathL(%d,%S)"),aBitmapFile,&aFileName);
   596         MPX_DEBUG3(_L("#MS# CGSVideoPlugin::LocateFilePathL(%d,%S)"),aBitmapFile,&aFileName);
   593     }   
   597     }   
   594 
   598 
       
   599 // -----------------------------------------------------------------------------
       
   600 // CGSVideoPlugin::VideoContrastIsSupportedL
       
   601 // -----------------------------------------------------------------------------
       
   602 //
       
   603 TBool CGSVideoPlugin::VideoContrastIsSupportedL()
       
   604     {
       
   605     TInt flags;
       
   606     CRepository* repository = CRepository::NewL( KCRUidMediaPlayerFeatures );
       
   607     repository->Get( KMPLocalVariation, flags );
       
   608     delete repository;
       
   609 
       
   610     return ( flags & KMediaPlayerVideoContrast );
       
   611     }
       
   612 
   595 //End of File
   613 //End of File