videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/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_
    26 #include <qobject>
    26 #include <qobject>
    27 
    27 
    28 #include <mpxplaybackframeworkdefs.h>
    28 #include <mpxplaybackframeworkdefs.h>
    29 
    29 
    30 #include "mpxvideo_debug.h"
    30 #include "mpxvideo_debug.h"
    31 #include "mpxvideoplaybackcontrol.hrh"
       
    32 #include "mpxcommonvideoplaybackview.hrh"
    31 #include "mpxcommonvideoplaybackview.hrh"
    33 #include "mpxvideoplaybackviewfiledetails.h"
    32 #include "mpxvideoplaybackviewfiledetails.h"
    34 
    33 
    35 // FORWARD DECLARATIONS
    34 // FORWARD DECLARATIONS
    36 class QTimer;
       
    37 class QString;
       
    38 class HbAction;
       
    39 class QActionGroup;
       
    40 class QMPXVideoPlaybackControlPolicy;
       
    41 class QMPXVideoPlaybackControlsLayout;
       
    42 class QMPXVideoPlaybackDocumentLoader;
    35 class QMPXVideoPlaybackDocumentLoader;
    43 class QMPXVideoPlaybackFullScreenControl;
       
    44 class QMPXVideoPlaybackNonTouchVolumeBar;
       
    45 class QMPXVideoPlaybackControlsController;
    36 class QMPXVideoPlaybackControlsController;
    46 class QMPXVideoPlaybackControlConfiguration;
    37 class QMPXVideoPlaybackControlConfiguration;
    47 
    38 
    48 
       
    49 // DATA TYPES
       
    50 
       
    51 enum TMPXTimerAction
       
    52 {
       
    53     EMPXTimerCancel,
       
    54     EMPXTimerReset
       
    55 };
       
    56 
       
    57 enum TPlaybackViewMode
       
    58 {
       
    59     EFullScreenView,
       
    60     EDetailsView,
       
    61     EAudioOnlyView
       
    62 };
       
    63 
       
    64 const int KMPXControlsTimeOut = 4000;
       
    65 
    39 
    66 
    40 
    67 // CLASS DECLARATION
    41 // CLASS DECLARATION
    68 
    42 
    69 class QMPXVideoPlaybackControlsController : public QObject
    43 class QMPXVideoPlaybackControlsController : public QObject
    81         * Destructor.
    55         * Destructor.
    82         */
    56         */
    83         virtual ~QMPXVideoPlaybackControlsController();
    57         virtual ~QMPXVideoPlaybackControlsController();
    84 
    58 
    85     public:
    59     public:
    86 
       
    87         /**
       
    88         * Handle event from container
       
    89         */
       
    90         void handleEvent( TMPXVideoPlaybackControlCommandIds event, int value = 0 );
       
    91 
       
    92         /**
       
    93         * Command handling function.
       
    94         * Call HandleCommandL() of container
       
    95         */
       
    96         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 
       
   108         /**
       
   109         * Reset or cancel timers for the controls
       
   110         */
       
   111         void resetDisappearingTimers( TMPXTimerAction timerAction );
       
   112 
       
   113         /**
       
   114         * Return state
       
   115         */
       
   116         inline TMPXPlaybackState state();
       
   117 
       
   118         /**
    60         /**
   119         * Return file details
    61         * Return file details
   120         */
    62         */
   121         inline QMPXVideoPlaybackViewFileDetails* fileDetails();
    63         inline QMPXVideoPlaybackViewFileDetails* fileDetails();
   122 
    64 
   123         //
       
   124         //  Add the file details to the controls controller when available
       
   125         //
       
   126         void addFileDetails( QMPXVideoPlaybackViewFileDetails* details );
       
   127 
       
   128         QMPXVideoPlaybackDocumentLoader* layoutLoader();
    65         QMPXVideoPlaybackDocumentLoader* layoutLoader();
   129 
       
   130         inline bool isFlipView();
       
   131 
       
   132         void updateVideoRectDone();
       
   133         
       
   134         void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
       
   135         
       
   136         TPlaybackViewMode viewMode();
       
   137 
    66 
   138     public:
    67     public:
   139         /**
    68         /**
   140         * Initialize controller
    69         * Initialize controller
   141         */
    70         */
   142         void initializeController();
    71         void initializeController();
   143 
    72 
   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:
    73     public:
   267         QMPXVideoPlaybackViewFileDetails          *mFileDetails;
    74         QMPXVideoPlaybackViewFileDetails          *mFileDetails;
   268 
    75 
   269         QList<QMPXVideoPlaybackFullScreenControl*> mControls;
       
   270 
       
   271         QMPXVideoPlaybackControlPolicy            *mControlsPolicy;
       
   272         QMPXVideoPlaybackControlConfiguration     *mControlsConfig;
    76         QMPXVideoPlaybackControlConfiguration     *mControlsConfig;
   273 
    77 
   274         QTimer                                    *mControlsTimer;
       
   275 
       
   276         QMPXVideoPlaybackDocumentLoader           *mLoader;
    78         QMPXVideoPlaybackDocumentLoader           *mLoader;
   277         QMPXVideoPlaybackNonTouchVolumeBar        *mVolumeControl;
       
   278 
       
   279         bool                                       mFlipViewOpened;
       
   280         bool                                       mViewTransitionIsGoingOn;
       
   281         TMPXPlaybackState                          mState;
       
   282         TPlaybackViewMode                          mViewMode;
       
   283         
       
   284 };
    79 };
   285 
       
   286 // INLINE METHODS
       
   287 // -------------------------------------------------------------------------------------------------
       
   288 //   QMPXVideoPlaybackControlsController::state
       
   289 // -------------------------------------------------------------------------------------------------
       
   290 //
       
   291 inline
       
   292 TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
       
   293 {
       
   294     return mState;
       
   295 }
       
   296 
    80 
   297 // -------------------------------------------------------------------------------------------------
    81 // -------------------------------------------------------------------------------------------------
   298 //   QMPXVideoPlaybackControlsController::fileDetails
    82 //   QMPXVideoPlaybackControlsController::fileDetails
   299 // -------------------------------------------------------------------------------------------------
    83 // -------------------------------------------------------------------------------------------------
   300 //
    84 //
   302 QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
    86 QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
   303 {
    87 {
   304     return mFileDetails;
    88     return mFileDetails;
   305 }
    89 }
   306 
    90 
   307 // -------------------------------------------------------------------------------------------------
       
   308 //   QMPXVideoPlaybackControlsController::isTvOutConnected
       
   309 // -------------------------------------------------------------------------------------------------
       
   310 //
       
   311 inline
       
   312 bool QMPXVideoPlaybackControlsController::isTvOutConnected()
       
   313 {
       
   314     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutConnected(%d)"),
       
   315             mFileDetails->mTvOutConnected);
       
   316 
       
   317     return mFileDetails->mTvOutConnected;
       
   318 }
       
   319 
       
   320 // -------------------------------------------------------------------------------------------------
       
   321 //   QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed
       
   322 // -------------------------------------------------------------------------------------------------
       
   323 //
       
   324 inline
       
   325 bool QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed()
       
   326 {
       
   327     bool playable = ( ! mFileDetails->mTvOutConnected || mFileDetails->mTvOutPlayAllowed );
       
   328 
       
   329     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() [%d]"),
       
   330             playable);
       
   331 
       
   332     return playable;
       
   333 }
       
   334 
       
   335 // -------------------------------------------------------------------------------------------------
       
   336 //   QMPXVideoPlaybackControlsController::isFlipView
       
   337 // -------------------------------------------------------------------------------------------------
       
   338 //
       
   339 inline
       
   340 bool QMPXVideoPlaybackControlsController::isFlipView()
       
   341 {
       
   342     return mFlipViewOpened;
       
   343 }
       
   344 
       
   345 
       
   346 #endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
    91 #endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
   347 
    92 
   348 // End of File
    93 // End of File