[vlc-commits] setfillVLCConfigCombo: deal with string config items

Rémi Denis-Courmont git at videolan.org
Sat Sep 3 12:46:47 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Sep  3 13:46:11 2011 +0300| [5df99e7abfe5216939c0c47354641d15fe212baa] | committer: Rémi Denis-Courmont

setfillVLCConfigCombo: deal with string config items

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5df99e7abfe5216939c0c47354641d15fe212baa
---

 modules/gui/qt4/components/preferences_widgets.cpp |   23 ++++++++++++++-----
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp
index 884ed30..65d5cf3 100644
--- a/modules/gui/qt4/components/preferences_widgets.cpp
+++ b/modules/gui/qt4/components/preferences_widgets.cpp
@@ -529,12 +529,20 @@ QString StringListConfigControl::getValue() const
 }
 
 void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
-                        QComboBox *combo )
+                            QComboBox *combo )
 {
     module_config_t *p_config =
                       config_FindConfig( VLC_OBJECT(p_intf), configname );
     if( p_config )
     {
+       QVariant def;
+       bool string = (p_config->i_type & 0xF0) == CONFIG_ITEM_STRING;
+
+       if( string )
+           def = QVariant( qfu(p_config->value.psz) );
+       else
+           def = QVariant( p_config->value.i );
+
        if(p_config->pf_update_list)
         {
             vlc_value_t val;
@@ -548,12 +556,15 @@ void setfillVLCConfigCombo( const char *configname, intf_thread_t *p_intf,
 
         for ( int i_index = 0; i_index < p_config->i_list; i_index++ )
         {
-            combo->addItem( qtr(p_config->ppsz_list_text[i_index]),
-                    QVariant( p_config->pi_list[i_index] ) );
-            if( p_config->value.i == p_config->pi_list[i_index] )
-            {
+            QVariant value;
+
+            if( string )
+                value = QVariant( qfu(p_config->ppsz_list[i_index]) );
+            else
+                value =QVariant( p_config->pi_list[i_index] );
+            combo->addItem( qtr(p_config->ppsz_list_text[i_index]), value );
+            if( def == value )
                 combo->setCurrentIndex( i_index );
-            }
         }
 
         if( p_config->psz_longtext )



More information about the vlc-commits mailing list