]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/interface_widgets.hpp
Qt4 - New kind of volume slider.
[vlc] / modules / gui / qt4 / components / interface_widgets.hpp
index 16a1dd4866051347ef3c6ad8b21481bff8bfaa15..7edde5e54aea21d093644124e93c34152d8b8a10 100644 (file)
@@ -5,6 +5,8 @@
  * $Id$
  *
  * 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
 #include <vlc/vlc.h>
 #include <vlc_interface.h>
 
+#include <vlc_aout.h>
 #include "qt4.hpp"
 
 #include <QWidget>
 #include <QFrame>
+#define VOLUME_MAX 200
 
 class ResizeEvent;
 class QPalette;
@@ -60,6 +64,11 @@ private:
     QWidget *frame;
     intf_thread_t *p_intf;
     vlc_mutex_t lock;
+signals:
+    void askResize();
+    void askVideoToShow();
+private slots:
+    void SetMinSize();
 };
 
 /******************** Background Widget ****************/
@@ -76,9 +85,13 @@ private:
     QLabel *label;
     QHBoxLayout *backgroundLayout;
     virtual void resizeEvent( QResizeEvent *e );
+    virtual void contextMenuEvent( QContextMenuEvent *event );
     int DrawBackground();
     int CleanBackground();
     intf_thread_t *p_intf;
+public slots:
+    void setArt( QString );
+    void toggle(){ TOGGLEV( this ); }
 };
 
 class VisualSelector : public QFrame
@@ -95,53 +108,172 @@ private slots:
     void next();
 };
 
+/* Advanced Button Bar */
 class QPushButton;
+class AdvControlsWidget : public QFrame
+{
+    Q_OBJECT
+public:
+    AdvControlsWidget( intf_thread_t *);
+    virtual ~AdvControlsWidget();
+
+    void enableInput( bool );
+    void enableVideo( bool );
+
+private:
+    intf_thread_t *p_intf;
+    QPushButton *recordButton, *ABButton;
+    QPushButton *snapshotButton, *frameButton;
+
+    mtime_t timeA, timeB;
+
+private slots:
+    void snapshot();
+    void frame();
+    void fromAtoB();
+    void record();
+    void AtoBLoop( float, int, int );
+};
+
+/* Button Bar */
+class InputSlider;
+class QSlider;
+class QGridLayout;
+class VolumeClickHandler;
+class SoundSlider;
+
 class ControlsWidget : public QFrame
 {
     Q_OBJECT
 public:
-    ControlsWidget( intf_thread_t *);
+    ControlsWidget( intf_thread_t *, bool );
     virtual ~ControlsWidget();
+
+    QPushButton *playlistButton;
+    SoundSlider *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;
-    QPushButton *slowerButton, *normalButton, *fasterButton;
-    QPushButton *fullscreenButton, *snapshotButton;
+    intf_thread_t       *p_intf;
+    QFrame              *discFrame;
+    QGridLayout         *controlLayout;
+    InputSlider         *slider;
+    QPushButton         *prevSectionButton, *nextSectionButton, *menuButton;
+    QPushButton         *playButton, *fullscreenButton;
+    QPushButton         *slowerButton, *fasterButton;
+    AdvControlsWidget   *advControls;
+    QLabel              *volMuteLabel;
+
+    bool                 b_advancedVisible;
 private slots:
+    void play();
+    void stop();
+    void prev();
+    void next();
+    void updateVolume( int );
+    void fullscreen();
+    void extSettings();
     void faster();
     void slower();
-    void normal();
-    void snapshot();
-    void fullscreen();
+    void toggleAdvanced();
+signals:
+    void advancedControlsToggled( bool );
+};
+
+class VolumeClickHandler : public QObject
+{
+public:
+    VolumeClickHandler( intf_thread_t *_p_intf, ControlsWidget *_m ) :QObject(_m)
+    {m = _m; p_intf = _p_intf; }
+    virtual ~VolumeClickHandler() {};
+    bool eventFilter( QObject *obj, QEvent *e )
+    {
+        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;
+    }
+private:
+    ControlsWidget *m;
+    intf_thread_t *p_intf;
+};
+
+#include <QLabel>
+#include <QMouseEvent>
+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 <QModelIndex>
+#include <QSplitter>
 class QSignalMapper;
 class PLSelector;
 class PLPanel;
 class QPushButton;
 
-class PlaylistWidget : public BasePlaylistWidget
+class PlaylistWidget : public QSplitter
 {
     Q_OBJECT;
 public:
-    PlaylistWidget( intf_thread_t * );
+    PlaylistWidget( intf_thread_t *_p_i ) ;
     virtual ~PlaylistWidget();
-    QSize widgetSize;
-    virtual QSize sizeHint() const;
 private:
     PLSelector *selector;
     PLPanel *rightPanel;
     QPushButton *addButton;
     QLabel *art;
     QString prevArt;
+protected:
+     intf_thread_t *p_intf;
 private slots:
     void setArt( QString );
 signals:
     void rootChanged( int );
+    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