Commit 7bb4a6ef authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

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? 
parent e87abf62
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <QComboBox> #include <QComboBox>
#include <QGridLayout> #include <QGridLayout>
#include <QPushButton> #include <QPushButton>
#include <QSlider>
#include <vlc_keys.h> #include <vlc_keys.h>
...@@ -547,6 +548,29 @@ void IntegerRangeConfigControl::finish() ...@@ -547,6 +548,29 @@ void IntegerRangeConfigControl::finish()
spin->setMinimum( p_item->min.i ); 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 **********/ /********* Integer / choice list **********/
IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this, IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_parent, bool bycat, module_config_t *_p_item, QWidget *_parent, bool bycat,
......
...@@ -101,6 +101,8 @@ public: ...@@ -101,6 +101,8 @@ public:
QGridLayout *, int& ); QGridLayout *, int& );
IntegerConfigControl( vlc_object_t *, module_config_t *, IntegerConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QSpinBox* ); QLabel*, QSpinBox* );
IntegerConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QSlider* );
virtual ~IntegerConfigControl() {}; virtual ~IntegerConfigControl() {};
virtual int getValue(); virtual int getValue();
virtual void show() { spin->show(); label->show(); } virtual void show() { spin->show(); label->show(); }
...@@ -108,7 +110,6 @@ public: ...@@ -108,7 +110,6 @@ public:
protected: protected:
QSpinBox *spin; QSpinBox *spin;
private: private:
QLabel *label; QLabel *label;
void finish(); void finish();
...@@ -125,6 +126,20 @@ private: ...@@ -125,6 +126,20 @@ private:
void finish(); 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 class IntegerListConfigControl : public VIntConfigControl
{ {
public: public:
......
...@@ -136,7 +136,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -136,7 +136,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#ifdef WIN32 #ifdef WIN32
CONFIG_GENERIC( "directx-wallpaper" , Bool , NULL, wallpaperMode ); CONFIG_GENERIC( "directx-wallpaper" , Bool , NULL, wallpaperMode );
CONFIG_GENERIC( "directx-device", String, NULL, dXdisplayDevice ); // CONFIG_GENERIC( "directx-device", String, NULL, dXdisplayDevice );
#endif #endif
CONFIG_GENERIC( "snapshot-path", String, NULL, CONFIG_GENERIC( "snapshot-path", String, NULL,
...@@ -161,7 +161,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -161,7 +161,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#endif #endif
CONFIG_GENERIC( "audio", Bool, NULL, enableAudio ); 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, /* CONFIG_GENERIC( "audio-language" , String , NULL,
preferredAudioLanguage ); */ //FIXME WHy ? preferredAudioLanguage ); */ //FIXME WHy ?
CONFIG_GENERIC( "spdif" , Bool , NULL, spdifBox ); CONFIG_GENERIC( "spdif" , Bool , NULL, spdifBox );
...@@ -173,8 +174,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -173,8 +174,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
/* CONFIG_GENERIC( "alsadev" , String , NULL, alsaDevice );*/ /* CONFIG_GENERIC( "alsadev" , String , NULL, alsaDevice );*/
CONFIG_GENERIC( "dspdev" , String , NULL, OSSDevice );//FIXME File CONFIG_GENERIC( "dspdev" , String , NULL, OSSDevice );//FIXME File
#else #else
CONFIG_GENERIC( "directx-audio-device" , Integer, NULL, /* CONFIG_GENERIC( "directx-audio-device" , Integer, NULL,
DirectXDevice ); DirectXDevice );*/
#endif #endif
CONFIG_GENERIC( "audiofile-file" , String , NULL, FileName ); //Fixme File CONFIG_GENERIC( "audiofile-file" , String , NULL, FileName ); //Fixme File
......
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