Moved all terminal support functions into MUtilities library.
This commit is contained in:
parent
bdfef0ed1c
commit
29d8b98a3f
@ -35,7 +35,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 1
|
||||
#define VER_LAMEXP_TYPE Beta
|
||||
#define VER_LAMEXP_PATCH 1
|
||||
#define VER_LAMEXP_BUILD 1593
|
||||
#define VER_LAMEXP_BUILD 1597
|
||||
#define VER_LAMEXP_CONFG 1558
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -534,7 +534,7 @@ bool AboutDialog::eventFilter(QObject *obj, QEvent *event)
|
||||
|
||||
void AboutDialog::initInformationTab(void)
|
||||
{
|
||||
const QDate versionDate = MUtils::Version::build_date();
|
||||
const QDate versionDate = MUtils::Version::app_build_date();
|
||||
|
||||
const QString versionStr = QString().sprintf
|
||||
(
|
||||
|
@ -1290,7 +1290,7 @@ bool MainWindow::winEvent(MSG *message, long *result)
|
||||
*/
|
||||
void MainWindow::windowShown(void)
|
||||
{
|
||||
const QStringList &arguments = lamexp_arguments(); //QApplication::arguments();
|
||||
const QStringList &arguments = MUtils::OS::arguments(); //QApplication::arguments();
|
||||
|
||||
//Force resize event
|
||||
resizeEvent(NULL);
|
||||
@ -1373,7 +1373,7 @@ void MainWindow::windowShown(void)
|
||||
}
|
||||
|
||||
//Update reminder
|
||||
if(MUtils::OS::current_date() >= MUtils::Version::build_date().addYears(1))
|
||||
if(MUtils::OS::current_date() >= MUtils::Version::app_build_date().addYears(1))
|
||||
{
|
||||
qWarning("Binary is more than a year old, time to update!");
|
||||
SHOW_CORNER_WIDGET(true);
|
||||
|
@ -544,7 +544,7 @@ void ProcessingDialog::initEncoding(void)
|
||||
unsigned int maximumInstances = qBound(0U, m_settings->maximumInstances(), MAX_INSTANCES);
|
||||
if(maximumInstances < 1)
|
||||
{
|
||||
const MUtils::CPUFetaures::cpu_info_t cpuFeatures = MUtils::CPUFetaures::detect(lamexp_arguments());
|
||||
const MUtils::CPUFetaures::cpu_info_t cpuFeatures = MUtils::CPUFetaures::detect(MUtils::OS::arguments());
|
||||
maximumInstances = cores2instances(qBound(1U, cpuFeatures.count, 64U));
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ void UpdateDialog::showEvent(QShowEvent *event)
|
||||
}
|
||||
|
||||
threadStatusChanged(m_thread->getUpdateStatus());
|
||||
ui->labelVersionInstalled->setText(QString("%1 %2 (%3)").arg(tr("Build"), QString::number(lamexp_version_build()), MUtils::Version::build_date().toString(Qt::ISODate)));
|
||||
ui->labelVersionInstalled->setText(QString("%1 %2 (%3)").arg(tr("Build"), QString::number(lamexp_version_build()), MUtils::Version::app_build_date().toString(Qt::ISODate)));
|
||||
ui->labelVersionLatest->setText(QString("(%1)").arg(tr("Unknown")));
|
||||
|
||||
ui->installButton->setEnabled(false);
|
||||
|
@ -90,7 +90,6 @@ class lamexp_icon_t;
|
||||
|
||||
const QIcon &lamexp_app_icon(void);
|
||||
bool lamexp_append_sysmenu(const QWidget *win, const unsigned int identifier, const QString &text);
|
||||
const QStringList &lamexp_arguments(void);
|
||||
QStringList lamexp_available_codepages(bool noAliases = true);
|
||||
bool lamexp_beep(int beepType);
|
||||
void lamexp_blink_window(QWidget *poWindow, unsigned int count = 10, unsigned int delay = 150);
|
||||
@ -116,7 +115,6 @@ bool lamexp_exec_shell(const QWidget *win, const QString &url, const QString &pa
|
||||
void lamexp_finalization(void);
|
||||
unsigned __int64 lamexp_free_diskspace(const QString &path, bool *ok = NULL);
|
||||
void lamexp_free_window_icon(lamexp_icon_t *icon);
|
||||
void lamexp_init_console(const QStringList &argv);
|
||||
void lamexp_init_error_handlers(void);
|
||||
int lamexp_init_ipc(void);
|
||||
bool lamexp_init_qt(int argc, char* argv[]);
|
||||
|
@ -127,7 +127,7 @@ bool lamexp_version_demo(void)
|
||||
*/
|
||||
QDate lamexp_version_expires(void)
|
||||
{
|
||||
return MUtils::Version::build_date().addDays(MUTILS_DEBUG ? 7 : 30);
|
||||
return MUtils::Version::app_build_date().addDays(MUTILS_DEBUG ? 7 : 30);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -70,6 +70,7 @@
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
#include <MUtils/Terminal.h>
|
||||
|
||||
//CRT includes
|
||||
#include <cstdio>
|
||||
@ -101,46 +102,10 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
||||
#define _LAMEXP_MAKE_STR(STR) #STR
|
||||
#define LAMEXP_MAKE_STR(STR) _LAMEXP_MAKE_STR(STR)
|
||||
|
||||
//String helper
|
||||
#define CLEAN_OUTPUT_STRING(STR) do \
|
||||
{ \
|
||||
const char CTRL_CHARS[3] = { '\r', '\n', '\t' }; \
|
||||
for(size_t i = 0; i < 3; i++) \
|
||||
{ \
|
||||
while(char *pos = strchr((STR), CTRL_CHARS[i])) *pos = char(0x20); \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
//String helper
|
||||
#define TRIM_LEFT(STR) do \
|
||||
{ \
|
||||
const char WHITE_SPACE[4] = { char(0x20), '\r', '\n', '\t' }; \
|
||||
for(size_t i = 0; i < 4; i++) \
|
||||
{ \
|
||||
while(*(STR) == WHITE_SPACE[i]) (STR)++; \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// GLOBAL VARS
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Console attached flag
|
||||
static bool g_lamexp_console_attached = false;
|
||||
|
||||
//Fatal exit flags
|
||||
static volatile bool g_lamexp_fatal_flag = true;
|
||||
|
||||
//CLI Arguments
|
||||
static struct
|
||||
{
|
||||
QStringList *list;
|
||||
QReadWriteLock lock;
|
||||
}
|
||||
g_lamexp_argv;
|
||||
|
||||
//Wine detection
|
||||
static struct
|
||||
{
|
||||
@ -185,16 +150,10 @@ static const char *g_lamexp_imageformats[] = {"bmp", "png", "jpg", "gif", "ico",
|
||||
//Main thread ID
|
||||
static const DWORD g_main_thread_id = GetCurrentThreadId();
|
||||
|
||||
//Log file
|
||||
static FILE *g_lamexp_log_file = NULL;
|
||||
|
||||
//Localization
|
||||
const char* LAMEXP_DEFAULT_LANGID = "en";
|
||||
const char* LAMEXP_DEFAULT_TRANSLATION = "LameXP_EN.qm";
|
||||
|
||||
//GURU MEDITATION
|
||||
static const char *GURU_MEDITATION = "\n\nGURU MEDITATION !!!\n\n";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// GLOBAL FUNCTIONS
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -231,141 +190,6 @@ bool lamexp_detect_wine(void)
|
||||
return g_lamexp_wine.bIsWine;
|
||||
}
|
||||
|
||||
/*
|
||||
* Change console text color
|
||||
*/
|
||||
static void lamexp_console_color(FILE* file, WORD attributes)
|
||||
{
|
||||
const HANDLE hConsole = (HANDLE)(_get_osfhandle(_fileno(file)));
|
||||
if((hConsole != NULL) && (hConsole != INVALID_HANDLE_VALUE))
|
||||
{
|
||||
SetConsoleTextAttribute(hConsole, attributes);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Output logging message to console
|
||||
*/
|
||||
static void lamexp_write_console(const int type, const char *msg)
|
||||
{
|
||||
__try
|
||||
{
|
||||
if(_isatty(_fileno(stderr)))
|
||||
{
|
||||
UINT oldOutputCP = GetConsoleOutputCP();
|
||||
if(oldOutputCP != CP_UTF8) SetConsoleOutputCP(CP_UTF8);
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case QtCriticalMsg:
|
||||
case QtFatalMsg:
|
||||
lamexp_console_color(stderr, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
fprintf(stderr, GURU_MEDITATION);
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
fflush(stderr);
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
lamexp_console_color(stderr, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
fflush(stderr);
|
||||
break;
|
||||
default:
|
||||
lamexp_console_color(stderr, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
fflush(stderr);
|
||||
break;
|
||||
}
|
||||
|
||||
lamexp_console_color(stderr, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
|
||||
if(oldOutputCP != CP_UTF8) SetConsoleOutputCP(oldOutputCP);
|
||||
}
|
||||
}
|
||||
__except(1)
|
||||
{
|
||||
/*ignore any exception that might occur here!*/
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Output logging message to debugger
|
||||
*/
|
||||
static void lamexp_write_dbg_out(const int type, const char *msg)
|
||||
{
|
||||
const char *FORMAT = "[LameXP][%c] %s\n";
|
||||
|
||||
__try
|
||||
{
|
||||
char buffer[512];
|
||||
const char* input = msg;
|
||||
TRIM_LEFT(input);
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case QtCriticalMsg:
|
||||
case QtFatalMsg:
|
||||
_snprintf_s(buffer, 512, _TRUNCATE, FORMAT, 'C', input);
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
_snprintf_s(buffer, 512, _TRUNCATE, FORMAT, 'W', input);
|
||||
break;
|
||||
default:
|
||||
_snprintf_s(buffer, 512, _TRUNCATE, FORMAT, 'I', input);
|
||||
break;
|
||||
}
|
||||
|
||||
char *temp = &buffer[0];
|
||||
CLEAN_OUTPUT_STRING(temp);
|
||||
OutputDebugStringA(temp);
|
||||
}
|
||||
__except(1)
|
||||
{
|
||||
/*ignore any exception that might occur here!*/
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Output logging message to logfile
|
||||
*/
|
||||
static void lamexp_write_logfile(const int type, const char *msg)
|
||||
{
|
||||
const char *FORMAT = "[%c][%04u] %s\r\n";
|
||||
|
||||
__try
|
||||
{
|
||||
if(g_lamexp_log_file)
|
||||
{
|
||||
char buffer[512];
|
||||
strncpy_s(buffer, 512, msg, _TRUNCATE);
|
||||
|
||||
char *temp = &buffer[0];
|
||||
TRIM_LEFT(temp);
|
||||
CLEAN_OUTPUT_STRING(temp);
|
||||
|
||||
const unsigned int timestamp = static_cast<unsigned int>(_time64(NULL) % 3600I64);
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case QtCriticalMsg:
|
||||
case QtFatalMsg:
|
||||
fprintf(g_lamexp_log_file, FORMAT, 'C', timestamp, temp);
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
fprintf(g_lamexp_log_file, FORMAT, 'W', timestamp, temp);
|
||||
break;
|
||||
default:
|
||||
fprintf(g_lamexp_log_file, FORMAT, 'I', timestamp, temp);
|
||||
break;
|
||||
}
|
||||
|
||||
fflush(g_lamexp_log_file);
|
||||
}
|
||||
}
|
||||
__except(1)
|
||||
{
|
||||
/*ignore any exception that might occur here!*/
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Qt message handler
|
||||
*/
|
||||
@ -376,25 +200,10 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
||||
return;
|
||||
}
|
||||
|
||||
//CSLocker lock(g_lamexp_message_lock); FIXME !!!! FIXME !!!! FIXME !!!! FIXME !!!!
|
||||
|
||||
if(g_lamexp_log_file)
|
||||
{
|
||||
lamexp_write_logfile(type, msg);
|
||||
}
|
||||
|
||||
if(g_lamexp_console_attached)
|
||||
{
|
||||
lamexp_write_console(type, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
lamexp_write_dbg_out(type, msg);
|
||||
}
|
||||
MUtils::Terminal::write(type, msg);
|
||||
|
||||
if((type == QtCriticalMsg) || (type == QtFatalMsg))
|
||||
{
|
||||
//lock.forceUnlock();
|
||||
MUtils::OS::fatal_exit(MUTILS_WCHR(QString::fromUtf8(msg)));
|
||||
}
|
||||
}
|
||||
@ -443,89 +252,6 @@ void lamexp_init_error_handlers(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the console
|
||||
*/
|
||||
void lamexp_init_console(const QStringList &argv)
|
||||
{
|
||||
bool enableConsole = (MUTILS_DEBUG) || ((VER_LAMEXP_CONSOLE_ENABLED) && lamexp_version_demo());
|
||||
|
||||
if(_environ)
|
||||
{
|
||||
wchar_t *logfile = NULL;
|
||||
size_t logfile_len = 0;
|
||||
if(!_wdupenv_s(&logfile, &logfile_len, L"LAMEXP_LOGFILE"))
|
||||
{
|
||||
if(logfile && (logfile_len > 0))
|
||||
{
|
||||
FILE *temp = NULL;
|
||||
if(!_wfopen_s(&temp, logfile, L"wb"))
|
||||
{
|
||||
fprintf(temp, "%c%c%c", char(0xEF), char(0xBB), char(0xBF));
|
||||
g_lamexp_log_file = temp;
|
||||
}
|
||||
free(logfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!MUTILS_DEBUG)
|
||||
{
|
||||
for(int i = 0; i < argv.count(); i++)
|
||||
{
|
||||
if(!argv.at(i).compare("--console", Qt::CaseInsensitive))
|
||||
{
|
||||
enableConsole = true;
|
||||
}
|
||||
else if(!argv.at(i).compare("--no-console", Qt::CaseInsensitive))
|
||||
{
|
||||
enableConsole = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(enableConsole)
|
||||
{
|
||||
if(!g_lamexp_console_attached)
|
||||
{
|
||||
if(AllocConsole() != FALSE)
|
||||
{
|
||||
SetConsoleCtrlHandler(NULL, TRUE);
|
||||
SetConsoleTitle(L"LameXP - Audio Encoder Front-End | Debug Console");
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
g_lamexp_console_attached = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(g_lamexp_console_attached)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
//See: http://support.microsoft.com/default.aspx?scid=kb;en-us;105305
|
||||
//-------------------------------------------------------------------
|
||||
const int flags = _O_WRONLY | _O_U8TEXT;
|
||||
int hCrtStdOut = _open_osfhandle((intptr_t) GetStdHandle(STD_OUTPUT_HANDLE), flags);
|
||||
int hCrtStdErr = _open_osfhandle((intptr_t) GetStdHandle(STD_ERROR_HANDLE), flags);
|
||||
FILE *hfStdOut = (hCrtStdOut >= 0) ? _fdopen(hCrtStdOut, "wb") : NULL;
|
||||
FILE *hfStdErr = (hCrtStdErr >= 0) ? _fdopen(hCrtStdErr, "wb") : NULL;
|
||||
if(hfStdOut) { *stdout = *hfStdOut; std::cout.rdbuf(new std::filebuf(hfStdOut)); }
|
||||
if(hfStdErr) { *stderr = *hfStdErr; std::cerr.rdbuf(new std::filebuf(hfStdErr)); }
|
||||
}
|
||||
|
||||
HWND hwndConsole = GetConsoleWindow();
|
||||
|
||||
if((hwndConsole != NULL) && (hwndConsole != INVALID_HANDLE_VALUE))
|
||||
{
|
||||
HMENU hMenu = GetSystemMenu(hwndConsole, 0);
|
||||
EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
|
||||
RemoveMenu(hMenu, SC_CLOSE, MF_BYCOMMAND);
|
||||
|
||||
SetWindowPos(hwndConsole, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
|
||||
SetWindowLong(hwndConsole, GWL_STYLE, GetWindowLong(hwndConsole, GWL_STYLE) & (~WS_MAXIMIZEBOX) & (~WS_MINIMIZEBOX));
|
||||
SetWindowPos(hwndConsole, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for debugger (detect routine)
|
||||
*/
|
||||
@ -690,7 +416,7 @@ bool lamexp_init_qt(int argc, char* argv[])
|
||||
{
|
||||
static bool qt_initialized = false;
|
||||
typedef BOOL (WINAPI *SetDllDirectoryProc)(WCHAR *lpPathName);
|
||||
const QStringList &arguments = lamexp_arguments();
|
||||
const QStringList &arguments = MUtils::OS::arguments();
|
||||
|
||||
//Don't initialized again, if done already
|
||||
if(qt_initialized)
|
||||
@ -839,6 +565,7 @@ bool lamexp_init_qt(int argc, char* argv[])
|
||||
}
|
||||
|
||||
//Update console icon, if a console is attached
|
||||
#if 0 //FIXME !!!! FIXME !!!! FIXME !!!! FIXME !!!! FIXME !!!! FIXME !!!! FIXME !!!! FIXME !!!!
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
||||
if(g_lamexp_console_attached && (!lamexp_detect_wine()))
|
||||
{
|
||||
@ -856,6 +583,7 @@ bool lamexp_init_qt(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Done
|
||||
@ -863,37 +591,6 @@ bool lamexp_init_qt(int argc, char* argv[])
|
||||
return true;
|
||||
}
|
||||
|
||||
const QStringList &lamexp_arguments(void)
|
||||
{
|
||||
QReadLocker readLock(&g_lamexp_argv.lock);
|
||||
|
||||
if(!g_lamexp_argv.list)
|
||||
{
|
||||
readLock.unlock();
|
||||
QWriteLocker writeLock(&g_lamexp_argv.lock);
|
||||
|
||||
g_lamexp_argv.list = new QStringList;
|
||||
|
||||
int nArgs = 0;
|
||||
LPWSTR *szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
|
||||
|
||||
if(NULL != szArglist)
|
||||
{
|
||||
for(int i = 0; i < nArgs; i++)
|
||||
{
|
||||
(*g_lamexp_argv.list) << MUTILS_QSTR(szArglist[i]);
|
||||
}
|
||||
LocalFree(szArglist);
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("CommandLineToArgvW() has failed !!!");
|
||||
}
|
||||
}
|
||||
|
||||
return (*g_lamexp_argv.list);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if visual themes are enabled (WinXP and later)
|
||||
*/
|
||||
@ -1823,7 +1520,6 @@ extern "C" void _lamexp_global_init_win32(void)
|
||||
}
|
||||
|
||||
//Zero *before* constructors are called
|
||||
LAMEXP_ZERO_MEMORY(g_lamexp_argv);
|
||||
LAMEXP_ZERO_MEMORY(g_lamexp_wine);
|
||||
LAMEXP_ZERO_MEMORY(g_lamexp_themes_enabled);
|
||||
LAMEXP_ZERO_MEMORY(g_lamexp_dwmapi);
|
||||
@ -1846,31 +1542,6 @@ extern "C" void _lamexp_global_free_win32(void)
|
||||
g_lamexp_dwmapi.dwmEnableBlurBehindWindow = NULL;
|
||||
MUTILS_DELETE(g_lamexp_dwmapi.dwmapi_dll);
|
||||
|
||||
//Free STDOUT and STDERR buffers
|
||||
if(g_lamexp_console_attached)
|
||||
{
|
||||
if(std::filebuf *tmp = dynamic_cast<std::filebuf*>(std::cout.rdbuf()))
|
||||
{
|
||||
std::cout.rdbuf(NULL);
|
||||
MUTILS_DELETE(tmp);
|
||||
}
|
||||
if(std::filebuf *tmp = dynamic_cast<std::filebuf*>(std::cerr.rdbuf()))
|
||||
{
|
||||
std::cerr.rdbuf(NULL);
|
||||
MUTILS_DELETE(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
//Close log file
|
||||
if(g_lamexp_log_file)
|
||||
{
|
||||
fclose(g_lamexp_log_file);
|
||||
g_lamexp_log_file = NULL;
|
||||
}
|
||||
|
||||
//Clear sound cache
|
||||
MUTILS_DELETE(g_lamexp_sounds.sound_db);
|
||||
|
||||
//Free CLI Arguments
|
||||
MUTILS_DELETE(g_lamexp_argv.list);
|
||||
}
|
||||
|
20
src/Main.cpp
20
src/Main.cpp
@ -38,6 +38,7 @@
|
||||
#include <MUtils/OSSupport.h>
|
||||
#include <MUtils/Version.h>
|
||||
#include <MUtils/CPUFeatures.h>
|
||||
#include <MUtils/Terminal.h>
|
||||
|
||||
//Qt includes
|
||||
#include <QApplication>
|
||||
@ -57,21 +58,24 @@ static int lamexp_main(int argc, char* argv[])
|
||||
bool bAccepted = true;
|
||||
|
||||
//Get CLI arguments
|
||||
const QStringList &arguments = lamexp_arguments();
|
||||
const QStringList &arguments = MUtils::OS::arguments();
|
||||
|
||||
//Init console
|
||||
lamexp_init_console(arguments);
|
||||
MUtils::Terminal::setup(arguments, MUTILS_DEBUG || lamexp_version_demo());
|
||||
|
||||
//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());
|
||||
qDebug("Copyright (c) 2004-%04d LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.", qMax(MUtils::Version::build_date().year(), MUtils::OS::current_date().year()));
|
||||
qDebug("Built on %s at %s with %s for Win-%s.\n", MUTILS_UTF8(MUtils::Version::build_date().toString(Qt::ISODate)), MUTILS_UTF8(MUtils::Version::build_time().toString(Qt::ISODate)), MUtils::Version::compiler_version(), MUtils::Version::compiler_arch());
|
||||
qDebug("Copyright (c) 2004-%04d LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.", qMax(MUtils::Version::app_build_date().year(), MUtils::OS::current_date().year()));
|
||||
qDebug("Built on %s at %s with %s for Win-%s.\n", MUTILS_UTF8(MUtils::Version::app_build_date().toString(Qt::ISODate)), MUTILS_UTF8(MUtils::Version::app_build_time().toString(Qt::ISODate)), MUtils::Version::compiler_version(), MUtils::Version::compiler_arch());
|
||||
|
||||
//print license info
|
||||
qDebug("This program is free software: you can redistribute it and/or modify");
|
||||
qDebug("it under the terms of the GNU General Public License <http://www.gnu.org/>.");
|
||||
qDebug("Note that this program is distributed with ABSOLUTELY NO WARRANTY.\n");
|
||||
|
||||
//Print library version
|
||||
qDebug("This application is powerd by MUtils library v%u.%02u (%s, %s).\n", MUtils::Version::lib_version_major(), MUtils::Version::lib_version_minor(), MUTILS_UTF8(MUtils::Version::lib_build_date().toString(Qt::ISODate)), MUTILS_UTF8(MUtils::Version::lib_build_time().toString(Qt::ISODate)));
|
||||
|
||||
//Print warning, if this is a "debug" build
|
||||
if(MUTILS_DEBUG)
|
||||
{
|
||||
@ -86,10 +90,10 @@ static int lamexp_main(int argc, char* argv[])
|
||||
{
|
||||
qDebug("argv[%d]=%s", i, MUTILS_UTF8(arguments.at(i)));
|
||||
}
|
||||
qDebug("");
|
||||
qDebug(" ");
|
||||
|
||||
//Detect CPU capabilities
|
||||
const MUtils::CPUFetaures::cpu_info_t cpuFeatures = MUtils::CPUFetaures::detect(lamexp_arguments());
|
||||
const MUtils::CPUFetaures::cpu_info_t cpuFeatures = MUtils::CPUFetaures::detect(MUtils::OS::arguments());
|
||||
qDebug(" CPU vendor id : %s (Intel=%s)", cpuFeatures.vendor, MUTILS_BOOL2STR(cpuFeatures.intel));
|
||||
qDebug("CPU brand string : %s", cpuFeatures.brand);
|
||||
qDebug(" CPU signature : Family=%d Model=%d Stepping=%d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping);
|
||||
@ -106,9 +110,9 @@ static int lamexp_main(int argc, char* argv[])
|
||||
if(lamexp_version_demo())
|
||||
{
|
||||
const QDate currentDate = MUtils::OS::current_date();
|
||||
if(currentDate.addDays(1) < MUtils::Version::build_date())
|
||||
if(currentDate.addDays(1) < MUtils::Version::app_build_date())
|
||||
{
|
||||
qFatal("System's date (%s) is before LameXP build date (%s). Huh?", currentDate.toString(Qt::ISODate).toLatin1().constData(), MUtils::Version::build_date().toString(Qt::ISODate).toLatin1().constData());
|
||||
qFatal("System's date (%s) is before LameXP build date (%s). Huh?", currentDate.toString(Qt::ISODate).toLatin1().constData(), MUtils::Version::app_build_date().toString(Qt::ISODate).toLatin1().constData());
|
||||
}
|
||||
qWarning(QString("Note: This demo (pre-release) version of LameXP will expire at %1.\n").arg(lamexp_version_expires().toString(Qt::ISODate)).toLatin1().constData());
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Global.h>
|
||||
#include <MUtils/OSSupport.h>
|
||||
|
||||
//Qt
|
||||
#include <QStringList>
|
||||
@ -53,7 +54,7 @@ void MessageProducerThread::run()
|
||||
{
|
||||
setTerminationEnabled(true);
|
||||
bool bSentFiles = false;
|
||||
const QStringList &arguments = lamexp_arguments(); //QApplication::arguments();
|
||||
const QStringList &arguments = MUtils::OS::arguments();
|
||||
|
||||
for(int i = 0; i < arguments.count(); i++)
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ bool ProcessThread::init(void)
|
||||
emit processStateInitialized(m_jobId, QFileInfo(m_audioFile.filePath()).fileName(), tr("Starting..."), ProgressModel::JobRunning);
|
||||
|
||||
//Initialize log
|
||||
handleMessage(QString().sprintf("LameXP v%u.%02u (Build #%u), compiled on %s at %s", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build(), MUtils::Version::build_date().toString(Qt::ISODate).toLatin1().constData(), MUtils::Version::build_time()));
|
||||
handleMessage(QString().sprintf("LameXP v%u.%02u (Build #%u), compiled on %s at %s", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build(), MUtils::Version::app_build_date().toString(Qt::ISODate).toLatin1().constData(), MUtils::Version::app_build_time()));
|
||||
handleMessage("\n-------------------------------\n");
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user