Added macros for a Unicode-safe version of qDebug(), qWarning() and qFatal(). These will pass the UFT-8 string with a Base64 encoding.

This commit is contained in:
LoRd_MuldeR 2011-03-12 21:58:46 +01:00
parent deff9ec023
commit c4983e3a4c
6 changed files with 12 additions and 7 deletions

View File

@ -272,7 +272,7 @@ switching to the 'Compatibility' tab and un-checking the 'Run this program in co
<a name="328b0a18"><b>Why do I get the error 'Executable requires Windows 2000 or later' on startup?</b></a><br> <a name="328b0a18"><b>Why do I get the error 'Executable requires Windows 2000 or later' on startup?</b></a><br>
<br> <br>
You are trying to run LameXP on a platform that is NOT supported, such as Windows 95, Windows 98 or Windows<br> You are trying to run LameXP on a platform that is NOT supported, such as Windows 95, Windows 98, Windows<br>
Millenium Edition or Windows NT 4.0. There is nothing you can do about that, except for updating to a less<br> Millenium Edition or Windows NT 4.0. There is nothing you can do about that, except for updating to a less<br>
antiquated OS. Note: This can also happen, if your system is configured to run LameXP in <a href="#e7c9ae2b">compatibility mode</a>.<br><br> antiquated OS. Note: This can also happen, if your system is configured to run LameXP in <a href="#e7c9ae2b">compatibility mode</a>.<br><br>

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 1 #define VER_LAMEXP_MINOR_LO 1
#define VER_LAMEXP_BUILD 366 #define VER_LAMEXP_BUILD 367
#define VER_LAMEXP_SUFFIX Beta-8 #define VER_LAMEXP_SUFFIX Beta-8
/* /*

View File

@ -207,7 +207,7 @@ bool lamexp_version_demo(void)
QDate lamexp_version_expires(void) QDate lamexp_version_expires(void)
{ {
return lamexp_version_date().addDays(30); return lamexp_version_date().addDays(LAMEXP_DEBUG ? 2 : 30);
} }
/* /*
@ -354,7 +354,7 @@ void lamexp_message_handler(QtMsgType type, const char *msg)
void lamexp_init_console(int argc, char* argv[]) void lamexp_init_console(int argc, char* argv[])
{ {
bool enableConsole = lamexp_version_demo(); bool enableConsole = lamexp_version_demo();
for(int i = 0; i < argc; i++) for(int i = 0; i < argc; i++)
{ {
if(!_stricmp(argv[i], "--console")) if(!_stricmp(argv[i], "--console"))

View File

@ -123,6 +123,11 @@ SIZE_T lamexp_dbg_private_bytes(void);
#define LAMEXP_DYNCAST(OUT,CLASS,SRC) try { OUT = dynamic_cast<CLASS>(SRC); } catch(std::bad_cast) { OUT = NULL; } #define LAMEXP_DYNCAST(OUT,CLASS,SRC) try { OUT = dynamic_cast<CLASS>(SRC); } catch(std::bad_cast) { OUT = NULL; }
#define LAMEXP_BOOL(X) (X ? "1" : "0") #define LAMEXP_BOOL(X) (X ? "1" : "0")
//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());
//Check for debug build //Check for debug build
#if defined(_DEBUG) || defined(QT_DEBUG) || !defined(NDEBUG) || !defined(QT_NO_DEBUG) #if defined(_DEBUG) || defined(QT_DEBUG) || !defined(NDEBUG) || !defined(QT_NO_DEBUG)
#define LAMEXP_DEBUG 1 #define LAMEXP_DEBUG 1

View File

@ -74,7 +74,7 @@ void FileAnalyzer::run()
while(!m_inputFiles.isEmpty()) while(!m_inputFiles.isEmpty())
{ {
QString currentFile = QDir::fromNativeSeparators(m_inputFiles.takeFirst()); QString currentFile = QDir::fromNativeSeparators(m_inputFiles.takeFirst());
qDebug("@BASE64@%s", QString("Analyzing: %1").arg(currentFile).toUtf8().toBase64().constData()); qDebug64("Analyzing: %1", currentFile);
emit fileSelected(QFileInfo(currentFile).fileName()); emit fileSelected(QFileInfo(currentFile).fileName());
AudioFileModel file = analyzeFile(currentFile); AudioFileModel file = analyzeFile(currentFile);
if(file.fileName().isEmpty() || file.formatContainerType().isEmpty() || file.formatAudioType().isEmpty()) if(file.fileName().isEmpty() || file.formatContainerType().isEmpty() || file.formatAudioType().isEmpty())
@ -82,7 +82,7 @@ void FileAnalyzer::run()
if(!PlaylistImporter::importPlaylist(m_inputFiles, currentFile)) if(!PlaylistImporter::importPlaylist(m_inputFiles, currentFile))
{ {
m_filesRejected++; m_filesRejected++;
qDebug("@BASE64@%s", QString("Skipped: %1").arg(file.filePath()).toUtf8().toBase64().constData()); qDebug64("Skipped: %1", file.filePath());
} }
continue; continue;
} }

View File

@ -228,7 +228,7 @@ void InitializationThread::initTranslations(void)
if(lamexp_translation_register(langId, qmFile, langName, systemId)) if(lamexp_translation_register(langId, qmFile, langName, systemId))
{ {
qDebug("@BASE64@%s", QString("Registering translation: %1 = %2 (%3)").arg(qmFile, langName, QString::number(systemId)).toUtf8().toBase64().constData()); qDebug64("Registering translation: %1 = %2 (%3)", qmFile, langName, QString::number(systemId));
} }
else else
{ {