Merge PR #3602: Remove Qt 4 stuff

This commit is contained in:
Davide Beatrici 2019-10-10 03:56:43 +02:00 committed by GitHub
commit df4ddb46f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
81 changed files with 146 additions and 1004 deletions

View File

@ -12,21 +12,15 @@
# "$$PWD/.." is the top of the source tree.
#
# clean_path() is used to clean the path.
# It's not available on Qt 4.
greaterThan(QT_MAJOR_VERSION, 4) {
TOP_SRCDIR = $$clean_path($$PWD/..)
}
TOP_SRCDIR = $$clean_path($$PWD/..)
# In case absolute_path() doesn't return anything.
# In case clean_path() doesn't return anything.
isEmpty(TOP_SRCDIR) {
TOP_SRCDIR = $$PWD/..
}
# shadowed() is used to retrieve the shadowed build path.
# It's not available on Qt 4.
greaterThan(QT_MAJOR_VERSION, 4) {
TOP_BUILDDIR = $$shadowed($$TOP_SRCDIR)
}
TOP_BUILDDIR = $$shadowed($$TOP_SRCDIR)
# In case shadowed() doesn't return anything.
isEmpty(TOP_BUILDDIR) {

View File

@ -23,18 +23,13 @@ QMAKE_RESOURCE_FLAGS += -compress 9
# architecture of the compiler via the
# force-x86_64-toolchain and force-x86-toolchain
# CONFIG options. Because we have these, qmake's
# QMAKE_TARGET.arch doesn't suffice any longer, and
# QT_ARCH doesn't suffice any longer, and
# we define MUMBLE_ARCH to be used in its place.
MUMBLE_ARCH = $$QMAKE_TARGET.arch
# When using Qt 5, use QT_ARCH instead of QMAKE_TARGET.
# It also works for cross-builds.
isEqual(QT_MAJOR_VERSION, 5) {
MUMBLE_ARCH = $$QT_ARCH
# QT_ARCH uses 'i386' instead of 'x86',
# so map that value back to what we expect.
equals(MUMBLE_ARCH, i386) {
MUMBLE_ARCH=x86
}
MUMBLE_ARCH = $$QT_ARCH
# QT_ARCH uses 'i386' instead of 'x86',
# so map that value back to what we expect.
equals(MUMBLE_ARCH, i386) {
MUMBLE_ARCH=x86
}
win32-g++ {
@ -344,20 +339,7 @@ macx {
!CONFIG(universal) {
CONFIG += no-pch
# Qt 5.1 and greater want short-form OS X SDKs.
isEqual(QT_MAJOR_VERSION, 5) {
QMAKE_MAC_SDK = macosx
} else {
QMAKE_MAC_SDK = $$system(xcrun --sdk macosx --show-sdk-path 2>/dev/null)
isEmpty(QMAKE_MAC_SDK) {
QMAKE_MAC_SDK = $$system(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
!exists($$QMAKE_MAC_SDK) {
message("Unable to find usable OS X SDK")
error("Aborting build")
}
}
}
QMAKE_MAC_SDK = macosx
QMAKE_CC = $$system(xcrun -find clang)
QMAKE_CXX = $$system(xcrun -find clang++)
QMAKE_LINK = $$system(xcrun -find clang++)

View File

@ -18,17 +18,13 @@
# adds c++11, c++14 or c++1z to CONFIG. If none of
# these are available, it adds c++03 to CONFIG.
#
# In Qt 5, qmake understands the c++11, c++14, and c++1z
# qmake understands the c++11, c++14, and c++1z
# CONFIG options, and will automatically populate
# QMAKE_CXXFLAGS and QMAKE_LFLAGS with the appropriate
# -std=c++XX values for the chosen C++ standard.
# For Qt 4, this .pri files will add the proper flags,
# because Qt 4's qmake doesn't know of the c++XX CONFIG
# options.
#
# The c++03 option is unknown for both Qt 4 and Qt 5.
# We handle setting up the proper CXXFLAGS and LFLAGS for
# both versions of Qt when c++03 is in CONFIG.
# The c++03 option is unknown for Qt.
# We handle setting up the proper CXXFLAGS and LFLAGS when c++03 is in CONFIG.
# First, auto-populate CONFIG with the latest C++ standard
# that Qt has detected support for.
@ -78,26 +74,9 @@ CONFIG(c++14) {
# Unix-specific handling of modern C++ features.
unix {
# Qt 4, as opposed to Qt 5, doesn't automatically
# populate QMAKE_CXXFLAGS and QMAKE_LFLAGS with the
# appropriate -std=c++XX flags. So, for Qt 4, we'll
# have to set them up manually.
lessThan(QT_MAJOR_VERSION, 5) {
CONFIG(c++1z) {
QMAKE_CXXFLAGS += -std=c++1z
QMAKE_LFLAGS += -std=c++1z
} else:CONFIG(c++14) {
QMAKE_CXXFLAGS += -std=c++14
QMAKE_LFLAGS += -std=c++14
} else:CONFIG(c++11) {
QMAKE_CXXFLAGS += -std=c++11
QMAKE_LFLAGS += -std=c++11
}
}
# No Qt versions know about CONFIG(c++03), since
# its our own internal hint -- so for CONFIG(c++03)
# we set QMAKE_CXXFLAGS and QMAKE_LFLAGS for both Qt 4
# and Qt 5.
# we set QMAKE_CXXFLAGS and QMAKE_LFLAGS.
CONFIG(c++03):!CONFIG(c++11):!CONFIG(c++14):!CONFIG(c++1z) {
# Note: we use -std=c++98 to support
# older compilers. In GCC, the following

View File

@ -5,13 +5,7 @@
# Allow cross-building by making a call to return the pkg-config
# that the user supplied to the build.
# pkgConfigExecutable() is part of Qt5.
# If building with Qt4, pkg-config is called instead
isEqual(QT_MAJOR_VERSION, 5) {
PKG_CONFIG = $$pkgConfigExecutable()
} else {
PKG_CONFIG = "pkg-config"
}
PKG_CONFIG = $$pkgConfigExecutable()
# must_pkgconfig(pkg)
#

View File

@ -14,15 +14,9 @@
#include "CryptState.h"
#include <QtCore/QMutex>
#if QT_VERSION >= 0x040700
# include <QtCore/QElapsedTimer>
#else
# include <QtCore/QTime>
#endif
#include <QtCore/QElapsedTimer>
#include <QtCore/QList>
#include <QtCore/QMutex>
#include <QtCore/QObject>
#include <QtNetwork/QSslSocket>
@ -42,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
@ -100,8 +90,4 @@ class Connection : public QObject {
#endif
};
#if QT_VERSION < 0x050000
Q_DECLARE_METATYPE(QAbstractSocket::SocketError)
#endif
#endif

View File

@ -1,19 +0,0 @@
// Copyright 2005-2019 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#ifndef MUMBLE_QATOMICINTCOMPAT_H_
#define MUMBLE_QATOMICINTCOMPAT_H_
// Portably (between Qt 4 and Qt 5) load the value
// of a QAtomicInt.
inline int QAtomicIntLoad(const QAtomicInt &ai) {
#if QT_VERSION >= 0x050000
return ai.load();
#else
return int(ai);
#endif
}
#endif

View File

@ -1,17 +0,0 @@
// Copyright 2005-2019 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#ifndef MUMBLE_QT4COMPAT_H_
#define MUMBLE_QT4COMPAT_H_
namespace Qt {
inline QString escape(const QString &plain) {
return plain.toHtmlEscaped();
}
}
#endif

View File

@ -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");
}

View File

@ -157,4 +157,4 @@ QList<ServerResolverRecord> ServerResolver::records() {
return QList<ServerResolverRecord>();
}
#include "ServerResolver_qt5.moc"
#include "ServerResolver.moc"

View File

@ -1,100 +0,0 @@
// Copyright 2005-2019 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#include "ServerResolver.h"
#include <QtNetwork/QHostInfo>
class ServerResolverPrivate : public QObject {
private:
Q_OBJECT
Q_DISABLE_COPY(ServerResolverPrivate)
public:
ServerResolverPrivate(QObject *parent);
void resolve(QString hostname, quint16 port);
QList<ServerResolverRecord> records();
QString m_origHostname;
quint16 m_origPort;
QList<ServerResolverRecord> m_resolved;
signals:
void resolved();
public slots:
void hostResolved(QHostInfo hostInfo);
};
ServerResolverPrivate::ServerResolverPrivate(QObject *parent)
: QObject(parent)
, m_origPort(0) {
}
void ServerResolverPrivate::resolve(QString hostname, quint16 port) {
m_origHostname = hostname;
m_origPort = port;
QHostInfo::lookupHost(hostname, this, SLOT(hostResolved(QHostInfo)));
}
QList<ServerResolverRecord> ServerResolverPrivate::records() {
return m_resolved;
}
void ServerResolverPrivate::hostResolved(QHostInfo hostInfo) {
if (hostInfo.error() == QHostInfo::NoError) {
QList<QHostAddress> resolvedAddresses = hostInfo.addresses();
// Convert QHostAddress -> HostAddress.
QList<HostAddress> addresses;
foreach (QHostAddress ha, resolvedAddresses) {
addresses << HostAddress(ha);
}
m_resolved << ServerResolverRecord(m_origHostname, m_origPort, 0, addresses);
}
emit resolved();
}
ServerResolver::ServerResolver(QObject *parent)
: QObject(parent) {
d = new ServerResolverPrivate(this);
}
QString ServerResolver::hostname() {
if (d) {
return d->m_origHostname;
}
return QString();
}
quint16 ServerResolver::port() {
if (d) {
return d->m_origPort;
}
return 0;
}
void ServerResolver::resolve(QString hostname, quint16 port) {
if (d) {
connect(d, SIGNAL(resolved()), this, SIGNAL(resolved()));
d->resolve(hostname, port);
}
}
QList<ServerResolverRecord> ServerResolver::records() {
if (d) {
return d->records();
}
return QList<ServerResolverRecord>();
}
#include "ServerResolver_nosrv.moc"

View File

@ -8,9 +8,6 @@
#ifndef MUMBLE_UTILS_H_
#define MUMBLE_UTILS_H_
#include "QAtomicIntCompat.h"
#include "Qt4Compat.h"
#include <QtCore/QtGlobal>
#define iroundf(x) ( static_cast<int>(x) )

View File

@ -72,7 +72,7 @@ SOURCES *= \
EnvUtils.cpp \
UnresolvedServerAddress.cpp \
ServerAddress.cpp \
ServerResolver_qt5.cpp \
ServerResolver.cpp \
ServerResolverRecord.cpp \
SelfSignedCertificate.cpp \
SSLLocks.cpp \
@ -80,16 +80,6 @@ SOURCES *= \
LIBS *= -lmumble_proto
equals(QT_MAJOR_VERSION, 4) {
CONFIG *= no-srv
}
CONFIG(no-srv) {
DEFINES += USE_NO_SRV
SOURCES -= ServerResolver_qt5.cpp
SOURCES *= ServerResolver_nosrv.cpp
}
# Add arc4random_uniform
INCLUDEPATH *= ../../3rdparty/arc4random-src
SOURCES *= ../../3rdparty/arc4random-src/arc4random_uniform.cpp
@ -130,13 +120,6 @@ unix {
QMAKE_CXXFLAGS *= "-I../mumble_proto" "-isystem ../mumble_proto"
}
# Make Q_DECL_OVERRIDE and Q_DECL_FINAL no-ops
# for Qt 4.
isEqual(QT_MAJOR_VERSION, 4) {
DEFINES *= Q_DECL_OVERRIDE=
DEFINES *= Q_DECL_FINAL=
}
CONFIG(debug, debug|release) {
CONFIG += console
}

View File

@ -338,7 +338,7 @@ void ALSAAudioInput::run() {
snd_pcm_close(capture_handle);
capture_handle = NULL;
}
g.mw->msgBox(tr("Opening chosen ALSA Input failed: %1").arg(Qt::escape(QLatin1String(snd_strerror(err)))));
g.mw->msgBox(tr("Opening chosen ALSA Input failed: %1").arg(QString::fromLatin1(snd_strerror(err)).toHtmlEscaped()));
return;
}
@ -476,7 +476,7 @@ void ALSAAudioOutput::run() {
snd_pcm_writei(pcm_handle, zerobuff, period_size);
if (! bOk) {
g.mw->msgBox(tr("Opening chosen ALSA Output failed: %1").arg(Qt::escape(QLatin1String(snd_strerror(err)))));
g.mw->msgBox(tr("Opening chosen ALSA Output failed: %1").arg(QString::fromLatin1(snd_strerror(err)).toHtmlEscaped()));
if (pcm_handle) {
snd_pcm_close(pcm_handle);
pcm_handle = NULL;

View File

@ -256,7 +256,7 @@ void ASIOConfig::on_qpbQuery_clicked() {
char err[255];
iasio->getErrorMessage(err);
SleepEx(10, false);
QMessageBox::critical(this, QLatin1String("Mumble"), tr("ASIO Initialization failed: %1").arg(Qt::escape(QLatin1String(err))), QMessageBox::Ok, QMessageBox::NoButton);
QMessageBox::critical(this, QLatin1String("Mumble"), tr("ASIO Initialization failed: %1").arg(QString::fromLatin1(err).toHtmlEscaped()), QMessageBox::Ok, QMessageBox::NoButton);
}
iasio->Release();
} else {
@ -281,7 +281,7 @@ void ASIOConfig::on_qpbConfig_clicked() {
char err[255];
iasio->getErrorMessage(err);
SleepEx(10, false);
QMessageBox::critical(this, QLatin1String("Mumble"), tr("ASIO Initialization failed: %1").arg(Qt::escape(QLatin1String(err))), QMessageBox::Ok, QMessageBox::NoButton);
QMessageBox::critical(this, QLatin1String("Mumble"), tr("ASIO Initialization failed: %1").arg(QString::fromLatin1(err).toHtmlEscaped()), QMessageBox::Ok, QMessageBox::NoButton);
}
iasio->Release();
} else {

View File

@ -36,9 +36,9 @@ AboutDialog::AboutDialog(QWidget *p) : QDialog(p) {
QList<LicenseInfo> thirdPartyLicenses = License::thirdPartyLicenses();
foreach(LicenseInfo li, thirdPartyLicenses) {
qtb3rdPartyLicense->append(QString::fromLatin1("<h3>%1 (<a href=\"%2\">%2</a>)</h3><pre>%3</pre>")
.arg(Qt::escape(li.name))
.arg(Qt::escape(li.url))
.arg(Qt::escape(li.license)));
.arg(li.name.toHtmlEscaped())
.arg(li.url.toHtmlEscaped())
.arg(li.license.toHtmlEscaped()));
}
qtb3rdPartyLicense->moveCursor(QTextCursor::Start);

View File

@ -8,11 +8,7 @@
#include <QtCore/QtGlobal>
#include <QtCore/QObject>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QDialog>
#else
# include <QtGui/QDialog>
#endif
#include <QtWidgets/QDialog>
class AboutDialog : public QDialog {
private:

View File

@ -371,7 +371,7 @@ void AudioInputDialog::on_qcbSystem_currentIndexChanged(int) {
foreach(audioDevice d, ql) {
qcbDevice->addItem(d.first, d.second);
qcbDevice->setItemData(idx, Qt::escape(d.first), Qt::ToolTipRole);
qcbDevice->setItemData(idx, d.first.toHtmlEscaped(), Qt::ToolTipRole);
++idx;
}
@ -524,7 +524,7 @@ void AudioOutputDialog::on_qcbSystem_currentIndexChanged(int) {
foreach(audioDevice d, ql) {
qcbDevice->addItem(d.first, d.second);
qcbDevice->setItemData(idx, Qt::escape(d.first), Qt::ToolTipRole);
qcbDevice->setItemData(idx, d.first.toHtmlEscaped(), Qt::ToolTipRole);
++idx;
}
bool canmute = aor->canMuteOthers();

View File

@ -194,7 +194,7 @@ QString AudioOutputSample::browseForSndfile(QString defaultpath) {
if (sf == NULL) {
QMessageBox::critical(NULL,
tr("Invalid sound file"),
tr("The file '%1' cannot be used by Mumble. Please select a file with a compatible format and encoding.").arg(Qt::escape(file)));
tr("The file '%1' cannot be used by Mumble. Please select a file with a compatible format and encoding.").arg(file.toHtmlEscaped()));
return QString();
}
delete sf;

View File

@ -9,11 +9,7 @@
#include <QtCore/QtGlobal>
#include <QtCore/QList>
#include <QtCore/QTimer>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QWidget>
#else
# include <QtGui/QWidget>
#endif
#include <QtWidgets/QWidget>
class AudioBar : public QWidget {
private:

View File

@ -7,13 +7,8 @@
#define MUMBLE_MUMBLE_AUDIOWIZARD_H_
#include <QtCore/QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QWizard>
# include <QtWidgets/QWizardPage>
#else
# include <QtGui/QWizard>
# include <QtGui/QWizardPage>
#endif
#include <QtWidgets/QWizard>
#include <QtWidgets/QWizardPage>
#include "AudioStats.h"
#include "AudioOutput.h"

View File

@ -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("%"));
@ -104,22 +99,19 @@ void CertView::setCert(const QList<QSslCertificate> &cert) {
qlSubjectEmail->setText(tr("(none)"));
if (qscCert.expiryDate() <= QDateTime::currentDateTime())
qlExpiry->setText(QString::fromLatin1("<font color=\"red\"><b>%1</b></font>").arg(Qt::escape(qscCert.expiryDate().toString(Qt::SystemLocaleDate))));
qlExpiry->setText(QString::fromLatin1("<font color=\"red\"><b>%1</b></font>").arg(qscCert.expiryDate().toString(Qt::SystemLocaleDate).toHtmlEscaped()));
else
qlExpiry->setText(qscCert.expiryDate().toString(Qt::SystemLocaleDate));
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);
}
}

View File

@ -8,11 +8,7 @@
#include <QtCore/QtGlobal>
#include <QtCore/QString>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QGroupBox>
#else
# include <QtGui/QGroupBox>
#endif
#include <QtWidgets/QGroupBox>
#include <QtNetwork/QHostInfo>
#include <QtNetwork/QSslCertificate>

View File

@ -8,11 +8,7 @@
#include <QtCore/QtGlobal>
#include <QtCore/QObject>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QWidget>
#else
# include <QtGui/QWidget>
#endif
#include <QtWidgets/QWidget>
struct Settings;
class ConfigDialog;

View File

@ -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;
}
@ -521,7 +506,8 @@ QVariant ServerItem::data(int column, int role) const {
} else if (role == Qt::ToolTipRole) {
QStringList qsl;
foreach(const ServerAddress &addr, qlAddresses) {
qsl << Qt::escape(addr.host.toString() + QLatin1String(":") + QString::number(static_cast<unsigned long>(addr.port)));
const QString qsAddress = addr.host.toString() + QLatin1String(":") + QString::number(static_cast<unsigned long>(addr.port));
qsl << qsAddress.toHtmlEscaped();
}
double ploss = 100.0;
@ -532,18 +518,18 @@ QVariant ServerItem::data(int column, int role) const {
QString qs;
qs +=
QLatin1String("<table>") +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Servername"), Qt::escape(qsName)) +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Hostname"), Qt::escape(qsHostname));
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Servername"), qsName.toHtmlEscaped()) +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Hostname"), qsHostname.toHtmlEscaped());
if (! qsBonjourHost.isEmpty())
qs += QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Bonjour name"), Qt::escape(qsBonjourHost));
qs += QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Bonjour name"), qsBonjourHost.toHtmlEscaped());
qs +=
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Port")).arg(usPort) +
QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Addresses"), qsl.join(QLatin1String(", ")));
if (! qsUrl.isEmpty())
qs += QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Website"), Qt::escape(qsUrl));
qs += QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Website"), qsUrl.toHtmlEscaped());
if (uiSent > 0) {
qs += QString::fromLatin1("<tr><th align=left>%1</th><td>%2</td></tr>").arg(ConnectDialog::tr("Packet loss"), QString::fromLatin1("%1% (%2/%3)").arg(ploss, 0, 'f', 1).arg(uiRecv).arg(uiSent));
@ -671,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());
@ -723,7 +704,7 @@ QMimeData *ServerItem::toMimeData(const QString &name, const QString &host, unsi
mime->setUrls(urls);
mime->setText(qs);
mime->setHtml(QString::fromLatin1("<a href=\"%1\">%2</a>").arg(qs).arg(Qt::escape(name)));
mime->setHtml(QString::fromLatin1("<a href=\"%1\">%2</a>").arg(qs).arg(name.toHtmlEscaped()));
return mime;
}
@ -1011,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);
@ -1019,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)));
@ -1379,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>)));
}

View File

@ -14,15 +14,9 @@
#include <QtCore/QtGlobal>
#include <QtCore/QString>
#include <QtCore/QUrl>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QStyledItemDelegate>
# include <QtWidgets/QTreeView>
# include <QtWidgets/QTreeWidgetItem>
#else
# include <QtGui/QStyledItemDelegate>
# include <QtGui/QTreeView>
# include <QtGui/QTreeWidgetItem>
#endif
#include <QtWidgets/QStyledItemDelegate>
#include <QtWidgets/QTreeView>
#include <QtWidgets/QTreeWidgetItem>
#include <QtNetwork/QHostInfo>

View File

@ -9,18 +9,10 @@
#include <QtCore/QObject>
#include <QtCore/QEventLoop>
#include <QtNetwork/QNetworkReply>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QDialog>
# include <QtWidgets/QProgressDialog>
# include <QtWidgets/QLineEdit>
# include <QtWidgets/QTextEdit>
#else
# include <QtGui/QDialog>
# include <QtGui/QProgressDialog>
# include <QtGui/QLineEdit>
# include <QtGui/QTextEdit>
#endif
#include <QtWidgets/QDialog>
#include <QtWidgets/QProgressDialog>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QTextEdit>
class CrashReporter : QDialog {
Q_OBJECT

View File

@ -7,16 +7,9 @@
#define MUMBLE_MUMBLE_CUSTOMELEMENTS_H_
#include <QtCore/QObject>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QLabel>
# include <QtWidgets/QTextBrowser>
# include <QtWidgets/QTextEdit>
#else
# include <QtGui/QLabel>
# include <QtGui/QTextBrowser>
# include <QtGui/QTextEdit>
#endif
#include <QtWidgets/QLabel>
#include <QtWidgets/QTextBrowser>
#include <QtWidgets/QTextEdit>
class LogTextBrowser : public QTextBrowser {
private:

View File

@ -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;

View File

@ -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
@ -100,7 +96,7 @@ Database::Database(const QString &dbname) {
QFileInfo fi(db.databaseName());
if (! fi.isWritable()) {
QMessageBox::critical(NULL, QLatin1String("Mumble"), tr("The database '%1' is read-only. Mumble cannot store server settings (i.e. SSL certificates) until you fix this problem.").arg(Qt::escape(fi.filePath())), QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton);
QMessageBox::critical(NULL, QLatin1String("Mumble"), tr("The database '%1' is read-only. Mumble cannot store server settings (i.e. SSL certificates) until you fix this problem.").arg(fi.filePath().toHtmlEscaped()), QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton);
qWarning("Database: Database is read-only");
}

View File

@ -8,12 +8,8 @@
#include <QtCore/QStringList>
#include <QtCore/QObject>
# include <QtCore/QPointer>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QMainWindow>
#else
# include <QtGui/QMainWindow>
#endif
#include <QtCore/QPointer>
#include <QtWidgets/QMainWindow>
class DeveloperConsole : public QObject {
private:

View File

@ -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());

View File

@ -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);

View File

@ -8,13 +8,8 @@
#include <QtCore/QtGlobal>
#include <QtCore/QThread>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QToolButton>
# include <QtWidgets/QStyledItemDelegate>
#else
# include <QtGui/QToolButton>
# include <QtGui/QStyledItemDelegate>
#endif
#include <QtWidgets/QToolButton>
#include <QtWidgets/QStyledItemDelegate>
#include "ConfigDialog.h"
#include "Timer.h"

View File

@ -88,7 +88,7 @@ LCDConfig::LCDConfig(Settings &st) : ConfigWidget(st) {
qtwi->setFlags(Qt::ItemIsEnabled |Qt::ItemIsUserCheckable);
qtwi->setText(0, d->name());
qtwi->setToolTip(0, Qt::escape(d->name()));
qtwi->setToolTip(0, d->name().toHtmlEscaped());
QSize lcdsize = d->size();
QString qsSize = QString::fromLatin1("%1x%2").arg(lcdsize.width()).arg(lcdsize.height());

View File

@ -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) {
@ -301,7 +292,7 @@ QString Log::msgColor(const QString &text, LogColorType t) {
}
QString Log::formatChannel(::Channel *c) {
return QString::fromLatin1("<a href='channelid://%1/%3' class='log-channel'>%2</a>").arg(c->iId).arg(Qt::escape(c->qsName)).arg(QString::fromLatin1(g.sh->qbaDigest.toBase64()));
return QString::fromLatin1("<a href='channelid://%1/%3' class='log-channel'>%2</a>").arg(c->iId).arg(c->qsName.toHtmlEscaped()).arg(QString::fromLatin1(g.sh->qbaDigest.toBase64()));
}
QString Log::formatClientUser(ClientUser *cu, LogColorType t, const QString &displayName) {
@ -313,7 +304,7 @@ QString Log::formatClientUser(ClientUser *cu, LogColorType t, const QString &dis
}
if (cu) {
QString name = Qt::escape(displayName.isNull() ? cu->qsName : displayName);
QString name = (displayName.isNull() ? cu->qsName : displayName).toHtmlEscaped();
if (cu->qsHash.isEmpty()) {
return QString::fromLatin1("<a href='clientid://%2/%4' class='log-user log-%1'>%3</a>").arg(className).arg(cu->uiSession).arg(name).arg(QString::fromLatin1(g.sh->qbaDigest.toBase64()));
} else {
@ -489,7 +480,7 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own
if (qdDate != dt.date()) {
qdDate = dt.date();
tc.insertBlock();
tc.insertHtml(tr("[Date changed to %1]\n").arg(Qt::escape(qdDate.toString(Qt::DefaultLocaleShortDate))));
tc.insertHtml(tr("[Date changed to %1]\n").arg(qdDate.toString(Qt::DefaultLocaleShortDate).toHtmlEscaped()));
tc.movePosition(QTextCursor::End);
}
@ -502,7 +493,7 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own
} else if (! g.mw->qteLog->document()->isEmpty()) {
tc.insertBlock();
}
tc.insertHtml(Log::msgColor(QString::fromLatin1("[%1] ").arg(Qt::escape(dt.time().toString())), Log::Time));
tc.insertHtml(Log::msgColor(QString::fromLatin1("[%1] ").arg(dt.time().toString().toHtmlEscaped()), Log::Time));
validHtml(console, &tc);
tc.movePosition(QTextCursor::End);
g.mw->qteLog->setTextCursor(tc);

View File

@ -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++;
@ -795,17 +778,13 @@ void MainWindow::saveImageAs() {
updateImagePath(fname);
if (!ok) {
g.l->log(Log::Warning, tr("Could not save image: %1").arg(Qt::escape(fname)));
g.l->log(Log::Warning, tr("Could not save image: %1").arg(fname.toHtmlEscaped()));
}
}
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;
@ -841,7 +820,7 @@ static void recreateServerHandler() {
}
void MainWindow::openUrl(const QUrl &url) {
g.l->log(Log::Information, tr("Opening URL %1").arg(Qt::escape(url.toString())));
g.l->log(Log::Information, tr("Opening URL %1").arg(url.toString().toHtmlEscaped()));
if (url.scheme() == QLatin1String("file")) {
QFile f(url.toLocalFile());
if (! f.exists() || ! f.open(QIODevice::ReadOnly)) {
@ -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;
@ -942,7 +912,7 @@ void MainWindow::openUrl(const QUrl &url) {
rtLast = MumbleProto::Reject_RejectType_None;
bRetryServer = true;
qaServerDisconnect->setEnabled(true);
g.l->log(Log::Information, tr("Connecting to server %1.").arg(Log::msgColor(Qt::escape(host), Log::Server)));
g.l->log(Log::Information, tr("Connecting to server %1.").arg(Log::msgColor(host.toHtmlEscaped(), Log::Server)));
g.sh->setConnectionInfo(host, port, user, pw);
g.sh->start(QThread::TimeCriticalPriority);
}
@ -1163,7 +1133,7 @@ void MainWindow::on_qaServerConnect_triggered(bool autoconnect) {
rtLast = MumbleProto::Reject_RejectType_None;
bRetryServer = true;
qaServerDisconnect->setEnabled(true);
g.l->log(Log::Information, tr("Connecting to server %1.").arg(Log::msgColor(Qt::escape(cd->qsServer), Log::Server)));
g.l->log(Log::Information, tr("Connecting to server %1.").arg(Log::msgColor(cd->qsServer.toHtmlEscaped(), Log::Server)));
g.sh->setConnectionInfo(cd->qsServer, cd->usPort, cd->qsUsername, cd->qsPassword);
g.sh->start(QThread::TimeCriticalPriority);
}
@ -1239,7 +1209,7 @@ void MainWindow::on_qaSelfRegister_triggered() {
return;
QMessageBox::StandardButton result;
result = QMessageBox::question(this, tr("Register yourself as %1").arg(p->qsName), tr("<p>You are about to register yourself on this server. This action cannot be undone, and your username cannot be changed once this is done. You will forever be known as '%1' on this server.</p><p>Are you sure you want to register yourself?</p>").arg(Qt::escape(p->qsName)), QMessageBox::Yes|QMessageBox::No);
result = QMessageBox::question(this, tr("Register yourself as %1").arg(p->qsName), tr("<p>You are about to register yourself on this server. This action cannot be undone, and your username cannot be changed once this is done. You will forever be known as '%1' on this server.</p><p>Are you sure you want to register yourself?</p>").arg(p->qsName.toHtmlEscaped()), QMessageBox::Yes|QMessageBox::No);
if (result == QMessageBox::Yes)
g.sh->registerUser(p->uiSession);
@ -1351,7 +1321,7 @@ void MainWindow::on_qaServerInformation_triggered() {
qsVersion.append(tr("<p>No build information or OS version available</p>"));
} else {
qsVersion.append(tr("<p>%1 (%2)<br />%3</p>")
.arg(Qt::escape(g.sh->qsRelease), Qt::escape(g.sh->qsOS), Qt::escape(g.sh->qsOSVersion)));
.arg(g.sh->qsRelease.toHtmlEscaped(), g.sh->qsOS.toHtmlEscaped(), g.sh->qsOSVersion.toHtmlEscaped()));
}
QString host, uname, pw;
@ -1403,12 +1373,12 @@ void MainWindow::on_qaServerInformation_triggered() {
"%3"
"<p>%4 ms average latency (%5 deviation)</p>"
"<p>Remote host %6 (port %7)</p>").arg(
Qt::escape(c->sessionProtocolString()),
c->sessionProtocolString().toHtmlEscaped(),
cipherDescription,
cipherPFSInfo,
QString::fromLatin1("%1").arg(boost::accumulators::mean(g.sh->accTCP), 0, 'f', 2),
QString::fromLatin1("%1").arg(sqrt(boost::accumulators::variance(g.sh->accTCP)),0,'f',2),
Qt::escape(host),
host.toHtmlEscaped(),
QString::number(port));
if (g.uiMaxUsers) {
qsControl += tr("<p>Connected users: %1/%2</p>").arg(ModelItem::c_qhUsers.count()).arg(g.uiMaxUsers);
@ -1688,9 +1658,9 @@ void MainWindow::on_qaUserRegister_triggered() {
QMessageBox::StandardButton result;
if (session == g.uiSession)
result = QMessageBox::question(this, tr("Register yourself as %1").arg(p->qsName), tr("<p>You are about to register yourself on this server. This action cannot be undone, and your username cannot be changed once this is done. You will forever be known as '%1' on this server.</p><p>Are you sure you want to register yourself?</p>").arg(Qt::escape(p->qsName)), QMessageBox::Yes|QMessageBox::No);
result = QMessageBox::question(this, tr("Register yourself as %1").arg(p->qsName), tr("<p>You are about to register yourself on this server. This action cannot be undone, and your username cannot be changed once this is done. You will forever be known as '%1' on this server.</p><p>Are you sure you want to register yourself?</p>").arg(p->qsName.toHtmlEscaped()), QMessageBox::Yes|QMessageBox::No);
else
result = QMessageBox::question(this, tr("Register user %1").arg(p->qsName), tr("<p>You are about to register %1 on the server. This action cannot be undone, the username cannot be changed, and as a registered user, %1 will have access to the server even if you change the server password.</p><p>From this point on, %1 will be authenticated with the certificate currently in use.</p><p>Are you sure you want to register %1?</p>").arg(Qt::escape(p->qsName)), QMessageBox::Yes|QMessageBox::No);
result = QMessageBox::question(this, tr("Register user %1").arg(p->qsName), tr("<p>You are about to register %1 on the server. This action cannot be undone, the username cannot be changed, and as a registered user, %1 will have access to the server even if you change the server password.</p><p>From this point on, %1 will be authenticated with the certificate currently in use.</p><p>Are you sure you want to register %1?</p>").arg(p->qsName.toHtmlEscaped()), QMessageBox::Yes|QMessageBox::No);
if (result == QMessageBox::Yes) {
p = ClientUser::get(session);
@ -1826,7 +1796,7 @@ void MainWindow::on_qaUserCommentReset_triggered() {
unsigned int session = p->uiSession;
int ret = QMessageBox::question(this, QLatin1String("Mumble"),
tr("Are you sure you want to reset the comment of user %1?").arg(Qt::escape(p->qsName)),
tr("Are you sure you want to reset the comment of user %1?").arg(p->qsName.toHtmlEscaped()),
QMessageBox::Yes, QMessageBox::No);
if (ret == QMessageBox::Yes) {
g.sh->setUserComment(session, QString());
@ -1842,7 +1812,7 @@ void MainWindow::on_qaUserTextureReset_triggered() {
unsigned int session = p->uiSession;
int ret = QMessageBox::question(this, QLatin1String("Mumble"),
tr("Are you sure you want to reset the avatar of user %1?").arg(Qt::escape(p->qsName)),
tr("Are you sure you want to reset the avatar of user %1?").arg(p->qsName.toHtmlEscaped()),
QMessageBox::Yes, QMessageBox::No);
if (ret == QMessageBox::Yes) {
g.sh->setUserTexture(session, QByteArray());
@ -1873,11 +1843,7 @@ void MainWindow::sendChatbarMessage(QString qsText) {
ClientUser *p = pmModel->getUser(qtvUsers->currentIndex());
Channel *c = pmModel->getChannel(qtvUsers->currentIndex());
#if QT_VERSION >= 0x050000
qsText = qsText.toHtmlEscaped();
#else
qsText = Qt::escape(qsText);
#endif
qsText = TextMessage::autoFormat(qsText);
if (!g.s.bChatBarUseSelection || p == NULL || p->uiSession == g.uiSession) {
@ -2074,7 +2040,7 @@ void MainWindow::on_qaChannelRemove_triggered() {
int id = c->iId;
ret=QMessageBox::question(this, QLatin1String("Mumble"), tr("Are you sure you want to delete %1 and all its sub-channels?").arg(Qt::escape(c->qsName)), QMessageBox::Yes, QMessageBox::No);
ret=QMessageBox::question(this, QLatin1String("Mumble"), tr("Are you sure you want to delete %1 and all its sub-channels?").arg(c->qsName.toHtmlEscaped()), QMessageBox::Yes, QMessageBox::No);
c = Channel::get(id);
if (!c)
@ -2965,7 +2931,7 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re
if (! g.sh->qlErrors.isEmpty()) {
foreach(QSslError e, g.sh->qlErrors)
g.l->log(Log::Warning, tr("SSL Verification failed: %1").arg(Qt::escape(e.errorString())));
g.l->log(Log::Warning, tr("SSL Verification failed: %1").arg(e.errorString().toHtmlEscaped()));
if (! g.sh->qscCert.isEmpty()) {
QSslCertificate c = g.sh->qscCert.at(0);
QString basereason;
@ -2980,7 +2946,7 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re
}
QStringList qsl;
foreach(QSslError e, g.sh->qlErrors)
qsl << QString::fromLatin1("<li>%1</li>").arg(Qt::escape(e.errorString()));
qsl << QString::fromLatin1("<li>%1</li>").arg(e.errorString().toHtmlEscaped());
QMessageBox qmb(QMessageBox::Warning, QLatin1String("Mumble"),
tr("<p>%1</p><ul>%2</ul><p>The specific errors with this certificate are:</p><ol>%3</ol>"
@ -3013,7 +2979,7 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re
if (! reason.isEmpty()) {
g.l->log(Log::ServerDisconnected, tr("Server connection failed: %1.").arg(Qt::escape(reason)));
g.l->log(Log::ServerDisconnected, tr("Server connection failed: %1.").arg(reason.toHtmlEscaped()));
} else {
g.l->log(Log::ServerDisconnected, tr("Disconnected from server."));
}
@ -3072,7 +3038,7 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re
void MainWindow::resolverError(QAbstractSocket::SocketError, QString reason) {
if (! reason.isEmpty()) {
g.l->log(Log::ServerDisconnected, tr("Server connection failed: %1.").arg(Qt::escape(reason)));
g.l->log(Log::ServerDisconnected, tr("Server connection failed: %1.").arg(reason.toHtmlEscaped()));
} else {
g.l->log(Log::ServerDisconnected, tr("Server connection failed."));
}
@ -3160,10 +3126,10 @@ void MainWindow::updateChatBar() {
if (!g.s.bChatBarUseSelection || c == NULL) // If no channel selected fallback to current one
c = ClientUser::get(g.uiSession)->cChannel;
qteChat->setDefaultText(tr("<center>Type message to channel '%1' here</center>").arg(Qt::escape(c->qsName)));
qteChat->setDefaultText(tr("<center>Type message to channel '%1' here</center>").arg(c->qsName.toHtmlEscaped()));
} else {
// User target
qteChat->setDefaultText(tr("<center>Type message to user '%1' here</center>").arg(Qt::escape(p->qsName)));
qteChat->setDefaultText(tr("<center>Type message to user '%1' here</center>").arg(p->qsName.toHtmlEscaped()));
}
updateMenuPermissions();

View File

@ -7,16 +7,9 @@
#define MUMBLE_MUMBLE_MAINWINDOW_H_
#include <QtCore/QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtCore/QPointer>
# include <QtWidgets/QMainWindow>
# include <QtWidgets/QSystemTrayIcon>
#else
# include <QtCore/QWeakPointer>
# include <QtGui/QMainWindow>
# include <QtGui/QSystemTrayIcon>
#endif
#include <QtCore/QPointer>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QSystemTrayIcon>
#include <QtNetwork/QAbstractSocket>
#include "CustomElements.h"
@ -101,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;
@ -126,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:

View File

@ -7,11 +7,7 @@
#include <QtCore/QtCore>
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QMessageBox>
#else
# include <QMessageBox>
#endif
#include <QtWidgets/QMessageBox>
#include <QPointer>
#include "ManualPlugin.h"

View File

@ -7,15 +7,9 @@
#define MUMBLE_MUMBLE_MANUALPLUGIN_H_
#include <QtCore/QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QDialog>
# include <QtWidgets/QGraphicsItem>
# include <QtWidgets/QGraphicsScene>
#else
# include <QDialog>
# include <QGraphicsItem>
# include <QGraphicsScene>
#endif
#include <QtWidgets/QDialog>
#include <QtWidgets/QGraphicsItem>
#include <QtWidgets/QGraphicsScene>
#include "ui_ManualPlugin.h"

View File

@ -83,7 +83,7 @@ void MainWindow::msgReject(const MumbleProto::Reject &msg) {
reason = tr("Your account information can not be verified currently. Please try again later");
break;
default:
reason = Qt::escape(u8(msg.reason()));
reason = u8(msg.reason()).toHtmlEscaped();
break;
}
@ -138,7 +138,7 @@ void MainWindow::msgServerSync(const MumbleProto::ServerSync &msg) {
connect(user, SIGNAL(prioritySpeakerStateChanged()), this, SLOT(userStateChanged()));
connect(user, SIGNAL(recordingStateChanged()), this, SLOT(userStateChanged()));
qstiIcon->setToolTip(tr("Mumble: %1").arg(Qt::escape(Channel::get(0)->qsName)));
qstiIcon->setToolTip(tr("Mumble: %1").arg(Channel::get(0)->qsName.toHtmlEscaped()));
// Update QActions and menues
on_qmServer_aboutToShow();
@ -205,7 +205,7 @@ void MainWindow::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
g.s.bTTS = true;
quint32 oflags = g.s.qmMessages.value(Log::PermissionDenied);
g.s.qmMessages[Log::PermissionDenied] = (oflags | Settings::LogTTS) & (~Settings::LogSoundfile);
g.l->log(Log::PermissionDenied, QString::fromUtf8(g.ccHappyEaster + 39).arg(Qt::escape(g.s.qsUsername)));
g.l->log(Log::PermissionDenied, QString::fromUtf8(g.ccHappyEaster + 39).arg(g.s.qsUsername.toHtmlEscaped()));
g.s.qmMessages[Log::PermissionDenied] = oflags;
g.s.bDeaf = bold;
g.s.bTTS = bold2;
@ -230,7 +230,7 @@ void MainWindow::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
break;
case MumbleProto::PermissionDenied_DenyType_UserName: {
if (msg.has_name())
g.l->log(Log::PermissionDenied, tr("Invalid username: %1.").arg(Qt::escape(u8(msg.name()))));
g.l->log(Log::PermissionDenied, tr("Invalid username: %1.").arg(u8(msg.name()).toHtmlEscaped()));
else
g.l->log(Log::PermissionDenied, tr("Invalid username."));
}
@ -249,7 +249,7 @@ void MainWindow::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
break;
default: {
if (msg.has_reason())
g.l->log(Log::PermissionDenied, tr("Denied: %1.").arg(Qt::escape(u8(msg.reason()))));
g.l->log(Log::PermissionDenied, tr("Denied: %1.").arg(u8(msg.reason()).toHtmlEscaped()));
else
g.l->log(Log::PermissionDenied, tr("Permission denied."));
}
@ -575,7 +575,7 @@ void MainWindow::msgUserRemove(const MumbleProto::UserRemove &msg) {
ACTOR_INIT;
SELF_INIT;
QString reason = Qt::escape(u8(msg.reason()));
QString reason = u8(msg.reason()).toHtmlEscaped();
if (pDst == pSelf) {
bRetryServer = false;

View File

@ -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

View File

@ -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;

View File

@ -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
@ -220,7 +216,7 @@ Overlay::Overlay() : QObject() {
#endif
if (! qlsServer->listen(pipepath)) {
QMessageBox::warning(NULL, QLatin1String("Mumble"), tr("Failed to create communication with overlay at %2: %1. No overlay will be available.").arg(Qt::escape(qlsServer->errorString()), Qt::escape(pipepath)), QMessageBox::Ok, QMessageBox::NoButton);
QMessageBox::warning(NULL, QLatin1String("Mumble"), tr("Failed to create communication with overlay at %2: %1. No overlay will be available.").arg(qlsServer->errorString().toHtmlEscaped(), pipepath.toHtmlEscaped()), QMessageBox::Ok, QMessageBox::NoButton);
} else {
qWarning() << "Overlay: Listening on" << qlsServer->fullServerName();
connect(qlsServer, SIGNAL(newConnection()), this, SLOT(newConnection()));

View File

@ -9,11 +9,7 @@
#include <QtCore/QtGlobal>
#include <QtCore/QUrl>
#include <QtNetwork/QLocalSocket>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QGraphicsItem>
#else
# include <QtGui/QGraphicsItem>
#endif
#include <QtWidgets/QGraphicsItem>
#include "ConfigDialog.h"
#include "OverlayText.h"

View File

@ -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;

View File

@ -7,11 +7,7 @@
#define MUMBLE_MUMBLE_OVERLAYEDITORSCENE_H_
#include <QtCore/QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QGraphicsScene>
#else
# include <QtGui/QGraphicsScene>
#endif
#include <QtWidgets/QGraphicsScene>
#include "Settings.h"

View File

@ -7,11 +7,7 @@
#define MUMBLE_MUMBLE_OVERLAYPOSITIONABLEITEM_H
#include <QtCore/QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QGraphicsItem>
#else
# include <QtGui/QGraphicsItem>
#endif
#include <QtWidgets/QGraphicsItem>
class OverlayPositionableItem : public QObject, public QGraphicsPixmapItem {
Q_OBJECT

View File

@ -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];

View File

@ -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();
}
@ -177,7 +172,7 @@ void PluginConfig::refillPluginList() {
i->setCheckState(1, pi->enabled ? Qt::Checked : Qt::Unchecked);
i->setText(0, pi->description);
if (pi->p->longdesc)
i->setToolTip(0, Qt::escape(QString::fromStdWString(pi->p->longdesc())));
i->setToolTip(0, QString::fromStdWString(pi->p->longdesc()).toHtmlEscaped());
i->setData(0, Qt::UserRole, pi->filename);
}
qtwPlugins->setCurrentItem(qtwPlugins->topLevelItem(0));
@ -430,7 +425,7 @@ void Plugins::on_Timer_timeout() {
QReadLocker lock(&qrwlPlugins);
if (prevlocked) {
g.l->log(Log::Information, tr("%1 lost link.").arg(Qt::escape(prevlocked->shortname)));
g.l->log(Log::Information, tr("%1 lost link.").arg(prevlocked->shortname.toHtmlEscaped()));
prevlocked = NULL;
}
@ -553,7 +548,7 @@ void Plugins::on_Timer_timeout() {
if (pi->enabled) {
if (pi->p2 ? pi->p2->trylock(pids) : pi->p->trylock()) {
pi->shortname = QString::fromStdWString(pi->p->shortname);
g.l->log(Log::Information, tr("%1 linked.").arg(Qt::escape(pi->shortname)));
g.l->log(Log::Information, tr("%1 linked.").arg(pi->shortname.toHtmlEscaped()));
pi->locked = true;
bUnlink = false;
locked = pi;
@ -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."));
@ -766,15 +755,15 @@ void Plugins::fetchedPAPluginDL(QByteArray data, QUrl url) {
if (f.open(QIODevice::WriteOnly)) {
f.write(data);
f.close();
g.mw->msgBox(tr("Downloaded new or updated plugin to %1.").arg(Qt::escape(f.fileName())));
g.mw->msgBox(tr("Downloaded new or updated plugin to %1.").arg(f.fileName().toHtmlEscaped()));
} else {
f.setFileName(qsUserPlugins + QLatin1String("/") + fname);
if (f.open(QIODevice::WriteOnly)) {
f.write(data);
f.close();
g.mw->msgBox(tr("Downloaded new or updated plugin to %1.").arg(Qt::escape(f.fileName())));
g.mw->msgBox(tr("Downloaded new or updated plugin to %1.").arg(f.fileName().toHtmlEscaped()));
} else {
g.mw->msgBox(tr("Failed to install new plugin to %1.").arg(Qt::escape(f.fileName())));
g.mw->msgBox(tr("Failed to install new plugin to %1.").arg(f.fileName().toHtmlEscaped()));
}
}

View File

@ -130,13 +130,9 @@ void RichTextHtmlEdit::insertFromMimeData(const QMimeData *source) {
if (! uri.isEmpty()) {
if (title.isEmpty())
title = uri;
#if QT_VERSION >= 0x050000
uri = uri.toHtmlEscaped();
title = title.toHtmlEscaped();
#else
uri = Qt::escape(uri);
title = Qt::escape(title);
#endif
insertHtml(QString::fromLatin1("<a href=\"%1\">%2</a>").arg(uri, title));
return;
@ -163,11 +159,7 @@ QString RichTextEditorLink::text() const {
QUrl url(qleUrl->text(), QUrl::StrictMode);
QString txt = qleText->text();
#if QT_VERSION >= 0x050000
txt = txt.toHtmlEscaped();
#else
txt = Qt::escape(txt);
#endif
if (url.isValid() && ! url.isRelative() && ! txt.isEmpty()) {
return QString::fromLatin1("<a href=\"%1\">%2</a>").arg(url.toString(), txt);

View File

@ -7,11 +7,7 @@
#define MUMBLE_MUMBLE_RICHTEXTEDITOR_H_
#include <QtCore/QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QTextEdit>
#else
# include <QtGui/QTextEdit>
#endif
#include <QtWidgets/QTextEdit>
class LogDocument;

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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

View File

@ -93,7 +93,7 @@ QVariant UserListModel::data(const QModelIndex &dataIndex, int role) const {
switch (dataIndex.column()) {
case COL_INACTIVEDAYS: return tr("Last seen: %1").arg(user.last_seen().empty() ?
tr("Never")
: Qt::escape(u8(user.last_seen())));
: u8(user.last_seen()).toHtmlEscaped());
case COL_LASTCHANNEL: return tr("Channel ID: %1").arg(user.last_channel());
default: return QVariant();
}

View File

@ -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);
}

View File

@ -7,13 +7,8 @@
#define MUMBLE_MUMBLE_USERVIEW_H_
#include <QtCore/QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QStyledItemDelegate>
# include <QtWidgets/QTreeView>
#else
# include <QtGui/QStyledItemDelegate>
# include <QtGui/QTreeView>
#endif
#include <QtWidgets/QStyledItemDelegate>
#include <QtWidgets/QTreeView>
#include "Timer.h"
@ -52,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();

View File

@ -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)));
}
@ -173,7 +167,7 @@ void VersionCheck::fetched(QByteArray a, QUrl url) {
file.remove();
}
} else {
g.mw->msgBox(tr("Downloading new snapshot from %1 to %2").arg(Qt::escape(fetch.toString()), Qt::escape(filename)));
g.mw->msgBox(tr("Downloading new snapshot from %1 to %2").arg(fetch.toString().toHtmlEscaped(), filename.toHtmlEscaped()));
WebFetch::fetch(QLatin1String("dl"), fetch, this, SLOT(fetched(QByteArray,QUrl)));
return;
}

View File

@ -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()) {

View File

@ -9,12 +9,7 @@
#include <QtCore/QtGlobal>
#include <QtCore/QObject>
#include <QtCore/QList>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QDialog>
#else
# include <QtGui/QDialog>
#endif
#include <QtWidgets/QDialog>
#include <QtNetwork/QSslCertificate>
class QListWidget;

View File

@ -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());

View File

@ -31,10 +31,7 @@
#include <QtCore/QtCore>
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
# include "Qt4Compat.h"
# include <QtWidgets/QtWidgets>
#endif
#include <QtWidgets/QtWidgets>
#include <QtSvg/QtSvg>
#ifdef USE_DBUS

View File

@ -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);
}
}

View File

@ -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
}

View File

@ -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;

View File

@ -38,9 +38,9 @@ AboutDialog::AboutDialog(QWidget *p, AboutDialogOptions options) : QDialog(p) {
QList<LicenseInfo> thirdPartyLicenses = License::thirdPartyLicenses();
foreach(LicenseInfo li, thirdPartyLicenses) {
qtb3rdPartyLicense->append(QString::fromLatin1("<h3>%1 (<a href=\"%2\">%2</a>)</h3><pre>%3</pre>")
.arg(Qt::escape(li.name))
.arg(Qt::escape(li.url))
.arg(Qt::escape(li.license)));
.arg(li.name.toHtmlEscaped())
.arg(li.url.toHtmlEscaped())
.arg(li.license.toHtmlEscaped()));
}
qtb3rdPartyLicense->moveCursor(QTextCursor::Start);

View File

@ -8,11 +8,7 @@
#include <QtCore/QtGlobal>
#include <QtCore/QObject>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QDialog>
#else
# include <QtGui/QDialog>
#endif
#include <QtWidgets/QDialog>
enum AboutDialogOptions {
AboutDialogOptionsShowAbout,

View File

@ -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.

View File

@ -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);

View File

@ -123,7 +123,7 @@ static void userToUser(const ::User *p, Murmur::User &mp) {
mp.udpPing = u->dUDPPingAvg;
mp.tcpPing = u->dTCPPingAvg;
mp.tcponly = QAtomicIntLoad(u->aiUdpFlag) == 0;
mp.tcponly = u->aiUdpFlag.load() == 0;
::Murmur::NetAddress addr(16, 0);
const Q_IPV6ADDR &a = u->haAddress.qip6;

View File

@ -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);
@ -934,7 +930,7 @@ bool Server::checkDecrypt(ServerUser *u, const char *encrypt, char *plain, unsig
}
void Server::sendMessage(ServerUser *u, const char *data, int len, QByteArray &cache, bool force) {
if ((QAtomicIntLoad(u->aiUdpFlag) == 1 || force) && (u->sUdpSocket != INVALID_SOCKET)) {
if ((u->aiUdpFlag.load() == 1 || force) && (u->sUdpSocket != INVALID_SOCKET)) {
#if defined(__LP64__)
STACKVAR(char, ebuffer, len+4+16);
char *buffer = reinterpret_cast<char *>(((reinterpret_cast<quint64>(ebuffer) + 8) & ~7) + 4);
@ -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
}
}

View File

@ -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);

View File

@ -8,12 +8,7 @@
#include <QtCore/QStringList>
#include <QtCore/QObject>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QSystemTrayIcon>
#else
# include <QtGui/QSystemTrayIcon>
#endif
#include <QtWidgets/QSystemTrayIcon>
class LogEmitter;
class QAction;

View File

@ -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()) {

View File

@ -32,19 +32,14 @@
# include <QtDBus/QtDBus>
#endif
#include "QAtomicIntCompat.h"
#ifdef Q_OS_WIN
# include <QtGui/QtGui>
# if QT_VERSION >= 0x050000
# include "Qt4Compat.h"
# include <QtWidgets/QtWidgets>
# endif
# include <ws2tcpip.h>
# include <qos2.h>
# include <shellapi.h>
# include <delayimp.h>
extern "C" {
void __cpuid(int a[4], int b);
};

View File

@ -7,7 +7,6 @@
#include <QtTest>
#include "SSL.h"
#include "QAtomicIntCompat.h"
#include <openssl/rand.h>
@ -30,7 +29,7 @@ public:
void run() {
unsigned char buf[64];
while (QAtomicIntLoad(*m_running) == 1) {
while (m_running->load() == 1) {
for (int i = 0; i < 1024; i++) {
if (m_seed) {
RAND_seed(buf, sizeof(buf));

View File

@ -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 {

View File

@ -9,17 +9,7 @@ include(../../../qmake/qt.pri)
QT *= network
TARGET = TestServerResolver
SOURCES *= TestServerResolver.cpp HostAddress.cpp ServerResolver_qt5.cpp ServerResolverRecord.cpp
SOURCES *= TestServerResolver.cpp HostAddress.cpp ServerResolver.cpp ServerResolverRecord.cpp
HEADERS *= HostAddress.h ServerResolver.h ServerResolverRecord.h
isEqual(QT_MAJOR_VERSION, 4) {
CONFIG *= no-srv
}
CONFIG(no-srv) {
DEFINES += USE_NO_SRV
SOURCES -= ServerResolver_qt5.cpp
SOURCES *= ServerResolver_nosrv.cpp
}
win32:LIBS *= -lws2_32