X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fcomponents%2Finterface_widgets.hpp;h=3c0a880d7818a3e2a185af8dcb83af19f30bf83e;hb=098dab901c1a17c869a52d0d4042d03f00a83d67;hp=2e79352656d9896f866eb7c8d4dc39d35d1c27dd;hpb=f3c5b0ad6afed1fd2cf8430443dad7f14db23632;p=vlc diff --git a/modules/gui/qt4/components/interface_widgets.hpp b/modules/gui/qt4/components/interface_widgets.hpp index 2e79352656..3c0a880d78 100644 --- a/modules/gui/qt4/components/interface_widgets.hpp +++ b/modules/gui/qt4/components/interface_widgets.hpp @@ -6,6 +6,7 @@ * * Authors: Clément Stenac * Jean-Baptiste Kempf + * Rafaël Carré * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,15 +26,41 @@ #ifndef _INTFWIDGETS_H_ #define _INTFWIDGETS_H_ -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include #include + #include "qt4.hpp" +#include "main_interface.hpp" +#include "input_manager.hpp" #include #include +#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 */ +/* it can be enabled on-non windows systems, + but it will be transparent only with composite manager */ +#ifndef WIN32 + #define HAVE_TRANSPARENCY 1 +#else + #define HAVE_TRANSPARENCY 0 +#endif + +/* Default value of opacity for FS controller */ +#define DEFAULT_OPACITY 0.75 + class ResizeEvent; class QPalette; class QPixmap; @@ -44,47 +71,59 @@ class QHBoxLayout; class VideoWidget : public QFrame { Q_OBJECT +friend class MainInterface; + public: VideoWidget( intf_thread_t * ); virtual ~VideoWidget(); void *request( vout_thread_t *, int *, int *, unsigned int *, unsigned int * ); - void release( void * ); - int control( void *, int, va_list ); - - int i_video_height, i_video_width; - vout_thread_t *p_vout; + void release( void * ); + int control( void *, int, va_list ); - QSize widgetSize; virtual QSize sizeHint() const; private: - QWidget *frame; intf_thread_t *p_intf; - vlc_mutex_t lock; + int i_vout; + + QSize videoSize; + +signals: + void askVideoWidgetToShow( unsigned int, unsigned int ); + +public slots: + void SetSizing( unsigned int, unsigned int ); + +protected: + virtual QPaintEngine *paintEngine() const + { + return NULL; + } + + virtual void paintEvent(QPaintEvent *); }; /******************** Background Widget ****************/ -class BackgroundWidget : public QFrame +class BackgroundWidget : public QWidget { Q_OBJECT public: BackgroundWidget( intf_thread_t * ); virtual ~BackgroundWidget(); - QSize widgetSize; - virtual QSize sizeHint() const; + private: QPalette plt; QLabel *label; - QHBoxLayout *backgroundLayout; - virtual void resizeEvent( QResizeEvent *e ); - int DrawBackground(); - int CleanBackground(); + virtual void contextMenuEvent( QContextMenuEvent *event ); intf_thread_t *p_intf; -private slots: - void setArt( QString ); + virtual void resizeEvent( QResizeEvent * event ); +public slots: + void toggle(){ TOGGLEV( this ); } + void updateArt( QString ); }; +#if 0 class VisualSelector : public QFrame { Q_OBJECT @@ -98,7 +137,9 @@ private slots: void prev(); void next(); }; +#endif +/* Advanced Button Bar */ class QPushButton; class AdvControlsWidget : public QFrame { @@ -106,58 +147,155 @@ class AdvControlsWidget : public QFrame public: AdvControlsWidget( intf_thread_t *); virtual ~AdvControlsWidget(); + void enableInput( bool ); void enableVideo( bool ); + private: intf_thread_t *p_intf; - QPushButton *slowerButton, *normalButton, *fasterButton; - QPushButton *fullscreenButton, *snapshotButton; + QPushButton *recordButton, *ABButton; + QPushButton *snapshotButton, *frameButton; + + mtime_t timeA, timeB; + private slots: - void faster(); - void slower(); - void normal(); void snapshot(); - void fullscreen(); +#if 0 + void frame(); +#endif + void fromAtoB(); + void record(); + void AtoBLoop( float, int, int ); }; +/* Button Bar */ class InputSlider; class QSlider; class QGridLayout; class VolumeClickHandler; +class SoundSlider; +class QAbstractSlider; +class QToolButton; + class ControlsWidget : public QFrame { Q_OBJECT public: - ControlsWidget( intf_thread_t *); + /* p_intf, advanced control visible or not, blingbling or not */ + ControlsWidget( intf_thread_t *_p_i, MainInterface *_p_mi, + bool b_advControls, bool b_shiny, bool b_fsCreation = false); virtual ~ControlsWidget(); QPushButton *playlistButton; - QSlider *volumeSlider; void setStatus( int ); + void enableInput( bool ); + void enableVideo( bool ); public slots: void setNavigation( int ); - void updateOnTimer(); protected: friend class MainInterface; friend class VolumeClickHandler; -private: - intf_thread_t *p_intf; - QFrame *discFrame; - QGridLayout *controlLayout; +protected: + intf_thread_t *p_intf; + QWidget *discFrame; + QWidget *telexFrame; + QGridLayout *controlLayout; InputSlider *slider; - QPushButton *prevSectionButton, *nextSectionButton, *menuButton; - QPushButton *playButton; -private slots: + QPushButton *prevSectionButton, *nextSectionButton, *menuButton; + QPushButton *playButton, *fullscreenButton, *extSettingsButton; + QPushButton *telexTransparent, *telexOn; + QSpinBox *telexPage; + QToolButton *slowerButton, *fasterButton; + QHBoxLayout *controlButLayout; + AdvControlsWidget *advControls; + QLabel *volMuteLabel; + QAbstractSlider *volumeSlider; + VolumeClickHandler *hVolLabel; + + bool b_advancedVisible; + bool b_telexTransparent; + bool b_telexEnabled; +protected slots: void play(); void stop(); void prev(); void next(); void updateVolume( int ); + void updateVolume( void ); + void updateInput(); void fullscreen(); void extSettings(); - void prefs(); + void faster(); + void slower(); + void toggleAdvanced(); + void toggleTeletext(); + void toggleTeletextTransparency(); + void enableTeletext( bool ); +signals: + void advancedControlsToggled( bool ); +}; + +/*********************************** + * Fullscreen controller + ***********************************/ +class FullscreenControllerWidget : public ControlsWidget +{ + Q_OBJECT +public: + FullscreenControllerWidget( intf_thread_t *, MainInterface*, bool, bool ); + virtual ~FullscreenControllerWidget(); + + /* */ + void attachVout( vout_thread_t *p_vout ); + void detachVout( vout_thread_t *p_vout ); + void fullscreenChanged( vout_thread_t *, bool b_fs, int i_timeout ); + +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 showFSC(); + void planHideFSC(); + void hideFSC(); + + void slowHideFSC(); + + +private: + QTimer *p_hideTimer; +#if HAVE_TRANSPARENCY + QTimer *p_slowHideTimer; +#endif + + int i_mouse_last_x; + int i_mouse_last_y; + + bool b_mouse_over; + + bool b_slow_hide_begin; + int i_slow_hide_timeout; + +#ifdef WIN32TRICK + bool fscHidden; +#endif + + virtual void customEvent( QEvent *event ); + + /* Shared variable between FSC and VLC (protected by a lock) */ + vlc_mutex_t lock; + bool b_fullscreen; + int i_hide_timeout; /* FSC hiding timeout, same as mouse hiding timeout */ }; + + class VolumeClickHandler : public QObject { public: @@ -166,9 +304,12 @@ public: virtual ~VolumeClickHandler() {}; bool eventFilter( QObject *obj, QEvent *e ) { - if (e->type() == QEvent::MouseButtonPress ) + if (e->type() == QEvent::MouseButtonPress ) { aout_VolumeMute( p_intf, NULL ); + audio_volume_t i_volume; + aout_VolumeGet( p_intf, &i_volume ); + m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) ); return true; } return false; @@ -178,36 +319,56 @@ private: intf_thread_t *p_intf; }; +#include +#include +class TimeLabel : public QLabel +{ + Q_OBJECT + void mousePressEvent( QMouseEvent *event ) + { + emit timeLabelClicked(); + } + void mouseDoubleClickEvent( QMouseEvent *event ) + { + emit timeLabelDoubleClicked(); + } +signals: + void timeLabelClicked(); + void timeLabelDoubleClicked(); +}; -/******************** Playlist Widgets ****************/ -#include -#include -class QSignalMapper; -class PLSelector; -class PLPanel; -class QPushButton; +class SpeedLabel : public QLabel +{ + Q_OBJECT +public: + SpeedLabel( intf_thread_t *_p_intf, const QString text ): QLabel( text) + { p_intf = _p_intf; } -class PlaylistWidget : public QSplitter +protected: + virtual void mouseDoubleClickEvent ( QMouseEvent * event ) + { + THEMIM->getIM()->setRate( INPUT_RATE_DEFAULT ); + } +private: + intf_thread_t *p_intf; +}; + +/******************** Speed Control Widgets ****************/ +class SpeedControlWidget : public QFrame { - Q_OBJECT; + Q_OBJECT public: - PlaylistWidget( intf_thread_t *_p_i ) ; - virtual ~PlaylistWidget(); - QSize widgetSize; - virtual QSize sizeHint() const; + SpeedControlWidget( intf_thread_t *); + virtual ~SpeedControlWidget(); + void updateControls( int ); private: - PLSelector *selector; - PLPanel *rightPanel; - QPushButton *addButton; - QLabel *art; - QString prevArt; -protected: - intf_thread_t *p_intf; + intf_thread_t *p_intf; + QSlider *speedSlider; +public slots: + void setEnable( bool ); private slots: - void setArt( QString ); -signals: - void rootChanged( int ); - void artSet( QString ); + void updateRate( int ); + void resetRate(); }; #endif