Commit a1710873 authored by Lukas Durfina's avatar Lukas Durfina Committed by Jean-Baptiste Kempf

Fullscreen controller

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent e6a8ec99
...@@ -42,6 +42,22 @@ ...@@ -42,6 +42,22 @@
#include <QFrame> #include <QFrame>
#define VOLUME_MAX 200 #define VOLUME_MAX 200
/* on WIN32 hide() for fullscreen controller doesnt work, so it have to be
done by trick with setting the opacity of window */
#ifdef WIN32
#define WIN32TRICK
#endif
/* to trying transparency with fullscreen controller on windows enable that */
/* #define TRANSPARENCY */
/* it can be enabled on non windows systems,
but it will be transparent only with composite manager */
#ifndef WIN32
#define TRANSPARENCY
#endif
class ResizeEvent; class ResizeEvent;
class QPalette; class QPalette;
class QPixmap; class QPixmap;
...@@ -155,7 +171,8 @@ class ControlsWidget : public QFrame ...@@ -155,7 +171,8 @@ class ControlsWidget : public QFrame
Q_OBJECT Q_OBJECT
public: public:
/* p_intf, advanced control visible or not, blingbling or not */ /* p_intf, advanced control visible or not, blingbling or not */
ControlsWidget( intf_thread_t *, MainInterface*, bool, bool ); ControlsWidget( intf_thread_t *_p_i, MainInterface *_p_mi,
bool b_advControls, bool b_shiny, bool b_fsCreation = false);
virtual ~ControlsWidget(); virtual ~ControlsWidget();
QPushButton *playlistButton; QPushButton *playlistButton;
...@@ -167,21 +184,23 @@ public slots: ...@@ -167,21 +184,23 @@ public slots:
protected: protected:
friend class MainInterface; friend class MainInterface;
friend class VolumeClickHandler; friend class VolumeClickHandler;
private: protected:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QWidget *discFrame; QWidget *discFrame;
QWidget *telexFrame; QWidget *telexFrame;
QGridLayout *controlLayout; QGridLayout *controlLayout;
InputSlider *slider; InputSlider *slider;
QPushButton *prevSectionButton, *nextSectionButton, *menuButton; QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
QPushButton *playButton, *fullscreenButton; QPushButton *playButton, *fullscreenButton, *extSettingsButton;
QToolButton *slowerButton, *fasterButton; QToolButton *slowerButton, *fasterButton;
QHBoxLayout *controlButLayout;
AdvControlsWidget *advControls; AdvControlsWidget *advControls;
QLabel *volMuteLabel; QLabel *volMuteLabel;
QAbstractSlider *volumeSlider; QAbstractSlider *volumeSlider;
VolumeClickHandler *hVolLabel;
bool b_advancedVisible; bool b_advancedVisible;
private slots: protected slots:
void play(); void play();
void stop(); void stop();
void prev(); void prev();
...@@ -198,6 +217,69 @@ signals: ...@@ -198,6 +217,69 @@ signals:
void advancedControlsToggled( bool ); void advancedControlsToggled( bool );
}; };
/***********************************
* Fullscreen controller
***********************************/
static int showFullscreenControllCallback(vlc_object_t *vlc_object, const char *variable, vlc_value_t old_val,
vlc_value_t new_val, void *data);
static int regMouseMoveCallback(vlc_object_t *vlc_object, const char *variable, vlc_value_t old_val,
vlc_value_t new_val, void *data);
class FullscreenControllerWidget : public ControlsWidget
{
Q_OBJECT
public:
FullscreenControllerWidget( intf_thread_t *, MainInterface*, bool, bool );
virtual ~FullscreenControllerWidget();
void SetHideTimeout( int hideTimeout ) { i_hideTimeout = hideTimeout; }
void regFullscreenCallback( vout_thread_t *p_vout );
bool isFSCHidden();
public slots:
void unregFullscreenCallback();
protected:
friend class MainInterface;
friend class VolumeClickHandler;
virtual void mouseMoveEvent( QMouseEvent *event );
virtual void mousePressEvent( QMouseEvent *event );
virtual void enterEvent( QEvent *event );
virtual void leaveEvent( QEvent *event );
virtual void keyPressEvent( QKeyEvent *event );
private slots:
void hideFSControllerWidget();
#ifdef TRANSPARENCY
void slowHideFSC();
#endif
private:
QTimer *p_hideTimer;
#ifdef TRANSPARENCY
QTimer *p_slowHideTimer;
#endif
int i_lastPosX;
int i_lastPosY;
int i_hideTimeout; /* FSC hiding timeout, same as mouse hiding timeout */
bool b_mouseIsOver;
#ifdef WIN32TRICK
bool fscHidden;
#endif
virtual void customEvent( QEvent *event );
};
class VolumeClickHandler : public QObject class VolumeClickHandler : public QObject
{ {
public: public:
......
...@@ -98,6 +98,7 @@ void InputManager::setInput( input_thread_t *_p_input ) ...@@ -98,6 +98,7 @@ void InputManager::setInput( input_thread_t *_p_input )
p_input = NULL; p_input = NULL;
i_input_id = 0; i_input_id = 0;
emit rateChanged( INPUT_RATE_DEFAULT ); emit rateChanged( INPUT_RATE_DEFAULT );
emit inputUnset();
} }
} }
......
...@@ -42,6 +42,9 @@ static int const ItemStateChanged_Type = QEvent::User + IMEventType + 3; ...@@ -42,6 +42,9 @@ static int const ItemStateChanged_Type = QEvent::User + IMEventType + 3;
static int const ItemTitleChanged_Type = QEvent::User + IMEventType + 4; static int const ItemTitleChanged_Type = QEvent::User + IMEventType + 4;
static int const ItemRateChanged_Type = QEvent::User + IMEventType + 5; static int const ItemRateChanged_Type = QEvent::User + IMEventType + 5;
static int const VolumeChanged_Type = QEvent::User + IMEventType + 6; static int const VolumeChanged_Type = QEvent::User + IMEventType + 6;
static int const FullscreenControlShow_Type = QEvent::User + IMEventType + 7;
static int const FullscreenControlHide_Type = QEvent::User + IMEventType + 8;
static int const FullscreenControlPlanHide_Type = QEvent::User + IMEventType + 9;
class IMEvent : public QEvent class IMEvent : public QEvent
{ {
...@@ -113,6 +116,8 @@ signals: ...@@ -113,6 +116,8 @@ signals:
/// Play/pause status /// Play/pause status
void statusChanged( int ); void statusChanged( int );
void artChanged( QString ); void artChanged( QString );
/// Controll of fullscreen controller
void inputUnset();
#ifdef ZVBI_COMPILED #ifdef ZVBI_COMPILED
void teletextEnabled( bool ); void teletextEnabled( bool );
#endif #endif
......
...@@ -82,10 +82,19 @@ static void *DoRequest( intf_thread_t *p_intf, vout_thread_t *p_vout, ...@@ -82,10 +82,19 @@ static void *DoRequest( intf_thread_t *p_intf, vout_thread_t *p_vout,
{ {
return p_intf->p_sys->p_mi->requestVideo( p_vout, pi1, pi2, pi3, pi4 ); return p_intf->p_sys->p_mi->requestVideo( p_vout, pi1, pi2, pi3, pi4 );
} }
static void *DoNotEmbeddedRequest( intf_thread_t *p_intf, vout_thread_t *p_vout,
int *pi1, int *pi2, unsigned int*pi3,unsigned int*pi4)
{
p_intf->p_sys->p_mi->requestNotEmbeddedVideo( p_vout );
return NULL;
}
static void DoRelease( intf_thread_t *p_intf, void *p_win ) static void DoRelease( intf_thread_t *p_intf, void *p_win )
{ {
return p_intf->p_sys->p_mi->releaseVideo( p_win ); return p_intf->p_sys->p_mi->releaseVideo( p_win );
} }
static int DoControl( intf_thread_t *p_intf, void *p_win, int i_q, va_list a ) static int DoControl( intf_thread_t *p_intf, void *p_win, int i_q, va_list a )
{ {
return p_intf->p_sys->p_mi->controlVideo( p_win, i_q, a ); return p_intf->p_sys->p_mi->controlVideo( p_win, i_q, a );
...@@ -240,6 +249,13 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -240,6 +249,13 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
CONNECT( controls, advancedControlsToggled( bool ), CONNECT( controls, advancedControlsToggled( bool ),
this, doComponentsUpdate() ); this, doComponentsUpdate() );
CONNECT( fullscreenControls, advancedControlsToggled( bool ),
this, doComponentsUpdate() );
CONNECT( THEMIM->getIM(), inputUnset(),
fullscreenControls, unregFullscreenCallback() );
/* Size and placement of interface */ /* Size and placement of interface */
QVLCTools::restoreWidgetPosition(settings,this,QSize(350,60)); QVLCTools::restoreWidgetPosition(settings,this,QSize(350,60));
...@@ -404,6 +420,12 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -404,6 +420,12 @@ void MainInterface::handleMainUi( QSettings *settings )
settings->value( "adv-controls", false ).toBool(), settings->value( "adv-controls", false ).toBool(),
config_GetInt( p_intf, "qt-blingbling" ) ); config_GetInt( p_intf, "qt-blingbling" ) );
/* Create the FULLSCREEN CONTROLS Widget */
/* bool b_shiny = config_GetInt( p_intf, "qt-blingbling" ); */
fullscreenControls = new FullscreenControllerWidget( p_intf, this,
settings->value( "adv-controls", false ).toBool(),
config_GetInt( p_intf, "qt-blingbling" ) );
/* Add the controls Widget to the main Widget */ /* Add the controls Widget to the main Widget */
mainLayout->insertWidget( 0, controls, 0, Qt::AlignBottom ); mainLayout->insertWidget( 0, controls, 0, Qt::AlignBottom );
...@@ -444,6 +466,10 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -444,6 +466,10 @@ void MainInterface::handleMainUi( QSettings *settings )
p_intf->pf_release_window = ::DoRelease; p_intf->pf_release_window = ::DoRelease;
p_intf->pf_control_window = ::DoControl; p_intf->pf_control_window = ::DoControl;
} }
else
{
p_intf->pf_request_window = ::DoNotEmbeddedRequest;
}
/* Finish the sizing */ /* Finish the sizing */
main->updateGeometry(); main->updateGeometry();
...@@ -695,10 +721,19 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x, ...@@ -695,10 +721,19 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
emit askVideoToResize( *pi_width, *pi_height ); emit askVideoToResize( *pi_width, *pi_height );
emit askUpdate(); emit askUpdate();
fullscreenControls->regFullscreenCallback( p_nvout );
} }
return ret; return ret;
} }
/* function called from ::DoRequest in order to show a nice VideoWidget
at the good size */
void MainInterface::requestNotEmbeddedVideo( vout_thread_t *p_nvout )
{
fullscreenControls->regFullscreenCallback( p_nvout );
}
void MainInterface::releaseVideo( void *p_win ) void MainInterface::releaseVideo( void *p_win )
{ {
emit askReleaseVideo( p_win ); emit askReleaseVideo( p_win );
...@@ -898,8 +933,10 @@ void MainInterface::setStatus( int status ) ...@@ -898,8 +933,10 @@ void MainInterface::setStatus( int status )
msg_Dbg( p_intf, "I was here, updating your status" ); msg_Dbg( p_intf, "I was here, updating your status" );
/* Forward the status to the controls to toggle Play/Pause */ /* Forward the status to the controls to toggle Play/Pause */
controls->setStatus( status ); controls->setStatus( status );
fullscreenControls->setStatus( status );
controls->updateInput(); controls->updateInput();
fullscreenControls->updateInput();
speedControl->setEnable( THEMIM->getIM()->hasInput() ); speedControl->setEnable( THEMIM->getIM()->hasInput() );
/* And in the systray for the menu */ /* And in the systray for the menu */
......
...@@ -45,6 +45,7 @@ class PlaylistWidget; ...@@ -45,6 +45,7 @@ class PlaylistWidget;
class VisualSelector; class VisualSelector;
class AdvControlsWidget; class AdvControlsWidget;
class ControlsWidget; class ControlsWidget;
class FullscreenControllerWidget;
class SpeedControlWidget; class SpeedControlWidget;
class QMenu; class QMenu;
class QSize; class QSize;
...@@ -72,6 +73,7 @@ public: ...@@ -72,6 +73,7 @@ public:
void *requestVideo( vout_thread_t *p_nvout, int *pi_x, void *requestVideo( vout_thread_t *p_nvout, int *pi_x,
int *pi_y, unsigned int *pi_width, int *pi_y, unsigned int *pi_width,
unsigned int *pi_height ); unsigned int *pi_height );
void requestNotEmbeddedVideo( vout_thread_t *p_nvout );
void releaseVideo( void * ); void releaseVideo( void * );
int controlVideo( void *p_window, int i_query, va_list args ); int controlVideo( void *p_window, int i_query, va_list args );
void requestLayoutUpdate(); void requestLayoutUpdate();
...@@ -99,6 +101,7 @@ private: ...@@ -99,6 +101,7 @@ private:
QString input_name; QString input_name;
QVBoxLayout *mainLayout; QVBoxLayout *mainLayout;
ControlsWidget *controls; ControlsWidget *controls;
FullscreenControllerWidget *fullscreenControls;
QMenu *speedControlMenu; QMenu *speedControlMenu;
SpeedControlWidget *speedControl; SpeedControlWidget *speedControl;
QProgressBar *pgBar; QProgressBar *pgBar;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment