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