diff --git a/doomsday/tools/amethyst/amethyst.pro b/doomsday/tools/amethyst/amethyst.pro index c604b67b6a..173550d988 100644 --- a/doomsday/tools/amethyst/amethyst.pro +++ b/doomsday/tools/amethyst/amethyst.pro @@ -22,6 +22,10 @@ CONFIG -= app_bundle TEMPLATE = app TARGET = amethyst +greaterThan(QT_MAJOR_VERSION, 4) { + DEFINES += HAVE_QT5 +} + SOURCES += \ src/block.cpp \ src/callstack.cpp \ diff --git a/doomsday/tools/amethyst/src/main.cpp b/doomsday/tools/amethyst/src/main.cpp index 57557b7654..e17e35f51a 100644 --- a/doomsday/tools/amethyst/src/main.cpp +++ b/doomsday/tools/amethyst/src/main.cpp @@ -22,18 +22,30 @@ #include #ifndef _WIN32 +# ifdef HAVE_QT5 void messagePrinter(QtMsgType type, const QMessageLogContext &, const QString &msg) +# else +void messagePrinter(QtMsgType type, const char* msg) +# endif { switch(type) { case QtDebugMsg: case QtWarningMsg: case QtCriticalMsg: +# ifdef HAVE_QT5 fwprintf(stderr, L"%s\n", msg.toLatin1().constData()); +# else + fwprintf(stderr, L"%s\n", msg); +# endif break; case QtFatalMsg: +# ifdef HAVE_QT5 fwprintf(stderr, L"Fatal Error: %s\n", msg.toLatin1().constData()); +# else + fwprintf(stderr, L"Fatal Error: %s\n", msg); +# endif abort(); } } @@ -69,7 +81,11 @@ void printUsage(void) int main(int argc, char **argv) { #ifndef _WIN32 +# ifdef HAVE_QT5 qInstallMessageHandler(messagePrinter); +# else + qInstallMsgHandler(messagePrinter); +# endif #endif QCoreApplication a(argc, argv); // event loop never started