]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/interface_widgets.hpp
qt4: do not access a widget from another thread
[vlc] / modules / gui / qt4 / components / interface_widgets.hpp
index 2b11a50a22ea29977f7bb1e060f6689c0bcabb1d..85dc19d83fceffaf44ddd9b729267ddf8e267650 100644 (file)
@@ -6,6 +6,7 @@
  *
  * Authors: Clément Stenac <zorglub@videolan.org>
  *          Jean-Baptiste Kempf <jb@videolan.org>
+ *          Rafaël Carré <funman@videolanorg>
  *
  * 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
@@ -33,6 +34,7 @@
 
 #include <QWidget>
 #include <QFrame>
+#define VOLUME_MAX 200
 
 class ResizeEvent;
 class QPalette;
@@ -64,6 +66,7 @@ private:
     vlc_mutex_t lock;
 signals:
     void askResize();
+    void askVideoToShow();
 private slots:
     void SetMinSize();
 };
@@ -82,10 +85,11 @@ private:
     QLabel *label;
     QHBoxLayout *backgroundLayout;
     virtual void resizeEvent( QResizeEvent *e );
+    virtual void contextMenuEvent( QContextMenuEvent *event );
     int DrawBackground();
     int CleanBackground();
     intf_thread_t *p_intf;
-private slots:
+public slots:
     void setArt( QString );
 };
 
@@ -114,14 +118,18 @@ public:
     void enableVideo( bool );
 private:
     intf_thread_t *p_intf;
-    QPushButton *normalButton;
-    QPushButton *snapshotButton;
+    QPushButton *normalButton, *recordButton, *ABButton;
+    QPushButton *snapshotButton, *frameButton;
 private slots:
     void normal();
     void snapshot();
-    void fullscreen();
+    void frame();
+    void fromAtoB();
+    void record();
 };
 
+
+
 class InputSlider;
 class QSlider;
 class QGridLayout;
@@ -130,7 +138,7 @@ class ControlsWidget : public QFrame
 {
     Q_OBJECT
 public:
-    ControlsWidget( intf_thread_t *);
+    ControlsWidget( intf_thread_t *, bool );
     virtual ~ControlsWidget();
 
     QPushButton *playlistButton;
@@ -145,13 +153,17 @@ protected:
     friend class MainInterface;
     friend class VolumeClickHandler;
 private:
-    intf_thread_t *p_intf;
-    QFrame *discFrame;
-    QGridLayout *controlLayout;
+    intf_thread_t       *p_intf;
+    QFrame              *discFrame;
+    QGridLayout         *controlLayout;
     InputSlider         *slider;
-    QPushButton *prevSectionButton, *nextSectionButton, *menuButton;
-    QPushButton *playButton, *fullscreenButton;
-    QPushButton *slowerButton, *fasterButton;
+    QPushButton         *prevSectionButton, *nextSectionButton, *menuButton;
+    QPushButton         *playButton, *fullscreenButton;
+    QPushButton         *slowerButton, *fasterButton;
+    AdvControlsWidget   *advControls;
+    QLabel              *volMuteLabel;
+
+    bool                 b_advancedVisible;
 private slots:
     void play();
     void stop();
@@ -160,9 +172,11 @@ private slots:
     void updateVolume( int );
     void fullscreen();
     void extSettings();
-    void prefs();
     void faster();
     void slower();
+    void toggleAdvanced();
+signals:
+    void advancedControlsToggled( bool );
 };
 
 class VolumeClickHandler : public QObject
@@ -173,9 +187,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;
@@ -185,6 +202,23 @@ private:
     intf_thread_t *p_intf;
 };
 
+#include <QLabel>
+#include <QMouseEvent>
+class TimeLabel : public QLabel
+{
+    Q_OBJECT
+    void mousePressEvent( QMouseEvent *event )
+    {
+        if( event->button() == Qt::LeftButton ) emit timeLabelClicked();
+    }
+    void mouseDoubleClickEvent( QMouseEvent *event )
+    {
+        emit timeLabelDoubleClicked();
+    }
+signals:
+    void timeLabelClicked();
+    void timeLabelDoubleClicked();
+};
 
 /******************** Playlist Widgets ****************/
 #include <QModelIndex>
@@ -217,4 +251,23 @@ signals:
     void artSet( QString );
 };
 
+
+/******************** Speed Control Widgets ****************/
+class SpeedControlWidget : public QFrame
+{
+    Q_OBJECT
+public:
+    SpeedControlWidget( intf_thread_t *);
+    virtual ~SpeedControlWidget();
+    void updateControls( int );
+private:
+    intf_thread_t *p_intf;
+    QSlider *speedSlider;
+    QPushButton *normalSpeedButton;
+private slots:
+    void updateRate( int );
+    void resetRate();
+};
+
+
 #endif