Commit 9a78b063 authored by Clément Stenac's avatar Clément Stenac

A bit of cleanup

parent ba0aca83
...@@ -61,11 +61,6 @@ ...@@ -61,11 +61,6 @@
PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
QTreeWidget( _parent ), p_intf( _p_intf ) QTreeWidget( _parent ), p_intf( _p_intf )
{ {
module_t *p_module;
vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
FIND_ANYWHERE );
if( !p_list ) return;
setColumnCount( 1 ); setColumnCount( 1 );
setIconSize( QSize( ITEM_HEIGHT,ITEM_HEIGHT ) ); setIconSize( QSize( ITEM_HEIGHT,ITEM_HEIGHT ) );
setAlternatingRowColors( true ); setAlternatingRowColors( true );
...@@ -83,14 +78,20 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -83,14 +78,20 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
/* Build the tree for the main module */ /* Build the tree for the main module */
int i_index; int i_index;
module_t *p_module;
vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
FIND_ANYWHERE );
bool found = true;
if( !p_list ) return;
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_index = 0; i_index < p_list->i_count; i_index++ )
{ {
p_module = (module_t *)p_list->p_values[i_index].p_object; p_module = (module_t *)p_list->p_values[i_index].p_object;
if( !strcmp( p_module->psz_object_name, "main" ) ) if( !strcmp( p_module->psz_object_name, "main" ) ) {
break; found = true; break;
} }
if( i_index < p_list->i_count ) }
{ assert( found );
module_config_t *p_item = p_module->p_config; module_config_t *p_item = p_module->p_config;
PrefsItemData *data = NULL; PrefsItemData *data = NULL;
QTreeWidgetItem *current_item = NULL; QTreeWidgetItem *current_item = NULL;
...@@ -182,7 +183,6 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -182,7 +183,6 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
break; break;
} }
} while( p_item->i_type != CONFIG_HINT_END && p_item++ ); } while( p_item->i_type != CONFIG_HINT_END && p_item++ );
}
/* Build the tree of plugins */ /* Build the tree of plugins */
for( int i_index = 0; i_index < p_list->i_count; i_index++ ) for( int i_index = 0; i_index < p_list->i_count; i_index++ )
...@@ -284,7 +284,6 @@ void PrefsTree::cleanAll() ...@@ -284,7 +284,6 @@ void PrefsTree::cleanAll()
doAll( true ); doAll( true );
} }
/// \todo When cleaning, we should remove the panel ?
void PrefsTree::doAll( bool doclean ) void PrefsTree::doAll( bool doclean )
{ {
for( int i_cat_index = 0 ; i_cat_index < topLevelItemCount(); for( int i_cat_index = 0 ; i_cat_index < topLevelItemCount();
...@@ -350,29 +349,9 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -350,29 +349,9 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
p_module = (module_t *) vlc_object_get( p_intf, data->i_object_id ); p_module = (module_t *) vlc_object_get( p_intf, data->i_object_id );
else else
{ {
/* List the plugins */ p_module = config_FindModule( p_intf, "main" );
int i_index; assert( p_module );
vlc_bool_t b_found = VLC_FALSE; vlc_object_yield( p_module );
vlc_list_t *p_list = vlc_list_find( p_intf,
VLC_OBJECT_MODULE, FIND_ANYWHERE );
if( !p_list ) return;
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_module = (module_t *)p_list->p_values[i_index].p_object;
if( !strcmp( p_module->psz_object_name, "main" ) )
{
b_found = VLC_TRUE;
break;
}
}
if( !p_module && !b_found )
{
msg_Warn( p_intf, "unable to create preferences (main not found)");
return;
}
if( p_module ) vlc_object_yield( p_module );
vlc_list_release( p_list );
} }
if( p_module->b_submodule ) if( p_module->b_submodule )
......
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