tsrc/consoleplayer/player/inc/consoleplayer.h
changeset 33 e1b6d78dfe6a
equal deleted inserted replaced
29:b818131c88a3 33:e1b6d78dfe6a
       
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  * The header for the main class of the ConsolePlayer test app.
       
    16  * 
       
    17  */
       
    18 
       
    19 #ifndef __CONSOLE_PLAYER_H__
       
    20 #define __CONSOLE_PLAYER_H__
       
    21 
       
    22 #include <e32msgqueue.h>
       
    23 
       
    24 #include "testappbase.h"
       
    25 #include "timercallback.h"
       
    26 #include "playerwindow.h"
       
    27 #include "externalplayer.h"
       
    28 
       
    29 class CPlayerWindow;
       
    30 
       
    31 enum TOperations
       
    32     {
       
    33     EOperation_ChangeDisplayMode = KOperation_FirstCustomIndex,
       
    34     EOperation_AbnormalTermination,
       
    35     EOperation_ToggleSecondVideo,
       
    36     EOperation_ToggleThirdVideo,
       
    37     EOperation_ToggleExternalPlayer,
       
    38     EOperation_ToggleExternalPlayer2,
       
    39     EOperation_ObscureWindow,
       
    40     EOperation_DragWindow,
       
    41     EOperation_ToggleOrdinalPositions,
       
    42     EOperation_LaunchAllWindows    
       
    43     };
       
    44 
       
    45 const TInt KMaxHistoryEntries = 10;
       
    46 _LIT( KHistoryFilename, "c:\\console_player_history.txt" );
       
    47 
       
    48 _LIT( KUrlListFilename, "c:\\data\\urls.txt" );
       
    49 
       
    50 class CConsolePlayer : public CTestAppBase,
       
    51                        private MPlayerWindowObserver,
       
    52                        private ITimerCallbackClient,
       
    53                        private MPlayerCommands
       
    54                        
       
    55 {
       
    56 public: // Methods
       
    57 
       
    58     static void ExecuteL();
       
    59     
       
    60 private: // Methods
       
    61 
       
    62     enum TActionToPerform
       
    63         {
       
    64         EAction_None = 0x0000,
       
    65         EAction_PlayLocalFile = 0x0001,
       
    66         EAction_PlayUrl = 0x0002,
       
    67         EAction_SameAsMainPlayer = 0x0008
       
    68         };
       
    69     
       
    70     enum TApiToUse
       
    71         {
       
    72         EApi_VideoPlayer = 0x1,
       
    73         EApi_OpenMaxAl = 0x2
       
    74         };
       
    75     
       
    76     CConsolePlayer(); 
       
    77 
       
    78     ~CConsolePlayer();
       
    79 
       
    80     void InitL();
       
    81 
       
    82     void Main();
       
    83         
       
    84     void MainL();
       
    85     
       
    86     bool SelectUrlL( TDes& aUrl );
       
    87 
       
    88     void UpdateVideoWindow();
       
    89 
       
    90     void UpdateWindowOrdinalPositions();
       
    91     
       
    92     void EnableDragging();
       
    93     
       
    94     void DisableDragging();
       
    95     
       
    96     void SelectAction( TUint aActionMask, 
       
    97                        TUint aApiMask, 
       
    98                        bool aPresentPerformanceModeOption, 
       
    99                        TActionToPerform& aAction, 
       
   100                        TApiToUse& aApi, 
       
   101                        bool& aPerformanceMode,
       
   102                        TFileName& aLocation );
       
   103     
       
   104     void DoSelectAction( TUint aActionMask, 
       
   105                          bool aPresentPerformanceModeOption, 
       
   106                          TActionToPerform& aAction,
       
   107                          bool& aPerformanceMode );
       
   108     
       
   109     bool DoSelectApi( TUint aApiMask, 
       
   110                       TApiToUse& aApi ); 
       
   111     
       
   112     CPlayerWindow* PlayerWindowNewL( TApiToUse aApi,
       
   113                                      TPoint aTopLeft,
       
   114                                      TSize aSize,
       
   115                                      bool aTransparent,
       
   116                                      TRgb aBackgroundColor,
       
   117                                      bool aSuppressGraphicsContext );
       
   118     
       
   119     TInt CreateAnotherPlayer( CPlayerWindow** aPlayerWindow, 
       
   120                               CExternalPlayer** aExternalPlayer,
       
   121                               const TDesC& aExternalPlayerExeName,
       
   122                               TSize aSize, 
       
   123                               TPoint aTopLeft );
       
   124     
       
   125     MPlayerCommands* CurrentPlayer();
       
   126 
       
   127     void SendOperationToAllPlayers( TInt aOperation );
       
   128     
       
   129     void DrawBorderAroundActiveWindows();
       
   130     
       
   131     // inherited from CTestAppBase
       
   132     virtual void SoftkeyFunctionUpdated();
       
   133     virtual bool ConsumeKeyEvent( TInt aKeyCode );
       
   134     virtual void ExecuteOperation( TInt aOperation, const TDesC& aOperationText );
       
   135     virtual void HandlePointerEvent( const TAdvancedPointerEvent& aEvent );    
       
   136 
       
   137     // inherited from MPlayerWindowObserver
       
   138     virtual void PlayInitiated();
       
   139     virtual void PlayStateChanged();
       
   140     virtual void Error(TInt aError);
       
   141         
       
   142     // inherited from MPlayerCommands
       
   143     virtual TInt ExecuteOperation( TInt aOperation );    
       
   144     virtual void MoveWindow( TPoint aNewCenter );    
       
   145     virtual void SetOrdinalPosition( TInt aPosition );
       
   146     
       
   147     // inherited from ITimerCallbackClient    
       
   148     void TimerCallback();
       
   149     
       
   150 private: // Attributes
       
   151     
       
   152     CTimerCallback*       iTimerCallback;    
       
   153     TBuf<120>             iBuffer;
       
   154     TInt                  iLastError;
       
   155     TInt                  iVideoWindowTextMode;
       
   156     TBuf<120>             iSelectedOptionText;
       
   157     TInt                  iSelectedOptionTextCounter;
       
   158     TInt                  iOrdinalIndex;
       
   159     bool                  iVideoWindow2Transparent;
       
   160     CPlayerWindow*        iVideoPlayer;
       
   161     CPlayerWindow*        iVideoPlayer2;
       
   162     CPlayerWindow*        iVideoPlayer3;
       
   163     CExternalPlayer*      iExternalPlayer;
       
   164     CExternalPlayer*      iExternalPlayer2;
       
   165     MPlayerCommands*      iActivePlayer;
       
   166     MPlayerCommands*      iPlayerBeingDragged;
       
   167     RWindow*              iFullScreenWindow;
       
   168     bool                  iObscured;
       
   169     TInt                  iFinalResult;
       
   170     TActionToPerform      iMainPlayerAction;
       
   171     TApiToUse             iMainPlayerApi;
       
   172     
       
   173     };
       
   174 
       
   175 #endif