[vlc-commits] Qt4: use config_GetPszChoices() for module items
Rémi Denis-Courmont
git at videolan.org
Fri Oct 12 18:29:12 CEST 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Oct 12 19:28:50 2012 +0300| [a7963bfafe65611b995b0718448e0b6bf43beca7] | committer: Rémi Denis-Courmont
Qt4: use config_GetPszChoices() for module items
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a7963bfafe65611b995b0718448e0b6bf43beca7
---
modules/gui/qt4/components/preferences_widgets.cpp | 51 ++++++++------------
modules/gui/qt4/components/preferences_widgets.hpp | 6 +--
modules/gui/qt4/components/simple_preferences.cpp | 6 +--
3 files changed, 26 insertions(+), 37 deletions(-)
diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index a39e07a..a10cade 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -81,10 +81,10 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
switch( p_item->i_type )
{
case CONFIG_ITEM_MODULE:
- p_control = new ModuleConfigControl( p_this, p_item, parent, false );
+ p_control = new StringListConfigControl( p_this, p_item, parent );
break;
case CONFIG_ITEM_MODULE_CAT:
- p_control = new ModuleConfigControl( p_this, p_item, parent, true );
+ p_control = new ModuleConfigControl( p_this, p_item, parent );
break;
case CONFIG_ITEM_MODULE_LIST:
p_control = new ModuleListConfigControl( p_this, p_item, parent, false );
@@ -509,13 +509,13 @@ void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
/********* Module **********/
ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p, bool bycat ) :
+ module_config_t *_p_item, QWidget *p ) :
VStringConfigControl( _p_this, _p_item )
{
label = new QLabel( qtr(p_item->psz_text), p );
combo = new QComboBox( p );
combo->setMinimumWidth( MINWIDTH_BOX );
- finish( bycat );
+ finish( );
}
void ModuleConfigControl::fillGrid( QGridLayout *l, int line )
@@ -525,15 +525,15 @@ void ModuleConfigControl::fillGrid( QGridLayout *l, int line )
}
ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
- bool bycat ) : VStringConfigControl( _p_this, _p_item )
+ module_config_t *_p_item, QLabel *_label, QComboBox *_combo )
+ : VStringConfigControl( _p_this, _p_item )
{
combo = _combo;
label = _label;
- finish( bycat );
+ finish( );
}
-void ModuleConfigControl::finish( bool bycat )
+void ModuleConfigControl::finish( )
{
combo->setEditable( false );
@@ -545,36 +545,25 @@ void ModuleConfigControl::finish( bool bycat )
{
module_t *p_parser = p_list[i];
- if( bycat )
- {
- if( !strcmp( module_get_object( p_parser ), "main" ) ) continue;
+ if( !strcmp( module_get_object( p_parser ), "main" ) ) continue;
- unsigned confsize;
- module_config_t *p_config;
+ unsigned confsize;
+ module_config_t *p_config;
- p_config = module_config_get (p_parser, &confsize);
- for (size_t i = 0; i < confsize; i++)
- {
- /* Hack: required subcategory is stored in i_min */
- const module_config_t *p_cfg = p_config + i;
- if( p_cfg->i_type == CONFIG_SUBCATEGORY &&
- p_cfg->value.i == p_item->min.i )
- combo->addItem( qtr( module_GetLongName( p_parser )),
- QVariant( module_get_object( p_parser ) ) );
- if( p_item->value.psz && !strcmp( p_item->value.psz,
- module_get_object( p_parser ) ) )
- combo->setCurrentIndex( combo->count() - 1 );
- }
- module_config_free (p_config);
- }
- else if( module_provides( p_parser, p_item->psz_type ) )
+ p_config = module_config_get (p_parser, &confsize);
+ for (size_t i = 0; i < confsize; i++)
{
- combo->addItem( qtr(module_GetLongName( p_parser ) ),
- QVariant( module_get_object( p_parser ) ) );
+ /* Hack: required subcategory is stored in i_min */
+ const module_config_t *p_cfg = p_config + i;
+ if( p_cfg->i_type == CONFIG_SUBCATEGORY &&
+ p_cfg->value.i == p_item->min.i )
+ combo->addItem( qtr( module_GetLongName( p_parser )),
+ QVariant( module_get_object( p_parser ) ) );
if( p_item->value.psz && !strcmp( p_item->value.psz,
module_get_object( p_parser ) ) )
combo->setCurrentIndex( combo->count() - 1 );
}
+ module_config_free (p_config);
}
module_list_free( p_list );
diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp
index ba67a77..17ec335 100644
--- a/modules/gui/qt4/components/preferences_widgets.hpp
+++ b/modules/gui/qt4/components/preferences_widgets.hpp
@@ -386,9 +386,9 @@ protected:
class ModuleConfigControl : public VStringConfigControl
{
public:
- ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool );
+ ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget * );
ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
- QComboBox*, bool );
+ QComboBox* );
virtual QString getValue() const;
protected:
virtual void changeVisibility( bool b )
@@ -398,7 +398,7 @@ protected:
}
virtual void fillGrid( QGridLayout*, int );
private:
- void finish( bool );
+ void finish( );
QLabel *label;
QComboBox *combo;
};
diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp
index a909043..759ba54 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -221,7 +221,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
CONFIG_BOOL( "overlay", overlay );
CONFIG_BOOL( "video-on-top", alwaysOnTop );
CONFIG_BOOL( "video-deco", windowDecorations );
- CONFIG_GENERIC( "vout", Module, ui.voutLabel, outputModule );
+ CONFIG_GENERIC( "vout", StringList, ui.voutLabel, outputModule );
#ifdef WIN32
CONFIG_GENERIC( "directx-device", StringList, ui.dxDeviceLabel,
@@ -350,12 +350,12 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
volNormSpin );
CONFIG_GENERIC( "audio-replay-gain-mode", StringList, ui.replayLabel,
replayCombo );
- CONFIG_GENERIC( "audio-visual" , Module , ui.visuLabel,
+ CONFIG_GENERIC( "audio-visual" , StringList, ui.visuLabel,
visualisation);
CONFIG_BOOL( "audio-time-stretch", autoscaleBox );
/* Audio Output Specifics */
- CONFIG_GENERIC( "aout", Module, ui.outputLabel, outputModule );
+ CONFIG_GENERIC( "aout", StringList, ui.outputLabel, outputModule );
CONNECT( ui.outputModule, currentIndexChanged( int ),
this, updateAudioOptions( int ) );
More information about the vlc-commits
mailing list