Commit 3a081b6a authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

SeekSlider: clean the code

parent 7ab98f85
/***************************************************************************** /*****************************************************************************
* input_manager.cpp : Manage an input and interact with its GUI elements * input_slider.cpp : VolumeSlider and SeekSlider
**************************************************************************** ****************************************************************************
* Copyright (C) 2006 the VideoLAN team * Copyright (C) 2006-2011 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include "qt4.hpp"
#include "util/input_slider.hpp" #include "util/input_slider.hpp"
#include <QPaintEvent> #include <QPaintEvent>
...@@ -34,7 +36,7 @@ ...@@ -34,7 +36,7 @@
#include <QPainter> #include <QPainter>
#include <QStyleOptionSlider> #include <QStyleOptionSlider>
#include <QLinearGradient> #include <QLinearGradient>
#include <QTimer>
#define MINIMUM 0 #define MINIMUM 0
#define MAXIMUM 1000 #define MAXIMUM 1000
...@@ -70,9 +72,13 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent ) ...@@ -70,9 +72,13 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent )
} }
/*** /***
* \brief Public interface, like setValue, but disabling the slider too * \brief Main public method, superseeding setValue. Disabling the slider when neeeded
*
* \param pos Position, between 0 and 1. -1 disables the slider
* \param time Elapsed time. Unused
* \param legnth Duration time.
***/ ***/
void SeekSlider::setPosition( float pos, int64_t a, int b ) void SeekSlider::setPosition( float pos, int64_t time, int length )
{ {
if( pos == -1.0 ) if( pos == -1.0 )
{ {
...@@ -85,7 +91,7 @@ void SeekSlider::setPosition( float pos, int64_t a, int b ) ...@@ -85,7 +91,7 @@ void SeekSlider::setPosition( float pos, int64_t a, int b )
if( !b_isSliding ) if( !b_isSliding )
setValue( (int)(pos * 1000.0 ) ); setValue( (int)(pos * 1000.0 ) );
inputLength = b; inputLength = length;
} }
void SeekSlider::startSeekTimer( int new_value ) void SeekSlider::startSeekTimer( int new_value )
...@@ -149,8 +155,6 @@ void SeekSlider::wheelEvent( QWheelEvent *event) ...@@ -149,8 +155,6 @@ void SeekSlider::wheelEvent( QWheelEvent *event)
increment of position */ increment of position */
emit sliderDragged( value()/1000.0 ); emit sliderDragged( value()/1000.0 );
} }
/* We do accept because for we don't want the parent to change the sound
vol */
event->accept(); event->accept();
} }
......
/***************************************************************************** /*****************************************************************************
* input_slider.hpp : A slider that controls an input * input_slider.hpp : VolumeSlider and SeekSlider
**************************************************************************** ****************************************************************************
* Copyright (C) 2006 the VideoLAN team * Copyright (C) 2006-2011 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
...@@ -18,20 +18,20 @@ ...@@ -18,20 +18,20 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software Foundation,
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#ifndef _INPUTSLIDER_H_ #ifndef _INPUTSLIDER_H_
#define _INPUTSLIDER_H_ #define _INPUTSLIDER_H_
#include "qt4.hpp"
#include <QSlider> #include <QSlider>
#include <QMouseEvent> #define MSTRTIME_MAX_SIZE 22
#include <QWheelEvent>
#include <QTimer> class QMouseEvent;
class QWheelEvent;
class QTimer;
/* Input Slider derived from QSlider */ /* Input Slider derived from QSlider */
class SeekSlider : public QSlider class SeekSlider : public QSlider
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment