]> 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 a5c8558a4e1e5243501824534e07ab9900fad173..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 );
 };
 
@@ -124,6 +128,8 @@ private slots:
     void record();
 };
 
+
+
 class InputSlider;
 class QSlider;
 class QGridLayout;
@@ -166,7 +172,6 @@ private slots:
     void updateVolume( int );
     void fullscreen();
     void extSettings();
-    void prefs();
     void faster();
     void slower();
     void toggleAdvanced();
@@ -182,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;
@@ -194,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>
@@ -226,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