Commit 9e011b3b authored by Benoit's avatar Benoit Committed by Jean-Baptiste Kempf

Qt: preferences with same module name have the right options

Fix #16175
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 2082625d
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
/********************************************************************* /*********************************************************************
* The Tree * The Tree
*********************************************************************/ *********************************************************************/
PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent,
module_t **p_list, size_t count ) :
QTreeWidget( _parent ), p_intf( _p_intf ) QTreeWidget( _parent ), p_intf( _p_intf )
{ {
b_show_only_loaded = false; b_show_only_loaded = false;
...@@ -194,8 +195,6 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -194,8 +195,6 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
} }
module_config_free( p_config ); module_config_free( p_config );
size_t count;
module_t **p_list = module_list_get( &count );
/* Build the tree of plugins */ /* Build the tree of plugins */
for( size_t i = 0; i < count; i++ ) for( size_t i = 0; i < count; i++ )
{ {
...@@ -273,6 +272,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -273,6 +272,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
module_data->psz_shortcut = strdup( module_get_object( p_module ) ); module_data->psz_shortcut = strdup( module_get_object( p_module ) );
module_data->name = qtr( module_get_name( p_module, false ) ); module_data->name = qtr( module_get_name( p_module, false ) );
module_data->help.clear(); module_data->help.clear();
module_data->p_module = p_module;
const char *psz_help = module_get_help( p_module ); const char *psz_help = module_get_help( p_module );
if ( psz_help ) if ( psz_help )
module_data->help = qtr( psz_help ); module_data->help = qtr( psz_help );
...@@ -288,7 +288,6 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -288,7 +288,6 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
/* We got everything, just sort a bit */ /* We got everything, just sort a bit */
sortItems( 0, Qt::AscendingOrder ); sortItems( 0, Qt::AscendingOrder );
module_list_free( p_list );
resizeColumnToContents( 0 ); resizeColumnToContents( 0 );
} }
...@@ -594,7 +593,7 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -594,7 +593,7 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
if( data->i_type == PrefsItemData::TYPE_CATEGORY ) if( data->i_type == PrefsItemData::TYPE_CATEGORY )
return; return;
else if( data->i_type == PrefsItemData::TYPE_MODULE ) else if( data->i_type == PrefsItemData::TYPE_MODULE )
p_module = module_find( data->psz_shortcut ); p_module = data->p_module;
else else
{ {
p_module = module_get_main(); p_module = module_get_main();
......
...@@ -59,6 +59,7 @@ public: ...@@ -59,6 +59,7 @@ public:
bool b_loaded; bool b_loaded;
QString name; QString name;
QString help; QString help;
module_t *p_module;
}; };
Q_DECLARE_METATYPE( PrefsItemData* ); Q_DECLARE_METATYPE( PrefsItemData* );
...@@ -68,7 +69,7 @@ class PrefsTree : public QTreeWidget ...@@ -68,7 +69,7 @@ class PrefsTree : public QTreeWidget
Q_OBJECT Q_OBJECT
public: public:
PrefsTree( intf_thread_t *, QWidget * ); PrefsTree( intf_thread_t *, QWidget *, module_t **, size_t );
void applyAll(); void applyAll();
void cleanAll(); void cleanAll();
......
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
#include <QShortcut> #include <QShortcut>
#include <QScrollArea> #include <QScrollArea>
#include <vlc_modules.h>
PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf ) PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
: QVLCDialog( parent, _p_intf ) : QVLCDialog( parent, _p_intf )
{ {
...@@ -81,6 +83,7 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf ) ...@@ -81,6 +83,7 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
/* Tree and panel initialisations */ /* Tree and panel initialisations */
advanced_tree = NULL; advanced_tree = NULL;
p_list = NULL;
tree_filter = NULL; tree_filter = NULL;
current_filter = NULL; current_filter = NULL;
simple_tree = NULL; simple_tree = NULL;
...@@ -144,6 +147,11 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf ) ...@@ -144,6 +147,11 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
QVLCTools::restoreWidgetPosition( p_intf, "Preferences", this, QSize( 800 , 700 ) ); QVLCTools::restoreWidgetPosition( p_intf, "Preferences", this, QSize( 800 , 700 ) );
} }
PrefsDialog::~PrefsDialog()
{
module_list_free( p_list );
}
void PrefsDialog::setAdvanced() void PrefsDialog::setAdvanced()
{ {
if ( !tree_filter ) if ( !tree_filter )
...@@ -171,11 +179,12 @@ void PrefsDialog::setAdvanced() ...@@ -171,11 +179,12 @@ void PrefsDialog::setAdvanced()
if( !advanced_tree ) if( !advanced_tree )
{ {
/* Creation */ /* Creation */
advanced_tree = new PrefsTree( p_intf, simple_tree_panel ); p_list = module_list_get( &count );
advanced_tree = new PrefsTree( p_intf, simple_tree_panel, p_list, count );
/* and connections */ /* and connections */
CONNECT( advanced_tree, CONNECT( advanced_tree,
currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ), currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ),
this, changeAdvPanel( QTreeWidgetItem * ) ); this, changeAdvPanel( QTreeWidgetItem * ) );
advanced_tree_panel->layout()->addWidget( advanced_tree ); advanced_tree_panel->layout()->addWidget( advanced_tree );
advanced_tree_panel->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred ); advanced_tree_panel->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred );
} }
......
...@@ -44,7 +44,7 @@ class PrefsDialog : public QVLCDialog ...@@ -44,7 +44,7 @@ class PrefsDialog : public QVLCDialog
Q_OBJECT Q_OBJECT
public: public:
PrefsDialog( QWidget *, intf_thread_t * ); PrefsDialog( QWidget *, intf_thread_t * );
virtual ~PrefsDialog() {} virtual ~PrefsDialog();
#if 0 #if 0
/*Called from extended settings, is not used anymore, but could be useful one day*/ /*Called from extended settings, is not used anymore, but could be useful one day*/
void showModulePrefs( char* ); void showModulePrefs( char* );
...@@ -66,6 +66,8 @@ private: ...@@ -66,6 +66,8 @@ private:
SPrefsCatList *simple_tree; SPrefsCatList *simple_tree;
PrefsTree *advanced_tree; PrefsTree *advanced_tree;
size_t count;
module_t **p_list;
SearchLineEdit *tree_filter; SearchLineEdit *tree_filter;
QCheckBox *current_filter; QCheckBox *current_filter;
......
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