videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/inc/mpxvideoplaybackcontrolscontroller.h
changeset 36 8aed59de29f9
parent 34 bbb98528c666
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
    13 *
    13 *
    14 * Description:  Implementation of MPXVideoPlaybackControlsController
    14 * Description:  Implementation of MPXVideoPlaybackControlsController
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 1 %
    18 // Version : %version: 2 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 #ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
    22 #ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
    23 #define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
    23 #define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
    31 #include "mpxvideoplaybackcontrol.hrh"
    31 #include "mpxvideoplaybackcontrol.hrh"
    32 #include "mpxcommonvideoplaybackview.hrh"
    32 #include "mpxcommonvideoplaybackview.hrh"
    33 #include "mpxvideoplaybackviewfiledetails.h"
    33 #include "mpxvideoplaybackviewfiledetails.h"
    34 
    34 
    35 // FORWARD DECLARATIONS
    35 // FORWARD DECLARATIONS
    36 class QTimer;
       
    37 class QString;
       
    38 class HbAction;
       
    39 class QActionGroup;
       
    40 class QMPXVideoPlaybackControlPolicy;
       
    41 class QMPXVideoPlaybackControlsLayout;
       
    42 class QMPXVideoPlaybackDocumentLoader;
    36 class QMPXVideoPlaybackDocumentLoader;
    43 class QMPXVideoPlaybackFullScreenControl;
       
    44 class QMPXVideoPlaybackNonTouchVolumeBar;
       
    45 class QMPXVideoPlaybackControlsController;
    37 class QMPXVideoPlaybackControlsController;
    46 class QMPXVideoPlaybackControlConfiguration;
       
    47 
    38 
    48 
    39 
    49 // DATA TYPES
    40 // DATA TYPES
    50 
    41 
    51 enum TMPXTimerAction
    42 enum TMPXTimerAction
    58 {
    49 {
    59     EFullScreenView,
    50     EFullScreenView,
    60     EDetailsView,
    51     EDetailsView,
    61     EAudioOnlyView
    52     EAudioOnlyView
    62 };
    53 };
    63 
       
    64 const int KMPXControlsTimeOut = 4000;
       
    65 
    54 
    66 
    55 
    67 // CLASS DECLARATION
    56 // CLASS DECLARATION
    68 
    57 
    69 class QMPXVideoPlaybackControlsController : public QObject
    58 class QMPXVideoPlaybackControlsController : public QObject
    81         * Destructor.
    70         * Destructor.
    82         */
    71         */
    83         virtual ~QMPXVideoPlaybackControlsController();
    72         virtual ~QMPXVideoPlaybackControlsController();
    84 
    73 
    85     public:
    74     public:
    86 
       
    87         /**
    75         /**
    88         * Handle event from container
    76         * Initialize controller
    89         */
    77         */
    90         void handleEvent( TMPXVideoPlaybackControlCommandIds event, int value = 0 );
    78         void initializeController();
    91 
    79 
    92         /**
    80         /**
    93         * Command handling function.
    81         * Command handling function.
    94         * Call HandleCommandL() of container
    82         * Call HandleCommandL() of container
    95         */
    83         */
    96         void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
    84         void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
    97 
       
    98         /*
       
    99         * Return ETrue if TV-out cable gets connected
       
   100         */
       
   101         inline bool isTvOutConnected();
       
   102 
       
   103         /*
       
   104          * Return ETrue if TV-out cable is connected and content can be played
       
   105          */
       
   106         inline bool isTvOutPlaybackAllowed();
       
   107 
    85 
   108         /**
    86         /**
   109         * Reset or cancel timers for the controls
    87         * Reset or cancel timers for the controls
   110         */
    88         */
   111         void resetDisappearingTimers( TMPXTimerAction timerAction );
    89         void resetDisappearingTimers( TMPXTimerAction timerAction );
   118         /**
    96         /**
   119         * Return file details
    97         * Return file details
   120         */
    98         */
   121         inline QMPXVideoPlaybackViewFileDetails* fileDetails();
    99         inline QMPXVideoPlaybackViewFileDetails* fileDetails();
   122 
   100 
   123         //
       
   124         //  Add the file details to the controls controller when available
       
   125         //
       
   126         void addFileDetails( QMPXVideoPlaybackViewFileDetails* details );
       
   127 
       
   128         QMPXVideoPlaybackDocumentLoader* layoutLoader();
   101         QMPXVideoPlaybackDocumentLoader* layoutLoader();
   129 
   102 
   130         inline bool isFlipView();
       
   131 
       
   132         void updateVideoRectDone();
       
   133         
       
   134         void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
       
   135         
       
   136         TPlaybackViewMode viewMode();
   103         TPlaybackViewMode viewMode();
   137 
   104 
   138     public:
   105     public:
   139         /**
       
   140         * Initialize controller
       
   141         */
       
   142         void initializeController();
       
   143 
       
   144         /**
       
   145         * Create controls
       
   146         */
       
   147         void createControls();
       
   148 
       
   149         /**
       
   150         * Update controls
       
   151         */
       
   152         void handleStateChange( TMPXPlaybackState newState );
       
   153 
       
   154         /**
       
   155         * Update Control's visibility
       
   156         */
       
   157         void updateControlsVisibility();
       
   158 
       
   159         /**
       
   160         * Toggle visibility
       
   161         */
       
   162         void toggleVisibility();
       
   163 
       
   164         /**
       
   165         * Create/delete controls based on updated control list
       
   166         */
       
   167         void controlsListUpdated();
       
   168 
       
   169         /**
       
   170         * Show Controls and reset the timers
       
   171         */
       
   172         void showControls();
       
   173 
       
   174         /**
       
   175         * Return ETrue if any control is visible
       
   176         */
       
   177         bool isVisible();
       
   178 
       
   179         /**
       
   180         * Append a control based on control index
       
   181         */
       
   182         void appendControl( TMPXVideoPlaybackControls controlIndex );
       
   183 
       
   184         /**
       
   185         * Set changed volume
       
   186         */
       
   187         void volumeChanged( int volume );
       
   188 
       
   189         /**
       
   190         * Set changed duration
       
   191         */
       
   192         void durationChanged( int duration);
       
   193 
       
   194         /**
       
   195         * Set changed position
       
   196         */
       
   197         void positionChanged( int position );
       
   198 
       
   199         /**
       
   200         * Set changed position
       
   201         */
       
   202         void aspectRatioChanged( int aspectRatio );
       
   203 
       
   204         /*
       
   205          *  Sets the download size on the progress bar
       
   206          */
       
   207         void setDownloadSize( int size );
       
   208 
       
   209         /*
       
   210          *  Updates the download ratio on the progress bar
       
   211          */
       
   212         void updateDownloadPosition( int newSize );
       
   213 
       
   214         /**
       
   215         * Set changed state on button bar
       
   216         */
       
   217         void updateStateOnButtonBar();
       
   218 
       
   219         /**
       
   220         * Check whether this clip is real format or not
       
   221         */
       
   222         bool realFormat( QString filename );
       
   223 
       
   224         /**
       
   225         * Check whether this clip is real format or not for streaming/live streaming
       
   226         */
       
   227         bool realFormatForStreaming( const TDesC& des );
       
   228 
       
   229         /**
       
   230         * Check whether this clip is real format or not for local/progressive donwload
       
   231         */
       
   232         bool realFormatForLocal();
       
   233         
       
   234         /**
       
   235         * Handle errors
       
   236         */
       
   237         void handleErrors(); 
       
   238         
       
   239         /**
       
   240 		* Return ETrue if control is visible
       
   241 		*/
       
   242 		bool isSoftKeyVisible( int value );
       
   243 
       
   244         /**
       
   245         * Handle tvout connected/disconnected event
       
   246         */
       
   247     void handleTvOutEvent( bool connected, 
       
   248 		                        TMPXVideoPlaybackControlCommandIds event,
       
   249 		                        int value );
       
   250 
       
   251 		HbAction* createAction( QActionGroup *actionsGroup,
       
   252 		                        int index,
       
   253 		                        const char *slot,
       
   254 		                        const QString& toolTip );
       
   255 
       
   256 		void updateVideoRect(  bool transitionEffect = true ); 
       
   257 
       
   258 		void showVolumeControls();
       
   259 
       
   260     private slots:
       
   261         void hideAllControls();
       
   262         void skipToNextVideoItem();
       
   263         void skipToPreviousVideoItem();
       
   264         void handleTappedOnScreen();
       
   265 
       
   266     public:
       
   267         QMPXVideoPlaybackViewFileDetails          *mFileDetails;
   106         QMPXVideoPlaybackViewFileDetails          *mFileDetails;
   268 
       
   269         QList<QMPXVideoPlaybackFullScreenControl*> mControls;
       
   270 
       
   271         QMPXVideoPlaybackControlPolicy            *mControlsPolicy;
       
   272         QMPXVideoPlaybackControlConfiguration     *mControlsConfig;
       
   273 
       
   274         QTimer                                    *mControlsTimer;
       
   275 
       
   276         QMPXVideoPlaybackDocumentLoader           *mLoader;
   107         QMPXVideoPlaybackDocumentLoader           *mLoader;
   277         QMPXVideoPlaybackNonTouchVolumeBar        *mVolumeControl;
       
   278 
       
   279         bool                                       mFlipViewOpened;
       
   280         bool                                       mViewTransitionIsGoingOn;
       
   281         TMPXPlaybackState                          mState;
   108         TMPXPlaybackState                          mState;
   282         TPlaybackViewMode                          mViewMode;
   109         TPlaybackViewMode                          mViewMode;
   283         TMPXTimerAction                            mTimerAction;
   110         TMPXTimerAction                            mTimerAction;
   284         
   111         TMPXVideoPlaybackViewCommandIds            mCommand;
       
   112         int                                        mValue;
   285 };
   113 };
   286 
   114 
   287 // INLINE METHODS
   115 // INLINE METHODS
   288 // -------------------------------------------------------------------------------------------------
   116 // -------------------------------------------------------------------------------------------------
   289 //   QMPXVideoPlaybackControlsController::state
   117 //   QMPXVideoPlaybackControlsController::state
   303 QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
   131 QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
   304 {
   132 {
   305     return mFileDetails;
   133     return mFileDetails;
   306 }
   134 }
   307 
   135 
   308 // -------------------------------------------------------------------------------------------------
       
   309 //   QMPXVideoPlaybackControlsController::isTvOutConnected
       
   310 // -------------------------------------------------------------------------------------------------
       
   311 //
       
   312 inline
       
   313 bool QMPXVideoPlaybackControlsController::isTvOutConnected()
       
   314 {
       
   315     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutConnected(%d)"),
       
   316             mFileDetails->mTvOutConnected);
       
   317 
       
   318     return mFileDetails->mTvOutConnected;
       
   319 }
       
   320 
       
   321 // -------------------------------------------------------------------------------------------------
       
   322 //   QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed
       
   323 // -------------------------------------------------------------------------------------------------
       
   324 //
       
   325 inline
       
   326 bool QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed()
       
   327 {
       
   328     bool playable = ( ! mFileDetails->mTvOutConnected || mFileDetails->mTvOutPlayAllowed );
       
   329 
       
   330     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() [%d]"),
       
   331             playable);
       
   332 
       
   333     return playable;
       
   334 }
       
   335 
       
   336 // -------------------------------------------------------------------------------------------------
       
   337 //   QMPXVideoPlaybackControlsController::isFlipView
       
   338 // -------------------------------------------------------------------------------------------------
       
   339 //
       
   340 inline
       
   341 bool QMPXVideoPlaybackControlsController::isFlipView()
       
   342 {
       
   343     return mFlipViewOpened;
       
   344 }
       
   345 
       
   346 
       
   347 #endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
   136 #endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
   348 
   137 
   349 // End of File
   138 // End of File