chxavplayview.h
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:5k
源码类别:

Symbian

开发平台:

Visual C++

  1. /************************************************************************
  2.  * chxavplayview.h
  3.  * ---------------
  4.  *
  5.  * Synopsis:
  6.  * Contains the declaration of the CHXAvPlayView class.  This class 
  7.  * implements the play/stop/pause view.
  8.  *
  9.  * Target:
  10.  * Symbian OS
  11.  *
  12.  *
  13.  * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
  14.  *
  15.  ************************************************************************/
  16. #ifndef _chxavplayview_h_
  17. #define _chxavplayview_h_
  18. // Helix includes...
  19. #include "ihxpckts.h"
  20. #include "hxfiles.h"
  21. #include "unkimp.h"
  22. #include "hxurl.h"
  23. #include "hxwintyp.h"
  24. #include "hxcom.h"
  25. #include "hxcomm.h"
  26. #include "hxmon.h"
  27. #include "hxslist.h"
  28. #include "hxstring.h"
  29. // Includes for this project...
  30. #include "chxavcallback.h"
  31. #include "chxavplayviewwindow.h"
  32. //#include "chxavwaitnote.h"
  33. #include "chxavviewbase.h"
  34. #include "chxsymsysagentwatcher.h"
  35. #include "ihxsymplayerstateobserver.h"
  36. // Forward declarations...
  37. class CHXAvPlayerUI;
  38. class CAknTitlePane;
  39. class CHXAvPlayView;
  40. class CHXAvPlayView
  41. : public CHXAvViewBase
  42. , public IHXSymPlayerStateObserver
  43. {
  44. public:
  45.     friend class CHXAvPlayViewWindow;
  46. public:
  47.     CHXAvPlayView(TInt idxView, CHXAvPlayerUI *pContext);
  48.     virtual ~CHXAvPlayView(); 
  49.     virtual void ConstructL();
  50.     comptr<CHXAvPlayer> GetPlayer();
  51.     // CHXAvAppViewBase 
  52.     void HandleCommandL(TInt command);
  53.     void UpdateViewStateL();    
  54.     CCoeControl* CreateViewWindowForActivatingViewL();
  55.     void FinishViewActivateL();
  56.     void FinishViewDeactivateL();
  57.     void HandleLosePlayFocus();
  58.     void HandleForegroundEventL(TBool bEnterForeground);
  59.      // IHXSymPlayerStateObserver
  60.     void OnLoadSession(IHXRequest* request);
  61.     void OnResume();
  62.     void OnStop();
  63.     void OnPause();
  64.     void OnPlayInitiate(const char *url);
  65.     void OnBeginBuffering(bool bIsBegin);
  66.     void OnBeginSeek();
  67.     void OnVolume(unsigned int percentVol);
  68.     void OnMute(bool bMute);
  69.     void OnNetConnect();
  70.     void OnAdvancePlaylist();
  71.     void OnError(HX_RESULT code);
  72.     void SetViewActivateClipL(const TDesC& file);
  73.     void SetShutdownOnViewDeactivation(bool bDoShutdownAutomatically);
  74. protected:
  75.     // implementation helpers
  76.     void UpdateSoftkeyMenuStateL();
  77.     void DoSaveL();
  78.     void DoViewClipInfoL();
  79.     // seek related
  80.     void EnterSeekMode(bool bEnter);
  81.     void HandleSeekKeyCommand(bool bForward);
  82.     UINT32 GetNextSeekStep(UINT32 msSeekStep);
  83.     void SetEndSeekCallback(bool bEnable);
  84.     void OnEndSeekCallback();
  85.     void ActivateNaviVolumeControlL(TUint msHide);
  86.     void UpdateNaviVolumeControlL();
  87.     void DeactivateNaviVolumeControl();
  88.     void ActivateNaviPlaylistControlL(TUint msHide);
  89.     void UpdateNaviPlaylistControlL();
  90.     void DeactivateNaviPlaylistControl();
  91.     void DrawNaviPlaylistControlNowL();
  92.     void EnsureExitPlaylistMode();
  93.     
  94.     void HideTempNaviControlNowL();
  95.     void UpdateNaviDefaultControlL();
  96.     void DrawNaviDefaultControlNowL();
  97.     void UpdateTitleL();
  98.     void HandleVolumeCommand(TInt idCmd);
  99.     bool TryHandlePlaylistCommandL(TInt command);
  100.     void HaltPlayer();
  101.     void OnPhoneEvent();
  102.     void OnBacklightTimer();
  103.     void InitBacklightState();
  104.     bool IsPlaylistMode();
  105.     void HandleShowPopupL();
  106.     // CAknView and derived...
  107.     void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
  108.     // misc implementation
  109.     void InitIdleOptionsMenu(CEikMenuPane* aMenuPane);
  110.     void InitPausedOptionsMenu(CEikMenuPane* aMenuPane);
  111.     void InitSaveMenuItem(CEikMenuPane* aMenuPane);
  112.     void InitLivePlayOptionsMenu(CEikMenuPane* aMenuPane);
  113.     void InitClipInfoMenuItem(CEikMenuPane* aMenuPane);
  114.     void InitPlaylistMenuItems(CEikMenuPane* pMenuPane);
  115.     void InitNonIdleMenuOptions(CEikMenuPane* pMenuPane);
  116.     
  117.     void UpdateContextPaneL();
  118.     void OnUserCancelConnect();
  119.     void DoExitPlaylistModeL(bool bPlayCurrent);
  120.     void DoTogglePlayState();
  121.     void ShowTempPlaylistControlL();
  122. private:
  123.    
  124.     CHXAvPlayViewWindowPtr m_spWindow;
  125.     refptr<HBufC> m_spViewActivateClip;
  126.     refptr<CAknNavigationDecorator> m_spNaviDefaultDecorator;
  127.     refptr<CAknNavigationDecorator> m_spNaviVolDecorator;
  128.     refptr<CAknNavigationDecorator> m_spNaviPlaylistDecorator;
  129.     CHXAvCallback m_cbTempNaviDisplay;
  130.     CHXAvCallback m_cbBacklight;
  131.     CHXAvCallback m_cbEndSeek;
  132.     bool m_bViewPlaylistMode;
  133.     bool m_bEnsureResumeOnExitPlaylistMode;
  134.     UINT32 m_msSeekStep;
  135.     
  136.     TInt    m_lastPhoneState;
  137.     CHXSymSysAgentWatcher m_saWatcher;
  138.     
  139.     bool m_bShutDownOnViewDeactivate;
  140.     CHXAvNetConnectUIPtr m_spNetConnectUi;
  141.     comptr<CHXAvPlayer> m_player;
  142. };
  143. inline 
  144. bool CHXAvPlayView::IsPlaylistMode()
  145. {
  146.     return m_bViewPlaylistMode;
  147. }
  148. inline
  149. comptr<CHXAvPlayer> CHXAvPlayView::GetPlayer()
  150. {
  151.     return m_player;
  152. }
  153. inline
  154. void CHXAvPlayView::SetShutdownOnViewDeactivation(bool bDoShutdownAutomatically)
  155. {
  156.     //
  157.     // this flag will prevent player from shutting down when view switches (presumably
  158.     // so when we return to the view the player state is same as before)
  159.     //
  160.     m_bShutDownOnViewDeactivate = bDoShutdownAutomatically;
  161. }
  162. #endif // _chxavplayview_h_