]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/util/input_slider.hpp
Qt: SeekSlider: don't show buffering < 1s
[vlc] / modules / gui / qt4 / util / input_slider.hpp
index 981900001918dd83b967e0a5657d5c098d78bf8b..c8e48feacf7b7957845a0aef503067459c11931e 100644 (file)
 
 #include <vlc_common.h>
 #include "timetooltip.hpp"
+#include "styles/seekstyle.hpp"
 
 #include <QSlider>
 #include <QPainter>
+#include <QTime>
 
 #define MSTRTIME_MAX_SIZE 22
 
@@ -44,6 +46,8 @@ class QHideEvent;
 class QTimer;
 class SeekPoints;
 class QPropertyAnimation;
+class QStyleOption;
+class QCommonStyle;
 
 /* Input Slider derived from QSlider */
 class SeekSlider : public QSlider
@@ -63,16 +67,16 @@ protected:
     virtual void enterEvent( QEvent * );
     virtual void leaveEvent( QEvent * );
     virtual void hideEvent( QHideEvent * );
+    virtual void paintEvent(QPaintEvent *ev);
 
-    virtual void paintEvent( QPaintEvent* event );
     virtual bool eventFilter( QObject *obj, QEvent *event );
 
-    QSize handleSize() const;
     virtual QSize sizeHint() const;
 
-    bool isAnimationRunning() const;
+    void processReleasedButton();
     qreal handleOpacity() const;
     void setHandleOpacity( qreal opacity );
+    int handleLength();
 
 private:
     bool isSliding;        /* Whether we are currently sliding by user action */
@@ -82,8 +86,11 @@ private:
     QTimer *seekLimitTimer;
     TimeTooltip *mTimeTooltip;
     float f_buffering;
+    QTime bufferingStart;
     SeekPoints* chapters;
     bool b_classic;
+    bool b_seekable;
+    int mHandleLength;
 
     /* Colors & gradients */
     QSize gradientsTargetSize;
@@ -93,6 +100,8 @@ private:
     QColor tickpointForeground;
     QColor shadowDark;
     QColor shadowLight;
+    QCommonStyle *alternativeStyle;
+
     /* Handle's animation */
     qreal mHandleOpacity;
     QPropertyAnimation *animHandle;
@@ -100,6 +109,7 @@ private:
 
 public slots:
     void setPosition( float, int64_t, int );
+    void setSeekable( bool b ) { b_seekable = b ; }
     void updateBuffering( float );
     void hideHandle();
 
@@ -109,17 +119,19 @@ private slots:
 
 signals:
     void sliderDragged( float );
-};
 
+};
 
 /* Sound Slider inherited directly from QAbstractSlider */
 class QPaintEvent;
 
+#define SOUNDMAX  125 // % (+6dB)
+
 class SoundSlider : public QAbstractSlider
 {
     Q_OBJECT
 public:
-    SoundSlider( QWidget *_parent, int _i_step, bool b_softamp, char * );
+    SoundSlider(QWidget *_parent, float _i_step, char *psz_colors, int max = SOUNDMAX );
     void setMuted( bool ); /* Set Mute status */
 
 protected:
@@ -132,6 +144,8 @@ protected:
     virtual void mouseMoveEvent( QMouseEvent * );
     virtual void mouseReleaseEvent( QMouseEvent * );
 
+    void processReleasedButton();
+
 private:
     bool isSliding; /* Whether we are currently sliding by user action */
     bool b_mouseOutside; /* Whether the mouse is outside or inside the Widget */