1 /*****************************************************************************
2 * input_slider.hpp : VolumeSlider and SeekSlider
3 ****************************************************************************
4 * Copyright (C) 2006-2011 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste Kempf <jb@videolan.org>
9 * Ludovic Fauvet <etix@videolan.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
26 #ifndef _INPUTSLIDER_H_
27 #define _INPUTSLIDER_H_
29 #include <vlc_common.h>
30 #include "timetooltip.hpp"
34 #define MSTRTIME_MAX_SIZE 22
42 /* Input Slider derived from QSlider */
43 class SeekSlider : public QSlider
47 SeekSlider( QWidget *_parent );
48 SeekSlider( Qt::Orientation q, QWidget *_parent );
50 void setChapters( SeekPoints * );
53 virtual void mouseMoveEvent( QMouseEvent *event );
54 virtual void mousePressEvent( QMouseEvent* event );
55 virtual void mouseReleaseEvent( QMouseEvent *event );
56 virtual void wheelEvent( QWheelEvent *event );
57 virtual void enterEvent( QEvent * );
58 virtual void leaveEvent( QEvent * );
59 virtual void hideEvent( QHideEvent * );
61 virtual void paintEvent( QPaintEvent* event );
62 virtual bool eventFilter( QObject *obj, QEvent *event );
64 QSize handleSize() const;
65 QSize sizeHint() const;
68 bool b_isSliding; /* Whether we are currently sliding by user action */
69 bool b_is_jumping; /* if we requested a jump to another chapter */
70 int inputLength; /* InputLength that can change */
71 char psz_length[MSTRTIME_MAX_SIZE]; /* Used for the ToolTip */
72 QTimer *seekLimitTimer;
73 TimeTooltip *mTimeTooltip;
78 void setPosition( float, int64_t, int );
79 void updateBuffering( float );
82 void startSeekTimer();
86 void sliderDragged( float );
90 /* Sound Slider inherited directly from QAbstractSlider */
93 class SoundSlider : public QAbstractSlider
97 SoundSlider( QWidget *_parent, int _i_step, bool b_softamp, char * );
98 void setMuted( bool ); /* Set Mute status */
101 const static int paddingL = 3;
102 const static int paddingR = 2;
104 virtual void paintEvent( QPaintEvent *);
105 virtual void wheelEvent( QWheelEvent *event );
106 virtual void mousePressEvent( QMouseEvent * );
107 virtual void mouseMoveEvent( QMouseEvent * );
108 virtual void mouseReleaseEvent( QMouseEvent * );
111 bool b_isSliding; /* Whether we are currently sliding by user action */
112 bool b_mouseOutside; /* Whether the mouse is outside or inside the Widget */
113 int i_oldvalue; /* Store the old Value before changing */
114 float f_step; /* How much do we increase each time we wheel */
117 QPixmap pixGradient; /* Gradient pix storage */
118 QPixmap pixGradient2; /* Muted Gradient pix storage */
119 QPixmap pixOutside; /* OutLine pix storage */
121 void changeValue( int x ); /* Function to modify the value from pixel x() */