Remove Qt::escape() -> QString::toHtmlEscaped() compatibility layer

https://wiki.qt.io/Transition_from_Qt_4.x_to_Qt5#Qt::escape_is_deprecated
This commit is contained in:
Davide Beatrici 2019-09-15 02:36:51 +02:00
parent 062fe2661d
commit eea435d780
22 changed files with 62 additions and 94 deletions

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

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

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

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

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

View File

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

View File

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

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

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

View File

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

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

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

View File

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

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

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

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

View File

@ -32,7 +32,6 @@
#include <QtCore/QtCore>
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
# include "Qt4Compat.h"
# include <QtWidgets/QtWidgets>
#endif

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

@ -35,7 +35,6 @@
#ifdef Q_OS_WIN
# include <QtGui/QtGui>
# if QT_VERSION >= 0x050000
# include "Qt4Compat.h"
# include <QtWidgets/QtWidgets>
# endif