]> git.sesse.net Git - vlc/commitdiff
Qt4 - Basic implementation of the extensions. Seem to work :D Just .avi now, because...
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 24 Jan 2008 08:28:07 +0000 (08:28 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 24 Jan 2008 08:28:07 +0000 (08:28 +0000)
Ref #763

modules/gui/qt4/components/simple_preferences.cpp
modules/gui/qt4/components/simple_preferences.hpp

index 68d88012f094602a3a67ee7e4ba905639e14a45b..7e7f48b4cce1748d78efafa1a2574abb7bc5cf44 100644 (file)
@@ -667,26 +667,41 @@ void SPrefsPanel::assoDialog()
     delete d;
 }
 
-void addAsso( char *psz_ext )
+void addAsso( QVLCRegistry *qvReg, char *psz_ext )
 {
+    char psz_VLC[] = "VLC";
 
+    char *psz_value = qvReg->ReadRegistryString( psz_ext, "", ""  );
+    if( strlen( psz_value ) > 0 )
+        qvReg->WriteRegistryString( psz_ext, "VLC.backup", psz_value );
+
+    qvReg->WriteRegistryString( psz_ext, "", strcat( psz_VLC, psz_ext ) );
 }
 
-void delAsso( char *psz_ext )
+void delAsso( QVLCRegistry *qvReg, char *psz_ext )
 {
+    char psz_VLC[] = "VLC";
+    char *psz_value = qvReg->ReadRegistryString( psz_ext, "", ""  );
 
+    if( !strcmp( strcat( psz_VLC, psz_ext ), psz_value ) )
+    {
+        qvReg->WriteRegistryString( psz_ext, "",
+            qvReg->ReadRegistryString( psz_ext, "VLC.backup", "" ) );
+        // qvReg->DeletKey( psz_ext, "VLC.backup" );
+    }
 }
 void SPrefsPanel::saveAsso()
 {
     for( int i = 0; i < listAsso.size(); i ++ )
     {
+        QVLCRegistry * qvReg = new QVLCRegistry( HKEY_CLASSES_ROOT );
         if( listAsso[i]->checkState() > 0 )
         {
-            addAsso( qtu( listAsso[i]->text() ) );
+            addAsso( qvReg, qtu( listAsso[i]->text() ) );
         }
         else
         {
-            delAsso( qtu( listAsso[i]->text() ) );
+            delAsso( qvReg, qtu( listAsso[i]->text() ) );
         }
     }
     /* Gruik ? Naaah */
index 644c7932b8322a4f77fb754ecb8a82bb10a3c6df..47ab94154fc30db6d5db286f76ecb1abdaab1260 100644 (file)
@@ -37,6 +37,9 @@
 #include "ui/sprefs_video.h"
 #include "ui/sprefs_subtitles.h"
 #include "ui/sprefs_interface.h"
+#ifdef WIN32
+#include "util/registry.hpp"
+#endif
 
 enum {
     SPrefsInterface = 0,