]> git.sesse.net Git - vlc/commitdiff
Qt4 : Simple Preferences. Add a slider widget to pref_widget, because it is nicer...
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 28 Feb 2007 23:38:48 +0000 (23:38 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 28 Feb 2007 23:38:48 +0000 (23:38 +0000)
Could you look please on that commit cause I don't understand if it is the good way to do it (I guess not) and why do I had to add this 'bool' to the methods.

zorglub, dionoea?

modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/preferences_widgets.hpp
modules/gui/qt4/components/simple_preferences.cpp

index 295fc84db8dd33d9ef39f31e161c8c6a2fde341b..80e9c33cb2f8056bf76780b045c941b9d60f9255 100644 (file)
@@ -43,6 +43,7 @@
 #include <QComboBox>
 #include <QGridLayout>
 #include <QPushButton>
+#include <QSlider>
 
 #include <vlc_keys.h>
 
@@ -547,6 +548,29 @@ void IntegerRangeConfigControl::finish()
     spin->setMinimum( p_item->min.i );
 }
 
+IntegerRangeSliderConfigControl::IntegerRangeSliderConfigControl(
+                                            vlc_object_t *_p_this,
+                                            module_config_t *_p_item,
+                                            QLabel *_label, QSlider *_slider,
+                                            bool *_bool          ) :
+                    VIntConfigControl( _p_this, _p_item )
+{
+    slider = _slider;
+    label = _label;
+    slider->setMaximum( p_item->max.i );
+    slider->setMinimum( p_item->min.i );
+    slider->setValue( p_item->value.i );
+    slider->setToolTip( qfu(p_item->psz_longtext) );
+    if( label )
+        label->setToolTip( qfu(p_item->psz_longtext) );
+}
+
+int IntegerRangeSliderConfigControl::getValue()
+{
+        return slider->value();
+}
+
+
 /********* Integer / choice list **********/
 IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
                module_config_t *_p_item, QWidget *_parent, bool bycat,
index 5cccaea67bc7de3c489d18bb6bcf79666689b490..31087439c86b3cde0a7f156966d3bc958f03c3df 100644 (file)
@@ -101,6 +101,8 @@ public:
                           QGridLayout *, int& );
     IntegerConfigControl( vlc_object_t *, module_config_t *,
                           QLabel*, QSpinBox* );
+    IntegerConfigControl( vlc_object_t *, module_config_t *,
+                          QLabel*, QSlider* );
     virtual ~IntegerConfigControl() {};
     virtual int getValue();
     virtual void show() { spin->show(); label->show(); }
@@ -108,7 +110,6 @@ public:
 
 protected:
     QSpinBox *spin;
-
 private:
     QLabel *label;
     void finish();
@@ -125,6 +126,20 @@ private:
     void finish();
 };
 
+class IntegerRangeSliderConfigControl : public VIntConfigControl
+{
+public:
+    IntegerRangeSliderConfigControl( vlc_object_t *, module_config_t *,
+                                QLabel *, QSlider *, bool * );
+    virtual ~IntegerRangeSliderConfigControl() {};
+    virtual int getValue();
+protected:
+         QSlider *slider;
+private:
+         QLabel *label;
+         void finish();
+};
+
 class IntegerListConfigControl : public VIntConfigControl
 {
 public:
index ef20090a775c7fadd8aae2a8915049a94083b6b1..c2b0b650a60d4fbbb5bdd5b9ed4c9d0f565ff090 100644 (file)
@@ -136,7 +136,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 
 #ifdef WIN32
             CONFIG_GENERIC( "directx-wallpaper" , Bool , NULL, wallpaperMode );
-            CONFIG_GENERIC( "directx-device", String, NULL, dXdisplayDevice );
+      //      CONFIG_GENERIC( "directx-device", String, NULL, dXdisplayDevice );
 #endif
 
             CONFIG_GENERIC( "snapshot-path", String, NULL,
@@ -161,7 +161,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 #endif
          CONFIG_GENERIC( "audio", Bool, NULL, enableAudio );
 
-/*       CONFIG_GENERIC( "volume" ,  RangedInt, NULL, defaultVolume );*/ //FIXME Why ?
+       CONFIG_GENERIC( "volume" ,  IntegerRangeSlider, NULL, defaultVolume ); 
+
 /*         CONFIG_GENERIC( "audio-language" , String , NULL, 
                     preferredAudioLanguage ); */ //FIXME WHy ?
          CONFIG_GENERIC( "spdif" , Bool , NULL, spdifBox );
@@ -173,8 +174,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 /*       CONFIG_GENERIC( "alsadev" , String , NULL, alsaDevice );*/
          CONFIG_GENERIC( "dspdev" , String , NULL, OSSDevice );//FIXME File
 #else
-         CONFIG_GENERIC( "directx-audio-device" , Integer, NULL, 
-                 DirectXDevice );
+/*       CONFIG_GENERIC( "directx-audio-device" , Integer, NULL, 
+                 DirectXDevice );*/
 #endif
          CONFIG_GENERIC( "audiofile-file" , String , NULL, FileName ); //Fixme File