From 93ec3e577095aee012432b84cb1ee11163b1050c Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Wed, 22 Nov 2006 18:42:57 +0000 Subject: [PATCH] Partial compilation fix --- modules/gui/qt4/components/preferences.cpp | 79 +++++++++---------- .../qt4/components/preferences_widgets.cpp | 67 ++++++++-------- 2 files changed, 72 insertions(+), 74 deletions(-) diff --git a/modules/gui/qt4/components/preferences.cpp b/modules/gui/qt4/components/preferences.cpp index 7792bfc8ec..014d6b0afb 100644 --- a/modules/gui/qt4/components/preferences.cpp +++ b/modules/gui/qt4/components/preferences.cpp @@ -77,44 +77,42 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : #undef BI /* Build the tree for the main module */ - int i_index; - module_t *p_module; + module_t *p_module = NULL; 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( int i_index = 0; p_module == NULL; i_index++ ) { + assert (i_index < p_list->i_count); + p_module = (module_t *)p_list->p_values[i_index].p_object; - if( !strcmp( p_module->psz_object_name, "main" ) ) { - found = true; break; - } + if( strcmp( p_module->psz_object_name, "main" ) ) + p_module = NULL; } - assert( found ); - module_config_t *p_item = p_module->p_config; PrefsItemData *data = NULL; QTreeWidgetItem *current_item = NULL; - if( p_item ) do + for (size_t i = 0; i < p_module->confsize; i++) { + module_config_t *p_item = p_module->p_config + i; char *psz_help; QIcon icon; switch( p_item->i_type ) { case CONFIG_CATEGORY: - if( p_item->i_value == -1 ) break; + if( p_item->value.i == -1 ) break; data = new PrefsItemData(); data->name = QString( qfu( config_CategoryNameGet - ( p_item->i_value ) ) ); - psz_help = config_CategoryHelpGet( p_item->i_value ); + ( p_item->value.i ) ) ); + psz_help = config_CategoryHelpGet( p_item->value.i ); if( psz_help ) data->help = QString( qfu(psz_help) ); else data->help.clear(); data->i_type = TYPE_CATEGORY; - data->i_object_id = p_item->i_value; + data->i_object_id = p_item->value.i; - switch( p_item->i_value ) + switch( p_item->value.i ) { #define CI(a,b) case a: icon = b##_icon;break CI( CAT_AUDIO, audio ); @@ -135,22 +133,22 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : addTopLevelItem( current_item ); break; case CONFIG_SUBCATEGORY: - if( p_item->i_value == -1 ) break; + if( p_item->value.i == -1 ) break; if( data && - ( p_item->i_value == SUBCAT_VIDEO_GENERAL || - p_item->i_value == SUBCAT_ADVANCED_MISC || - p_item->i_value == SUBCAT_INPUT_GENERAL || - p_item->i_value == SUBCAT_INTERFACE_GENERAL || - p_item->i_value == SUBCAT_SOUT_GENERAL|| - p_item->i_value == SUBCAT_PLAYLIST_GENERAL|| - p_item->i_value == SUBCAT_AUDIO_GENERAL ) ) + ( p_item->value.i == SUBCAT_VIDEO_GENERAL || + p_item->value.i == SUBCAT_ADVANCED_MISC || + p_item->value.i == SUBCAT_INPUT_GENERAL || + p_item->value.i == SUBCAT_INTERFACE_GENERAL || + p_item->value.i == SUBCAT_SOUT_GENERAL|| + p_item->value.i == SUBCAT_PLAYLIST_GENERAL|| + p_item->value.i == SUBCAT_AUDIO_GENERAL ) ) { // Data still contains the correct thing data->i_type = TYPE_CATSUBCAT; - data->i_subcat_id = p_item->i_value; + data->i_subcat_id = p_item->value.i; data->name = QString( qfu( config_CategoryNameGet( - p_item->i_value )) ); - psz_help = config_CategoryHelpGet( p_item->i_value ); + p_item->value.i )) ); + psz_help = config_CategoryHelpGet( p_item->value.i ); if( psz_help ) data->help = QString( qfu(psz_help) ); else @@ -161,14 +159,14 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : } data = new PrefsItemData(); data->name = QString( qfu( config_CategoryNameGet( - p_item->i_value)) ); - psz_help = config_CategoryHelpGet( p_item->i_value ); + p_item->value.i)) ); + psz_help = config_CategoryHelpGet( p_item->value.i ); if( psz_help ) data->help = QString( qfu(psz_help) ); else data->help.clear(); data->i_type = TYPE_SUBCATEGORY; - data->i_object_id = p_item->i_value; + data->i_object_id = p_item->value.i; assert( current_item ); @@ -182,12 +180,11 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : current_item->addChild( subcat_item ); break; } - } while( p_item->i_type != CONFIG_HINT_END && p_item++ ); + } /* Build the tree of plugins */ for( int i_index = 0; i_index < p_list->i_count; i_index++ ) { - module_config_t *p_item; int i_subcategory = -1, i_category = -1, i_options = 0; p_module = (module_t *)p_list->p_values[i_index].p_object; @@ -198,20 +195,20 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : * are stored in the parent module) */ if( p_module->b_submodule ) continue; - p_item = p_module->p_config; - if( !p_item ) continue; + for (size_t i = 0; i < p_module->confsize; i++) + { + module_config_t *p_item = p_module->p_config + i; - do { if( p_item->i_type == CONFIG_CATEGORY ) - i_category = p_item->i_value; + i_category = p_item->value.i; else if( p_item->i_type == CONFIG_SUBCATEGORY ) - i_subcategory = p_item->i_value; + i_subcategory = p_item->value.i; if( p_item->i_type & CONFIG_ITEM ) i_options++; if( i_options > 0 && i_category >= 0 && i_subcategory >= 0 ) break; - } while( p_item->i_type != CONFIG_HINT_END && p_item++ ); + } if( !i_options ) continue; // Nothing to display @@ -365,9 +362,9 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, { if( p_item->i_type == CONFIG_SUBCATEGORY && ( data->i_type == TYPE_SUBCATEGORY && - p_item->i_value == data->i_object_id ) || + p_item->value.i == data->i_object_id ) || ( data->i_type == TYPE_CATSUBCAT && - p_item->i_value == data->i_subcat_id ) ) + p_item->value.i == data->i_subcat_id ) ) break; if( p_item->i_type == CONFIG_HINT_END ) break; } while( p_item++ ); @@ -415,9 +412,9 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, if( p_item ) do { if( ( ( data->i_type == TYPE_SUBCATEGORY && - p_item->i_value != data->i_object_id ) || + p_item->value.i != data->i_object_id ) || ( data->i_type == TYPE_CATSUBCAT && - p_item->i_value != data->i_subcat_id ) ) && + p_item->value.i != data->i_subcat_id ) ) && ( p_item->i_type == CONFIG_CATEGORY || p_item->i_type == CONFIG_SUBCATEGORY ) ) break; diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index 5c6bb53a6f..295fc84db8 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -92,7 +92,7 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this, if( p_item->i_list ) p_control = new IntegerListConfigControl( p_this, p_item, parent, false, l, line ); - else if( p_item->i_min || p_item->i_max ) + else if( p_item->min.i || p_item->max.i ) p_control = new IntegerRangeConfigControl( p_this, p_item, parent, l, line ); else @@ -112,7 +112,7 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this, p_control = new BoolConfigControl( p_this, p_item, parent, l, line ); break; case CONFIG_ITEM_FLOAT: - if( p_item->f_min || p_item->f_max ) + if( p_item->min.f || p_item->max.f ) p_control = new FloatRangeConfigControl( p_this, p_item, parent, l, line ); else @@ -173,7 +173,7 @@ StringConfigControl::StringConfigControl( vlc_object_t *_p_this, VStringConfigControl( _p_this, _p_item, _parent ) { label = new QLabel( qfu(p_item->psz_text) ); - text = new QLineEdit( qfu(p_item->psz_value) ); + text = new QLineEdit( qfu(p_item->value.psz) ); finish(); if( !l ) @@ -200,7 +200,7 @@ StringConfigControl::StringConfigControl( vlc_object_t *_p_this, void StringConfigControl::finish() { - text->setText( qfu(p_item->psz_value) ); + text->setText( qfu(p_item->value.psz) ); text->setToolTip( qfu(p_item->psz_longtext) ); if( label ) label->setToolTip( qfu(p_item->psz_longtext) ); @@ -246,7 +246,7 @@ void StringListConfigControl::finish( bool bycat ) p_item->ppsz_list_text[i_index] : p_item->ppsz_list[i_index] ), QVariant( p_item->ppsz_list[i_index] ) ); - if( p_item->psz_value && !strcmp( p_item->psz_value, + if( p_item->value.psz && !strcmp( p_item->value.psz, p_item->ppsz_list[i_index] ) ) combo->setCurrentIndex( combo->count() - 1 ); } @@ -308,24 +308,24 @@ void ModuleConfigControl::finish( bool bycat ) { if( !strcmp( p_parser->psz_object_name, "main" ) ) continue; - module_config_t *p_config = p_parser->p_config; - if( p_config ) do + for (size_t i = 0; i < p_parser->confsize; i++) { + module_config_t *p_config = p_parser->p_config + i; /* Hack: required subcategory is stored in i_min */ if( p_config->i_type == CONFIG_SUBCATEGORY && - p_config->i_value == p_item->i_min ) + p_config->value.i == p_item->min.i ) combo->addItem( qfu(p_parser->psz_longname), QVariant( p_parser->psz_object_name ) ); - if( p_item->psz_value && !strcmp( p_item->psz_value, + if( p_item->value.psz && !strcmp( p_item->value.psz, p_parser->psz_object_name) ) combo->setCurrentIndex( combo->count() - 1 ); - } while( p_config->i_type != CONFIG_HINT_END && p_config++ ); + } } else if( !strcmp( p_parser->psz_capability, p_item->psz_type ) ) { combo->addItem( qfu(p_parser->psz_longname), QVariant( p_parser->psz_object_name ) ); - if( p_item->psz_value && !strcmp( p_item->psz_value, + if( p_item->value.psz && !strcmp( p_item->value.psz, p_parser->psz_object_name) ) combo->setCurrentIndex( combo->count() - 1 ); } @@ -405,19 +405,19 @@ void ModuleListConfigControl::finish( bool bycat ) { if( !strcmp( p_parser->psz_object_name, "main" ) ) continue; - module_config_t *p_config = p_parser->p_config; - if( p_config ) do + for (size_t i = 0; i < p_parser->confsize; i++) { + module_config_t *p_config = p_parser->p_config + i; /* Hack: required subcategory is stored in i_min */ if( p_config->i_type == CONFIG_SUBCATEGORY && - p_config->i_value == p_item->i_min ) + p_config->value.i == p_item->min.i ) { QCheckBox *cb = new QCheckBox( qfu( p_parser->psz_object_name ) ); cb->setToolTip( qfu(p_parser->psz_longname) ); modules.push_back( cb ); } - } while( p_config->i_type != CONFIG_HINT_END && p_config++ ); + } } else if( !strcmp( p_parser->psz_capability, p_item->psz_type ) ) { @@ -512,7 +512,7 @@ void IntegerConfigControl::finish() { spin->setMaximum( 2000000000 ); spin->setMinimum( -2000000000 ); - spin->setValue( p_item->i_value ); + spin->setValue( p_item->value.i ); spin->setToolTip( qfu(p_item->psz_longtext) ); if( label ) label->setToolTip( qfu(p_item->psz_longtext) ); @@ -543,8 +543,8 @@ IntegerRangeConfigControl::IntegerRangeConfigControl( vlc_object_t *_p_this, void IntegerRangeConfigControl::finish() { - spin->setMaximum( p_item->i_max ); - spin->setMinimum( p_item->i_min ); + spin->setMaximum( p_item->max.i ); + spin->setMinimum( p_item->min.i ); } /********* Integer / choice list **********/ @@ -585,7 +585,7 @@ void IntegerListConfigControl::finish( bool bycat ) { combo->addItem( qfu(p_item->ppsz_list_text[i_index] ), QVariant( p_item->pi_list[i_index] ) ); - if( p_item->i_value == p_item->pi_list[i_index] ) + if( p_item->value.i == p_item->pi_list[i_index] ) combo->setCurrentIndex( combo->count() - 1 ); } combo->setToolTip( qfu(p_item->psz_longtext) ); @@ -632,7 +632,7 @@ BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this, void BoolConfigControl::finish() { - checkbox->setCheckState( p_item->i_value == VLC_TRUE ? Qt::Checked + checkbox->setCheckState( p_item->value.i == VLC_TRUE ? Qt::Checked : Qt::Unchecked ); checkbox->setToolTip( qfu(p_item->psz_longtext) ); } @@ -687,7 +687,7 @@ void FloatConfigControl::finish() spin->setMaximum( 2000000000. ); spin->setMinimum( -2000000000. ); spin->setSingleStep( 0.1 ); - spin->setValue( (double)p_item->f_value ); + spin->setValue( (double)p_item->value.f ); spin->setToolTip( qfu(p_item->psz_longtext) ); if( label ) label->setToolTip( qfu(p_item->psz_longtext) ); @@ -719,8 +719,8 @@ FloatRangeConfigControl::FloatRangeConfigControl( vlc_object_t *_p_this, void FloatRangeConfigControl::finish() { - spin->setMaximum( (double)p_item->f_max ); - spin->setMinimum( (double)p_item->f_min ); + spin->setMaximum( (double)p_item->max.f ); + spin->setMinimum( (double)p_item->min.f ); } @@ -762,22 +762,23 @@ void KeySelectorControl::finish() module_t *p_main = config_FindModule( p_this, "main" ); assert( p_main ); - module_config_t *p_item = p_main->p_config; - if( p_item ) do + for (size_t i = 0; i < p_main->confsize; i++) { + module_config_t *p_item = p_main->p_config + i; + if( p_item->i_type & CONFIG_ITEM && p_item->psz_name && strstr( p_item->psz_name , "key-" ) ) { QTreeWidgetItem *treeItem = new QTreeWidgetItem(); treeItem->setText( 0, qfu( p_item->psz_text ) ); - treeItem->setText( 1, VLCKeyToString( p_item->i_value ) ); + treeItem->setText( 1, VLCKeyToString( p_item->value.i ) ); treeItem->setData( 0, Qt::UserRole, QVariant::fromValue( (void*)p_item ) ); values += p_item; table->addTopLevelItem( treeItem ); } - } while( p_item->i_type != CONFIG_HINT_END && p_item++ ); + } table->resizeColumnToContents( 0 ); CONNECT( table, itemDoubleClicked( QTreeWidgetItem *, int ), @@ -793,7 +794,7 @@ void KeySelectorControl::selectKey( QTreeWidgetItem *keyItem ) d->exec(); if( d->result() == QDialog::Accepted ) { - p_keyItem->i_value = d->keyValue; + p_keyItem->value.i = d->keyValue; if( d->conflicts ) { for( int i = 0; i < table->topLevelItemCount() ; i++ ) @@ -801,11 +802,11 @@ void KeySelectorControl::selectKey( QTreeWidgetItem *keyItem ) QTreeWidgetItem *it = table->topLevelItem(i); module_config_t *p_item = static_cast (it->data( 0, Qt::UserRole ).value()); - it->setText( 1, VLCKeyToString( p_item->i_value ) ); + it->setText( 1, VLCKeyToString( p_item->value.i ) ); } } else - keyItem->setText( 1, VLCKeyToString( p_keyItem->i_value ) ); + keyItem->setText( 1, VLCKeyToString( p_keyItem->value.i ) ); } delete d; } @@ -814,7 +815,7 @@ void KeySelectorControl::doApply() { foreach( module_config_t *p_current, values ) { - config_PutInt( p_this, p_current->psz_name, p_current->i_value ); + config_PutInt( p_this, p_current->psz_name, p_current->value.i ); } } @@ -855,10 +856,10 @@ void KeyInputDialog::keyPressEvent( QKeyEvent *e ) module_config_t *p_current = NULL; foreach( p_current, values ) { - if( p_current->i_value == i_vlck && strcmp( p_current->psz_text, + if( p_current->value.i == i_vlck && strcmp( p_current->psz_text, keyToChange ) ) { - p_current->i_value = 0; + p_current->value.i = 0; conflicts = true; break; } -- 2.39.2