/*
* Download and install WMA Decoder component
*/
-void MainWindow::installWMADecoder(void)
+bool MainWindow::installWMADecoder(void)
{
static const char *download_url = "http://www.nch.com.au/components/wmawav.exe";
static const char *download_hash = "52a3b0e6690faf3f830c336d3c0eadfb7a4e9bc6";
+ bool bResult = false;
+
QString binaryWGet = lamexp_lookup_tool("wget.exe");
QString binaryElevator = lamexp_lookup_tool("elevator.exe");
{
continue;
}
- return;
+ break;
}
QFile setupFileContent(setupFile);
{
continue;
}
- return;
+ break;
}
QApplication::setOverrideCursor(Qt::WaitCursor);
if(QMessageBox::information(this, tr("WMA Decoder"), tr("The WMA File Decoder has been installed. Please restart LameXP now!"), tr("Quit LameXP"), tr("Postpone")) == 0)
{
- QApplication::quit();
+ bResult = true;
}
break;
}
+
+ return bResult;
+}
+
+/*
+ * Check for updates
+ */
+bool MainWindow::checkForUpdates(void)
+{
+ bool bReadyToInstall = false;
+
+ UpdateDialog *updateDialog = new UpdateDialog(m_settings, this);
+ updateDialog->exec();
+
+ if(updateDialog->getSuccess())
+ {
+ m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate));
+ bReadyToInstall = updateDialog->updateReadyToInstall();
+ }
+
+ LAMEXP_DELETE(updateDialog);
+ return bReadyToInstall;
}
////////////////////////////////////////////////////////////
PlaySound(MAKEINTRESOURCE(IDR_WAVE_WHAMMY), GetModuleHandle(NULL), SND_RESOURCE | SND_SYNC);
if(QMessageBox::warning(this, tr("LameXP - Expired"), QString("<nobr>%1<br>%2</nobr>").arg(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(lamexp_version_expires().toString(Qt::ISODate)), tr("LameXP is free software and release versions won't expire.")), tr("Check for Updates"), tr("Exit Program")) == 0)
{
- checkUpdatesActionActivated();
+ checkForUpdates();
}
QApplication::quit();
return;
qWarning("Binary is more than a year old, time to update!");
if(QMessageBox::warning(this, tr("Urgent Update"), QString("<nobr>%1</nobr>").arg(tr("Your version of LameXP is more than a year old. Time for an update!")), tr("Check for Updates"), tr("Exit Program")) == 0)
{
- checkUpdatesActionActivated();
+ if(checkForUpdates())
+ {
+ QApplication::quit();
+ return;
+ }
}
else
{
{
if(QMessageBox::information(this, tr("Update Reminder"), QString("<nobr>%1</nobr>").arg(lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
{
- checkUpdatesActionActivated();
+ if(checkForUpdates())
+ {
+ QApplication::quit();
+ return;
+ }
}
}
}
messageText += QString("%1</nobr>").arg(tr("Do you want to download and install the WMA File Decoder component now?"));
if(QMessageBox::information(this, tr("WMA Decoder Missing"), messageText, tr("Download && Install"), tr("Postpone")) == 0)
{
- installWMADecoder();
+ if(installWMADecoder())
+ {
+ QApplication::quit();
+ return;
+ }
}
}
}
TEMP_HIDE_DROPBOX
(
- UpdateDialog *updateDialog = new UpdateDialog(m_settings, this);
- updateDialog->exec();
- if(updateDialog->getSuccess())
+ if(checkForUpdates())
{
- m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate));
+ QApplication::quit();
}
- LAMEXP_DELETE(updateDialog);
)
}
{
if(QMessageBox::question(this, tr("Install WMA Decoder"), tr("Do you want to download and install the WMA File Decoder component now?"), tr("Download && Install"), tr("Cancel")) == 0)
{
- installWMADecoder();
+ if(installWMADecoder())
+ {
+ QApplication::quit();
+ return;
+ }
}
}
/*
* Check for debugger
*/
-void WINAPI debugThreadProc(__in LPVOID lpParameter)
+#if !defined(_DEBUG) || defined(NDEBUG)
+void WINAPI lamexp_debug_thread_proc(__in LPVOID lpParameter)
{
- BOOL remoteDebuggerPresent = FALSE;
- //CheckRemoteDebuggerPresent(GetCurrentProcess, &remoteDebuggerPresent);
-
- while(!IsDebuggerPresent() && !remoteDebuggerPresent)
+ while(!IsDebuggerPresent())
{
Sleep(333);
- //CheckRemoteDebuggerPresent(GetCurrentProcess, &remoteDebuggerPresent);
}
-
TerminateProcess(GetCurrentProcess(), -1);
}
+HANDLE lamexp_debug_thread_init(void)
+{
+ if(IsDebuggerPresent())
+ {
+ FatalAppExit(0, L"Not a debug build. Please unload debugger and try again!");
+ TerminateProcess(GetCurrentProcess(), -1);
+ }
+ return CreateThread(NULL, NULL, reinterpret_cast<LPTHREAD_START_ROUTINE>(&lamexp_debug_thread_proc), NULL, NULL, NULL);
+}
+static const HANDLE g_debug_thread = lamexp_debug_thread_init();
+#endif
/*
* Check for compatibility mode
qWarning("---------------------------------------------------------\n");
#else
#define LAMEXP_DEBUG 0
-#define LAMEXP_CHECK_DEBUG_BUILD \
- if(IsDebuggerPresent()) { \
- FatalAppExit(0, L"Not a debug build. Please unload debugger and try again!"); \
- TerminateProcess(GetCurrentProcess, -1); } \
- CreateThread(NULL, NULL, reinterpret_cast<LPTHREAD_START_ROUTINE>(&debugThreadProc), NULL, NULL, NULL);
- void WINAPI debugThreadProc(__in LPVOID lpParameter);
+#define LAMEXP_CHECK_DEBUG_BUILD
#endif
//Memory check