Set text codec to UTF-8, so qDebug/qWarning/qFatal don't destroy Unicode strings. Also remove qDebug64() and friends, as we don't need them any more.
This commit is contained in:
parent
9f011cb572
commit
282528ea67
@ -2684,17 +2684,17 @@
|
||||
<context>
|
||||
<name>QApplication</name>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="683"/>
|
||||
<location filename="../../src/Global.cpp" line="671"/>
|
||||
<source>Executable '%1' doesn't support Windows compatibility mode.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="770"/>
|
||||
<location filename="../../src/Global.cpp" line="758"/>
|
||||
<source>Executable '%1' requires Qt v%2, but found Qt v%3.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/Global.cpp" line="779"/>
|
||||
<location filename="../../src/Global.cpp" line="767"/>
|
||||
<source>Executable '%1' requires Windows 2000 or later.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 3
|
||||
#define VER_LAMEXP_TYPE Beta
|
||||
#define VER_LAMEXP_PATCH 2
|
||||
#define VER_LAMEXP_BUILD 700
|
||||
#define VER_LAMEXP_BUILD 702
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Tools versions
|
||||
|
@ -745,13 +745,13 @@ void MainWindow::dropEvent(QDropEvent *event)
|
||||
}
|
||||
if(file.isFile())
|
||||
{
|
||||
qDebug64("Dropped File: %1", file.canonicalFilePath());
|
||||
qDebug("Dropped File: %s", file.canonicalFilePath().toUtf8().constData());
|
||||
droppedFiles << file.canonicalFilePath();
|
||||
continue;
|
||||
}
|
||||
if(file.isDir())
|
||||
{
|
||||
qDebug64("Dropped Folder: %1", file.canonicalFilePath());
|
||||
qDebug("Dropped Folder: %s", file.canonicalFilePath().toUtf8().constData());
|
||||
QList<QFileInfo> list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Files | QDir::NoSymLinks);
|
||||
if(list.count() > 0)
|
||||
{
|
||||
@ -765,7 +765,7 @@ void MainWindow::dropEvent(QDropEvent *event)
|
||||
list = QDir(file.canonicalFilePath()).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
|
||||
for(int j = 0; j < list.count(); j++)
|
||||
{
|
||||
qDebug64("Descending to Folder: %1", list.at(j).canonicalFilePath());
|
||||
qDebug("Descending to Folder: %s", list.at(j).canonicalFilePath().toUtf8().constData());
|
||||
urls.prepend(QUrl::fromLocalFile(list.at(j).canonicalFilePath()));
|
||||
}
|
||||
}
|
||||
|
@ -368,17 +368,14 @@ static void lamexp_console_color(FILE* file, WORD attributes)
|
||||
void lamexp_message_handler(QtMsgType type, const char *msg)
|
||||
{
|
||||
static const char *GURU_MEDITATION = "\n\nGURU MEDITATION !!!\n\n";
|
||||
|
||||
const char *text = msg;
|
||||
const char *buffer = NULL;
|
||||
|
||||
QMutexLocker lock(&g_lamexp_message_mutex);
|
||||
|
||||
if((strlen(msg) > 8) && (_strnicmp(msg, "@BASE64@", 8) == 0))
|
||||
{
|
||||
buffer = _strdup(QByteArray::fromBase64(msg + 8).constData());
|
||||
if(buffer) text = buffer;
|
||||
}
|
||||
//if((strlen(msg) > 8) && (_strnicmp(msg, "@BASE64@", 8) == 0))
|
||||
//{
|
||||
// buffer = _strdup(QByteArray::fromBase64(msg + 8).constData());
|
||||
// if(buffer) text = buffer;
|
||||
//}
|
||||
|
||||
if(g_lamexp_console_attached)
|
||||
{
|
||||
@ -393,17 +390,17 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
||||
fflush(stderr);
|
||||
lamexp_console_color(stderr, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
fprintf(stderr, GURU_MEDITATION);
|
||||
fprintf(stderr, "%s\n", text);
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
fflush(stderr);
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
lamexp_console_color(stderr, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
fprintf(stderr, "%s\n", text);
|
||||
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", text);
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
fflush(stderr);
|
||||
break;
|
||||
}
|
||||
@ -413,42 +410,33 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
|
||||
}
|
||||
else
|
||||
{
|
||||
char temp[1024] = {'\0'};
|
||||
QString temp("[LameXP][%1] %2");
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case QtCriticalMsg:
|
||||
case QtFatalMsg:
|
||||
_snprintf_s(temp, 1024, _TRUNCATE, "[LameXP][C] %s", text);
|
||||
temp = temp.arg("C", QString::fromUtf8(msg));
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
_snprintf_s(temp, 1024, _TRUNCATE, "[LameXP][C] %s", text);
|
||||
temp = temp.arg("W", QString::fromUtf8(msg));
|
||||
break;
|
||||
default:
|
||||
_snprintf_s(temp, 1024, _TRUNCATE, "[LameXP][C] %s", text);
|
||||
temp = temp.arg("I", QString::fromUtf8(msg));
|
||||
break;
|
||||
}
|
||||
|
||||
char *ptr = strchr(temp, '\n');
|
||||
while(ptr != NULL)
|
||||
{
|
||||
*ptr = '\t';
|
||||
ptr = strchr(temp, '\n');
|
||||
}
|
||||
|
||||
strncat_s(temp, 1024, "\n", _TRUNCATE);
|
||||
OutputDebugStringA(temp);
|
||||
temp.replace("\n", "\t").append("\n");
|
||||
OutputDebugStringA(temp.toLatin1().constData());
|
||||
}
|
||||
|
||||
if(type == QtCriticalMsg || type == QtFatalMsg)
|
||||
{
|
||||
lock.unlock();
|
||||
MessageBoxW(NULL, QWCHAR(QString::fromUtf8(text)), L"LameXP - GURU MEDITATION", MB_ICONERROR | MB_TOPMOST | MB_TASKMODAL);
|
||||
MessageBoxW(NULL, QWCHAR(QString::fromUtf8(msg)), L"LameXP - GURU MEDITATION", MB_ICONERROR | MB_TOPMOST | MB_TASKMODAL);
|
||||
FatalAppExit(0, L"The application has encountered a critical error and will exit now!");
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
}
|
||||
|
||||
LAMEXP_SAFE_FREE(buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -822,6 +810,9 @@ bool lamexp_init_qt(int argc, char* argv[])
|
||||
application->setOrganizationDomain("mulder.at.gg");
|
||||
application->setWindowIcon((date.month() == 12 && date.day() >= 24 && date.day() <= 26) ? QIcon(":/MainIcon2.png") : QIcon(":/MainIcon.png"));
|
||||
|
||||
//Set text Codec for locale
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
||||
|
||||
//Load plugins from application directory
|
||||
QCoreApplication::setLibraryPaths(QStringList() << QApplication::applicationDirPath());
|
||||
qDebug("Library Path:\n%s\n", QApplication::libraryPaths().first().toUtf8().constData());
|
||||
|
@ -140,9 +140,9 @@ SIZE_T lamexp_dbg_private_bytes(void);
|
||||
#define LAMEXP_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" LAMEXP_MAKE_STRING(__LINE__) ") : warning: " TXT))
|
||||
|
||||
//Output Qt debug message (Unicode-safe versions)
|
||||
#define qDebug64(FORMAT, ...) qDebug("@BASE64@%s", QString(FORMAT).arg(__VA_ARGS__).toUtf8().toBase64().constData());
|
||||
#define qWarning64(FORMAT, ...) qWarning("@BASE64@%s", QString(FORMAT).arg(__VA_ARGS__).toUtf8().toBase64().constData());
|
||||
#define qFatal64(FORMAT, ...) qFatal("@BASE64@%s", QString(FORMAT).arg(__VA_ARGS__).toUtf8().toBase64().constData());
|
||||
//#define qDebug64(FORMAT, ...) qDebug("@BASE64@%s", QString(FORMAT).arg(__VA_ARGS__).toUtf8().toBase64().constData());
|
||||
//#define qWarning64(FORMAT, ...) qWarning("@BASE64@%s", QString(FORMAT).arg(__VA_ARGS__).toUtf8().toBase64().constData());
|
||||
//#define qFatal64(FORMAT, ...) qFatal("@BASE64@%s", QString(FORMAT).arg(__VA_ARGS__).toUtf8().toBase64().constData());
|
||||
|
||||
//Check for debug build
|
||||
#if defined(_DEBUG) && defined(QT_DEBUG) && !defined(NDEBUG) && !defined(QT_NO_DEBUG)
|
||||
|
@ -73,8 +73,8 @@ void DiskObserverThread::observe(void)
|
||||
freeSpace = lamexp_free_diskspace(m_path);
|
||||
if(freeSpace < minimumSpace)
|
||||
{
|
||||
qWarning64("Free diskspace on '%1' dropped below %2 MB, only %3 MB free!", m_path, QString::number(minimumSpace / 1048576), QString::number(freeSpace / 1048576));
|
||||
emit messageLogged(tr("Low diskspace on drive '%1' detected (only %2 MB are free), problems can occur!").arg(QDir::toNativeSeparators(m_path), QString::number(freeSpace / 1048576)), true);
|
||||
qWarning("Free diskspace on '%s' dropped below %s MB, only %s MB free!", m_path.toUtf8().constData(), QString::number(minimumSpace / 1048576ui64).toUtf8().constData(), QString::number(freeSpace / 1048576ui64).toUtf8().constData());
|
||||
emit messageLogged(tr("Low diskspace on drive '%1' detected (only %2 MB are free), problems can occur!").arg(QDir::toNativeSeparators(m_path), QString::number(freeSpace / 1048576ui64)), true);
|
||||
minimumSpace = min(freeSpace, (minimumSpace >> 1));
|
||||
}
|
||||
Sleep(1000);
|
||||
|
@ -84,7 +84,7 @@ void FileAnalyzer::run()
|
||||
{
|
||||
int fileType = fileTypeNormal;
|
||||
QString currentFile = QDir::fromNativeSeparators(m_inputFiles.takeFirst());
|
||||
qDebug64("Analyzing: %1", currentFile);
|
||||
qDebug("Analyzing: %s", currentFile.toUtf8().constData());
|
||||
emit fileSelected(QFileInfo(currentFile).fileName());
|
||||
AudioFileModel file = analyzeFile(currentFile, &fileType);
|
||||
|
||||
@ -134,13 +134,13 @@ void FileAnalyzer::run()
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug64("Rejected Avisynth file: %1", file.filePath());
|
||||
qDebug("Rejected Avisynth file: %s", file.filePath().toUtf8().constData());
|
||||
m_filesRejected++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug64("Rejected file of unknown type: %1", file.filePath());
|
||||
qDebug("Rejected file of unknown type: %s", file.filePath().toUtf8().constData());
|
||||
m_filesRejected++;
|
||||
}
|
||||
continue;
|
||||
@ -513,7 +513,7 @@ bool FileAnalyzer::checkFile_CDDA(QFile &file)
|
||||
|
||||
void FileAnalyzer::retrieveCover(AudioFileModel &audioFile, const QString &filePath)
|
||||
{
|
||||
qDebug64("Retrieving cover from: %1", filePath);
|
||||
qDebug("Retrieving cover from: %s", filePath.toUtf8().constData());
|
||||
QString extension;
|
||||
|
||||
switch(m_currentCover)
|
||||
|
@ -299,7 +299,7 @@ void InitializationThread::initTranslations(void)
|
||||
|
||||
if(lamexp_translation_register(langId, qmFile, langName, systemId))
|
||||
{
|
||||
qDebug64("Registering translation: %1 = %2 (%3)", qmFile, langName, QString::number(systemId));
|
||||
qDebug("Registering translation: %s = %s (%u)", qmFile.toUtf8().constData(), langName.toUtf8().constData(), systemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user