]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/util/input_slider.hpp
Merge branch 'master' into lpcm_encoder
[vlc] / modules / gui / qt4 / util / input_slider.hpp
index a06d93a2b3d34317da153f2264cd793dbba3e1f8..08800f1ded9f986890322bee77405fe1fd6816ef 100644 (file)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
+ *          Jean-Baptiste Kempf <jb@videolan.org>
  *
  * 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 "qt4.hpp"
 
 #include <QSlider>
+
 #include <QMouseEvent>
+#include <QWheelEvent>
+#include <QTimer>
 
+/* Input Slider derived from QSlider */
 class InputSlider : public QSlider
 {
     Q_OBJECT
 public:
     InputSlider( QWidget *_parent );
-    InputSlider( Qt::Orientation q,QWidget *_parent );
-    virtual ~InputSlider()   {};
+    InputSlider( Qt::Orientation q, QWidget *_parent );
+    virtual ~InputSlider() {};
 protected:
     virtual void mouseMoveEvent(QMouseEvent *event);
     virtual void mousePressEvent(QMouseEvent* event);
     virtual void mouseReleaseEvent(QMouseEvent* event);
+    virtual void wheelEvent(QWheelEvent *event);
 private:
-    bool b_sliding;
-    int inputLength;
-    char psz_length[MSTRTIME_MAX_SIZE];
+    bool b_isSliding; /* Whether we are currently sliding by user action */
+    int inputLength;  /* InputLength that can change */
+    char psz_length[MSTRTIME_MAX_SIZE]; /* Used for the ToolTip */
+    int lastSeeked;
+    QTimer *timer;
+
 public slots:
-    void setPosition( float, int, int );
+    void setPosition( float, int64_t, int );
 private slots:
     void userDrag( int );
+    void seekTick();
+
 signals:
     void sliderDragged( float );
 };
 
 
+/* Sound Slider inherited directly from QAbstractSlider */
 class QPaintEvent;
-#include <QAbstractSlider>
 
 class SoundSlider : public QAbstractSlider
 {
     Q_OBJECT
 public:
-    SoundSlider( QWidget *_parent, int _i_step, bool b_softamp );
+    SoundSlider( QWidget *_parent, int _i_step, bool b_softamp, char * );
     virtual ~SoundSlider() {};
+    void setMuted( bool ); /* Set Mute status */
+
 protected:
-    int paddingL;
-    int paddingR;
+    const static int paddingL = 3;
+    const static int paddingR = 2;
+
     virtual void paintEvent(QPaintEvent *);
     virtual void wheelEvent( QWheelEvent *event );
     virtual void mousePressEvent( QMouseEvent * );
     virtual void mouseMoveEvent( QMouseEvent * );
     virtual void mouseReleaseEvent( QMouseEvent * );
+
 private:
-    bool b_sliding;
-    bool b_outside;
-    int i_oldvalue;
-    float f_step;
-    void changeValue( int x );
-    QPixmap pixGradient;
-    QPixmap pixOutside;
+    bool b_isSliding; /* Whether we are currently sliding by user action */
+    bool b_mouseOutside; /* Whether the mouse is outside or inside the Widget */
+    int i_oldvalue; /* Store the old Value before changing */
+    float f_step; /* How much do we increase each time we wheel */
+    bool b_isMuted;
+
+    QPixmap pixGradient; /* Gradient pix storage */
+    QPixmap pixGradient2; /* Muted Gradient pix storage */
+    QPixmap pixOutside; /* OutLine pix storage */
+
+    void changeValue( int x ); /* Function to modify the value from pixel x() */
 };
 
 #endif