OSDN Git Service

Fixed Windows XP compatibility. RegSetKeyValue() isn't supported on system prior...
authorlordmulder <mulder2@gmx.de>
Sat, 29 Jan 2011 20:57:53 +0000 (21:57 +0100)
committerlordmulder <mulder2@gmx.de>
Sat, 29 Jan 2011 20:57:53 +0000 (21:57 +0100)
src/Config.h
src/Dialog_About.cpp
src/Dialog_MainWindow.cpp
src/ShellIntegration.cpp

index 03499a4..7c98153 100644 (file)
@@ -25,7 +25,7 @@
 #define VER_LAMEXP_MAJOR                               4
 #define VER_LAMEXP_MINOR_HI                            0
 #define VER_LAMEXP_MINOR_LO                            0
-#define VER_LAMEXP_BUILD                               276
+#define VER_LAMEXP_BUILD                               277
 #define VER_LAMEXP_SUFFIX                              Beta-2
 
 /*
index 71b15d0..b86908f 100644 (file)
@@ -157,7 +157,14 @@ int AboutDialog::exec()
 {
        if(m_settings->soundsEnabled())
        {
-               if(!m_firstShow || !playResoureSound("imageres.dll", 5080, true))
+               if(m_firstShow)
+               {
+                       if(!playResoureSound("imageres.dll", 5080, true))
+                       {
+                               PlaySound(TEXT("SystemStart"), NULL, SND_ALIAS | SND_ASYNC);
+                       }
+               }
+               else
                {
                        PlaySound(MAKEINTRESOURCE(IDR_WAVE_ABOUT), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC);
                }
index 32cd2ef..58eaa5f 100644 (file)
@@ -295,7 +295,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
        actionDisableNeroAacNotifications->setChecked(!m_settings->neroAacNotificationsEnabled());
        actionDisableWmaDecoderNotifications->setChecked(!m_settings->wmaDecoderNotificationsEnabled());
        actionDisableShellIntegration->setChecked(!m_settings->shellIntegrationEnabled());
-       actionDisableShellIntegration->setVisible(!lamexp_portable_mode());
+       actionDisableShellIntegration->setDisabled(lamexp_portable_mode() && actionDisableShellIntegration->isChecked());
        connect(actionDisableUpdateReminder, SIGNAL(triggered(bool)), this, SLOT(disableUpdateReminderActionTriggered(bool)));
        connect(actionDisableSounds, SIGNAL(triggered(bool)), this, SLOT(disableSoundsActionTriggered(bool)));
        connect(actionInstallWMADecoder, SIGNAL(triggered(bool)), this, SLOT(installWMADecoderActionTriggered(bool)));
@@ -2164,4 +2164,9 @@ void MainWindow::disableShellIntegrationActionTriggered(bool checked)
        }
 
        actionDisableShellIntegration->setChecked(!m_settings->shellIntegrationEnabled());
+       
+       if(lamexp_portable_mode() && actionDisableShellIntegration->isChecked())
+       {
+               actionDisableShellIntegration->setEnabled(false);
+       }
 }
index 30cfabe..e02583e 100644 (file)
@@ -44,7 +44,7 @@ static const char *g_lamexpFileType = "LameXP.SupportedAudioFile";
 QMutex ShellIntegration::m_mutex;
 
 //Macros
-#define REG_WRITE_STRING(KEY, STR) RegSetKeyValue(key, NULL, NULL, REG_SZ, QWCHAR(STR), (STR.size() + 1) * sizeof(wchar_t))
+#define REG_WRITE_STRING(KEY, STR) RegSetValueEx(key, NULL, NULL, REG_SZ, reinterpret_cast<const BYTE*>(STR.utf16()), (STR.size() + 1) * sizeof(wchar_t))
 
 ////////////////////////////////////////////////////////////
 // Constructor
@@ -247,7 +247,7 @@ QStringList *ShellIntegration::detectTypes(const QString &lamexpFileType, const
                {
                        if(RegCreateKeyEx(HKEY_CURRENT_USER, QWCHAR(QString("Software\\Classes\\%1").arg(currentExt)), NULL, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
                        {
-                               RegSetKeyValue(key, NULL, NULL, REG_SZ, QWCHAR(lamexpFileType), (lamexpFileType.size() + 1) * sizeof(wchar_t));
+                               REG_WRITE_STRING(key, lamexpFileType);
                                RegCloseKey(key);
                        }
                }