Skip to content

Commit

Permalink
Amethyst|Fixed: Compiling with Qt 4
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 3, 2015
1 parent 60a1606 commit 1ae9c29
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doomsday/tools/amethyst/amethyst.pro
Expand Up @@ -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 \
Expand Down
16 changes: 16 additions & 0 deletions doomsday/tools/amethyst/src/main.cpp
Expand Up @@ -22,18 +22,30 @@
#include <QDebug>

#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();
}
}
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 1ae9c29

Please sign in to comment.