mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
gui: Remove QT_VERSION fallbacks for Qt < 5
There were surprisingly many `#ifdef` fallbacks for Qt 4. Remiving them simplifies maintenance, as well as adding new GUI functionality.
This commit is contained in:
@@ -55,13 +55,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)
|
||||
Q_IMPORT_PLUGIN(qtaccessiblewidgets)
|
||||
#else
|
||||
#if QT_VERSION < 0x050400
|
||||
Q_IMPORT_PLUGIN(AccessibleFactory)
|
||||
#endif
|
||||
@@ -73,11 +66,6 @@ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
||||
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QTextCodec>
|
||||
#endif
|
||||
|
||||
// Declare meta types used for QMetaObject::invokeMethod
|
||||
Q_DECLARE_METATYPE(bool*)
|
||||
@@ -151,16 +139,6 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans
|
||||
}
|
||||
|
||||
/* qDebug() message handler --> debug.log */
|
||||
#if QT_VERSION < 0x050000
|
||||
void DebugMessageHandler(QtMsgType type, const char *msg)
|
||||
{
|
||||
if (type == QtDebugMsg) {
|
||||
LogPrint(BCLog::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);
|
||||
@@ -170,7 +148,6 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, cons
|
||||
LogPrintf("GUI: %s\n", msg.toStdString());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Class encapsulating Bitcoin Core startup and shutdown.
|
||||
* Allows running startup and shutdown in a different thread from the UI thread.
|
||||
@@ -572,12 +549,6 @@ int main(int argc, char *argv[])
|
||||
// Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory
|
||||
|
||||
/// 1. Basic Qt initialization (not dependent on parameters or configuration)
|
||||
#if QT_VERSION < 0x050000
|
||||
// Internal string conversion is all UTF-8
|
||||
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
|
||||
#endif
|
||||
|
||||
Q_INIT_RESOURCE(bitcoin);
|
||||
Q_INIT_RESOURCE(bitcoin_locale);
|
||||
|
||||
@@ -708,17 +679,12 @@ int main(int argc, char *argv[])
|
||||
/// 9. Main GUI initialization
|
||||
// Install global event filter that makes sure that long tooltips can be word-wrapped
|
||||
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
|
||||
#if QT_VERSION < 0x050000
|
||||
// Install qDebug() message handler to route to debug.log
|
||||
qInstallMsgHandler(DebugMessageHandler);
|
||||
#else
|
||||
#if defined(Q_OS_WIN)
|
||||
// Install global event filter for processing Windows session related Windows messages (WM_QUERYENDSESSION and WM_ENDSESSION)
|
||||
qApp->installNativeEventFilter(new WinShutdownMonitor());
|
||||
#endif
|
||||
// Install qDebug() message handler to route to debug.log
|
||||
qInstallMessageHandler(DebugMessageHandler);
|
||||
#endif
|
||||
// Allow parameter interaction before we create the options model
|
||||
app.parameterSetup();
|
||||
// Load GUI settings from QSettings
|
||||
@@ -739,7 +705,7 @@ int main(int argc, char *argv[])
|
||||
// so the GUI thread won't be held up.
|
||||
if (node->baseInitialize()) {
|
||||
app.requestInitialize();
|
||||
#if defined(Q_OS_WIN) && QT_VERSION >= 0x050000
|
||||
#if defined(Q_OS_WIN)
|
||||
WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("%1 didn't yet exit safely...").arg(QObject::tr(PACKAGE_NAME)), (HWND)app.getMainWinId());
|
||||
#endif
|
||||
app.exec();
|
||||
|
||||
Reference in New Issue
Block a user