Commit 844056d2 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: renaming variables and simple cleanups in seekslider

(cherry picked from commit 0147fb79)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent fafbf575
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent ) SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent )
: QSlider( q, _parent ) : QSlider( q, _parent )
{ {
b_isSliding = false; isSliding = false;
f_buffering = 1.0; f_buffering = 1.0;
mHandleOpacity = 1.0; mHandleOpacity = 1.0;
chapters = NULL; chapters = NULL;
...@@ -128,12 +128,12 @@ void SeekSlider::setPosition( float pos, int64_t time, int length ) ...@@ -128,12 +128,12 @@ void SeekSlider::setPosition( float pos, int64_t time, int length )
if( pos == -1.0 ) if( pos == -1.0 )
{ {
setEnabled( false ); setEnabled( false );
b_isSliding = false; isSliding = false;
} }
else else
setEnabled( true ); setEnabled( true );
if( !b_isSliding ) if( !isSliding )
setValue( (int)( pos * 1000.0 ) ); setValue( (int)( pos * 1000.0 ) );
inputLength = length; inputLength = length;
...@@ -142,7 +142,7 @@ void SeekSlider::setPosition( float pos, int64_t time, int length ) ...@@ -142,7 +142,7 @@ void SeekSlider::setPosition( float pos, int64_t time, int length )
void SeekSlider::startSeekTimer() void SeekSlider::startSeekTimer()
{ {
/* Only fire one update, when sliding, every 150ms */ /* Only fire one update, when sliding, every 150ms */
if( b_isSliding && !seekLimitTimer->isActive() ) if( isSliding && !seekLimitTimer->isActive() )
seekLimitTimer->start( 150 ); seekLimitTimer->start( 150 );
} }
...@@ -161,11 +161,11 @@ void SeekSlider::updateBuffering( float f_buffering_ ) ...@@ -161,11 +161,11 @@ void SeekSlider::updateBuffering( float f_buffering_ )
void SeekSlider::mouseReleaseEvent( QMouseEvent *event ) void SeekSlider::mouseReleaseEvent( QMouseEvent *event )
{ {
event->accept(); event->accept();
b_isSliding = false; isSliding = false;
seekLimitTimer->stop(); /* We're not sliding anymore: only last seek on release */ 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; return;
} }
QSlider::mouseReleaseEvent( event ); QSlider::mouseReleaseEvent( event );
...@@ -182,7 +182,7 @@ void SeekSlider::mousePressEvent( QMouseEvent* event ) ...@@ -182,7 +182,7 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
return; return;
} }
b_is_jumping = false; isJumping = false;
/* handle chapter clicks */ /* handle chapter clicks */
int i_width = size().width(); int i_width = size().width();
if ( chapters && inputLength && i_width) if ( chapters && inputLength && i_width)
...@@ -213,21 +213,21 @@ void SeekSlider::mousePressEvent( QMouseEvent* event ) ...@@ -213,21 +213,21 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
{ {
chapters->jumpTo( i_selected ); chapters->jumpTo( i_selected );
event->accept(); event->accept();
b_is_jumping = true; isJumping = true;
return; return;
} }
} }
} }
} }
b_isSliding = true ; isSliding = true ;
setValue( QStyle::sliderValueFromPosition( MINIMUM, MAXIMUM, event->x(), width(), false ) ); setValue( QStyle::sliderValueFromPosition( MINIMUM, MAXIMUM, event->x(), width(), false ) );
event->accept(); event->accept();
} }
void SeekSlider::mouseMoveEvent( QMouseEvent *event ) void SeekSlider::mouseMoveEvent( QMouseEvent *event )
{ {
if( b_isSliding ) if( isSliding )
{ {
setValue( QStyle::sliderValueFromPosition( MINIMUM, MAXIMUM, event->x(), width(), false) ); setValue( QStyle::sliderValueFromPosition( MINIMUM, MAXIMUM, event->x(), width(), false) );
emit sliderMoved( value() ); emit sliderMoved( value() );
...@@ -270,7 +270,7 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event ) ...@@ -270,7 +270,7 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event )
void SeekSlider::wheelEvent( QWheelEvent *event ) void SeekSlider::wheelEvent( QWheelEvent *event )
{ {
/* Don't do anything if we are for somehow reason sliding */ /* 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 setValue( value() + event->delta() / 12 ); /* 12 = 8 * 15 / 10
Since delta is in 1/8 of ° and mouse have steps of 15 ° 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, ...@@ -572,7 +572,7 @@ SoundSlider::SoundSlider( QWidget *_parent, int _i_step, bool b_hard,
f_step = ( _i_step * 100 ) / AOUT_VOLUME_MAX ; f_step = ( _i_step * 100 ) / AOUT_VOLUME_MAX ;
setRange( SOUNDMIN, b_hard ? (2 * SOUNDMAX) : SOUNDMAX ); setRange( SOUNDMIN, b_hard ? (2 * SOUNDMAX) : SOUNDMAX );
setMouseTracking( true ); setMouseTracking( true );
b_isSliding = false; isSliding = false;
b_mouseOutside = true; b_mouseOutside = true;
b_isMuted = false; b_isMuted = false;
...@@ -651,7 +651,7 @@ void SoundSlider::mousePressEvent( QMouseEvent *event ) ...@@ -651,7 +651,7 @@ void SoundSlider::mousePressEvent( QMouseEvent *event )
if( event->button() != Qt::RightButton ) if( event->button() != Qt::RightButton )
{ {
/* We enter the sliding mode */ /* We enter the sliding mode */
b_isSliding = true; isSliding = true;
i_oldvalue = value(); i_oldvalue = value();
emit sliderPressed(); emit sliderPressed();
changeValue( event->x() - paddingL ); changeValue( event->x() - paddingL );
...@@ -669,14 +669,14 @@ void SoundSlider::mouseReleaseEvent( QMouseEvent *event ) ...@@ -669,14 +669,14 @@ void SoundSlider::mouseReleaseEvent( QMouseEvent *event )
setValue( value() ); setValue( value() );
emit sliderMoved( value() ); emit sliderMoved( value() );
} }
b_isSliding = false; isSliding = false;
b_mouseOutside = false; b_mouseOutside = false;
} }
} }
void SoundSlider::mouseMoveEvent( QMouseEvent *event ) void SoundSlider::mouseMoveEvent( QMouseEvent *event )
{ {
if( b_isSliding ) if( isSliding )
{ {
QRect rect( paddingL - 15, -1, QRect rect( paddingL - 15, -1,
WLENGTH + 15 * 2 , WHEIGHT + 5 ); WLENGTH + 15 * 2 , WHEIGHT + 5 );
......
...@@ -46,7 +46,7 @@ class SeekSlider : public QSlider ...@@ -46,7 +46,7 @@ class SeekSlider : public QSlider
Q_OBJECT Q_OBJECT
Q_PROPERTY(qreal handleOpacity READ handleOpacity WRITE setHandleOpacity) Q_PROPERTY(qreal handleOpacity READ handleOpacity WRITE setHandleOpacity)
public: public:
SeekSlider( Qt::Orientation q, QWidget *_parent ); SeekSlider( Qt::Orientation q, QWidget *_parent = 0 );
~SeekSlider(); ~SeekSlider();
void setChapters( SeekPoints * ); void setChapters( SeekPoints * );
...@@ -63,16 +63,17 @@ protected: ...@@ -63,16 +63,17 @@ protected:
virtual bool eventFilter( QObject *obj, QEvent *event ); virtual bool eventFilter( QObject *obj, QEvent *event );
QSize handleSize() const; QSize handleSize() const;
QSize sizeHint() const; virtual QSize sizeHint() const;
bool isAnimationRunning() const; bool isAnimationRunning() const;
qreal handleOpacity() const; qreal handleOpacity() const;
void setHandleOpacity( qreal opacity ); void setHandleOpacity( qreal opacity );
private: private:
bool b_isSliding; /* Whether we are currently sliding by user action */ bool isSliding; /* Whether we are currently sliding by user action */
bool b_is_jumping; /* if we requested a jump to another chapter */ bool isJumping; /* if we requested a jump to another chapter */
int inputLength; /* InputLength that can change */ int inputLength; /* InputLength that can change */
char psz_length[MSTRTIME_MAX_SIZE]; /* Used for the ToolTip */ char psz_length[MSTRTIME_MAX_SIZE]; /* Used for the ToolTip */
QTimer *seekLimitTimer; QTimer *seekLimitTimer;
TimeTooltip *mTimeTooltip; TimeTooltip *mTimeTooltip;
float f_buffering; float f_buffering;
...@@ -118,7 +119,7 @@ protected: ...@@ -118,7 +119,7 @@ protected:
virtual void mouseReleaseEvent( QMouseEvent * ); virtual void mouseReleaseEvent( QMouseEvent * );
private: 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 */ bool b_mouseOutside; /* Whether the mouse is outside or inside the Widget */
int i_oldvalue; /* Store the old Value before changing */ int i_oldvalue; /* Store the old Value before changing */
float f_step; /* How much do we increase each time we wheel */ float f_step; /* How much do we increase each time we wheel */
......
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