From c4dcf064d54aa197bc4720a509acd13f2fcaa3b2 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 13 Mar 2021 15:50:34 +0400 Subject: [PATCH] Avoid multiple .arg usage as suggested by clazy --- .../SourceFiles/api/api_authorizations.cpp | 14 ++++----- Telegram/SourceFiles/api/api_updates.cpp | 8 ++--- Telegram/SourceFiles/calls/calls_call.cpp | 6 ++-- .../chat_helpers/emoji_keywords.cpp | 11 +++---- .../chat_helpers/field_autocomplete.cpp | 6 ++-- .../chat_helpers/spellchecker_common.cpp | 18 +++++------ .../SourceFiles/core/crash_report_window.cpp | 6 +++- Telegram/SourceFiles/core/launcher.cpp | 10 +++---- .../SourceFiles/core/local_url_handlers.cpp | 2 +- Telegram/SourceFiles/core/sandbox.cpp | 2 +- Telegram/SourceFiles/history/history.cpp | 14 ++++----- .../history/history_item_components.cpp | 2 +- .../SourceFiles/history/history_widget.cpp | 6 +++- .../SourceFiles/lang/lang_cloud_manager.cpp | 6 ++-- .../SourceFiles/lang/lang_file_parser.cpp | 10 +++---- Telegram/SourceFiles/lang/lang_instance.cpp | 2 +- Telegram/SourceFiles/logs.cpp | 18 +++++------ .../media/view/media_view_overlay_widget.cpp | 2 +- .../mtproto/connection_resolving.cpp | 16 +++++----- .../details/mtproto_dc_key_creator.cpp | 30 +++++++++---------- Telegram/SourceFiles/mtproto/mtp_instance.cpp | 18 +++++------ .../SourceFiles/mtproto/session_private.cpp | 11 +++++-- .../mtproto/special_config_request.cpp | 29 +++++++++--------- .../platform/linux/launcher_linux.cpp | 7 ++--- .../linux/linux_desktop_environment.cpp | 2 +- .../linux/notifications_manager_linux.cpp | 8 ++--- .../details/storage_file_utilities.cpp | 12 ++++---- .../SourceFiles/storage/serialize_peer.cpp | 2 +- .../storage/storage_cloud_song_cover.cpp | 2 +- .../SourceFiles/support/support_templates.cpp | 8 ++--- .../window/notifications_utilities.cpp | 6 ++-- .../window/themes/window_theme.cpp | 6 ++-- .../window/themes/window_theme_editor.cpp | 2 +- .../themes/window_theme_editor_block.cpp | 2 +- .../window/themes/window_theme_editor_box.cpp | 6 ++-- 35 files changed, 161 insertions(+), 149 deletions(-) diff --git a/Telegram/SourceFiles/api/api_authorizations.cpp b/Telegram/SourceFiles/api/api_authorizations.cpp index 8e849e1b6..e690c618f 100644 --- a/Telegram/SourceFiles/api/api_authorizations.cpp +++ b/Telegram/SourceFiles/api/api_authorizations.cpp @@ -46,9 +46,9 @@ Authorizations::Entry ParseEntry(const MTPDauthorization &data) { return version; }(); - result.name = QString("%1%2") - .arg(appName) - .arg(appVer.isEmpty() ? QString() : (' ' + appVer)); + result.name = QString("%1%2").arg( + appName, + appVer.isEmpty() ? QString() : (' ' + appVer)); const auto country = qs(data.vcountry()); const auto platform = qs(data.vplatform()); @@ -61,10 +61,10 @@ Authorizations::Entry ParseEntry(const MTPDauthorization &data) { result.activeTime = data.vdate_active().v ? data.vdate_active().v : data.vdate_created().v; - result.info = QString("%1, %2%3") - .arg(qs(data.vdevice_model())) - .arg(platform.isEmpty() ? QString() : platform + ' ') - .arg(qs(data.vsystem_version())); + result.info = QString("%1, %2%3").arg( + qs(data.vdevice_model()), + platform.isEmpty() ? QString() : platform + ' ', + qs(data.vsystem_version())); result.ip = qs(data.vip()) + (country.isEmpty() ? QString() diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index 242fe5f14..b93898647 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -399,10 +399,10 @@ void Updates::feedChannelDifference( void Updates::channelDifferenceFail( not_null channel, const MTP::Error &error) { - LOG(("RPC Error in getChannelDifference: %1 %2: %3" - ).arg(error.code() - ).arg(error.type() - ).arg(error.description())); + LOG(("RPC Error in getChannelDifference: %1 %2: %3").arg( + QString::number(error.code()), + error.type(), + error.description())); failDifferenceStartTimerFor(channel); } diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index 897b6d68b..a0f163a40 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -819,9 +819,9 @@ void Call::createAndStartController(const MTPDphoneCall &call) { return data.vlibrary_versions().v; }).value(0, MTP_bytes(kDefaultVersion)).v; - LOG(("Call Info: Creating instance with version '%1', allowP2P: %2" - ).arg(QString::fromUtf8(version) - ).arg(Logs::b(descriptor.config.enableP2P))); + LOG(("Call Info: Creating instance with version '%1', allowP2P: %2").arg( + QString::fromUtf8(version), + Logs::b(descriptor.config.enableP2P))); _instance = tgcalls::Meta::Create( version.toStdString(), std::move(descriptor)); diff --git a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp index 68e879915..206a5c0f0 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp @@ -261,8 +261,9 @@ void ApplyDifference( }) | ranges::view::filter([&](const LangPackEmoji &entry) { if (!entry.emoji) { LOG(("API Warning: emoji %1 is not supported, word: %2." - ).arg(entry.text - ).arg(word)); + ).arg( + entry.text, + word)); } return (entry.emoji != nullptr); }); @@ -419,9 +420,9 @@ void EmojiKeywords::LangPack::applyDifference( const auto version = data.vversion().v; const auto &keywords = data.vkeywords().v; if (code != _id) { - LOG(("API Error: Bad lang_code for emoji keywords %1 -> %2" - ).arg(_id - ).arg(code)); + LOG(("API Error: Bad lang_code for emoji keywords %1 -> %2").arg( + _id, + code)); _data.version = 0; _state = State::Refreshed; return; diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp index e771b2ef3..2a29c7188 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp @@ -1046,9 +1046,9 @@ bool FieldAutocomplete::Inner::chooseAtIndex( const auto insertUsername = (botStatus == 0 || botStatus == 2 || _parent->filter().indexOf('@') > 0); - const auto commandString = QString("/%1%2") - .arg(command->command) - .arg(insertUsername ? ('@' + user->username) : QString()); + const auto commandString = QString("/%1%2").arg( + command->command, + insertUsername ? ('@' + user->username) : QString()); _botCommandChosen.fire({ commandString, method }); return true; diff --git a/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp b/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp index 9574a7511..1daf71ebe 100644 --- a/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp +++ b/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp @@ -251,9 +251,9 @@ MTP::DedicatedLoader::Location GetDownloadLocation(int id) { QString DictPathByLangId(int langId) { EnsurePath(); - return qsl("%1/%2") - .arg(DictionariesPath()) - .arg(Spellchecker::LocaleFromLangId(langId).name()); + return qsl("%1/%2").arg( + DictionariesPath(), + Spellchecker::LocaleFromLangId(langId).name()); } QString DictionariesPath() { @@ -281,9 +281,9 @@ bool RemoveDictionary(int langId) { return true; } const auto fileName = Spellchecker::LocaleFromLangId(langId).name(); - const auto folder = qsl("%1/%2/") - .arg(DictionariesPath()) - .arg(fileName); + const auto folder = qsl("%1/%2/").arg( + DictionariesPath(), + fileName); return QDir(folder).removeRecursively(); } @@ -294,9 +294,9 @@ bool WriteDefaultDictionary() { return false; } const auto fileName = QLocale(en).name(); - const auto folder = qsl("%1/%2/") - .arg(DictionariesPath()) - .arg(fileName); + const auto folder = qsl("%1/%2/").arg( + DictionariesPath(), + fileName); QDir(folder).removeRecursively(); const auto path = folder + fileName; diff --git a/Telegram/SourceFiles/core/crash_report_window.cpp b/Telegram/SourceFiles/core/crash_report_window.cpp index 43bc5c90f..c37a06026 100644 --- a/Telegram/SourceFiles/core/crash_report_window.cpp +++ b/Telegram/SourceFiles/core/crash_report_window.cpp @@ -468,7 +468,11 @@ void LastCrashedWindow::onSendReport() { } QString apiid = getReportField(qstr("apiid"), qstr("ApiId:")), version = getReportField(qstr("version"), qstr("Version:")); - _checkReply = _sendManager.get(QNetworkRequest(qsl("https://tdesktop.com/crash.php?act=query_report&apiid=%1&version=%2&dmp=%3&platform=%4").arg(apiid).arg(version).arg(minidumpFileName().isEmpty() ? 0 : 1).arg(CrashReports::PlatformString()))); + _checkReply = _sendManager.get(QNetworkRequest(qsl("https://tdesktop.com/crash.php?act=query_report&apiid=%1&version=%2&dmp=%3&platform=%4").arg( + apiid, + version, + QString::number(minidumpFileName().isEmpty() ? 0 : 1), + CrashReports::PlatformString()))); connect(_checkReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onSendingError(QNetworkReply::NetworkError))); connect(_checkReply, SIGNAL(finished()), this, SLOT(onCheckingFinished())); diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index eefb05b28..e8ab106c6 100644 --- a/Telegram/SourceFiles/core/launcher.cpp +++ b/Telegram/SourceFiles/core/launcher.cpp @@ -183,16 +183,14 @@ bool MoveLegacyAlphaFolder(const QString &folder, const QString &file) { const auto newFile = was + "/tdata/alpha"; if (QFile::exists(oldFile) && !QFile::exists(newFile)) { if (!QFile(oldFile).copy(newFile)) { - LOG(("FATAL: Could not copy '%1' to '%2'" - ).arg(oldFile - ).arg(newFile)); + LOG(("FATAL: Could not copy '%1' to '%2'").arg( + oldFile, + newFile)); return false; } } if (!QDir().rename(was, now)) { - LOG(("FATAL: Could not rename '%1' to '%2'" - ).arg(was - ).arg(now)); + LOG(("FATAL: Could not rename '%1' to '%2'").arg(was, now)); return false; } } diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 98a2f45e9..37608f5d0 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -580,7 +580,7 @@ QString TryConvertUrlToLocal(QString url) { return qsl("tg://bg?slug=") + bgMatch->captured(1) + (params.isEmpty() ? QString() : '&' + params); } else if (auto postMatch = regex_match(qsl("^c/(\\-?\\d+)/(\\d+)(/?\\?|/?$)"), query, matchOptions)) { auto params = query.mid(postMatch->captured(0).size()).toString(); - return qsl("tg://privatepost?channel=%1&post=%2").arg(postMatch->captured(1)).arg(postMatch->captured(2)) + (params.isEmpty() ? QString() : '&' + params); + return qsl("tg://privatepost?channel=%1&post=%2").arg(postMatch->captured(1), postMatch->captured(2)) + (params.isEmpty() ? QString() : '&' + params); } else if (auto usernameMatch = regex_match(qsl("^([a-zA-Z0-9\\.\\_]+)(/?\\?|/?$|/(\\d+)/?(?:\\?|$))"), query, matchOptions)) { auto params = query.mid(usernameMatch->captured(0).size()).toString(); auto postParam = QString(); diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp index 39cbf01fe..ceed57011 100644 --- a/Telegram/SourceFiles/core/sandbox.cpp +++ b/Telegram/SourceFiles/core/sandbox.cpp @@ -288,7 +288,7 @@ void Sandbox::socketError(QLocalSocket::LocalSocketError e) { psCheckLocalSocket(_localServerName); if (!_localServer.listen(_localServerName)) { - LOG(("Failed to start listening to %1 server: %2").arg(_localServerName).arg(_localServer.errorString())); + LOG(("Failed to start listening to %1 server: %2").arg(_localServerName, _localServer.errorString())); return App::quit(); } #endif // !Q_OS_WINRT diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index ed6ab98f3..ee59d08ff 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -1443,9 +1443,9 @@ bool History::unreadCountRefreshNeeded(MsgId readTillId) const { std::optional History::countStillUnreadLocal(MsgId readTillId) const { if (isEmpty() || !folderKnown()) { - DEBUG_LOG(("Reading: countStillUnreadLocal unknown %1 and %2." - ).arg(Logs::b(isEmpty()) - ).arg(Logs::b(folderKnown()))); + DEBUG_LOG(("Reading: countStillUnreadLocal unknown %1 and %2.").arg( + Logs::b(isEmpty()), + Logs::b(folderKnown()))); return std::nullopt; } if (_inboxReadBefore) { @@ -1478,10 +1478,10 @@ std::optional History::countStillUnreadLocal(MsgId readTillId) const { } } const auto minimalServerId = minMsgId(); - DEBUG_LOG(("Reading: check at end loaded from %1 loaded %2 - %3" - ).arg(minimalServerId - ).arg(Logs::b(loadedAtBottom()) - ).arg(Logs::b(loadedAtTop()))); + DEBUG_LOG(("Reading: check at end loaded from %1 loaded %2 - %3").arg( + QString::number(minimalServerId), + Logs::b(loadedAtBottom()), + Logs::b(loadedAtTop()))); if (!loadedAtBottom() || (!loadedAtTop() && !minimalServerId) || minimalServerId > readTillId) { diff --git a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp index ccd3c3261..07863eab1 100644 --- a/Telegram/SourceFiles/history/history_item_components.cpp +++ b/Telegram/SourceFiles/history/history_item_components.cpp @@ -464,7 +464,7 @@ QString ReplyMarkupClickHandler::tooltip() const { const auto url = button ? QString::fromUtf8(button->data) : QString(); const auto text = _fullDisplayed ? QString() : buttonText(); if (!url.isEmpty() && !text.isEmpty()) { - return QString("%1\n\n%2").arg(text).arg(url); + return QString("%1\n\n%2").arg(text, url); } else if (url.isEmpty() != text.isEmpty()) { return text + url; } else { diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index dd54cb380..80d6139f0 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2497,7 +2497,11 @@ void HistoryWidget::messagesFailed(const MTP::Error &error, int requestId) { return; } - LOG(("RPC Error: %1 %2: %3").arg(error.code()).arg(error.type()).arg(error.description())); + LOG(("RPC Error: %1 %2: %3").arg( + QString::number(error.code()), + error.type(), + error.description())); + if (_preloadRequest == requestId) { _preloadRequest = 0; } else if (_preloadDownRequest == requestId) { diff --git a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp index f9d5aa3f6..459c5cf58 100644 --- a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp +++ b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp @@ -290,9 +290,9 @@ void CloudManager::applyLangPackDifference( } } else { LOG(("Lang Warning: " - "Ignoring update for '%1' because our language is '%2'" - ).arg(langpackId - ).arg(_langpack.id())); + "Ignoring update for '%1' because our language is '%2'").arg( + langpackId, + _langpack.id())); } } diff --git a/Telegram/SourceFiles/lang/lang_file_parser.cpp b/Telegram/SourceFiles/lang/lang_file_parser.cpp index b282613fe..6c2b79941 100644 --- a/Telegram/SourceFiles/lang/lang_file_parser.cpp +++ b/Telegram/SourceFiles/lang/lang_file_parser.cpp @@ -155,7 +155,7 @@ bool FileParser::readKeyValue(const char *&from, const char *end) { QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &relativePath) { QFile file(QFileInfo(relativePath).exists() ? relativePath : absolutePath); if (!file.open(QIODevice::ReadOnly)) { - Ui::Integration::Instance().writeLogEntry(u"Lang Error: Could not open file at '%1' ('%2')"_q.arg(relativePath).arg(absolutePath)); + Ui::Integration::Instance().writeLogEntry(u"Lang Error: Could not open file at '%1' ('%2')"_q.arg(relativePath, absolutePath)); return QByteArray(); } if (file.size() > kLangFileLimit) { @@ -166,7 +166,7 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela constexpr auto kCodecMagicSize = 3; auto codecMagic = file.read(kCodecMagicSize); if (codecMagic.size() < kCodecMagicSize) { - Ui::Integration::Instance().writeLogEntry(u"Lang Error: Found bad file at '%1' ('%2')"_q.arg(relativePath).arg(absolutePath)); + Ui::Integration::Instance().writeLogEntry(u"Lang Error: Found bad file at '%1' ('%2')"_q.arg(relativePath, absolutePath)); return QByteArray(); } file.seek(0); @@ -177,11 +177,11 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela stream.setCodec("UTF-16"); auto string = stream.readAll(); if (stream.status() != QTextStream::Ok) { - Ui::Integration::Instance().writeLogEntry(u"Lang Error: Could not read UTF-16 data from '%1' ('%2')"_q.arg(relativePath).arg(absolutePath)); + Ui::Integration::Instance().writeLogEntry(u"Lang Error: Could not read UTF-16 data from '%1' ('%2')"_q.arg(relativePath, absolutePath)); return QByteArray(); } if (string.isEmpty()) { - Ui::Integration::Instance().writeLogEntry(u"Lang Error: Empty UTF-16 content in '%1' ('%2')"_q.arg(relativePath).arg(absolutePath)); + Ui::Integration::Instance().writeLogEntry(u"Lang Error: Empty UTF-16 content in '%1' ('%2')"_q.arg(relativePath, absolutePath)); return QByteArray(); } return string.toUtf8(); @@ -197,7 +197,7 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela data = data.mid(3); // skip UTF-8 BOM } if (data.isEmpty()) { - Ui::Integration::Instance().writeLogEntry(u"Lang Error: Empty UTF-8 content in '%1' ('%2')"_q.arg(relativePath).arg(absolutePath)); + Ui::Integration::Instance().writeLogEntry(u"Lang Error: Empty UTF-8 content in '%1' ('%2')"_q.arg(relativePath, absolutePath)); return QByteArray(); } return data; diff --git a/Telegram/SourceFiles/lang/lang_instance.cpp b/Telegram/SourceFiles/lang/lang_instance.cpp index ae3978943..ab32ffeae 100644 --- a/Telegram/SourceFiles/lang/lang_instance.cpp +++ b/Telegram/SourceFiles/lang/lang_instance.cpp @@ -92,7 +92,7 @@ void ValueParser::appendToResult(const char *nextBegin) { bool ValueParser::logError(const QString &text) { _failed = true; auto loggedKey = (_currentTag.size() > 0) ? (_key + QString(':') + _currentTag) : QString(_key); - LOG(("Lang Error: %1 (key '%2')").arg(text).arg(loggedKey)); + LOG(("Lang Error: %1 (key '%2')").arg(text, loggedKey)); return false; } diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index 1c4bf00b6..0318eaff5 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -55,7 +55,7 @@ QString _logsEntryStart() { const auto tm = QDateTime::currentDateTime(); - return QString("[%1 %2-%3]").arg(tm.toString("hh:mm:ss.zzz")).arg(QString("%1").arg(threadId, 2, 10, QChar('0'))).arg(++index, 7, 10, QChar('0')); + return QString("[%1 %2-%3]").arg(tm.toString("hh:mm:ss.zzz"), QString("%1").arg(threadId, 2, 10, QChar('0'))).arg(++index, 7, 10, QChar('0')); } class LogsDataFields { @@ -136,12 +136,12 @@ private: return false; } if (!QFile(files[type]->fileName()).copy(to->fileName())) { // don't close files[type] yet - LOG(("Could not copy '%1' to '%2' to start new logging!").arg(files[type]->fileName()).arg(to->fileName())); + LOG(("Could not copy '%1' to '%2' to start new logging!").arg(files[type]->fileName(), to->fileName())); return false; } if (to->open(mode | QIODevice::Append)) { std::swap(files[type], to); - LOG(("Moved logging from '%1' to '%2'!").arg(to->fileName()).arg(files[type]->fileName())); + LOG(("Moved logging from '%1' to '%2'!").arg(to->fileName(), files[type]->fileName())); to->remove(); LogsStartIndexChosen = -1; @@ -152,7 +152,7 @@ private: QString oldlog = cWorkingDir() + *i, oldlogend = i->mid(qstr("log_start").size()); if (oldlogend.size() == 1 + qstr(".txt").size() && oldlogend.at(0).isDigit() && oldlogend.midRef(1) == qstr(".txt")) { bool removed = QFile(*i).remove(); - LOG(("Old start log '%1' found, deleted: %2").arg(*i).arg(Logs::b(removed))); + LOG(("Old start log '%1' found, deleted: %2").arg(*i, Logs::b(removed))); } } @@ -266,7 +266,7 @@ bool DebugModeEnabled = false; void MoveOldDataFiles(const QString &wasDir) { QFile data(wasDir + "data"), dataConfig(wasDir + "data_config"), tdataConfig(wasDir + "tdata/config"); if (data.exists() && dataConfig.exists() && !QFileInfo(cWorkingDir() + "data").exists() && !QFileInfo(cWorkingDir() + "data_config").exists()) { // move to home dir - LOG(("Copying data to home dir '%1' from '%2'").arg(cWorkingDir()).arg(wasDir)); + LOG(("Copying data to home dir '%1' from '%2'").arg(cWorkingDir(), wasDir)); if (data.copy(cWorkingDir() + "data")) { LOG(("Copied 'data' to home dir")); if (dataConfig.copy(cWorkingDir() + "data_config")) { @@ -419,7 +419,7 @@ void start(not_null launcher) { ).arg(Logs::b(cInstallBetaVersion()) ).arg(cAlphaVersion() ).arg(Logs::b(DebugEnabled()))); - LOG(("Executable dir: %1, name: %2").arg(cExeDir()).arg(cExeName())); + LOG(("Executable dir: %1, name: %2").arg(cExeDir(), cExeName())); LOG(("Initial working dir: %1").arg(initialWorkingDir)); LOG(("Working dir: %1").arg(cWorkingDir())); LOG(("Command line: %1").arg(launcher->argumentsString())); @@ -530,7 +530,7 @@ void writeMain(const QString &v) { QString msg(QString("[%1.%2.%3 %4:%5:%6] %7\n").arg(tm.tm_year + 1900).arg(tm.tm_mon + 1, 2, 10, QChar('0')).arg(tm.tm_mday, 2, 10, QChar('0')).arg(tm.tm_hour, 2, 10, QChar('0')).arg(tm.tm_min, 2, 10, QChar('0')).arg(tm.tm_sec, 2, 10, QChar('0')).arg(v)); _logsWrite(LogDataMain, msg); - QString debugmsg(QString("%1 %2\n").arg(_logsEntryStart()).arg(v)); + QString debugmsg(QString("%1 %2\n").arg(_logsEntryStart(), v)); _logsWrite(LogDataDebug, debugmsg); } @@ -549,7 +549,7 @@ void writeDebug(const char *file, int32 line, const QString &v) { file = found + 1; } - QString msg(QString("%1 %2 (%3 : %4)\n").arg(_logsEntryStart()).arg(v).arg(file).arg(line)); + QString msg(QString("%1 %2 (%3 : %4)\n").arg(_logsEntryStart(), v, file, line)); _logsWrite(LogDataDebug, msg); #ifdef Q_OS_WIN @@ -562,7 +562,7 @@ void writeDebug(const char *file, int32 line, const QString &v) { } void writeTcp(const QString &v) { - QString msg(QString("%1 %2\n").arg(_logsEntryStart()).arg(v)); + QString msg(QString("%1 %2\n").arg(_logsEntryStart(), v)); _logsWrite(LogDataTcp, msg); } diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 31f023818..d69a4e430 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -174,7 +174,7 @@ void PaintImageProfile(QPainter &p, const QImage &image, QRect rect, QRect fill) } } push(); - LOG(("FRAME (%1): %2 (copies: %3)").arg(label).arg(times.join(' ')).arg(copies)); + LOG(("FRAME (%1): %2 (copies: %3)").arg(label, times.join(' ')).arg(copies)); times = QStringList(); now = crl::now(); }; diff --git a/Telegram/SourceFiles/mtproto/connection_resolving.cpp b/Telegram/SourceFiles/mtproto/connection_resolving.cpp index 89408c6e1..392a311a3 100644 --- a/Telegram/SourceFiles/mtproto/connection_resolving.cpp +++ b/Telegram/SourceFiles/mtproto/connection_resolving.cpp @@ -72,10 +72,10 @@ void ResolvingConnection::setChild(ConnectionPointer &&child) { &AbstractConnection::disconnected, this, &ResolvingConnection::handleDisconnected); - DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' got new child '%3'" - ).arg(_protocolDcId - ).arg(_proxy.host + ':' + QString::number(_proxy.port) - ).arg((_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size()) + DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' got new child '%3'").arg( + QString::number(_protocolDcId), + _proxy.host + ':' + QString::number(_proxy.port), + (_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size()) ? _proxy.resolvedIPs[_ipIndex] : _proxy.host)); if (_protocolDcId) { @@ -227,10 +227,10 @@ void ResolvingConnection::connectToServer( _port = port; _protocolSecret = protocolSecret; _protocolDcId = protocolDcId; - DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' connects a child '%3'" - ).arg(_protocolDcId - ).arg(_proxy.host +':' + QString::number(_proxy.port) - ).arg((_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size()) + DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' connects a child '%3'").arg( + QString::number(_protocolDcId), + _proxy.host +':' + QString::number(_proxy.port), + (_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size()) ? _proxy.resolvedIPs[_ipIndex] : _proxy.host)); return _child->connectToServer( diff --git a/Telegram/SourceFiles/mtproto/details/mtproto_dc_key_creator.cpp b/Telegram/SourceFiles/mtproto/details/mtproto_dc_key_creator.cpp index d1da9f591..0c5514e71 100644 --- a/Telegram/SourceFiles/mtproto/details/mtproto_dc_key_creator.cpp +++ b/Telegram/SourceFiles/mtproto/details/mtproto_dc_key_creator.cpp @@ -380,7 +380,7 @@ void DcKeyCreator::dhParamsAnswered( if (data.vserver_nonce() != attempt->data.server_nonce) { LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in server_DH_params_ok)!")); - DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str())); + DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str())); return failed(); } @@ -426,12 +426,12 @@ void DcKeyCreator::dhParamsAnswered( const auto &dh_inner_data(dh_inner.c_server_DH_inner_data()); if (dh_inner_data.vnonce() != attempt->data.nonce) { LOG(("AuthKey Error: received nonce <> sent nonce (in server_DH_inner_data)!")); - DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&dh_inner_data.vnonce(), 16).str()).arg(Logs::mb(&attempt->data.nonce, 16).str())); + DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&dh_inner_data.vnonce(), 16).str(), Logs::mb(&attempt->data.nonce, 16).str())); return failed(); } if (dh_inner_data.vserver_nonce() != attempt->data.server_nonce) { LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in server_DH_inner_data)!")); - DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&dh_inner_data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str())); + DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&dh_inner_data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str())); return failed(); } const auto sha1Buffer = openssl::Sha1( @@ -443,7 +443,7 @@ void DcKeyCreator::dhParamsAnswered( openssl::kSha1Size); if (bytes::compare(sha1Dec, sha1Buffer)) { LOG(("AuthKey Error: sha1 hash of encrypted part did not match!")); - DEBUG_LOG(("AuthKey Error: sha1 did not match, server_nonce: %1, new_nonce %2, encrypted data %3").arg(Logs::mb(&attempt->data.server_nonce, 16).str()).arg(Logs::mb(&attempt->data.new_nonce, 16).str()).arg(Logs::mb(encDHStr.constData(), encDHLen).str())); + DEBUG_LOG(("AuthKey Error: sha1 did not match, server_nonce: %1, new_nonce %2, encrypted data %3").arg(Logs::mb(&attempt->data.server_nonce, 16).str(), Logs::mb(&attempt->data.new_nonce, 16).str(), Logs::mb(encDHStr.constData(), encDHLen).str())); return failed(); } base::unixtime::update(dh_inner_data.vserver_time().v); @@ -466,12 +466,12 @@ void DcKeyCreator::dhParamsAnswered( if (data.vserver_nonce() != attempt->data.server_nonce) { LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in server_DH_params_fail)!")); - DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str())); + DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str())); return failed(); } if (data.vnew_nonce_hash() != NonceDigest(bytes::object_as_span(&attempt->data.new_nonce))) { LOG(("AuthKey Error: received new_nonce_hash did not match!")); - DEBUG_LOG(("AuthKey Error: received new_nonce_hash: %1, new_nonce: %2").arg(Logs::mb(&data.vnew_nonce_hash(), 16).str()).arg(Logs::mb(&attempt->data.new_nonce, 32).str())); + DEBUG_LOG(("AuthKey Error: received new_nonce_hash: %1, new_nonce: %2").arg(Logs::mb(&data.vnew_nonce_hash(), 16).str(), Logs::mb(&attempt->data.new_nonce, 32).str())); return failed(); } LOG(("AuthKey Error: server_DH_params_fail received!")); @@ -535,18 +535,18 @@ void DcKeyCreator::dhClientParamsAnswered( data.match([&](const MTPDdh_gen_ok &data) { if (data.vnonce() != attempt->data.nonce) { LOG(("AuthKey Error: received nonce <> sent nonce (in dh_gen_ok)!")); - DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str()).arg(Logs::mb(&attempt->data.nonce, 16).str())); + DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str(), Logs::mb(&attempt->data.nonce, 16).str())); return failed(); } if (data.vserver_nonce() != attempt->data.server_nonce) { LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in dh_gen_ok)!")); - DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str())); + DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str())); return failed(); } attempt->data.new_nonce_buf[32] = bytes::type(1); if (data.vnew_nonce_hash1() != NonceDigest(attempt->data.new_nonce_buf)) { LOG(("AuthKey Error: received new_nonce_hash1 did not match!")); - DEBUG_LOG(("AuthKey Error: received new_nonce_hash1: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash1(), 16).str()).arg(Logs::mb(attempt->data.new_nonce_buf.data(), 41).str())); + DEBUG_LOG(("AuthKey Error: received new_nonce_hash1: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash1(), 16).str(), Logs::mb(attempt->data.new_nonce_buf.data(), 41).str())); return failed(); } @@ -557,19 +557,19 @@ void DcKeyCreator::dhClientParamsAnswered( }, [&](const MTPDdh_gen_retry &data) { if (data.vnonce() != attempt->data.nonce) { LOG(("AuthKey Error: received nonce <> sent nonce (in dh_gen_retry)!")); - DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str()).arg(Logs::mb(&attempt->data.nonce, 16).str())); + DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str(), Logs::mb(&attempt->data.nonce, 16).str())); return failed(); } if (data.vserver_nonce() != attempt->data.server_nonce) { LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in dh_gen_retry)!")); - DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str())); + DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str())); return failed(); } attempt->data.new_nonce_buf[32] = bytes::type(2); uchar sha1Buffer[20]; if (data.vnew_nonce_hash2() != NonceDigest(attempt->data.new_nonce_buf)) { LOG(("AuthKey Error: received new_nonce_hash2 did not match!")); - DEBUG_LOG(("AuthKey Error: received new_nonce_hash2: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash2(), 16).str()).arg(Logs::mb(attempt->data.new_nonce_buf.data(), 41).str())); + DEBUG_LOG(("AuthKey Error: received new_nonce_hash2: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash2(), 16).str(), Logs::mb(attempt->data.new_nonce_buf.data(), 41).str())); return failed(); } attempt->data.retry_id = attempt->data.auth_key_aux_hash; @@ -577,19 +577,19 @@ void DcKeyCreator::dhClientParamsAnswered( }, [&](const MTPDdh_gen_fail &data) { if (data.vnonce() != attempt->data.nonce) { LOG(("AuthKey Error: received nonce <> sent nonce (in dh_gen_fail)!")); - DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str()).arg(Logs::mb(&attempt->data.nonce, 16).str())); + DEBUG_LOG(("AuthKey Error: received nonce: %1, sent nonce: %2").arg(Logs::mb(&data.vnonce(), 16).str(), Logs::mb(&attempt->data.nonce, 16).str())); return failed(); } if (data.vserver_nonce() != attempt->data.server_nonce) { LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in dh_gen_fail)!")); - DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str()).arg(Logs::mb(&attempt->data.server_nonce, 16).str())); + DEBUG_LOG(("AuthKey Error: received server_nonce: %1, sent server_nonce: %2").arg(Logs::mb(&data.vserver_nonce(), 16).str(), Logs::mb(&attempt->data.server_nonce, 16).str())); return failed(); } attempt->data.new_nonce_buf[32] = bytes::type(3); uchar sha1Buffer[20]; if (data.vnew_nonce_hash3() != NonceDigest(attempt->data.new_nonce_buf)) { LOG(("AuthKey Error: received new_nonce_hash3 did not match!")); - DEBUG_LOG(("AuthKey Error: received new_nonce_hash3: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash3(), 16).str()).arg(Logs::mb(attempt->data.new_nonce_buf.data(), 41).str())); + DEBUG_LOG(("AuthKey Error: received new_nonce_hash3: %1, new_nonce_buf: %2").arg(Logs::mb(&data.vnew_nonce_hash3(), 16).str(), Logs::mb(attempt->data.new_nonce_buf.data(), 41).str())); return failed(); } LOG(("AuthKey Error: dh_gen_fail received!")); diff --git a/Telegram/SourceFiles/mtproto/mtp_instance.cpp b/Telegram/SourceFiles/mtproto/mtp_instance.cpp index c7007e5ae..a144db622 100644 --- a/Telegram/SourceFiles/mtproto/mtp_instance.cpp +++ b/Telegram/SourceFiles/mtproto/mtp_instance.cpp @@ -1042,10 +1042,10 @@ void Instance::Private::processCallback(const Response &response) { if (handler.done || handler.fail) { const auto handleError = [&](const Error &error) { DEBUG_LOG(("RPC Info: " - "error received, code %1, type %2, description: %3" - ).arg(error.code() - ).arg(error.type() - ).arg(error.description())); + "error received, code %1, type %2, description: %3").arg( + QString::number(error.code()), + error.type(), + error.description())); if (rpcErrorOccured(response, handler, error)) { unregisterRequest(requestId); } else { @@ -1112,11 +1112,11 @@ bool Instance::Private::rpcErrorOccured( if (onErrorDefault(error, response)) { return false; } - LOG(("RPC Error: request %1 got fail with code %2, error %3%4" - ).arg(response.requestId - ).arg(error.code() - ).arg(error.type() - ).arg(error.description().isEmpty() + LOG(("RPC Error: request %1 got fail with code %2, error %3%4").arg( + QString::number(response.requestId), + QString::number(error.code()), + error.type(), + error.description().isEmpty() ? QString() : QString(": %1").arg(error.description()))); if (onFail) { diff --git a/Telegram/SourceFiles/mtproto/session_private.cpp b/Telegram/SourceFiles/mtproto/session_private.cpp index 2574c23ba..9258d8cdb 100644 --- a/Telegram/SourceFiles/mtproto/session_private.cpp +++ b/Telegram/SourceFiles/mtproto/session_private.cpp @@ -1701,7 +1701,11 @@ SessionPrivate::HandleResult SessionPrivate::handleOneReceived( auto &ids = data.vmsg_ids().v; auto &states = data.vinfo().v; - DEBUG_LOG(("Message Info: msgs all info received, msgId %1, reqMsgIds: %2, states %3").arg(msgId).arg(LogIdsVector(ids)).arg(Logs::mb(states.data(), states.length()).str())); + DEBUG_LOG(("Message Info: msgs all info received, msgId %1, reqMsgIds: %2, states %3").arg( + QString::number(msgId), + LogIdsVector(ids), + Logs::mb(states.data(), states.length()).str())); + handleMsgsStates(ids, states); } return HandleResult::Success; @@ -2271,8 +2275,9 @@ void SessionPrivate::onConnected( _testConnections, [&](const TestConnection &test) { return test.priority > my; }); if (j != end(_testConnections)) { - DEBUG_LOG(("MTP Info: connection %1 succeed, " - "waiting for %2.").arg(i->data->tag()).arg(j->data->tag())); + DEBUG_LOG(("MTP Info: connection %1 succeed, waiting for %2.").arg( + i->data->tag(), + j->data->tag())); _waitForBetterTimer.callOnce(kWaitForBetterTimeout); } else { DEBUG_LOG(("MTP Info: connection through IPv4 succeed.")); diff --git a/Telegram/SourceFiles/mtproto/special_config_request.cpp b/Telegram/SourceFiles/mtproto/special_config_request.cpp index f93c8539b..f1239bba9 100644 --- a/Telegram/SourceFiles/mtproto/special_config_request.cpp +++ b/Telegram/SourceFiles/mtproto/special_config_request.cpp @@ -100,7 +100,7 @@ QByteArray ParseRemoteConfigResponse(const QByteArray &bytes) { return document.object().value( "entries" ).toObject().value( - qsl("%1%2").arg(kConfigKey).arg(kConfigSubKey) + qsl("%1%2").arg(kConfigKey, kConfigSubKey) ).toString().toLatin1(); } @@ -290,17 +290,17 @@ void SpecialConfigRequest::performRequest(const Attempt &attempt) { case Type::Mozilla: { url.setHost(attempt.data); url.setPath(qsl("/dns-query")); - url.setQuery(qsl("name=%1&type=16&random_padding=%2" - ).arg(_domainString - ).arg(GenerateDnsRandomPadding())); + url.setQuery(qsl("name=%1&type=16&random_padding=%2").arg( + _domainString, + GenerateDnsRandomPadding())); request.setRawHeader("accept", "application/dns-json"); } break; case Type::Google: { url.setHost(attempt.data); url.setPath(qsl("/resolve")); - url.setQuery(qsl("name=%1&type=ANY&random_padding=%2" - ).arg(_domainString - ).arg(GenerateDnsRandomPadding())); + url.setQuery(qsl("name=%1&type=ANY&random_padding=%2").arg( + _domainString, + GenerateDnsRandomPadding())); if (!attempt.host.isEmpty()) { const auto host = attempt.host + ".google.com"; request.setRawHeader("Host", host.toLatin1()); @@ -311,23 +311,24 @@ void SpecialConfigRequest::performRequest(const Attempt &attempt) { url.setPath(qsl("/v1/projects/%1/namespaces/firebase:fetch" ).arg(kRemoteProject)); url.setQuery(qsl("key=%1").arg(kApiKey)); - payload = qsl("{\"app_id\":\"%1\",\"app_instance_id\":\"%2\"}" - ).arg(kAppId - ).arg(InstanceId()).toLatin1(); + payload = qsl("{\"app_id\":\"%1\",\"app_instance_id\":\"%2\"}").arg( + kAppId, + InstanceId()).toLatin1(); request.setRawHeader("Content-Type", "application/json"); } break; case Type::Realtime: { url.setHost(kFireProject + qsl(".%1").arg(attempt.data)); - url.setPath(qsl("/%1%2.json").arg(kConfigKey).arg(kConfigSubKey)); + url.setPath(qsl("/%1%2.json").arg(kConfigKey, kConfigSubKey)); } break; case Type::FireStore: { url.setHost(attempt.host.isEmpty() ? ApiDomain(attempt.data) : attempt.data); url.setPath(qsl("/v1/projects/%1/databases/(default)/documents/%2/%3" - ).arg(kFireProject - ).arg(kConfigKey - ).arg(kConfigSubKey)); + ).arg( + kFireProject, + kConfigKey, + kConfigSubKey)); if (!attempt.host.isEmpty()) { const auto host = ApiDomain(attempt.host); request.setRawHeader("Host", host.toLatin1()); diff --git a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp index 1c721e4c2..eb36fc019 100644 --- a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp @@ -51,10 +51,9 @@ void Launcher::initHook() { QApplication::setAttribute(Qt::AA_DisableSessionManager, true); QApplication::setDesktopFileName([] { if (!Core::UpdaterDisabled() && !cExeName().isEmpty()) { - const auto appimagePath = qsl("file://%1%2") - .arg(cExeDir()) - .arg(cExeName()) - .toUtf8(); + const auto appimagePath = qsl("file://%1%2").arg( + cExeDir(), + cExeName()).toUtf8(); char md5Hash[33] = { 0 }; hashMd5Hex( diff --git a/Telegram/SourceFiles/platform/linux/linux_desktop_environment.cpp b/Telegram/SourceFiles/platform/linux/linux_desktop_environment.cpp index 1915224c5..ac8c8c28a 100644 --- a/Telegram/SourceFiles/platform/linux/linux_desktop_environment.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_desktop_environment.cpp @@ -15,7 +15,7 @@ namespace { QString GetEnv(const char *name) { auto value = qEnvironmentVariable(name); - LOG(("Getting DE, %1: '%2'").arg(name).arg(value)); + LOG(("Getting DE, %1: '%2'").arg(name, value)); return value; } diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 9ec221bcc..afec532fe 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -395,13 +395,13 @@ NotificationData::NotificationData( if (capabilities.contains(qsl("body-markup"))) { _body = subtitle.isEmpty() ? msg.toHtmlEscaped().toStdString() - : qsl("%1\n%2") - .arg(subtitle.toHtmlEscaped()) - .arg(msg.toHtmlEscaped()).toStdString(); + : qsl("%1\n%2").arg( + subtitle.toHtmlEscaped(), + msg.toHtmlEscaped()).toStdString(); } else { _body = subtitle.isEmpty() ? msg.toStdString() - : qsl("%1\n%2").arg(subtitle).arg(msg).toStdString(); + : qsl("%1\n%2").arg(subtitle, msg).toStdString(); } if (capabilities.contains("actions")) { diff --git a/Telegram/SourceFiles/storage/details/storage_file_utilities.cpp b/Telegram/SourceFiles/storage/details/storage_file_utilities.cpp index 9591255cb..f33229273 100644 --- a/Telegram/SourceFiles/storage/details/storage_file_utilities.cpp +++ b/Telegram/SourceFiles/storage/details/storage_file_utilities.cpp @@ -283,9 +283,9 @@ void FileWriteDescriptor::finish() { return; } QFile::remove(safe); - LOG(("Storage Error: Could not rename '%1' to '%2', removing." - ).arg(simple - ).arg(safe)); + LOG(("Storage Error: Could not rename '%1' to '%2', removing.").arg( + simple, + safe)); } } @@ -360,9 +360,9 @@ bool ReadFile( continue; } if (memcmp(magic, TdfMagic, TdfMagicLen)) { - DEBUG_LOG(("App Info: bad magic %1 in '%2'" - ).arg(Logs::mb(magic, TdfMagicLen).str() - ).arg(name)); + DEBUG_LOG(("App Info: bad magic %1 in '%2'").arg( + Logs::mb(magic, TdfMagicLen).str(), + name)); continue; } diff --git a/Telegram/SourceFiles/storage/serialize_peer.cpp b/Telegram/SourceFiles/storage/serialize_peer.cpp index 75b37305d..b4b22c13c 100644 --- a/Telegram/SourceFiles/storage/serialize_peer.cpp +++ b/Telegram/SourceFiles/storage/serialize_peer.cpp @@ -338,7 +338,7 @@ QString peekUserPhone(int streamAppVersion, QDataStream &stream) { QString first, last, phone; stream >> first >> last >> phone; DEBUG_LOG(("peekUserPhone.data: %1 %2 %3" - ).arg(first).arg(last).arg(phone)); + ).arg(first, last, phone)); return phone; } diff --git a/Telegram/SourceFiles/storage/storage_cloud_song_cover.cpp b/Telegram/SourceFiles/storage/storage_cloud_song_cover.cpp index b5168e4d2..072926e16 100644 --- a/Telegram/SourceFiles/storage/storage_cloud_song_cover.cpp +++ b/Telegram/SourceFiles/storage/storage_cloud_song_cover.cpp @@ -36,7 +36,7 @@ auto Location(const QString &url) { auto JsonUrl(not_null song) { return QString("https://itunes.apple.com/search?term=" \ - "%1 %2&entity=song&limit=4").arg(song->performer).arg(song->title); + "%1 %2&entity=song&limit=4").arg(song->performer, song->title); } // Dummy JSON responce. diff --git a/Telegram/SourceFiles/support/support_templates.cpp b/Telegram/SourceFiles/support/support_templates.cpp index 773912b7f..6c3939a6b 100644 --- a/Telegram/SourceFiles/support/support_templates.cpp +++ b/Telegram/SourceFiles/support/support_templates.cpp @@ -378,10 +378,10 @@ QString FormatUpdateNotification(const QString &path, const Delta &delta) { if (!delta.added.empty()) { result += qstr("-------- Added --------\n\n"); for (const auto question : delta.added) { - result += qsl("Q: %1\nK: %2\nA: %3\n\n" - ).arg(question->question - ).arg(question->originalKeys.join(qsl(", ")) - ).arg(question->value.trimmed()); + result += qsl("Q: %1\nK: %2\nA: %3\n\n").arg( + question->question, + question->originalKeys.join(qsl(", ")), + question->value.trimmed()); } } if (!delta.changed.empty()) { diff --git a/Telegram/SourceFiles/window/notifications_utilities.cpp b/Telegram/SourceFiles/window/notifications_utilities.cpp index 724584cee..8fe8aa584 100644 --- a/Telegram/SourceFiles/window/notifications_utilities.cpp +++ b/Telegram/SourceFiles/window/notifications_utilities.cpp @@ -60,9 +60,9 @@ QString CachedUserpics::get( } else { v.until = 0; } - v.path = u"%1tdata/temp/%2.png"_q - .arg(cWorkingDir()) - .arg(QString::number(openssl::RandomValue(), 16)); + v.path = u"%1tdata/temp/%2.png"_q.arg( + cWorkingDir(), + QString::number(openssl::RandomValue(), 16)); if (key.first || key.second) { if (peer->isSelf()) { const auto method = (_type == Type::Rounded) diff --git a/Telegram/SourceFiles/window/themes/window_theme.cpp b/Telegram/SourceFiles/window/themes/window_theme.cpp index 40d8526dd..94ca16a35 100644 --- a/Telegram/SourceFiles/window/themes/window_theme.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme.cpp @@ -406,9 +406,9 @@ bool InitializeFromCache( bool InitializeFromSaved(Saved &&saved) { if (saved.object.content.size() < 4) { - LOG(("Theme Error: Could not load theme from '%1' (%2)" - ).arg(saved.object.pathRelative - ).arg(saved.object.pathAbsolute)); + LOG(("Theme Error: Could not load theme from '%1' (%2)").arg( + saved.object.pathRelative, + saved.object.pathAbsolute)); return false; } diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp index c1802bd6c..bfd6a42c9 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp @@ -611,7 +611,7 @@ void Editor::Inner::applyEditing(const QString &name, const QString ©Of, QCo auto plainValue = copyOf.isEmpty() ? ColorHexString(value) : copyOf.toLatin1(); auto newContent = ReplaceValueInPaletteContent(_paletteContent, plainName, plainValue); if (newContent == "error") { - LOG(("Theme Error: could not replace '%1: %2' in content").arg(name).arg(copyOf.isEmpty() ? QString::fromLatin1(ColorHexString(value)) : copyOf)); + LOG(("Theme Error: could not replace '%1: %2' in content").arg(name, copyOf.isEmpty() ? QString::fromLatin1(ColorHexString(value)) : copyOf)); error(); return; } diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp index 59cfb29ec..bb5918222 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp @@ -221,7 +221,7 @@ bool EditorBlock::feedCopy(const QString &name, const QString ©Of) { } addRow(name, copyOf, row->value()); } else { - LOG(("Theme Warning: Skipping value '%1: %2' (expected a color value in #rrggbb or #rrggbbaa or a previously defined key in the color scheme)").arg(name).arg(copyOf)); + LOG(("Theme Warning: Skipping value '%1: %2' (expected a color value in #rrggbb or #rrggbbaa or a previously defined key in the color scheme)").arg(name, copyOf)); } return true; } diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp index 927e02bee..8bbeecd64 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp @@ -284,9 +284,9 @@ void ImportFromFile( name, ColorHexString(color->c)); if (data == "error") { - LOG(("Theme Error: could not adjust '%1: %2' in content" - ).arg(QString::fromLatin1(name) - ).arg(QString::fromLatin1(ColorHexString(color->c)))); + LOG(("Theme Error: could not adjust '%1: %2' in content").arg( + QString::fromLatin1(name), + QString::fromLatin1(ColorHexString(color->c)))); return QByteArray(); } }