[vlc-commits] Qt: preferences with same module name have the right options
Benoit du Payrat
git at videolan.org
Tue Apr 19 13:21:16 CEST 2016
vlc | branch: master | Benoit du Payrat <benoit at videolabs.io> | Tue Apr 19 11:21:03 2016 +0200| [9e011b3bb1c0295f07973b16e29e7ac434305a6f] | committer: Jean-Baptiste Kempf
Qt: preferences with same module name have the right options
Fix #16175
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9e011b3bb1c0295f07973b16e29e7ac434305a6f
---
modules/gui/qt/components/complete_preferences.cpp | 9 ++++-----
modules/gui/qt/components/complete_preferences.hpp | 3 ++-
modules/gui/qt/dialogs/preferences.cpp | 17 +++++++++++++----
modules/gui/qt/dialogs/preferences.hpp | 4 +++-
4 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/modules/gui/qt/components/complete_preferences.cpp b/modules/gui/qt/components/complete_preferences.cpp
index d8620b1..389edc4 100644
--- a/modules/gui/qt/components/complete_preferences.cpp
+++ b/modules/gui/qt/components/complete_preferences.cpp
@@ -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();
diff --git a/modules/gui/qt/components/complete_preferences.hpp b/modules/gui/qt/components/complete_preferences.hpp
index 5c3bfa7..dae75bf 100644
--- a/modules/gui/qt/components/complete_preferences.hpp
+++ b/modules/gui/qt/components/complete_preferences.hpp
@@ -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();
diff --git a/modules/gui/qt/dialogs/preferences.cpp b/modules/gui/qt/dialogs/preferences.cpp
index 8aeb017..110c60d 100644
--- a/modules/gui/qt/dialogs/preferences.cpp
+++ b/modules/gui/qt/dialogs/preferences.cpp
@@ -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 );
}
diff --git a/modules/gui/qt/dialogs/preferences.hpp b/modules/gui/qt/dialogs/preferences.hpp
index 58ba7c4..43a9044 100644
--- a/modules/gui/qt/dialogs/preferences.hpp
+++ b/modules/gui/qt/dialogs/preferences.hpp
@@ -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;
More information about the vlc-commits
mailing list