diff --git a/doc/Changelog.html b/doc/Changelog.html
index 44d46980..8b537303 100644
--- a/doc/Changelog.html
+++ b/doc/Changelog.html
@@ -24,6 +24,7 @@ a:visited { color: #0000EE; }
Implemented multi-threading in initialization code for faster application startup
Fixed a potential crash (stack overflow) when adding a huge number of files
Fixed a problem with Cue Sheet import and files that contain trailing dots in their name
+Workaround for a bug (feature?) of Qt's command-line parser that screwed up some arguments
Changes between v4.03 and v4.04 [2012-04-26]:
diff --git a/etc/Deployment/_version.bat b/etc/Deployment/_version.bat
index 2fd007df..4b052d06 100644
--- a/etc/Deployment/_version.bat
+++ b/etc/Deployment/_version.bat
@@ -27,7 +27,8 @@ if "%VER_LAMEXP_TYPE%"=="" GOTO:EOF
if "%VER_LAMEXP_PATCH%"=="" GOTO:EOF
REM ------------------------------------------
set "VER_LAMEXP_BASENAME=LameXP"
-if not "%VER_LAMEXP_TYPE%" == "Final" set "VER_LAMEXP_BASENAME=LameXP-PRERELEASE"
+if "%VER_LAMEXP_TYPE%" == "Alpha" set "VER_LAMEXP_BASENAME=LameXP-ALPHA"
+if "%VER_LAMEXP_TYPE%" == "Beta" set "VER_LAMEXP_BASENAME=LameXP-BETA"
REM ------------------------------------------
echo LameXP Version:
echo %VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%, Build #%VER_LAMEXP_BUILD% (%VER_LAMEXP_TYPE%-%VER_LAMEXP_PATCH%)
diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts
index f3c7d0e5..ea73f971 100644
--- a/etc/Translation/Blank.ts
+++ b/etc/Translation/Blank.ts
@@ -3016,22 +3016,22 @@
QApplication
-
+
Executable '%1' doesn't support Windows compatibility mode.
-
+
Executable '%1' requires Qt v%2, but found Qt v%3.
-
+
Executable '%1' was built for Qt '%2', but found Qt '%3'.
-
+
Executable '%1' requires Windows 2000 or later.
diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts
index 3463c78d..1276beb1 100644
--- a/etc/Translation/LameXP_PL.ts
+++ b/etc/Translation/LameXP_PL.ts
@@ -3016,22 +3016,22 @@
QApplication
-
+
Executable '%1' doesn't support Windows compatibility mode.
Plik wykonywalny '%1' nie działa w trybie kompatybilności z Windows.
-
+
Executable '%1' requires Qt v%2, but found Qt v%3.
Plik wykonywalny '%1' wymaga Qt v%2, znaleziono jednak Qt v%3.
-
+
Executable '%1' was built for Qt '%2', but found Qt '%3'.
Plik wykonywalny "%1" został skompilowany dla Qt "%2", znaleziono "%3".
-
+
Executable '%1' requires Windows 2000 or later.
Plik wykonywalny '%1' wymaga do uruchomienia Windows 2000 lub nowszego.
diff --git a/etc/Translation/LameXP_SV.ts b/etc/Translation/LameXP_SV.ts
index bcbc43ed..57388102 100644
--- a/etc/Translation/LameXP_SV.ts
+++ b/etc/Translation/LameXP_SV.ts
@@ -3016,22 +3016,22 @@
QApplication
-
+
Executable '%1' doesn't support Windows compatibility mode.
EXE-filen '%1' stöder inte Windows kompatibilitetsläge.
-
+
Executable '%1' requires Qt v%2, but found Qt v%3.
EXE-filen '%1' kräver Qt v%2, du har Qt v%3.
-
+
Executable '%1' was built for Qt '%2', but found Qt '%3'.
EXE-filen '%1' är byggd för Qt '%2', du har Qt '%3'.
-
+
Executable '%1' requires Windows 2000 or later.
EXE-filen '%1' kräver Windows 2000 eller senare.
diff --git a/src/Config.h b/src/Config.h
index 7e11412a..b77ec895 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 5
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 5
-#define VER_LAMEXP_BUILD 1038
+#define VER_LAMEXP_BUILD 1040
///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!)
diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp
index 2690332a..c4b8d2b7 100644
--- a/src/Dialog_MainWindow.cpp
+++ b/src/Dialog_MainWindow.cpp
@@ -1125,7 +1125,7 @@ bool MainWindow::winEvent(MSG *message, long *result)
*/
void MainWindow::windowShown(void)
{
- QStringList arguments = QApplication::arguments();
+ const QStringList &arguments = lamexp_arguments(); //QApplication::arguments();
//First run?
bool firstRun = false;
diff --git a/src/Global.cpp b/src/Global.cpp
index 5bd854fd..78b628ab 100644
--- a/src/Global.cpp
+++ b/src/Global.cpp
@@ -63,6 +63,9 @@
#include
#include
+//Shell API
+#include
+
//COM includes
#include
#include
@@ -258,6 +261,9 @@ static const DWORD g_main_thread_id = GetCurrentThreadId();
//Log file
static FILE *g_lamexp_log_file = NULL;
+//CLI Arguments
+static QStringList *g_lamexp_argv = NULL;
+
///////////////////////////////////////////////////////////////////////////////
// GLOBAL FUNCTIONS
///////////////////////////////////////////////////////////////////////////////
@@ -536,7 +542,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
/*
* Initialize the console
*/
-void lamexp_init_console(int argc, char* argv[])
+void lamexp_init_console(const QStringList &argv)
{
bool enableConsole = lamexp_version_demo();
@@ -561,13 +567,13 @@ void lamexp_init_console(int argc, char* argv[])
if(!LAMEXP_DEBUG)
{
- for(int i = 0; i < argc; i++)
+ for(int i = 0; i < argv.count(); i++)
{
- if(!_stricmp(argv[i], "--console"))
+ if(!argv.at(i).compare("--console", Qt::CaseInsensitive))
{
enableConsole = true;
}
- else if(!_stricmp(argv[i], "--no-console"))
+ else if(!argv.at(i).compare("--no-console", Qt::CaseInsensitive))
{
enableConsole = false;
}
@@ -1683,6 +1689,31 @@ bool lamexp_install_translator_from_file(const QString &qmFile)
return success;
}
+const QStringList &lamexp_arguments(void)
+{
+ if(!g_lamexp_argv)
+ {
+ g_lamexp_argv = new QStringList();
+ int nArgs = 0;
+ LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
+
+ if(NULL != szArglist)
+ {
+ for(int i = 0; i < nArgs; i++)
+ {
+ *g_lamexp_argv << WCHAR2QSTR(szArglist[i]);
+ }
+ LocalFree(szArglist);
+ }
+ else
+ {
+ qWarning("CommandLineToArgvW failed !!!");
+ }
+ }
+
+ return *g_lamexp_argv;
+}
+
/*
* Locate known folder on local system
*/
@@ -2100,6 +2131,9 @@ void lamexp_finalization(void)
fclose(g_lamexp_log_file);
g_lamexp_log_file = NULL;
}
+
+ //Free CLI Arguments
+ LAMEXP_DELETE(g_lamexp_argv);
}
/*
diff --git a/src/Global.h b/src/Global.h
index bf255e13..f71a750d 100644
--- a/src/Global.h
+++ b/src/Global.h
@@ -104,7 +104,7 @@ DWORD lamexp_get_os_version(void);
bool lamexp_detect_wine(void);
//Public functions
-void lamexp_init_console(int argc, char* argv[]);
+void lamexp_init_console(const QStringList &argv);
bool lamexp_init_qt(int argc, char* argv[]);
int lamexp_init_ipc(void);
LONG WINAPI lamexp_exception_handler(__in struct _EXCEPTION_POINTERS *ExceptionInfo);
@@ -124,6 +124,7 @@ bool lamexp_portable_mode(void);
bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false);
bool lamexp_is_hibernation_supported(void);
QIcon lamexp_app_icon(const QDate *date = NULL, const QTime *time = NULL);
+const QStringList &lamexp_arguments(void);
//Translation support
QStringList lamexp_query_translations(void);
diff --git a/src/Main.cpp b/src/Main.cpp
index 3aef19ed..020927f4 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -50,8 +50,11 @@ static int lamexp_main(int argc, char* argv[])
int iShutdown = shutdownFlag_None;
bool bAccepted = true;
+ //Get CLI arguments
+ const QStringList &arguments = lamexp_arguments();
+
//Init console
- lamexp_init_console(argc, argv);
+ lamexp_init_console(arguments);
//Print version info
qDebug("LameXP - Audio Encoder Front-End v%d.%02d %s (Build #%03d)", lamexp_version_major(), lamexp_version_minor(), lamexp_version_release(), lamexp_version_build());
@@ -73,9 +76,9 @@ static int lamexp_main(int argc, char* argv[])
//Enumerate CLI arguments
qDebug("Command-Line Arguments:");
- for(int i = 0; i < argc; i++)
+ for(int i = 0; i < arguments.count(); i++)
{
- qDebug("argv[%d]=%s", i, argv[i]);
+ qDebug("argv[%d]=%s", i, arguments.at(i).toUtf8().constData());
}
qDebug("");
diff --git a/src/Thread_MessageProducer.cpp b/src/Thread_MessageProducer.cpp
index 85c0a902..90e75eb2 100644
--- a/src/Thread_MessageProducer.cpp
+++ b/src/Thread_MessageProducer.cpp
@@ -46,7 +46,7 @@ void MessageProducerThread::run()
{
setTerminationEnabled(true);
bool bSentFiles = false;
- QStringList arguments = QApplication::arguments();
+ const QStringList &arguments = lamexp_arguments(); //QApplication::arguments();
for(int i = 0; i < arguments.count(); i++)
{