From 5796854fe9b646311db5db6800d4866dec56dfaa Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Thu, 24 Jan 2008 08:28:07 +0000 Subject: [PATCH] Qt4 - Basic implementation of the extensions. Seem to work :D Just .avi now, because we have no good list of extensions in the source code... :D Ref #763 --- .../gui/qt4/components/simple_preferences.cpp | 23 +++++++++++++++---- .../gui/qt4/components/simple_preferences.hpp | 3 +++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp index 68d88012f0..7e7f48b4cc 100644 --- a/modules/gui/qt4/components/simple_preferences.cpp +++ b/modules/gui/qt4/components/simple_preferences.cpp @@ -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 */ diff --git a/modules/gui/qt4/components/simple_preferences.hpp b/modules/gui/qt4/components/simple_preferences.hpp index 644c7932b8..47ab94154f 100644 --- a/modules/gui/qt4/components/simple_preferences.hpp +++ b/modules/gui/qt4/components/simple_preferences.hpp @@ -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, -- 2.39.2