[vlc-commits] SeekSlider: clean the code
Jean-Baptiste Kempf
git at videolan.org
Tue Apr 12 02:30:51 CEST 2011
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Apr 12 02:29:39 2011 +0200| [3a081b6aeeb7b455bb894fb76cfc42fbe336c0f6] | committer: Jean-Baptiste Kempf
SeekSlider: clean the code
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3a081b6aeeb7b455bb894fb76cfc42fbe336c0f6
---
modules/gui/qt4/util/input_slider.cpp | 22 +++++++++++++---------
modules/gui/qt4/util/input_slider.hpp | 18 +++++++++---------
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index 552f8c9..eb172f2 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -1,7 +1,7 @@
/*****************************************************************************
- * 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 at 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();
}
diff --git a/modules/gui/qt4/util/input_slider.hpp b/modules/gui/qt4/util/input_slider.hpp
index 00e2375..9447ce9 100644
--- a/modules/gui/qt4/util/input_slider.hpp
+++ b/modules/gui/qt4/util/input_slider.hpp
@@ -1,7 +1,7 @@
/*****************************************************************************
- * 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 at 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
More information about the vlc-commits
mailing list