Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Bump minimum QT support to 5.9.5, Remove obsolete checks #2251

Merged
merged 2 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions build-aux/m4/bitcoin_qt.m4
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,26 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
AC_SUBST(QT_SELECT, qt5)
AC_SUBST(MOC_DEFS)

dnl Internal. Check if the included version of Qt meets our minimum of QT 5.9.5
dnl Requires: INCLUDES must be populated as necessary.
dnl Output: bitcoin_cv_qt5=yes|no
AC_DEFUN([_BITCOIN_QT_CHECK_QT5],[
AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QtCore/qconfig.h>
#ifndef QT_VERSION
# include <QtCore/qglobal.h>
#endif
]],
[[
#if QT_VERSION < 0x050905
choke
#endif
]])],
[bitcoin_cv_qt5=yes],
[bitcoin_cv_qt5=no])
])])

dnl Gridcoin: determine whether to disable macOS 10.14+ dark-mode. This feature
dnl needs Qt 5.12+. If we find an earlier version, the variable substitution in
dnl share/qt/Info.plist disables macos 10.14 appearance features like dark-mode
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ fi
BITCOIN_QT_INIT

dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
BITCOIN_QT_CONFIGURE([5.5.1])
BITCOIN_QT_CONFIGURE([5.9.5])

if test x$build_bitcoin_utils$build_gridcoinresearchd$bitcoin_enable_qt$use_tests$use_bench = xnonononono; then
use_boost=no
Expand Down
25 changes: 2 additions & 23 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ Q_IMPORT_PLUGIN(qtaccessiblewidgets)

#if defined(QT_STATICPLUGIN)
#include <QtPlugin>
#if QT_VERSION < 0x050400
Q_IMPORT_PLUGIN(AccessibleFactory)
#endif
#if defined(QT_QPA_PLATFORM_XCB)
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
#elif defined(QT_QPA_PLATFORM_WINDOWS)
Expand Down Expand Up @@ -220,16 +217,6 @@ static std::string Translate(const char* psz)
}

/* qDebug() message handler --> debug.log */
#if QT_VERSION < 0x050000
void DebugMessageHandler(QtMsgType type, const char *msg)
{
if (type == QtDebugMsg) {
LogPrint(BCLog::LogFlags::QT, "GUI: %s\n", msg);
} else {
LogPrintf("GUI: %s\n", msg);
}
}
#else
void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg)
{
Q_UNUSED(context);
Expand All @@ -239,7 +226,6 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, cons
LogPrintf("GUI: %s\n", msg.toStdString());
}
}
#endif

/* Handle runaway exceptions. Shows a message box with the problem and quits the program.
*/
Expand Down Expand Up @@ -295,9 +281,7 @@ int main(int argc, char *argv[])

// Generate high-dpi pixmaps
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#if QT_VERSION >= 0x050600
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif

// Initiate the app here to support choosing the data directory.
Q_INIT_RESOURCE(bitcoin);
Expand Down Expand Up @@ -350,7 +334,7 @@ int main(int argc, char *argv[])
// Install global event filter that suppresses help context question mark
app.installEventFilter(new GUIUtil::WindowContextHelpButtonHintFilter(&app));

#if defined(WIN32) && QT_VERSION >= 0x050000
#if defined(WIN32)
// Install global event filter for processing Windows session related Windows messages (WM_QUERYENDSESSION and WM_ENDSESSION)
app.installNativeEventFilter(new WinShutdownMonitor());
#endif
Expand Down Expand Up @@ -584,13 +568,8 @@ int StartGridcoinQt(int argc, char *argv[], QApplication& app, OptionsModel& opt

std::shared_ptr<ThreadHandler> threads = std::make_shared<ThreadHandler>();

#if QT_VERSION < 0x050000
// Install qDebug() message handler to route to debug.log
qInstallMsgHandler(DebugMessageHandler);
#else
// Install qDebug() message handler to route to debug.log
qInstallMessageHandler(DebugMessageHandler);
#endif

// Subscribe to global signals from core
uiInterface.ThreadSafeMessageBox.connect(ThreadSafeMessageBox);
Expand Down Expand Up @@ -680,7 +659,7 @@ int StartGridcoinQt(int argc, char *argv[], QApplication& app, OptionsModel& opt
// Place this here as guiref has to be defined if we don't want to lose URIs
ipcInit(argc, argv);

#if defined(WIN32) && defined(QT_GUI) && QT_VERSION >= 0x050000
#if defined(WIN32) && defined(QT_GUI)
WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(QObject::tr(PACKAGE_NAME)), (HWND)window.winId());
#endif

Expand Down
7 changes: 0 additions & 7 deletions src/qt/test/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@

#if defined(QT_STATICPLUGIN)
#include <QtPlugin>
#if QT_VERSION < 0x050000
Q_IMPORT_PLUGIN(qcncodecs)
Q_IMPORT_PLUGIN(qjpcodecs)
Q_IMPORT_PLUGIN(qtwcodecs)
Q_IMPORT_PLUGIN(qkrcodecs)
#else
#if defined(QT_QPA_PLATFORM_MINIMAL)
Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin);
#endif
Expand All @@ -22,7 +16,6 @@ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
#endif
#endif
#endif


// This is all you need to run all the tests
Expand Down
2 changes: 1 addition & 1 deletion src/qt/winshutdownmonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <qt/winshutdownmonitor.h>

#if defined(WIN32) && QT_VERSION >= 0x050000
#if defined(WIN32)
#include <init.h>
#include <util.h>

Expand Down
2 changes: 0 additions & 2 deletions src/qt/winshutdownmonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <QByteArray>
#include <QString>

#if QT_VERSION >= 0x050000
#include <windef.h> // for HWND

#include <QAbstractNativeEventFilter>
Expand All @@ -24,6 +23,5 @@ class WinShutdownMonitor : public QAbstractNativeEventFilter
static void registerShutdownBlockReason(const QString& strReason, const HWND& mainWinId);
};
#endif
#endif

#endif // BITCOIN_QT_WINSHUTDOWNMONITOR_H