From 420fa82e8dd3923a6bf782c894c34622c84a9d85 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Sat, 8 Aug 2015 15:19:46 +0200 Subject: [PATCH] Put some string placeholders between quotes --- src/app/application.cpp | 2 +- src/core/bittorrent/session.cpp | 20 ++++++++++---------- src/core/bittorrent/torrenthandle.cpp | 4 ++-- src/gui/addnewtorrentdialog.cpp | 2 +- src/gui/deletionconfirmationdlg.h | 2 +- src/gui/mainwindow.cpp | 10 +++++----- src/gui/properties/peerlistwidget.cpp | 6 +++--- src/gui/properties/peersadditiondlg.cpp | 2 +- src/gui/rss/automatedrssdownloader.cpp | 2 +- src/gui/rss/rssfeed.cpp | 4 ++-- src/gui/rss/rssparser.cpp | 2 +- src/gui/torrentimportdlg.cpp | 4 ++-- src/gui/transferlistfilterswidget.cpp | 6 +++--- src/searchengine/engineselectdlg.cpp | 12 ++++++------ 14 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/app/application.cpp b/src/app/application.cpp index 9620ec24d..414984366 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -131,7 +131,7 @@ void Application::sendNotificationEmail(BitTorrent::TorrentHandle *const torrent Net::Smtp *sender = new Net::Smtp; sender->sendMail("notification@qbittorrent.org", Preferences::instance()->getMailNotificationEmail(), - QObject::tr("[qBittorrent] %1 has finished downloading").arg(torrent->name()), + QObject::tr("[qBittorrent] '%1' has finished downloading").arg(torrent->name()), content); } diff --git a/src/core/bittorrent/session.cpp b/src/core/bittorrent/session.cpp index d94c58c03..9a866e288 100644 --- a/src/core/bittorrent/session.cpp +++ b/src/core/bittorrent/session.cpp @@ -351,7 +351,7 @@ void Session::setSessionSettings() libt::session_settings sessionSettings = m_nativeSession->settings(); sessionSettings.user_agent = "qBittorrent " VERSION; //std::cout << "HTTP User-Agent is " << sessionSettings.user_agent << std::endl; - logger->addMessage(tr("HTTP User-Agent is %1").arg(Utils::String::fromStdString(sessionSettings.user_agent))); + logger->addMessage(tr("HTTP User-Agent is '%1'").arg(Utils::String::fromStdString(sessionSettings.user_agent))); sessionSettings.upnp_ignore_nonrouters = true; sessionSettings.use_dht_as_fallback = false; @@ -721,13 +721,13 @@ void Session::processBigRatios() if ((ratio <= TorrentHandle::MAX_RATIO) && (ratio >= ratioLimit)) { Logger* const logger = Logger::instance(); if (m_highRatioAction == MaxRatioAction::Remove) { - logger->addMessage(tr("%1 reached the maximum ratio you set. Removing...").arg(torrent->name())); + logger->addMessage(tr("'%1' reached the maximum ratio you set. Removing...").arg(torrent->name())); deleteTorrent(torrent->hash()); } else { // Pause it if (!torrent->isPaused()) { - logger->addMessage(tr("%1 reached the maximum ratio you set. Pausing...").arg(torrent->name())); + logger->addMessage(tr("'%1' reached the maximum ratio you set. Pausing...").arg(torrent->name())); torrent->pause(); } } @@ -1212,7 +1212,7 @@ void Session::exportTorrentFiles(QString path) QDir exportDir(path); if (!exportDir.exists()) { if (!exportDir.mkpath(exportDir.absolutePath())) { - Logger::instance()->addMessage(tr("Error: Could not create torrent export directory: %1").arg(exportDir.absolutePath()), Log::CRITICAL); + Logger::instance()->addMessage(tr("Error: Could not create torrent export directory: '%1'").arg(exportDir.absolutePath()), Log::CRITICAL); return; } } @@ -1240,7 +1240,7 @@ void Session::exportTorrentFiles(QString path) QFile::copy(srcPath, dstPath); } else { - Logger::instance()->addMessage(tr("Error: could not export torrent %1, maybe it has not metadata yet.").arg(torrent->hash()), Log::CRITICAL); + Logger::instance()->addMessage(tr("Error: could not export torrent '%1', maybe it has not metadata yet.").arg(torrent->hash()), Log::CRITICAL); } } } @@ -1691,7 +1691,7 @@ void Session::handleTorrentFinished(TorrentHandle *const torrent) } else { qDebug("Caught error loading torrent"); - Logger::instance()->addMessage(tr("Unable to decode %1 torrent file.").arg(Utils::Fs::toNativePath(torrentFullpath)), Log::CRITICAL); + Logger::instance()->addMessage(tr("Unable to decode '%1' torrent file.").arg(Utils::Fs::toNativePath(torrentFullpath)), Log::CRITICAL); } } } @@ -1797,8 +1797,8 @@ void Session::recursiveTorrentDownload(const InfoHash &hash) const QString torrentRelpath = torrent->filePath(i); if (torrentRelpath.endsWith(".torrent")) { Logger::instance()->addMessage( - tr("Recursive download of file %1 embedded in torrent %2" - , "Recursive download of test.torrent embedded in torrent test2") + tr("Recursive download of file '%1' embedded in torrent '%2'" + , "Recursive download of 'test.torrent' embedded in torrent 'test2'") .arg(Utils::Fs::toNativePath(torrentRelpath)).arg(torrent->name())); const QString torrentFullpath = torrent->savePath() + "/" + torrentRelpath; @@ -2106,7 +2106,7 @@ void Session::handleAddTorrentAlert(libtorrent::add_torrent_alert *p) exportTorrentFile(torrent); } else { - logger->addMessage(tr("Couldn't save %1.torrent").arg(torrent->hash()), Log::CRITICAL); + logger->addMessage(tr("Couldn't save '%1.torrent'").arg(torrent->hash()), Log::CRITICAL); } } @@ -2223,7 +2223,7 @@ void Session::handlePeerBanAlert(libt::peer_ban_alert *p) void Session::handleUrlSeedAlert(libt::url_seed_alert *p) { - Logger::instance()->addMessage(tr("URL seed lookup failed for url: %1, message: %2").arg(Utils::String::fromStdString(p->url)).arg(Utils::String::fromStdString(p->message())), Log::CRITICAL); + Logger::instance()->addMessage(tr("URL seed lookup failed for URL: '%1', message: %2").arg(Utils::String::fromStdString(p->url)).arg(Utils::String::fromStdString(p->message())), Log::CRITICAL); } void Session::handleListenSucceededAlert(libt::listen_succeeded_alert *p) diff --git a/src/core/bittorrent/torrenthandle.cpp b/src/core/bittorrent/torrenthandle.cpp index 4aa12cf5c..996160a37 100644 --- a/src/core/bittorrent/torrenthandle.cpp +++ b/src/core/bittorrent/torrenthandle.cpp @@ -1491,13 +1491,13 @@ void TorrentHandle::handleFastResumeRejectedAlert(libtorrent::fastresume_rejecte updateStatus(); if (p->error.value() == libt::errors::mismatching_file_size) { // Mismatching file size (files were probably moved) - logger->addMessage(tr("File sizes mismatch for torrent %1, pausing it.").arg(name()), Log::CRITICAL); + logger->addMessage(tr("File sizes mismatch for torrent '%1', pausing it.").arg(name()), Log::CRITICAL); m_hasMissingFiles = true; if (!isPaused()) pause(); } else { - logger->addMessage(tr("Fast resume data was rejected for torrent %1. Reason: %2. Checking again...") + logger->addMessage(tr("Fast resume data was rejected for torrent '%1'. Reason: %2. Checking again...") .arg(name()).arg(Utils::String::fromStdString(p->message())), Log::CRITICAL); } } diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index 3597ed503..a2662ea92 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -706,7 +706,7 @@ void AddNewTorrentDialog::setupTreeview() void AddNewTorrentDialog::handleDownloadFailed(const QString &url, const QString &reason) { - MessageBoxRaised::critical(0, tr("Download Error"), QString("Cannot download %1: %2").arg(url).arg(reason)); + MessageBoxRaised::critical(0, tr("Download Error"), QString("Cannot download '%1': %2").arg(url).arg(reason)); this->deleteLater(); } diff --git a/src/gui/deletionconfirmationdlg.h b/src/gui/deletionconfirmationdlg.h index 551ac08bd..6356dfc2d 100644 --- a/src/gui/deletionconfirmationdlg.h +++ b/src/gui/deletionconfirmationdlg.h @@ -45,7 +45,7 @@ class DeletionConfirmationDlg : public QDialog, private Ui::confirmDeletionDlg { DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name): QDialog(parent) { setupUi(this); if (size == 1) - label->setText(tr("Are you sure you want to delete \"%1\" from the transfer list?", "Are you sure you want to delete \"ubuntu-linux-iso\" from the transfer list?").arg(name)); + label->setText(tr("Are you sure you want to delete '%1' from the transfer list?", "Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?").arg(name)); else label->setText(tr("Are you sure you want to delete these %1 torrents from the transfer list?", "Are you sure you want to delete these 5 torrents from the transfer list?").arg(QString::number(size))); // Icons diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 9749c2fec..c85cb2f45 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -634,13 +634,13 @@ void MainWindow::addTorrentFailed(const QString &error) const // called when a torrent has finished void MainWindow::finishedTorrent(BitTorrent::TorrentHandle *const torrent) const { - showNotificationBaloon(tr("Download completion"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(torrent->name())); + showNotificationBaloon(tr("Download completion"), tr("'%1' has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(torrent->name())); } // Notification when disk is full void MainWindow::fullDiskError(BitTorrent::TorrentHandle *const torrent, QString msg) const { - showNotificationBaloon(tr("I/O Error", "i.e: Input/Output Error"), tr("An I/O error occurred for torrent %1.\n Reason: %2", "e.g: An error occurred for torrent xxx.avi.\n Reason: disk is full.").arg(torrent->name()).arg(msg)); + showNotificationBaloon(tr("I/O Error", "i.e: Input/Output Error"), tr("An I/O error occurred for torrent '%1'.\n Reason: %2", "e.g: An error occurred for torrent 'xxx.avi'.\n Reason: disk is full.").arg(torrent->name()).arg(msg)); } void MainWindow::createKeyboardShortcuts() @@ -701,7 +701,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHand if (pref->recursiveDownloadDisabled()) return; // Get Torrent name QString torrent_name = torrent->name(); - QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent %1 contains torrent files, do you want to proceed with their download?").arg(torrent_name)); + QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent '%1' contains torrent files, do you want to proceed with their download?").arg(torrent_name)); QPushButton *yes = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole); /*QPushButton *no = */ confirmBox.addButton(tr("No"), QMessageBox::NoRole); QPushButton *never = confirmBox.addButton(tr("Never"), QMessageBox::NoRole); @@ -716,7 +716,7 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(BitTorrent::TorrentHand void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const { // Display a message box - showNotificationBaloon(tr("URL download error"), tr("Couldn't download file at URL: %1, reason: %2.").arg(url).arg(reason)); + showNotificationBaloon(tr("URL download error"), tr("Couldn't download file at URL '%1', reason: %2.").arg(url).arg(reason)); } void MainWindow::on_actionSet_global_upload_limit_triggered() @@ -1589,7 +1589,7 @@ bool MainWindow::addPythonPathToEnv() return true; QString python_path = Preferences::getPythonPath(); if (!python_path.isEmpty()) { - Logger::instance()->addMessage(tr("Python found in %1").arg(Utils::Fs::toNativePath(python_path)), Log::INFO); + Logger::instance()->addMessage(tr("Python found in '%1'").arg(Utils::Fs::toNativePath(python_path)), Log::INFO); // Add it to PATH envvar QString path_envar = QString::fromLocal8Bit(qgetenv("PATH").constData()); if (path_envar.isNull()) diff --git a/src/gui/properties/peerlistwidget.cpp b/src/gui/properties/peerlistwidget.cpp index 3e2e0d747..1dabf529d 100644 --- a/src/gui/properties/peerlistwidget.cpp +++ b/src/gui/properties/peerlistwidget.cpp @@ -182,11 +182,11 @@ void PeerListWidget::showPeerListMenu(const QPoint&) foreach (const BitTorrent::PeerAddress &addr, peersList) { if (torrent->connectPeer(addr)) { qDebug("Adding peer %s...", qPrintable(addr.ip.toString())); - Logger::instance()->addMessage(tr("Manually adding peer %1...").arg(addr.ip.toString())); + Logger::instance()->addMessage(tr("Manually adding peer '%1'...").arg(addr.ip.toString())); peerCount++; } else { - Logger::instance()->addMessage(tr("The peer %1 could not be added to this torrent.").arg(addr.ip.toString()), Log::WARNING); + Logger::instance()->addMessage(tr("The peer '%1' could not be added to this torrent.").arg(addr.ip.toString()), Log::WARNING); } } if (peerCount < peersList.length()) @@ -219,7 +219,7 @@ void PeerListWidget::banSelectedPeers() int row = m_proxyModel->mapToSource(index).row(); QString ip = m_listModel->data(m_listModel->index(row, PeerListDelegate::IP_HIDDEN)).toString(); qDebug("Banning peer %s...", ip.toLocal8Bit().data()); - Logger::instance()->addMessage(tr("Manually banning peer %1...").arg(ip)); + Logger::instance()->addMessage(tr("Manually banning peer '%1'...").arg(ip)); BitTorrent::Session::instance()->banIP(ip); } // Refresh list diff --git a/src/gui/properties/peersadditiondlg.cpp b/src/gui/properties/peersadditiondlg.cpp index 3dd1f7737..172c8d671 100644 --- a/src/gui/properties/peersadditiondlg.cpp +++ b/src/gui/properties/peersadditiondlg.cpp @@ -67,7 +67,7 @@ void PeersAdditionDlg::validateInput() } else { QMessageBox::warning(this, tr("Invalid peer"), - tr("The peer %1 is invalid.").arg(peer), + tr("The peer '%1' is invalid.").arg(peer), QMessageBox::Ok); m_peersList.clear(); return; diff --git a/src/gui/rss/automatedrssdownloader.cpp b/src/gui/rss/automatedrssdownloader.cpp index c18cdd935..6d6a16237 100644 --- a/src/gui/rss/automatedrssdownloader.cpp +++ b/src/gui/rss/automatedrssdownloader.cpp @@ -377,7 +377,7 @@ void AutomatedRssDownloader::on_removeRuleBtn_clicked() // Ask for confirmation QString confirm_text; if (selection.count() == 1) - confirm_text = tr("Are you sure you want to remove the download rule named %1?").arg(selection.first()->text()); + confirm_text = tr("Are you sure you want to remove the download rule named '%1'?").arg(selection.first()->text()); else confirm_text = tr("Are you sure you want to remove the selected download rules?"); if (QMessageBox::question(this, tr("Rule deletion confirmation"), confirm_text, QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes) diff --git a/src/gui/rss/rssfeed.cpp b/src/gui/rss/rssfeed.cpp index 6587e9123..9a81223ce 100644 --- a/src/gui/rss/rssfeed.cpp +++ b/src/gui/rss/rssfeed.cpp @@ -365,12 +365,12 @@ void RssFeed::downloadArticleTorrentIfMatching(RssDownloadRuleList* rules, const // Download the torrent const QString& torrent_url = article->torrentUrl(); if (torrent_url.isEmpty()) { - Logger::instance()->addMessage(tr("Automatic download %1 from %2 RSS feed failed because it doesn't contain a torrent or a magnet link...").arg(article->title()).arg(displayName()), Log::WARNING); + Logger::instance()->addMessage(tr("Automatic download of '%1' from '%2' RSS feed failed because it doesn't contain a torrent or a magnet link...").arg(article->title()).arg(displayName()), Log::WARNING); article->markAsRead(); return; } - Logger::instance()->addMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(article->title()).arg(displayName())); + Logger::instance()->addMessage(tr("Automatically downloading '%1' torrent from '%2' RSS feed...").arg(article->title()).arg(displayName())); connect(BitTorrent::Session::instance(), SIGNAL(downloadFromUrlFinished(QString)), article.data(), SLOT(handleTorrentDownloadSuccess(const QString&)), Qt::UniqueConnection); connect(article.data(), SIGNAL(articleWasRead()), SLOT(handleArticleStateChanged()), Qt::UniqueConnection); diff --git a/src/gui/rss/rssparser.cpp b/src/gui/rss/rssparser.cpp index fb0932d59..b3a1cac37 100644 --- a/src/gui/rss/rssparser.cpp +++ b/src/gui/rss/rssparser.cpp @@ -498,7 +498,7 @@ void RssParser::parseFeed(const ParsingJob& job) } if (!found_channel) { - reportFailure(job, tr("Invalid RSS feed at %1.").arg(job.feedUrl)); + reportFailure(job, tr("Invalid RSS feed at '%1'.").arg(job.feedUrl)); return; } diff --git a/src/gui/torrentimportdlg.cpp b/src/gui/torrentimportdlg.cpp index 798925f5e..a28a6145b 100644 --- a/src/gui/torrentimportdlg.cpp +++ b/src/gui/torrentimportdlg.cpp @@ -86,9 +86,9 @@ void TorrentImportDlg::on_browseContentBtn_clicked() QString filter; if (!extension.isEmpty()) { extension = extension.toUpper(); - filter = tr("%1 Files", "%1 is a file extension (e.g. PDF)").arg(extension) + " (*." + extension + ")"; + filter = tr("'%1' Files", "%1 is a file extension (e.g. PDF)").arg(extension) + " (*." + extension + ")"; } - m_contentPath = QFileDialog::getOpenFileName(this, tr("Please provide the location of %1", "%1 is a file name").arg(file_name), default_dir, filter); + m_contentPath = QFileDialog::getOpenFileName(this, tr("Please provide the location of '%1'", "%1 is a file name").arg(file_name), default_dir, filter); if (m_contentPath.isEmpty() || !QFile(m_contentPath).exists()) { m_contentPath = QString::null; ui->importBtn->setEnabled(false); diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index b5797675a..8d58dddf9 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -630,12 +630,12 @@ void TrackerFiltersList::handleFavicoDownload(const QString& url, const QString& bool invalid = (sizes.size() > 0 ? icon.pixmap(sizes.first()).isNull() : true); if (invalid) { if (url.endsWith(".ico", Qt::CaseInsensitive)) { - Logger::instance()->addMessage(tr("Couldn't decode favicon for URL `%1`. Trying to download favicon in PNG format.").arg(url), + Logger::instance()->addMessage(tr("Couldn't decode favicon for URL '%1'. Trying to download favicon in PNG format.").arg(url), Log::WARNING); downloadFavicon(url.left(url.size() - 4) + ".png"); } else { - Logger::instance()->addMessage(tr("Couldn't decode favicon for URL `%1`.").arg(url), Log::WARNING); + Logger::instance()->addMessage(tr("Couldn't decode favicon for URL '%1'.").arg(url), Log::WARNING); } Utils::Fs::forceRemove(filePath); } @@ -649,7 +649,7 @@ void TrackerFiltersList::handleFavicoFailure(const QString& url, const QString& { // Don't use getHost() on the url here. Print the full url. The error might relate to // that. - Logger::instance()->addMessage(tr("Couldn't download favicon for URL `%1`. Reason: `%2`").arg(url).arg(error), + Logger::instance()->addMessage(tr("Couldn't download favicon for URL '%1'. Reason: %2").arg(url).arg(error), Log::WARNING); if (url.endsWith(".ico", Qt::CaseInsensitive)) downloadFavicon(url.left(url.size() - 4) + ".png"); diff --git a/src/searchengine/engineselectdlg.cpp b/src/searchengine/engineselectdlg.cpp index a6e191626..2841aed12 100644 --- a/src/searchengine/engineselectdlg.cpp +++ b/src/searchengine/engineselectdlg.cpp @@ -251,7 +251,7 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) { qDebug("Version to be installed: %.2f", new_version); if (!isUpdateNeeded(plugin_name, new_version)) { qDebug("Apparently update is not needed, we have a more recent version"); - QMessageBox::information(this, tr("Search plugin install"), tr("A more recent version of %1 search engine plugin is already installed.", "%1 is the name of the search engine").arg(plugin_name)); + QMessageBox::information(this, tr("Search plugin install"), tr("A more recent version of '%1' search engine plugin is already installed.", "%1 is the name of the search engine").arg(plugin_name)); return; } // Process with install @@ -276,12 +276,12 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) { // restore backup QFile::copy(dest_path+".bak", dest_path); Utils::Fs::forceRemove(dest_path+".bak"); - QMessageBox::warning(this, tr("Search plugin install"), tr("%1 search engine plugin could not be updated, keeping old version.", "%1 is the name of the search engine").arg(plugin_name)); + QMessageBox::warning(this, tr("Search plugin install"), tr("'%1' search engine plugin could not be updated, keeping old version.", "%1 is the name of the search engine").arg(plugin_name)); return; } else { // Remove broken file Utils::Fs::forceRemove(dest_path); - QMessageBox::warning(this, tr("Search plugin install"), tr("%1 search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name)); + QMessageBox::warning(this, tr("Search plugin install"), tr("'%1' search engine plugin could not be installed.", "%1 is the name of the search engine").arg(plugin_name)); return; } } @@ -291,10 +291,10 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) { qreal version = SearchEngine::getPluginVersion(Utils::Fs::searchEngineLocation() + "/engines/" + plugin_name + ".py"); QTreeWidgetItem *item = findItemWithID(plugin_name); item->setText(ENGINE_VERSION, QString::number(version, 'f', 2)); - QMessageBox::information(this, tr("Search plugin install"), tr("%1 search engine plugin was successfully updated.", "%1 is the name of the search engine").arg(plugin_name)); + QMessageBox::information(this, tr("Search plugin install"), tr("'%1' search engine plugin was successfully updated.", "%1 is the name of the search engine").arg(plugin_name)); return; } else { - QMessageBox::information(this, tr("Search plugin install"), tr("%1 search engine plugin was successfully installed.", "%1 is the name of the search engine").arg(plugin_name)); + QMessageBox::information(this, tr("Search plugin install"), tr("'%1' search engine plugin was successfully installed.", "%1 is the name of the search engine").arg(plugin_name)); return; } } @@ -491,6 +491,6 @@ void engineSelectDlg::handleDownloadFailure(const QString &url, const QString &r // a plugin update download has been failed QString plugin_name = url.split('/').last(); plugin_name.replace(".py", "", Qt::CaseInsensitive); - QMessageBox::warning(this, tr("Search plugin update"), tr("Sorry, %1 search plugin installation failed.", "%1 is the name of the search engine").arg(plugin_name)); + QMessageBox::warning(this, tr("Search plugin update"), tr("Sorry, '%1' search plugin installation failed.", "%1 is the name of the search engine").arg(plugin_name)); } }