Avoid multiple .arg usage as suggested by clazy

This commit is contained in:
Ilya Fedin 2021-03-13 15:50:34 +04:00 committed by John Preston
parent d9771d0f88
commit c4dcf064d5
35 changed files with 161 additions and 149 deletions

View file

@ -46,9 +46,9 @@ Authorizations::Entry ParseEntry(const MTPDauthorization &data) {
return version; return version;
}(); }();
result.name = QString("%1%2") result.name = QString("%1%2").arg(
.arg(appName) appName,
.arg(appVer.isEmpty() ? QString() : (' ' + appVer)); appVer.isEmpty() ? QString() : (' ' + appVer));
const auto country = qs(data.vcountry()); const auto country = qs(data.vcountry());
const auto platform = qs(data.vplatform()); const auto platform = qs(data.vplatform());
@ -61,10 +61,10 @@ Authorizations::Entry ParseEntry(const MTPDauthorization &data) {
result.activeTime = data.vdate_active().v result.activeTime = data.vdate_active().v
? data.vdate_active().v ? data.vdate_active().v
: data.vdate_created().v; : data.vdate_created().v;
result.info = QString("%1, %2%3") result.info = QString("%1, %2%3").arg(
.arg(qs(data.vdevice_model())) qs(data.vdevice_model()),
.arg(platform.isEmpty() ? QString() : platform + ' ') platform.isEmpty() ? QString() : platform + ' ',
.arg(qs(data.vsystem_version())); qs(data.vsystem_version()));
result.ip = qs(data.vip()) result.ip = qs(data.vip())
+ (country.isEmpty() + (country.isEmpty()
? QString() ? QString()

View file

@ -399,10 +399,10 @@ void Updates::feedChannelDifference(
void Updates::channelDifferenceFail( void Updates::channelDifferenceFail(
not_null<ChannelData*> channel, not_null<ChannelData*> channel,
const MTP::Error &error) { const MTP::Error &error) {
LOG(("RPC Error in getChannelDifference: %1 %2: %3" LOG(("RPC Error in getChannelDifference: %1 %2: %3").arg(
).arg(error.code() QString::number(error.code()),
).arg(error.type() error.type(),
).arg(error.description())); error.description()));
failDifferenceStartTimerFor(channel); failDifferenceStartTimerFor(channel);
} }

View file

@ -819,9 +819,9 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
return data.vlibrary_versions().v; return data.vlibrary_versions().v;
}).value(0, MTP_bytes(kDefaultVersion)).v; }).value(0, MTP_bytes(kDefaultVersion)).v;
LOG(("Call Info: Creating instance with version '%1', allowP2P: %2" LOG(("Call Info: Creating instance with version '%1', allowP2P: %2").arg(
).arg(QString::fromUtf8(version) QString::fromUtf8(version),
).arg(Logs::b(descriptor.config.enableP2P))); Logs::b(descriptor.config.enableP2P)));
_instance = tgcalls::Meta::Create( _instance = tgcalls::Meta::Create(
version.toStdString(), version.toStdString(),
std::move(descriptor)); std::move(descriptor));

View file

@ -261,8 +261,9 @@ void ApplyDifference(
}) | ranges::view::filter([&](const LangPackEmoji &entry) { }) | ranges::view::filter([&](const LangPackEmoji &entry) {
if (!entry.emoji) { if (!entry.emoji) {
LOG(("API Warning: emoji %1 is not supported, word: %2." LOG(("API Warning: emoji %1 is not supported, word: %2."
).arg(entry.text ).arg(
).arg(word)); entry.text,
word));
} }
return (entry.emoji != nullptr); return (entry.emoji != nullptr);
}); });
@ -419,9 +420,9 @@ void EmojiKeywords::LangPack::applyDifference(
const auto version = data.vversion().v; const auto version = data.vversion().v;
const auto &keywords = data.vkeywords().v; const auto &keywords = data.vkeywords().v;
if (code != _id) { if (code != _id) {
LOG(("API Error: Bad lang_code for emoji keywords %1 -> %2" LOG(("API Error: Bad lang_code for emoji keywords %1 -> %2").arg(
).arg(_id _id,
).arg(code)); code));
_data.version = 0; _data.version = 0;
_state = State::Refreshed; _state = State::Refreshed;
return; return;

View file

@ -1046,9 +1046,9 @@ bool FieldAutocomplete::Inner::chooseAtIndex(
const auto insertUsername = (botStatus == 0 const auto insertUsername = (botStatus == 0
|| botStatus == 2 || botStatus == 2
|| _parent->filter().indexOf('@') > 0); || _parent->filter().indexOf('@') > 0);
const auto commandString = QString("/%1%2") const auto commandString = QString("/%1%2").arg(
.arg(command->command) command->command,
.arg(insertUsername ? ('@' + user->username) : QString()); insertUsername ? ('@' + user->username) : QString());
_botCommandChosen.fire({ commandString, method }); _botCommandChosen.fire({ commandString, method });
return true; return true;

View file

@ -251,9 +251,9 @@ MTP::DedicatedLoader::Location GetDownloadLocation(int id) {
QString DictPathByLangId(int langId) { QString DictPathByLangId(int langId) {
EnsurePath(); EnsurePath();
return qsl("%1/%2") return qsl("%1/%2").arg(
.arg(DictionariesPath()) DictionariesPath(),
.arg(Spellchecker::LocaleFromLangId(langId).name()); Spellchecker::LocaleFromLangId(langId).name());
} }
QString DictionariesPath() { QString DictionariesPath() {
@ -281,9 +281,9 @@ bool RemoveDictionary(int langId) {
return true; return true;
} }
const auto fileName = Spellchecker::LocaleFromLangId(langId).name(); const auto fileName = Spellchecker::LocaleFromLangId(langId).name();
const auto folder = qsl("%1/%2/") const auto folder = qsl("%1/%2/").arg(
.arg(DictionariesPath()) DictionariesPath(),
.arg(fileName); fileName);
return QDir(folder).removeRecursively(); return QDir(folder).removeRecursively();
} }
@ -294,9 +294,9 @@ bool WriteDefaultDictionary() {
return false; return false;
} }
const auto fileName = QLocale(en).name(); const auto fileName = QLocale(en).name();
const auto folder = qsl("%1/%2/") const auto folder = qsl("%1/%2/").arg(
.arg(DictionariesPath()) DictionariesPath(),
.arg(fileName); fileName);
QDir(folder).removeRecursively(); QDir(folder).removeRecursively();
const auto path = folder + fileName; const auto path = folder + fileName;

View file

@ -468,7 +468,11 @@ void LastCrashedWindow::onSendReport() {
} }
QString apiid = getReportField(qstr("apiid"), qstr("ApiId:")), version = getReportField(qstr("version"), qstr("Version:")); 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(error(QNetworkReply::NetworkError)), this, SLOT(onSendingError(QNetworkReply::NetworkError)));
connect(_checkReply, SIGNAL(finished()), this, SLOT(onCheckingFinished())); connect(_checkReply, SIGNAL(finished()), this, SLOT(onCheckingFinished()));

View file

@ -183,16 +183,14 @@ bool MoveLegacyAlphaFolder(const QString &folder, const QString &file) {
const auto newFile = was + "/tdata/alpha"; const auto newFile = was + "/tdata/alpha";
if (QFile::exists(oldFile) && !QFile::exists(newFile)) { if (QFile::exists(oldFile) && !QFile::exists(newFile)) {
if (!QFile(oldFile).copy(newFile)) { if (!QFile(oldFile).copy(newFile)) {
LOG(("FATAL: Could not copy '%1' to '%2'" LOG(("FATAL: Could not copy '%1' to '%2'").arg(
).arg(oldFile oldFile,
).arg(newFile)); newFile));
return false; return false;
} }
} }
if (!QDir().rename(was, now)) { if (!QDir().rename(was, now)) {
LOG(("FATAL: Could not rename '%1' to '%2'" LOG(("FATAL: Could not rename '%1' to '%2'").arg(was, now));
).arg(was
).arg(now));
return false; return false;
} }
} }

View file

@ -580,7 +580,7 @@ QString TryConvertUrlToLocal(QString url) {
return qsl("tg://bg?slug=") + bgMatch->captured(1) + (params.isEmpty() ? QString() : '&' + params); return qsl("tg://bg?slug=") + bgMatch->captured(1) + (params.isEmpty() ? QString() : '&' + params);
} else if (auto postMatch = regex_match(qsl("^c/(\\-?\\d+)/(\\d+)(/?\\?|/?$)"), query, matchOptions)) { } else if (auto postMatch = regex_match(qsl("^c/(\\-?\\d+)/(\\d+)(/?\\?|/?$)"), query, matchOptions)) {
auto params = query.mid(postMatch->captured(0).size()).toString(); 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)) { } else if (auto usernameMatch = regex_match(qsl("^([a-zA-Z0-9\\.\\_]+)(/?\\?|/?$|/(\\d+)/?(?:\\?|$))"), query, matchOptions)) {
auto params = query.mid(usernameMatch->captured(0).size()).toString(); auto params = query.mid(usernameMatch->captured(0).size()).toString();
auto postParam = QString(); auto postParam = QString();

View file

@ -288,7 +288,7 @@ void Sandbox::socketError(QLocalSocket::LocalSocketError e) {
psCheckLocalSocket(_localServerName); psCheckLocalSocket(_localServerName);
if (!_localServer.listen(_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(); return App::quit();
} }
#endif // !Q_OS_WINRT #endif // !Q_OS_WINRT

View file

@ -1443,9 +1443,9 @@ bool History::unreadCountRefreshNeeded(MsgId readTillId) const {
std::optional<int> History::countStillUnreadLocal(MsgId readTillId) const { std::optional<int> History::countStillUnreadLocal(MsgId readTillId) const {
if (isEmpty() || !folderKnown()) { if (isEmpty() || !folderKnown()) {
DEBUG_LOG(("Reading: countStillUnreadLocal unknown %1 and %2." DEBUG_LOG(("Reading: countStillUnreadLocal unknown %1 and %2.").arg(
).arg(Logs::b(isEmpty()) Logs::b(isEmpty()),
).arg(Logs::b(folderKnown()))); Logs::b(folderKnown())));
return std::nullopt; return std::nullopt;
} }
if (_inboxReadBefore) { if (_inboxReadBefore) {
@ -1478,10 +1478,10 @@ std::optional<int> History::countStillUnreadLocal(MsgId readTillId) const {
} }
} }
const auto minimalServerId = minMsgId(); const auto minimalServerId = minMsgId();
DEBUG_LOG(("Reading: check at end loaded from %1 loaded %2 - %3" DEBUG_LOG(("Reading: check at end loaded from %1 loaded %2 - %3").arg(
).arg(minimalServerId QString::number(minimalServerId),
).arg(Logs::b(loadedAtBottom()) Logs::b(loadedAtBottom()),
).arg(Logs::b(loadedAtTop()))); Logs::b(loadedAtTop())));
if (!loadedAtBottom() if (!loadedAtBottom()
|| (!loadedAtTop() && !minimalServerId) || (!loadedAtTop() && !minimalServerId)
|| minimalServerId > readTillId) { || minimalServerId > readTillId) {

View file

@ -464,7 +464,7 @@ QString ReplyMarkupClickHandler::tooltip() const {
const auto url = button ? QString::fromUtf8(button->data) : QString(); const auto url = button ? QString::fromUtf8(button->data) : QString();
const auto text = _fullDisplayed ? QString() : buttonText(); const auto text = _fullDisplayed ? QString() : buttonText();
if (!url.isEmpty() && !text.isEmpty()) { 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()) { } else if (url.isEmpty() != text.isEmpty()) {
return text + url; return text + url;
} else { } else {

View file

@ -2497,7 +2497,11 @@ void HistoryWidget::messagesFailed(const MTP::Error &error, int requestId) {
return; 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) { if (_preloadRequest == requestId) {
_preloadRequest = 0; _preloadRequest = 0;
} else if (_preloadDownRequest == requestId) { } else if (_preloadDownRequest == requestId) {

View file

@ -290,9 +290,9 @@ void CloudManager::applyLangPackDifference(
} }
} else { } else {
LOG(("Lang Warning: " LOG(("Lang Warning: "
"Ignoring update for '%1' because our language is '%2'" "Ignoring update for '%1' because our language is '%2'").arg(
).arg(langpackId langpackId,
).arg(_langpack.id())); _langpack.id()));
} }
} }

View file

@ -155,7 +155,7 @@ bool FileParser::readKeyValue(const char *&from, const char *end) {
QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &relativePath) { QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &relativePath) {
QFile file(QFileInfo(relativePath).exists() ? relativePath : absolutePath); QFile file(QFileInfo(relativePath).exists() ? relativePath : absolutePath);
if (!file.open(QIODevice::ReadOnly)) { 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(); return QByteArray();
} }
if (file.size() > kLangFileLimit) { if (file.size() > kLangFileLimit) {
@ -166,7 +166,7 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela
constexpr auto kCodecMagicSize = 3; constexpr auto kCodecMagicSize = 3;
auto codecMagic = file.read(kCodecMagicSize); auto codecMagic = file.read(kCodecMagicSize);
if (codecMagic.size() < 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(); return QByteArray();
} }
file.seek(0); file.seek(0);
@ -177,11 +177,11 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela
stream.setCodec("UTF-16"); stream.setCodec("UTF-16");
auto string = stream.readAll(); auto string = stream.readAll();
if (stream.status() != QTextStream::Ok) { 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(); return QByteArray();
} }
if (string.isEmpty()) { 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 QByteArray();
} }
return string.toUtf8(); return string.toUtf8();
@ -197,7 +197,7 @@ QByteArray FileParser::ReadFile(const QString &absolutePath, const QString &rela
data = data.mid(3); // skip UTF-8 BOM data = data.mid(3); // skip UTF-8 BOM
} }
if (data.isEmpty()) { 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 QByteArray();
} }
return data; return data;

View file

@ -92,7 +92,7 @@ void ValueParser::appendToResult(const char *nextBegin) {
bool ValueParser::logError(const QString &text) { bool ValueParser::logError(const QString &text) {
_failed = true; _failed = true;
auto loggedKey = (_currentTag.size() > 0) ? (_key + QString(':') + _currentTag) : QString(_key); 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; return false;
} }

View file

@ -55,7 +55,7 @@ QString _logsEntryStart() {
const auto tm = QDateTime::currentDateTime(); 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 { class LogsDataFields {
@ -136,12 +136,12 @@ private:
return false; return false;
} }
if (!QFile(files[type]->fileName()).copy(to->fileName())) { // don't close files[type] yet 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; return false;
} }
if (to->open(mode | QIODevice::Append)) { if (to->open(mode | QIODevice::Append)) {
std::swap(files[type], to); 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(); to->remove();
LogsStartIndexChosen = -1; LogsStartIndexChosen = -1;
@ -152,7 +152,7 @@ private:
QString oldlog = cWorkingDir() + *i, oldlogend = i->mid(qstr("log_start").size()); 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")) { if (oldlogend.size() == 1 + qstr(".txt").size() && oldlogend.at(0).isDigit() && oldlogend.midRef(1) == qstr(".txt")) {
bool removed = QFile(*i).remove(); 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) { void MoveOldDataFiles(const QString &wasDir) {
QFile data(wasDir + "data"), dataConfig(wasDir + "data_config"), tdataConfig(wasDir + "tdata/config"); 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 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")) { if (data.copy(cWorkingDir() + "data")) {
LOG(("Copied 'data' to home dir")); LOG(("Copied 'data' to home dir"));
if (dataConfig.copy(cWorkingDir() + "data_config")) { if (dataConfig.copy(cWorkingDir() + "data_config")) {
@ -419,7 +419,7 @@ void start(not_null<Core::Launcher*> launcher) {
).arg(Logs::b(cInstallBetaVersion()) ).arg(Logs::b(cInstallBetaVersion())
).arg(cAlphaVersion() ).arg(cAlphaVersion()
).arg(Logs::b(DebugEnabled()))); ).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(("Initial working dir: %1").arg(initialWorkingDir));
LOG(("Working dir: %1").arg(cWorkingDir())); LOG(("Working dir: %1").arg(cWorkingDir()));
LOG(("Command line: %1").arg(launcher->argumentsString())); 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)); 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); _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); _logsWrite(LogDataDebug, debugmsg);
} }
@ -549,7 +549,7 @@ void writeDebug(const char *file, int32 line, const QString &v) {
file = found + 1; 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); _logsWrite(LogDataDebug, msg);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -562,7 +562,7 @@ void writeDebug(const char *file, int32 line, const QString &v) {
} }
void writeTcp(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); _logsWrite(LogDataTcp, msg);
} }

View file

@ -174,7 +174,7 @@ void PaintImageProfile(QPainter &p, const QImage &image, QRect rect, QRect fill)
} }
} }
push(); 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(); times = QStringList();
now = crl::now(); now = crl::now();
}; };

View file

@ -72,10 +72,10 @@ void ResolvingConnection::setChild(ConnectionPointer &&child) {
&AbstractConnection::disconnected, &AbstractConnection::disconnected,
this, this,
&ResolvingConnection::handleDisconnected); &ResolvingConnection::handleDisconnected);
DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' got new child '%3'" DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' got new child '%3'").arg(
).arg(_protocolDcId QString::number(_protocolDcId),
).arg(_proxy.host + ':' + QString::number(_proxy.port) _proxy.host + ':' + QString::number(_proxy.port),
).arg((_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size()) (_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size())
? _proxy.resolvedIPs[_ipIndex] ? _proxy.resolvedIPs[_ipIndex]
: _proxy.host)); : _proxy.host));
if (_protocolDcId) { if (_protocolDcId) {
@ -227,10 +227,10 @@ void ResolvingConnection::connectToServer(
_port = port; _port = port;
_protocolSecret = protocolSecret; _protocolSecret = protocolSecret;
_protocolDcId = protocolDcId; _protocolDcId = protocolDcId;
DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' connects a child '%3'" DEBUG_LOG(("Resolving Info: dc:%1 proxy '%2' connects a child '%3'").arg(
).arg(_protocolDcId QString::number(_protocolDcId),
).arg(_proxy.host +':' + QString::number(_proxy.port) _proxy.host +':' + QString::number(_proxy.port),
).arg((_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size()) (_ipIndex >= 0 && _ipIndex < _proxy.resolvedIPs.size())
? _proxy.resolvedIPs[_ipIndex] ? _proxy.resolvedIPs[_ipIndex]
: _proxy.host)); : _proxy.host));
return _child->connectToServer( return _child->connectToServer(

View file

@ -380,7 +380,7 @@ void DcKeyCreator::dhParamsAnswered(
if (data.vserver_nonce() != attempt->data.server_nonce) { if (data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in server_DH_params_ok)!")); 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(); return failed();
} }
@ -426,12 +426,12 @@ void DcKeyCreator::dhParamsAnswered(
const auto &dh_inner_data(dh_inner.c_server_DH_inner_data()); const auto &dh_inner_data(dh_inner.c_server_DH_inner_data());
if (dh_inner_data.vnonce() != attempt->data.nonce) { if (dh_inner_data.vnonce() != attempt->data.nonce) {
LOG(("AuthKey Error: received nonce <> sent nonce (in server_DH_inner_data)!")); 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(); return failed();
} }
if (dh_inner_data.vserver_nonce() != attempt->data.server_nonce) { if (dh_inner_data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in server_DH_inner_data)!")); 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(); return failed();
} }
const auto sha1Buffer = openssl::Sha1( const auto sha1Buffer = openssl::Sha1(
@ -443,7 +443,7 @@ void DcKeyCreator::dhParamsAnswered(
openssl::kSha1Size); openssl::kSha1Size);
if (bytes::compare(sha1Dec, sha1Buffer)) { if (bytes::compare(sha1Dec, sha1Buffer)) {
LOG(("AuthKey Error: sha1 hash of encrypted part did not match!")); 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(); return failed();
} }
base::unixtime::update(dh_inner_data.vserver_time().v); base::unixtime::update(dh_inner_data.vserver_time().v);
@ -466,12 +466,12 @@ void DcKeyCreator::dhParamsAnswered(
if (data.vserver_nonce() != attempt->data.server_nonce) { if (data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in server_DH_params_fail)!")); 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(); return failed();
} }
if (data.vnew_nonce_hash() != NonceDigest(bytes::object_as_span(&attempt->data.new_nonce))) { if (data.vnew_nonce_hash() != NonceDigest(bytes::object_as_span(&attempt->data.new_nonce))) {
LOG(("AuthKey Error: received new_nonce_hash did not match!")); 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(); return failed();
} }
LOG(("AuthKey Error: server_DH_params_fail received!")); LOG(("AuthKey Error: server_DH_params_fail received!"));
@ -535,18 +535,18 @@ void DcKeyCreator::dhClientParamsAnswered(
data.match([&](const MTPDdh_gen_ok &data) { data.match([&](const MTPDdh_gen_ok &data) {
if (data.vnonce() != attempt->data.nonce) { if (data.vnonce() != attempt->data.nonce) {
LOG(("AuthKey Error: received nonce <> sent nonce (in dh_gen_ok)!")); 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(); return failed();
} }
if (data.vserver_nonce() != attempt->data.server_nonce) { if (data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in dh_gen_ok)!")); 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(); return failed();
} }
attempt->data.new_nonce_buf[32] = bytes::type(1); attempt->data.new_nonce_buf[32] = bytes::type(1);
if (data.vnew_nonce_hash1() != NonceDigest(attempt->data.new_nonce_buf)) { if (data.vnew_nonce_hash1() != NonceDigest(attempt->data.new_nonce_buf)) {
LOG(("AuthKey Error: received new_nonce_hash1 did not match!")); 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(); return failed();
} }
@ -557,19 +557,19 @@ void DcKeyCreator::dhClientParamsAnswered(
}, [&](const MTPDdh_gen_retry &data) { }, [&](const MTPDdh_gen_retry &data) {
if (data.vnonce() != attempt->data.nonce) { if (data.vnonce() != attempt->data.nonce) {
LOG(("AuthKey Error: received nonce <> sent nonce (in dh_gen_retry)!")); 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(); return failed();
} }
if (data.vserver_nonce() != attempt->data.server_nonce) { if (data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in dh_gen_retry)!")); 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(); return failed();
} }
attempt->data.new_nonce_buf[32] = bytes::type(2); attempt->data.new_nonce_buf[32] = bytes::type(2);
uchar sha1Buffer[20]; uchar sha1Buffer[20];
if (data.vnew_nonce_hash2() != NonceDigest(attempt->data.new_nonce_buf)) { if (data.vnew_nonce_hash2() != NonceDigest(attempt->data.new_nonce_buf)) {
LOG(("AuthKey Error: received new_nonce_hash2 did not match!")); 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(); return failed();
} }
attempt->data.retry_id = attempt->data.auth_key_aux_hash; attempt->data.retry_id = attempt->data.auth_key_aux_hash;
@ -577,19 +577,19 @@ void DcKeyCreator::dhClientParamsAnswered(
}, [&](const MTPDdh_gen_fail &data) { }, [&](const MTPDdh_gen_fail &data) {
if (data.vnonce() != attempt->data.nonce) { if (data.vnonce() != attempt->data.nonce) {
LOG(("AuthKey Error: received nonce <> sent nonce (in dh_gen_fail)!")); 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(); return failed();
} }
if (data.vserver_nonce() != attempt->data.server_nonce) { if (data.vserver_nonce() != attempt->data.server_nonce) {
LOG(("AuthKey Error: received server_nonce <> sent server_nonce (in dh_gen_fail)!")); 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(); return failed();
} }
attempt->data.new_nonce_buf[32] = bytes::type(3); attempt->data.new_nonce_buf[32] = bytes::type(3);
uchar sha1Buffer[20]; uchar sha1Buffer[20];
if (data.vnew_nonce_hash3() != NonceDigest(attempt->data.new_nonce_buf)) { if (data.vnew_nonce_hash3() != NonceDigest(attempt->data.new_nonce_buf)) {
LOG(("AuthKey Error: received new_nonce_hash3 did not match!")); 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(); return failed();
} }
LOG(("AuthKey Error: dh_gen_fail received!")); LOG(("AuthKey Error: dh_gen_fail received!"));

View file

@ -1042,10 +1042,10 @@ void Instance::Private::processCallback(const Response &response) {
if (handler.done || handler.fail) { if (handler.done || handler.fail) {
const auto handleError = [&](const Error &error) { const auto handleError = [&](const Error &error) {
DEBUG_LOG(("RPC Info: " DEBUG_LOG(("RPC Info: "
"error received, code %1, type %2, description: %3" "error received, code %1, type %2, description: %3").arg(
).arg(error.code() QString::number(error.code()),
).arg(error.type() error.type(),
).arg(error.description())); error.description()));
if (rpcErrorOccured(response, handler, error)) { if (rpcErrorOccured(response, handler, error)) {
unregisterRequest(requestId); unregisterRequest(requestId);
} else { } else {
@ -1112,11 +1112,11 @@ bool Instance::Private::rpcErrorOccured(
if (onErrorDefault(error, response)) { if (onErrorDefault(error, response)) {
return false; return false;
} }
LOG(("RPC Error: request %1 got fail with code %2, error %3%4" LOG(("RPC Error: request %1 got fail with code %2, error %3%4").arg(
).arg(response.requestId QString::number(response.requestId),
).arg(error.code() QString::number(error.code()),
).arg(error.type() error.type(),
).arg(error.description().isEmpty() error.description().isEmpty()
? QString() ? QString()
: QString(": %1").arg(error.description()))); : QString(": %1").arg(error.description())));
if (onFail) { if (onFail) {

View file

@ -1701,7 +1701,11 @@ SessionPrivate::HandleResult SessionPrivate::handleOneReceived(
auto &ids = data.vmsg_ids().v; auto &ids = data.vmsg_ids().v;
auto &states = data.vinfo().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); handleMsgsStates(ids, states);
} return HandleResult::Success; } return HandleResult::Success;
@ -2271,8 +2275,9 @@ void SessionPrivate::onConnected(
_testConnections, _testConnections,
[&](const TestConnection &test) { return test.priority > my; }); [&](const TestConnection &test) { return test.priority > my; });
if (j != end(_testConnections)) { if (j != end(_testConnections)) {
DEBUG_LOG(("MTP Info: connection %1 succeed, " DEBUG_LOG(("MTP Info: connection %1 succeed, waiting for %2.").arg(
"waiting for %2.").arg(i->data->tag()).arg(j->data->tag())); i->data->tag(),
j->data->tag()));
_waitForBetterTimer.callOnce(kWaitForBetterTimeout); _waitForBetterTimer.callOnce(kWaitForBetterTimeout);
} else { } else {
DEBUG_LOG(("MTP Info: connection through IPv4 succeed.")); DEBUG_LOG(("MTP Info: connection through IPv4 succeed."));

View file

@ -100,7 +100,7 @@ QByteArray ParseRemoteConfigResponse(const QByteArray &bytes) {
return document.object().value( return document.object().value(
"entries" "entries"
).toObject().value( ).toObject().value(
qsl("%1%2").arg(kConfigKey).arg(kConfigSubKey) qsl("%1%2").arg(kConfigKey, kConfigSubKey)
).toString().toLatin1(); ).toString().toLatin1();
} }
@ -290,17 +290,17 @@ void SpecialConfigRequest::performRequest(const Attempt &attempt) {
case Type::Mozilla: { case Type::Mozilla: {
url.setHost(attempt.data); url.setHost(attempt.data);
url.setPath(qsl("/dns-query")); url.setPath(qsl("/dns-query"));
url.setQuery(qsl("name=%1&type=16&random_padding=%2" url.setQuery(qsl("name=%1&type=16&random_padding=%2").arg(
).arg(_domainString _domainString,
).arg(GenerateDnsRandomPadding())); GenerateDnsRandomPadding()));
request.setRawHeader("accept", "application/dns-json"); request.setRawHeader("accept", "application/dns-json");
} break; } break;
case Type::Google: { case Type::Google: {
url.setHost(attempt.data); url.setHost(attempt.data);
url.setPath(qsl("/resolve")); url.setPath(qsl("/resolve"));
url.setQuery(qsl("name=%1&type=ANY&random_padding=%2" url.setQuery(qsl("name=%1&type=ANY&random_padding=%2").arg(
).arg(_domainString _domainString,
).arg(GenerateDnsRandomPadding())); GenerateDnsRandomPadding()));
if (!attempt.host.isEmpty()) { if (!attempt.host.isEmpty()) {
const auto host = attempt.host + ".google.com"; const auto host = attempt.host + ".google.com";
request.setRawHeader("Host", host.toLatin1()); request.setRawHeader("Host", host.toLatin1());
@ -311,23 +311,24 @@ void SpecialConfigRequest::performRequest(const Attempt &attempt) {
url.setPath(qsl("/v1/projects/%1/namespaces/firebase:fetch" url.setPath(qsl("/v1/projects/%1/namespaces/firebase:fetch"
).arg(kRemoteProject)); ).arg(kRemoteProject));
url.setQuery(qsl("key=%1").arg(kApiKey)); url.setQuery(qsl("key=%1").arg(kApiKey));
payload = qsl("{\"app_id\":\"%1\",\"app_instance_id\":\"%2\"}" payload = qsl("{\"app_id\":\"%1\",\"app_instance_id\":\"%2\"}").arg(
).arg(kAppId kAppId,
).arg(InstanceId()).toLatin1(); InstanceId()).toLatin1();
request.setRawHeader("Content-Type", "application/json"); request.setRawHeader("Content-Type", "application/json");
} break; } break;
case Type::Realtime: { case Type::Realtime: {
url.setHost(kFireProject + qsl(".%1").arg(attempt.data)); 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; } break;
case Type::FireStore: { case Type::FireStore: {
url.setHost(attempt.host.isEmpty() url.setHost(attempt.host.isEmpty()
? ApiDomain(attempt.data) ? ApiDomain(attempt.data)
: attempt.data); : attempt.data);
url.setPath(qsl("/v1/projects/%1/databases/(default)/documents/%2/%3" url.setPath(qsl("/v1/projects/%1/databases/(default)/documents/%2/%3"
).arg(kFireProject ).arg(
).arg(kConfigKey kFireProject,
).arg(kConfigSubKey)); kConfigKey,
kConfigSubKey));
if (!attempt.host.isEmpty()) { if (!attempt.host.isEmpty()) {
const auto host = ApiDomain(attempt.host); const auto host = ApiDomain(attempt.host);
request.setRawHeader("Host", host.toLatin1()); request.setRawHeader("Host", host.toLatin1());

View file

@ -51,10 +51,9 @@ void Launcher::initHook() {
QApplication::setAttribute(Qt::AA_DisableSessionManager, true); QApplication::setAttribute(Qt::AA_DisableSessionManager, true);
QApplication::setDesktopFileName([] { QApplication::setDesktopFileName([] {
if (!Core::UpdaterDisabled() && !cExeName().isEmpty()) { if (!Core::UpdaterDisabled() && !cExeName().isEmpty()) {
const auto appimagePath = qsl("file://%1%2") const auto appimagePath = qsl("file://%1%2").arg(
.arg(cExeDir()) cExeDir(),
.arg(cExeName()) cExeName()).toUtf8();
.toUtf8();
char md5Hash[33] = { 0 }; char md5Hash[33] = { 0 };
hashMd5Hex( hashMd5Hex(

View file

@ -15,7 +15,7 @@ namespace {
QString GetEnv(const char *name) { QString GetEnv(const char *name) {
auto value = qEnvironmentVariable(name); auto value = qEnvironmentVariable(name);
LOG(("Getting DE, %1: '%2'").arg(name).arg(value)); LOG(("Getting DE, %1: '%2'").arg(name, value));
return value; return value;
} }

View file

@ -395,13 +395,13 @@ NotificationData::NotificationData(
if (capabilities.contains(qsl("body-markup"))) { if (capabilities.contains(qsl("body-markup"))) {
_body = subtitle.isEmpty() _body = subtitle.isEmpty()
? msg.toHtmlEscaped().toStdString() ? msg.toHtmlEscaped().toStdString()
: qsl("<b>%1</b>\n%2") : qsl("<b>%1</b>\n%2").arg(
.arg(subtitle.toHtmlEscaped()) subtitle.toHtmlEscaped(),
.arg(msg.toHtmlEscaped()).toStdString(); msg.toHtmlEscaped()).toStdString();
} else { } else {
_body = subtitle.isEmpty() _body = subtitle.isEmpty()
? msg.toStdString() ? msg.toStdString()
: qsl("%1\n%2").arg(subtitle).arg(msg).toStdString(); : qsl("%1\n%2").arg(subtitle, msg).toStdString();
} }
if (capabilities.contains("actions")) { if (capabilities.contains("actions")) {

View file

@ -283,9 +283,9 @@ void FileWriteDescriptor::finish() {
return; return;
} }
QFile::remove(safe); QFile::remove(safe);
LOG(("Storage Error: Could not rename '%1' to '%2', removing." LOG(("Storage Error: Could not rename '%1' to '%2', removing.").arg(
).arg(simple simple,
).arg(safe)); safe));
} }
} }
@ -360,9 +360,9 @@ bool ReadFile(
continue; continue;
} }
if (memcmp(magic, TdfMagic, TdfMagicLen)) { if (memcmp(magic, TdfMagic, TdfMagicLen)) {
DEBUG_LOG(("App Info: bad magic %1 in '%2'" DEBUG_LOG(("App Info: bad magic %1 in '%2'").arg(
).arg(Logs::mb(magic, TdfMagicLen).str() Logs::mb(magic, TdfMagicLen).str(),
).arg(name)); name));
continue; continue;
} }

View file

@ -338,7 +338,7 @@ QString peekUserPhone(int streamAppVersion, QDataStream &stream) {
QString first, last, phone; QString first, last, phone;
stream >> first >> last >> phone; stream >> first >> last >> phone;
DEBUG_LOG(("peekUserPhone.data: %1 %2 %3" DEBUG_LOG(("peekUserPhone.data: %1 %2 %3"
).arg(first).arg(last).arg(phone)); ).arg(first, last, phone));
return phone; return phone;
} }

View file

@ -36,7 +36,7 @@ auto Location(const QString &url) {
auto JsonUrl(not_null<SongData*> song) { auto JsonUrl(not_null<SongData*> song) {
return QString("https://itunes.apple.com/search?term=" \ 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. // Dummy JSON responce.

View file

@ -378,10 +378,10 @@ QString FormatUpdateNotification(const QString &path, const Delta &delta) {
if (!delta.added.empty()) { if (!delta.added.empty()) {
result += qstr("-------- Added --------\n\n"); result += qstr("-------- Added --------\n\n");
for (const auto question : delta.added) { for (const auto question : delta.added) {
result += qsl("Q: %1\nK: %2\nA: %3\n\n" result += qsl("Q: %1\nK: %2\nA: %3\n\n").arg(
).arg(question->question question->question,
).arg(question->originalKeys.join(qsl(", ")) question->originalKeys.join(qsl(", ")),
).arg(question->value.trimmed()); question->value.trimmed());
} }
} }
if (!delta.changed.empty()) { if (!delta.changed.empty()) {

View file

@ -60,9 +60,9 @@ QString CachedUserpics::get(
} else { } else {
v.until = 0; v.until = 0;
} }
v.path = u"%1tdata/temp/%2.png"_q v.path = u"%1tdata/temp/%2.png"_q.arg(
.arg(cWorkingDir()) cWorkingDir(),
.arg(QString::number(openssl::RandomValue<uint64>(), 16)); QString::number(openssl::RandomValue<uint64>(), 16));
if (key.first || key.second) { if (key.first || key.second) {
if (peer->isSelf()) { if (peer->isSelf()) {
const auto method = (_type == Type::Rounded) const auto method = (_type == Type::Rounded)

View file

@ -406,9 +406,9 @@ bool InitializeFromCache(
bool InitializeFromSaved(Saved &&saved) { bool InitializeFromSaved(Saved &&saved) {
if (saved.object.content.size() < 4) { if (saved.object.content.size() < 4) {
LOG(("Theme Error: Could not load theme from '%1' (%2)" LOG(("Theme Error: Could not load theme from '%1' (%2)").arg(
).arg(saved.object.pathRelative saved.object.pathRelative,
).arg(saved.object.pathAbsolute)); saved.object.pathAbsolute));
return false; return false;
} }

View file

@ -611,7 +611,7 @@ void Editor::Inner::applyEditing(const QString &name, const QString &copyOf, QCo
auto plainValue = copyOf.isEmpty() ? ColorHexString(value) : copyOf.toLatin1(); auto plainValue = copyOf.isEmpty() ? ColorHexString(value) : copyOf.toLatin1();
auto newContent = ReplaceValueInPaletteContent(_paletteContent, plainName, plainValue); auto newContent = ReplaceValueInPaletteContent(_paletteContent, plainName, plainValue);
if (newContent == "error") { 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(); error();
return; return;
} }

View file

@ -221,7 +221,7 @@ bool EditorBlock::feedCopy(const QString &name, const QString &copyOf) {
} }
addRow(name, copyOf, row->value()); addRow(name, copyOf, row->value());
} else { } 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; return true;
} }

View file

@ -284,9 +284,9 @@ void ImportFromFile(
name, name,
ColorHexString(color->c)); ColorHexString(color->c));
if (data == "error") { if (data == "error") {
LOG(("Theme Error: could not adjust '%1: %2' in content" LOG(("Theme Error: could not adjust '%1: %2' in content").arg(
).arg(QString::fromLatin1(name) QString::fromLatin1(name),
).arg(QString::fromLatin1(ColorHexString(color->c)))); QString::fromLatin1(ColorHexString(color->c))));
return QByteArray(); return QByteArray();
} }
} }