Commit dcaffea5 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: Change the rate scale in order to have 0.96x in the slider in order to...

Qt: Change the rate scale in order to have 0.96x in the slider in order to help people who want to fix NTSC/PAL issues.

Also remove lots of includes.
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 4cca7c8a
/***************************************************************************** /*****************************************************************************
* interface_widgets.cpp : Custom widgets for the main interface * interface_widgets.cpp : Custom widgets for the main interface
**************************************************************************** ****************************************************************************
* Copyright ( C ) 2006 the VideoLAN team * Copyright (C) 2006-2008 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
...@@ -28,23 +28,15 @@ ...@@ -28,23 +28,15 @@
# include "config.h" # include "config.h"
#endif #endif
#include <vlc_vout.h>
#include "dialogs_provider.hpp"
#include "components/interface_widgets.hpp" #include "components/interface_widgets.hpp"
#include "main_interface.hpp"
#include "input_manager.hpp" #include "input_manager.hpp" /* Rate control */
#include "menus.hpp" #include "menus.hpp" /* Popup menu on bgWidget */
#include "util/input_slider.hpp"
#include "util/customwidgets.hpp" #include <vlc_vout.h>
#include <QLabel> #include <QLabel>
#include <QSpacerItem>
#include <QCursor>
#include <QPushButton>
#include <QToolButton> #include <QToolButton>
#include <QHBoxLayout>
#include <QMenu>
#include <QPalette> #include <QPalette>
#include <QResizeEvent> #include <QResizeEvent>
#include <QDate> #include <QDate>
...@@ -56,8 +48,6 @@ ...@@ -56,8 +48,6 @@
#include <math.h> #include <math.h>
#define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media")
/********************************************************************** /**********************************************************************
* Video Widget. A simple frame on which video is drawn * Video Widget. A simple frame on which video is drawn
* This class handles resize issues * This class handles resize issues
...@@ -238,6 +228,9 @@ void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event ) ...@@ -238,6 +228,9 @@ void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event )
} }
#if 0 #if 0
#include <QPushButton>
#include <QHBoxLayout>
/********************************************************************** /**********************************************************************
* Visualization selector panel * Visualization selector panel
**********************************************************************/ **********************************************************************/
...@@ -304,10 +297,10 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) : ...@@ -304,10 +297,10 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) :
speedSlider->setOrientation( Qt::Vertical ); speedSlider->setOrientation( Qt::Vertical );
speedSlider->setTickPosition( QSlider::TicksRight ); speedSlider->setTickPosition( QSlider::TicksRight );
speedSlider->setRange( -24, 24 ); speedSlider->setRange( -34, 34 );
speedSlider->setSingleStep( 1 ); speedSlider->setSingleStep( 1 );
speedSlider->setPageStep( 1 ); speedSlider->setPageStep( 1 );
speedSlider->setTickInterval( 12 ); speedSlider->setTickInterval( 17 );
CONNECT( speedSlider, valueChanged( int ), this, updateRate( int ) ); CONNECT( speedSlider, valueChanged( int ), this, updateRate( int ) );
...@@ -343,7 +336,7 @@ void SpeedControlWidget::updateControls( int rate ) ...@@ -343,7 +336,7 @@ void SpeedControlWidget::updateControls( int rate )
return; return;
} }
double value = 12 * log( (double)INPUT_RATE_DEFAULT / rate ) / log( 2 ); double value = 17 * log( (double)INPUT_RATE_DEFAULT / rate ) / log( 2 );
int sliderValue = (int) ( ( value > 0 ) ? value + .5 : value - .5 ); int sliderValue = (int) ( ( value > 0 ) ? value + .5 : value - .5 );
if( sliderValue < speedSlider->minimum() ) if( sliderValue < speedSlider->minimum() )
...@@ -363,7 +356,7 @@ void SpeedControlWidget::updateControls( int rate ) ...@@ -363,7 +356,7 @@ void SpeedControlWidget::updateControls( int rate )
void SpeedControlWidget::updateRate( int sliderValue ) void SpeedControlWidget::updateRate( int sliderValue )
{ {
double speed = pow( 2, (double)sliderValue / 12 ); double speed = pow( 2, (double)sliderValue / 17 );
int rate = INPUT_RATE_DEFAULT / speed; int rate = INPUT_RATE_DEFAULT / speed;
THEMIM->getIM()->setRate(rate); THEMIM->getIM()->setRate(rate);
...@@ -371,11 +364,9 @@ void SpeedControlWidget::updateRate( int sliderValue ) ...@@ -371,11 +364,9 @@ void SpeedControlWidget::updateRate( int sliderValue )
void SpeedControlWidget::resetRate() void SpeedControlWidget::resetRate()
{ {
THEMIM->getIM()->setRate(INPUT_RATE_DEFAULT); THEMIM->getIM()->setRate( INPUT_RATE_DEFAULT );
} }
static int downloadCoverCallback( vlc_object_t *p_this, static int downloadCoverCallback( vlc_object_t *p_this,
char const *psz_var, char const *psz_var,
vlc_value_t oldvar, vlc_value_t newvar, vlc_value_t oldvar, vlc_value_t newvar,
......
/***************************************************************************** /*****************************************************************************
* interface_widgets.hpp : Custom widgets for the main interface * interface_widgets.hpp : Custom widgets for the main interface
**************************************************************************** ****************************************************************************
* Copyright (C) 2006 the VideoLAN team * Copyright (C) 2006-2008 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Clément Stenac <zorglub@videolan.org> * Authors: Clément Stenac <zorglub@videolan.org>
...@@ -30,16 +30,14 @@ ...@@ -30,16 +30,14 @@
# include "config.h" # include "config.h"
#endif #endif
#include <vlc_common.h>
#include <vlc_interface.h>
//#include <vlc_aout.h> Visualizer
#include "qt4.hpp"
#include "main_interface.hpp" #include "main_interface.hpp"
#include "input_manager.hpp" #include "input_manager.hpp"
#include "components/controller.hpp" #include "components/controller.hpp"
#include "components/controller_widget.hpp" #include "components/controller_widget.hpp"
//#include <vlc_aout.h> Visualizer
#include <QWidget> #include <QWidget>
#include <QFrame> #include <QFrame>
#include <QLabel> #include <QLabel>
...@@ -155,7 +153,7 @@ class SpeedLabel : public QLabel ...@@ -155,7 +153,7 @@ class SpeedLabel : public QLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
SpeedLabel( intf_thread_t *_p_intf, const QString text ): QLabel( text) SpeedLabel( intf_thread_t *_p_intf, const QString text ): QLabel( text )
{ p_intf = _p_intf; } { p_intf = _p_intf; }
protected: protected:
...@@ -178,8 +176,10 @@ public: ...@@ -178,8 +176,10 @@ public:
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QSlider *speedSlider; QSlider *speedSlider;
public slots: public slots:
void setEnable( bool ); void setEnable( bool );
private slots: private slots:
void updateRate( int ); void updateRate( int );
void resetRate(); void resetRate();
...@@ -193,18 +193,22 @@ public: ...@@ -193,18 +193,22 @@ public:
vlc_object_t *p_this, vlc_object_t *p_this,
input_item_t *p_input = NULL ); input_item_t *p_input = NULL );
virtual ~CoverArtLabel() virtual ~CoverArtLabel()
{ if( p_input ) vlc_gc_decref( p_input ); }; { if( p_input ) vlc_gc_decref( p_input ); }
private: private:
input_item_t *p_input; input_item_t *p_input;
vlc_object_t *p_this; vlc_object_t *p_this;
QString prevArt; QString prevArt;
public slots: public slots:
void requestUpdate() { emit updateRequested(); }; void requestUpdate() { emit updateRequested(); };
void update( input_item_t* p_item ) void update( input_item_t* p_item )
{ if( p_input ) vlc_gc_decref( p_input ); {
if( ( p_input = p_item ) ) vlc_gc_incref( p_input ); if( p_input ) vlc_gc_decref( p_input );
requestUpdate(); } if( ( p_input = p_item ) )
vlc_gc_incref( p_input );
requestUpdate();
}
private slots: private slots:
void doUpdate(); void doUpdate();
......
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