diff --git a/res/images/Working.gif b/res/images/Working.gif new file mode 100644 index 00000000..3288d103 Binary files /dev/null and b/res/images/Working.gif differ diff --git a/src/Config.h b/src/Config.h index ec446483..6cb44b5b 100644 --- a/src/Config.h +++ b/src/Config.h @@ -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 40 +#define VER_LAMEXP_BUILD 41 #define VER_LAMEXP_SUFFIX TechPreview /* diff --git a/src/Global.cpp b/src/Global.cpp index 6c906110..05a028c4 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -35,6 +35,7 @@ #include #include #include +#include //LameXP includes #include "Resource.h" @@ -107,6 +108,9 @@ static QSystemSemaphore *g_lamexp_semaphore_write_ptr = NULL; //Image formats static const char *g_lamexp_imageformats[] = {"png", "gif", "ico", "svg", NULL}; +//Global locks +static QMutex g_lamexp_message_mutex; + /////////////////////////////////////////////////////////////////////////////// // GLOBAL FUNCTIONS /////////////////////////////////////////////////////////////////////////////// @@ -172,6 +176,54 @@ const QDate &lamexp_version_date(void) return g_lamexp_version_date; } +/* + * Qt message handler + */ +void lamexp_message_handler(QtMsgType type, const char *msg) +{ + static HANDLE hConsole = NULL; + QMutexLocker lock(&g_lamexp_message_mutex); + + if(!hConsole) + { + hConsole = CreateFile(L"CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); + if(hConsole == INVALID_HANDLE_VALUE) hConsole = NULL; + } + + CONSOLE_SCREEN_BUFFER_INFO bufferInfo; + GetConsoleScreenBufferInfo(hConsole, &bufferInfo); + + switch(type) + { + case QtCriticalMsg: + case QtFatalMsg: + fflush(stdout); + fflush(stderr); + SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_INTENSITY); + fprintf(stderr, "\nCRITICAL ERROR !!!\n%s\n\n", msg); + MessageBoxA(NULL, msg, "LameXP - CRITICAL ERROR", MB_ICONERROR | MB_TOPMOST | MB_TASKMODAL); + break; + case QtWarningMsg: + SetConsoleTextAttribute(hConsole, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY); + fprintf(stderr, "%s\n", msg); + fflush(stderr); + break; + default: + SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY); + fprintf(stderr, "%s\n", msg); + fflush(stderr); + break; + } + + SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED); + + if(type == QtCriticalMsg || type == QtFatalMsg) + { + FatalAppExit(0, L"The application has encountered a critical error and will exit now!"); + TerminateProcess(GetCurrentProcess(), -1); + } + } + /* * Initialize the console */ diff --git a/src/Global.h b/src/Global.h index 2d24fb83..393f5609 100644 --- a/src/Global.h +++ b/src/Global.h @@ -31,10 +31,11 @@ //Win32 #include -//Class declarations +//Declarations class QString; class LockedFile; class QDate; +enum QtMsgType; //Types definitions typedef struct @@ -65,6 +66,7 @@ unsigned int lamexp_toolver_neroaac(void); void lamexp_init_console(int argc, char* argv[]); bool lamexp_init_qt(int argc, char* argv[]); int lamexp_init_ipc(void); +void lamexp_message_handler(QtMsgType type, const char *msg); void lamexp_register_tool(const QString &toolName, LockedFile *file, unsigned int version = 0); bool lamexp_check_tool(const QString &toolName); const QString lamexp_lookup_tool(const QString &toolName); diff --git a/src/Main.cpp b/src/Main.cpp index 5280b35d..9cff87e9 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -32,6 +32,7 @@ #include #include #include +#include /////////////////////////////////////////////////////////////////////////////// // Main function @@ -134,54 +135,6 @@ int lamexp_main(int argc, char* argv[]) return iResult; } -/////////////////////////////////////////////////////////////////////////////// -// Message Handler -/////////////////////////////////////////////////////////////////////////////// - -static void lamexp_message_handler(QtMsgType type, const char *msg) -{ - static HANDLE hConsole = NULL; - - if(!hConsole) - { - hConsole = CreateFile(L"CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); - } - - CONSOLE_SCREEN_BUFFER_INFO bufferInfo; - GetConsoleScreenBufferInfo(hConsole, &bufferInfo); - - switch(type) - { - case QtCriticalMsg: - case QtFatalMsg: - fflush(stdout); - fflush(stderr); - SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_INTENSITY); - fprintf(stderr, "\nCRITICAL ERROR !!!\n%s\n\n", msg); - MessageBoxA(NULL, msg, "LameXP - CRITICAL ERROR", MB_ICONERROR | MB_TOPMOST | MB_TASKMODAL); - break; - case QtWarningMsg: - SetConsoleTextAttribute(hConsole, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY); - fprintf(stderr, "%s\n", msg); - fflush(stderr); - break; - default: - SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY); - fprintf(stderr, "%s\n", msg); - fflush(stderr); - break; - } - - SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED); - - if(type == QtCriticalMsg || type == QtFatalMsg) - { - FatalAppExit(0, L"The application has encountered a critical error and will exit now!"); - TerminateProcess(GetCurrentProcess(), -1); - } - } - - /////////////////////////////////////////////////////////////////////////////// // Applicaton entry point /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp index 8f7f6be2..3e2dcf93 100644 --- a/src/Thread_Initialization.cpp +++ b/src/Thread_Initialization.cpp @@ -178,6 +178,7 @@ void InitializationThread::initNeroAac(void) { qWarning("Nero process failed to create!"); qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData()); + qDebug("File '%s' does exist?\n%s\n!", neroFileInfo[0].canonicalFilePath().toUtf8().constData(), (neroFileInfo[0].exists() ? "Yes, it still exists" : "Nope, it disappeared")); process.kill(); process.waitForFinished(-1); for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]); @@ -223,7 +224,7 @@ void InitializationThread::initNeroAac(void) if(!(neroVersion > 0)) { - qWarning("Nero AAC version could not be determined!", neroVersion); + qWarning("Nero AAC version could not be determined -> AAC encoding support will be disabled!", neroVersion); for(int i = 0; i < 3; i++) LAMEXP_DELETE(neroBin[i]); return; }