aboutsummaryrefslogtreecommitdiff
path: root/src/browsertab.cpp
diff options
context:
space:
mode:
authorKarol Kosek <krkk@krkk.ct8.pl>2021-04-15 18:29:33 +0200
committerFelix Queißner <felix@ib-queissner.de>2021-04-16 10:27:47 +0200
commit9ecc88dda38388871d3d316e93df7b5b629b3e47 (patch)
tree07505c0a18c9b352f9966135c2bfee85611c7cd3 /src/browsertab.cpp
parent399a69c4a0245a7796fc73f028ba88105960a060 (diff)
downloadkristall-9ecc88dda38388871d3d316e93df7b5b629b3e47.tar.gz
Unwarp tr() from QStrings
We don't need to wrap tr() with QString, because it returns QString anyway. Although it doesn't change the binary size (mostly because compilers were smart to remove that already), it helps to make the code a little bit cleaner. It's a somewhat continuation of c740189bcaa5bc6c073f8b3802303acf5ac36e47, but I thought back then it happened only there, so now I've removed it from all places.
Diffstat (limited to 'src/browsertab.cpp')
-rw-r--r--src/browsertab.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp
index 32927fc..e397f0f 100644
--- a/src/browsertab.cpp
+++ b/src/browsertab.cpp
@@ -196,7 +196,7 @@ void BrowserTab::navigateTo(const QUrl &url, PushToHistory mode, RequestFlags fl
this->timer.start();
if(not this->startRequest(url, ProtocolHandler::Default, flags)) {
- QMessageBox::critical(this, tr("Kristall"), QString(tr("Failed to execute request to %1")).arg(url.toString()));
+ QMessageBox::critical(this, tr("Kristall"), tr("Failed to execute request to %1").arg(url.toString()));
return;
}
@@ -289,13 +289,13 @@ void BrowserTab::openSourceView()
monospace_font.setStyleHint(QFont::Monospace);
auto dialog = std::make_unique<QDialog>(this, Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
- dialog->setWindowTitle(QString(tr("Source of %0")).arg(this->current_location.toString()));
+ dialog->setWindowTitle(tr("Source of %0").arg(this->current_location.toString()));
auto layout = new QVBoxLayout(dialog.get());
dialog->setLayout(layout);
auto hint = new QLabel(dialog.get());
- hint->setText(QString(tr("Mime type: %0")).arg(current_mime.toString()));
+ hint->setText(tr("Mime type: %0").arg(current_mime.toString()));
layout->addWidget(hint);
auto text = new QPlainTextEdit(dialog.get());
@@ -451,7 +451,7 @@ void BrowserTab::on_certificateRequired(const QString &reason)
if (not trySetClientCertificate(reason))
{
- setErrorMessage(QString(tr("The page requested a authorized client certificate, but none was provided.\r\nOriginal query was: %1")).arg(reason));
+ setErrorMessage(tr("The page requested a authorized client certificate, but none was provided.\r\nOriginal query was: %1").arg(reason));
}
else
{
@@ -559,11 +559,11 @@ void BrowserTab::on_requestComplete(const QByteArray &ref_data, const MimeType &
auto response = QMessageBox::question(
this,
tr("Kristall"),
- QString(tr("Failed to convert input charset %1 to UTF-8. Cannot display the file.\r\nDo you want to display unconverted data anyways?")).arg(charset)
+ tr("Failed to convert input charset %1 to UTF-8. Cannot display the file.\r\nDo you want to display unconverted data anyways?").arg(charset)
);
if(response != QMessageBox::Yes) {
- setErrorMessage(QString(tr("Failed to convert input charset %1 to UTF-8.")).arg(charset));
+ setErrorMessage(tr("Failed to convert input charset %1 to UTF-8.").arg(charset));
return;
}
}
@@ -856,7 +856,7 @@ void BrowserTab::on_inputRequired(const QString &query, const bool is_sensitive)
{
if (dialog.exec() != QDialog::Accepted)
{
- setErrorMessage(QString(tr("Site requires input:\n%1")).arg(query));
+ setErrorMessage(tr("Site requires input:\n%1").arg(query));
return;
}
@@ -893,7 +893,7 @@ void BrowserTab::on_redirected(QUrl uri, bool is_permanent)
if (redirection_count >= kristall::globals().options.max_redirections)
{
- setErrorMessage(QString(tr("Too many consecutive redirections. The last redirection would have redirected you to:\r\n%1")).arg(uri.toString(QUrl::FullyEncoded)));
+ setErrorMessage(tr("Too many consecutive redirections. The last redirection would have redirected you to:\r\n%1").arg(uri.toString(QUrl::FullyEncoded)));
return;
}
else
@@ -944,7 +944,7 @@ void BrowserTab::on_redirected(QUrl uri, bool is_permanent)
question
);
if(answer != QMessageBox::Yes) {
- setErrorMessage(QString(tr("Redirection to %1 cancelled by user")).arg(uri.toString()));
+ setErrorMessage(tr("Redirection to %1 cancelled by user").arg(uri.toString()));
return;
}
}
@@ -958,7 +958,7 @@ void BrowserTab::on_redirected(QUrl uri, bool is_permanent)
}
else
{
- setErrorMessage(QString(tr("Redirection to %1 failed")).arg(uri.toString()));
+ setErrorMessage(tr("Redirection to %1 failed").arg(uri.toString()));
}
}
}
@@ -967,7 +967,7 @@ void BrowserTab::setErrorMessage(const QString &msg)
{
this->is_internal_location = true;
this->on_requestComplete(
- QString(tr("An error happened:\r\n%0")).arg(msg).toUtf8(),
+ tr("An error happened:\r\n%0").arg(msg).toUtf8(),
"text/plain charset=utf-8");
this->updateUI();
@@ -1191,16 +1191,16 @@ void BrowserTab::on_text_browser_anchorClicked(const QUrl &url, bool open_in_new
{
if (not QDesktopServices::openUrl(url))
{
- QMessageBox::warning(this, "Kristall", QString(tr("Failed to start system URL handler for\r\n%1")).arg(real_url.toString()));
+ QMessageBox::warning(this, "Kristall", tr("Failed to start system URL handler for\r\n%1").arg(real_url.toString()));
}
}
else if (support == ProtocolSetup::Disabled)
{
- QMessageBox::warning(this, "Kristall", QString(tr("The requested url uses a scheme that has been disabled in the settings:\r\n%1")).arg(real_url.toString()));
+ QMessageBox::warning(this, "Kristall", tr("The requested url uses a scheme that has been disabled in the settings:\r\n%1").arg(real_url.toString()));
}
else
{
- QMessageBox::warning(this, "Kristall", QString(tr("The requested url cannot be processed by Kristall:\r\n%1")).arg(real_url.toString()));
+ QMessageBox::warning(this, "Kristall", tr("The requested url cannot be processed by Kristall:\r\n%1").arg(real_url.toString()));
}
}
}
@@ -1690,7 +1690,7 @@ void BrowserTab::on_text_browser_customContextMenuRequested(const QPoint pos)
if (!QDesktopServices::openUrl(real_url))
{
QMessageBox::warning(this, "Kristall",
- QString(tr("Failed to start system URL handler for\r\n%1")).arg(real_url.toString()));
+ tr("Failed to start system URL handler for\r\n%1").arg(real_url.toString()));
}
});
}