From 4f53179752c412e1c4c169cd060eceaf5d002954 Mon Sep 17 00:00:00 2001 From: nowrep Date: Mon, 18 Feb 2013 13:37:12 +0100 Subject: [PATCH] [Qt5] Fixed building with Qt5. --- src/lib/plugins/qtwebkit/qtwebkitplugin.cpp | 4 ++++ src/main/main.cpp | 25 +++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/lib/plugins/qtwebkit/qtwebkitplugin.cpp b/src/lib/plugins/qtwebkit/qtwebkitplugin.cpp index 07ae8414d..ad35b69d4 100644 --- a/src/lib/plugins/qtwebkit/qtwebkitplugin.cpp +++ b/src/lib/plugins/qtwebkit/qtwebkitplugin.cpp @@ -56,4 +56,8 @@ QObject* QtWebKitPlugin::createExtension(Extension ext) const Q_EXPORT_PLUGIN2(qtwebkitplugins, QtWebKitPlugin) #endif +#if (QT_VERSION < 0x050000) Q_IMPORT_PLUGIN(qtwebkitplugins) +#else +Q_IMPORT_PLUGIN(QtWebKitPlugin) +#endif diff --git a/src/main/main.cpp b/src/main/main.cpp index 2293910f1..c6f81788d 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -113,6 +113,7 @@ void qupzilla_signal_handler(int s) } #endif +#if (QT_VERSION < 0x050000) void msgHandler(QtMsgType type, const char* msg) { // Skip this debug message as it may occur in a large amount over time @@ -135,12 +136,36 @@ void msgHandler(QtMsgType type, const char* msg) break; } } +#else +void msgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) +{ + QByteArray localMsg = msg.toLocal8Bit(); + switch (type) { + case QtDebugMsg: + case QtWarningMsg: + case QtCriticalMsg: + fprintf(stderr, "%s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); + break; + case QtFatalMsg: + fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); + abort(); + + default: + break; + } +} +#endif int main(int argc, char* argv[]) { QT_REQUIRE_VERSION(argc, argv, "4.7.0"); + +#if (QT_VERSION < 0x050000) qInstallMsgHandler(&msgHandler); +#else + qInstallMessageHandler(&msgHandler); +#endif #if defined(QZ_WS_X11) && QT_VERSION < 0x050000 QApplication::setGraphicsSystem("raster"); // Better overall performance on X11