Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavide Beatrici <davidebeatrici@gmail.com>2019-10-10 04:14:38 +0300
committerDavide Beatrici <davidebeatrici@gmail.com>2019-10-10 04:14:38 +0300
commit1ac534915c54a2a60e181ea8c900643e854dcdbf (patch)
treec8bda07f2ef125182e5b6a9f54b557a29c6f178c /src
parenta50e572e2d5386c35e24d93e14f013531cee79b4 (diff)
Remove remaining Qt 4 stuff
For reference: https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5
Diffstat (limited to 'src')
-rw-r--r--src/Connection.h8
-rw-r--r--src/SSL.cpp127
-rw-r--r--src/mumble/Cert.cpp10
-rw-r--r--src/mumble/ConnectDialog.cpp35
-rw-r--r--src/mumble/DBus.cpp4
-rw-r--r--src/mumble/Database.cpp4
-rw-r--r--src/mumble/Global.cpp15
-rw-r--r--src/mumble/GlobalShortcut.cpp9
-rw-r--r--src/mumble/Log.cpp9
-rw-r--r--src/mumble/MainWindow.cpp32
-rw-r--r--src/mumble/MainWindow.h9
-rw-r--r--src/mumble/MumbleApplication.cpp12
-rw-r--r--src/mumble/MumbleApplication.h10
-rw-r--r--src/mumble/Overlay.cpp4
-rw-r--r--src/mumble/OverlayClient.cpp34
-rw-r--r--src/mumble/Overlay_macx.mm7
-rw-r--r--src/mumble/Plugins.cpp13
-rw-r--r--src/mumble/ServerHandler.cpp5
-rw-r--r--src/mumble/Settings.cpp8
-rw-r--r--src/mumble/SocketRPC.cpp4
-rw-r--r--src/mumble/TaskList.cpp5
-rw-r--r--src/mumble/UserEdit.cpp10
-rw-r--r--src/mumble/UserInformation.cpp7
-rw-r--r--src/mumble/UserView.cpp13
-rw-r--r--src/mumble/UserView.h5
-rw-r--r--src/mumble/VersionCheck.cpp8
-rw-r--r--src/mumble/ViewCert.cpp15
-rw-r--r--src/mumble/main.cpp19
-rw-r--r--src/mumble/os_macx.mm12
-rw-r--r--src/mumble/os_unix.cpp10
-rw-r--r--src/mumble/os_win.cpp12
-rw-r--r--src/murmur/Cert.cpp5
-rw-r--r--src/murmur/Meta.cpp27
-rw-r--r--src/murmur/Server.cpp23
-rw-r--r--src/murmur/Server.h4
-rw-r--r--src/murmur/main.cpp18
-rw-r--r--src/tests/TestServerResolver/TestServerResolver.cpp6
37 files changed, 23 insertions, 535 deletions
diff --git a/src/Connection.h b/src/Connection.h
index a431315a2..9bc24ab05 100644
--- a/src/Connection.h
+++ b/src/Connection.h
@@ -36,11 +36,7 @@ class Connection : public QObject {
Q_DISABLE_COPY(Connection)
protected:
QSslSocket *qtsSocket;
-#if QT_VERSION >= 0x040700
QElapsedTimer qtLastPacket;
-#else
- QTime qtLastPacket;
-#endif
unsigned int uiType;
int iPacketLength;
#ifdef Q_OS_WIN
@@ -94,8 +90,4 @@ class Connection : public QObject {
#endif
};
-#if QT_VERSION < 0x050000
-Q_DECLARE_METATYPE(QAbstractSocket::SocketError)
-#endif
-
#endif
diff --git a/src/SSL.cpp b/src/SSL.cpp
index 6b803204b..c7d9ed145 100644
--- a/src/SSL.cpp
+++ b/src/SSL.cpp
@@ -108,120 +108,7 @@ out:
}
void MumbleSSL::addSystemCA() {
-#if QT_VERSION < 0x040700 && !defined(NO_SYSTEM_CA_OVERRIDE)
-#if defined(Q_OS_WIN)
- QStringList qsl;
- qsl << QLatin1String("Ca");
- qsl << QLatin1String("Root");
- qsl << QLatin1String("AuthRoot");
- foreach(const QString &store, qsl) {
- HCERTSTORE hCertStore;
- PCCERT_CONTEXT pCertContext = NULL;
-
- bool found = false;
-
- hCertStore = CertOpenSystemStore(NULL, store.utf16());
- if (! hCertStore) {
- qWarning("SSL: Failed to open CA store %s", qPrintable(store));
- continue;
- }
-
- while (pCertContext = CertEnumCertificatesInStore(hCertStore, pCertContext)) {
- QByteArray qba(reinterpret_cast<const char *>(pCertContext->pbCertEncoded), pCertContext->cbCertEncoded);
-
- QList<QSslCertificate> ql = QSslCertificate::fromData(qba, QSsl::Pem);
- ql += QSslCertificate::fromData(qba, QSsl::Der);
- if (! ql.isEmpty()) {
- found = true;
- QSslSocket::addDefaultCaCertificates(ql);
- }
- }
- if (found)
- qWarning("SSL: Added CA certificates from system store '%s'", qPrintable(store));
-
- CertCloseStore(hCertStore, 0);
- }
-
-#elif defined(Q_OS_MAC)
- CFArrayRef certs = NULL;
- bool found = false;
-
- if (SecTrustCopyAnchorCertificates(&certs) == noErr) {
- int ncerts = CFArrayGetCount(certs);
- for (int i = 0; i < ncerts; i++) {
- CFDataRef data = NULL;
-
- SecCertificateRef cert = reinterpret_cast<SecCertificateRef>(const_cast<void *>(CFArrayGetValueAtIndex(certs, i)));
- if (! cert)
- continue;
-
- if (SecKeychainItemExport(cert, kSecFormatX509Cert, kSecItemPemArmour, NULL, &data) == noErr) {
- const char *ptr = reinterpret_cast<const char *>(CFDataGetBytePtr(data));
- int len = CFDataGetLength(data);
- QByteArray qba(ptr, len);
-
- QList<QSslCertificate> ql = QSslCertificate::fromData(qba, QSsl::Pem);
- if (! ql.isEmpty()) {
- found = true;
- QSslSocket::addDefaultCaCertificates(ql);
- }
- }
- }
-
- CFRelease(certs);
-
- if (found)
- qWarning("SSL: Added CA certificates from 'System Roots' store.");
- }
-#elif defined(Q_OS_UNIX)
- QStringList qsl;
-
-#ifdef SYSTEM_CA_DIR
- QSslSocket::addDefaultCaCertificates(QLatin1String(MUMTEXT(SYSTEM_CA_DIR)));
-#else
-#ifdef SYSTEM_CA_BUNDLE
- qsl << QLatin1String(MUMTEXT(SYSTEM_CA_BUNDLE));
-#else
-#ifdef __FreeBSD__
- qsl << QLatin1String("/usr/local/share/certs/ca-root-nss.crt");
-#else
- qsl << QLatin1String("/etc/pki/tls/certs/ca-bundle.crt");
- qsl << QLatin1String("/etc/ssl/certs/ca-certificates.crt");
-#endif
-#endif
-
- foreach(const QString &filename, qsl) {
- QFile f(filename);
- if (f.exists() && f.open(QIODevice::ReadOnly)) {
- QList<QSslCertificate> ql = QSslCertificate::fromDevice(&f, QSsl::Pem);
- ql += QSslCertificate::fromDevice(&f, QSsl::Der);
- if (! ql.isEmpty()) {
- qWarning("SSL: Added CA certificates from '%s'", qPrintable(filename));
- QSslSocket::addDefaultCaCertificates(ql);
- }
- }
- }
-#endif // SYSTEM_CA_DIR
-#endif // Q_OS_UNIX
-
- QSet<QByteArray> digests;
- QList<QSslCertificate> ql;
- foreach(const QSslCertificate &crt, QSslSocket::defaultCaCertificates()) {
- QByteArray digest = crt.digest(QCryptographicHash::Sha1);
- if (! digests.contains(digest) && crt.isValid()) {
- ql << crt;
- digests.insert(digest);
- }
- }
- QSslSocket::setDefaultCaCertificates(ql);
-#endif // NO_SYSTEM_CA_OVERRIDE
-
- // Don't perform on-demand loading of root certificates
-#if QT_VERSION >= 0x050500
QSslSocket::addDefaultCaCertificates(QSslConfiguration::systemCaCertificates());
-#elif QT_VERSION >= 0x040800
- QSslSocket::addDefaultCaCertificates(QSslSocket::systemCaCertificates());
-#endif
#ifdef Q_OS_WIN
// Work around issue #1271.
@@ -233,7 +120,6 @@ void MumbleSSL::addSystemCA() {
QList<QSslCertificate> filteredCaList;
foreach (QSslCertificate cert, caList) {
-#if QT_VERSION >= 0x050000
QStringList orgs = cert.subjectInfo(QSslCertificate::Organization);
bool skip = false;
foreach (QString ou, orgs) {
@@ -245,12 +131,7 @@ void MumbleSSL::addSystemCA() {
if (skip) {
continue;
}
-#else
- QString ou = cert.subjectInfo(QSslCertificate::Organization);
- if (ou.contains(QLatin1String("Skype"), Qt::CaseInsensitive)) {
- continue;
- }
-#endif
+
filteredCaList.append(cert);
}
@@ -266,21 +147,15 @@ 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 >= 0x050000
case QSsl::TlsV1_0: return QLatin1String("TLS 1.0");
case QSsl::TlsV1_1: return QLatin1String("TLS 1.1");
case QSsl::TlsV1_2: return QLatin1String("TLS 1.2");
#if QT_VERSION >= 0x050C00
case QSsl::TlsV1_3: return QLatin1String("TLS 1.3");
#endif
-#else
- case QSsl::TlsV1: return QLatin1String("TLS 1.0");
-#endif
case QSsl::AnyProtocol: return QLatin1String("AnyProtocol");
-#if QT_VERSION >= 0x040800
case QSsl::TlsV1SslV3: return QLatin1String("TlsV1SslV3");
case QSsl::SecureProtocols: return QLatin1String("SecureProtocols");
-#endif
default:
case QSsl::UnknownProtocol: return QLatin1String("UnknownProtocol");
}
diff --git a/src/mumble/Cert.cpp b/src/mumble/Cert.cpp
index a5072cdac..f07dcda47 100644
--- a/src/mumble/Cert.cpp
+++ b/src/mumble/Cert.cpp
@@ -79,7 +79,6 @@ void CertView::setCert(const QList<QSslCertificate> &cert) {
} else {
QSslCertificate qscCert = qlCert.at(0);
-#if QT_VERSION >= 0x050000
const QStringList &names = qscCert.subjectInfo(QSslCertificate::CommonName);
QString name;
if (names.count() > 0) {
@@ -87,10 +86,6 @@ void CertView::setCert(const QList<QSslCertificate> &cert) {
}
QStringList emails = qscCert.subjectAlternativeNames().values(QSsl::EmailEntry);
-#else
- const QString &name = qscCert.subjectInfo(QSslCertificate::CommonName);
- QStringList emails(qscCert.alternateSubjectNames().values(QSsl::EmailEntry));
-#endif
QString tmpName = name;
tmpName = tmpName.replace(QLatin1String("\\x"), QLatin1String("%"));
@@ -111,15 +106,12 @@ void CertView::setCert(const QList<QSslCertificate> &cert) {
if (qlCert.count() > 1)
qscCert = qlCert.last();
-#if QT_VERSION >= 0x050000
const QStringList &issuerNames = qscCert.issuerInfo(QSslCertificate::CommonName);
QString issuerName;
if (issuerNames.count() > 0) {
issuerName = issuerNames.at(0);
}
-#else
- const QString &issuerName = qscCert.issuerInfo(QSslCertificate::CommonName);
-#endif
+
qlIssuerName->setText((issuerName == name) ? tr("Self-signed") : issuerName);
}
}
diff --git a/src/mumble/ConnectDialog.cpp b/src/mumble/ConnectDialog.cpp
index c8fb49404..56adf2c75 100644
--- a/src/mumble/ConnectDialog.cpp
+++ b/src/mumble/ConnectDialog.cpp
@@ -415,16 +415,10 @@ ServerItem *ServerItem::fromMimeData(const QMimeData *mime, bool default_name, Q
}
if (default_name) {
-#if QT_VERSION >= 0x050000
QUrlQuery query(url);
if (! query.hasQueryItem(QLatin1String("title"))) {
query.addQueryItem(QLatin1String("title"), url.host());
}
-#else
- if (! url.hasQueryItem(QLatin1String("title"))) {
- url.addQueryItem(QLatin1String("title"), url.host());
- }
-#endif
}
if (! url.isValid()) {
@@ -454,9 +448,7 @@ ServerItem *ServerItem::fromUrl(QUrl url, QWidget *p) {
return NULL;
}
-#if QT_VERSION >= 0x050000
QUrlQuery query(url);
-#endif
if (url.userName().isEmpty()) {
if (g.s.qsUsername.isEmpty()) {
@@ -471,17 +463,10 @@ ServerItem *ServerItem::fromUrl(QUrl url, QWidget *p) {
url.setUserName(g.s.qsUsername);
}
-#if QT_VERSION >= 0x050000
ServerItem *si = new ServerItem(query.queryItemValue(QLatin1String("title")), url.host(), static_cast<unsigned short>(url.port(DEFAULT_MUMBLE_PORT)), url.userName(), url.password());
if (query.hasQueryItem(QLatin1String("url")))
si->qsUrl = query.queryItemValue(QLatin1String("url"));
-#else
- ServerItem *si = new ServerItem(url.queryItemValue(QLatin1String("title")), url.host(), static_cast<unsigned short>(url.port(DEFAULT_MUMBLE_PORT)), url.userName(), url.password());
-
- if (url.hasQueryItem(QLatin1String("url")))
- si->qsUrl = url.queryItemValue(QLatin1String("url"));
-#endif
return si;
}
@@ -672,15 +657,10 @@ QMimeData *ServerItem::toMimeData(const QString &name, const QString &host, unsi
url.setPort(port);
url.setPath(channel);
-#if QT_VERSION >= 0x050000
QUrlQuery query;
query.addQueryItem(QLatin1String("title"), name);
query.addQueryItem(QLatin1String("version"), QLatin1String("1.2.0"));
url.setQuery(query);
-#else
- url.addQueryItem(QLatin1String("title"), name);
- url.addQueryItem(QLatin1String("version"), QLatin1String("1.2.0"));
-#endif
QString qs = QLatin1String(url.toEncoded());
@@ -1012,7 +992,6 @@ ConnectDialog::ConnectDialog(QWidget *p, bool autoconnect) : QDialog(p), bAutoCo
qtwServers->sortItems(1, Qt::AscendingOrder);
-#if QT_VERSION >= 0x050000
qtwServers->header()->setSectionResizeMode(0, QHeaderView::Stretch);
if (qtwServers->columnCount() >= 2) {
qtwServers->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
@@ -1020,15 +999,6 @@ ConnectDialog::ConnectDialog(QWidget *p, bool autoconnect) : QDialog(p), bAutoCo
if (qtwServers->columnCount() >= 3) {
qtwServers->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
}
-#else
- qtwServers->header()->setResizeMode(0, QHeaderView::Stretch);
- if (qtwServers->columnCount() >= 2) {
- qtwServers->header()->setResizeMode(1, QHeaderView::ResizeToContents);
- }
- if (qtwServers->columnCount() >= 3) {
- qtwServers->header()->setResizeMode(2, QHeaderView::ResizeToContents);
- }
-#endif
connect(qtwServers->header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), this, SLOT(OnSortChanged(int, Qt::SortOrder)));
@@ -1380,13 +1350,10 @@ void ConnectDialog::initList() {
QUrl url;
url.setPath(QLatin1String("/v1/list"));
-#if QT_VERSION >= 0x050000
+
QUrlQuery query;
query.addQueryItem(QLatin1String("version"), QLatin1String(MUMTEXT(MUMBLE_VERSION_STRING)));
url.setQuery(query);
-#else
- url.addQueryItem(QLatin1String("version"), QLatin1String(MUMTEXT(MUMBLE_VERSION_STRING)));
-#endif
WebFetch::fetch(QLatin1String("publist"), url, this, SLOT(fetched(QByteArray,QUrl,QMap<QString,QString>)));
}
diff --git a/src/mumble/DBus.cpp b/src/mumble/DBus.cpp
index 646be653d..108797e71 100644
--- a/src/mumble/DBus.cpp
+++ b/src/mumble/DBus.cpp
@@ -46,13 +46,9 @@ void MumbleDBus::getCurrentUrl(const QDBusMessage &msg) {
u.setPort(port);
u.setUserName(user);
-#if QT_VERSION >= 0x050000
QUrlQuery query;
query.addQueryItem(QLatin1String("version"), QLatin1String("1.2.0"));
u.setQuery(query);
-#else
- u.addQueryItem(QLatin1String("version"), QLatin1String("1.2.0"));
-#endif
QStringList path;
Channel *c = ClientUser::get(g.uiSession)->cChannel;
diff --git a/src/mumble/Database.cpp b/src/mumble/Database.cpp
index d89e268cd..da2ef6f34 100644
--- a/src/mumble/Database.cpp
+++ b/src/mumble/Database.cpp
@@ -47,11 +47,7 @@ Database::Database(const QString &dbname) {
int i;
datapaths << g.qdBasePath.absolutePath();
-#if QT_VERSION >= 0x050000
datapaths << QStandardPaths::writableLocation(QStandardPaths::DataLocation);
-#else
- datapaths << QDesktopServices::storageLocation(QDesktopServices::DataLocation);
-#endif
#if defined(Q_OS_UNIX) && ! defined(Q_OS_MAC)
datapaths << QDir::homePath() + QLatin1String("/.config/Mumble");
#endif
diff --git a/src/mumble/Global.cpp b/src/mumble/Global.cpp
index 41ec60e17..f3b82aa85 100644
--- a/src/mumble/Global.cpp
+++ b/src/mumble/Global.cpp
@@ -20,11 +20,7 @@ Global *Global::g_global_struct;
static void migrateDataDir() {
#ifdef Q_OS_MAC
QString olddir = QDir::homePath() + QLatin1String("/Library/Preferences/Mumble");
-#if QT_VERSION >= 0x050000
QString newdir = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
-#else
- QString newdir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
-#endif // QT_VERSION
QString linksTo = QFile::symLinkTarget(olddir);
if (!QFile::exists(newdir) && QFile::exists(olddir) && linksTo.isEmpty()) {
QDir d;
@@ -49,7 +45,6 @@ static void migrateDataDir() {
// Qt4 used another data directory on Unix-like systems, to ensure a seamless
// transition we must first move the users data to the new directory.
#if defined(Q_OS_UNIX) && ! defined(Q_OS_MAC)
-#if QT_VERSION >= 0x050000
QString olddir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/data/Mumble");
QString newdir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/Mumble");
@@ -66,7 +61,6 @@ static void migrateDataDir() {
}
qWarning("Application data migration failed.");
-#endif // QT_VERSION
#endif // defined(Q_OS_UNIX) && ! defined(Q_OS_MAC)
}
#endif // Q_OS_WIN
@@ -121,11 +115,8 @@ Global::Global() {
QStringList qsl;
qsl << QCoreApplication::instance()->applicationDirPath();
-#if QT_VERSION >= 0x050000
qsl << QStandardPaths::writableLocation(QStandardPaths::DataLocation);
-#else
- qsl << QDesktopServices::storageLocation(QDesktopServices::DataLocation);
-#endif
+
#if defined(Q_OS_WIN)
QString appdata;
wchar_t appData[MAX_PATH];
@@ -155,11 +146,7 @@ Global::Global() {
qdBasePath.setPath(appdata);
#else
migrateDataDir();
-#if QT_VERSION >= 0x050000
qdBasePath.setPath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
-#else
- qdBasePath.setPath(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
-#endif
#endif
if (! qdBasePath.exists()) {
QDir::root().mkpath(qdBasePath.absolutePath());
diff --git a/src/mumble/GlobalShortcut.cpp b/src/mumble/GlobalShortcut.cpp
index 26c5b5e19..6272285da 100644
--- a/src/mumble/GlobalShortcut.cpp
+++ b/src/mumble/GlobalShortcut.cpp
@@ -529,20 +529,11 @@ GlobalShortcutConfig::GlobalShortcutConfig(Settings &st) : ConfigWidget(st) {
qtwShortcuts->setColumnCount(canSuppress ? 4 : 3);
qtwShortcuts->setItemDelegate(new ShortcutDelegate(qtwShortcuts));
-#if QT_VERSION >= 0x050000
qtwShortcuts->header()->setSectionResizeMode(0, QHeaderView::Fixed);
qtwShortcuts->header()->resizeSection(0, 150);
qtwShortcuts->header()->setSectionResizeMode(2, QHeaderView::Stretch);
if (canSuppress)
qtwShortcuts->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
-#else
- qtwShortcuts->header()->setResizeMode(0, QHeaderView::Fixed);
- qtwShortcuts->header()->resizeSection(0, 150);
- qtwShortcuts->header()->setResizeMode(2, QHeaderView::Stretch);
- if (canSuppress)
- qtwShortcuts->header()->setResizeMode(3, QHeaderView::ResizeToContents);
-#endif
-
qcbEnableGlobalShortcuts->setVisible(canDisable);
diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp
index 85d417d60..3e39be694 100644
--- a/src/mumble/Log.cpp
+++ b/src/mumble/Log.cpp
@@ -39,21 +39,12 @@ LogConfig::LogConfig(Settings &st) : ConfigWidget(st) {
qgbTTS->setDisabled(true);
#endif
-#if QT_VERSION >= 0x050000
qtwMessages->header()->setSectionResizeMode(ColMessage, QHeaderView::Stretch);
qtwMessages->header()->setSectionResizeMode(ColConsole, QHeaderView::ResizeToContents);
qtwMessages->header()->setSectionResizeMode(ColNotification, QHeaderView::ResizeToContents);
qtwMessages->header()->setSectionResizeMode(ColHighlight, QHeaderView::ResizeToContents);
qtwMessages->header()->setSectionResizeMode(ColTTS, QHeaderView::ResizeToContents);
qtwMessages->header()->setSectionResizeMode(ColStaticSound, QHeaderView::ResizeToContents);
-#else
- qtwMessages->header()->setResizeMode(ColMessage, QHeaderView::Stretch);
- qtwMessages->header()->setResizeMode(ColConsole, QHeaderView::ResizeToContents);
- qtwMessages->header()->setResizeMode(ColNotification, QHeaderView::ResizeToContents);
- qtwMessages->header()->setResizeMode(ColHighlight, QHeaderView::ResizeToContents);
- qtwMessages->header()->setResizeMode(ColTTS, QHeaderView::ResizeToContents);
- qtwMessages->header()->setResizeMode(ColStaticSound, QHeaderView::ResizeToContents);
-#endif
QTreeWidgetItem *twi;
for (int i = Log::firstMsgType; i <= Log::lastMsgType; ++i) {
diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp
index a363673be..5459778d7 100644
--- a/src/mumble/MainWindow.cpp
+++ b/src/mumble/MainWindow.cpp
@@ -135,11 +135,6 @@ MainWindow::MainWindow(QWidget *p) : QMainWindow(p) {
qwPTTButtonWidget = NULL;
-#if QT_VERSION < 0x050000
- cuContextUser = QWeakPointer<ClientUser>();
- cContextChannel = QWeakPointer<Channel>();
-#endif
-
qtReconnect = new QTimer(this);
qtReconnect->setInterval(10000);
qtReconnect->setSingleShot(true);
@@ -356,9 +351,7 @@ void MainWindow::setupGui() {
updateTransmitModeComboBox();
-// For Qt >= 5, enable this call (only) for Windows.
-// For Qt < 5, enable for anything but macOS.
-#if (QT_VERSION >= 0x050000 && defined(Q_OS_WIN)) || (QT_VERSION < 0x050000 && !defined(Q_OS_MAC))
+#ifdef Q_OS_WIN
setupView(false);
#endif
@@ -383,12 +376,6 @@ void MainWindow::setupGui() {
#ifdef Q_OS_MAC
setWindowOpacity(1.0f);
-#if QT_VERSION < 0x040700
- // Process pending events. This is done to force the unified
- // toolbar to show up as soon as possible (and not wait until
- // we are back into the Cocoa mainloop)
- qApp->processEvents();
-#endif
#endif
}
@@ -437,12 +424,8 @@ void MainWindow::msgBox(QString msg) {
}
#ifdef Q_OS_WIN
-#if QT_VERSION >= 0x050000
bool MainWindow::nativeEvent(const QByteArray &, void *message, long *) {
MSG *msg = reinterpret_cast<MSG *>(message);
-#else
-bool MainWindow::winEvent(MSG *msg, long *) {
-#endif
if (msg->message == WM_DEVICECHANGE && msg->wParam == DBT_DEVNODES_CHANGED)
uiNewHardware++;
@@ -801,11 +784,7 @@ void MainWindow::saveImageAs() {
QString MainWindow::getImagePath(QString filename) const {
if (g.s.qsImagePath.isEmpty() || ! QDir(g.s.qsImagePath).exists()) {
-#if QT_VERSION >= 0x050000
g.s.qsImagePath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
-#else
- g.s.qsImagePath = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
-#endif
}
if (filename.isEmpty()) {
return g.s.qsImagePath;
@@ -878,12 +857,8 @@ void MainWindow::openUrl(const QUrl &url) {
minor = 2;
patch = 0;
-#if QT_VERSION >= 0x050000
QUrlQuery query(url);
QString version = query.queryItemValue(QLatin1String("version"));
-#else
- QString version = url.queryItemValue(QLatin1String("version"));
-#endif
MumbleVersion::get(&major, &minor, &patch, version);
if ((major < 1) || // No pre 1.2.0
@@ -902,13 +877,8 @@ void MainWindow::openUrl(const QUrl &url) {
qsDesiredChannel = url.path();
QString name;
-#if QT_VERSION >= 0x050000
if (query.hasQueryItem(QLatin1String("title")))
name = query.queryItemValue(QLatin1String("title"));
-#else
- if (url.hasQueryItem(QLatin1String("title")))
- name = url.queryItemValue(QLatin1String("title"));
-#endif
if (g.sh && g.sh->isRunning()) {
QString oHost, oUser, oPw;
diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h
index 661d0b668..ae8de533d 100644
--- a/src/mumble/MainWindow.h
+++ b/src/mumble/MainWindow.h
@@ -94,13 +94,8 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin
/// save when activating the "Save Image As..." context menu item.
QTextCursor qtcSaveImageCursor;
-#if QT_VERSION >= 0x050000
QPointer<Channel> cContextChannel;
QPointer<ClientUser> cuContextUser;
-#else
- QWeakPointer<Channel> cContextChannel;
- QWeakPointer<ClientUser> cuContextUser;
-#endif
QPoint qpContextPosition;
@@ -119,11 +114,7 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin
void openUserLocalVolumeDialog(ClientUser *p);
#ifdef Q_OS_WIN
-#if QT_VERSION >= 0x050000
bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
-#else
- bool winEvent(MSG *, long *) Q_DECL_OVERRIDE;
-#endif
unsigned int uiNewHardware;
#endif
protected:
diff --git a/src/mumble/MumbleApplication.cpp b/src/mumble/MumbleApplication.cpp
index c338fc805..e90f0ec8d 100644
--- a/src/mumble/MumbleApplication.cpp
+++ b/src/mumble/MumbleApplication.cpp
@@ -91,7 +91,6 @@ static bool gswForward(MSG *msg) {
return false;
}
-# if QT_VERSION >= 0x050000
bool MumbleApplication::nativeEventFilter(const QByteArray &, void *message, long *) {
MSG *msg = reinterpret_cast<MSG *>(message);
if (QThread::currentThread() == thread()) {
@@ -102,15 +101,4 @@ bool MumbleApplication::nativeEventFilter(const QByteArray &, void *message, lon
}
return false;
}
-# else
-bool MumbleApplication::winEventFilter(MSG *msg, long *result) {
- if (QThread::currentThread() == thread()) {
- bool suppress = gswForward(msg);
- if (suppress) {
- return true;
- }
- }
- return QApplication::winEventFilter(msg, result);
-}
-# endif
#endif
diff --git a/src/mumble/MumbleApplication.h b/src/mumble/MumbleApplication.h
index a67f62f61..cfe5a3031 100644
--- a/src/mumble/MumbleApplication.h
+++ b/src/mumble/MumbleApplication.h
@@ -9,14 +9,14 @@
#include <QApplication>
#include <QUrl>
-#if QT_VERSION >= 0x050000 && defined(Q_OS_WIN)
-# include <QAbstractNativeEventFilter>
+#ifdef Q_OS_WIN
+#include <QAbstractNativeEventFilter>
#endif
/**
* @brief Implements custom system shutdown behavior as well as event filtering.
*/
-#if QT_VERSION >= 0x050000 && defined(Q_OS_WIN)
+#ifdef Q_OS_WIN
class MumbleApplication : public QApplication, public QAbstractNativeEventFilter {
#else
class MumbleApplication : public QApplication {
@@ -50,11 +50,7 @@ class MumbleApplication : public QApplication {
bool event(QEvent *e) Q_DECL_OVERRIDE;
#ifdef Q_OS_WIN
-# if QT_VERSION >= 0x050000
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
-# else
- bool winEventFilter(MSG *msg, long *result) Q_DECL_OVERRIDE;
-# endif
#endif
QUrl quLaunchURL;
diff --git a/src/mumble/Overlay.cpp b/src/mumble/Overlay.cpp
index df960d3b7..2b47db766 100644
--- a/src/mumble/Overlay.cpp
+++ b/src/mumble/Overlay.cpp
@@ -141,12 +141,8 @@ OverlayAppInfo OverlayAppInfo::applicationInfoForId(const QString &identifier) {
HINSTANCE qWinAppInstValue = GetModuleHandle(NULL);
HICON icon = ExtractIcon(qWinAppInstValue, identifier.toStdWString().c_str(), 0);
if (icon) {
-#if QT_VERSION >= 0x050000
extern QPixmap qt_pixmapFromWinHICON(HICON icon);
qiAppIcon = QIcon(qt_pixmapFromWinHICON(icon));
-#else
- qiAppIcon = QIcon(QPixmap::fromWinHICON(icon));
-#endif
DestroyIcon(icon);
}
#endif
diff --git a/src/mumble/OverlayClient.cpp b/src/mumble/OverlayClient.cpp
index 735d6c88e..bd369edd9 100644
--- a/src/mumble/OverlayClient.cpp
+++ b/src/mumble/OverlayClient.cpp
@@ -137,19 +137,11 @@ void OverlayClient::updateMouse() {
QPixmap pm;
HICON c = ::GetCursor();
-#if QT_VERSION < 0x050000
- if (c == NULL)
- c = qgv.viewport()->cursor().handle();
-#endif
-
ICONINFO info;
ZeroMemory(&info, sizeof(info));
if (c != NULL && ::GetIconInfo(c, &info)) {
-#if QT_VERSION >= 0x050000
extern QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int format = 0);
-#else
-# define qt_pixmapFromWinHBITMAP(bmp) QPixmap::fromWinHBITMAP(bmp)
-#endif
+
if (info.hbmColor) {
pm = qt_pixmapFromWinHBITMAP(info.hbmColor);
pm.setMask(QBitmap(qt_pixmapFromWinHBITMAP(info.hbmMask)));
@@ -195,19 +187,11 @@ void OverlayClient::updateMouse() {
}
#endif
-#if QT_VERSION < 0x050000 && (defined(Q_OS_WIN) || defined(Q_OS_MAC))
-extern bool Q_GUI_EXPORT qt_use_native_dialogs;
-#endif
-
// Qt gets very very unhappy if we embed or unmbed the widget that an event is called from.
// This means that if any modal dialog is open, we'll be in a event loop of an object
// that we're about to reparent.
void OverlayClient::showGui() {
-#if defined(QT3_SUPPORT) || (defined(Q_OS_WIN) && QT_VERSION < 0x050000)
- if (QCoreApplication::loopLevel() > 1)
- return;
-#else
int count = 0;
{
@@ -221,7 +205,6 @@ void OverlayClient::showGui() {
// If there's more than one window up, we're likely deep in a message loop.
if (count > 1)
return;
-#endif
g.ocIntercept = this;
@@ -294,10 +277,6 @@ outer:
setupScene(true);
-#if QT_VERSION < 0x050000 && (defined(Q_OS_WIN) || defined(Q_OS_MAC))
- qt_use_native_dialogs = false;
-#endif
-
OverlayMsg om;
om.omh.uiMagic = OVERLAY_MAGIC_NUMBER;
om.omh.uiType = OVERLAY_MSGTYPE_INTERACTIVE;
@@ -309,14 +288,6 @@ outer:
}
void OverlayClient::hideGui() {
-#if defined(QT3_SUPPORT) || (defined(Q_OS_WIN) && QT_VERSION < 0x050000)
- if (QCoreApplication::loopLevel() > 1) {
- QCoreApplication::exit_loop();
- QMetaObject::invokeMethod(this, "hideGui", Qt::QueuedConnection);
- return;
- }
-#endif
-
ougUsers.bShowExamples = false;
QList<QWidget *> widgetlist;
@@ -367,9 +338,6 @@ void OverlayClient::hideGui() {
setupScene(false);
qgv.setAttribute(Qt::WA_WState_Hidden, true);
-#if QT_VERSION < 0x050000 && (defined(Q_OS_WIN) || defined(Q_OS_MAC))
- qt_use_native_dialogs = true;
-#endif
OverlayMsg om;
om.omh.uiMagic = OVERLAY_MAGIC_NUMBER;
diff --git a/src/mumble/Overlay_macx.mm b/src/mumble/Overlay_macx.mm
index 0f1994692..9aca57298 100644
--- a/src/mumble/Overlay_macx.mm
+++ b/src/mumble/Overlay_macx.mm
@@ -212,13 +212,6 @@ void OverlayClient::updateMouse() {
cgimg = [(NSBitmapImageRep *)rep CGImage];
}
}
-
-#if QT_VERSION < 0x050000
- if (cgimg) {
- pm = QPixmap::fromMacCGImageRef(cgimg);
- qmCursors.insert(csShape, pm);
- }
-#endif
}
NSPoint p = [cursor hotSpot];
diff --git a/src/mumble/Plugins.cpp b/src/mumble/Plugins.cpp
index 450e2649c..1addf2643 100644
--- a/src/mumble/Plugins.cpp
+++ b/src/mumble/Plugins.cpp
@@ -73,13 +73,8 @@ struct PluginFetchMeta {
PluginConfig::PluginConfig(Settings &st) : ConfigWidget(st) {
setupUi(this);
-#if QT_VERSION >= 0x050000
qtwPlugins->header()->setSectionResizeMode(0, QHeaderView::Stretch);
qtwPlugins->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
-#else
- qtwPlugins->header()->setResizeMode(0, QHeaderView::Stretch);
- qtwPlugins->header()->setResizeMode(1, QHeaderView::ResizeToContents);
-#endif
refillPluginList();
}
@@ -586,16 +581,10 @@ void Plugins::checkUpdates() {
#ifdef QT_NO_DEBUG
-#if QT_VERSION >= 0x050000
QUrlQuery query;
query.setQueryItems(queryItems);
url.setQuery(query);
-#else
- for (int i = 0; i < queryItems.size(); i++) {
- const QPair<QString, QString> &queryPair = queryItems.at(i);
- url.addQueryItem(queryPair.first, queryPair.second);
- }
-#endif
+
WebFetch::fetch(QLatin1String("update"), url, this, SLOT(fetchedUpdatePAPlugins(QByteArray,QUrl)));
#else
g.mw->msgBox(tr("Skipping plugin update in debug mode."));
diff --git a/src/mumble/ServerHandler.cpp b/src/mumble/ServerHandler.cpp
index 6498e1391..b5606acef 100644
--- a/src/mumble/ServerHandler.cpp
+++ b/src/mumble/ServerHandler.cpp
@@ -379,11 +379,10 @@ void ServerHandler::run() {
// In Qt 5.4, QSsl::SecureProtocols is equivalent
// to "TLSv1.0 or later", which we require.
qtsSock->setProtocol(QSsl::SecureProtocols);
- #elif QT_VERSION >= 0x050000
- qtsSock->setProtocol(QSsl::TlsV1_0);
#else
- qtsSock->setProtocol(QSsl::TlsV1);
+ qtsSock->setProtocol(QSsl::TlsV1_0);
#endif
+
qtsSock->connectToHost(saTargetServer.host.toAddress(), saTargetServer.port);
tTimestamp.restart();
diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp
index 298aab6ee..008bc3e2e 100644
--- a/src/mumble/Settings.cpp
+++ b/src/mumble/Settings.cpp
@@ -282,11 +282,7 @@ Settings::Settings() {
bPluginCheck = true;
#endif
-#if QT_VERSION >= 0x050000
qsImagePath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
-#else
- qsImagePath = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
-#endif
ceExpand = ChannelsWithUsers;
ceChannelDrag = Ask;
@@ -379,11 +375,7 @@ Settings::Settings() {
bHighContrast = false;
// Recording
-#if QT_VERSION >= 0x050000
qsRecordingPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
-#else
- qsRecordingPath = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
-#endif
qsRecordingFile = QLatin1String("Mumble-%date-%time-%host-%user");
rmRecordingMode = RecordingMixdown;
iRecordingFormat = 0;
diff --git a/src/mumble/SocketRPC.cpp b/src/mumble/SocketRPC.cpp
index 8a220b928..86234c5af 100644
--- a/src/mumble/SocketRPC.cpp
+++ b/src/mumble/SocketRPC.cpp
@@ -176,13 +176,9 @@ void SocketRPCClient::processXml() {
u.setPort(port);
u.setUserName(user);
-#if QT_VERSION >= 0x050000
QUrlQuery query;
query.addQueryItem(QLatin1String("version"), QLatin1String("1.2.0"));
u.setQuery(query);
-#else
- u.addQueryItem(QLatin1String("version"), QLatin1String("1.2.0"));
-#endif
QStringList path;
Channel *c = ClientUser::get(g.uiSession)->cChannel;
diff --git a/src/mumble/TaskList.cpp b/src/mumble/TaskList.cpp
index 58e37dedc..ffde41380 100644
--- a/src/mumble/TaskList.cpp
+++ b/src/mumble/TaskList.cpp
@@ -39,15 +39,10 @@ void TaskList::addToRecentList(QString name, QString user, QString host, int por
url.setHost(host);
url.setPort(port);
-#if QT_VERSION >= 0x050000
QUrlQuery query;
query.addQueryItem(QLatin1String("title"), name);
query.addQueryItem(QLatin1String("version"), QLatin1String("1.2.0"));
url.setQuery(query);
-#else
- url.addQueryItem(QLatin1String("title"), name);
- url.addQueryItem(QLatin1String("version"), QLatin1String("1.2.0"));
-#endif
QSettings settings(QLatin1String("HKEY_CLASSES_ROOT"), QSettings::NativeFormat);
diff --git a/src/mumble/UserEdit.cpp b/src/mumble/UserEdit.cpp
index d1305dcf9..972bdaf9f 100644
--- a/src/mumble/UserEdit.cpp
+++ b/src/mumble/UserEdit.cpp
@@ -37,20 +37,12 @@ UserEdit::UserEdit(const MumbleProto::UserList &userList, QWidget *p)
qtvUserList->setFocus();
qtvUserList->setContextMenuPolicy(Qt::CustomContextMenu);
-
-#if QT_VERSION >= 0x050000
qtvUserList->header()->setSectionResizeMode(UserListModel::COL_NICK, QHeaderView::Stretch);
+
if (!m_model->isLegacy()) {
qtvUserList->header()->setSectionResizeMode(UserListModel::COL_INACTIVEDAYS, QHeaderView::ResizeToContents);
qtvUserList->header()->setSectionResizeMode(UserListModel::COL_LASTCHANNEL, QHeaderView::Stretch);
}
-#else
- qtvUserList->header()->setResizeMode(UserListModel::COL_NICK, QHeaderView::Stretch);
- if (!m_model->isLegacy()) {
- qtvUserList->header()->setResizeMode(UserListModel::COL_INACTIVEDAYS, QHeaderView::ResizeToContents);
- qtvUserList->header()->setResizeMode(UserListModel::COL_LASTCHANNEL, QHeaderView::Stretch);
- }
-#endif
if (m_model->isLegacy()) {
qlInactive->hide();
diff --git a/src/mumble/UserInformation.cpp b/src/mumble/UserInformation.cpp
index 4fb5d2ce9..c93c7c544 100644
--- a/src/mumble/UserInformation.cpp
+++ b/src/mumble/UserInformation.cpp
@@ -21,14 +21,12 @@ static QString decode_utf8_qssl_string(const QString &input) {
return QUrl::fromPercentEncoding(i.replace(QLatin1String("\\x"), QLatin1String("%")).toLatin1());
}
-#if QT_VERSION >= 0x050000
static QString decode_utf8_qssl_string(const QStringList &list) {
if (list.count() > 0) {
return decode_utf8_qssl_string(list.at(0));
}
return QString();
}
-#endif
UserInformation::UserInformation(const MumbleProto::UserStats &msg, QWidget *p) : QDialog(p) {
setupUi(this);
@@ -115,12 +113,7 @@ void UserInformation::update(const MumbleProto::UserStats &msg) {
qpbCertificate->setEnabled(true);
const QSslCertificate &cert = qlCerts.last();
-
-#if QT_VERSION >= 0x050000
const QMultiMap<QSsl::AlternativeNameEntryType, QString> &alts = cert.subjectAlternativeNames();
-#else
- const QMultiMap<QSsl::AlternateNameEntryType, QString> &alts = cert.alternateSubjectNames();
-#endif
if (alts.contains(QSsl::EmailEntry))
qlCertificate->setText(QStringList(alts.values(QSsl::EmailEntry)).join(tr(", ")));
else
diff --git a/src/mumble/UserView.cpp b/src/mumble/UserView.cpp
index fdcd5afd2..121808376 100644
--- a/src/mumble/UserView.cpp
+++ b/src/mumble/UserView.cpp
@@ -41,12 +41,7 @@ void UserDelegate::paint(QPainter * painter, const QStyleOptionViewItem &option,
painter->save();
-#if QT_VERSION >= 0x050000
QStyleOptionViewItem o = option;
-#else
- QStyleOptionViewItemV4 o = option;
-#endif
-
initStyleOption(&o, index);
QStyle *style = o.widget->style();
@@ -375,12 +370,7 @@ void UserView::updateChannel(const QModelIndex &idx) {
}
}
-#if QT_VERSION >= 0x050000
-void UserView::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight, const QVector<int> &)
-#else
-void UserView::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight)
-#endif
-{
+void UserView::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight, const QVector<int> &) {
UserModel *um = static_cast<UserModel *>(model());
int nRowCount = um->rowCount();
int i;
@@ -389,4 +379,3 @@ void UserView::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bo
QTreeView::dataChanged(topLeft,bottomRight);
}
-
diff --git a/src/mumble/UserView.h b/src/mumble/UserView.h
index 504f457cb..8c50cd82b 100644
--- a/src/mumble/UserView.h
+++ b/src/mumble/UserView.h
@@ -47,12 +47,7 @@ class UserView : public QTreeView {
public:
UserView(QWidget *);
void keyboardSearch(const QString &search) Q_DECL_OVERRIDE;
-#if QT_VERSION >= 0x050000
void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight, const QVector<int> & roles = QVector<int> ()) Q_DECL_OVERRIDE;
-#else
- void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight) Q_DECL_OVERRIDE;
-#endif
-
public slots:
void nodeActivated(const QModelIndex &idx);
void selectSearchResult();
diff --git a/src/mumble/VersionCheck.cpp b/src/mumble/VersionCheck.cpp
index c70934587..b2c1a25b3 100644
--- a/src/mumble/VersionCheck.cpp
+++ b/src/mumble/VersionCheck.cpp
@@ -67,16 +67,10 @@ VersionCheck::VersionCheck(bool autocheck, QObject *p, bool focus) : QObject(p)
}
}
-#if QT_VERSION >= 0x050000
QUrlQuery query;
query.setQueryItems(queryItems);
url.setQuery(query);
-#else
- for (int i = 0; i < queryItems.size(); i++) {
- const QPair<QString, QString> &queryPair = queryItems.at(i);
- url.addQueryItem(queryPair.first, queryPair.second);
- }
-#endif
+
WebFetch::fetch(QLatin1String("update"), url, this, SLOT(fetched(QByteArray,QUrl)));
}
diff --git a/src/mumble/ViewCert.cpp b/src/mumble/ViewCert.cpp
index 6aa6d539f..3768b4396 100644
--- a/src/mumble/ViewCert.cpp
+++ b/src/mumble/ViewCert.cpp
@@ -18,7 +18,6 @@ static QString decode_utf8_qssl_string(const QString &input) {
return QUrl::fromPercentEncoding(i.replace(QLatin1String("\\x"), QLatin1String("%")).toLatin1());
}
-#if QT_VERSION >= 0x050000
static QStringList processQSslCertificateInfo(QStringList in) {
QStringList list;
foreach (QString str, in) {
@@ -26,13 +25,6 @@ static QStringList processQSslCertificateInfo(QStringList in) {
}
return list;
}
-#else
-static QStringList processQSslCertificateInfo(QString in) {
- QStringList out;
- out << decode_utf8_qssl_string(in);
- return out;
-}
-#endif
static void addQSslCertificateInfo(QStringList &l, const QString &label, const QStringList &items) {
foreach (const QString &item, items) {
@@ -132,17 +124,10 @@ void ViewCert::on_Chain_currentRowChanged(int idx) {
l << tr("Serial: %1").arg(QString::fromLatin1(c.serialNumber().toHex()));
l << tr("Public Key: %1 bits %2").arg(c.publicKey().length()).arg((c.publicKey().algorithm() == QSsl::Rsa) ? tr("RSA") : tr("DSA"));
l << tr("Digest (SHA-1): %1").arg(prettifyDigest(QString::fromLatin1(c.digest(QCryptographicHash::Sha1).toHex())));
-#if QT_VERSION >= 0x050000
l << tr("Digest (SHA-256): %1").arg(prettifyDigest(QString::fromLatin1(c.digest(QCryptographicHash::Sha256).toHex())));
-#endif
-#if QT_VERSION >= 0x050000
const QMultiMap<QSsl::AlternativeNameEntryType, QString> &alts = c.subjectAlternativeNames();
QMultiMap<QSsl::AlternativeNameEntryType, QString>::const_iterator i;
-#else
- const QMultiMap<QSsl::AlternateNameEntryType, QString> &alts = c.alternateSubjectNames();
- QMultiMap<QSsl::AlternateNameEntryType, QString>::const_iterator i;
-#endif
for (i=alts.constBegin(); i != alts.constEnd(); ++i) {
switch (i.key()) {
diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp
index b0b810d34..69613fa67 100644
--- a/src/mumble/main.cpp
+++ b/src/mumble/main.cpp
@@ -55,18 +55,6 @@
// We define a global macro called 'g'. This can lead to issues when included code uses 'g' as a type or parameter name (like protobuf 3.7 does). As such, for now, we have to make this our last include.
#include "Global.h"
-#if defined(USE_STATIC_QT_PLUGINS) && QT_VERSION < 0x050000
-Q_IMPORT_PLUGIN(qtaccessiblewidgets)
-# ifdef Q_OS_WIN
- Q_IMPORT_PLUGIN(qico)
-# endif
-Q_IMPORT_PLUGIN(qsvg)
-Q_IMPORT_PLUGIN(qsvgicon)
-# ifdef Q_OS_MAC
- Q_IMPORT_PLUGIN(qicnsicon)
-# endif
-#endif
-
#ifdef BOOST_NO_EXCEPTIONS
namespace boost {
void throw_exception(std::exception const &) {
@@ -120,7 +108,7 @@ int main(int argc, char **argv) {
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
-#if QT_VERSION >= 0x050000 && defined(Q_OS_WIN)
+#ifdef Q_OS_WIN
a.installNativeEventFilter(&a);
#endif
@@ -508,12 +496,7 @@ int main(int argc, char **argv) {
g.s.uiUpdateCounter = 2;
if (! CertWizard::validateCert(g.s.kpCertificate)) {
-#if QT_VERSION >= 0x050000
QDir qd(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
-#else
- QDir qd(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
-#endif
-
QFile qf(qd.absoluteFilePath(QLatin1String("MumbleAutomaticCertificateBackup.p12")));
if (qf.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) {
Settings::KeyPair kp = CertWizard::importCert(qf.readAll());
diff --git a/src/mumble/os_macx.mm b/src/mumble/os_macx.mm
index 616b5251b..e8a42682c 100644
--- a/src/mumble/os_macx.mm
+++ b/src/mumble/os_macx.mm
@@ -60,16 +60,10 @@ static void mumbleMessageOutputQString(QtMsgType type, const QString &msg) {
}
}
-#if QT_VERSION < 0x050000
-static void mumbleMessageOutput(QtMsgType type, const char *msg) {
- mumbleMessageOutputQString(type, QString::fromUtf8(msg));
-}
-#elif QT_VERSION >= 0x050000
static void mumbleMessageOutputWithContext(QtMsgType type, const QMessageLogContext &ctx, const QString &msg) {
Q_UNUSED(ctx);
mumbleMessageOutputQString(type, msg);
}
-#endif
void query_language() {
CFPropertyListRef cfaLangs;
@@ -154,11 +148,7 @@ void os_init() {
strcat(buff, logpath);
fConsole = fopen(buff, "a+");
if (fConsole) {
-#if QT_VERSION >= 0x050000
- qInstallMessageHandler(mumbleMessageOutputWithContext);
-#else
- qInstallMsgHandler(mumbleMessageOutput);
-#endif
+ qInstallMessageHandler(mumbleMessageOutputWithContext);
}
}
diff --git a/src/mumble/os_unix.cpp b/src/mumble/os_unix.cpp
index dc14de63d..669d907f6 100644
--- a/src/mumble/os_unix.cpp
+++ b/src/mumble/os_unix.cpp
@@ -38,16 +38,10 @@ static void mumbleMessageOutputQString(QtMsgType type, const QString &msg) {
}
}
-#if QT_VERSION < 0x050000
-static void mumbleMessageOutput(QtMsgType type, const char *msg) {
- mumbleMessageOutputQString(type, QString::fromUtf8(msg));
-}
-#elif QT_VERSION >= 0x050000
static void mumbleMessageOutputWithContext(QtMsgType type, const QMessageLogContext &ctx, const QString &msg) {
Q_UNUSED(ctx);
mumbleMessageOutputQString(type, msg);
}
-#endif
void os_init() {
// Make a copy of the global LogEmitter, such that
@@ -55,9 +49,5 @@ void os_init() {
// of the Global object and its LogEmitter object.
le = g.le;
-#if QT_VERSION >= 0x050000
qInstallMessageHandler(mumbleMessageOutputWithContext);
-#else
- qInstallMsgHandler(mumbleMessageOutput);
-#endif
}
diff --git a/src/mumble/os_win.cpp b/src/mumble/os_win.cpp
index ba107c7ef..2633cb929 100644
--- a/src/mumble/os_win.cpp
+++ b/src/mumble/os_win.cpp
@@ -81,18 +81,10 @@ static void mumbleMessageOutputQString(QtMsgType type, const QString &msg) {
}
}
-#if QT_VERSION < 0x050000
-static void mumbleMessageOutput(QtMsgType type, const char *msg) {
- mumbleMessageOutputQString(type, QString::fromUtf8(msg));
-}
-#endif
-
-#if QT_VERSION >= 0x050000
static void mumbleMessageOutputWithContext(QtMsgType type, const QMessageLogContext &ctx, const QString &msg) {
Q_UNUSED(ctx);
mumbleMessageOutputQString(type, msg);
}
-#endif
static LONG WINAPI MumbleUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo) {
MINIDUMP_EXCEPTION_INFORMATION i;
@@ -269,11 +261,7 @@ void os_init() {
fConsole = _wfsopen(console.toStdWString().c_str(), L"a+", _SH_DENYWR);
if (fConsole) {
-#if QT_VERSION >= 0x050000
qInstallMessageHandler(mumbleMessageOutputWithContext);
-#else
- qInstallMsgHandler(mumbleMessageOutput);
-#endif
}
QString hash;
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()) {
diff --git a/src/tests/TestServerResolver/TestServerResolver.cpp b/src/tests/TestServerResolver/TestServerResolver.cpp
index e8c984509..ddafcdb11 100644
--- a/src/tests/TestServerResolver/TestServerResolver.cpp
+++ b/src/tests/TestServerResolver/TestServerResolver.cpp
@@ -13,13 +13,7 @@
void signalSpyWait(QSignalSpy &spy) {
// We increase the timeout from 5s to 8s because travis builds could fail otherwise (slow network response).
const int signalTimeoutS = 8;
-#if QT_VERSION >= 0x050000
spy.wait(signalTimeoutS * 1000);
-#else
- // Equivalent to QSignalSpy::wait() in Qt 5, except we do not return early on a spied on signal result.
- QTestEventLoop loop;
- loop.enterLoop(signalTimeoutS);
-#endif
}
class TestServerResolver : public QObject {