QString::arg usage optimization

This commit is contained in:
Ilya Fedin 2023-12-22 03:50:42 +04:00 committed by John Preston
parent e6b9a07163
commit 29646707a1
7 changed files with 14 additions and 16 deletions

View file

@ -1092,7 +1092,7 @@ QString TryConvertUrlToLocal(QString url) {
const auto base = u"tg://privatepost?channel="_q + channel;
auto added = QString();
if (const auto threadPostMatch = regex_match(u"^/(\\d+)/(\\d+)(/?\\?|/?$)"_q, privateMatch->captured(2))) {
added = u"&topic=%1&post=%2"_q.arg(threadPostMatch->captured(1)).arg(threadPostMatch->captured(2));
added = u"&topic=%1&post=%2"_q.arg(threadPostMatch->captured(1), threadPostMatch->captured(2));
} else if (const auto postMatch = regex_match(u"^/(\\d+)(/?\\?|/?$)"_q, privateMatch->captured(2))) {
added = u"&post="_q + postMatch->captured(1);
}
@ -1122,7 +1122,7 @@ QString TryConvertUrlToLocal(QString url) {
const auto base = u"tg://resolve?domain="_q + url_encode(usernameMatch->captured(1));
auto added = QString();
if (const auto threadPostMatch = regex_match(u"^/(\\d+)/(\\d+)(/?\\?|/?$)"_q, usernameMatch->captured(2))) {
added = u"&topic=%1&post=%2"_q.arg(threadPostMatch->captured(1)).arg(threadPostMatch->captured(2));
added = u"&topic=%1&post=%2"_q.arg(threadPostMatch->captured(1), threadPostMatch->captured(2));
} else if (const auto postMatch = regex_match(u"^/(\\d+)(/?\\?|/?$)"_q, usernameMatch->captured(2))) {
added = u"&post="_q + postMatch->captured(1);
} else if (const auto storyMatch = regex_match(u"^/s/(\\d+)(/?\\?|/?$)"_q, usernameMatch->captured(2))) {

View file

@ -216,7 +216,7 @@ void Sandbox::setupScreenScale() {
const auto logEnv = [](const char *name) {
const auto value = qEnvironmentVariable(name);
if (!value.isEmpty()) {
LOG(("%1: %2").arg(name).arg(value));
LOG(("%1: %2").arg(name, value));
}
};
logEnv("QT_DEVICE_PIXEL_RATIO");

View file

@ -134,8 +134,9 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
}
DEBUG_LOG(("Video Info: "
"Trying \"%1\" hardware acceleration for \"%2\" decoder."
).arg(av_hwdevice_get_type_name(type)
).arg(context->codec->name));
).arg(
av_hwdevice_get_type_name(type),
context->codec->name));
if (parent->hw_device_ctx) {
av_buffer_unref(&parent->hw_device_ctx);
}

View file

@ -82,8 +82,7 @@ enum class FilterType {
const auto durationString = Ui::FormatDurationText(duration / kPrecision);
const auto decimalPart = duration % kPrecision;
return QString("%1%2%3")
.arg(durationString)
.arg(QLocale().decimalPoint())
.arg(durationString, QLocale().decimalPoint())
.arg(decimalPart);
}

View file

@ -85,8 +85,7 @@ void HttpConnection::connectToServer(
if (Logs::DebugEnabled()) {
_debugId = u"%1(dc:%2,%3)"_q
.arg(_debugId.toInt())
.arg(ProtocolDcDebugId(protocolDcId))
.arg(url().toDisplayString());
.arg(ProtocolDcDebugId(protocolDcId), url().toDisplayString());
}
_pingTime = crl::now();

View file

@ -536,9 +536,10 @@ void TcpConnection::connectToServer(
const auto postfix = _socket->debugPostfix();
_debugId = u"%1(dc:%2,%3%4:%5%6)"_q
.arg(_debugId.toInt())
.arg(ProtocolDcDebugId(_protocolDcId))
.arg((_proxy.type == ProxyData::Type::Mtproto) ? "mtproxy " : "")
.arg(_address)
.arg(
ProtocolDcDebugId(_protocolDcId),
(_proxy.type == ProxyData::Type::Mtproto) ? "mtproxy " : "",
_address)
.arg(_port)
.arg(postfix.isEmpty() ? _protocol->debugPostfix() : postfix);
_socket->setDebugId(_debugId);

View file

@ -985,8 +985,7 @@ void Form::validateCard(
if (error) {
LOG(("Stripe Error %1: %2 (%3)"
).arg(int(error.code())
).arg(error.description()
).arg(error.message()));
).arg(error.description(), error.message()));
_updates.fire(Error{ Error::Type::Stripe, error.description() });
} else {
setPaymentCredentials({
@ -1036,8 +1035,7 @@ void Form::validateCard(
if (error) {
LOG(("SmartGlocal Error %1: %2 (%3)"
).arg(int(error.code())
).arg(error.description()
).arg(error.message()));
).arg(error.description(), error.message()));
_updates.fire(Error{
Error::Type::SmartGlocal,
error.description(),