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