From: Jean-Baptiste Kempf Date: Wed, 28 Feb 2007 23:38:48 +0000 (+0000) Subject: Qt4 : Simple Preferences. Add a slider widget to pref_widget, because it is nicer... X-Git-Tag: 0.9.0-test0~8367 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=7bb4a6ef55444f256c11190378e57c430db67afe;p=vlc Qt4 : Simple Preferences. Add a slider widget to pref_widget, because it is nicer than a QSpinBox. 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? --- diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index 295fc84db8..80e9c33cb2 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -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, diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp index 5cccaea67b..31087439c8 100644 --- a/modules/gui/qt4/components/preferences_widgets.hpp +++ b/modules/gui/qt4/components/preferences_widgets.hpp @@ -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: diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp index ef20090a77..c2b0b650a6 100644 --- a/modules/gui/qt4/components/simple_preferences.cpp +++ b/modules/gui/qt4/components/simple_preferences.cpp @@ -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