]> git.sesse.net Git - vlc/commitdiff
Qt: Change the rate scale in order to have 0.96x in the slider in order to help peopl...
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 29 Dec 2008 11:54:58 +0000 (12:54 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 30 Dec 2008 12:19:34 +0000 (13:19 +0100)
Also remove lots of includes.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp

index 99a600c50a8654c198fd73a4e8076ea4765bf46b..e0fd180badbd1b238ddfba6e436d126007995e9f 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * interface_widgets.cpp : Custom widgets for the main interface
  ****************************************************************************
- * Copyright ( C ) 2006 the VideoLAN team
+ * Copyright (C) 2006-2008 the VideoLAN team
  * $Id$
  *
  * Authors: Clément Stenac <zorglub@videolan.org>
 # include "config.h"
 #endif
 
-#include <vlc_vout.h>
-
-#include "dialogs_provider.hpp"
 #include "components/interface_widgets.hpp"
-#include "main_interface.hpp"
-#include "input_manager.hpp"
-#include "menus.hpp"
-#include "util/input_slider.hpp"
-#include "util/customwidgets.hpp"
+
+#include "input_manager.hpp"     /* Rate control */
+#include "menus.hpp"             /* Popup menu on bgWidget */
+
+#include <vlc_vout.h>
 
 #include <QLabel>
-#include <QSpacerItem>
-#include <QCursor>
-#include <QPushButton>
 #include <QToolButton>
-#include <QHBoxLayout>
-#include <QMenu>
 #include <QPalette>
 #include <QResizeEvent>
 #include <QDate>
@@ -56,8 +48,6 @@
 
 #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
  * This class handles resize issues
@@ -238,6 +228,9 @@ void BackgroundWidget::contextMenuEvent( QContextMenuEvent *event )
 }
 
 #if 0
+#include <QPushButton>
+#include <QHBoxLayout>
+
 /**********************************************************************
  * Visualization selector panel
  **********************************************************************/
@@ -304,10 +297,10 @@ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i ) :
     speedSlider->setOrientation( Qt::Vertical );
     speedSlider->setTickPosition( QSlider::TicksRight );
 
-    speedSlider->setRange( -24, 24 );
+    speedSlider->setRange( -34, 34 );
     speedSlider->setSingleStep( 1 );
     speedSlider->setPageStep( 1 );
-    speedSlider->setTickInterval( 12 );
+    speedSlider->setTickInterval( 17 );
 
     CONNECT( speedSlider, valueChanged( int ), this, updateRate( int ) );
 
@@ -343,7 +336,7 @@ void SpeedControlWidget::updateControls( int rate )
         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 );
 
     if( sliderValue < speedSlider->minimum() )
@@ -363,7 +356,7 @@ void SpeedControlWidget::updateControls( int rate )
 
 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;
 
     THEMIM->getIM()->setRate(rate);
@@ -371,11 +364,9 @@ void SpeedControlWidget::updateRate( int sliderValue )
 
 void SpeedControlWidget::resetRate()
 {
-    THEMIM->getIM()->setRate(INPUT_RATE_DEFAULT);
+    THEMIM->getIM()->setRate( INPUT_RATE_DEFAULT );
 }
 
-
-
 static int downloadCoverCallback( vlc_object_t *p_this,
                                   char const *psz_var,
                                   vlc_value_t oldvar, vlc_value_t newvar,
index 607924b39c9b8b7abc6fc1f324101266086bad7d..f042806a2e7123abfa2e5d735b9ad4d68bf89bf6 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * interface_widgets.hpp : Custom widgets for the main interface
  ****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
+ * Copyright (C) 2006-2008 the VideoLAN team
  * $Id$
  *
  * Authors: Clément Stenac <zorglub@videolan.org>
 # include "config.h"
 #endif
 
-#include <vlc_common.h>
-#include <vlc_interface.h>
-//#include <vlc_aout.h> Visualizer
-
-#include "qt4.hpp"
 #include "main_interface.hpp"
 #include "input_manager.hpp"
+
 #include "components/controller.hpp"
 #include "components/controller_widget.hpp"
 
+//#include <vlc_aout.h> Visualizer
+
 #include <QWidget>
 #include <QFrame>
 #include <QLabel>
@@ -155,7 +153,7 @@ class SpeedLabel : public QLabel
 {
     Q_OBJECT
 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; }
 
 protected:
@@ -178,8 +176,10 @@ public:
 private:
     intf_thread_t *p_intf;
     QSlider *speedSlider;
+
 public slots:
     void setEnable( bool );
+
 private slots:
     void updateRate( int );
     void resetRate();
@@ -193,18 +193,22 @@ public:
                    vlc_object_t *p_this,
                    input_item_t *p_input = NULL );
     virtual ~CoverArtLabel()
-            { if( p_input ) vlc_gc_decref( p_input ); };
+    { if( p_input ) vlc_gc_decref( p_input ); }
 private:
     input_item_t *p_input;
     vlc_object_t *p_this;
+
     QString prevArt;
 
 public slots:
     void requestUpdate() { emit updateRequested(); };
     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 );
-              requestUpdate(); }
+    {
+        if( p_input ) vlc_gc_decref( p_input );
+        if( ( p_input = p_item ) )
+            vlc_gc_incref( p_input );
+        requestUpdate();
+    }
 
 private slots:
     void doUpdate();