[vlc-commits] Qt: renaming variables and simple cleanups in seekslider
Jean-Baptiste Kempf
git at videolan.org
Wed Feb 22 01:06:06 CET 2012
vlc/vlc-2.0 | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Feb 22 00:36:13 2012 +0100| [844056d29438d04ca2180de310ef6fb7541a7d43] | committer: Jean-Baptiste Kempf
Qt: renaming variables and simple cleanups in seekslider
(cherry picked from commit 0147fb79c23a80a3a3fbaddaa6362a5ab9d5ee9a)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=844056d29438d04ca2180de310ef6fb7541a7d43
---
modules/gui/qt4/util/input_slider.cpp | 32 ++++++++++++++++----------------
modules/gui/qt4/util/input_slider.hpp | 15 ++++++++-------
2 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index 1842c32..df4631e 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -58,7 +58,7 @@
SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent )
: QSlider( q, _parent )
{
- b_isSliding = false;
+ isSliding = false;
f_buffering = 1.0;
mHandleOpacity = 1.0;
chapters = NULL;
@@ -128,12 +128,12 @@ void SeekSlider::setPosition( float pos, int64_t time, int length )
if( pos == -1.0 )
{
setEnabled( false );
- b_isSliding = false;
+ isSliding = false;
}
else
setEnabled( true );
- if( !b_isSliding )
+ if( !isSliding )
setValue( (int)( pos * 1000.0 ) );
inputLength = length;
@@ -142,7 +142,7 @@ void SeekSlider::setPosition( float pos, int64_t time, int length )
void SeekSlider::startSeekTimer()
{
/* Only fire one update, when sliding, every 150ms */
- if( b_isSliding && !seekLimitTimer->isActive() )
+ if( isSliding && !seekLimitTimer->isActive() )
seekLimitTimer->start( 150 );
}
@@ -161,11 +161,11 @@ void SeekSlider::updateBuffering( float f_buffering_ )
void SeekSlider::mouseReleaseEvent( QMouseEvent *event )
{
event->accept();
- b_isSliding = false;
+ isSliding = false;
seekLimitTimer->stop(); /* We're not sliding anymore: only last seek on release */
- if ( b_is_jumping )
+ if ( isJumping )
{
- b_is_jumping = false;
+ isJumping = false;
return;
}
QSlider::mouseReleaseEvent( event );
@@ -182,7 +182,7 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
return;
}
- b_is_jumping = false;
+ isJumping = false;
/* handle chapter clicks */
int i_width = size().width();
if ( chapters && inputLength && i_width)
@@ -213,21 +213,21 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
{
chapters->jumpTo( i_selected );
event->accept();
- b_is_jumping = true;
+ isJumping = true;
return;
}
}
}
}
- b_isSliding = true ;
+ isSliding = true ;
setValue( QStyle::sliderValueFromPosition( MINIMUM, MAXIMUM, event->x(), width(), false ) );
event->accept();
}
void SeekSlider::mouseMoveEvent( QMouseEvent *event )
{
- if( b_isSliding )
+ if( isSliding )
{
setValue( QStyle::sliderValueFromPosition( MINIMUM, MAXIMUM, event->x(), width(), false) );
emit sliderMoved( value() );
@@ -270,7 +270,7 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event )
void SeekSlider::wheelEvent( QWheelEvent *event )
{
/* Don't do anything if we are for somehow reason sliding */
- if( !b_isSliding )
+ if( !isSliding )
{
setValue( value() + event->delta() / 12 ); /* 12 = 8 * 15 / 10
Since delta is in 1/8 of ° and mouse have steps of 15 °
@@ -572,7 +572,7 @@ SoundSlider::SoundSlider( QWidget *_parent, int _i_step, bool b_hard,
f_step = ( _i_step * 100 ) / AOUT_VOLUME_MAX ;
setRange( SOUNDMIN, b_hard ? (2 * SOUNDMAX) : SOUNDMAX );
setMouseTracking( true );
- b_isSliding = false;
+ isSliding = false;
b_mouseOutside = true;
b_isMuted = false;
@@ -651,7 +651,7 @@ void SoundSlider::mousePressEvent( QMouseEvent *event )
if( event->button() != Qt::RightButton )
{
/* We enter the sliding mode */
- b_isSliding = true;
+ isSliding = true;
i_oldvalue = value();
emit sliderPressed();
changeValue( event->x() - paddingL );
@@ -669,14 +669,14 @@ void SoundSlider::mouseReleaseEvent( QMouseEvent *event )
setValue( value() );
emit sliderMoved( value() );
}
- b_isSliding = false;
+ isSliding = false;
b_mouseOutside = false;
}
}
void SoundSlider::mouseMoveEvent( QMouseEvent *event )
{
- if( b_isSliding )
+ if( isSliding )
{
QRect rect( paddingL - 15, -1,
WLENGTH + 15 * 2 , WHEIGHT + 5 );
diff --git a/modules/gui/qt4/util/input_slider.hpp b/modules/gui/qt4/util/input_slider.hpp
index 4a2b1da..e638b36 100644
--- a/modules/gui/qt4/util/input_slider.hpp
+++ b/modules/gui/qt4/util/input_slider.hpp
@@ -46,7 +46,7 @@ class SeekSlider : public QSlider
Q_OBJECT
Q_PROPERTY(qreal handleOpacity READ handleOpacity WRITE setHandleOpacity)
public:
- SeekSlider( Qt::Orientation q, QWidget *_parent );
+ SeekSlider( Qt::Orientation q, QWidget *_parent = 0 );
~SeekSlider();
void setChapters( SeekPoints * );
@@ -63,16 +63,17 @@ protected:
virtual bool eventFilter( QObject *obj, QEvent *event );
QSize handleSize() const;
- QSize sizeHint() const;
+ virtual QSize sizeHint() const;
+
bool isAnimationRunning() const;
qreal handleOpacity() const;
void setHandleOpacity( qreal opacity );
private:
- bool b_isSliding; /* Whether we are currently sliding by user action */
- bool b_is_jumping; /* if we requested a jump to another chapter */
- int inputLength; /* InputLength that can change */
- char psz_length[MSTRTIME_MAX_SIZE]; /* Used for the ToolTip */
+ bool isSliding; /* Whether we are currently sliding by user action */
+ bool isJumping; /* if we requested a jump to another chapter */
+ int inputLength; /* InputLength that can change */
+ char psz_length[MSTRTIME_MAX_SIZE]; /* Used for the ToolTip */
QTimer *seekLimitTimer;
TimeTooltip *mTimeTooltip;
float f_buffering;
@@ -118,7 +119,7 @@ protected:
virtual void mouseReleaseEvent( QMouseEvent * );
private:
- bool b_isSliding; /* Whether we are currently sliding by user action */
+ bool isSliding; /* Whether we are currently sliding by user action */
bool b_mouseOutside; /* Whether the mouse is outside or inside the Widget */
int i_oldvalue; /* Store the old Value before changing */
float f_step; /* How much do we increase each time we wheel */
More information about the vlc-commits
mailing list