[vlc-commits] qt: remove obsolete native slider widget
Pierre Lamot
git at videolan.org
Tue Dec 17 15:37:43 CET 2019
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Fri Dec 6 14:50:41 2019 +0100| [83b9c43a0edf0a2dc8770b75af4471edec583e84] | committer: Jean-Baptiste Kempf
qt: remove obsolete native slider widget
time tooltip is removed as well
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=83b9c43a0edf0a2dc8770b75af4471edec583e84
---
modules/gui/qt/Makefile.am | 10 +-
modules/gui/qt/styles/seekstyle.cpp | 237 -----------
modules/gui/qt/styles/seekstyle.hpp | 54 ---
modules/gui/qt/util/input_slider.cpp | 768 -----------------------------------
modules/gui/qt/util/input_slider.hpp | 172 --------
modules/gui/qt/util/timetooltip.cpp | 154 -------
modules/gui/qt/util/timetooltip.hpp | 52 ---
po/POTFILES.in | 6 -
8 files changed, 2 insertions(+), 1451 deletions(-)
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 77198a653f..aaf9c17f15 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -181,9 +181,7 @@ libqt_plugin_la_SOURCES = \
gui/qt/dialogs/sout/sout_widgets.hpp \
gui/qt/dialogs/sout/profiles.hpp \
gui/qt/util/animators.cpp gui/qt/util/animators.hpp \
- gui/qt/util/input_slider.cpp gui/qt/util/input_slider.hpp \
gui/qt/player/input_models.cpp gui/qt/player/input_models.hpp \
- gui/qt/util/timetooltip.cpp gui/qt/util/timetooltip.hpp \
gui/qt/util/customwidgets.cpp gui/qt/util/customwidgets.hpp \
gui/qt/util/searchlineedit.cpp gui/qt/util/searchlineedit.hpp \
gui/qt/util/registry.cpp gui/qt/util/registry.hpp \
@@ -204,8 +202,7 @@ libqt_plugin_la_SOURCES = \
gui/qt/util/singleton.hpp \
gui/qt/util/vlctick.cpp \
gui/qt/util/vlctick.hpp \
- gui/qt/util/imagehelper.cpp gui/qt/util/imagehelper.hpp \
- gui/qt/styles/seekstyle.cpp gui/qt/styles/seekstyle.hpp
+ gui/qt/util/imagehelper.cpp gui/qt/util/imagehelper.hpp
if HAVE_WIN32
libqt_plugin_la_SOURCES += \
gui/qt/main_interface_win32.cpp gui/qt/main_interface_win32.hpp
@@ -306,9 +303,7 @@ nodist_libqt_plugin_la_SOURCES = \
gui/qt/dialogs/sout/profile_selector.moc.cpp \
gui/qt/dialogs/sout/sout_widgets.moc.cpp \
gui/qt/util/animators.moc.cpp \
- gui/qt/util/input_slider.moc.cpp \
gui/qt/player/input_models.moc.cpp \
- gui/qt/util/timetooltip.moc.cpp \
gui/qt/util/customwidgets.moc.cpp \
gui/qt/util/qmleventfilter.moc.cpp \
gui/qt/util/searchlineedit.moc.cpp \
@@ -317,8 +312,7 @@ nodist_libqt_plugin_la_SOURCES = \
gui/qt/util/validators.moc.cpp \
gui/qt/util/buttons/RoundButton.moc.cpp \
gui/qt/util/buttons/DeckButtonsLayout.moc.cpp \
- gui/qt/util/buttons/BrowseButton.moc.cpp \
- gui/qt/styles/seekstyle.moc.cpp
+ gui/qt/util/buttons/BrowseButton.moc.cpp
if HAVE_WIN32
nodist_libqt_plugin_la_SOURCES += gui/qt/main_interface_win32.moc.cpp
diff --git a/modules/gui/qt/styles/seekstyle.cpp b/modules/gui/qt/styles/seekstyle.cpp
deleted file mode 100644
index 063f8e90a3..0000000000
--- a/modules/gui/qt/styles/seekstyle.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/*****************************************************************************
- * seekstyle.cpp : Seek slider style
- ****************************************************************************
- * Copyright (C) 2011-2012 VLC authors and VideoLAN
- *
- * Authors: Ludovic Fauvet <etix at videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * 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.
- *****************************************************************************/
-
-#include "seekstyle.hpp"
-#include "util/input_slider.hpp"
-
-#include <QProxyStyle>
-#include <QStyleFactory>
-#include <QStyleOptionSlider>
-#include <QPainter>
-#include <QDebug>
-
-#define RADIUS 3
-#define CHAPTERSSPOTSIZE 3
-
-SeekStyle::SeekStyleOption::SeekStyleOption()
- : QStyleOptionSlider(), buffering( 1.0 ), length(0), animate(false), animationopacity( 1.0 ),
- animationloading(0.0)
-{
-
-}
-
-SeekStyle::SeekStyle() : QProxyStyle( QStyleFactory::create( QLatin1String("Windows") ) )
-{
-
-}
-
-int SeekStyle::pixelMetric( PixelMetric metric, const QStyleOption *option, const QWidget *widget ) const
-{
- const QStyleOptionSlider *slider;
-
- if ( widget && ( slider = qstyleoption_cast<const QStyleOptionSlider *>( option ) ) )
- {
- switch( metric )
- {
- case QStyle::PM_SliderThickness:
- case QStyle::PM_SliderLength:
- return widget->minimumSize().height();
- default:
- break;
- }
- }
-
- return QProxyStyle::pixelMetric( metric, option, widget );
-}
-
-void SeekStyle::drawComplexControl( ComplexControl cc, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget ) const
-{
- if( cc == CC_Slider )
- {
- painter->setRenderHints( QPainter::Antialiasing );
-
- if ( const SeekStyle::SeekStyleOption *slideroptions =
- qstyleoption_cast<const SeekStyle::SeekStyleOption *>( option ) )
- {
- qreal sliderPos = -1;
-
- /* Get the needed subcontrols to draw the slider */
- QRect groove = subControlRect(CC_Slider, slideroptions, SC_SliderGroove, widget);
- QRect handle = subControlRect(CC_Slider, slideroptions, SC_SliderHandle, widget);
-
- /* Adjust the size of the groove so the handle stays centered */
- groove.adjust( handle.width() / 2, 0, -handle.width() / 2, 0 );
-
- /* Reduce the height of the groove */
- // Note: in the original 2.0.0 code, the groove had a height of 9px and to
- // comply with the original style (but still allow the widget to expand) I
- // had to remove 1 from the rect bottom.
- groove.adjust( 0, (qreal)groove.height() / 3.7, 0, (qreal)-groove.height() / 3.7 - 1 );
-
- if ( ( slideroptions->subControls & SC_SliderGroove ) && groove.isValid() )
- {
- sliderPos = ( ( (qreal)groove.width() ) / (qreal)slideroptions->maximum )
- * (qreal)slideroptions->sliderPosition;
-
- /* set the background color and gradient */
- QColor backgroundBase( slideroptions->palette.window().color() );
- QLinearGradient backgroundGradient( 0, 0, 0, slideroptions->rect.height() );
- backgroundGradient.setColorAt( 0.0, backgroundBase.darker( 140 ) );
- backgroundGradient.setColorAt( 1.0, backgroundBase );
-
- /* set the foreground color and gradient */
- QColor foregroundBase( 50, 156, 255 );
- QLinearGradient foregroundGradient( 0, 0, 0, groove.height() );
- foregroundGradient.setColorAt( 0.0, foregroundBase );
- foregroundGradient.setColorAt( 1.0, foregroundBase.darker( 125 ) );
-
- /* draw a slight 3d effect on the bottom */
- painter->setPen( QColor( 230, 230, 230 ) );
- painter->setBrush( Qt::NoBrush );
- painter->drawRoundedRect( groove.adjusted( 0, 2, 0, 0 ), RADIUS, RADIUS );
-
- /* draw background */
- painter->setPen( Qt::NoPen );
- painter->setBrush( backgroundGradient );
- painter->drawRoundedRect( groove, RADIUS, RADIUS );
-
- /* adjusted foreground rectangle */
- QRect valueRect = groove.adjusted( 1, 1, -1, 0 );
-
- valueRect.setWidth( sliderPos );
-
- /* draw foreground */
- if ( slideroptions->sliderPosition > slideroptions->minimum && slideroptions->sliderPosition <= slideroptions->maximum )
- {
- painter->setPen( Qt::NoPen );
- painter->setBrush( foregroundGradient );
- painter->drawRoundedRect( valueRect, RADIUS, RADIUS );
- }
-
- if ( slideroptions->buffering == 0.0 && slideroptions->animationloading > 0.0 )
- {
- int width = groove.width() - groove.width() / 6;
- QRect innerRect = groove.adjusted( slideroptions->animationloading * width + 1, 1,
- width * ( -1.0 + slideroptions->animationloading ) - 1, 0);
- QColor overlayColor = QColor( "Orange" );
- overlayColor.setAlpha( 128 );
- painter->setBrush( overlayColor );
- painter->drawRoundedRect( innerRect, RADIUS, RADIUS );
- }
-
- /* draw buffering overlay */
- if ( slideroptions->buffering > 0.0 && slideroptions->buffering < 1.0 )
- {
- QRect innerRect = groove.adjusted( 1, 1,
- groove.width() * ( -1.0 + slideroptions->buffering ) - 1, 0 );
- QColor overlayColor = QColor( "Orange" );
- overlayColor.setAlpha( 128 );
- painter->setBrush( overlayColor );
- painter->drawRoundedRect( innerRect, RADIUS, RADIUS );
- }
- }
-
- if ( slideroptions->subControls & SC_SliderTickmarks ) {
- QStyleOptionSlider tmpSlider = *slideroptions;
- tmpSlider.subControls = SC_SliderTickmarks;
- QProxyStyle::drawComplexControl(cc, &tmpSlider, painter, widget);
- }
-
- if ( slideroptions->subControls & SC_SliderHandle && handle.isValid() )
- {
- /* Useful for debugging */
- //painter->setBrush( QColor( 0, 0, 255, 150 ) );
- //painter->drawRect( handle );
-
- if ( option->state & QStyle::State_MouseOver || slideroptions->animate )
- {
- QPalette p = slideroptions->palette;
-
- /* draw chapters tickpoints */
- if ( slideroptions->points.size() && slideroptions->length && groove.width() )
- {
- QColor background = p.color( QPalette::Active, QPalette::Window );
- QColor foreground = p.color( QPalette::Active, QPalette::WindowText );
- foreground.setHsv( foreground.hue(),
- ( background.saturation() + foreground.saturation() ) / 2,
- ( background.value() + foreground.value() ) / 2 );
- if ( slideroptions->orientation == Qt::Horizontal ) /* TODO: vertical */
- {
- foreach( vlc_tick_t time, slideroptions->points )
- {
- int x = groove.x() + time / (double)CLOCK_FREQ / slideroptions->length * groove.width();
- painter->setPen( foreground );
- painter->setBrush( Qt::NoBrush );
- painter->drawLine( x, slideroptions->rect.height(), x, slideroptions->rect.height() - CHAPTERSSPOTSIZE );
- }
- }
- }
-
- /* draw handle */
- if ( option->state & QStyle::State_Enabled && sliderPos != -1 )
- {
- QSize hSize = QSize( handle.height(), handle.height() ) - QSize( 6, 6 );;
- QPoint pos = QPoint( handle.center().x() - ( hSize.width() / 2 ), handle.center().y() - ( hSize.height() / 2 ) );
-
- QPoint shadowPos( pos - QPoint( 2, 2 ) );
- QSize sSize( QSize( handle.height(), handle.height() ) - QSize( 2, 2 ) );
-
- /* prepare the handle's gradient */
- QLinearGradient handleGradient( 0, 0, 0, hSize.height() );
- handleGradient.setColorAt( 0.0, p.window().color().lighter( 120 ) );
- handleGradient.setColorAt( 0.9, p.window().color().darker( 120 ) );
-
- /* prepare the handle's shadow gradient */
- QColor shadowBase = p.shadow().color();
- if( shadowBase.lightness() > 100 )
- shadowBase = QColor( 60, 60, 60 ); // Palette's shadow is too bright
- QColor shadowDark( shadowBase.darker( 150 ) );
- QColor shadowLight( shadowBase.lighter( 180 ) );
- shadowLight.setAlpha( 50 );
-
- QRadialGradient shadowGradient( shadowPos.x() + ( sSize.width() / 2 ),
- shadowPos.y() + ( sSize.height() / 2 ),
- qMax( sSize.width(), sSize.height() ) / 2 );
- shadowGradient.setColorAt( 0.4, shadowDark );
- shadowGradient.setColorAt( 1.0, shadowLight );
-
- painter->setPen( Qt::NoPen );
- painter->setOpacity( slideroptions->animationopacity );
-
- /* draw the handle's shadow */
- painter->setBrush( shadowGradient );
- painter->drawEllipse( shadowPos.x(), shadowPos.y() + 1, sSize.width(), sSize.height() );
-
- /* finally draw the handle */
- painter->setBrush( handleGradient );
- painter->drawEllipse( pos.x(), pos.y(), hSize.width(), hSize.height() );
- }
- }
- }
- }
- }
- else
- {
- qWarning() << "SeekStyle: Drawing an unmanaged control";
- QProxyStyle::drawComplexControl( cc, option, painter, widget );
- }
-}
diff --git a/modules/gui/qt/styles/seekstyle.hpp b/modules/gui/qt/styles/seekstyle.hpp
deleted file mode 100644
index 1a165f793c..0000000000
--- a/modules/gui/qt/styles/seekstyle.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*****************************************************************************
- * seekstyle.hpp : Seek slider style
- ****************************************************************************
- * Copyright (C) 2011-2012 VLC authors and VideoLAN
- *
- * Authors: Ludovic Fauvet <etix at videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * 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.
- *****************************************************************************/
-
-#ifndef SEEKSTYLE_HPP
-#define SEEKSTYLE_HPP
-
-#include "qt.hpp"
-
-#include <inttypes.h>
-#include <QProxyStyle>
-#include <QStyleOptionSlider>
-
-class SeekStyle : public QProxyStyle
-{
- Q_OBJECT
-public:
- class SeekStyleOption : public QStyleOptionSlider
- {
- public:
- SeekStyleOption();
- float buffering;
- int length;
- bool animate;
- qreal animationopacity;
- qreal animationloading;
- QList<vlc_tick_t> points;
- };
-
-public:
- SeekStyle();
- int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0) const Q_DECL_OVERRIDE;
- void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const Q_DECL_OVERRIDE;
-};
-
-#endif // SEEKSTYLE_HPP
diff --git a/modules/gui/qt/util/input_slider.cpp b/modules/gui/qt/util/input_slider.cpp
deleted file mode 100644
index b849db4cff..0000000000
--- a/modules/gui/qt/util/input_slider.cpp
+++ /dev/null
@@ -1,768 +0,0 @@
-/*****************************************************************************
- * input_slider.cpp : VolumeSlider and SeekSlider
- ****************************************************************************
- * Copyright (C) 2006-2011 the VideoLAN team
- *
- * Authors: Clément Stenac <zorglub at videolan.org>
- * Jean-Baptiste Kempf <jb at videolan.org>
- * Ludovic Fauvet <etix at videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * 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.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "qt.hpp"
-
-#include "util/input_slider.hpp"
-#include "util/timetooltip.hpp"
-#include "player/player_controller.hpp"
-#include "imagehelper.hpp"
-#include "player/input_models.hpp"
-
-#include <QPaintEvent>
-#include <QPainter>
-#include <QBitmap>
-#include <QStyleOptionSlider>
-#include <QLinearGradient>
-#include <QTimer>
-#include <QRadialGradient>
-#include <QLinearGradient>
-#include <QSize>
-#include <QPalette>
-#include <QColor>
-#include <QPoint>
-#include <QPropertyAnimation>
-#include <QApplication>
-#include <QDebug>
-#include <QScreen>
-#include <QSequentialAnimationGroup>
-
-#include <vlc_aout.h>
-
-namespace {
- int const MIN_SLIDER_VALUE = 0;
- int const MAX_SLIDER_VALUE = 10000;
-
- int const CHAPTER_SPOT_SIZE = 3;
-
- int const FADE_DURATION = 300;
- int const FADEOUT_DELAY = 2000;
-}
-
-SeekSlider::SeekSlider( intf_thread_t *p_intf, Qt::Orientation q, QWidget *_parent, bool _static )
- : QSlider( q, _parent ), p_intf( p_intf ), b_classic( _static ), animLoading( NULL )
-{
- isSliding = false;
- isJumping = false;
- f_buffering = 0.0;
- mHandleOpacity = 1.0;
- mLoading = 0.0;
- chapters = THEMIM->getChapters();
- mHandleLength = -1;
- b_seekable = true;
- alternativeStyle = NULL;
-
- // prepare some static colors
- QPalette p = palette();
- QColor background = p.color( QPalette::Active, QPalette::Window );
- tickpointForeground = p.color( QPalette::Active, QPalette::WindowText );
- tickpointForeground.setHsv( tickpointForeground.hue(),
- ( background.saturation() + tickpointForeground.saturation() ) / 2,
- ( background.value() + tickpointForeground.value() ) / 2 );
-
- // set the background color and gradient
- QColor backgroundBase( p.window().color() );
- backgroundGradient.setColorAt( 0.0, backgroundBase.darker( 140 ) );
- backgroundGradient.setColorAt( 1.0, backgroundBase );
-
- // set the foreground color and gradient
- QColor foregroundBase( 50, 156, 255 );
- foregroundGradient.setColorAt( 0.0, foregroundBase );
- foregroundGradient.setColorAt( 1.0, foregroundBase.darker( 140 ) );
-
- // prepare the handle's gradient
- handleGradient.setColorAt( 0.0, p.window().color().lighter( 120 ) );
- handleGradient.setColorAt( 0.9, p.window().color().darker( 120 ) );
-
- // prepare the handle's shadow gradient
- QColor shadowBase = p.shadow().color();
- if( shadowBase.lightness() > 100 )
- shadowBase = QColor( 60, 60, 60 ); // Palette's shadow is too bright
- shadowDark = shadowBase.darker( 150 );
- shadowLight = shadowBase.lighter( 180 );
- shadowLight.setAlpha( 50 );
-
- /* Timer used to fire intermediate updatePos() when sliding */
- seekLimitTimer = new QTimer( this );
- seekLimitTimer->setSingleShot( true );
-
- /* Tooltip bubble */
- mTimeTooltip = new TimeTooltip( NULL );
- mTimeTooltip->setMouseTracking( true );
-
- /* Properties */
- setRange( MIN_SLIDER_VALUE, MAX_SLIDER_VALUE );
- setSingleStep( 2 );
- setPageStep( 10 );
- setMouseTracking( true );
- setTracking( true );
- setFocusPolicy( Qt::NoFocus );
-
- /* Use the new/classic style */
- setMinimumHeight( 18 );
- if( !b_classic )
- {
- alternativeStyle = new SeekStyle;
- setStyle( alternativeStyle );
- }
-
- /* Init to 0 */
- setPosition( -1.0, 0, 0 );
- secstotimestr( psz_length, 0 );
-
- animHandle = new QPropertyAnimation( this, "handleOpacity", this );
- animHandle->setDuration( FADE_DURATION );
- animHandle->setStartValue( 0.0 );
- animHandle->setEndValue( 1.0 );
-
- QPropertyAnimation *animLoadingIn = new QPropertyAnimation( this, "loadingProperty", this );
- animLoadingIn->setDuration( 2000 );
- animLoadingIn->setStartValue( 0.0 );
- animLoadingIn->setEndValue( 1.0 );
- animLoadingIn->setEasingCurve( QEasingCurve::OutBounce );
- QPropertyAnimation *animLoadingOut = new QPropertyAnimation( this, "loadingProperty", this );
- animLoadingOut->setDuration( 2000 );
- animLoadingOut->setStartValue( 1.0 );
- animLoadingOut->setEndValue( 0.0 );
- animLoadingOut->setEasingCurve( QEasingCurve::OutBounce );
-
- animLoading = new QSequentialAnimationGroup( this );
- animLoading->addAnimation( animLoadingIn );
- animLoading->addAnimation( animLoadingOut );
- animLoading->setLoopCount( -1 );
-
- hideHandleTimer = new QTimer( this );
- hideHandleTimer->setSingleShot( true );
- hideHandleTimer->setInterval( FADEOUT_DELAY );
-
- startAnimLoadingTimer = new QTimer( this );
- startAnimLoadingTimer->setSingleShot( true );
- startAnimLoadingTimer->setInterval( 500 );
-
- connect( THEMIM, &PlayerController::inputChanged, this , &SeekSlider::inputUpdated );
- CONNECT( this, sliderMoved( int ), this, startSeekTimer() );
- CONNECT( seekLimitTimer, timeout(), this, updatePos() );
- CONNECT( hideHandleTimer, timeout(), this, hideHandle() );
- CONNECT( startAnimLoadingTimer, timeout(), this, startAnimLoading() );
- mTimeTooltip->installEventFilter( this );
-}
-
-SeekSlider::~SeekSlider()
-{
- if ( alternativeStyle )
- delete alternativeStyle;
- delete mTimeTooltip;
-}
-
-/***
- * \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, vlc_tick_t time, int length )
-{
- VLC_UNUSED(time);
- if( pos == -1.0 || ! b_seekable )
- {
- setEnabled( false );
- mTimeTooltip->hide();
- isSliding = false;
- setValue( 0 );
- return;
- }
- else
- setEnabled( true );
-
- if( !isSliding )
- {
- setValue( pos * static_cast<float>( maximum() ) );
- if ( animLoading != NULL && pos >= 0.0f && animLoading->state() != QAbstractAnimation::Stopped )
- {
- animLoading->stop();
- mLoading = 0.0f;
- }
-
- }
-
- inputLength = length;
-}
-
-void SeekSlider::startSeekTimer()
-{
- /* Only fire one update, when sliding, every 150ms */
- if( isSliding && !seekLimitTimer->isActive() )
- seekLimitTimer->start( 150 );
-}
-
-void SeekSlider::updatePos()
-{
- float f_pos = value() / static_cast<float>( maximum() );
- emit sliderDragged( f_pos ); /* Send new position to VLC's core */
-}
-
-void SeekSlider::updateBuffering( float f_buffering_ )
-{
- if ( f_buffering_ < f_buffering )
- bufferingStart = QTime::currentTime();
- f_buffering = f_buffering_;
- if ( f_buffering > 0.0 || isEnabled() ) {
- animLoading->stop();
- startAnimLoadingTimer->stop();
- mLoading = 0.0;
- }
- repaint();
-}
-
-void SeekSlider::inputUpdated( bool b_has_input )
-{
- if ( b_has_input == false ) {
- animLoading->stop();
- startAnimLoadingTimer->stop();
- mLoading = 0.0;
- repaint();
- }
- else if ( f_buffering == 0.0 && !isEnabled() )
- startAnimLoadingTimer->start();
-}
-
-void SeekSlider::processReleasedButton()
-{
- if ( !isSliding && !isJumping ) return;
- isSliding = false;
- bool b_seekPending = seekLimitTimer->isActive();
- seekLimitTimer->stop(); /* We're not sliding anymore: only last seek on release */
- if ( isJumping )
- {
- isJumping = false;
- return;
- }
- if( b_seekPending && isEnabled() )
- updatePos();
-}
-
-void SeekSlider::mouseReleaseEvent( QMouseEvent *event )
-{
- if ( event->button() != Qt::LeftButton && event->button() != Qt::MidButton )
- {
- QSlider::mouseReleaseEvent( event );
- return;
- }
- event->accept();
- processReleasedButton();
-}
-
-void SeekSlider::mousePressEvent( QMouseEvent* event )
-{
- /* Right-click */
- if ( !isEnabled() ||
- ( event->button() != Qt::LeftButton && event->button() != Qt::MidButton )
- )
- {
- QSlider::mousePressEvent( event );
- return;
- }
-
- isJumping = false;
- /* handle chapter clicks */
- int i_width = size().width();
- if ( chapters->rowCount() != 0 && inputLength && i_width)
- {
- if ( orientation() == Qt::Horizontal ) /* TODO: vertical */
- {
- /* only on chapters zone */
- if ( event->y() < CHAPTER_SPOT_SIZE ||
- event->y() > ( size().height() - CHAPTER_SPOT_SIZE ) )
- {
- int i_selected = -1;
- vlc_tick_t first_chapter = chapters->data(chapters->index(0), ChapterListModel::TimeRole).value<vlc_tick_t>();
- bool b_startsnonzero = first_chapter > 0; /* as we always starts at 1 */
- int i_min_diff = i_width + 1;
- for( int i = 0 ; i < chapters->rowCount() ; i++ )
- {
- vlc_tick_t chaptertime = chapters->data(chapters->index(i), ChapterListModel::TimeRole).value<vlc_tick_t>();
- int x = chaptertime / (double)CLOCK_FREQ / inputLength * i_width;
- int diff_x = abs( x - event->x() );
- if ( diff_x < i_min_diff )
- {
- i_min_diff = diff_x;
- i_selected = i + ( ( b_startsnonzero )? 1 : 0 );
- } else break;
- }
- if ( i_selected && i_min_diff < 4 ) // max 4px around mark
- {
- chapters->setData(chapters->index(i_selected) , true, ChapterListModel::TimeRole);
- event->accept();
- isJumping = true;
- return;
- }
- }
- }
- }
-
- isSliding = true ;
-
- setValue( getValueFromXPos( event->x() ) );
- emit sliderMoved( value() );
- event->accept();
-}
-
-void SeekSlider::mouseMoveEvent( QMouseEvent *event )
-{
- if ( ! ( event->buttons() & ( Qt::LeftButton | Qt::MidButton ) ) )
- {
- /* Handle button release when mouserelease has been hijacked by popup */
- processReleasedButton();
- }
-
- if ( !isEnabled() ) return event->accept();
-
- if( isSliding )
- {
- setValue( getValueFromXPos( event->x() ) );
- emit sliderMoved( value() );
- }
-
- /* Tooltip */
- if ( inputLength > 0 )
- {
- int margin = handleLength();
- int posX = qMax( rect().left() + margin, qMin( rect().right() - margin, event->x() ) );
-
- QString chapterLabel;
-
- if ( orientation() == Qt::Horizontal ) /* TODO: vertical */
- {
- int i_selected = -1;
- for( int i = 0 ; i < chapters->rowCount() ; i++ )
- {
- vlc_tick_t chaptertime = chapters->data( chapters->index(i), ChapterListModel::TimeRole ).value<vlc_tick_t>();
- int x = margin + chaptertime / (double)CLOCK_FREQ / inputLength * (size().width() - 2*margin);
- if ( event->x() >= x )
- i_selected = i;
- }
- if ( i_selected >= 0 && i_selected < chapters->rowCount() )
- {
- chapterLabel = chapters->data(chapters->index(i_selected), Qt::DisplayRole ).toString();
- }
- }
-
- QPoint target( event->globalX() - ( event->x() - posX ),
- QWidget::mapToGlobal( QPoint( 0, 0 ) ).y() );
- if( likely( size().width() > handleLength() ) ) {
- secstotimestr( psz_length, getValuePercentageFromXPos( event->x() ) * inputLength );
- mTimeTooltip->setTip( target, psz_length, chapterLabel );
- }
- }
- event->accept();
-}
-
-void SeekSlider::wheelEvent( QWheelEvent *event )
-{
- /* Don't do anything if we are for somehow reason sliding */
- if( !isSliding && isEnabled() )
- {
- int64_t i_size = var_InheritInteger( vlc_object_instance(p_intf), "short-jump-size" );
- int i_mode = var_InheritInteger( vlc_object_instance(p_intf), "hotkeys-x-wheel-mode" );
- if ( ( event->delta() < 0 && i_mode != 3 ) || ( event->delta() > 0 && i_mode == 3 ) )
- i_size = - i_size;
- float posOffset = static_cast<float>( i_size ) / static_cast<float>( inputLength );
- setValue( value() + posOffset * maximum() );
- emit sliderDragged( value() / static_cast<float>( maximum() ) );
- }
- event->accept();
-}
-
-void SeekSlider::enterEvent( QEvent * )
-{
- /* Cancel the fade-out timer */
- hideHandleTimer->stop();
- /* Only start the fade-in if needed */
- if( isEnabled() && animHandle->direction() != QAbstractAnimation::Forward )
- {
- /* If pause is called while not running Qt will complain */
- if( animHandle->state() == QAbstractAnimation::Running )
- animHandle->pause();
- animHandle->setDirection( QAbstractAnimation::Forward );
- animHandle->start();
- }
- /* Don't show the tooltip if the slider is disabled or a menu is open */
- if( isEnabled() && inputLength > 0 && !qApp->activePopupWidget() )
- mTimeTooltip->show();
-}
-
-void SeekSlider::leaveEvent( QEvent * )
-{
- hideHandleTimer->start();
- /* Hide the tooltip
- - if the mouse leave the slider rect (Note: it can still be
- over the tooltip!)
- - if another window is on the way of the cursor */
- if( !rect().contains( mapFromGlobal( QCursor::pos() ) ) ||
- ( !isActiveWindow() && !mTimeTooltip->isActiveWindow() ) )
- {
- mTimeTooltip->hide();
- }
-}
-
-void SeekSlider::paintEvent( QPaintEvent *ev )
-{
- if ( alternativeStyle )
- {
- SeekStyle::SeekStyleOption option;
- option.initFrom( this );
- if ( QTime::currentTime() > bufferingStart.addSecs( 1 ) )
- option.buffering = f_buffering;
- else
- option.buffering = 0.0;
- option.length = inputLength;
- option.animate = ( animHandle->state() == QAbstractAnimation::Running
- || hideHandleTimer->isActive() );
- option.animationopacity = mHandleOpacity;
- option.animationloading = mLoading;
- option.sliderPosition = sliderPosition();
- option.sliderValue = value();
- option.maximum = maximum();
- option.minimum = minimum();
- for (int i = 0; i < chapters->rowCount(); i++)
- option.points << chapters->data(chapters->index(i), ChapterListModel::TimeRole).value<vlc_tick_t>();
- QPainter painter( this );
- style()->drawComplexControl( QStyle::CC_Slider, &option, &painter, this );
- }
- else
- QSlider::paintEvent( ev );
-}
-
-void SeekSlider::hideEvent( QHideEvent * )
-{
- mTimeTooltip->hide();
-}
-
-bool SeekSlider::eventFilter( QObject *obj, QEvent *event )
-{
- if( obj == mTimeTooltip )
- {
- if( event->type() == QEvent::MouseMove )
- {
- QMouseEvent* mev = static_cast<QMouseEvent*>( event );
-
- if( rect().contains( mapFromGlobal( mev->globalPos() ) ) )
- return false;
- }
-
- if( event->type() == QEvent::Leave ||
- event->type() == QEvent::MouseMove )
- {
- mTimeTooltip->hide();
- }
-
- return false;
- }
-
- return QSlider::eventFilter( obj, event );
-}
-
-QSize SeekSlider::sizeHint() const
-{
- if ( b_classic )
- return QSlider::sizeHint();
- return ( orientation() == Qt::Horizontal ) ? QSize( 100, 18 )
- : QSize( 18, 100 );
-}
-
-qreal SeekSlider::handleOpacity() const
-{
- return mHandleOpacity;
-}
-
-qreal SeekSlider::loading() const
-{
- return mLoading;
-}
-
-void SeekSlider::setHandleOpacity(qreal opacity)
-{
- mHandleOpacity = opacity;
- /* Request a new paintevent */
- update();
-}
-
-void SeekSlider::setLoading(qreal loading)
-{
- mLoading = loading;
- /* Request a new paintevent */
- update();
-}
-
-inline int SeekSlider::handleLength()
-{
- if ( mHandleLength > 0 )
- return mHandleLength;
-
- /* Ask for the length of the handle to the underlying style */
- QStyleOptionSlider option;
- initStyleOption( &option );
- mHandleLength = style()->pixelMetric( QStyle::PM_SliderLength, &option );
- return mHandleLength;
-}
-
-inline int SeekSlider::getValueFromXPos( int posX )
-{
- return QStyle::sliderValueFromPosition(
- minimum(), maximum(),
- posX - handleLength() / 2,
- width() - handleLength(),
- false
- );
-}
-
-inline float SeekSlider::getValuePercentageFromXPos( int posX )
-{
- return getValueFromXPos( posX ) / static_cast<float>( maximum() );
-}
-
-void SeekSlider::hideHandle()
-{
- /* If pause is called while not running Qt will complain */
- if( animHandle->state() == QAbstractAnimation::Running )
- animHandle->pause();
- /* Play the animation backward */
- animHandle->setDirection( QAbstractAnimation::Backward );
- animHandle->start();
-}
-
-void SeekSlider::startAnimLoading()
-{
- animLoading->start();
-}
-
-/* This work is derived from Amarok's work under GPLv2+
- - Mark Kretschmann
- - Gábor Lehel
- */
-#define WLENGTH 85 // px
-#define WHEIGHT 26 // px
-#define PADDINGL 6 // px
-#define PADDINGR 6 // px
-#define SOUNDMIN 0 // %
-
-SoundSlider::SoundSlider( QWidget *_parent, float _i_step,
- char *psz_colors, int max )
- : QAbstractSlider( _parent )
-{
- f_step = (float)(_i_step * 10000)
- / (float)((max - SOUNDMIN) * AOUT_VOLUME_DEFAULT);
- setRange( SOUNDMIN, max);
- setMouseTracking( true );
- isSliding = false;
- b_mouseOutside = true;
- b_isMuted = false;
-
- setFixedSize( WLENGTH, WHEIGHT );
-
- pixOutside = ImageHelper::loadSvgToPixmap(":/toolbar/volslide-outside.svg", width(), height() );
-
- const QPixmap temp = ImageHelper::loadSvgToPixmap(":/toolbar/volslide-inside.svg", width(), height() );
- const QBitmap mask( temp.createHeuristicMask() );
-
- pixGradient = QPixmap( pixOutside.size() );
- pixGradient2 = QPixmap( pixOutside.size() );
-#if HAS_QT56
- pixGradient.setDevicePixelRatio(QApplication::primaryScreen()->devicePixelRatio());
- pixGradient2.setDevicePixelRatio(QApplication::primaryScreen()->devicePixelRatio());
-#endif
-
- /* Gradient building from the preferences */
- QLinearGradient gradient( PADDINGL, 2, width() - PADDINGR, 2 );
- QLinearGradient gradient2( PADDINGL, 2, width()- PADDINGR, 2 );
-
- QStringList colorList = qfu( psz_colors ).split( ";" );
- free( psz_colors );
-
- /* Fill with 255 if the list is too short */
- if( colorList.count() < 12 )
- for( int i = colorList.count(); i < 12; i++)
- colorList.append( "255" );
-
- background = palette().color( QPalette::Active, QPalette::Window );
- foreground = palette().color( QPalette::Active, QPalette::WindowText );
- foreground.setHsv( foreground.hue(),
- ( background.saturation() + foreground.saturation() ) / 2,
- ( background.value() + foreground.value() ) / 2 );
-
- textfont.setPointSize( 7 );
- textrect.setRect( 0, 0, 34, 15 );
-
- /* Regular colors */
-#define c(i) colorList.at(i).toInt()
-#define add_color(gradient, range, c1, c2, c3) \
- gradient.setColorAt( range, QColor( c(c1), c(c2), c(c3) ) );
-
- /* Desaturated colors */
-#define desaturate(c) c->setHsvF( c->hueF(), 0.2 , 0.5, 1.0 )
-#define add_desaturated_color(gradient, range, c1, c2, c3) \
- foo = new QColor( c(c1), c(c2), c(c3) );\
- desaturate( foo ); gradient.setColorAt( range, *foo );\
- delete foo;
-
- /* combine the two helpers */
-#define add_colors( gradient1, gradient2, range, c1, c2, c3 )\
- add_color( gradient1, range, c1, c2, c3 ); \
- add_desaturated_color( gradient2, range, c1, c2, c3 );
-
- float f_mid_point = ( 100.0 / maximum() );
- QColor * foo;
- add_colors( gradient, gradient2, 0.0, 0, 1, 2 );
- add_colors( gradient, gradient2, f_mid_point - 0.05, 3, 4, 5 );
- add_colors( gradient, gradient2, f_mid_point + 0.05, 6, 7, 8 );
- add_colors( gradient, gradient2, 1.0, 9, 10, 11 );
-
- painter.begin( &pixGradient );
- painter.setPen( Qt::NoPen );
- painter.setBrush( gradient );
- painter.drawRect( pixGradient.rect() );
- painter.end();
-
- painter.begin( &pixGradient2 );
- painter.setPen( Qt::NoPen );
- painter.setBrush( gradient2 );
- painter.drawRect( pixGradient2.rect() );
- painter.end();
-
- pixGradient.setMask( mask );
- pixGradient2.setMask( mask );
-}
-
-void SoundSlider::wheelEvent( QWheelEvent *event )
-{
- int newvalue = value() + event->delta() / ( 8 * 15 ) * f_step;
- setValue( __MIN( __MAX( minimum(), newvalue ), maximum() ) );
-
- emit sliderReleased();
- emit sliderMoved( value() );
-}
-
-void SoundSlider::mousePressEvent( QMouseEvent *event )
-{
- if( event->button() != Qt::RightButton )
- {
- /* We enter the sliding mode */
- isSliding = true;
- i_oldvalue = value();
- emit sliderPressed();
- changeValue( event->x() );
- emit sliderMoved( value() );
- }
-}
-
-void SoundSlider::processReleasedButton()
-{
- if( !b_mouseOutside && value() != i_oldvalue )
- {
- emit sliderReleased();
- setValue( value() );
- emit sliderMoved( value() );
- }
- isSliding = false;
- b_mouseOutside = false;
-}
-
-void SoundSlider::mouseReleaseEvent( QMouseEvent *event )
-{
- if( event->button() != Qt::RightButton )
- processReleasedButton();
-}
-
-void SoundSlider::mouseMoveEvent( QMouseEvent *event )
-{
- /* handle mouserelease hijacking */
- if ( isSliding && ( event->buttons() & ~Qt::RightButton ) == Qt::NoButton )
- processReleasedButton();
-
- if( isSliding )
- {
- QRect rect( PADDINGL - 15, -1,
- width() - PADDINGR + 15 * 2 , width() + 5 );
- if( !rect.contains( event->pos() ) )
- { /* We are outside */
- if ( !b_mouseOutside )
- setValue( i_oldvalue );
- b_mouseOutside = true;
- }
- else
- { /* We are inside */
- b_mouseOutside = false;
- changeValue( event->x() );
- emit sliderMoved( value() );
- }
- }
- else
- {
- int i = ( ( event->x() - PADDINGL ) * maximum() ) / ( width() - ( PADDINGR + PADDINGL ) );
- i = __MIN( __MAX( 0, i ), maximum() );
- setToolTip( QString("%1 %" ).arg( i ) );
- }
-}
-
-void SoundSlider::changeValue( int x )
-{
- setValue( ( ( x - PADDINGL ) * maximum() ) / ( width() - ( PADDINGR + PADDINGL ) ) );
-}
-
-void SoundSlider::setMuted( bool m )
-{
- b_isMuted = m;
- update();
-}
-
-void SoundSlider::paintEvent( QPaintEvent *e )
-{
- QPixmap *paintGradient;
- if (b_isMuted)
- paintGradient = &this->pixGradient2;
- else
- paintGradient = &this->pixGradient;
-
- painter.begin( this );
-
- float f_scale = paintGradient->width() / float( width() );
- const int offsetDst = int( ( ( width() - ( PADDINGR + PADDINGL ) ) * value() + 100 ) / maximum() ) + PADDINGL;
- const int offsetSrc = int( ( ( paintGradient->width() - ( PADDINGR + PADDINGL ) * f_scale ) * value() + 100 ) / maximum() + PADDINGL * f_scale );
-
- painter.drawPixmap( 0, 0, offsetDst, height(), *paintGradient, 0, 0, offsetSrc, paintGradient->height() );
- painter.drawPixmap( 0, 0, width(), height(), pixOutside, 0, 0, pixOutside.width(), pixOutside.height() );
-
- painter.setPen( foreground );
- painter.setFont( textfont );
- painter.drawText( textrect, Qt::AlignRight | Qt::AlignVCenter,
- QString::number( value() ) + '%' );
-
- painter.end();
- e->accept();
-}
diff --git a/modules/gui/qt/util/input_slider.hpp b/modules/gui/qt/util/input_slider.hpp
deleted file mode 100644
index 1ffd590150..0000000000
--- a/modules/gui/qt/util/input_slider.hpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/*****************************************************************************
- * input_slider.hpp : VolumeSlider and SeekSlider
- ****************************************************************************
- * Copyright (C) 2006-2011 the VideoLAN team
- *
- * Authors: Clément Stenac <zorglub at videolan.org>
- * Jean-Baptiste Kempf <jb at videolan.org>
- * Ludovic Fauvet <etix at videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * 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.
- *****************************************************************************/
-
-#ifndef VLC_QT_INPUT_SLIDER_HPP_
-#define VLC_QT_INPUT_SLIDER_HPP_
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "styles/seekstyle.hpp"
-
-#include <QSlider>
-#include <QPainter>
-#include <QTime>
-
-class QMouseEvent;
-class QWheelEvent;
-class QHideEvent;
-class QTimer;
-class QPropertyAnimation;
-class QCommonStyle;
-class TimeTooltip;
-class QSequentialAnimationGroup;
-
-/* Input Slider derived from QSlider */
-class SeekSlider : public QSlider
-{
- Q_OBJECT
- Q_PROPERTY(qreal handleOpacity READ handleOpacity WRITE setHandleOpacity)
- Q_PROPERTY(qreal loadingProperty READ loading WRITE setLoading)
-public:
- SeekSlider( intf_thread_t *p_intf, Qt::Orientation q, QWidget *_parent = 0,
- bool _classic = false );
- virtual ~SeekSlider();
-
-protected:
- void mouseMoveEvent( QMouseEvent *event ) Q_DECL_OVERRIDE;
- void mousePressEvent( QMouseEvent* event ) Q_DECL_OVERRIDE;
- void mouseReleaseEvent( QMouseEvent *event ) Q_DECL_OVERRIDE;
- void wheelEvent( QWheelEvent *event ) Q_DECL_OVERRIDE;
- void enterEvent( QEvent * ) Q_DECL_OVERRIDE;
- void leaveEvent( QEvent * ) Q_DECL_OVERRIDE;
- void hideEvent( QHideEvent * ) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *ev) Q_DECL_OVERRIDE;
-
- bool eventFilter( QObject *obj, QEvent *event ) Q_DECL_OVERRIDE;
-
- QSize sizeHint() const Q_DECL_OVERRIDE;
-
- void processReleasedButton();
- qreal handleOpacity() const;
- qreal loading() const;
- void setHandleOpacity( qreal opacity );
- void setLoading( qreal loading );
- int handleLength();
-
- float getValuePercentageFromXPos( int );
- int getValueFromXPos( int );
-
-private:
- intf_thread_t *p_intf;
- 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;
- QTime bufferingStart;
- QAbstractListModel* chapters;
- bool b_classic;
- bool b_seekable;
- int mHandleLength;
-
- /* Colors & gradients */
- QSize gradientsTargetSize;
- QLinearGradient backgroundGradient;
- QLinearGradient foregroundGradient;
- QLinearGradient handleGradient;
- QColor tickpointForeground;
- QColor shadowDark;
- QColor shadowLight;
- QCommonStyle *alternativeStyle;
-
- /* Handle's animation */
- qreal mHandleOpacity;
- qreal mLoading;
- QPropertyAnimation *animHandle;
- QSequentialAnimationGroup *animLoading;
- QTimer *hideHandleTimer;
- QTimer *startAnimLoadingTimer;
-
-public slots:
- void setPosition( float, vlc_tick_t, int );
- void setSeekable( bool b ) { b_seekable = b ; }
- void updateBuffering( float );
- void hideHandle();
-
-private slots:
- void startSeekTimer();
- void updatePos();
- void inputUpdated( bool );
- void startAnimLoading();
-
-signals:
- void sliderDragged( float );
-
-};
-
-/* Sound Slider inherited directly from QAbstractSlider */
-class QPaintEvent;
-
-#define SOUNDMAX 125 // % (+6dB)
-
-class SoundSlider : public QAbstractSlider
-{
- Q_OBJECT
-public:
- SoundSlider(QWidget *_parent, float _i_step, char *psz_colors, int max = SOUNDMAX );
- void setMuted( bool ); /* Set Mute status */
-
-protected:
- void paintEvent( QPaintEvent *) Q_DECL_OVERRIDE;
- void wheelEvent( QWheelEvent *event ) Q_DECL_OVERRIDE;
- void mousePressEvent( QMouseEvent * ) Q_DECL_OVERRIDE;
- void mouseMoveEvent( QMouseEvent * ) Q_DECL_OVERRIDE;
- void mouseReleaseEvent( QMouseEvent * ) Q_DECL_OVERRIDE;
-
- void processReleasedButton();
-
-private:
- 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 */
- bool b_isMuted;
-
- QPixmap pixGradient; /* Gradient pix storage */
- QPixmap pixGradient2; /* Muted Gradient pix storage */
- QPixmap pixOutside; /* OutLine pix storage */
- QPainter painter;
- QColor background;
- QColor foreground;
- QFont textfont;
- QRect textrect;
-
- void changeValue( int x ); /* Function to modify the value from pixel x() */
-};
-
-#endif
diff --git a/modules/gui/qt/util/timetooltip.cpp b/modules/gui/qt/util/timetooltip.cpp
deleted file mode 100644
index 825a2b0aac..0000000000
--- a/modules/gui/qt/util/timetooltip.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*****************************************************************************
- * Copyright © 2011-2012 VideoLAN
- *
- * Authors: Ludovic Fauvet <etix at l0cal.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * 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.
- *****************************************************************************/
-
-#include "timetooltip.hpp"
-
-#include <QApplication>
-#include <QPainter>
-#include <QPainterPath>
-#include <QBitmap>
-#include <QFontMetrics>
-#include <QDesktopWidget>
-
-#define TIP_HEIGHT 5
-
-TimeTooltip::TimeTooltip( QWidget *parent ) :
- QWidget( parent )
-{
- setWindowFlags( Qt::ToolTip |
- Qt::WindowStaysOnTopHint |
- Qt::FramelessWindowHint );
-
- // Tell Qt that it doesn't need to erase the background before
- // a paintEvent occurs. This should save some CPU cycles.
- setAttribute( Qt::WA_OpaquePaintEvent );
- setAttribute( Qt::WA_TranslucentBackground );
- setAttribute( Qt::WA_TransparentForMouseEvents );
-
- // Inherit from the system default font size -5
- mFont = QFont( "Verdana", qMax( qApp->font().pointSize() - 5, 7 ) );
- mTipX = -1;
-
- // By default the widget is unintialized and should not be displayed
- resize( 0, 0 );
-}
-
-void TimeTooltip::adjustPosition()
-{
- if( mDisplayedText.isEmpty() )
- {
- resize( 0, 0 );
- return;
- }
-
- // Get the bounding box required to print the text and add some padding
- QFontMetrics metrics( mFont );
- QRect textbox = metrics.boundingRect( mDisplayedText );
- textbox.adjust( -2, -2, 2, 2 );
- textbox.moveTo( 0, 0 );
-
- // Resize the widget to fit our needs
- QSize size( textbox.width() + 1, textbox.height() + TIP_HEIGHT + 1 );
-
- // The desired label position is just above the target
- QPoint position( mTarget.x() - size.width() / 2,
-#if defined( Q_OS_WIN )
- mTarget.y() - 2 * size.height() - TIP_HEIGHT / 2 );
-#else
- mTarget.y() - size.height() - TIP_HEIGHT / 2 );
-#endif
-
- // Keep the tooltip on the same screen if possible
- QRect screen = QApplication::desktop()->screenGeometry( mTarget );
- position.setX( qMax( screen.left(), qMin( position.x(),
- screen.left() + screen.width() - size.width() ) ) );
- position.setY( qMax( screen.top(), qMin( position.y(),
- screen.top() + screen.height() - size.height() ) ) );
-
- move( position );
-
- int tipX = mTarget.x() - position.x();
- if( mBox != textbox || mTipX != tipX )
- {
- mBox = textbox;
- mTipX = tipX;
-
- resize( size );
- buildPath();
- }
-}
-
-void TimeTooltip::buildPath()
-{
- // Prepare the painter path for future use so
- // we only have to generate the text at runtime.
-
- // Draw the text box
- mPainterPath = QPainterPath();
- mPainterPath.addRect( mBox );
-
- // Draw the tip
- QPolygonF polygon;
- polygon << QPoint( qMax( 0, mTipX - 3 ), mBox.height() )
- << QPoint( mTipX, mBox.height() + TIP_HEIGHT )
- << QPoint( qMin( mTipX + 3, mBox.width() ), mBox.height() );
- mPainterPath.addPolygon( polygon );
-
- // Store the simplified version of the path
- mPainterPath = mPainterPath.simplified();
-}
-
-void TimeTooltip::setTip( const QPoint& target, const QString& time, const QString& text )
-{
- mDisplayedText = time;
- if ( !text.isEmpty() )
- mDisplayedText.append( " - " ).append( text );
-
- if( mTarget != target || time.length() != mTime.length() || mText != text )
- {
- mTarget = target;
- mTime = time;
- mText = text;
- adjustPosition();
- }
-
- update();
- raise();
-}
-
-void TimeTooltip::show()
-{
- setVisible( true );
- raise();
-}
-
-void TimeTooltip::paintEvent( QPaintEvent * )
-{
- QPainter p( this );
- p.setRenderHints( QPainter::HighQualityAntialiasing | QPainter::TextAntialiasing );
-
- p.setPen( Qt::black );
- p.setBrush( qApp->palette().base() );
- p.drawPath( mPainterPath );
-
- p.setFont( mFont );
- p.setPen( QPen( qApp->palette().text(), 1 ) );
- p.drawText( mBox, Qt::AlignCenter, mDisplayedText );
-}
diff --git a/modules/gui/qt/util/timetooltip.hpp b/modules/gui/qt/util/timetooltip.hpp
deleted file mode 100644
index 5c3882ed2b..0000000000
--- a/modules/gui/qt/util/timetooltip.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*****************************************************************************
- * Copyright © 2011 VideoLAN
- *
- * Authors: Ludovic Fauvet <etix at l0cal.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * 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.
- *****************************************************************************/
-
-#ifndef TIMETOOLTIP_H
-#define TIMETOOLTIP_H
-
-#include "qt.hpp"
-
-#include <QWidget>
-
-class TimeTooltip : public QWidget
-{
- Q_OBJECT
-public:
- explicit TimeTooltip( QWidget *parent = 0 );
- void setTip( const QPoint& pos, const QString& time, const QString& text );
- virtual void show();
-
-protected:
- void paintEvent( QPaintEvent * ) Q_DECL_OVERRIDE;
-
-private:
- void adjustPosition();
- void buildPath();
- QPoint mTarget;
- QString mTime;
- QString mText;
- QString mDisplayedText;
- QFont mFont;
- QRect mBox;
- QPainterPath mPainterPath;
- int mTipX;
-};
-
-#endif // TIMETOOLTIP_H
diff --git a/po/POTFILES.in b/po/POTFILES.in
index eebebc07c4..7b51cf3166 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -761,8 +761,6 @@ modules/gui/qt/qt.cpp
modules/gui/qt/qt.hpp
modules/gui/qt/recents.cpp
modules/gui/qt/recents.hpp
-modules/gui/qt/styles/seekstyle.cpp
-modules/gui/qt/styles/seekstyle.hpp
modules/gui/qt/util/animators.cpp
modules/gui/qt/util/animators.hpp
modules/gui/qt/util/buttons/BrowseButton.cpp
@@ -775,8 +773,6 @@ modules/gui/qt/util/customwidgets.cpp
modules/gui/qt/util/customwidgets.hpp
modules/gui/qt/util/imagehelper.cpp
modules/gui/qt/util/imagehelper.hpp
-modules/gui/qt/util/input_slider.cpp
-modules/gui/qt/util/input_slider.hpp
modules/gui/qt/util/qt_dirs.cpp
modules/gui/qt/util/qt_dirs.hpp
modules/gui/qt/util/qvlcapp.hpp
@@ -786,8 +782,6 @@ modules/gui/qt/util/registry.hpp
modules/gui/qt/util/searchlineedit.cpp
modules/gui/qt/util/searchlineedit.hpp
modules/gui/qt/util/singleton.hpp
-modules/gui/qt/util/timetooltip.cpp
-modules/gui/qt/util/timetooltip.hpp
modules/gui/qt/util/validators.cpp
modules/gui/qt/util/validators.hpp
modules/gui/skins2/commands/async_queue.cpp
More information about the vlc-commits
mailing list