diff options
author | Davide Beatrici <davidebeatrici@gmail.com> | 2019-10-10 04:14:38 +0300 |
---|---|---|
committer | Davide Beatrici <davidebeatrici@gmail.com> | 2019-10-10 04:14:38 +0300 |
commit | 1ac534915c54a2a60e181ea8c900643e854dcdbf (patch) | |
tree | c8bda07f2ef125182e5b6a9f54b557a29c6f178c /src/murmur | |
parent | a50e572e2d5386c35e24d93e14f013531cee79b4 (diff) |
Remove remaining Qt 4 stuff
For reference: https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5
Diffstat (limited to 'src/murmur')
-rw-r--r-- | src/murmur/Cert.cpp | 5 | ||||
-rw-r--r-- | src/murmur/Meta.cpp | 27 | ||||
-rw-r--r-- | src/murmur/Server.cpp | 23 | ||||
-rw-r--r-- | src/murmur/Server.h | 4 | ||||
-rw-r--r-- | src/murmur/main.cpp | 18 |
5 files changed, 6 insertions, 71 deletions
diff --git a/src/murmur/Cert.cpp b/src/murmur/Cert.cpp index 3a1fe10b1..80883cca8 100644 --- a/src/murmur/Cert.cpp +++ b/src/murmur/Cert.cpp @@ -129,14 +129,11 @@ void Server::initializeCert() { #endif QString issuer; -#if QT_VERSION >= 0x050000 + QStringList issuerNames = qscCert.issuerInfo(QSslCertificate::CommonName); if (! issuerNames.isEmpty()) { issuer = issuerNames.first(); } -#else - issuer = qscCert.issuerInfo(QSslCertificate::CommonName); -#endif // Really old certs/keys are no good, throw them away so we can // generate a new one below. diff --git a/src/murmur/Meta.cpp b/src/murmur/Meta.cpp index 3baac7a7b..f52620167 100644 --- a/src/murmur/Meta.cpp +++ b/src/murmur/Meta.cpp @@ -140,11 +140,7 @@ void MetaParams::read(QString fname) { QStringList datapaths; #if defined(Q_OS_WIN) -#if QT_VERSION >= 0x050000 datapaths << QStandardPaths::writableLocation(QStandardPaths::DataLocation); -#else - datapaths << QDesktopServices::storageLocation(QDesktopServices::DataLocation); -#endif QDir appdir = QDir(QDir::fromNativeSeparators(EnvUtils::getenv(QLatin1String("APPDATA")))); datapaths << appdir.absolutePath() + QLatin1String("/Mumble"); @@ -188,9 +184,8 @@ void MetaParams::read(QString fname) { } QDir::setCurrent(qdBasePath.absolutePath()); qsSettings = new QSettings(qsAbsSettingsFilePath, QSettings::IniFormat); -#if QT_VERSION >= 0x040500 qsSettings->setIniCodec("UTF-8"); -#endif + qWarning("Initializing settings from %s (basepath %s)", qPrintable(qsSettings->fileName()), qPrintable(qdBasePath.absolutePath())); QString qsHost = qsSettings->value("host", QString()).toString(); @@ -258,7 +253,6 @@ void MetaParams::read(QString fname) { hasipv4 = true; } -#if QT_VERSION >= 0x050000 if (hasipv6) { if (SslServer::hasDualStackSupport() && hasipv4) { qlBind << QHostAddress(QHostAddress::Any); @@ -271,23 +265,6 @@ void MetaParams::read(QString fname) { if (hasipv4) { qlBind << QHostAddress(QHostAddress::AnyIPv4); } -#else // QT_VERSION < 0x050000 - // For Qt 4 AnyIPv6 resulted in a dual stack socket on dual stack - // capable systems while Any resulted in an IPv4 only socket. For - // Qt 5 this has been reworked so that AnyIPv6/v4 are now exclusive - // IPv6/4 sockets while Any is the dual stack socket. - - if (hasipv6) { - qlBind << QHostAddress(QHostAddress::AnyIPv6); - if (SslServer::hasDualStackSupport() && hasipv4) { - hasipv4 = false; // No need to add a separate ipv4 socket - } - } - - if (hasipv4) { - qlBind << QHostAddress(QHostAddress::Any); - } -#endif } qsPassword = typeCheckedFromSettings("serverpassword", qsPassword); @@ -444,9 +421,7 @@ void MetaParams::read(QString fname) { bool MetaParams::loadSSLSettings() { QSettings updatedSettings(qsAbsSettingsFilePath, QSettings::IniFormat); -#if QT_VERSION >= 0x040500 updatedSettings.setIniCodec("UTF-8"); -#endif QString tmpCiphersStr = typeCheckedFromSettings("sslCiphers", qsCiphers); diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp index 4fc502396..15037c5c5 100644 --- a/src/murmur/Server.cpp +++ b/src/murmur/Server.cpp @@ -95,11 +95,7 @@ bool SslServer::hasDualStackSupport() { return result; } -#if QT_VERSION >= 0x050000 void SslServer::incomingConnection(qintptr v) { -#else -void SslServer::incomingConnection(int v) { -#endif QSslSocket *s = new QSslSocket(this); s->setSocketDescriptor(v); qlSockets.append(s); @@ -1299,10 +1295,8 @@ void Server::newClient() { // In Qt 5.4, QSsl::SecureProtocols is equivalent // to "TLSv1.0 or later", which we require. sock->setProtocol(QSsl::SecureProtocols); -#elif QT_VERSION >= 0x050000 - sock->setProtocol(QSsl::TlsV1_0); #else - sock->setProtocol(QSsl::TlsV1); + sock->setProtocol(QSsl::TlsV1_0); #endif sock->startServerEncryption(); } @@ -1327,14 +1321,9 @@ void Server::encrypted() { QList<QSslCertificate> certs = uSource->peerCertificateChain(); if (!certs.isEmpty()) { const QSslCertificate &cert = certs.last(); -#if QT_VERSION >= 0x050000 uSource->qslEmail = cert.subjectAlternativeNames().values(QSsl::EmailEntry); -#else - uSource->qslEmail = cert.alternateSubjectNames().values(QSsl::EmailEntry); -#endif uSource->qsHash = cert.digest(QCryptographicHash::Sha1).toHex(); if (! uSource->qslEmail.isEmpty() && uSource->bVerified) { -#if QT_VERSION >= 0x050000 QString subject; QString issuer; @@ -1347,10 +1336,7 @@ void Server::encrypted() { if (! issuerList.isEmpty()) { issuer = issuerList.first(); } -#else - QString subject = cert.subjectInfo(QSslCertificate::CommonName); - QString issuer = certs.first().issuerInfo(QSslCertificate::CommonName); -#endif + log(uSource, QString::fromUtf8("Strong certificate for %1 <%2> (signed by %3)").arg(subject).arg(uSource->qslEmail.join(", ")).arg(issuer)); } @@ -1424,11 +1410,8 @@ void Server::sslError(const QList<QSslError> &errors) { // See // https://bugreports.qt.io/browse/QTBUG-53906 // https://github.com/mumble-voip/mumble/issues/2334 -#if QT_VERSION >= 0x050000 + u->disconnectSocket(); -#else - u->disconnectSocket(true); -#endif } } diff --git a/src/murmur/Server.h b/src/murmur/Server.h index 79dd87b07..03e0b719b 100644 --- a/src/murmur/Server.h +++ b/src/murmur/Server.h @@ -65,11 +65,7 @@ class SslServer : public QTcpServer { Q_DISABLE_COPY(SslServer) protected: QList<QSslSocket *> qlSockets; -#if QT_VERSION >= 0x050000 void incomingConnection(qintptr) Q_DECL_OVERRIDE; -#else - void incomingConnection(int) Q_DECL_OVERRIDE; -#endif public: QSslSocket *nextPendingSSLConnection(); SslServer(QObject *parent = NULL); diff --git a/src/murmur/main.cpp b/src/murmur/main.cpp index 5572ea67c..ea6a99031 100644 --- a/src/murmur/main.cpp +++ b/src/murmur/main.cpp @@ -151,16 +151,10 @@ static void murmurMessageOutputQString(QtMsgType type, const QString &msg) { } } -#if QT_VERSION >= 0x050000 static void murmurMessageOutputWithContext(QtMsgType type, const QMessageLogContext &ctx, const QString &msg) { Q_UNUSED(ctx); murmurMessageOutputQString(type, msg); } -#else -static void murmurMessageOutput(QtMsgType type, const char *msg) { - murmurMessageOutputQString(type, QString::fromUtf8(msg)); -} -#endif #ifdef USE_ICE void IceParse(int &argc, char *argv[]); @@ -220,9 +214,6 @@ int main(int argc, char **argv) { MumbleSSL::initialize(); QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); -#if QT_VERSION < 0x050000 - QTextCodec::setCodecForCStrings(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 @@ -252,11 +243,8 @@ int main(int argc, char **argv) { #endif qsrand(QDateTime::currentDateTime().toTime_t()); -#if QT_VERSION >= 0x050000 + qInstallMessageHandler(murmurMessageOutputWithContext); -#else - qInstallMsgHandler(murmurMessageOutput); -#endif #ifdef Q_OS_WIN Tray tray(NULL, &le); @@ -618,11 +606,7 @@ int main(int argc, char **argv) { delete meta; -#if QT_VERSION >= 0x050000 qInstallMessageHandler(NULL); -#else - qInstallMsgHandler(NULL); -#endif #ifdef Q_OS_UNIX if (! Meta::mp.qsPid.isEmpty()) { |