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$
*
* Authors: Clément Stenac <zorglub@videolan.org>
......@@ -26,6 +26,8 @@
# include "config.h"
#endif
#include "qt4.hpp"
#include "util/input_slider.hpp"
#include <QPaintEvent>
......@@ -34,7 +36,7 @@
#include <QPainter>
#include <QStyleOptionSlider>
#include <QLinearGradient>
#include <QTimer>
#define MINIMUM 0
#define MAXIMUM 1000
......@@ -45,7 +47,7 @@ SeekSlider::SeekSlider( QWidget *_parent ) : QSlider( _parent )
}
SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent )
: QSlider( q, _parent )
: QSlider( q, _parent )
{
b_isSliding = false;
......@@ -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 )
{
......@@ -85,7 +91,7 @@ void SeekSlider::setPosition( float pos, int64_t a, int b )
if( !b_isSliding )
setValue( (int)(pos * 1000.0 ) );
inputLength = b;
inputLength = length;
}
void SeekSlider::startSeekTimer( int new_value )
......@@ -149,8 +155,6 @@ void SeekSlider::wheelEvent( QWheelEvent *event)
increment of position */
emit sliderDragged( value()/1000.0 );
}
/* We do accept because for we don't want the parent to change the sound
vol */
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$
*
* Authors: Clément Stenac <zorglub@videolan.org>
......@@ -18,20 +18,20 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef _INPUTSLIDER_H_
#define _INPUTSLIDER_H_
#include "qt4.hpp"
#include <QSlider>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QTimer>
#define MSTRTIME_MAX_SIZE 22
class QMouseEvent;
class QWheelEvent;
class QTimer;
/* Input Slider derived from 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