]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/interface_widgets.hpp
Update qt4 interface to use new "teletex-es". It fixes the unwanted display
[vlc] / modules / gui / qt4 / components / interface_widgets.hpp
index e72522a8746ed51b09885e1aabe28d9e43eeba39..e1bcbb5f8cdd78ac22f20963ee5a008461f1b463 100644 (file)
 #ifndef _INTFWIDGETS_H_
 #define _INTFWIDGETS_H_
 
-#include <vlc/vlc.h>
-#include <vlc_interface.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
+#include <vlc_common.h>
+#include <vlc_interface.h>
 #include <vlc_aout.h>
+
 #include "qt4.hpp"
+#include "main_interface.hpp"
+#include "input_manager.hpp"
 
 #include <QWidget>
 #include <QFrame>
+
 #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;
@@ -46,51 +71,56 @@ 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 );
+    void  release( void * );
+    int   control( void *, int, va_list );
 
-    int i_video_height, i_video_width;
-    vout_thread_t *p_vout;
-
-    QSize widgetSize;
-    QSize sizeHint() const;
+    virtual QSize sizeHint() const;
 private:
-    QWidget *frame;
     intf_thread_t *p_intf;
-    vlc_mutex_t lock;
+    int i_vout;
+
+    QSize videoSize;
+
 signals:
-    void askResize();
-    void askVideoToShow();
-private slots:
-    void SetMinSize();
+    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;
-    QSize sizeHint() const;
-    bool b_need_update;
+
 private:
     QPalette plt;
     QLabel *label;
-    virtual void resizeEvent( QResizeEvent *e );
     virtual void contextMenuEvent( QContextMenuEvent *event );
     intf_thread_t *p_intf;
-    int i_runs;
+    virtual void resizeEvent( QResizeEvent * event );
 public slots:
     void toggle(){ TOGGLEV( this ); }
-    void update( void );
+    void updateArt( QString );
 };
 
 class VisualSelector : public QFrame
@@ -128,7 +158,9 @@ private:
 
 private slots:
     void snapshot();
+#if 0
     void frame();
+#endif
     void fromAtoB();
     void record();
     void AtoBLoop( float, int, int );
@@ -141,14 +173,15 @@ class QGridLayout;
 class VolumeClickHandler;
 class SoundSlider;
 class QAbstractSlider;
+class QToolButton;
 
 class ControlsWidget : public QFrame
 {
     Q_OBJECT
 public:
     /* p_intf, advanced control visible or not, blingbling or not */
-    ControlsWidget( intf_thread_t *, MainInterface*, bool, bool );
-//    QSize sizeHint() const;
+    ControlsWidget( intf_thread_t *_p_i, MainInterface *_p_mi,
+        bool b_advControls, bool b_shiny, bool b_fsCreation = false);
     virtual ~ControlsWidget();
 
     QPushButton *playlistButton;
@@ -157,38 +190,111 @@ public:
     void enableVideo( bool );
 public slots:
     void setNavigation( int );
-    void updateOnTimer();
 protected:
     friend class MainInterface;
     friend class VolumeClickHandler;
-private:
+protected:
     intf_thread_t       *p_intf;
-    QFrame              *discFrame;
+    QWidget             *discFrame;
+    QWidget             *telexFrame;
     QGridLayout         *controlLayout;
     InputSlider         *slider;
     QPushButton         *prevSectionButton, *nextSectionButton, *menuButton;
-    QPushButton         *playButton, *fullscreenButton;
-    QPushButton         *slowerButton, *fasterButton;
+    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;
-private slots:
+    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 faster();
     void slower();
     void toggleAdvanced();
+    void toggleTeletext();
+    void toggleTeletextTransparency();
+    void enableTeletext( bool );
 signals:
     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 setIsFullscreen( bool isFS ) { b_isFullscreen = isFS; }
+    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();
+    void slowHideFSC();
+
+private:
+    QTimer *p_hideTimer;
+
+#if HAVE_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;
+    bool b_isFullscreen;
+
+#ifdef WIN32TRICK
+    bool fscHidden;
+#endif
+
+    virtual void customEvent( QEvent *event );
+};
+
+
+
 class VolumeClickHandler : public QObject
 {
 public:
@@ -230,6 +336,21 @@ signals:
     void timeLabelDoubleClicked();
 };
 
+class SpeedLabel : public QLabel
+{
+    Q_OBJECT
+public:
+    SpeedLabel( intf_thread_t *_p_intf, const QString text ): QLabel( text)
+    { p_intf = _p_intf; }
+
+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
@@ -242,7 +363,8 @@ public:
 private:
     intf_thread_t *p_intf;
     QSlider *speedSlider;
-    QPushButton *normalSpeedButton;
+public slots:
+    void setEnable( bool );
 private slots:
     void updateRate( int );
     void resetRate();