From 1edb1513c5f4f7d7baf552bc4c2b85c7d1ea23c7 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Sun, 21 Jul 2024 01:04:03 +0200 Subject: [PATCH] FEAT: Add Qt 6 support --- src/Ban.cpp | 2 +- src/Ban.h | 2 +- src/FFDHE.h | 5 ++- src/HostAddress.cpp | 6 ++-- src/HostAddress.h | 2 +- src/PacketDataStream.h | 2 +- src/QtUtils.h | 2 +- src/SSL.cpp | 8 ++--- src/ServerAddress.cpp | 4 +-- src/ServerAddress.h | 2 +- src/UnresolvedServerAddress.cpp | 4 +-- src/UnresolvedServerAddress.h | 2 +- src/Version.cpp | 16 +++++---- src/mumble/API_v_1_x_x.cpp | 9 +++-- src/mumble/Accessibility.cpp | 5 ++- src/mumble/Cert.cpp | 6 ++-- src/mumble/ConfigDialog.cpp | 1 - src/mumble/ConnectDialog.cpp | 20 +++++++---- src/mumble/ConnectDialog.h | 4 +++ src/mumble/CrashReporter.cpp | 4 +-- src/mumble/Database.cpp | 2 +- src/mumble/GKey.cpp | 6 +++- src/mumble/GlobalShortcut.cpp | 29 +++++++++++----- src/mumble/GlobalShortcut_win.cpp | 12 +++++-- src/mumble/Log.cpp | 25 ++++++++------ src/mumble/MainWindow.cpp | 5 ++- src/mumble/MainWindow.h | 4 +++ src/mumble/Markdown.cpp | 48 ++++++++++---------------- src/mumble/MumbleApplication.cpp | 6 +++- src/mumble/MumbleApplication.h | 4 +++ src/mumble/OverlayClient.cpp | 19 +++++++--- src/mumble/OverlayConfig.cpp | 1 - src/mumble/OverlayEditor.cpp | 4 +++ src/mumble/OverlayEditor.h | 4 +++ src/mumble/OverlayEditorScene.cpp | 11 +++--- src/mumble/OverlayPositionableItem.cpp | 4 +-- src/mumble/OverlayText.cpp | 5 +-- src/mumble/OverlayUser.cpp | 11 +++--- src/mumble/PluginInstaller.cpp | 3 ++ src/mumble/PluginInstaller.h | 4 +++ src/mumble/PluginUpdater.cpp | 3 +- src/mumble/RichTextEditor.cpp | 13 ++++--- src/mumble/SearchDialog.cpp | 5 ++- src/mumble/ServerHandler.cpp | 5 +-- src/mumble/Settings.cpp | 14 ++++---- src/mumble/Settings.h | 3 +- src/mumble/TalkingUI.cpp | 28 ++++++++++----- src/mumble/ThemeInfo.cpp | 8 ++--- src/mumble/Translations.cpp | 11 +++--- src/mumble/VoiceRecorder.cpp | 9 +++-- src/mumble/WebFetch.cpp | 6 ++-- src/mumble/XMLTools.cpp | 2 +- src/mumble/main.cpp | 4 +-- src/murmur/Meta.cpp | 23 ++++++++---- src/murmur/Meta.h | 5 +-- src/murmur/MumbleServerIce.cpp | 4 +-- src/murmur/PBKDF2.cpp | 1 + src/murmur/Server.cpp | 47 ++++++++++++++++++++----- src/murmur/Server.h | 5 +-- src/murmur/ServerDB.cpp | 8 ++--- src/murmur/ServerDB.h | 5 +-- src/murmur/Tray.cpp | 6 +++- src/murmur/main.cpp | 8 +++-- 63 files changed, 339 insertions(+), 197 deletions(-) diff --git a/src/Ban.cpp b/src/Ban.cpp index 6ff7be1cf4..6816b08167 100644 --- a/src/Ban.cpp +++ b/src/Ban.cpp @@ -37,6 +37,6 @@ QString Ban::toString() const { iDuration == 0 ? QLatin1String("(permanent)") : QLatin1String("(temporary)")); } -quint32 qHash(const Ban &b) { +std::size_t qHash(const Ban &b) { return qHash(b.qsHash) ^ qHash(b.haAddress) ^ qHash(b.qsUsername) ^ qHash(b.iMask); } diff --git a/src/Ban.h b/src/Ban.h index 5e9a4f2008..0c0cb2ca66 100644 --- a/src/Ban.h +++ b/src/Ban.h @@ -29,6 +29,6 @@ struct Ban { QString toString() const; }; -quint32 qHash(const Ban &); +std::size_t qHash(const Ban &); #endif diff --git a/src/FFDHE.h b/src/FFDHE.h index 4e1bfa3a95..25a1be05b1 100644 --- a/src/FFDHE.h +++ b/src/FFDHE.h @@ -6,9 +6,8 @@ #ifndef MUMBLE_FFDHE_H_ #define MUMBLE_FFDHE_H_ -class QByteArray; -class QString; -class QStringList; +#include +#include /// FFDHE provides access to the Diffie-Hellman parameters from RFC 7919. class FFDHE { diff --git a/src/HostAddress.cpp b/src/HostAddress.cpp index a68096cb70..b86d080e7a 100644 --- a/src/HostAddress.cpp +++ b/src/HostAddress.cpp @@ -7,6 +7,8 @@ #include "ByteSwap.h" +#include + #ifdef Q_OS_WIN # include "win.h" # include @@ -180,7 +182,7 @@ void HostAddress::setByte(std::size_t idx, std::uint8_t value) { m_byteRepresentation[idx] = value; } -quint32 qHash(const HostAddress &ha) { +std::size_t qHash(const HostAddress &ha) { return qHashRange(ha.m_byteRepresentation.begin(), ha.m_byteRepresentation.end()); } @@ -202,7 +204,7 @@ QString HostAddress::toString(bool bracketEnclosed) const { ntohs(shortArray[4]), ntohs(shortArray[5]), ntohs(shortArray[6]), ntohs(shortArray[7]), squareBracketClose); - return str.replace(QRegExp(QLatin1String("(:0)+")), QLatin1String(":")); + return str.replace(QRegularExpression(QLatin1String("(:0)+")), QLatin1String(":")); } else { return bracketEnclosed ? QLatin1String("[::]") : QLatin1String("::"); } diff --git a/src/HostAddress.h b/src/HostAddress.h index c9b693e88f..1beb09c96d 100644 --- a/src/HostAddress.h +++ b/src/HostAddress.h @@ -46,7 +46,7 @@ struct HostAddress { void setByte(std::size_t idx, std::uint8_t value); - friend quint32 qHash(const HostAddress &); + friend std::size_t qHash(const HostAddress &); private: // Binary representation of an IPv6 address diff --git a/src/PacketDataStream.h b/src/PacketDataStream.h index 03b97d6b54..20eecba500 100644 --- a/src/PacketDataStream.h +++ b/src/PacketDataStream.h @@ -289,7 +289,7 @@ class PacketDataStream { return *this; \ } - + INTMAPOPERATOR(qsizetype); INTMAPOPERATOR(int); INTMAPOPERATOR(unsigned int); INTMAPOPERATOR(short); diff --git a/src/QtUtils.h b/src/QtUtils.h index 6fb0bd5221..fbddd7da54 100644 --- a/src/QtUtils.h +++ b/src/QtUtils.h @@ -8,11 +8,11 @@ #include #include +#include #include class QObject; -class QStringList; namespace Mumble { namespace QtUtils { diff --git a/src/SSL.cpp b/src/SSL.cpp index bb30f7e9f5..dd4b6502fa 100644 --- a/src/SSL.cpp +++ b/src/SSL.cpp @@ -155,14 +155,12 @@ void MumbleSSL::addSystemCA() { QString MumbleSSL::protocolToString(QSsl::SslProtocol protocol) { switch (protocol) { - case QSsl::SslV3: - return QLatin1String("SSL 3"); - case QSsl::SslV2: - return QLatin1String("SSL 2"); +#if QT_VERSION < 0x060300 case QSsl::TlsV1_0: return QLatin1String("TLS 1.0"); case QSsl::TlsV1_1: return QLatin1String("TLS 1.1"); +#endif case QSsl::TlsV1_2: return QLatin1String("TLS 1.2"); #if QT_VERSION >= 0x050C00 @@ -171,8 +169,6 @@ QString MumbleSSL::protocolToString(QSsl::SslProtocol protocol) { #endif case QSsl::AnyProtocol: return QLatin1String("AnyProtocol"); - case QSsl::TlsV1SslV3: - return QLatin1String("TlsV1SslV3"); case QSsl::SecureProtocols: return QLatin1String("SecureProtocols"); default: diff --git a/src/ServerAddress.cpp b/src/ServerAddress.cpp index a67ee71828..187f8609a2 100644 --- a/src/ServerAddress.cpp +++ b/src/ServerAddress.cpp @@ -31,6 +31,6 @@ bool operator<(const ServerAddress &lhs, const ServerAddress &rhs) { return false; } -uint qHash(const ServerAddress &key) { - return qHash(key.host) ^ uint(key.port); +std::size_t qHash(const ServerAddress &key) { + return qHash(key.host) ^ static_cast< std::size_t >(key.port); } diff --git a/src/ServerAddress.h b/src/ServerAddress.h index e0424d96d7..5dda6d5a8b 100644 --- a/src/ServerAddress.h +++ b/src/ServerAddress.h @@ -43,6 +43,6 @@ bool operator<(const ServerAddress &lhs, const ServerAddress &rhs); /// Implementation of qHash for ServerAddress, such that ServerAddress /// can be used as a key in QHash, QMap, etc. -uint qHash(const ServerAddress &key); +std::size_t qHash(const ServerAddress &key); #endif diff --git a/src/UnresolvedServerAddress.cpp b/src/UnresolvedServerAddress.cpp index fbaa2a47be..6d76ad793e 100644 --- a/src/UnresolvedServerAddress.cpp +++ b/src/UnresolvedServerAddress.cpp @@ -38,6 +38,6 @@ bool operator<(const UnresolvedServerAddress &lhs, const UnresolvedServerAddress return false; } -uint qHash(const UnresolvedServerAddress &key) { - return qHash(key.hostname) ^ uint(key.port); +std::size_t qHash(const UnresolvedServerAddress &key) { + return qHash(key.hostname) ^ static_cast< std::size_t >(key.port); } diff --git a/src/UnresolvedServerAddress.h b/src/UnresolvedServerAddress.h index e2d60621de..1237b2c9aa 100644 --- a/src/UnresolvedServerAddress.h +++ b/src/UnresolvedServerAddress.h @@ -42,6 +42,6 @@ bool operator<(const UnresolvedServerAddress &lhs, const UnresolvedServerAddress /// Implementation of qHash for UnresolvedServerAddress, such that /// UnresolvedServerAddress can be used as a key in QHash, QMap, etc. -uint qHash(const UnresolvedServerAddress &key); +std::size_t qHash(const UnresolvedServerAddress &key); #endif diff --git a/src/Version.cpp b/src/Version.cpp index 19cfee9769..17ac3641a0 100644 --- a/src/Version.cpp +++ b/src/Version.cpp @@ -6,7 +6,7 @@ #include "Version.h" #include -#include +#include namespace Version { @@ -69,12 +69,14 @@ QString toConfigString(Version::full_t v) { bool getComponents(Version::component_t &major, Version::component_t &minor, Version::component_t &patch, const QString &version) { - QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)\\.(\\d+)(?:\\.(\\d+))?")); - - if (rx.exactMatch(version)) { - major = static_cast< Version::component_t >(rx.cap(1).toInt()); - minor = static_cast< Version::component_t >(rx.cap(2).toInt()); - patch = static_cast< Version::component_t >(rx.cap(3).toInt()); + constexpr QLatin1StringView pattern("(\\d+)\\.(\\d+)\\.(\\d+)(?:\\.(\\d+))?"); + const QRegularExpression rx(QRegularExpression::anchoredPattern(pattern)); + const QRegularExpressionMatch match = rx.matchView(version); + + if (match.hasMatch()) { + major = static_cast< Version::component_t >(match.captured(1).toInt()); + minor = static_cast< Version::component_t >(match.captured(2).toInt()); + patch = static_cast< Version::component_t >(match.captured(3).toInt()); return true; } diff --git a/src/mumble/API_v_1_x_x.cpp b/src/mumble/API_v_1_x_x.cpp index a787d7924a..954115c748 100644 --- a/src/mumble/API_v_1_x_x.cpp +++ b/src/mumble/API_v_1_x_x.cpp @@ -1213,8 +1213,13 @@ QVariant getMumbleSettingHelper(mumble_settings_key_t key) { // IS_TYPE actually only checks if the QVariant can be converted to the needed type since that's all that we really care // about at the end of the day. -#define IS_TYPE(var, varType) static_cast< QMetaType::Type >(var.type()) == varType -#define IS_NOT_TYPE(var, varType) static_cast< QMetaType::Type >(var.type()) != varType +#if QT_VERSION >= 0x060000 +# define IS_TYPE(var, varType) static_cast< QMetaType::Type >(var.typeId()) == varType +# define IS_NOT_TYPE(var, varType) static_cast< QMetaType::Type >(var.typeId()) != varType +#else +# define IS_TYPE(var, varType) static_cast< QMetaType::Type >(var.type()) == varType +# define IS_NOT_TYPE(var, varType) static_cast< QMetaType::Type >(var.type()) != varType +#endif void MumbleAPI::getMumbleSetting_bool_v_1_0_x(mumble_plugin_id_t callerID, mumble_settings_key_t key, bool *outValue, std::shared_ptr< api_promise_t > promise) { diff --git a/src/mumble/Accessibility.cpp b/src/mumble/Accessibility.cpp index f8ccd96e6e..ed6cd27727 100644 --- a/src/mumble/Accessibility.cpp +++ b/src/mumble/Accessibility.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -18,7 +19,9 @@ namespace Mumble { namespace Accessibility { - QString removeHTMLTags(QString value) { return value.remove(QRegExp("<[^>]*>")); } + QString removeHTMLTags(QString value) { + return value.remove(QRegularExpression("<[^>]*>")); + } void setDescriptionFromLabel(QWidget *widget, const QLabel *label) { widget->setAccessibleDescription(removeHTMLTags(label->text())); diff --git a/src/mumble/Cert.cpp b/src/mumble/Cert.cpp index 0662baa05f..69b5b28d56 100644 --- a/src/mumble/Cert.cpp +++ b/src/mumble/Cert.cpp @@ -18,6 +18,7 @@ #include "Utils.h" #include "Global.h" +#include #include #include #include @@ -228,8 +229,9 @@ void CertWizard::initializePage(int id) { bool CertWizard::validateCurrentPage() { if (currentPage() == qwpNew) { - QRegExp ereg(QLatin1String("(^$)|((.+)@(.+))"), Qt::CaseInsensitive, QRegExp::RegExp2); - if (!ereg.exactMatch(qleEmail->text())) { + const QRegularExpression ereg(QRegularExpression::anchoredPattern(QLatin1String("(^$)|((.+)@(.+))")), + QRegularExpression::CaseInsensitiveOption); + if (!ereg.match(qleEmail->text()).hasMatch()) { qlError->setText(tr("Unable to validate email.
Enter a valid (or blank) email to continue.")); qwpNew->setComplete(false); return false; diff --git a/src/mumble/ConfigDialog.cpp b/src/mumble/ConfigDialog.cpp index 69ea261bd5..01df25c567 100644 --- a/src/mumble/ConfigDialog.cpp +++ b/src/mumble/ConfigDialog.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/src/mumble/ConnectDialog.cpp b/src/mumble/ConnectDialog.cpp index 16c317a0ad..6f86fd76cc 100644 --- a/src/mumble/ConnectDialog.cpp +++ b/src/mumble/ConnectDialog.cpp @@ -18,7 +18,9 @@ #include "Global.h" #include +#include #include +#include #include #include #include @@ -28,7 +30,6 @@ #include #include #include -#include #include #include @@ -129,7 +130,11 @@ ServerView::~ServerView() { delete siPublic; } +#if QT_VERSION >= 0x060000 +QMimeData *ServerView::mimeData(const QList< QTreeWidgetItem * > &mimeitems) const { +#else QMimeData *ServerView::mimeData(const QList< QTreeWidgetItem * > mimeitems) const { +#endif if (mimeitems.isEmpty()) return nullptr; @@ -154,11 +159,12 @@ void ServerView::fixupName(ServerItem *si) { int tag = 1; - QRegExp tmatch(QLatin1String("(.+)\\((\\d+)\\)")); - tmatch.setMinimal(true); - if (tmatch.exactMatch(name)) { - name = tmatch.capturedTexts().at(1).trimmed(); - tag = tmatch.capturedTexts().at(2).toInt(); + const QRegularExpression regex(QRegularExpression::anchoredPattern(QLatin1String("(.+)\\((\\d+)\\)")), + QRegularExpression::InvertedGreedinessOption); + const QRegularExpressionMatch match = regex.match(name); + if (match.hasMatch()) { + name = match.capturedTexts().at(1).trimmed(); + tag = match.capturedTexts().at(2).toInt(); } bool found; @@ -734,7 +740,7 @@ bool ServerItem::operator<(const QTreeWidgetItem &o) const { QString a = qsName.toLower(); QString b = other.qsName.toLower(); - QRegExp re(QLatin1String("[^0-9a-z]")); + QRegularExpression re(QLatin1String("[^0-9a-z]")); a.remove(re); b.remove(re); return a < b; diff --git a/src/mumble/ConnectDialog.h b/src/mumble/ConnectDialog.h index e8a3860c51..c7bac71673 100644 --- a/src/mumble/ConnectDialog.h +++ b/src/mumble/ConnectDialog.h @@ -101,7 +101,11 @@ class ServerView : public QTreeWidget { void fixupName(ServerItem *si); protected: +#if QT_VERSION >= 0x060000 + QMimeData *mimeData(const QList< QTreeWidgetItem * > &) const Q_DECL_OVERRIDE; +#else QMimeData *mimeData(const QList< QTreeWidgetItem * >) const Q_DECL_OVERRIDE; +#endif QStringList mimeTypes() const Q_DECL_OVERRIDE; Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE; bool dropMimeData(QTreeWidgetItem *, int, const QMimeData *, Qt::DropAction) Q_DECL_OVERRIDE; diff --git a/src/mumble/CrashReporter.cpp b/src/mumble/CrashReporter.cpp index 08fd5bad52..a57b70a7b8 100644 --- a/src/mumble/CrashReporter.cpp +++ b/src/mumble/CrashReporter.cpp @@ -174,7 +174,7 @@ void CrashReporter::run() { QString app = QLatin1String("dxdiag.exe"); QString systemRoot = EnvUtils::getenv(QLatin1String("SystemRoot")); - if (systemRoot.count() > 0) { + if (!systemRoot.isEmpty()) { app = QDir::fromNativeSeparators(systemRoot + QLatin1String("/System32/dxdiag.exe")); } @@ -204,7 +204,7 @@ void CrashReporter::run() { connect(qpdProgress, SIGNAL(canceled()), qelLoop, SLOT(quit())); QString boundary = - QString::fromLatin1("---------------------------%1").arg(QDateTime::currentDateTime().toTime_t()); + QString::fromLatin1("---------------------------%1").arg(QDateTime::currentDateTime().toSecsSinceEpoch()); QString os = QString::fromLatin1("--%1\r\nContent-Disposition: form-data; " "name=\"os\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n%2 %3\r\n") diff --git a/src/mumble/Database.cpp b/src/mumble/Database.cpp index fc366530a1..0798546618 100644 --- a/src/mumble/Database.cpp +++ b/src/mumble/Database.cpp @@ -45,7 +45,7 @@ bool Database::findOrCreateDatabase() { QStringList datapaths; datapaths << Global::get().qdBasePath.absolutePath(); - datapaths << QStandardPaths::writableLocation(QStandardPaths::DataLocation); + datapaths << QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation); #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) datapaths << QDir::homePath() + QLatin1String("/.config/Mumble"); #endif diff --git a/src/mumble/GKey.cpp b/src/mumble/GKey.cpp index a698f6c589..e77ee1615a 100644 --- a/src/mumble/GKey.cpp +++ b/src/mumble/GKey.cpp @@ -94,7 +94,11 @@ GKeyLibrary::GKeyLibrary() { if (RegOpenKeyEx(GKEY_LOGITECH_DLL_REG_HKEY, GKEY_LOGITECH_DLL_REG_PATH, 0, KEY_READ, &key) == ERROR_SUCCESS) { LONG err = RegQueryValueEx(key, L"", nullptr, &type, reinterpret_cast< LPBYTE >(wcLocation), &len); if (err == ERROR_SUCCESS && type == REG_SZ) { - QString qsLocation = QString::fromUtf16(reinterpret_cast< ushort * >(wcLocation), len / 2); +#if QT_VERSION >= 0x060000 + const auto qsLocation = QString::fromUtf16(reinterpret_cast< char16_t * >(wcLocation), len / 2); +#else + const auto qsLocation = QString::fromUtf16(reinterpret_cast< ushort * >(wcLocation), len / 2); +#endif qWarning("GKeyLibrary: Found ServerBinary with libLocation = \"%s\", len = %lu", qPrintable(qsLocation), static_cast< unsigned long >(len)); alternatives << qsLocation; diff --git a/src/mumble/GlobalShortcut.cpp b/src/mumble/GlobalShortcut.cpp index d290c2bbc3..ac675deeb3 100644 --- a/src/mumble/GlobalShortcut.cpp +++ b/src/mumble/GlobalShortcut.cpp @@ -512,15 +512,15 @@ void ShortcutTargetWidget::on_qtbEdit_clicked() { ShortcutDelegate::ShortcutDelegate(QObject *p) : QStyledItemDelegate(p) { QItemEditorFactory *factory = new QItemEditorFactory; - factory->registerEditor(QVariant::List, new QStandardItemEditorCreator< GlobalShortcutButtons >()); - factory->registerEditor(QVariant::UInt, new QStandardItemEditorCreator< ShortcutActionWidget >()); - factory->registerEditor(QVariant::Int, new QStandardItemEditorCreator< ShortcutToggleWidget >()); + factory->registerEditor(QMetaType::QVariantList, new QStandardItemEditorCreator< GlobalShortcutButtons >()); + factory->registerEditor(QMetaType::UInt, new QStandardItemEditorCreator< ShortcutActionWidget >()); + factory->registerEditor(QMetaType::Int, new QStandardItemEditorCreator< ShortcutToggleWidget >()); factory->registerEditor(static_cast< int >(QVariant::fromValue(ShortcutTarget()).userType()), new QStandardItemEditorCreator< ShortcutTargetWidget >()); factory->registerEditor(static_cast< int >(QVariant::fromValue(ChannelTarget()).userType()), new QStandardItemEditorCreator< ChannelSelectWidget >()); - factory->registerEditor(QVariant::String, new QStandardItemEditorCreator< TextEditWidget >()); - factory->registerEditor(QVariant::Invalid, new QStandardItemEditorCreator< QWidget >()); + factory->registerEditor(QMetaType::QString, new QStandardItemEditorCreator< TextEditWidget >()); + factory->registerEditor(QMetaType::UnknownType, new QStandardItemEditorCreator< QWidget >()); setItemEditorFactory(factory); } @@ -545,9 +545,12 @@ QString ShortcutDelegate::displayText(const QVariant &item, const QLocale &loc) return tr("< Unknown Channel >"); } } - +#if QT_VERSION >= 0x060000 + switch (item.typeId()) { +#else switch (item.type()) { - case QVariant::Int: { +#endif + case QMetaType::Int: { const auto v = item.toInt(); if (v > 0) { return tr("On"); @@ -557,11 +560,11 @@ QString ShortcutDelegate::displayText(const QVariant &item, const QLocale &loc) return tr("Toggle"); } - case QVariant::UInt: { + case QMetaType::UInt: { const auto shortcut = GlobalShortcutEngine::engine->qmShortcuts.value(item.toInt()); return shortcut ? shortcut->name : tr("Unassigned"); } - case QVariant::List: { + case QMetaType::QVariantList: { const auto buttons = item.value< QList< QVariant > >(); if (buttons.count() > 0) { QString text; @@ -580,7 +583,11 @@ QString ShortcutDelegate::displayText(const QVariant &item, const QLocale &loc) } } default: +#if QT_VERSION >= 0x060000 + qWarning("ShortcutDelegate::displayText(): Unknown type %d", item.typeId()); +#else qWarning("ShortcutDelegate::displayText(): Unknown type %d", item.type()); +#endif } return QStyledItemDelegate::displayText(item, loc); @@ -849,7 +856,11 @@ QTreeWidgetItem *GlobalShortcutConfig::itemForShortcut(const Shortcut &sc) const ::GlobalShortcut *gs = GlobalShortcutEngine::engine->qmShortcuts.value(sc.iIndex); item->setData(0, Qt::DisplayRole, static_cast< unsigned int >(sc.iIndex)); +#if QT_VERSION >= 0x060000 + if (sc.qvData.isValid() && gs && (sc.qvData.metaType() == gs->qvDefault.metaType())) +#else if (sc.qvData.isValid() && gs && (sc.qvData.type() == gs->qvDefault.type())) +#endif item->setData(1, Qt::DisplayRole, sc.qvData); else if (gs) item->setData(1, Qt::DisplayRole, gs->qvDefault); diff --git a/src/mumble/GlobalShortcut_win.cpp b/src/mumble/GlobalShortcut_win.cpp index aab7949f26..c6e46e4e1d 100644 --- a/src/mumble/GlobalShortcut_win.cpp +++ b/src/mumble/GlobalShortcut_win.cpp @@ -193,25 +193,33 @@ void GlobalShortcutWin::registerMetaTypes() { registered = true; qRegisterMetaType< InputHid >(); +#if QT_VERSION < 0x060000 qRegisterMetaTypeStreamOperators< InputHid >(); QMetaType::registerComparators< InputHid >(); - +#endif qRegisterMetaType< InputKeyboard >(); +#if QT_VERSION < 0x060000 qRegisterMetaTypeStreamOperators< InputKeyboard >(); QMetaType::registerComparators< InputKeyboard >(); - +#endif qRegisterMetaType< InputMouse >(); +#if QT_VERSION < 0x060000 qRegisterMetaTypeStreamOperators< InputMouse >(); QMetaType::registerComparators< InputMouse >(); +#endif #ifdef USE_XBOXINPUT qRegisterMetaType< InputXinput >(); +# if QT_VERSION < 0x060000 qRegisterMetaTypeStreamOperators< InputXinput >(); QMetaType::registerComparators< InputXinput >(); +# endif #endif #ifdef USE_GKEY qRegisterMetaType< InputGkey >(); +# if QT_VERSION < 0x060000 qRegisterMetaTypeStreamOperators< InputGkey >(); QMetaType::registerComparators< InputGkey >(); +# endif #endif } } diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp index 1b1a39a9cb..298e7423bd 100644 --- a/src/mumble/Log.cpp +++ b/src/mumble/Log.cpp @@ -24,12 +24,12 @@ #include #include +#include #include #include #include #include #include -#include const QString LogConfig::name = QLatin1String("LogConfig"); @@ -771,7 +771,7 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own QString fixedNLPlain = plain.replace(QLatin1String("\r\n"), QLatin1String("\n")).replace(QLatin1String("\r"), QLatin1String("\n")); - if (fixedNLPlain.contains(QRegExp(QLatin1String("\\n[ \\t]*$")))) { + if (fixedNLPlain.contains(QRegularExpression(QLatin1String("\\n[ \\t]*$")))) { // If the message ends with one or more blank lines (or lines only containing whitespace) // paint a border around the message to make clear that it contains invisible parts. // The beginning of the message is clear anyway (the date and potentially the "To XY" part) @@ -849,18 +849,19 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own } // Apply simplifications to spoken text - QRegExp identifyURL(QLatin1String("[a-z-]+://[^ <]*"), Qt::CaseInsensitive, QRegExp::RegExp2); + const QRegularExpression identifyURL(QRegularExpression::anchoredPattern(QLatin1String("[a-z-]+://[^ <]*")), + QRegularExpression::CaseInsensitiveOption); - QStringList qslAllowed = allowedSchemes(); + const QStringList qslAllowed = allowedSchemes(); + QRegularExpressionMatch match = identifyURL.match(plain); + int pos = 0; - int pos = 0; - while ((pos = identifyURL.indexIn(plain, pos)) != -1) { - QUrl url(identifyURL.cap(0).toLower()); - int len = identifyURL.matchedLength(); + while (match.hasMatch()) { + QUrl url(match.captured(0).toLower()); if (url.isValid() && qslAllowed.contains(url.scheme())) { // Replace it appropriately QString replacement; - QString host = url.host().replace(QRegExp(QLatin1String("^www.")), QString()); + QString host = url.host().replace(QRegularExpression(QLatin1String("^www.")), QString()); if (url.scheme() == QLatin1String("http") || url.scheme() == QLatin1String("https")) replacement = tr("link to %1").arg(host); @@ -873,10 +874,12 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own else replacement = tr("%1 link").arg(url.scheme()); - plain.replace(pos, len, replacement); + plain.replace(pos, match.capturedLength(), replacement); } else { - pos += len; + pos += match.capturedLength(); } + + match = identifyURL.match(plain, pos); } #ifndef USE_NO_TTS diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index f32428a4f4..646595435d 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -73,7 +73,6 @@ #include #include #include -#include #include #include #include @@ -610,7 +609,11 @@ void MainWindow::msgBox(QString msg) { } #ifdef Q_OS_WIN +# if QT_VERSION >= 0x060000 +bool MainWindow::nativeEvent(const QByteArray &, void *message, qintptr *) { +# else bool MainWindow::nativeEvent(const QByteArray &, void *message, long *) { +# endif MSG *msg = reinterpret_cast< MSG * >(message); if (msg->message == WM_DEVICECHANGE && msg->wParam == DBT_DEVNODES_CHANGED) uiNewHardware++; diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h index e54eab7116..0e4c460c79 100644 --- a/src/mumble/MainWindow.h +++ b/src/mumble/MainWindow.h @@ -150,7 +150,11 @@ class MainWindow : public QMainWindow, public Ui::MainWindow { void openUserLocalNicknameDialog(const ClientUser &p); #ifdef Q_OS_WIN +# if QT_VERSION >= 0x060000 + bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) Q_DECL_OVERRIDE; +# else bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; +# endif unsigned int uiNewHardware; #endif protected: diff --git a/src/mumble/Markdown.cpp b/src/mumble/Markdown.cpp index 03c87c6810..8c1d1d5b8d 100644 --- a/src/mumble/Markdown.cpp +++ b/src/mumble/Markdown.cpp @@ -13,6 +13,15 @@ namespace Markdown { // Placeholder constant const QLatin1String regularLineBreakPlaceholder("%<\\!!linebreak!!//>@"); +/// Just a wrapper for QRegularExpression::match(). +static QRegularExpressionMatch regexMatch(const QRegularExpression ®ex, const QString &subject, int &offset) { +#if QT_VERSION >= 0x060000 + return regex.match(subject, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchorAtOffsetMatchOption); +#else + return regex.match(subject, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption); +#endif +} + /// Tries to match and replace an escaped character at exactly the given offset in the string /// /// @param str A reference to the String to work on @@ -22,8 +31,7 @@ const QLatin1String regularLineBreakPlaceholder("%<\\!!linebreak!!//>@"); bool processEscapedChar(QString &str, int &offset) { static const QRegularExpression s_regex(QLatin1String("\\\\(.)")); - QRegularExpressionMatch match = - s_regex.match(str, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption); + const QRegularExpressionMatch match = regexMatch(s_regex, str, offset); if (match.hasMatch()) { QString replacement = QString::fromLatin1("%1").arg(match.captured(1)).toHtmlEscaped(); @@ -49,9 +57,7 @@ bool processMarkdownHeader(QString &str, int &offset) { // not create a huge spacing after the heading static const QRegularExpression s_regex(QLatin1String("^(#+) (.*)"), QRegularExpression::MultilineOption); - QRegularExpressionMatch match = - s_regex.match(str, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption); - + const QRegularExpressionMatch match = regexMatch(s_regex, str, offset); if (match.hasMatch()) { int sectionLevel = match.captured(1).size(); QString sectionName = match.captured(2).trimmed().toHtmlEscaped(); @@ -90,9 +96,7 @@ bool processMarkdownLink(QString &str, int &offset) { // Link in format [link text](url) static const QRegularExpression s_regex(QLatin1String("\\[([^\\]\\[]+)\\]\\(([^\\)]+)\\)")); - QRegularExpressionMatch match = - s_regex.match(str, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption); - + const QRegularExpressionMatch match = regexMatch(s_regex, str, offset); if (match.hasMatch()) { QString url = match.captured(2); @@ -126,9 +130,7 @@ bool processMarkdownBold(QString &str, int &offset) { // Bold text is marked as **bold** static const QRegularExpression s_regex(QLatin1String("\\*\\*([^*]+)\\*\\*")); - QRegularExpressionMatch match = - s_regex.match(str, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption); - + const QRegularExpressionMatch match = regexMatch(s_regex, str, offset); if (match.hasMatch()) { QString replacement = QString::fromLatin1("%1").arg(match.captured(1).toHtmlEscaped()); str.replace(match.capturedStart(), match.capturedEnd() - match.capturedStart(), replacement); @@ -151,9 +153,7 @@ bool processMarkdownItalic(QString &str, int &offset) { // Italic text is marked as *italic* static const QRegularExpression s_regex(QLatin1String("\\*([^*]+)\\*")); - QRegularExpressionMatch match = - s_regex.match(str, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption); - + const QRegularExpressionMatch match = regexMatch(s_regex, str, offset); if (match.hasMatch()) { QString replacement = QString::fromLatin1("%1").arg(match.captured(1).toHtmlEscaped()); str.replace(match.capturedStart(), match.capturedEnd() - match.capturedStart(), replacement); @@ -176,9 +176,7 @@ bool processMarkdownStrikethrough(QString &str, int &offset) { // Strikethrough text is marked as ~~text~~ static const QRegularExpression s_regex(QLatin1String("~~([^~]+)~~")); - QRegularExpressionMatch match = - s_regex.match(str, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption); - + const QRegularExpressionMatch match = regexMatch(s_regex, str, offset); if (match.hasMatch()) { QString replacement = QString::fromLatin1("%1").arg(match.captured(1).toHtmlEscaped()); str.replace(match.capturedStart(), match.capturedEnd() - match.capturedStart(), replacement); @@ -202,9 +200,7 @@ bool processMarkdownBlockQuote(QString &str, int &offset) { static const QRegularExpression s_regex(QLatin1String("^(>|>) (.|\\n(>|>) )+"), QRegularExpression::MultilineOption); - QRegularExpressionMatch match = - s_regex.match(str, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption); - + const QRegularExpressionMatch match = regexMatch(s_regex, str, offset); if (match.hasMatch()) { QString quote = match.captured(0).replace(QLatin1String(">"), QLatin1String(">")); @@ -243,9 +239,7 @@ bool processMarkdownInlineCode(QString &str, int &offset) { // Inline code fragments are marked as `code` static const QRegularExpression s_regex(QLatin1String("`([^`\n]+)`")); - QRegularExpressionMatch match = - s_regex.match(str, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption); - + const QRegularExpressionMatch match = regexMatch(s_regex, str, offset); if (match.hasMatch()) { QString replacement = QString::fromLatin1("%1").arg(match.captured(1).toHtmlEscaped()); str.replace(match.capturedStart(), match.capturedEnd() - match.capturedStart(), replacement); @@ -269,9 +263,7 @@ bool processMarkdownCodeBlock(QString &str, int &offset) { // Also consume a potential following newline as the
 tag will cause a linebreak anyways
 	static const QRegularExpression s_regex(QLatin1String("```.*\\n((?:[^`]|``?[^`]?)*)```(\\r\\n|\\n|\\r)?"));
 
-	QRegularExpressionMatch match =
-		s_regex.match(str, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption);
-
+	const QRegularExpressionMatch match = regexMatch(s_regex, str, offset);
 	if (match.hasMatch()) {
 		QString code = match.captured(1).toHtmlEscaped();
 
@@ -315,9 +307,7 @@ bool processPlainLink(QString &str, int &offset) {
 	static const QRegularExpression s_regex(
 		QLatin1String("([a-zA-Z]+://|[wW][wW][wW]\\.)([A-Za-z0-9-._~:/?#\\[\\]@!$&'()*+,;=]|%[a-fA-F0-9]{2})+"));
 
-	QRegularExpressionMatch match =
-		s_regex.match(str, offset, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption);
-
+	const QRegularExpressionMatch match = regexMatch(s_regex, str, offset);
 	if (match.hasMatch()) {
 		QString url = match.captured(0);
 
diff --git a/src/mumble/MumbleApplication.cpp b/src/mumble/MumbleApplication.cpp
index b97d8aec2d..bc25713a5c 100644
--- a/src/mumble/MumbleApplication.cpp
+++ b/src/mumble/MumbleApplication.cpp
@@ -27,7 +27,7 @@ MumbleApplication::MumbleApplication(int &pargc, char **pargv) : QApplication(pa
 
 QString MumbleApplication::applicationVersionRootPath() {
 	QString versionRoot = EnvUtils::getenv(QLatin1String("MUMBLE_VERSION_ROOT"));
-	if (versionRoot.count() > 0) {
+	if (!versionRoot.isEmpty()) {
 		return versionRoot;
 	}
 	return this->applicationDirPath();
@@ -57,7 +57,11 @@ bool MumbleApplication::event(QEvent *e) {
 }
 
 #ifdef Q_OS_WIN
+#	if QT_VERSION >= 0x060000
+bool MumbleApplication::nativeEventFilter(const QByteArray &, void *message, qintptr *) {
+#	else
 bool MumbleApplication::nativeEventFilter(const QByteArray &, void *message, long *) {
+#	endif
 	auto gsw = static_cast< GlobalShortcutWin * >(GlobalShortcutEngine::engine);
 	if (!gsw) {
 		return false;
diff --git a/src/mumble/MumbleApplication.h b/src/mumble/MumbleApplication.h
index d26399a376..210950416c 100644
--- a/src/mumble/MumbleApplication.h
+++ b/src/mumble/MumbleApplication.h
@@ -49,7 +49,11 @@ class MumbleApplication : public QApplication {
 
 	bool event(QEvent *e) Q_DECL_OVERRIDE;
 #ifdef Q_OS_WIN
+#	if QT_VERSION >= 0x060000
+	bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) Q_DECL_OVERRIDE;
+#	else
 	bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
+#	endif
 #endif
 
 	QUrl quLaunchURL;
diff --git a/src/mumble/OverlayClient.cpp b/src/mumble/OverlayClient.cpp
index e7a8805014..827d86fbe0 100644
--- a/src/mumble/OverlayClient.cpp
+++ b/src/mumble/OverlayClient.cpp
@@ -138,14 +138,23 @@ void OverlayClient::updateMouse() {
 		extern QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int format = 0);
 
 		if (info.hbmColor) {
+#		if QT_VERSION >= 0x060000
+			pm = QBitmap::fromPixmap(qt_pixmapFromWinHBITMAP(info.hbmColor));
+			pm.setMask(QBitmap::fromPixmap(qt_pixmapFromWinHBITMAP(info.hbmMask)));
+#		else
 			pm = qt_pixmapFromWinHBITMAP(info.hbmColor);
 			pm.setMask(QBitmap(qt_pixmapFromWinHBITMAP(info.hbmMask)));
+#		endif
 		} else {
-			QBitmap orig(qt_pixmapFromWinHBITMAP(info.hbmMask));
-			QImage img = orig.toImage();
+#		if QT_VERSION >= 0x060000
+			const auto orig = QBitmap::fromPixmap(qt_pixmapFromWinHBITMAP(info.hbmMask));
+#		else
+			const QBitmap orig(qt_pixmapFromWinHBITMAP(info.hbmMask));
+#		endif
+			const QImage img = orig.toImage();
 
-			int h = img.height() / 2;
-			int w = img.bytesPerLine() / sizeof(quint32);
+			const int h         = img.height() / 2;
+			const std::size_t w = img.bytesPerLine() / sizeof(quint32);
 
 			QImage out(img.width(), h, QImage::Format_MonoLSB);
 			QImage outmask(img.width(), h, QImage::Format_MonoLSB);
@@ -258,7 +267,7 @@ void OverlayClient::showGui() {
 	Global::get().mw->qteChat->setFocus();
 
 	qgv.setAttribute(Qt::WA_WState_Hidden, false);
-	qApp->setActiveWindow(&qgv);
+	qgv.activateWindow();
 	qgv.setFocus();
 
 	ougUsers.bShowExamples = true;
diff --git a/src/mumble/OverlayConfig.cpp b/src/mumble/OverlayConfig.cpp
index 265d29cf69..b6f817b22d 100644
--- a/src/mumble/OverlayConfig.cpp
+++ b/src/mumble/OverlayConfig.cpp
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/src/mumble/OverlayEditor.cpp b/src/mumble/OverlayEditor.cpp
index 25f07d1a6a..0521094459 100644
--- a/src/mumble/OverlayEditor.cpp
+++ b/src/mumble/OverlayEditor.cpp
@@ -52,7 +52,11 @@ OverlayEditor::~OverlayEditor() {
 		qgiPromote->setZValue(-1.0f);
 }
 
+#if QT_VERSION >= 0x060000
+void OverlayEditor::enterEvent(QEnterEvent *e) {
+#else
 void OverlayEditor::enterEvent(QEvent *e) {
+#endif
 	QGraphicsProxyWidget *qgpw = Global::get().mw->graphicsProxyWidget();
 	if (qgpw)
 		qgpw->setOpacity(0.9f);
diff --git a/src/mumble/OverlayEditor.h b/src/mumble/OverlayEditor.h
index cbef6fce8b..fd374997c7 100644
--- a/src/mumble/OverlayEditor.h
+++ b/src/mumble/OverlayEditor.h
@@ -20,7 +20,11 @@ class OverlayEditor : public QDialog, public Ui::OverlayEditor {
 	OverlayEditorScene oes;
 	OverlaySettings *os;
 
+#if QT_VERSION >= 0x060000
+	void enterEvent(QEnterEvent *e) Q_DECL_OVERRIDE;
+#else
 	void enterEvent(QEvent *e) Q_DECL_OVERRIDE;
+#endif
 	void leaveEvent(QEvent *e) Q_DECL_OVERRIDE;
 
 public:
diff --git a/src/mumble/OverlayEditorScene.cpp b/src/mumble/OverlayEditorScene.cpp
index 833dd39f02..03e3924609 100644
--- a/src/mumble/OverlayEditorScene.cpp
+++ b/src/mumble/OverlayEditorScene.cpp
@@ -18,6 +18,7 @@
 #include "Global.h"
 #include "GlobalShortcut.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -173,11 +174,11 @@ void OverlayEditorScene::moveAvatar() {
 }
 
 void OverlayEditorScene::moveBox() {
-	QRectF childrenBounds = os.qrfAvatar | os.qrfChannel | os.qrfMutedDeafened | os.qrfUserName;
+	const QRectF childrenBounds = os.qrfAvatar | os.qrfChannel | os.qrfMutedDeafened | os.qrfUserName;
 
-	bool haspen = (os.qcBoxPen != os.qcBoxFill) && (!qFuzzyCompare(os.qcBoxPen.alphaF(), static_cast< qreal >(0.0f)));
-	qreal pw    = haspen ? qMax< qreal >(1.0f, os.fBoxPenWidth * uiSize * uiZoom) : 0.0f;
-	qreal pad   = os.fBoxPad * uiSize * uiZoom;
+	const bool haspen = (os.qcBoxPen != os.qcBoxFill) && (!qFuzzyCompare(os.qcBoxPen.alphaF(), 0.0f));
+	const qreal pw    = haspen ? qMax< qreal >(1.0f, os.fBoxPenWidth * uiSize * uiZoom) : 0.0f;
+	const qreal pad   = os.fBoxPad * uiSize * uiZoom;
 
 	QPainterPath pp;
 	pp.addRoundedRect(childrenBounds.x() * uiSize * uiZoom + -pw / 2.0f - pad,
@@ -187,7 +188,7 @@ void OverlayEditorScene::moveBox() {
 	qgpiBox->setPath(pp);
 	qgpiBox->setPos(0.0f, 0.0f);
 	qgpiBox->setPen(haspen ? QPen(os.qcBoxPen, pw) : Qt::NoPen);
-	qgpiBox->setBrush(qFuzzyCompare(os.qcBoxFill.alphaF(), static_cast< qreal >(0.0f)) ? Qt::NoBrush : os.qcBoxFill);
+	qgpiBox->setBrush(qFuzzyCompare(os.qcBoxFill.alphaF(), 0.0f) ? Qt::NoBrush : os.qcBoxFill);
 	qgpiBox->setOpacity(1.0f);
 
 	qgpiBox->setVisible(os.bBox);
diff --git a/src/mumble/OverlayPositionableItem.cpp b/src/mumble/OverlayPositionableItem.cpp
index 038e7a79b6..863dfb4e6d 100644
--- a/src/mumble/OverlayPositionableItem.cpp
+++ b/src/mumble/OverlayPositionableItem.cpp
@@ -51,8 +51,8 @@ void OverlayPositionableItem::onMove() {
 	const QRectF &sr = scene()->sceneRect();
 	const QPointF &p = m_qgeiHandle->pos();
 
-	m_position->setX(qBound< qreal >(0.0f, p.x() / sr.width(), 1.0f));
-	m_position->setY(qBound< qreal >(0.0f, p.y() / sr.height(), 1.0f));
+	m_position->setX(qBound< qreal >(0.0, p.x() / sr.width(), 1.0f));
+	m_position->setY(qBound< qreal >(0.0, p.y() / sr.height(), 1.0f));
 
 	m_qgeiHandle->setPos(m_position->x() * sr.width(), m_position->y() * sr.height());
 
diff --git a/src/mumble/OverlayText.cpp b/src/mumble/OverlayText.cpp
index 700858649d..73a9471e8e 100644
--- a/src/mumble/OverlayText.cpp
+++ b/src/mumble/OverlayText.cpp
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 BasepointPixmap::BasepointPixmap() : qpBasePoint(0, 0), iAscent(-1), iDescent(-1) {
 }
@@ -82,7 +83,7 @@ BasepointPixmap OverlayTextLine::createPixmap(QColor col) {
 			fYCorrection = fEdge - static_cast< float >(qr.top());
 		}
 
-		QMatrix correction;
+		QTransform correction;
 		correction.translate(fXCorrection, fYCorrection);
 		qpp = correction.map(qpp);
 	}
@@ -176,7 +177,7 @@ BasepointPixmap OverlayTextLine::createPixmap(unsigned int maxwidth, unsigned in
 		}
 
 		// translation to "pixmap space":
-		QMatrix correction;
+		QTransform correction;
 		//  * adjust left edge
 		correction.translate(-bb.x() + fEdge, 0.0f);
 		//  * scale overly high text (still on baseline)
diff --git a/src/mumble/OverlayUser.cpp b/src/mumble/OverlayUser.cpp
index f3462027fe..01f18d0c1a 100644
--- a/src/mumble/OverlayUser.cpp
+++ b/src/mumble/OverlayUser.cpp
@@ -122,12 +122,11 @@ void OverlayUser::updateLayout() {
 	qgpiChannel->setZValue(3.0f);
 	qgpiChannel->setOpacity(os->fChannel);
 
-	QRectF childrenBounds = os->qrfAvatar | os->qrfChannel | os->qrfMutedDeafened | os->qrfUserName;
+	const QRectF childrenBounds = os->qrfAvatar | os->qrfChannel | os->qrfMutedDeafened | os->qrfUserName;
 
-	bool haspen =
-		(os->qcBoxPen != os->qcBoxFill) && (!qFuzzyCompare(os->qcBoxPen.alphaF(), static_cast< qreal >(0.0f)));
-	qreal pw  = haspen ? qMax< qreal >(1.0f, os->fBoxPenWidth * uiSize * os->fZoom) : 0.0f;
-	qreal pad = os->fBoxPad * uiSize * os->fZoom;
+	const bool haspen = (os->qcBoxPen != os->qcBoxFill) && (!qFuzzyCompare(os->qcBoxPen.alphaF(), 0.0f));
+	const qreal pw    = haspen ? qMax< qreal >(1.0f, os->fBoxPenWidth * uiSize * os->fZoom) : 0.0f;
+	const qreal pad   = os->fBoxPad * uiSize * os->fZoom;
 	QPainterPath pp;
 	pp.addRoundedRect(childrenBounds.x() * uiSize * os->fZoom + -pw / 2.0f - pad,
 					  childrenBounds.y() * uiSize * os->fZoom + -pw / 2.0f - pad,
@@ -137,7 +136,7 @@ void OverlayUser::updateLayout() {
 	qgpiBox->setPos(0.0f, 0.0f);
 	qgpiBox->setZValue(-1.0f);
 	qgpiBox->setPen(haspen ? QPen(os->qcBoxPen, pw) : Qt::NoPen);
-	qgpiBox->setBrush(qFuzzyCompare(os->qcBoxFill.alphaF(), static_cast< qreal >(0.0f)) ? Qt::NoBrush : os->qcBoxFill);
+	qgpiBox->setBrush(qFuzzyCompare(os->qcBoxFill.alphaF(), 0.0f) ? Qt::NoBrush : os->qcBoxFill);
 	qgpiBox->setOpacity(1.0f);
 
 	if (!cuUser) {
diff --git a/src/mumble/PluginInstaller.cpp b/src/mumble/PluginInstaller.cpp
index 942eb69f76..4770b96ab1 100644
--- a/src/mumble/PluginInstaller.cpp
+++ b/src/mumble/PluginInstaller.cpp
@@ -51,6 +51,9 @@ bool PluginInstaller::canBePluginFile(const QFileInfo &fileInfo) noexcept {
 	return QLibrary::isLibrary(fileInfo.fileName());
 }
 
+PluginInstaller::PluginInstaller(const QString &filePath, QWidget *p) : PluginInstaller(QFileInfo(filePath), p) {
+}
+
 PluginInstaller::PluginInstaller(const QFileInfo &fileInfo, QWidget *p)
 	: QDialog(p), m_pluginArchive(fileInfo), m_plugin(nullptr), m_pluginSource(), m_pluginDestination(),
 	  m_copyPlugin(false) {
diff --git a/src/mumble/PluginInstaller.h b/src/mumble/PluginInstaller.h
index 3f054cd875..7d49e3e8a0 100644
--- a/src/mumble/PluginInstaller.h
+++ b/src/mumble/PluginInstaller.h
@@ -65,6 +65,10 @@ class PluginInstaller : public QDialog, public Ui::PluginInstaller {
 	/// @returns Whether the provided file could (!) be a plugin source
 	static bool canBePluginFile(const QFileInfo &fileInfo) noexcept;
 
+	/// @param filePath The plugin source to process
+	///
+	/// @throws PluginInstallException If something isn't right or goes wrong
+	PluginInstaller(const QString &filePath, QWidget *p = nullptr);
 	/// @param fileInfo The plugin source to process
 	///
 	/// @throws PluginInstallException If something isn't right or goes wrong
diff --git a/src/mumble/PluginUpdater.cpp b/src/mumble/PluginUpdater.cpp
index db99c94cf5..cb25e0814c 100644
--- a/src/mumble/PluginUpdater.cpp
+++ b/src/mumble/PluginUpdater.cpp
@@ -20,6 +20,7 @@
 #include 
 
 #include 
+#include 
 
 PluginUpdater::PluginUpdater(QWidget *parent)
 	: QDialog(parent), m_wasInterrupted(false), m_dataMutex(), m_pluginsToUpdate(), m_networkManager(),
@@ -33,7 +34,7 @@ PluginUpdater::~PluginUpdater() {
 
 void PluginUpdater::checkForUpdates() {
 	// Dispatch a thread in which each plugin can check for updates
-	QtConcurrent::run([this]() {
+	std::ignore = QtConcurrent::run([this]() {
 		QMutexLocker lock(&m_dataMutex);
 
 		const QVector< const_plugin_ptr_t > plugins = Global::get().pluginManager->getPlugins();
diff --git a/src/mumble/RichTextEditor.cpp b/src/mumble/RichTextEditor.cpp
index b00bc5d3b2..06b1f20e2b 100644
--- a/src/mumble/RichTextEditor.cpp
+++ b/src/mumble/RichTextEditor.cpp
@@ -11,6 +11,7 @@
 #include "Global.h"
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,9 +35,13 @@ static QString decodeMimeString(const QByteArray &src) {
 	if (src.isEmpty())
 		return QString();
 
-	if ((src.length() >= 4) && ((static_cast< std::size_t >(src.length()) % sizeof(ushort)) == 0)) {
-		const ushort *ptr = reinterpret_cast< const ushort * >(src.constData());
-		int len           = static_cast< int >(static_cast< std::size_t >(src.length()) / sizeof(ushort));
+	if ((src.length() >= 4) && ((static_cast< std::size_t >(src.length()) % sizeof(char16_t)) == 0)) {
+#if QT_VERSION >= 0x060000
+		const auto *ptr = reinterpret_cast< const char16_t * >(src.constData());
+#else
+		const auto *ptr = reinterpret_cast< const ushort * >(src.constData());
+#endif
+		auto len = static_cast< int >(static_cast< std::size_t >(src.length()) / sizeof(char16_t));
 		if ((ptr[0] > 0) && (ptr[0] < 0x7f) && (ptr[1] > 0) && (ptr[1] < 0x7f)) {
 			while (len && (ptr[len - 1] == 0))
 				--len;
@@ -76,7 +81,7 @@ static QString decodeMimeString(const QByteArray &src) {
 void RichTextHtmlEdit::insertFromMimeData(const QMimeData *source) {
 	QString uri;
 	QString title;
-	QRegExp newline(QLatin1String("[\\r\\n]"));
+	QRegularExpression newline(QLatin1String("[\\r\\n]"));
 
 #ifndef QT_NO_DEBUG
 	qWarning() << "RichTextHtmlEdit::insertFromMimeData" << source->formats();
diff --git a/src/mumble/SearchDialog.cpp b/src/mumble/SearchDialog.cpp
index 0616272a4c..9a2cb84e95 100644
--- a/src/mumble/SearchDialog.cpp
+++ b/src/mumble/SearchDialog.cpp
@@ -69,9 +69,8 @@ class SearchResultItem : public QTreeWidgetItem {
 
 		setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicator);
 
-		QString matchText =
-			m_result.fullText.replace(m_result.begin, m_result.length,
-									  "" + m_result.fullText.midRef(m_result.begin, m_result.length) + "");
+		const QString matchText = m_result.fullText.replace(
+			m_result.begin, m_result.length, "" + m_result.fullText.mid(m_result.begin, m_result.length) + "");
 
 		setData(MATCH_COLUMN, Qt::DisplayRole, std::move(matchText));
 		setData(MATCH_COLUMN, SearchDialogItemDelegate::CHANNEL_TREE_ROLE, m_result.channelHierarchy);
diff --git a/src/mumble/ServerHandler.cpp b/src/mumble/ServerHandler.cpp
index fe590960f6..5aeeb9f24a 100644
--- a/src/mumble/ServerHandler.cpp
+++ b/src/mumble/ServerHandler.cpp
@@ -438,8 +438,9 @@ void ServerHandler::run() {
 		}
 		bUdp = false;
 
-
-#if QT_VERSION >= 0x050500
+#if QT_VERSION >= 0x060300
+		qtsSock->setProtocol(QSsl::TlsV1_2OrLater);
+#elif QT_VERSION >= 0x050500
 		qtsSock->setProtocol(QSsl::TlsV1_0OrLater);
 #elif QT_VERSION >= 0x050400
 		// In Qt 5.4, QSsl::SecureProtocols is equivalent
diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp
index 0eae32d307..a29425cd48 100644
--- a/src/mumble/Settings.cpp
+++ b/src/mumble/Settings.cpp
@@ -397,7 +397,7 @@ bool operator<(const ChannelTarget &lhs, const ChannelTarget &rhs) {
 	return lhs.channelID < rhs.channelID;
 }
 
-quint32 qHash(const ChannelTarget &target) {
+std::size_t qHash(const ChannelTarget &target) {
 	return qHash(target.channelID);
 }
 
@@ -514,16 +514,16 @@ Settings::Settings() {
 	GlobalShortcutWin::registerMetaTypes();
 #endif
 	qRegisterMetaType< ShortcutTarget >("ShortcutTarget");
-	qRegisterMetaTypeStreamOperators< ShortcutTarget >("ShortcutTarget");
 	qRegisterMetaType< ChannelTarget >("ChannelTarget");
-	qRegisterMetaTypeStreamOperators< ChannelTarget >("ChannelTarget");
 	qRegisterMetaType< QVariant >("QVariant");
 	qRegisterMetaType< PluginSetting >("PluginSetting");
-	qRegisterMetaTypeStreamOperators< PluginSetting >("PluginSetting");
 	qRegisterMetaType< Search::SearchDialog::UserAction >("SearchDialog::UserAction");
 	qRegisterMetaType< Search::SearchDialog::ChannelAction >("SearchDialog::ChannelAction");
-
-
+#if QT_VERSION < 0x060000
+	qRegisterMetaTypeStreamOperators< ChannelTarget >("ChannelTarget");
+	qRegisterMetaTypeStreamOperators< PluginSetting >("PluginSetting");
+	qRegisterMetaTypeStreamOperators< ShortcutTarget >("ShortcutTarget");
+#endif
 #ifdef Q_OS_MACOS
 	// The echo cancellation feature on macOS is experimental and known to be able to cause problems
 	// (e.g. muting the user instead of only cancelling echo - https://github.com/mumble-voip/mumble/issues/4912)
@@ -1278,7 +1278,7 @@ QString Settings::findSettingsLocation(bool legacy, bool *foundExistingFile) con
 	// this path instead of creating a new one (in the location that we currently think is best to use).
 	QStringList paths;
 	paths << QCoreApplication::instance()->applicationDirPath();
-	paths << QStandardPaths::writableLocation(QStandardPaths::DataLocation);
+	paths << QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
 	paths << QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
 	paths << QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
 	paths << QFileInfo(QSettings().fileName()).dir().absolutePath();
diff --git a/src/mumble/Settings.h b/src/mumble/Settings.h
index ad001d2f93..a75df408c2 100644
--- a/src/mumble/Settings.h
+++ b/src/mumble/Settings.h
@@ -66,7 +66,7 @@ struct ChannelTarget {
 
 Q_DECLARE_METATYPE(ChannelTarget)
 
-quint32 qHash(const ChannelTarget &);
+std::size_t qHash(const ChannelTarget &);
 
 struct ShortcutTarget {
 	bool bCurrentSelection           = false;
@@ -81,7 +81,6 @@ struct ShortcutTarget {
 
 	ShortcutTarget() = default;
 	bool isServerSpecific() const;
-	bool operator<(const ShortcutTarget &) const;
 	bool operator==(const ShortcutTarget &) const;
 };
 
diff --git a/src/mumble/TalkingUI.cpp b/src/mumble/TalkingUI.cpp
index a39dd073f7..e145eb6972 100644
--- a/src/mumble/TalkingUI.cpp
+++ b/src/mumble/TalkingUI.cpp
@@ -508,14 +508,21 @@ void TalkingUI::mousePressEvent(QMouseEvent *event) {
 	bool foundTarget = false;
 
 	for (auto ¤tContainer : m_containers) {
-		QRect containerArea(currentContainer->getWidget()->mapToGlobal({ 0, 0 }),
-							currentContainer->getWidget()->size());
-
+		const QRect containerArea(currentContainer->getWidget()->mapToGlobal(QPoint(0, 0)),
+								  currentContainer->getWidget()->size());
+#if QT_VERSION >= 0x060000
+		if (containerArea.contains(event->globalPosition().toPoint())) {
+#else
 		if (containerArea.contains(event->globalPos())) {
+#endif
 			for (auto ¤tEntry : currentContainer->getEntries()) {
-				QRect entryArea(currentEntry->getWidget()->mapToGlobal({ 0, 0 }), currentEntry->getWidget()->size());
-
+				const QRect entryArea(currentEntry->getWidget()->mapToGlobal(QPoint(0, 0)),
+									  currentEntry->getWidget()->size());
+#if QT_VERSION >= 0x060000
+				if (entryArea.contains(event->globalPosition().toPoint())) {
+#else
 				if (entryArea.contains(event->globalPos())) {
+#endif
 					switch (currentEntry->getType()) {
 						case EntryType::USER:
 							setSelection(
@@ -557,9 +564,14 @@ void TalkingUI::mousePressEvent(QMouseEvent *event) {
 			// currently selected item. This item we have updated to the correct one with the setSelection() call above
 			// resulting in the proper context menu being shown at the position of the mouse which in this case is in
 			// the TalkingUI.
-			QMetaObject::invokeMethod(Global::get().mw, "on_qtvUsers_customContextMenuRequested", Qt::QueuedConnection,
-									  Q_ARG(QPoint, Global::get().mw->qtvUsers->mapFromGlobal(event->globalPos())),
-									  Q_ARG(bool, false));
+			QMetaObject::invokeMethod(
+				Global::get().mw, "on_qtvUsers_customContextMenuRequested", Qt::QueuedConnection,
+#if QT_VERSION >= 0x060000
+				Q_ARG(QPoint, Global::get().mw->qtvUsers->mapFromGlobal(event->globalPosition().toPoint())),
+#else
+				Q_ARG(QPoint, Global::get().mw->qtvUsers->mapFromGlobal(event->globalPos())),
+#endif
+				Q_ARG(bool, false));
 		}
 	} else {
 		// Clear selection
diff --git a/src/mumble/ThemeInfo.cpp b/src/mumble/ThemeInfo.cpp
index 9e20f2c5ef..cba8d7497a 100644
--- a/src/mumble/ThemeInfo.cpp
+++ b/src/mumble/ThemeInfo.cpp
@@ -7,6 +7,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 QFileInfo ThemeInfo::StyleInfo::getPlatformQss() const {
@@ -23,7 +24,7 @@ QFileInfo ThemeInfo::StyleInfo::getPlatformQss() const {
 
 boost::optional< ThemeInfo::StyleInfo > readStyleFromConfig(QSettings &themeConfig, const QString &styleId,
 															const ThemeInfo &theme, const QDir &themeDir) {
-	QRegExp qssPlatformRegex(QString::fromLatin1("^%1/qss_(.*)").arg(styleId));
+	const QRegularExpression qssPlatformRegex(QString::fromLatin1("^%1/qss_(.*)").arg(styleId));
 
 	ThemeInfo::StyleInfo style;
 
@@ -44,10 +45,9 @@ boost::optional< ThemeInfo::StyleInfo > readStyleFromConfig(QSettings &themeConf
 	}
 
 	foreach (const QString &platformQssConfig, themeConfig.allKeys().filter(qssPlatformRegex)) {
-		qssPlatformRegex.indexIn(platformQssConfig);
-		const QString platform = qssPlatformRegex.cap(1);
+		const QString platform = qssPlatformRegex.match(platformQssConfig).captured(1);
 
-		QFileInfo platformQss = (themeDir.filePath(themeConfig.value(platformQssConfig).toString()));
+		const auto platformQss = QFileInfo(themeDir.filePath(themeConfig.value(platformQssConfig).toString()));
 		if (!platformQss.exists() || !platformQss.isFile()) {
 			qWarning() << "Style" << style.name << " of theme " << theme.name << " references invalid qss "
 					   << platformQss.filePath() << " for platform " << platform << ", skipping theme";
diff --git a/src/mumble/Translations.cpp b/src/mumble/Translations.cpp
index da8c2b1a4d..50d6b9d395 100644
--- a/src/mumble/Translations.cpp
+++ b/src/mumble/Translations.cpp
@@ -118,15 +118,18 @@ namespace Translations {
 		// existing Qt translations. If not, we try to load the qt-translations installed on the host-machine and if
 		// that fails as well, we try to load translations bundled in Mumble. Note: Resource starting with :/ are
 		// bundled resources specified in a .qrc file
+#if QT_VERSION >= 0x060000
+		const QString translationsPath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
+#else
+		const QString translationsPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+#endif
 		if (guard.m_qtTranslator->load(locale, ":/mumble_overwrite_qt_")) {
 			app.installTranslator(guard.m_qtTranslator);
 		} else if (guard.m_qtTranslator->load(locale, ":/mumble_overwrite_qtbase_")) {
 			app.installTranslator(guard.m_qtTranslator);
-		} else if (guard.m_qtTranslator->load(locale, "qt_", prefix,
-											  QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
+		} else if (guard.m_qtTranslator->load(locale, "qt_", prefix, translationsPath)) {
 			app.installTranslator(guard.m_qtTranslator);
-		} else if (guard.m_qtTranslator->load(locale, "qtbase_", prefix,
-											  QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
+		} else if (guard.m_qtTranslator->load(locale, "qtbase_", prefix, translationsPath)) {
 			app.installTranslator(guard.m_qtTranslator);
 		} else if (guard.m_qtTranslator->load(locale, ":/qt_")) {
 			app.installTranslator(guard.m_qtTranslator);
diff --git a/src/mumble/VoiceRecorder.cpp b/src/mumble/VoiceRecorder.cpp
index be563baa78..0e09b93567 100644
--- a/src/mumble/VoiceRecorder.cpp
+++ b/src/mumble/VoiceRecorder.cpp
@@ -14,6 +14,8 @@
 
 #include 
 
+#include 
+
 VoiceRecorder::RecordBuffer::RecordBuffer(int recordInfoIndex_, boost::shared_array< float > buffer_, int samples_,
 										  quint64 absoluteStartSample_)
 
@@ -63,11 +65,12 @@ QString VoiceRecorder::sanitizeFilenameOrPathComponent(const QString &str) const
 	}
 
 	// Replace < > : " / \ | ? * as well as chr(0) to chr(31)
-	res = res.replace(QRegExp(QLatin1String("[<>:\"/\\\\|\\?\\*\\x00-\\x1F]")), QLatin1String("_"));
+	res = res.replace(QRegularExpression(QLatin1String("[<>:\"/\\\\|\\?\\*\\x00-\\x1F]")), QLatin1String("_"));
 
 	// Prepend reserved filenames CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2,
 	// LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9
-	res = res.replace(QRegExp(QLatin1String("^((CON|PRN|AUX|NUL|COM[1-9]|LPT1[1-9])(\\.|$))"), Qt::CaseInsensitive),
+	res = res.replace(QRegularExpression(QLatin1String("^((CON|PRN|AUX|NUL|COM[1-9]|LPT1[1-9])(\\.|$))"),
+										 QRegularExpression::CaseInsensitiveOption),
 					  QLatin1String("_\\1"));
 
 	// Make sure we do not exceed 255 characters
@@ -125,7 +128,7 @@ QString VoiceRecorder::expandTemplateVariables(const QString &path, const QStrin
 				QHashIterator< const QString, QString > it(vars);
 				while (it.hasNext()) {
 					it.next();
-					if (str.midRef(i + 1, it.key().length()) == it.key()) {
+					if (str.mid(i + 1, it.key().length()) == it.key()) {
 						i += it.key().length();
 						tmp += it.value();
 						replaced     = true;
diff --git a/src/mumble/WebFetch.cpp b/src/mumble/WebFetch.cpp
index 56cd62acfd..e6059308e9 100644
--- a/src/mumble/WebFetch.cpp
+++ b/src/mumble/WebFetch.cpp
@@ -8,6 +8,7 @@
 #include "NetworkConfig.h"
 #include "Global.h"
 
+#include 
 #include 
 
 WebFetch::WebFetch(QString service, QUrl url, QObject *obj, const char *slot)
@@ -65,8 +66,9 @@ void WebFetch::finished() {
 			if (!name.isEmpty() && !value.isEmpty()) {
 				headers.insert(name, value);
 				if (name == QLatin1String("Use-Service-Prefix")) {
-					QRegExp servicePrefixRegExp(QLatin1String("^[a-zA-Z]+$"));
-					if (servicePrefixRegExp.exactMatch(value)) {
+					const QRegularExpression servicePrefixRegExp(
+						QRegularExpression::anchoredPattern(QLatin1String("^[a-zA-Z]+$")));
+					if (servicePrefixRegExp.match(value).hasMatch()) {
 						Global::get().s.qsServicePrefix = value.toLower();
 					}
 				}
diff --git a/src/mumble/XMLTools.cpp b/src/mumble/XMLTools.cpp
index 3b9b9d0b33..f9e108bfd6 100644
--- a/src/mumble/XMLTools.cpp
+++ b/src/mumble/XMLTools.cpp
@@ -18,7 +18,7 @@ void XMLTools::recurseParse(QXmlStreamReader &reader, QXmlStreamWriter &writer,
 		QMap< QString, QString > style;
 		QMap< QString, QString > pstyle = opstyle;
 
-		QStringRef styleref = a.value(QLatin1String("style"));
+		const auto styleref = a.value(QLatin1String("style"));
 		if (!styleref.isNull()) {
 			QString stylestring = styleref.toString();
 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp
index 204b9c4a07..a22b357327 100644
--- a/src/mumble/main.cpp
+++ b/src/mumble/main.cpp
@@ -161,7 +161,7 @@ int main(int argc, char **argv) {
 	a.setDesktopFileName("info.mumble.Mumble");
 #endif
 
-#if QT_VERSION >= 0x050100
+#if QT_VERSION >= 0x050100 && QT_VERSION < 0x060000
 	a.setAttribute(Qt::AA_UseHighDpiPixmaps);
 #endif
 
@@ -419,7 +419,7 @@ int main(int argc, char **argv) {
 				std::cout << "Mumble version " << Version::getRelease().toStdString() << std::endl;
 				return 0;
 			} else {
-				if (PluginInstaller::canBePluginFile(args.at(i))) {
+				if (PluginInstaller::canBePluginFile(QFileInfo(args.at(i)))) {
 					pluginsToBeInstalled << args.at(i);
 				} else {
 					if (!bRpcMode) {
diff --git a/src/murmur/Meta.cpp b/src/murmur/Meta.cpp
index a27f2dce26..7b2ae9d4a0 100644
--- a/src/murmur/Meta.cpp
+++ b/src/murmur/Meta.cpp
@@ -97,8 +97,8 @@ MetaParams::MetaParams() {
 	iChannelNestingLimit = 10;
 	iChannelCountLimit   = 1000;
 
-	qrUserName    = QRegExp(QLatin1String("[ -=\\w\\[\\]\\{\\}\\(\\)\\@\\|\\.]+"));
-	qrChannelName = QRegExp(QLatin1String("[ -=\\w\\#\\[\\]\\{\\}\\(\\)\\@\\|]+"));
+	qrUserName    = QRegularExpression(QLatin1String("[ -=\\w\\[\\]\\{\\}\\(\\)\\@\\|\\.]+"));
+	qrChannelName = QRegularExpression(QLatin1String("[ -=\\w\\#\\[\\]\\{\\}\\(\\)\\@\\|]+"));
 
 	iMessageLimit = 1;
 	iMessageBurst = 5;
@@ -149,7 +149,11 @@ ReturnType MetaParams::typeCheckedFromSettings(const QString &name, const ValueT
 
 	// Bit convoluted as canConvert() only does a static check without considering whether
 	// say a string like "blub" is actually a valid double (which convert does).
+#if QT_VERSION >= 0x060000
+	if (!cfgVariable.convert(QMetaType(QVariant(defaultValue).metaType()))) {
+#else
 	if (!cfgVariable.convert(static_cast< int >(QVariant(defaultValue).type()))) {
+#endif
 		qCritical() << "Configuration variable" << name << "is of invalid format. Set to default value of"
 					<< defaultValue << ".";
 		return static_cast< ReturnType >(defaultValue);
@@ -165,7 +169,7 @@ void MetaParams::read(QString fname) {
 		QStringList datapaths;
 
 #if defined(Q_OS_WIN)
-		datapaths << QStandardPaths::writableLocation(QStandardPaths::DataLocation);
+		datapaths << QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
 
 		QDir appdir = QDir(QDir::fromNativeSeparators(EnvUtils::getenv(QLatin1String("APPDATA"))));
 		datapaths << appdir.absolutePath() + QLatin1String("/Mumble");
@@ -213,7 +217,9 @@ void MetaParams::read(QString fname) {
 	}
 	QDir::setCurrent(qdBasePath.absolutePath());
 	qsSettings = new QSettings(qsAbsSettingsFilePath, QSettings::IniFormat);
+#if QT_VERSION < 0x060000
 	qsSettings->setIniCodec("UTF-8");
+#endif
 
 	qsSettings->sync();
 	switch (qsSettings->status()) {
@@ -238,10 +244,11 @@ void MetaParams::read(QString fname) {
 	QString qsHost = qsSettings->value("host", QString()).toString();
 	if (!qsHost.isEmpty()) {
 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
-		foreach (const QString &host, qsHost.split(QRegExp(QLatin1String("\\s+")), Qt::SkipEmptyParts)) {
+		foreach (const QString &host, qsHost.split(QRegularExpression(QLatin1String("\\s+")), Qt::SkipEmptyParts)) {
 #else
 		// Qt 5.14 introduced the Qt::SplitBehavior flags deprecating the QString fields
-		foreach (const QString &host, qsHost.split(QRegExp(QLatin1String("\\s+")), QString::SkipEmptyParts)) {
+		foreach (const QString &host,
+				 qsHost.split(QRegularExpression(QLatin1String("\\s+")), QString::SkipEmptyParts)) {
 #endif
 			QHostAddress qhaddr;
 			if (qhaddr.setAddress(host)) {
@@ -367,8 +374,8 @@ void MetaParams::read(QString fname) {
 	}
 #endif
 
-	qrUserName    = QRegExp(typeCheckedFromSettings("username", qrUserName.pattern()));
-	qrChannelName = QRegExp(typeCheckedFromSettings("channelname", qrChannelName.pattern()));
+	qrUserName    = QRegularExpression(typeCheckedFromSettings("username", qrUserName.pattern()));
+	qrChannelName = QRegularExpression(typeCheckedFromSettings("channelname", qrChannelName.pattern()));
 
 	iMessageLimit = typeCheckedFromSettings< unsigned int >("messagelimit", 1);
 	iMessageBurst = typeCheckedFromSettings< unsigned int >("messageburst", 5);
@@ -441,7 +448,9 @@ void MetaParams::read(QString fname) {
 
 bool MetaParams::loadSSLSettings() {
 	QSettings updatedSettings(qsAbsSettingsFilePath, QSettings::IniFormat);
+#if QT_VERSION < 0x060000
 	updatedSettings.setIniCodec("UTF-8");
+#endif
 
 	QString tmpCiphersStr = typeCheckedFromSettings("sslCiphers", qsCiphers);
 
diff --git a/src/murmur/Meta.h b/src/murmur/Meta.h
index 47de623183..73320f2bc5 100644
--- a/src/murmur/Meta.h
+++ b/src/murmur/Meta.h
@@ -16,6 +16,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -95,8 +96,8 @@ class MetaParams {
 	QUrl qurlRegWeb;
 	bool bBonjour;
 
-	QRegExp qrUserName;
-	QRegExp qrChannelName;
+	QRegularExpression qrUserName;
+	QRegularExpression qrChannelName;
 
 	unsigned int iMessageLimit;
 	unsigned int iMessageBurst;
diff --git a/src/murmur/MumbleServerIce.cpp b/src/murmur/MumbleServerIce.cpp
index 1915264020..37bc6d4561 100644
--- a/src/murmur/MumbleServerIce.cpp
+++ b/src/murmur/MumbleServerIce.cpp
@@ -181,7 +181,7 @@ static void banToBan(const ::Ban &b, ::MumbleServer::Ban &mb) {
 	mb.name     = iceString(b.qsUsername);
 	mb.hash     = iceString(b.qsHash);
 	mb.reason   = iceString(b.qsReason);
-	mb.start    = static_cast< int >(b.qdtStart.toLocalTime().toTime_t());
+	mb.start    = static_cast< int >(b.qdtStart.toLocalTime().toSecsSinceEpoch());
 	mb.duration = static_cast< int >(b.iDuration);
 }
 
@@ -197,7 +197,7 @@ static void banToBan(const ::MumbleServer::Ban &mb, ::Ban &b) {
 	b.qsUsername = u8(mb.name);
 	b.qsHash     = u8(mb.hash);
 	b.qsReason   = u8(mb.reason);
-	b.qdtStart   = QDateTime::fromTime_t(static_cast< quint32 >(mb.start)).toUTC();
+	b.qdtStart   = QDateTime::fromSecsSinceEpoch(static_cast< quint32 >(mb.start)).toUTC();
 	b.iDuration  = static_cast< unsigned int >(mb.duration);
 }
 
diff --git a/src/murmur/PBKDF2.cpp b/src/murmur/PBKDF2.cpp
index ad340feddb..a0ced9fc74 100644
--- a/src/murmur/PBKDF2.cpp
+++ b/src/murmur/PBKDF2.cpp
@@ -49,6 +49,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp
index bc89c65306..a49b58e204 100644
--- a/src/murmur/Server.cpp
+++ b/src/murmur/Server.cpp
@@ -29,6 +29,7 @@
 #include "Utils.h"
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -365,9 +366,10 @@ void Server::readParams() {
 	if (!qsHost.isEmpty()) {
 		qlBind.clear();
 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
-		foreach (const QString &host, qsHost.split(QRegExp(QLatin1String("\\s+")), Qt::SkipEmptyParts)) {
+		foreach (const QString &host, qsHost.split(QRegularExpression(QLatin1String("\\s+")), Qt::SkipEmptyParts)) {
 #else
-		// Qt 5.14 introduced the Qt::SplitBehavior flags deprecating the QString fields
+		// Qt 5.14 introduced the Qt::SplitBehavior flags, deprecating the QString fields.
+		// It also introduced the QString::split() overload that accepts a QRegularExpression.
 		foreach (const QString &host, qsHost.split(QRegExp(QLatin1String("\\s+")), QString::SkipEmptyParts)) {
 #endif
 			QHostAddress qhaddr;
@@ -450,8 +452,10 @@ void Server::readParams() {
 	iChannelNestingLimit = getConf("channelnestinglimit", iChannelNestingLimit).toInt();
 	iChannelCountLimit   = getConf("channelcountlimit", iChannelCountLimit).toInt();
 
-	qrUserName    = QRegExp(getConf("username", qrUserName.pattern()).toString());
-	qrChannelName = QRegExp(getConf("channelname", qrChannelName.pattern()).toString());
+	qrUserName =
+		decltype(qrUserName)(QRegularExpression::anchoredPattern(getConf("username", qrUserName.pattern()).toString()));
+	qrChannelName = decltype(qrChannelName)(
+		QRegularExpression::anchoredPattern(getConf("channelname", qrChannelName.pattern()).toString()));
 
 	iMessageLimit = getConf("messagelimit", iMessageLimit).toUInt();
 	if (iMessageLimit < 1) { // Prevent disabling messages entirely
@@ -580,9 +584,9 @@ void Server::setLiveConf(const QString &key, const QString &value) {
 	else if (key == "allowrecording")
 		allowRecording = !v.isNull() ? QVariant(v).toBool() : Meta::mp.allowRecording;
 	else if (key == "username")
-		qrUserName = !v.isNull() ? QRegExp(v) : Meta::mp.qrUserName;
+		qrUserName = !v.isNull() ? QRegularExpression(v) : Meta::mp.qrUserName;
 	else if (key == "channelname")
-		qrChannelName = !v.isNull() ? QRegExp(v) : Meta::mp.qrChannelName;
+		qrChannelName = !v.isNull() ? QRegularExpression(v) : Meta::mp.qrChannelName;
 	else if (key == "suggestversion")
 		m_suggestVersion = !v.isNull() ? Version::fromConfig(v) : Meta::mp.m_suggestVersion;
 	else if (key == "suggestpositional")
@@ -1476,7 +1480,9 @@ void Server::newClient() {
 
 		u->setToS();
 
-#if QT_VERSION >= 0x050500
+#if QT_VERSION >= 0x060300
+		sock->setProtocol(QSsl::TlsV1_2OrLater);
+#elif QT_VERSION >= 0x050500
 		sock->setProtocol(QSsl::TlsV1_0OrLater);
 #elif QT_VERSION >= 0x050400
 		// In Qt 5.4, QSsl::SecureProtocols is equivalent
@@ -2144,13 +2150,28 @@ QString Server::addressToString(const QHostAddress &adr, unsigned short port) {
 
 	if ((Meta::mp.iObfuscate != 0)) {
 		QCryptographicHash h(QCryptographicHash::Sha1);
+#if QT_VERSION >= 0x060000
+		QByteArrayView byteView(reinterpret_cast< const char * >(&Meta::mp.iObfuscate), sizeof(Meta::mp.iObfuscate));
+		h.addData(byteView);
+#else
 		h.addData(reinterpret_cast< const char * >(&Meta::mp.iObfuscate), sizeof(Meta::mp.iObfuscate));
+#endif
 		if (adr.protocol() == QAbstractSocket::IPv4Protocol) {
 			quint32 num = adr.toIPv4Address();
+#if QT_VERSION >= 0x060000
+			byteView = { reinterpret_cast< const char * >(&num), sizeof(num) };
+			h.addData(byteView);
+#else
 			h.addData(reinterpret_cast< const char * >(&num), sizeof(num));
+#endif
 		} else if (adr.protocol() == QAbstractSocket::IPv6Protocol) {
 			Q_IPV6ADDR num = adr.toIPv6Address();
+#if QT_VERSION >= 0x060000
+			byteView = { reinterpret_cast< const char * >(num.c), sizeof(num.c) };
+			h.addData(byteView);
+#else
 			h.addData(reinterpret_cast< const char * >(num.c), sizeof(num.c));
+#endif
 		}
 		return QString("<<%1:%2>>").arg(QString::fromLatin1(h.result().toHex()), QString::number(port));
 	}
@@ -2160,11 +2181,19 @@ QString Server::addressToString(const QHostAddress &adr, unsigned short port) {
 bool Server::validateUserName(const QString &name) {
 	// We expect the name passed to this function to be fully trimmed already. This way we
 	// prevent "empty" names (at least with the default username restriction).
-	return (name.trimmed().length() == name.length() && qrUserName.exactMatch(name) && (name.length() <= 512));
+	if (name.length() > 512 || name.length() != name.trimmed().length()) {
+		return false;
+	}
+
+	return qrUserName.match(name).hasMatch();
 }
 
 bool Server::validateChannelName(const QString &name) {
-	return (qrChannelName.exactMatch(name) && (name.length() <= 512));
+	if (name.length() > 512) {
+		return false;
+	}
+
+	return qrChannelName.match(name).hasMatch();
 }
 
 void Server::recheckCodecVersions(ServerUser *connectingUser) {
diff --git a/src/murmur/Server.h b/src/murmur/Server.h
index d8f8724ea0..c9fb596398 100644
--- a/src/murmur/Server.h
+++ b/src/murmur/Server.h
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -137,8 +138,8 @@ class Server : public QThread {
 	bool bAllowPing;
 	bool allowRecording;
 
-	QRegExp qrUserName;
-	QRegExp qrChannelName;
+	QRegularExpression qrUserName;
+	QRegularExpression qrChannelName;
 
 	unsigned int iMessageLimit;
 	unsigned int iMessageBurst;
diff --git a/src/murmur/ServerDB.cpp b/src/murmur/ServerDB.cpp
index ebe7c41032..1e50c47993 100644
--- a/src/murmur/ServerDB.cpp
+++ b/src/murmur/ServerDB.cpp
@@ -57,10 +57,6 @@ class TransactionHolder {
 		delete qsqQuery;
 		ServerDB::db->commit();
 	}
-	TransactionHolder(const TransactionHolder &other) {
-		ServerDB::db->transaction();
-		qsqQuery = other.qsqQuery ? new QSqlQuery(*other.qsqQuery) : 0;
-	}
 };
 
 QSqlDatabase *ServerDB::db = nullptr;
@@ -113,7 +109,7 @@ ServerDB::ServerDB() {
 	}
 	db = new QSqlDatabase(QSqlDatabase::addDatabase(Meta::mp.qsDBDriver));
 
-	qsUpgradeSuffix = QString::fromLatin1("_old_%1").arg(QDateTime::currentDateTime().toTime_t());
+	qsUpgradeSuffix = QString::fromLatin1("_old_%1").arg(QDateTime::currentDateTime().toSecsSinceEpoch());
 
 	bool found = false;
 
@@ -2566,7 +2562,7 @@ QList< QPair< unsigned int, QString > > ServerDB::getLog(int server_id, unsigned
 	while (query.next()) {
 		QDateTime qdt = query.value(0).toDateTime();
 		QString msg   = query.value(1).toString();
-		ql << QPair< unsigned int, QString >(qdt.toLocalTime().toTime_t(), msg);
+		ql << QPair< unsigned int, QString >(qdt.toLocalTime().toSecsSinceEpoch(), msg);
 	}
 	return ql;
 }
diff --git a/src/murmur/ServerDB.h b/src/murmur/ServerDB.h
index aa07c4b72d..3e3595095b 100644
--- a/src/murmur/ServerDB.h
+++ b/src/murmur/ServerDB.h
@@ -62,10 +62,11 @@ class ServerDB : public QObject {
 	static bool query(QSqlQuery &, const QString &, bool fatal = true, bool warn = true);
 	static bool exec(QSqlQuery &, const QString &str = QString(), bool fatal = true, bool warn = true);
 	static bool execBatch(QSqlQuery &, const QString &str = QString(), bool fatal = true);
-	// No copy; private declaration without implementation
-	ServerDB(const ServerDB &);
 
 private:
+	ServerDB(const ServerDB &)            = delete;
+	ServerDB &operator=(const ServerDB &) = delete;
+
 	static void loadOrSetupMetaPBKDF2IterationCount(QSqlQuery &query);
 	static void writeSUPW(int srvnum, const QString &pwHash, const QString &saltHash, const QVariant &kdfIterations);
 };
diff --git a/src/murmur/Tray.cpp b/src/murmur/Tray.cpp
index be55be9852..ca3d608f54 100644
--- a/src/murmur/Tray.cpp
+++ b/src/murmur/Tray.cpp
@@ -11,7 +11,11 @@
 #include "Server.h"
 #include "Version.h"
 
-#include 
+#if QT_VERSION >= 0x060000
+#	include 
+#else
+#	include 
+#endif
 #include 
 #include 
 #include 
diff --git a/src/murmur/main.cpp b/src/murmur/main.cpp
index 0a96997afb..3399236a4c 100644
--- a/src/murmur/main.cpp
+++ b/src/murmur/main.cpp
@@ -30,7 +30,9 @@
 #	include 
 #endif
 
-#include 
+#if QT_VERSION < 0x060000
+#	include 
+#endif
 
 #ifdef USE_DBUS
 #	include 
@@ -245,9 +247,9 @@ int main(int argc, char **argv) {
 	a.setOrganizationDomain("mumble.sourceforge.net");
 
 	MumbleSSL::initialize();
-
+#if QT_VERSION < 0x060000
 	QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
-
+#endif
 #ifdef Q_OS_WIN
 	// By default, windbus expects the path to dbus-daemon to be in PATH, and the path
 	// should contain bin\\, and the path to the config is hardcoded as ..\etc