]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/simple_preferences.cpp
Qt: Reusing the titles from the simple preferences submenu as tooltip for the simple...
[vlc] / modules / gui / qt4 / components / simple_preferences.cpp
index b957b730af3698df669ef9f9be8d7b1fa854672a..874ade55facdea3f64a42acadcb0e8452fba933d 100644 (file)
 
 #include "components/simple_preferences.hpp"
 #include "components/preferences_widgets.hpp"
+#include "dialogs/ml_configuration.hpp"
 
 #include <vlc_config_cat.h>
 #include <vlc_configuration.h>
+#include <vlc_aout_intf.h>
 
 #include <QString>
 #include <QFont>
@@ -67,11 +69,11 @@ SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent, bool sma
 
     short icon_height = small ? ICON_HEIGHT /2 : ICON_HEIGHT;
 
-#define ADD_CATEGORY( button, label, icon, numb )                           \
+#define ADD_CATEGORY( button, label, ltooltip, icon, numb )                 \
     QToolButton * button = new QToolButton( this );                         \
     button->setIcon( QIcon( ":/prefsmenu/" #icon ) );                       \
     button->setText( label );                                               \
-    button->setToolTip( label + qtr("Preferences") );                       \
+    button->setToolTip( ltooltip );                                         \
     button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );              \
     button->setIconSize( QSize( icon_height, icon_height ) );               \
     button->resize( icon_height + 6 , icon_height + 6 );                    \
@@ -81,17 +83,17 @@ SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent, bool sma
     buttonGroup->addButton( button, numb );                                 \
     layout->addWidget( button );
 
-    ADD_CATEGORY( SPrefsInterface, qtr("Interface"),
+    ADD_CATEGORY( SPrefsInterface, qtr("Interface"), qtr("Interface Settings"),
                   cone_interface_64, 0 );
-    ADD_CATEGORY( SPrefsAudio, qtr("Audio"),
+    ADD_CATEGORY( SPrefsAudio, qtr("Audio"), qtr("Audio Settings"),
                   cone_audio_64, 1 );
-    ADD_CATEGORY( SPrefsVideo, qtr("Video"),
+    ADD_CATEGORY( SPrefsVideo, qtr("Video"), qtr("Video Settings"),
                   cone_video_64, 2 );
-    ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles && OSD"),
+    ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles && OSD"), qtr("Subtitles & On Screen Display Settings"),
                   cone_subtitles_64, 3 );
-    ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input && Codecs"),
+    ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input && Codecs"), qtr("Input & Codecs Settings"),
                   cone_input_64, 4 );
-    ADD_CATEGORY( SPrefsHotkeys, qtr("Hotkeys"),
+    ADD_CATEGORY( SPrefsHotkeys, qtr("Hotkeys"), qtr("Configure Hotkeys"),
                   cone_hotkeys_64, 5 );
 
 #undef ADD_CATEGORY
@@ -138,7 +140,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             if( p_config )                                                \
             {                                                             \
                 control =  new BoolConfigControl( VLC_OBJECT(p_intf),     \
-                           p_config, NULL, ui.qcontrol, false );          \
+                           p_config, NULL, ui.qcontrol );          \
                 controls.append( control );                               \
             }                                                             \
             else { ui.qcontrol->setEnabled( false ); }
@@ -220,16 +222,24 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             CONFIG_BOOL( "video-deco", windowDecorations );
             CONFIG_GENERIC( "vout", Module, ui.voutLabel, outputModule );
 
-            CONFIG_BOOL( "video-wallpaper", wallpaperMode );
 #ifdef WIN32
             CONFIG_GENERIC( "directx-device", StringList, ui.dxDeviceLabel,
                             dXdisplayDevice );
             CONFIG_BOOL( "directx-hw-yuv", hwYUVBox );
+            CONNECT( ui.overlay, toggled( bool ), ui.hwYUVBox, setEnabled( bool ) );
 #else
             ui.directXBox->setVisible( false );
             ui.hwYUVBox->setVisible( false );
 #endif
 
+#ifdef __OS2__
+            CONFIG_BOOL( "kva-fixt23", kvaFixT23 );
+            CONFIG_GENERIC( "kva-video-mode", StringList, ui.kvaVideoModeLabel,
+                            kvaVideoMode );
+#else
+            ui.kvaBox->setVisible( false );
+#endif
+
             CONFIG_GENERIC( "deinterlace", IntegerList, ui.deinterLabel, deinterlaceBox );
             CONFIG_GENERIC( "deinterlace-mode", StringList, ui.deinterModeLabel, deinterlaceModeBox );
             CONFIG_GENERIC( "aspect-ratio", String, ui.arLabel, arLine );
@@ -286,6 +296,11 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             optionWidgets.append( DirectXControl );
             CONFIG_GENERIC_NO_UI( "directx-audio-device-name", StringList,
                     DirectXLabel, DirectXDevice );
+#elif defined( __OS2__ )
+            audioControl( kai );
+            optionWidgets.append( kaiControl );
+            CONFIG_GENERIC_NO_UI( "kai-audio-device", StringList, kaiLabel,
+                    kaiDevice );
 #else
             if( module_exists( "alsa" ) )
             {
@@ -312,8 +327,8 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 #undef audioCommon
 
             /* Audio Options */
-            ui.volumeValue->setMaximum( QT_VOLUME_MAX / QT_VOLUME_DEFAULT * 100 );
-            CONFIG_GENERIC_NO_BOOL( "qt-startvolume" , IntegerRangeSlider, NULL,
+            ui.volumeValue->setMaximum( (AOUT_VOLUME_DEFAULT * 2) / AOUT_VOLUME_DEFAULT * 100 );
+            CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL,
                                      defaultVolume );
             CONNECT( ui.defaultVolume, valueChanged( int ),
                      this, updateAudioVolume( int ) );
@@ -392,7 +407,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             qs_filter = qfu( psz ).split( ':', QString::SkipEmptyParts );
             free( psz );
 
-            bool b_enabled = ( qs_filter.contains( "volnorm" ) );
+            bool b_enabled = ( qs_filter.contains( "normvol" ) );
             ui.volNormBox->setChecked( b_enabled );
             ui.volNormSpin->setEnabled( b_enabled );
 
@@ -473,6 +488,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             CONFIG_GENERIC( "sout-x264-preset", StringList, ui.x264Label, presetBox );
             CONFIG_GENERIC( "sout-x264-profile", StringList, ui.x264profileLabel, profileBox );
             CONFIG_GENERIC( "sout-x264-level", String, ui.x264profileLabel, levelBox );
+            CONFIG_BOOL( "mkv-preload-local-dir", mkvPreloadBox );
 
             /* Caching */
             /* Add the things to the ComboBox */
@@ -486,46 +502,19 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             addToCachingBox( N_("Higher latency"), CachingHigher );
             #undef addToCachingBox
 
-#define TestCaC( name ) \
+#define TestCaC( name, factor ) \
     b_cache_equal =  b_cache_equal && \
-     ( i_cache == config_GetInt( p_intf, name ) )
-
-#define TestCaCi( name, int ) \
-    b_cache_equal = b_cache_equal &&  \
-    ( ( i_cache * int ) == config_GetInt( p_intf, name ) )
+     ( i_cache * factor == config_GetInt( p_intf, name ) );
             /* Select the accurate value of the ComboBox */
             bool b_cache_equal = true;
-            int i_cache = config_GetInt( p_intf, "file-caching");
-
-            TestCaC( "udp-caching" );
-            if (module_exists ("dvdread"))
-                TestCaC( "dvdread-caching" );
-            if (module_exists ("dvdnav"))
-                TestCaC( "dvdnav-caching" );
-            TestCaC( "tcp-caching" );
-            TestCaC( "cdda-caching" );
-            TestCaC( "screen-caching" ); TestCaC( "vcd-caching" );
-            #ifdef WIN32
-            TestCaC( "dshow-caching" );
-            #else
-            if (module_exists ("access_jack"))
-                TestCaC( "jack-input-caching" );
-            if (module_exists ("v4l2"))
-                TestCaC( "v4l2-caching" );
-            if (module_exists ("pvr"))
-                TestCaC( "pvr-caching" );
-            #endif
-            if (module_exists ("livedotcom"))
-                TestCaCi( "rtsp-caching", 4 );
-            TestCaCi( "ftp-caching", 2 );
-            TestCaCi( "http-caching", 2 );
-            if (module_exists ("access_realrtsp"))
-                TestCaCi( "realrtsp-caching", 10 );
-            TestCaCi( "mms-caching", 10 );
+            int i_cache = config_GetInt( p_intf, "file-caching" );
+
+            TestCaC( "network-caching", 10/3 );
+            TestCaC( "disc-caching", 1);
+            TestCaC( "live-caching", 1 );
             if( b_cache_equal == 1 )
                 ui.cachingCombo->setCurrentIndex(
                 ui.cachingCombo->findData( QVariant( i_cache ) ) );
-#undef TestCaCi
 #undef TestCaC
 
         END_SPREFS_CAT;
@@ -548,6 +537,10 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             ui.assoButton->hide();
             ui.assocLabel->hide();
 #endif
+#ifdef MEDIA_LIBRARY
+            BUTTONACT( ui.sqlMLbtn, configML() );
+#endif
+
             /* interface */
             char *psz_intf = config_GetPsz( p_intf, "intf" );
             if( psz_intf )
@@ -562,17 +555,20 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 
             optionWidgets.append( ui.skins );
             optionWidgets.append( ui.qt4 );
-#if !defined(NDEBUG) || !defined( WIN32)
+#if !defined( WIN32)
             ui.stylesCombo->addItem( qtr("System's default") );
             ui.stylesCombo->addItems( QStyleFactory::keys() );
             ui.stylesCombo->setCurrentIndex( ui.stylesCombo->findText(
                         getSettings()->value( "MainWindow/QtStyle", "" ).toString() ) );
             ui.stylesCombo->insertSeparator( 1 );
+            if ( ui.stylesCombo->currentIndex() < 0 )
+                ui.stylesCombo->setCurrentIndex( 0 ); /* default */
 
             CONNECT( ui.stylesCombo, currentIndexChanged( QString ), this, changeStyle( QString ) );
             optionWidgets.append( ui.stylesCombo );
 #else
             ui.stylesCombo->hide();
+            ui.stylesLabel->hide();
             optionWidgets.append( NULL );
 #endif
             radioGroup = new QButtonGroup(this);
@@ -651,15 +647,25 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
                             encoding );
             CONFIG_GENERIC( "sub-language", String, ui.subLangLabel,
                             preferredLanguage );
-            CONFIG_GENERIC_NO_BOOL( "freetype-font", Font, ui.fontLabel, font );
-            CONFIG_GENERIC( "freetype-color", IntegerList, ui.fontColorLabel,
-                            fontColor );
+
             CONFIG_GENERIC( "freetype-rel-fontsize", IntegerList,
                             ui.fontSizeLabel, fontSize );
-            CONFIG_GENERIC( "freetype-effect", IntegerList, ui.fontEffectLabel,
-                            effect );
+
+            CONFIG_GENERIC_NO_BOOL( "freetype-font", Font, ui.fontLabel, font );
+            CONFIG_GENERIC_NO_BOOL( "freetype-color", Color, ui.fontColorLabel,
+                            fontColor );
+            CONFIG_GENERIC( "freetype-outline-thickness", IntegerList,
+                            ui.fontEffectLabel, effect );
+            CONFIG_GENERIC_NO_BOOL( "freetype-outline-color", Color, ui.outlineColorLabel,
+                            outlineColor );
+
             CONFIG_GENERIC_NO_BOOL( "sub-margin", Integer, ui.subsPosLabel, subsPosition );
 
+            ui.shadowCheck->setChecked( config_GetInt( p_intf, "freetype-shadow-opacity" ) > 0 );
+            ui.backgroundCheck->setChecked( config_GetInt( p_intf, "freetype-background-opacity" ) > 0 );
+            optionWidgets.append( ui.shadowCheck );
+            optionWidgets.append( ui.backgroundCheck );
+
         END_SPREFS_CAT;
 
         case SPrefsHotkeys:
@@ -735,6 +741,8 @@ void SPrefsPanel::updateAudioOptions( int number)
                                             ->itemData( number ).toString();
 #ifdef WIN32
     optionWidgets[directxW]->setVisible( ( value == "aout_directx" ) );
+#elif defined( __OS2__ )
+    optionWidgets[kaiW]->setVisible( ( value == "kai" ) );
 #else
     /* optionWidgets[ossW] can be NULL */
     if( optionWidgets[ossW] )
@@ -757,7 +765,7 @@ SPrefsPanel::~SPrefsPanel()
 void SPrefsPanel::updateAudioVolume( int volume )
 {
     qobject_cast<QSpinBox *>(optionWidgets[volLW])
-        ->setValue( volume * 100 / QT_VOLUME_DEFAULT );
+        ->setValue( volume * 100 / AOUT_VOLUME_DEFAULT );
 }
 
 
@@ -765,7 +773,7 @@ void SPrefsPanel::updateAudioVolume( int volume )
 void SPrefsPanel::apply()
 {
     /* Generic save for ever panel */
-    QList<ConfigControl *>::Iterator i;
+    QList<ConfigControl *>::const_iterator i;
     for( i = controls.begin() ; i != controls.end() ; ++i )
     {
         ConfigControl *c = qobject_cast<ConfigControl *>(*i);
@@ -777,51 +785,28 @@ void SPrefsPanel::apply()
     case SPrefsInputAndCodecs:
     {
         /* Device default selection */
-        char *psz_devicepath =
-            strdup( qtu( qobject_cast<QComboBox *>(optionWidgets[inputLE])->currentText() ) );
-        if( !EMPTY_STR( psz_devicepath ) )
+        QByteArray devicepath =
+            qobject_cast<QComboBox *>(optionWidgets[inputLE])->currentText().toUtf8();
+        if( devicepath.size() > 0 )
         {
-            config_PutPsz( p_intf, "dvd", psz_devicepath );
-            config_PutPsz( p_intf, "vcd", psz_devicepath );
-            config_PutPsz( p_intf, "cd-audio", psz_devicepath );
-            free( psz_devicepath );
+            config_PutPsz( p_intf, "dvd", devicepath );
+            config_PutPsz( p_intf, "vcd", devicepath );
+            config_PutPsz( p_intf, "cd-audio", devicepath );
         }
 
-#define CaCi( name, int ) config_PutInt( p_intf, name, int * i_comboValue )
-#define CaC( name ) CaCi( name, 1 )
+#define CaC( name, factor ) config_PutInt( p_intf, name, i_comboValue * factor )
         /* Caching */
         QComboBox *cachingCombo = qobject_cast<QComboBox *>(optionWidgets[cachingCoB]);
         int i_comboValue = cachingCombo->itemData( cachingCombo->currentIndex() ).toInt();
         if( i_comboValue )
         {
-            CaC( "udp-caching" );
-            if (module_exists ("dvdread" ))
-                CaC( "dvdread-caching" );
-            if (module_exists ("dvdnav" ))
-                CaC( "dvdnav-caching" );
-            CaC( "tcp-caching" ); CaC( "vcd-caching" );
-            CaC( "cdda-caching" ); CaC( "file-caching" );
-            CaC( "screen-caching" ); CaC( "bd-caching" );
-            CaCi( "rtsp-caching", 2 ); CaCi( "ftp-caching", 2 );
-            CaCi( "http-caching", 2 );
-            if (module_exists ("access_realrtsp" ))
-                CaCi( "realrtsp-caching", 10 );
-            CaCi( "mms-caching", 10 );
-            #ifdef WIN32
-            CaC( "dshow-caching" );
-            #else
-            if (module_exists ( "access_jack" ))
-            CaC( "jack-input-caching" );
-            if (module_exists ( "v4l2" ))
-                CaC( "v4l2-caching" );
-            if (module_exists ( "pvr" ))
-                CaC( "pvr-caching" );
-            #endif
-            //CaCi( "dv-caching" ) too short...
+            CaC( "file-caching", 1 );
+            CaC( "network-caching", 10/3 );
+            CaC( "disc-caching", 1 );
+            CaC( "live-caching", 1 );
         }
         break;
 #undef CaC
-#undef CaCi
     }
 
     /* Interfaces */
@@ -843,10 +828,10 @@ void SPrefsPanel::apply()
     {
         bool b_checked =
             qobject_cast<QCheckBox *>(optionWidgets[normalizerChB])->isChecked();
-        if( b_checked && !qs_filter.contains( "volnorm" ) )
-            qs_filter.append( "volnorm" );
-        if( !b_checked && qs_filter.contains( "volnorm" ) )
-            qs_filter.removeAll( "volnorm" );
+        if( b_checked && !qs_filter.contains( "normvol" ) )
+            qs_filter.append( "normvol" );
+        if( !b_checked && qs_filter.contains( "normvol" ) )
+            qs_filter.removeAll( "normvol" );
 
         b_checked =
             qobject_cast<QCheckBox *>(optionWidgets[headphoneB])->isChecked();
@@ -859,6 +844,25 @@ void SPrefsPanel::apply()
         config_PutPsz( p_intf, "audio-filter", qtu( qs_filter.join( ":" ) ) );
         break;
     }
+    case SPrefsSubtitles:
+    {
+        bool b_checked = qobject_cast<QCheckBox *>(optionWidgets[shadowCB])->isChecked();
+        if( b_checked && config_GetInt( p_intf, "freetype-shadow-opacity" ) == 0 ) {
+            config_PutInt( p_intf, "freetype-shadow-opacity", 128 );
+        }
+        else if (!b_checked ) {
+            config_PutInt( p_intf, "freetype-shadow-opacity", 0 );
+        }
+
+        b_checked = qobject_cast<QCheckBox *>(optionWidgets[backgroundCB])->isChecked();
+        if( b_checked && config_GetInt( p_intf, "freetype-background-opacity" ) == 0 ) {
+            config_PutInt( p_intf, "freetype-background-opacity", 128 );
+        }
+        else if (!b_checked ) {
+            config_PutInt( p_intf, "freetype-background-opacity", 0 );
+        }
+
+    }
     }
 }
 
@@ -886,10 +890,18 @@ void SPrefsPanel::changeStyle( QString s_style )
     };
 }
 
+void SPrefsPanel::configML()
+{
+#ifdef MEDIA_LIBRARY
+    MLConfDialog *mld = new MLConfDialog( this, p_intf );
+    mld->exec();
+    delete mld;
+#endif
+}
+
 #ifdef WIN32
 #include <QDialogButtonBox>
 #include "util/registry.hpp"
-#include <string>
 
 bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current,
                            QTreeWidgetItem* parent, QVLCRegistry *qvReg )
@@ -898,7 +910,7 @@ bool SPrefsPanel::addType( const char * psz_ext, QTreeWidgetItem* current,
     const char* psz_VLC = "VLC";
     current = new QTreeWidgetItem( parent, QStringList( psz_ext ) );
 
-    if( strstr( qvReg->ReadRegistryString( psz_ext, "", ""  ), psz_VLC ) )
+    if( strstr( qvReg->ReadRegistryString( psz_ext, "", "" ), psz_VLC ) )
     {
         current->setCheckState( 0, Qt::Checked );
         b_temp = false;
@@ -919,7 +931,7 @@ void SPrefsPanel::assoDialog()
 
     if( S_OK == CoCreateInstance( &clsid_IApplication2,
                 NULL, CLSCTX_INPROC_SERVER,
-                &IID_IApplicationAssociationRegistrationUI,
+                IID_IApplicationAssociationRegistrationUI,
                 (void **)&p_appassoc) )
     {
         if(S_OK == p_appassoc->vt->LaunchAdvancedAssociationUI(p_appassoc, L"VLC" ) )
@@ -932,6 +944,7 @@ void SPrefsPanel::assoDialog()
     CoUninitialize();
 
     QDialog *d = new QDialog( this );
+    d->setWindowTitle( qtr( "File associations" ) );
     QGridLayout *assoLayout = new QGridLayout( d );
 
     QTreeWidget *filetypeList = new QTreeWidget;
@@ -952,7 +965,7 @@ void SPrefsPanel::assoDialog()
     videoType->setExpanded( true ); videoType->setCheckState( 0, Qt::Unchecked );
     otherType->setExpanded( true ); otherType->setCheckState( 0, Qt::Unchecked );
 
-    QTreeWidgetItem *currentItem;
+    QTreeWidgetItem *currentItem = NULL;
 
     int i_temp = 0;
 #define aTa( name ) i_temp += addType( name, currentItem, audioType, qvReg )
@@ -973,7 +986,7 @@ void SPrefsPanel::assoDialog()
     aTv( ".gxf" ); aTv( ".m1v" ); aTv( ".m2v" ); aTv( ".m2ts" ); aTv( ".m4v" );
     aTv( ".mkv" ); aTv( ".mov" ); aTv( ".mp2" ); aTv( ".mp4" ); aTv( ".mpeg" );
     aTv( ".mpeg1" ); aTv( ".mpeg2" ); aTv( ".mpeg4" ); aTv( ".mpg" );
-    aTv( ".mts" ); aTv( ".mxf" );
+    aTv( ".mts" ); aTv( ".mtv" ); aTv( ".mxf" );
     aTv( ".ogg" ); aTv( ".ogm" ); aTv( ".ogx" ); aTv( ".ogv" );  aTv( ".ts" );
     aTv( ".vob" ); aTv( ".vro" ); aTv( ".wmv" );
     videoType->setCheckState( 0, ( i_temp > 0 ) ?
@@ -1012,8 +1025,8 @@ void SPrefsPanel::assoDialog()
 
 void addAsso( QVLCRegistry *qvReg, const char *psz_ext )
 {
-    std::string s_path( "VLC" ); s_path += psz_ext;
-    std::string s_path2 = s_path;
+    QString s_path( "VLC" ); s_path += psz_ext;
+    QString s_path2 = s_path;
 
     /* Save a backup if already assigned */
     char *psz_value = qvReg->ReadRegistryString( psz_ext, "", ""  );
@@ -1023,27 +1036,26 @@ void addAsso( QVLCRegistry *qvReg, const char *psz_ext )
     delete psz_value;
 
     /* Put a "link" to VLC.EXT as default */
-    qvReg->WriteRegistryString( psz_ext, "", s_path.c_str() );
+    qvReg->WriteRegistryString( psz_ext, "", qtu( s_path ) );
 
     /* Create the needed Key if they weren't done in the installer */
-    if( !qvReg->RegistryKeyExists( s_path.c_str() ) )
+    if( !qvReg->RegistryKeyExists( qtu( s_path ) ) )
     {
-        qvReg->WriteRegistryString( psz_ext, "", s_path.c_str() );
-        qvReg->WriteRegistryString( s_path.c_str(), "", "Media file" );
-        qvReg->WriteRegistryString( s_path.append( "\\shell" ).c_str() , "", "Play" );
+        qvReg->WriteRegistryString( psz_ext, "", qtu( s_path ) );
+        qvReg->WriteRegistryString( qtu( s_path ), "", "Media file" );
+        qvReg->WriteRegistryString( qtu( s_path.append( "\\shell" ) ), "", "Play" );
 
         /* Get the installer path */
         QVLCRegistry *qvReg2 = new QVLCRegistry( HKEY_LOCAL_MACHINE );
-        std::string str_temp; str_temp.assign(
-            qvReg2->ReadRegistryString( "Software\\VideoLAN\\VLC", "", "" ) );
+        QString str_temp = qvReg2->ReadRegistryString( "Software\\VideoLAN\\VLC", "", "" );
 
         if( str_temp.size() )
         {
-            qvReg->WriteRegistryString( s_path.append( "\\Play\\command" ).c_str(),
-                "", str_temp.append(" --started-from-file \"%1\"" ).c_str() );
+            qvReg->WriteRegistryString( qtu( s_path.append( "\\Play\\command" ) ),
+                "", qtu( str_temp.append(" --started-from-file \"%1\"" ) ) );
 
-            qvReg->WriteRegistryString( s_path2.append( "\\DefaultIcon" ).c_str(),
-                        "", str_temp.append(",0").c_str() );
+            qvReg->WriteRegistryString( qtu( s_path2.append( "\\DefaultIcon" ) ),
+                        "", qtu( str_temp.append(",0") ) );
         }
         delete qvReg2;
     }
@@ -1052,7 +1064,7 @@ void addAsso( QVLCRegistry *qvReg, const char *psz_ext )
 void delAsso( QVLCRegistry *qvReg, const char *psz_ext )
 {
     char psz_VLC[] = "VLC";
-    char *psz_value = qvReg->ReadRegistryString( psz_ext, "", ""  );
+    char *psz_value = qvReg->ReadRegistryString( psz_ext, "", "" );
 
     if( psz_value && !strcmp( strcat( psz_VLC, psz_ext ), psz_value ) )
     {
@@ -1067,7 +1079,7 @@ void delAsso( QVLCRegistry *qvReg, const char *psz_ext )
 }
 void SPrefsPanel::saveAsso()
 {
-    QVLCRegistry * qvReg;
+    QVLCRegistry * qvReg = NULL;
     for( int i = 0; i < listAsso.size(); i ++ )
     {
         qvReg  = new QVLCRegistry( HKEY_CLASSES_ROOT );