diff options
-rw-r--r-- | src/Qt4Compat.h | 17 | ||||
-rw-r--r-- | src/Utils.h | 2 | ||||
-rw-r--r-- | src/mumble/ALSAAudio.cpp | 4 | ||||
-rw-r--r-- | src/mumble/ASIOInput.cpp | 4 | ||||
-rw-r--r-- | src/mumble/About.cpp | 6 | ||||
-rw-r--r-- | src/mumble/AudioConfigDialog.cpp | 4 | ||||
-rw-r--r-- | src/mumble/AudioOutputSample.cpp | 2 | ||||
-rw-r--r-- | src/mumble/Cert.cpp | 2 | ||||
-rw-r--r-- | src/mumble/ConnectDialog.cpp | 13 | ||||
-rw-r--r-- | src/mumble/Database.cpp | 2 | ||||
-rw-r--r-- | src/mumble/LCD.cpp | 2 | ||||
-rw-r--r-- | src/mumble/Log.cpp | 8 | ||||
-rw-r--r-- | src/mumble/MainWindow.cpp | 42 | ||||
-rw-r--r-- | src/mumble/Messages.cpp | 12 | ||||
-rw-r--r-- | src/mumble/Overlay.cpp | 2 | ||||
-rw-r--r-- | src/mumble/Plugins.cpp | 12 | ||||
-rw-r--r-- | src/mumble/RichTextEditor.cpp | 10 | ||||
-rw-r--r-- | src/mumble/UserListModel.cpp | 2 | ||||
-rw-r--r-- | src/mumble/VersionCheck.cpp | 2 | ||||
-rw-r--r-- | src/mumble/mumble_pch.hpp | 1 | ||||
-rw-r--r-- | src/murmur/About.cpp | 6 | ||||
-rw-r--r-- | src/murmur/murmur_pch.h | 1 |
22 files changed, 62 insertions, 94 deletions
diff --git a/src/Qt4Compat.h b/src/Qt4Compat.h deleted file mode 100644 index 32d185b33..000000000 --- a/src/Qt4Compat.h +++ /dev/null @@ -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
\ No newline at end of file diff --git a/src/Utils.h b/src/Utils.h index 3b3cd3c83..5de584299 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -8,8 +8,6 @@ #ifndef MUMBLE_UTILS_H_ #define MUMBLE_UTILS_H_ -#include "Qt4Compat.h" - #include <QtCore/QtGlobal> #define iroundf(x) ( static_cast<int>(x) ) diff --git a/src/mumble/ALSAAudio.cpp b/src/mumble/ALSAAudio.cpp index 06b282f9e..9f5173017 100644 --- a/src/mumble/ALSAAudio.cpp +++ b/src/mumble/ALSAAudio.cpp @@ -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; diff --git a/src/mumble/ASIOInput.cpp b/src/mumble/ASIOInput.cpp index e6fc34e9f..49cbd0aff 100644 --- a/src/mumble/ASIOInput.cpp +++ b/src/mumble/ASIOInput.cpp @@ -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 { diff --git a/src/mumble/About.cpp b/src/mumble/About.cpp index eef2f44e4..9885e9deb 100644 --- a/src/mumble/About.cpp +++ b/src/mumble/About.cpp @@ -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); diff --git a/src/mumble/AudioConfigDialog.cpp b/src/mumble/AudioConfigDialog.cpp index 96405be4a..e19a5c36f 100644 --- a/src/mumble/AudioConfigDialog.cpp +++ b/src/mumble/AudioConfigDialog.cpp @@ -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(); diff --git a/src/mumble/AudioOutputSample.cpp b/src/mumble/AudioOutputSample.cpp index 099e4b0f0..a6217eba7 100644 --- a/src/mumble/AudioOutputSample.cpp +++ b/src/mumble/AudioOutputSample.cpp @@ -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; diff --git a/src/mumble/Cert.cpp b/src/mumble/Cert.cpp index fabcfb956..a5072cdac 100644 --- a/src/mumble/Cert.cpp +++ b/src/mumble/Cert.cpp @@ -104,7 +104,7 @@ 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)); diff --git a/src/mumble/ConnectDialog.cpp b/src/mumble/ConnectDialog.cpp index aa622162d..c8fb49404 100644 --- a/src/mumble/ConnectDialog.cpp +++ b/src/mumble/ConnectDialog.cpp @@ -521,7 +521,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 +533,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)); @@ -723,7 +724,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; } diff --git a/src/mumble/Database.cpp b/src/mumble/Database.cpp index 941bb8080..d89e268cd 100644 --- a/src/mumble/Database.cpp +++ b/src/mumble/Database.cpp @@ -100,7 +100,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"); } diff --git a/src/mumble/LCD.cpp b/src/mumble/LCD.cpp index 62385eaf9..8a909c4c4 100644 --- a/src/mumble/LCD.cpp +++ b/src/mumble/LCD.cpp @@ -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()); diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp index 274da974d..85d417d60 100644 --- a/src/mumble/Log.cpp +++ b/src/mumble/Log.cpp @@ -301,7 +301,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 +313,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 +489,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 +502,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); diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index 83911c152..a363673be 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -795,7 +795,7 @@ 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())); } } @@ -841,7 +841,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)) { @@ -942,7 +942,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 +1163,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 +1239,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 +1351,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 +1403,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 +1688,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 +1826,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 +1842,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 +1873,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 +2070,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 +2961,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 +2976,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 +3009,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 +3068,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 +3156,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(); diff --git a/src/mumble/Messages.cpp b/src/mumble/Messages.cpp index b6f210e5a..1a1c9d3d3 100644 --- a/src/mumble/Messages.cpp +++ b/src/mumble/Messages.cpp @@ -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; diff --git a/src/mumble/Overlay.cpp b/src/mumble/Overlay.cpp index 62c77b673..df960d3b7 100644 --- a/src/mumble/Overlay.cpp +++ b/src/mumble/Overlay.cpp @@ -220,7 +220,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())); diff --git a/src/mumble/Plugins.cpp b/src/mumble/Plugins.cpp index fca8876bf..450e2649c 100644 --- a/src/mumble/Plugins.cpp +++ b/src/mumble/Plugins.cpp @@ -177,7 +177,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 +430,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 +553,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; @@ -766,15 +766,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())); } } diff --git a/src/mumble/RichTextEditor.cpp b/src/mumble/RichTextEditor.cpp index 20c5d5ace..15f96eabe 100644 --- a/src/mumble/RichTextEditor.cpp +++ b/src/mumble/RichTextEditor.cpp @@ -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); diff --git a/src/mumble/UserListModel.cpp b/src/mumble/UserListModel.cpp index 2f5d41596..6534e80a8 100644 --- a/src/mumble/UserListModel.cpp +++ b/src/mumble/UserListModel.cpp @@ -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(); } diff --git a/src/mumble/VersionCheck.cpp b/src/mumble/VersionCheck.cpp index a14af8ab6..c70934587 100644 --- a/src/mumble/VersionCheck.cpp +++ b/src/mumble/VersionCheck.cpp @@ -173,7 +173,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; } diff --git a/src/mumble/mumble_pch.hpp b/src/mumble/mumble_pch.hpp index cabbdc8ac..0f1b8a1fa 100644 --- a/src/mumble/mumble_pch.hpp +++ b/src/mumble/mumble_pch.hpp @@ -32,7 +32,6 @@ #include <QtCore/QtCore> #include <QtGui/QtGui> #if QT_VERSION >= 0x050000 -# include "Qt4Compat.h" # include <QtWidgets/QtWidgets> #endif diff --git a/src/murmur/About.cpp b/src/murmur/About.cpp index 1a72af15b..18f2c661a 100644 --- a/src/murmur/About.cpp +++ b/src/murmur/About.cpp @@ -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); diff --git a/src/murmur/murmur_pch.h b/src/murmur/murmur_pch.h index 2b6fd4078..a7e1e3a28 100644 --- a/src/murmur/murmur_pch.h +++ b/src/murmur/murmur_pch.h @@ -35,7 +35,6 @@ #ifdef Q_OS_WIN # include <QtGui/QtGui> # if QT_VERSION >= 0x050000 -# include "Qt4Compat.h" # include <QtWidgets/QtWidgets> # endif |