X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fcomponents%2Fcomplete_preferences.cpp;h=f8dd3d80c0d636c68ed327b52303e624860d0b69;hb=e5c9c3b1de2c7d7afb0576e296b67cdc5a5945f5;hp=d6cd6160c7e0c5678fc38933337286147623d41f;hpb=35824733e305214dfada18dd6362cfa02a86dcd3;p=vlc diff --git a/modules/gui/qt4/components/complete_preferences.cpp b/modules/gui/qt4/components/complete_preferences.cpp index d6cd6160c7..f8dd3d80c0 100644 --- a/modules/gui/qt4/components/complete_preferences.cpp +++ b/modules/gui/qt4/components/complete_preferences.cpp @@ -34,11 +34,8 @@ #include #include #include -#include #include #include -#include -#include #include "components/complete_preferences.hpp" #include "components/preferences_widgets.hpp" @@ -64,25 +61,25 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : setTextElideMode( Qt::ElideNone ); /* Nice icons */ -#define BI( a,b) QIcon a##_icon = QIcon( QPixmap( b )) - BI( audio, ":/advprefs_audio" ); - BI( video, ":/advprefs_video" ); - BI( input, ":/advprefs_codec" ); - BI( sout, ":/advprefs_sout" ); - BI( advanced, ":/advprefs_extended" ); - BI( playlist, ":/advprefs_playlist" ); - BI( interface, ":/advprefs_intf" ); +#define BI( a,b) QIcon a##_icon = QIcon( b ) + BI( audio, ":/prefsmenu/advanced/audio" ); + BI( video, ":/prefsmenu/advanced/video" ); + BI( input, ":/prefsmenu/advanced/codec" ); + BI( sout, ":/prefsmenu/advanced/sout" ); + BI( advanced, ":/prefsmenu/advanced/extended" ); + BI( playlist, ":/prefsmenu/advanced/playlist" ); + BI( interface, ":/prefsmenu/advanced/intf" ); #undef BI /* Build the tree for the main module */ - module_t *p_module = module_GetMainModule( p_intf ); + module_t *p_module = module_get_main(); /* Initialisation and get the confsize */ PrefsItemData *data = NULL; PrefsItemData *data_sub = NULL; QTreeWidgetItem *current_item = NULL; unsigned confsize; - module_config_t *const p_config = module_GetConfig (p_module, &confsize); + module_config_t *const p_config = module_config_get (p_module, &confsize); /* Go through the list of conf */ for( size_t i = 0; i < confsize; i++ ) @@ -178,8 +175,6 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : /* Create a new TreeWidget */ QTreeWidgetItem *subcat_item = new QTreeWidgetItem(); subcat_item->setText( 0, data_sub->name ); - /* TODO : Choose the image */ - //subcat_item->setIcon( 0 , XXX ); subcat_item->setData( 0, Qt::UserRole, qVariantFromValue( data_sub ) ); subcat_item->setSizeHint( 0, QSize( -1, ITEM_HEIGHT ) ); @@ -192,24 +187,22 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : /* Other items don't need yet a place on the tree */ } } - module_PutConfig( p_config ); - vlc_object_release( (vlc_object_t*)p_module ); + module_config_free( p_config ); + module_release( p_module ); - vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, - FIND_ANYWHERE ); + module_t **p_list = module_list_get( NULL ); /* Build the tree of plugins */ - for( int i_index = 0; i_index < p_list->i_count; i_index++ ) + for( size_t i = 0; (p_module = p_list[i]) != NULL; i++ ) { - /* Take every module */ - p_module = (module_t *)p_list->p_values[i_index].p_object; - // Main module excluded - if( module_IsMainModule( p_module) ) continue; + if( module_is_main( p_module) ) continue; + + unsigned confsize; + int i_subcategory = 0, i_category = 0; - unsigned i_subcategory = 0, i_category = 0, confsize; bool b_options = false; - module_config_t *const p_config = module_GetConfig (p_module, &confsize); + module_config_t *const p_config = module_config_get (p_module, &confsize); /* Loop through the configurations items */ for (size_t i = 0; i < confsize; i++) @@ -227,7 +220,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : if( b_options && i_category && i_subcategory ) break; } - module_PutConfig (p_config); + module_config_free (p_config); /* Dummy item, please proceed */ if( !b_options || i_category == 0 || i_subcategory == 0 ) continue; @@ -272,12 +265,10 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : PrefsItemData *module_data = new PrefsItemData(); module_data->i_type = TYPE_MODULE; - module_data->psz_name = strdup( module_GetObjName( p_module ) ); + module_data->psz_name = strdup( module_get_object( p_module ) ); module_data->help.clear(); - // TODO image QTreeWidgetItem *module_item = new QTreeWidgetItem(); - module_item->setText( 0, qtr( module_GetName( p_module, false ) ) ); - //item->setIcon( 0 , XXX ); + module_item->setText( 0, qtr( module_get_name( p_module, false ) ) ); module_item->setData( 0, Qt::UserRole, QVariant::fromValue( module_data) ); module_item->setSizeHint( 0, QSize( -1, ITEM_HEIGHT ) ); @@ -287,7 +278,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : /* We got everything, just sort a bit */ sortItems( 0, Qt::AscendingOrder ); - vlc_list_release( p_list ); + module_list_free( p_list ); } PrefsTree::~PrefsTree() {} @@ -362,15 +353,15 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, if( data->i_type == TYPE_CATEGORY ) return; else if( data->i_type == TYPE_MODULE ) - p_module = module_Find( p_intf, data->psz_name ); + p_module = module_find( data->psz_name ); else { - p_module = module_GetMainModule( p_intf ); + p_module = module_get_main(); assert( p_module ); } unsigned confsize; - module_config_t *const p_config = module_GetConfig (p_module, &confsize), + module_config_t *const p_config = module_config_get (p_module, &confsize), *p_item = p_config, *p_end = p_config + confsize; @@ -378,11 +369,11 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, { while (p_item < p_end) { - if( p_item->i_type == CONFIG_SUBCATEGORY && - ( data->i_type == TYPE_SUBCATEGORY && + if( p_item->i_type == CONFIG_SUBCATEGORY && + ( ( data->i_type == TYPE_SUBCATEGORY && p_item->value.i == data->i_object_id ) || ( data->i_type == TYPE_CATSUBCAT && - p_item->value.i == data->i_subcat_id ) ) + p_item->value.i == data->i_subcat_id ) ) ) break; p_item++; } @@ -403,7 +394,7 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, } else { - const char *psz_help = module_GetHelp (p_module); + const char *psz_help = module_get_help (p_module); head = QString( qtr( module_GetLongName( p_module ) ) ); if( psz_help ) { @@ -457,10 +448,11 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, if( box ) { box->setLayout( boxlayout ); + box->show(); layout->addWidget( box, i_line, 0, 1, -1 ); i_line++; } - box = new QGroupBox( qtr( p_item->psz_text ) ); + box = new QGroupBox( qtr( p_item->psz_text ), this ); box->hide(); boxlayout = new QGridLayout(); } @@ -475,10 +467,10 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ConfigControl *control; if( ! box ) control = ConfigControl::createControl( VLC_OBJECT( p_intf ), - p_item, NULL, layout, i_line ); + p_item, this, layout, i_line ); else control = ConfigControl::createControl( VLC_OBJECT( p_intf ), - p_item, NULL, boxlayout, i_boxline ); + p_item, this, boxlayout, i_boxline ); if( !control ) continue; @@ -499,7 +491,7 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, layout->addWidget( box, i_line, 0, 1, -1 ); } - module_Put( p_module ); + module_release (p_module); scrolled_area->setSizePolicy( QSizePolicy::Preferred,QSizePolicy::Fixed ); scrolled_area->setLayout( layout ); @@ -518,5 +510,12 @@ void AdvPrefsPanel::apply() c->doApply( p_intf ); } } + void AdvPrefsPanel::clean() {} + +AdvPrefsPanel::~AdvPrefsPanel() +{ + qDeleteAll( controls ); controls.clear(); +} +