[vlc-commits] qt: replaced macros with proper constants
Filip Roséen
git at videolan.org
Tue Mar 22 19:31:09 CET 2016
vlc | branch: master | Filip Roséen <filip at videolabs.io> | Tue Mar 22 19:26:04 2016 +0100| [dad11202557adee0f5bdd1ae54a2f2c6d69e4e7b] | committer: Jean-Baptiste Kempf
qt: replaced macros with proper constants
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dad11202557adee0f5bdd1ae54a2f2c6d69e4e7b
---
modules/gui/qt/util/input_slider.cpp | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/modules/gui/qt/util/input_slider.cpp b/modules/gui/qt/util/input_slider.cpp
index b7459a6..6f23de6 100644
--- a/modules/gui/qt/util/input_slider.cpp
+++ b/modules/gui/qt/util/input_slider.cpp
@@ -51,11 +51,15 @@
#include <QDebug>
#include <QSequentialAnimationGroup>
-#define MINIMUM 0
-#define MAXIMUM 1000
-#define CHAPTERSSPOTSIZE 3
-#define FADEDURATION 300
-#define FADEOUTDELAY 2000
+namespace {
+ int const MIN_SLIDER_VALUE = 0;
+ int const MAX_SLIDER_VALUE = 1000;
+
+ int const CHAPTER_SPOT_SIZE = 3;
+
+ int const FADE_DURATION = 300;
+ int const FADEOUT_DELAY = 2000;
+}
SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static )
: QSlider( q, _parent ), b_classic( _static ), animLoading( NULL )
@@ -109,7 +113,7 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static )
mTimeTooltip->setMouseTracking( true );
/* Properties */
- setRange( MINIMUM, MAXIMUM );
+ setRange( MIN_SLIDER_VALUE, MAX_SLIDER_VALUE );
setSingleStep( 2 );
setPageStep( 10 );
setMouseTracking( true );
@@ -129,7 +133,7 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static )
secstotimestr( psz_length, 0 );
animHandle = new QPropertyAnimation( this, "handleOpacity", this );
- animHandle->setDuration( FADEDURATION );
+ animHandle->setDuration( FADE_DURATION );
animHandle->setStartValue( 0.0 );
animHandle->setEndValue( 1.0 );
@@ -151,7 +155,7 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static )
hideHandleTimer = new QTimer( this );
hideHandleTimer->setSingleShot( true );
- hideHandleTimer->setInterval( FADEOUTDELAY );
+ hideHandleTimer->setInterval( FADEOUT_DELAY );
startAnimLoadingTimer = new QTimer( this );
startAnimLoadingTimer->setSingleShot( true );
@@ -300,8 +304,8 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
if ( orientation() == Qt::Horizontal ) /* TODO: vertical */
{
/* only on chapters zone */
- if ( event->y() < CHAPTERSSPOTSIZE ||
- event->y() > ( size().height() - CHAPTERSSPOTSIZE ) )
+ if ( event->y() < CHAPTER_SPOT_SIZE ||
+ event->y() > ( size().height() - CHAPTER_SPOT_SIZE ) )
{
QList<SeekPoint> points = chapters->getPoints();
int i_selected = -1;
@@ -332,7 +336,7 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
isSliding = true ;
- setValue( QStyle::sliderValueFromPosition( MINIMUM, MAXIMUM, event->x() - handleLength() / 2, width() - handleLength(), false ) );
+ setValue( QStyle::sliderValueFromPosition( MIN_SLIDER_VALUE, MAX_SLIDER_VALUE, event->x() - handleLength() / 2, width() - handleLength(), false ) );
emit sliderMoved( value() );
event->accept();
}
@@ -349,7 +353,7 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event )
if( isSliding )
{
- setValue( QStyle::sliderValueFromPosition( MINIMUM, MAXIMUM, event->x() - handleLength() / 2, width() - handleLength(), false) );
+ setValue( QStyle::sliderValueFromPosition( MIN_SLIDER_VALUE, MAX_SLIDER_VALUE, event->x() - handleLength() / 2, width() - handleLength(), false) );
emit sliderMoved( value() );
}
More information about the vlc-commits
mailing list