diff --git a/src/app/application.cpp b/src/app/application.cpp index 0fa8b3475..db99b3e5a 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -587,7 +587,7 @@ int Application::exec(const QStringList ¶ms) #ifndef DISABLE_WEBUI Preferences *const pref = Preferences::instance(); // Display some information to the user - const QString mesg = QString("\n******** %1 ********\n").arg(tr("Information")) + const QString mesg = QString::fromLatin1("\n******** %1 ********\n").arg(tr("Information")) + tr("To control qBittorrent, access the Web UI at %1") .arg(QString("http://localhost:") + QString::number(pref->getWebUiPort())) + '\n'; printf("%s", qUtf8Printable(mesg)); diff --git a/src/app/cmdoptions.cpp b/src/app/cmdoptions.cpp index 0024b95d6..532f2a0a9 100644 --- a/src/app/cmdoptions.cpp +++ b/src/app/cmdoptions.cpp @@ -364,7 +364,7 @@ QStringList QBtCommandLineParameters::paramList() const // torrent paths or URLs. if (!savePath.isEmpty()) - result.append(QString("@savePath=%1").arg(savePath)); + result.append(QLatin1String("@savePath=") + savePath); if (addPaused == TriStateBool::True) { result.append(QLatin1String("@addPaused=1")); @@ -377,7 +377,7 @@ QStringList QBtCommandLineParameters::paramList() const result.append(QLatin1String("@skipChecking")); if (!category.isEmpty()) - result.append(QString("@category=%1").arg(category)); + result.append(QLatin1String("@category=") + category); if (sequential) result.append(QLatin1String("@sequential")); diff --git a/src/app/main.cpp b/src/app/main.cpp index 04842be67..1153ab292 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -395,7 +395,7 @@ bool userAgreesWithLegalNotice() Q_ASSERT(!pref->getAcceptedLegal()); #ifdef DISABLE_GUI - const QString eula = QString("\n*** %1 ***\n").arg(QObject::tr("Legal Notice")) + const QString eula = QString::fromLatin1("\n*** %1 ***\n").arg(QObject::tr("Legal Notice")) + QObject::tr("qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.") + "\n\n" + QObject::tr("No further notices will be issued.") + "\n\n" + QObject::tr("Press %1 key to accept and continue...").arg("'y'") + '\n'; diff --git a/src/app/stacktrace_win.h b/src/app/stacktrace_win.h index 4ad573a83..1d37c4703 100644 --- a/src/app/stacktrace_win.h +++ b/src/app/stacktrace_win.h @@ -93,8 +93,8 @@ BOOL CALLBACK straceWin::EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVO EnumModulesContext* context = (EnumModulesContext*)UserContext; mod.SizeOfStruct = sizeof(IMAGEHLP_MODULE64); if(SymGetModuleInfo64(context->hProcess, BaseOfDll, &mod)) { - QString moduleBase = QString("0x%1").arg(BaseOfDll, 16, 16, QLatin1Char('0')); - QString line = QString("%1 %2 Image: %3") + QString moduleBase = QString::fromLatin1("0x%1").arg(BaseOfDll, 16, 16, QLatin1Char('0')); + QString line = QString::fromLatin1("%1 %2 Image: %3") .arg(mod.ModuleName, -25) .arg(moduleBase, -13) .arg(mod.LoadedImageName); @@ -102,7 +102,7 @@ BOOL CALLBACK straceWin::EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVO QString pdbName(mod.LoadedPdbName); if(!pdbName.isEmpty()) { - QString line2 = QString("%1 %2") + QString line2 = QString::fromLatin1("%1 %2") .arg("", 35) .arg(pdbName); context->stream << line2 << '\n'; @@ -165,7 +165,7 @@ QString straceWin::getSourcePathAndLineNumber(HANDLE hProcess, DWORD64 addr) } #endif #endif - return QString("%1 : %2").arg(path).arg(line.LineNumber); + return QString::fromLatin1("%1 : %2").arg(path).arg(line.LineNumber); } return QString(); @@ -296,7 +296,7 @@ const QString straceWin::getBacktrace() sourceFile = getSourcePathAndLineNumber(hProcess, ihsf.InstructionOffset - 1); } else { - funcName = QString("0x%1").arg(ihsf.InstructionOffset, 8, 16, QLatin1Char('0')); + funcName = QString::fromLatin1("0x%1").arg(ihsf.InstructionOffset, 8, 16, QLatin1Char('0')); } SymSetContext(hProcess, &ihsf, NULL); #ifndef __MINGW32__ @@ -304,7 +304,7 @@ const QString straceWin::getBacktrace() SymEnumSymbols(hProcess, 0, NULL, EnumSymbolsCB, (PVOID)¶ms); #endif - QString insOffset = QString("0x%1").arg(ihsf.InstructionOffset, 16, 16, QLatin1Char('0')); + QString insOffset = QString::fromLatin1("0x%1").arg(ihsf.InstructionOffset, 16, 16, QLatin1Char('0')); QString formatLine = "#%1 %2 %3 %4"; #ifndef __MINGW32__ formatLine += "(%5)"; @@ -318,7 +318,7 @@ const QString straceWin::getBacktrace() .arg(params.join(", ")); if (!sourceFile.isEmpty()) - debugLine += QString("[ %1 ]").arg(sourceFile); + debugLine += QString::fromLatin1("[ %1 ]").arg(sourceFile); #else ; #endif diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 1207591b3..f7e8ff8b6 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -1810,7 +1810,7 @@ bool Session::deleteTorrent(const InfoHash &hash, const DeleteOption deleteOptio // Remove it from torrent resume directory const QDir resumeDataDir(m_resumeFolderPath); QStringList filters; - filters << QString("%1.*").arg(torrent->hash()); + filters << QString::fromLatin1("%1.*").arg(torrent->hash()); const QStringList files = resumeDataDir.entryList(filters, QDir::Files, QDir::Unsorted); for (const QString &file : files) Utils::Fs::forceRemove(resumeDataDir.absoluteFilePath(file)); @@ -2457,8 +2457,8 @@ void Session::exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolde ((folder == TorrentExportFolder::Finished) && !finishedTorrentExportDirectory().isEmpty())); const QString validName = Utils::Fs::toValidFileSystemName(torrent->name()); - const QString torrentFilename = QString("%1.torrent").arg(torrent->hash()); - QString torrentExportFilename = QString("%1.torrent").arg(validName); + const QString torrentFilename = QString::fromLatin1("%1.torrent").arg(torrent->hash()); + QString torrentExportFilename = QString::fromLatin1("%1.torrent").arg(validName); const QString torrentPath = QDir(m_resumeFolderPath).absoluteFilePath(torrentFilename); const QDir exportPath(folder == TorrentExportFolder::Regular ? torrentExportDirectory() : finishedTorrentExportDirectory()); if (exportPath.exists() || exportPath.mkpath(exportPath.absolutePath())) { @@ -2466,7 +2466,7 @@ void Session::exportTorrentFile(TorrentHandle *const torrent, TorrentExportFolde int counter = 0; while (QFile::exists(newTorrentPath) && !Utils::Fs::sameFiles(torrentPath, newTorrentPath)) { // Append number to torrent name to make it unique - torrentExportFilename = QString("%1 %2.torrent").arg(validName).arg(++counter); + torrentExportFilename = QString::fromLatin1("%1 %2.torrent").arg(validName).arg(++counter); newTorrentPath = exportPath.absoluteFilePath(torrentExportFilename); } @@ -3923,7 +3923,7 @@ void Session::handleTorrentResumeDataReady(TorrentHandle *const torrent, const l out.reserve(1024 * 1024); // most fastresume file sizes are under 1 MB lt::bencode(std::back_inserter(out), data); - const QString filename = QString("%1.fastresume").arg(torrent->hash()); + const QString filename = QString::fromLatin1("%1.fastresume").arg(torrent->hash()); #if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) QMetaObject::invokeMethod(m_resumeDataSavingManager , [this, filename, out]() { m_resumeDataSavingManager->save(filename, out); }); @@ -4160,7 +4160,7 @@ void Session::startUpTorrents() int resumedTorrentsCount = 0; const auto startupTorrent = [this, &resumeDataDir, &resumedTorrentsCount](const TorrentResumeData ¶ms) { - const QString filePath = resumeDataDir.filePath(QString("%1.torrent").arg(params.hash)); + const QString filePath = resumeDataDir.filePath(QString::fromLatin1("%1.torrent").arg(params.hash)); qDebug() << "Starting up torrent" << params.hash << "..."; if (!addTorrent_impl(params.addTorrentData, params.magnetUri, TorrentInfo::loadFromFile(filePath), params.data)) LogMsg(tr("Unable to resume torrent '%1'.", "e.g: Unable to resume torrent 'hash'.") diff --git a/src/base/http/responsegenerator.cpp b/src/base/http/responsegenerator.cpp index 90ee498d5..e21cfb363 100644 --- a/src/base/http/responsegenerator.cpp +++ b/src/base/http/responsegenerator.cpp @@ -54,7 +54,7 @@ QByteArray Http::toByteArray(Response response) // Header Fields for (auto i = response.headers.constBegin(); i != response.headers.constEnd(); ++i) - buf += QString("%1: %2").arg(i.key(), i.value()).toLatin1().append(CRLF); + buf += QString::fromLatin1("%1: %2").arg(i.key(), i.value()).toLatin1().append(CRLF); // the first empty line buf += CRLF; diff --git a/src/base/net/geoipmanager.cpp b/src/base/net/geoipmanager.cpp index 49f30cfb1..4e9ad7cbc 100644 --- a/src/base/net/geoipmanager.cpp +++ b/src/base/net/geoipmanager.cpp @@ -88,7 +88,7 @@ void GeoIPManager::loadDatabase() m_geoIPDatabase = nullptr; const QString filepath = Utils::Fs::expandPathAbs( - QString("%1%2/%3").arg(specialFolderLocation(SpecialFolder::Data), GEODB_FOLDER, GEODB_FILENAME)); + QString::fromLatin1("%1%2/%3").arg(specialFolderLocation(SpecialFolder::Data), GEODB_FOLDER, GEODB_FILENAME)); QString error; m_geoIPDatabase = GeoIPDatabase::load(filepath, error); @@ -442,7 +442,7 @@ void GeoIPManager::downloadFinished(const DownloadResult &result) specialFolderLocation(SpecialFolder::Data) + GEODB_FOLDER); if (!QDir(targetPath).exists()) QDir().mkpath(targetPath); - QFile targetFile(QString("%1/%2").arg(targetPath, GEODB_FILENAME)); + QFile targetFile(QString::fromLatin1("%1/%2").arg(targetPath, GEODB_FILENAME)); if (!targetFile.open(QFile::WriteOnly) || (targetFile.write(data) == -1)) LogMsg(tr("Couldn't save downloaded IP geolocation database file."), Log::WARNING); else diff --git a/src/base/net/proxyconfigurationmanager.cpp b/src/base/net/proxyconfigurationmanager.cpp index 99e77d635..155e52461 100644 --- a/src/base/net/proxyconfigurationmanager.cpp +++ b/src/base/net/proxyconfigurationmanager.cpp @@ -139,17 +139,17 @@ void ProxyConfigurationManager::configureProxy() if (!m_isProxyOnlyForTorrents) { switch (m_config.type) { case ProxyType::HTTP_PW: - proxyStrHTTP = QString("http://%1:%2@%3:%4").arg(m_config.username + proxyStrHTTP = QString::fromLatin1("http://%1:%2@%3:%4").arg(m_config.username , m_config.password, m_config.ip, QString::number(m_config.port)); break; case ProxyType::HTTP: - proxyStrHTTP = QString("http://%1:%2").arg(m_config.ip, QString::number(m_config.port)); + proxyStrHTTP = QString::fromLatin1("http://%1:%2").arg(m_config.ip, QString::number(m_config.port)); break; case ProxyType::SOCKS5: - proxyStrSOCK = QString("%1:%2").arg(m_config.ip, QString::number(m_config.port)); + proxyStrSOCK = QString::fromLatin1("%1:%2").arg(m_config.ip, QString::number(m_config.port)); break; case ProxyType::SOCKS5_PW: - proxyStrSOCK = QString("%1:%2@%3:%4").arg(m_config.username + proxyStrSOCK = QString::fromLatin1("%1:%2@%3:%4").arg(m_config.username , m_config.password, m_config.ip, QString::number(m_config.port)); break; default: diff --git a/src/base/rss/rss_autodownloader.cpp b/src/base/rss/rss_autodownloader.cpp index ffa888531..8ba0d96f3 100644 --- a/src/base/rss/rss_autodownloader.cpp +++ b/src/base/rss/rss_autodownloader.cpp @@ -100,7 +100,7 @@ QPointer AutoDownloader::m_instance = nullptr; QString computeSmartFilterRegex(const QStringList &filters) { - return QString("(?:_|\\b)(?:%1)(?:_|\\b)").arg(filters.join(QString(")|(?:"))); + return QString::fromLatin1("(?:_|\\b)(?:%1)(?:_|\\b)").arg(filters.join(QString(")|(?:"))); } AutoDownloader::AutoDownloader() diff --git a/src/base/rss/rss_autodownloadrule.cpp b/src/base/rss/rss_autodownloadrule.cpp index 7bc18108d..40f9d1847 100644 --- a/src/base/rss/rss_autodownloadrule.cpp +++ b/src/base/rss/rss_autodownloadrule.cpp @@ -323,7 +323,7 @@ bool AutoDownloadRule::matchesEpisodeFilterExpression(const QString &articleTitl } } else { // Single number - const QString expStr {QString("\\b(?:s0?%1[ -_\\.]?e0?%2|%1x0?%2)(?:\\D|\\b)").arg(season, episode)}; + const QString expStr {QString::fromLatin1("\\b(?:s0?%1[ -_\\.]?e0?%2|%1x0?%2)(?:\\D|\\b)").arg(season, episode)}; if (cachedRegex(expStr).match(articleTitle).hasMatch()) return true; } @@ -354,7 +354,7 @@ bool AutoDownloadRule::matchesSmartEpisodeFilter(const QString &articleTitle) co if (!isRepack && !isProper) return false; - const QString fullEpisodeStr = QString("%1%2%3").arg(episodeStr, + const QString fullEpisodeStr = QString::fromLatin1("%1%2%3").arg(episodeStr, isRepack ? "-REPACK" : "", isProper ? "-PROPER" : ""); const bool previouslyMatchedFull = m_dataPtr->previouslyMatchedEpisodes.contains(fullEpisodeStr); @@ -366,8 +366,8 @@ bool AutoDownloadRule::matchesSmartEpisodeFilter(const QString &articleTitle) co // If this is a REPACK and PROPER download, add the individual entries to the list // so we don't download those if (isRepack && isProper) { - m_dataPtr->lastComputedEpisodes.append(QString("%1-REPACK").arg(episodeStr)); - m_dataPtr->lastComputedEpisodes.append(QString("%1-PROPER").arg(episodeStr)); + m_dataPtr->lastComputedEpisodes.append(episodeStr + QLatin1String("-REPACK")); + m_dataPtr->lastComputedEpisodes.append(episodeStr + QLatin1String("-PROPER")); } } diff --git a/src/base/rss/rss_feed.cpp b/src/base/rss/rss_feed.cpp index 969a160e6..e6d815626 100644 --- a/src/base/rss/rss_feed.cpp +++ b/src/base/rss/rss_feed.cpp @@ -400,7 +400,7 @@ void Feed::downloadIcon() // Download the RSS Feed icon // XXX: This works for most sites but it is not perfect const QUrl url(m_url); - const auto iconUrl = QString("%1://%2/favicon.ico").arg(url.scheme(), url.host()); + const auto iconUrl = QString::fromLatin1("%1://%2/favicon.ico").arg(url.scheme(), url.host()); Net::DownloadManager::instance()->download( Net::DownloadRequest(iconUrl).saveToFile(true) , this, &Feed::handleIconDownloadFinished); diff --git a/src/base/rss/rss_session.cpp b/src/base/rss/rss_session.cpp index fb7d52dcc..c2b1f722c 100644 --- a/src/base/rss/rss_session.cpp +++ b/src/base/rss/rss_session.cpp @@ -330,7 +330,7 @@ void Session::loadFolder(const QJsonObject &jsonObj, Folder *folder) } else { LogMsg(tr("Couldn't load RSS Item '%1'. Invalid data format.") - .arg(QString("%1\\%2").arg(folder->path(), key)), Log::WARNING); + .arg(QString::fromLatin1("%1\\%2").arg(folder->path(), key)), Log::WARNING); } } diff --git a/src/base/search/searchpluginmanager.cpp b/src/base/search/searchpluginmanager.cpp index 276664bd6..5904b8d35 100644 --- a/src/base/search/searchpluginmanager.cpp +++ b/src/base/search/searchpluginmanager.cpp @@ -185,7 +185,7 @@ void SearchPluginManager::enablePlugin(const QString &name, const bool enabled) // Updates shipped plugin void SearchPluginManager::updatePlugin(const QString &name) { - installPlugin(QString("%1%2.py").arg(m_updateUrl, name)); + installPlugin(QString::fromLatin1("%1%2.py").arg(m_updateUrl, name)); } // Install or update plugin from file or url @@ -283,12 +283,12 @@ bool SearchPluginManager::uninstallPlugin(const QString &name) void SearchPluginManager::updateIconPath(PluginInfo *const plugin) { if (!plugin) return; - QString iconPath = QString("%1/%2.png").arg(pluginsLocation(), plugin->name); + QString iconPath = QString::fromLatin1("%1/%2.png").arg(pluginsLocation(), plugin->name); if (QFile::exists(iconPath)) { plugin->iconPath = iconPath; } else { - iconPath = QString("%1/%2.ico").arg(pluginsLocation(), plugin->name); + iconPath = QString::fromLatin1("%1/%2.ico").arg(pluginsLocation(), plugin->name); if (QFile::exists(iconPath)) plugin->iconPath = iconPath; } @@ -338,7 +338,7 @@ QString SearchPluginManager::pluginFullName(const QString &pluginName) QString SearchPluginManager::pluginsLocation() { - return QString("%1/engines").arg(engineLocation()); + return QString::fromLatin1("%1/engines").arg(engineLocation()); } QString SearchPluginManager::engineLocation() @@ -526,7 +526,7 @@ bool SearchPluginManager::isUpdateNeeded(const QString &pluginName, const Plugin QString SearchPluginManager::pluginPath(const QString &name) { - return QString("%1/%2.py").arg(pluginsLocation(), name); + return QString::fromLatin1("%1/%2.py").arg(pluginsLocation(), name); } PluginVersion SearchPluginManager::getPluginVersion(const QString &filePath) diff --git a/src/gui/aboutdialog.cpp b/src/gui/aboutdialog.cpp index 76640cc9f..52f587449 100644 --- a/src/gui/aboutdialog.cpp +++ b/src/gui/aboutdialog.cpp @@ -43,7 +43,7 @@ AboutDialog::AboutDialog(QWidget *parent) setAttribute(Qt::WA_DeleteOnClose); // Title - m_ui->labelName->setText(QString("

qBittorrent " QBT_VERSION " (%1-bit)

").arg(QT_POINTER_SIZE * 8)); + m_ui->labelName->setText(QString::fromLatin1("

qBittorrent " QBT_VERSION " (%1-bit)

").arg(QT_POINTER_SIZE * 8)); m_ui->logo->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/skin/qbittorrent-tray.svg", this, 32)); diff --git a/src/gui/advancedsettings.cpp b/src/gui/advancedsettings.cpp index a6e91fa9f..dcc2d6838 100644 --- a/src/gui/advancedsettings.cpp +++ b/src/gui/advancedsettings.cpp @@ -333,7 +333,7 @@ void AdvancedSettings::loadAdvancedSettings() , tr("Open documentation")) , this); labelQbtLink->setOpenExternalLinks(true); - addRow(QBITTORRENT_HEADER, QString("%1").arg(tr("qBittorrent Section")), labelQbtLink); + addRow(QBITTORRENT_HEADER, QString::fromLatin1("%1").arg(tr("qBittorrent Section")), labelQbtLink); static_cast(cellWidget(QBITTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); auto *labelLibtorrentLink = new QLabel( @@ -341,7 +341,7 @@ void AdvancedSettings::loadAdvancedSettings() , tr("Open documentation")) , this); labelLibtorrentLink->setOpenExternalLinks(true); - addRow(LIBTORRENT_HEADER, QString("%1").arg(tr("libtorrent Section")), labelLibtorrentLink); + addRow(LIBTORRENT_HEADER, QString::fromLatin1("%1").arg(tr("libtorrent Section")), labelLibtorrentLink); static_cast(cellWidget(LIBTORRENT_HEADER, PROPERTY))->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); #if defined(Q_OS_WIN) diff --git a/src/gui/categoryfiltermodel.cpp b/src/gui/categoryfiltermodel.cpp index b2d3fc3b9..45a93598a 100644 --- a/src/gui/categoryfiltermodel.cpp +++ b/src/gui/categoryfiltermodel.cpp @@ -75,7 +75,7 @@ public: if (!m_parent || m_parent->name().isEmpty()) return m_name; - return QString("%1/%2").arg(m_parent->fullName(), m_name); + return QString::fromLatin1("%1/%2").arg(m_parent->fullName(), m_name); } CategoryModelItem *parent() const diff --git a/src/gui/lineedit.cpp b/src/gui/lineedit.cpp index 256065ab0..13450ce26 100644 --- a/src/gui/lineedit.cpp +++ b/src/gui/lineedit.cpp @@ -27,7 +27,7 @@ LineEdit::LineEdit(QWidget *parent) m_searchButton->setStyleSheet("QToolButton {border: none; padding: 2px;}"); // padding between text and widget borders - setStyleSheet(QString("QLineEdit {padding-left: %1px;}").arg(m_searchButton->sizeHint().width())); + setStyleSheet(QString::fromLatin1("QLineEdit {padding-left: %1px;}").arg(m_searchButton->sizeHint().width())); setClearButtonEnabled(true); diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index ecf940034..02c7a0e28 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -1539,7 +1539,7 @@ void MainWindow::reloadSessionStats() , tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true))); #else // OSes such as Windows do not support html here - const QString toolTip = QString("%1\n%2").arg( + const QString toolTip = QString::fromLatin1("%1\n%2").arg( tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true)) , tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true))); #endif // Q_OS_UNIX @@ -1818,7 +1818,7 @@ void MainWindow::handleUpdateCheckFinished(bool updateAvailable, QString newVers answer = QMessageBox::question(this, tr("qBittorrent Update Available") , tr("A new version is available.") + "
" + tr("Do you want to download %1?").arg(newVersion) + "

" - + QString("%1").arg(tr("Open changelog...")) + + QString::fromLatin1("%1").arg(tr("Open changelog...")) , QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); if (answer == QMessageBox::Yes) { // The user want to update, let's download the update diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index db680ae81..c8177ef5e 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -1559,7 +1559,7 @@ void OptionsDialog::on_addScanFolderButton_clicked() } if (!error.isEmpty()) - QMessageBox::critical(this, tr("Adding entry failed"), QString("%1\n%2").arg(error, dir)); + QMessageBox::critical(this, tr("Adding entry failed"), QString::fromLatin1("%1\n%2").arg(error, dir)); } } diff --git a/src/gui/rss/automatedrssdownloader.cpp b/src/gui/rss/automatedrssdownloader.cpp index 8a7489f3c..77feb34e0 100644 --- a/src/gui/rss/automatedrssdownloader.cpp +++ b/src/gui/rss/automatedrssdownloader.cpp @@ -59,8 +59,8 @@ const QString EXT_LEGACY {QStringLiteral(".rssrules")}; AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) : QDialog(parent) - , m_formatFilterJSON(QString("%1 (*%2)").arg(tr("Rules"), EXT_JSON)) - , m_formatFilterLegacy(QString("%1 (*%2)").arg(tr("Rules (legacy)"), EXT_LEGACY)) + , m_formatFilterJSON(QString::fromLatin1("%1 (*%2)").arg(tr("Rules"), EXT_JSON)) + , m_formatFilterLegacy(QString::fromLatin1("%1 (*%2)").arg(tr("Rules (legacy)"), EXT_LEGACY)) , m_ui(new Ui::AutomatedRssDownloader) , m_currentRuleItem(nullptr) { @@ -413,7 +413,7 @@ void AutomatedRssDownloader::on_exportBtn_clicked() QString selectedFilter {m_formatFilterJSON}; QString path = QFileDialog::getSaveFileName( this, tr("Export RSS rules"), QDir::homePath() - , QString("%1;;%2").arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter); + , QString::fromLatin1("%1;;%2").arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter); if (path.isEmpty()) return; const RSS::AutoDownloader::RulesFileFormat format { @@ -445,7 +445,7 @@ void AutomatedRssDownloader::on_importBtn_clicked() QString selectedFilter {m_formatFilterJSON}; QString path = QFileDialog::getOpenFileName( this, tr("Import RSS rules"), QDir::homePath() - , QString("%1;;%2").arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter); + , QString::fromLatin1("%1;;%2").arg(m_formatFilterJSON, m_formatFilterLegacy), &selectedFilter); if (path.isEmpty() || !QFile::exists(path)) return; diff --git a/src/gui/rss/feedlistwidget.cpp b/src/gui/rss/feedlistwidget.cpp index f59c40ce4..a1749d332 100644 --- a/src/gui/rss/feedlistwidget.cpp +++ b/src/gui/rss/feedlistwidget.cpp @@ -113,7 +113,7 @@ void FeedListWidget::handleItemUnreadCountChanged(RSS::Item *rssItem) else { QTreeWidgetItem *item = mapRSSItem(rssItem); Q_ASSERT(item); - item->setData(0, Qt::DisplayRole, QString("%1 (%2)").arg(rssItem->name()).arg(rssItem->unreadCount())); + item->setData(0, Qt::DisplayRole, QString::fromLatin1("%1 (%2)").arg(rssItem->name(), QString::number(rssItem->unreadCount()))); } } @@ -122,7 +122,7 @@ void FeedListWidget::handleItemPathChanged(RSS::Item *rssItem) QTreeWidgetItem *item = mapRSSItem(rssItem); Q_ASSERT(item); - item->setData(0, Qt::DisplayRole, QString("%1 (%2)").arg(rssItem->name()).arg(rssItem->unreadCount())); + item->setData(0, Qt::DisplayRole, QString::fromLatin1("%1 (%2)").arg(rssItem->name(), QString::number(rssItem->unreadCount()))); RSS::Item *parentRssItem = RSS::Session::instance()->itemByPath(RSS::Item::parentPath(rssItem->path())); QTreeWidgetItem *parentItem = mapRSSItem(parentRssItem); @@ -228,7 +228,7 @@ void FeedListWidget::dropEvent(QDropEvent *event) QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem *parentItem) { auto *item = new QTreeWidgetItem; - item->setData(0, Qt::DisplayRole, QString("%1 (%2)").arg(rssItem->name()).arg(rssItem->unreadCount())); + item->setData(0, Qt::DisplayRole, QString::fromLatin1("%1 (%2)").arg(rssItem->name(), QString::number(rssItem->unreadCount()))); item->setData(0, Qt::UserRole, reinterpret_cast(rssItem)); m_rssToTreeItemMapping[rssItem] = item; diff --git a/src/gui/statsdialog.cpp b/src/gui/statsdialog.cpp index 9efc18e49..0e1d160d4 100644 --- a/src/gui/statsdialog.cpp +++ b/src/gui/statsdialog.cpp @@ -80,20 +80,19 @@ void StatsDialog::update() : "-"); // Cache hits qreal readRatio = cs.readRatio; - m_ui->labelCacheHits->setText(QString("%1%").arg( - readRatio > 0 + m_ui->labelCacheHits->setText(QString::fromLatin1("%1%").arg((readRatio > 0) ? Utils::String::fromDouble(100 * readRatio, 2) - : "0")); + : QLatin1String("0"))); // Buffers size m_ui->labelTotalBuf->setText(Utils::Misc::friendlyUnit(cs.totalUsedBuffers * 16 * 1024)); // Disk overload (100%) equivalent // From lt manual: disk_write_queue and disk_read_queue are the number of peers currently waiting on a disk write or disk read // to complete before it receives or sends any more data on the socket. It's a metric of how disk bound you are. - m_ui->labelWriteStarve->setText(QString("%1%").arg(((ss.diskWriteQueue > 0) && (ss.peersCount > 0)) + m_ui->labelWriteStarve->setText(QString::fromLatin1("%1%").arg(((ss.diskWriteQueue > 0) && (ss.peersCount > 0)) ? Utils::String::fromDouble((100. * ss.diskWriteQueue / ss.peersCount), 2) : QLatin1String("0"))); - m_ui->labelReadStarve->setText(QString("%1%").arg(((ss.diskReadQueue > 0) && (ss.peersCount > 0)) + m_ui->labelReadStarve->setText(QString::fromLatin1("%1%").arg(((ss.diskReadQueue > 0) && (ss.peersCount > 0)) ? Utils::String::fromDouble((100. * ss.diskReadQueue / ss.peersCount), 2) : QLatin1String("0"))); diff --git a/src/gui/tagfiltermodel.cpp b/src/gui/tagfiltermodel.cpp index f82e8d3ae..c0d08e901 100644 --- a/src/gui/tagfiltermodel.cpp +++ b/src/gui/tagfiltermodel.cpp @@ -319,7 +319,7 @@ QVector TagFilterModel::findItems(const QSet &tags) if (item) items.push_back(item); else - qWarning() << QString("Requested tag '%1' missing from the model.").arg(tag); + qWarning() << QString::fromLatin1("Requested tag '%1' missing from the model.").arg(tag); } return items; } diff --git a/src/gui/torrentcreatordialog.cpp b/src/gui/torrentcreatordialog.cpp index b0f6bb448..0dba00e07 100644 --- a/src/gui/torrentcreatordialog.cpp +++ b/src/gui/torrentcreatordialog.cpp @@ -215,7 +215,7 @@ void TorrentCreatorDialog::handleCreationSuccess(const QString &path, const QStr BitTorrent::Session::instance()->addTorrent(info, params); } QMessageBox::information(this, tr("Torrent creator") - , QString("%1\n%2").arg(tr("Torrent created:"), Utils::Fs::toNativePath(path))); + , QString::fromLatin1("%1\n%2").arg(tr("Torrent created:"), Utils::Fs::toNativePath(path))); setInteractionEnabled(true); } diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index 2966b6478..0edfd7637 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -327,7 +327,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const QString &hash) trackerItem->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon("network-server")); const QString scheme = getScheme(tracker); - downloadFavicon(QString("%1://%2/favicon.ico").arg((scheme.startsWith("http") ? scheme : "http"), host)); + downloadFavicon(QString::fromLatin1("%1://%2/favicon.ico").arg((scheme.startsWith("http") ? scheme : "http"), host)); } if (!trackerItem) return; @@ -340,7 +340,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const QString &hash) return; } - trackerItem->setText(QString("%1 (%2)").arg(host).arg(tmp.size())); + trackerItem->setText(QString::fromLatin1("%1 (%2)").arg(host, QString::number(tmp.size()))); if (exists) { if (currentRow() == rowFromTracker(host)) applyFilter(currentRow()); @@ -384,7 +384,7 @@ void TrackerFiltersList::removeItem(const QString &tracker, const QString &hash) return; } if (trackerItem) - trackerItem->setText(QString("%1 (%2)").arg(host).arg(tmp.size())); + trackerItem->setText(QString::fromLatin1("%1 (%2)").arg(host, QString::number(tmp.size()))); } else { row = 1;