Replaced some qstr with u""_q literal.

This commit is contained in:
23rd 2022-11-27 00:20:17 +03:00
parent 22dc7023fc
commit 2acedca6b7
99 changed files with 477 additions and 480 deletions

View File

@ -598,7 +598,7 @@ void ChatParticipants::requestSelf(not_null<ChannelData*> channel) {
});
}).fail([=](const MTP::Error &error) {
_selfParticipantRequests.erase(channel);
if (error.type() == qstr("CHANNEL_PRIVATE")) {
if (error.type() == u"CHANNEL_PRIVATE"_q) {
channel->privateErrorReceived();
}
finalize();

View File

@ -23,7 +23,7 @@ MTPVector<MTPDocumentAttribute> ComposeSendingDocumentAttributes(
auto attributes = QVector<MTPDocumentAttribute>(1, filenameAttribute);
if (dimensions.width() > 0 && dimensions.height() > 0) {
const auto duration = document->getDuration();
if (duration >= 0 && !document->hasMimeType(qstr("image/gif"))) {
if (duration >= 0 && !document->hasMimeType(u"image/gif"_q)) {
auto flags = MTPDdocumentAttributeVideo::Flags(0);
using VideoFlag = MTPDdocumentAttributeVideo::Flag;
if (document->isVideoMessage()) {

View File

@ -166,7 +166,7 @@ void SendExistingMedia(
), [=](const MTPUpdates &result, const MTP::Response &response) {
}, [=](const MTP::Error &error, const MTP::Response &response) {
if (error.code() == 400
&& error.type().startsWith(qstr("FILE_REFERENCE_"))) {
&& error.type().startsWith(u"FILE_REFERENCE_"_q)) {
api->refreshFileReference(origin, [=](const auto &result) {
if (media->fileReference() != usedFileReference) {
repeatRequest(repeatRequest);

View File

@ -33,12 +33,12 @@ Key ExtractKey(const QString &query) {
qthelp::UrlParamNameTransform::ToLower)
: QMap<QString, QString>();
};
if (check.startsWith(qstr("tg://privatepost"), Qt::CaseInsensitive)) {
if (check.startsWith(u"tg://privatepost"_q, Qt::CaseInsensitive)) {
const auto params = parse();
const auto channel = params.value("channel");
const auto post = params.value("post").toInt();
return (channel.toULongLong() && post) ? Key{ channel, post } : Key();
} else if (check.startsWith(qstr("tg://resolve"), Qt::CaseInsensitive)) {
} else if (check.startsWith(u"tg://resolve"_q, Qt::CaseInsensitive)) {
const auto params = parse();
const auto domain = params.value("domain");
const auto post = params.value("post").toInt();
@ -220,7 +220,7 @@ QString ConvertPeerSearchQuery(const QString &query) {
const auto trimmed = query.trimmed();
const auto local = Core::TryConvertUrlToLocal(trimmed);
const auto check = local.isEmpty() ? trimmed : local;
if (!check.startsWith(qstr("tg://resolve"), Qt::CaseInsensitive)) {
if (!check.startsWith(u"tg://resolve"_q, Qt::CaseInsensitive)) {
return query;
}
const auto delimeter = check.indexOf('?');

View File

@ -95,7 +95,7 @@ void ProcessScheduledMessageWithElapsedTime(
}
bool IsForceLogoutNotification(const MTPDupdateServiceNotification &data) {
return qs(data.vtype()).startsWith(qstr("AUTH_KEY_DROP_"));
return qs(data.vtype()).startsWith(u"AUTH_KEY_DROP_"_q);
}
bool HasForceLogoutNotification(const MTPUpdates &updates) {

View File

@ -479,12 +479,12 @@ void ApiWrap::sendMessageFail(
FullMsgId itemId) {
const auto show = ShowForPeer(peer);
if (error == qstr("PEER_FLOOD")) {
if (error == u"PEER_FLOOD"_q) {
show->showBox(
Ui::MakeInformBox(
PeerFloodErrorText(&session(), PeerFloodType::Send)),
Ui::LayerOption::CloseOther);
} else if (error == qstr("USER_BANNED_IN_CHANNEL")) {
} else if (error == u"USER_BANNED_IN_CHANNEL"_q) {
const auto link = Ui::Text::Link(
tr::lng_cant_more_info(tr::now),
session().createInternalLinkFull(qsl("spambot")));
@ -496,8 +496,8 @@ void ApiWrap::sendMessageFail(
link,
Ui::Text::WithEntities)),
Ui::LayerOption::CloseOther);
} else if (error.startsWith(qstr("SLOWMODE_WAIT_"))) {
const auto chop = qstr("SLOWMODE_WAIT_").size();
} else if (error.startsWith(u"SLOWMODE_WAIT_"_q)) {
const auto chop = u"SLOWMODE_WAIT_"_q.size();
const auto left = base::StringViewMid(error, chop).toInt();
if (const auto channel = peer->asChannel()) {
const auto seconds = channel->slowmodeSeconds();
@ -508,7 +508,7 @@ void ApiWrap::sendMessageFail(
requestFullPeer(peer);
}
}
} else if (error == qstr("SCHEDULE_STATUS_PRIVATE")) {
} else if (error == u"SCHEDULE_STATUS_PRIVATE"_q) {
auto &scheduled = _session->data().scheduledMessages();
Assert(peer->isUser());
if (const auto item = scheduled.lookupItem(peer->id, itemId.msg)) {
@ -517,7 +517,7 @@ void ApiWrap::sendMessageFail(
Ui::MakeInformBox(tr::lng_cant_do_this()),
Ui::LayerOption::CloseOther);
}
} else if (error == qstr("CHAT_FORWARDS_RESTRICTED")) {
} else if (error == u"CHAT_FORWARDS_RESTRICTED"_q) {
if (show->valid()) {
Ui::ShowMultilineToast({
.parentOverride = show->toastParent(),
@ -528,7 +528,7 @@ void ApiWrap::sendMessageFail(
.duration = kJoinErrorDuration
});
}
} else if (error == qstr("PREMIUM_ACCOUNT_REQUIRED")) {
} else if (error == u"PREMIUM_ACCOUNT_REQUIRED"_q) {
Settings::ShowPremium(&session(), "premium_stickers");
}
if (const auto item = _session->data().message(itemId)) {
@ -3616,7 +3616,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
UnixtimeFromMsgId(response.outerMsgId));
}
}, [=](const MTP::Error &error, const MTP::Response &response) {
if (error.type() == qstr("MESSAGE_EMPTY")) {
if (error.type() == u"MESSAGE_EMPTY"_q) {
lastMessage->destroy();
} else {
sendMessageFail(error, peer, randomId, newId);

View File

@ -64,7 +64,7 @@ AboutBox::AboutBox(QWidget *parent)
}
void AboutBox::prepare() {
setTitle(rpl::single(qsl("Telegram Desktop")));
setTitle(rpl::single(u"Telegram Desktop"_q));
addButton(tr::lng_close(), [this] { closeBox(); });
@ -94,19 +94,19 @@ void AboutBox::resizeEvent(QResizeEvent *e) {
void AboutBox::showVersionHistory() {
if (cRealAlphaVersion()) {
auto url = qsl("https://tdesktop.com/");
auto url = u"https://tdesktop.com/"_q;
if (Platform::IsWindows32Bit()) {
url += qsl("win/%1.zip");
url += u"win/%1.zip"_q;
} else if (Platform::IsWindows64Bit()) {
url += qsl("win64/%1.zip");
url += u"win64/%1.zip"_q;
} else if (Platform::IsMac()) {
url += qsl("mac/%1.zip");
url += u"mac/%1.zip"_q;
} else if (Platform::IsLinux()) {
url += qsl("linux/%1.tar.xz");
url += u"linux/%1.tar.xz"_q;
} else {
Unexpected("Platform value.");
}
url = url.arg(qsl("talpha%1_%2").arg(cRealAlphaVersion()).arg(Core::countAlphaVersionSignature(cRealAlphaVersion())));
url = url.arg(u"talpha%1_%2"_q.arg(cRealAlphaVersion()).arg(Core::countAlphaVersionSignature(cRealAlphaVersion())));
QGuiApplication::clipboard()->setText(url);
@ -129,7 +129,7 @@ void AboutBox::keyPressEvent(QKeyEvent *e) {
}
QString telegramFaqLink() {
const auto result = qsl("https://telegram.org/faq");
const auto result = u"https://telegram.org/faq"_q;
const auto langpacked = [&](const char *language) {
return result + '/' + language;
};
@ -139,7 +139,7 @@ QString telegramFaqLink() {
return langpacked(language);
}
}
if (current.startsWith(qstr("pt-br"))) {
if (current.startsWith(u"pt-br"_q)) {
return langpacked("br");
}
return result;
@ -148,7 +148,7 @@ QString telegramFaqLink() {
QString currentVersionText() {
auto result = QString::fromLatin1(AppVersionStr);
if (cAlphaVersion()) {
result += qsl(" alpha %1").arg(cAlphaVersion() % 1000);
result += u" alpha %1"_q.arg(cAlphaVersion() % 1000);
} else if (AppBetaVersion) {
result += " beta";
}

View File

@ -270,11 +270,11 @@ void ChangePhone::EnterPhone::sendPhoneFail(
const QString &phoneNumber) {
if (MTP::IsFloodError(error)) {
showError(tr::lng_flood_error(tr::now));
} else if (error.type() == qstr("PHONE_NUMBER_INVALID")) {
} else if (error.type() == u"PHONE_NUMBER_INVALID"_q) {
showError(tr::lng_bad_phone(tr::now));
} else if (error.type() == qstr("PHONE_NUMBER_BANNED")) {
} else if (error.type() == u"PHONE_NUMBER_BANNED"_q) {
Ui::ShowPhoneBannedError(&_controller->window(), phoneNumber);
} else if (error.type() == qstr("PHONE_NUMBER_OCCUPIED")) {
} else if (error.type() == u"PHONE_NUMBER_OCCUPIED"_q) {
_controller->show(
Ui::MakeInformBox(
tr::lng_change_phone_occupied(
@ -428,13 +428,13 @@ void ChangePhone::EnterCode::showError(const QString &text) {
void ChangePhone::EnterCode::sendCodeFail(const MTP::Error &error) {
if (MTP::IsFloodError(error)) {
showError(tr::lng_flood_error(tr::now));
} else if (error.type() == qstr("PHONE_CODE_EMPTY")
|| error.type() == qstr("PHONE_CODE_INVALID")) {
} else if (error.type() == u"PHONE_CODE_EMPTY"_q
|| error.type() == u"PHONE_CODE_INVALID"_q) {
showError(tr::lng_bad_code(tr::now));
} else if (error.type() == qstr("PHONE_CODE_EXPIRED")
|| error.type() == qstr("PHONE_NUMBER_BANNED")) {
} else if (error.type() == u"PHONE_CODE_EXPIRED"_q
|| error.type() == u"PHONE_NUMBER_BANNED"_q) {
closeBox(); // Go back to phone input.
} else if (error.type() == qstr("PHONE_NUMBER_INVALID")) {
} else if (error.type() == u"PHONE_NUMBER_INVALID"_q) {
showError(tr::lng_bad_phone(tr::now));
} else {
showError(Lang::Hard::ServerError());

View File

@ -79,7 +79,7 @@ DeleteMessagesBox::DeleteMessagesBox(
void DeleteMessagesBox::prepare() {
auto details = TextWithEntities();
const auto appendDetails = [&](TextWithEntities &&text) {
details.append(qstr("\n\n")).append(std::move(text));
details.append(u"\n\n"_q).append(std::move(text));
};
auto deleteText = lifetime().make_state<rpl::variable<QString>>();
*deleteText = tr::lng_box_delete();

View File

@ -91,7 +91,7 @@ void DownloadPathBox::radioChanged(Directory value) {
void DownloadPathBox::editPath() {
const auto initialPath = [] {
const auto path = Core::App().settings().downloadPath();
if (!path.isEmpty() && path != qstr("tmp")) {
if (!path.isEmpty() && path != u"tmp"_q) {
return path.left(path.size() - (path.endsWith('/') ? 1 : 0));
}
return QString();

View File

@ -495,19 +495,19 @@ void PasscodeBox::setPasswordFail(const QString &type) {
closeReplacedBy();
_setRequest = 0;
if (type == qstr("PASSWORD_HASH_INVALID")
|| type == qstr("SRP_PASSWORD_CHANGED")) {
if (type == u"PASSWORD_HASH_INVALID"_q
|| type == u"SRP_PASSWORD_CHANGED"_q) {
if (_oldPasscode->isHidden()) {
_passwordReloadNeeded.fire({});
closeBox();
} else {
badOldPasscode();
}
} else if (type == qstr("SRP_ID_INVALID")) {
} else if (type == u"SRP_ID_INVALID"_q) {
handleSrpIdInvalid();
//} else if (type == qstr("NEW_PASSWORD_BAD")) {
//} else if (type == qstr("NEW_SALT_INVALID")) {
} else if (type == qstr("EMAIL_INVALID")) {
//} else if (type == u"NEW_PASSWORD_BAD"_q) {
//} else if (type == u"NEW_SALT_INVALID"_q) {
} else if (type == u"EMAIL_INVALID"_q) {
_emailError = tr::lng_cloud_password_bad_email(tr::now);
_recoverEmail->setFocus();
_recoverEmail->showError();
@ -519,7 +519,7 @@ void PasscodeBox::setPasswordFail(
const QByteArray &newPasswordBytes,
const QString &email,
const MTP::Error &error) {
const auto prefix = qstr("EMAIL_UNCONFIRMED_");
const auto prefix = u"EMAIL_UNCONFIRMED_"_q;
if (error.type().startsWith(prefix)) {
const auto codeLength = base::StringViewMid(error.type(), prefix.size()).toInt();
@ -552,9 +552,9 @@ void PasscodeBox::validateEmail(
_setRequest = 0;
if (MTP::IsFloodError(error)) {
errors->fire(tr::lng_flood_error(tr::now));
} else if (error.type() == qstr("CODE_INVALID")) {
} else if (error.type() == u"CODE_INVALID"_q) {
errors->fire(tr::lng_signin_wrong_code(tr::now));
} else if (error.type() == qstr("EMAIL_HASH_EXPIRED")) {
} else if (error.type() == u"EMAIL_HASH_EXPIRED"_q) {
const auto weak = Ui::MakeWeak(this);
_clearUnconfirmedPassword.fire({});
if (weak) {
@ -801,9 +801,9 @@ bool PasscodeBox::handleCustomCheckError(const MTP::Error &error) {
bool PasscodeBox::handleCustomCheckError(const QString &type) {
if (MTP::IsFloodError(type)
|| type == qstr("PASSWORD_HASH_INVALID")
|| type == qstr("SRP_PASSWORD_CHANGED")
|| type == qstr("SRP_ID_INVALID")) {
|| type == u"PASSWORD_HASH_INVALID"_q
|| type == u"SRP_PASSWORD_CHANGED"_q
|| type == u"SRP_ID_INVALID"_q) {
setPasswordFail(type);
return true;
}
@ -979,7 +979,7 @@ void PasscodeBox::resetSecret(
});
}).fail([=](const MTP::Error &error) {
_setRequest = 0;
if (error.type() == qstr("SRP_ID_INVALID")) {
if (error.type() == u"SRP_ID_INVALID"_q) {
handleSrpIdInvalid();
}
}).send();
@ -1330,17 +1330,17 @@ void RecoverBox::checkSubmitFail(const MTP::Error &error) {
_submitRequest = 0;
const QString &err = error.type();
if (err == qstr("PASSWORD_EMPTY")) {
if (err == u"PASSWORD_EMPTY"_q) {
_newPasswordSet.fire(QByteArray());
getDelegate()->show(
Ui::MakeInformBox(tr::lng_cloud_password_removed()),
Ui::LayerOption::CloseOther);
} else if (err == qstr("PASSWORD_RECOVERY_NA")) {
} else if (err == u"PASSWORD_RECOVERY_NA"_q) {
closeBox();
} else if (err == qstr("PASSWORD_RECOVERY_EXPIRED")) {
} else if (err == u"PASSWORD_RECOVERY_EXPIRED"_q) {
_recoveryExpired.fire({});
closeBox();
} else if (err == qstr("CODE_INVALID")) {
} else if (err == u"CODE_INVALID"_q) {
setError(tr::lng_signin_wrong_code(tr::now));
_recoverCode->selectAll();
_recoverCode->setFocus();
@ -1381,9 +1381,9 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
*requestId = 0;
if (MTP::IsFloodError(error)) {
errors->fire(tr::lng_flood_error(tr::now));
} else if (error.type() == qstr("CODE_INVALID")) {
} else if (error.type() == u"CODE_INVALID"_q) {
errors->fire(tr::lng_signin_wrong_code(tr::now));
} else if (error.type() == qstr("EMAIL_HASH_EXPIRED")) {
} else if (error.type() == u"EMAIL_HASH_EXPIRED"_q) {
cancels->fire({});
if (*weak) {
auto box = Ui::MakeInformBox(

View File

@ -647,15 +647,15 @@ void EditAdminBox::sendTransferRequestFrom(
const auto &type = error.type();
const auto problem = [&] {
if (type == qstr("CHANNELS_ADMIN_PUBLIC_TOO_MUCH")) {
if (type == u"CHANNELS_ADMIN_PUBLIC_TOO_MUCH"_q) {
return tr::lng_channels_too_much_public_other(tr::now);
} else if (type == qstr("CHANNELS_ADMIN_LOCATED_TOO_MUCH")) {
} else if (type == u"CHANNELS_ADMIN_LOCATED_TOO_MUCH"_q) {
return tr::lng_channels_too_much_located_other(tr::now);
} else if (type == qstr("ADMINS_TOO_MUCH")) {
} else if (type == u"ADMINS_TOO_MUCH"_q) {
return (channel->isBroadcast()
? tr::lng_error_admin_limit_channel
: tr::lng_error_admin_limit)(tr::now);
} else if (type == qstr("CHANNEL_INVALID")) {
} else if (type == u"CHANNEL_INVALID"_q) {
return (channel->isBroadcast()
? tr::lng_channel_not_accessible
: tr::lng_group_not_accessible)(tr::now);
@ -663,9 +663,9 @@ void EditAdminBox::sendTransferRequestFrom(
return Lang::Hard::ServerError();
}();
const auto recoverable = [&] {
return (type == qstr("PASSWORD_MISSING"))
|| (type == qstr("PASSWORD_TOO_FRESH_XXX"))
|| (type == qstr("SESSION_TOO_FRESH_XXX"));
return (type == u"PASSWORD_MISSING"_q)
|| (type == u"PASSWORD_TOO_FRESH_XXX"_q)
|| (type == u"SESSION_TOO_FRESH_XXX"_q);
}();
const auto weak = Ui::MakeWeak(this);
getDelegate()->show(Ui::MakeInformBox(problem));

View File

@ -112,7 +112,7 @@ void SaveChatAdmin(
const auto &type = error.type();
if (retryOnNotParticipant
&& isAdmin
&& (type == qstr("USER_NOT_PARTICIPANT"))) {
&& (type == u"USER_NOT_PARTICIPANT"_q)) {
AddChatParticipant(chat, user, [=] {
SaveChatAdmin(chat, user, isAdmin, onDone, onFail, false);
}, onFail);

View File

@ -154,7 +154,7 @@ void SaveDefaultRestrictions(
done();
}).fail([=](const MTP::Error &error) {
api->clearModifyRequest(key);
if (error.type() != qstr("CHAT_NOT_MODIFIED")) {
if (error.type() != u"CHAT_NOT_MODIFIED"_q) {
return;
}
if (const auto chat = peer->asChat()) {
@ -187,7 +187,7 @@ void SaveSlowmodeSeconds(
done();
}).fail([=](const MTP::Error &error) {
api->clearModifyRequest(key);
if (error.type() != qstr("CHAT_NOT_MODIFIED")) {
if (error.type() != u"CHAT_NOT_MODIFIED"_q) {
return;
}
channel->setSlowmodeSeconds(seconds);
@ -1568,7 +1568,7 @@ void Controller::saveUsername() {
continueSave();
}).fail([=](const MTP::Error &error) {
const auto &type = error.type();
if (type == qstr("USERNAME_NOT_MODIFIED")) {
if (type == u"USERNAME_NOT_MODIFIED"_q) {
channel->setName(
TextUtilities::SingleLine(channel->name()),
TextUtilities::SingleLine(*_savingData.username));
@ -1578,10 +1578,10 @@ void Controller::saveUsername() {
// Very rare case.
showEditPeerTypeBox([&] {
if (type == qstr("USERNAME_INVALID")) {
if (type == u"USERNAME_INVALID"_q) {
return tr::lng_create_channel_link_invalid();
} else if (type == qstr("USERNAME_OCCUPIED")
|| type == qstr("USERNAMES_UNAVAILABLE")) {
} else if (type == u"USERNAME_OCCUPIED"_q
|| type == u"USERNAMES_UNAVAILABLE"_q) {
return tr::lng_create_channel_link_occupied();
}
return tr::lng_create_channel_link_invalid();
@ -1635,8 +1635,8 @@ void Controller::saveTitle() {
};
const auto onFail = [=](const MTP::Error &error) {
const auto &type = error.type();
if (type == qstr("CHAT_NOT_MODIFIED")
|| type == qstr("CHAT_TITLE_NOT_MODIFIED")) {
if (type == u"CHAT_NOT_MODIFIED"_q
|| type == u"CHAT_TITLE_NOT_MODIFIED"_q) {
if (const auto channel = _peer->asChannel()) {
channel->setName(
*_savingData.title,
@ -1648,7 +1648,7 @@ void Controller::saveTitle() {
return;
}
_controls.title->showError();
if (type == qstr("NO_CHAT_TITLE")) {
if (type == u"NO_CHAT_TITLE"_q) {
_box->scrollToWidget(_controls.title);
}
cancelSave();
@ -1689,7 +1689,7 @@ void Controller::saveDescription() {
successCallback();
}).fail([=](const MTP::Error &error) {
const auto &type = error.type();
if (type == qstr("CHAT_ABOUT_NOT_MODIFIED")) {
if (type == u"CHAT_ABOUT_NOT_MODIFIED"_q) {
successCallback();
return;
}
@ -1746,7 +1746,7 @@ void Controller::togglePreHistoryHidden(
channel->session().api().applyUpdates(result);
apply();
}).fail([=](const MTP::Error &error) {
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
apply();
} else {
fail();
@ -1779,7 +1779,7 @@ void Controller::saveForum() {
channel->session().api().applyUpdates(result);
continueSave();
}).fail([=](const MTP::Error &error) {
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
continueSave();
} else {
cancelSave();
@ -1801,7 +1801,7 @@ void Controller::saveSignatures() {
channel->session().api().applyUpdates(result);
continueSave();
}).fail([=](const MTP::Error &error) {
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
continueSave();
} else {
cancelSave();
@ -1821,7 +1821,7 @@ void Controller::saveForwards() {
_peer->session().api().applyUpdates(result);
continueSave();
}).fail([=](const MTP::Error &error) {
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
continueSave();
} else {
cancelSave();
@ -1843,7 +1843,7 @@ void Controller::saveJoinToWrite() {
_peer->session().api().applyUpdates(result);
continueSave();
}).fail([=](const MTP::Error &error) {
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
continueSave();
} else {
cancelSave();
@ -1865,7 +1865,7 @@ void Controller::saveRequestToJoin() {
_peer->session().api().applyUpdates(result);
continueSave();
}).fail([=](const MTP::Error &error) {
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
if (error.type() == u"CHAT_NOT_MODIFIED"_q) {
continueSave();
} else {
cancelSave();
@ -1921,7 +1921,7 @@ void Controller::deleteChannel() {
)).done([=](const MTPUpdates &result) {
session->api().applyUpdates(result);
//}).fail([=](const MTP::Error &error) {
// if (error.type() == qstr("CHANNEL_TOO_LARGE")) {
// if (error.type() == u"CHANNEL_TOO_LARGE"_q) {
// Ui::show(Box<Ui::InformBox>(tr::lng_cant_delete_channel(tr::now)));
// }
}).send();

View File

@ -409,7 +409,7 @@ void Controller::addHeaderBlock(not_null<Ui::VerticalLayout*> container) {
return result;
};
const auto prefix = qstr("https://");
const auto prefix = u"https://"_q;
const auto label = container->lifetime().make_state<Ui::InviteLinkLabel>(
container,
rpl::single(link.startsWith(prefix)
@ -982,7 +982,7 @@ void AddPermanentLinkBlock(
auto link = value->value(
) | rpl::map([=](const LinkData &data) {
const auto prefix = qstr("https://");
const auto prefix = u"https://"_q;
return data.link.startsWith(prefix)
? data.link.mid(prefix.size())
: data.link;

View File

@ -312,13 +312,13 @@ QString Row::generateName() {
}
auto result = _data.link;
return result.replace(
qstr("https://"),
u"https://"_q,
QString()
).replace(
qstr("t.me/+"),
u"t.me/+"_q,
QString()
).replace(
qstr("t.me/joinchat/"),
u"t.me/joinchat/"_q,
QString()
);
}

View File

@ -282,7 +282,7 @@ void SaveAllowedReactions(
Unexpected("Invalid peer type in SaveAllowedReactions.");
}
}).fail([=](const MTP::Error &error) {
if (error.type() == qstr("REACTION_INVALID")) {
if (error.type() == u"REACTION_INVALID"_q) {
peer->updateFullForced();
peer->owner().reactions().refreshDefault();
}

View File

@ -538,7 +538,7 @@ void Controller::checkUsernameAvailability() {
}
const auto initial = (_controls.privacy->value() != Privacy::HasUsername);
const auto checking = initial
? qsl(".bad.")
? u".bad."_q
: getUsernameInput();
if (checking.size() < Ui::EditPeer::kMinUsernameLength) {
return;
@ -565,10 +565,10 @@ void Controller::checkUsernameAvailability() {
_checkUsernameRequestId = 0;
const auto &type = error.type();
_usernameState = UsernameState::Normal;
if (type == qstr("CHANNEL_PUBLIC_GROUP_NA")) {
if (type == u"CHANNEL_PUBLIC_GROUP_NA"_q) {
_usernameState = UsernameState::NotAvailable;
_controls.privacy->setValue(Privacy::NoUsername);
} else if (type == qstr("CHANNELS_ADMIN_PUBLIC_TOO_MUCH")) {
} else if (type == u"CHANNELS_ADMIN_PUBLIC_TOO_MUCH"_q) {
_usernameState = UsernameState::TooMany;
if (_controls.privacy->value() == Privacy::HasUsername) {
askUsernameRevoke();
@ -578,10 +578,9 @@ void Controller::checkUsernameAvailability() {
_controls.usernameResult = nullptr;
setFocusUsername();
}
} else if (type == qstr("USERNAME_INVALID")) {
} else if (type == u"USERNAME_INVALID"_q) {
showUsernameError(tr::lng_create_channel_link_invalid());
} else if (type == qstr("USERNAME_OCCUPIED")
&& checking != username) {
} else if (type == u"USERNAME_OCCUPIED"_q && checking != username) {
showUsernameError(tr::lng_create_channel_link_occupied());
}
}).send();

View File

@ -1993,15 +1993,15 @@ void StickersBox::Inner::AddressField::correctValue(
auto newText = now;
auto newCursor = nowCursor;
auto removeFromBeginning = {
qstr("http://"),
qstr("https://"),
qstr("www.t.me/"),
qstr("www.telegram.me/"),
qstr("www.telegram.dog/"),
qstr("t.me/"),
qstr("telegram.me/"),
qstr("telegram.dog/"),
qstr("addstickers/"),
u"http://"_q,
u"https://"_q,
u"www.t.me/"_q,
u"www.telegram.me/"_q,
u"www.telegram.dog/"_q,
u"t.me/"_q,
u"telegram.me/"_q,
u"telegram.dog/"_q,
u"addstickers/"_q,
};
for (auto &removePhrase : removeFromBeginning) {
if (newText.startsWith(removePhrase)) {

View File

@ -93,7 +93,7 @@ UsernameEditor::UsernameEditor(
, _username(
this,
st::defaultInputField,
rpl::single(qsl("@username")),
rpl::single(u"@username"_q),
session->user()->editableUsername(),
QString())
, _checkTimer([=] { check(); }) {
@ -260,7 +260,7 @@ void UsernameEditor::checkInfoPurchaseAvailable() {
void UsernameEditor::updateFail(const QString &error) {
const auto self = _session->user();
if ((error == qstr("USERNAME_NOT_MODIFIED"))
if ((error == u"USERNAME_NOT_MODIFIED"_q)
|| (_sentUsername == self->editableUsername())) {
self->setName(
TextUtilities::SingleLine(self->firstName),
@ -268,18 +268,18 @@ void UsernameEditor::updateFail(const QString &error) {
TextUtilities::SingleLine(self->nameOrPhone),
TextUtilities::SingleLine(_sentUsername));
_saved.fire_done();
} else if (error == qstr("USERNAME_INVALID")) {
} else if (error == u"USERNAME_INVALID"_q) {
_username->setFocus();
_username->showError();
_errorText = tr::lng_username_invalid(tr::now);
checkInfoChange();
} else if ((error == qstr("USERNAME_OCCUPIED"))
|| (error == qstr("USERNAMES_UNAVAILABLE"))) {
} else if ((error == u"USERNAME_OCCUPIED"_q)
|| (error == u"USERNAMES_UNAVAILABLE"_q)) {
_username->setFocus();
_username->showError();
_errorText = tr::lng_username_occupied(tr::now);
checkInfoChange();
} else if (error == qstr("USERNAME_PURCHASE_AVAILABLE")) {
} else if (error == u"USERNAME_PURCHASE_AVAILABLE"_q) {
checkInfoPurchaseAvailable();
} else {
_username->setFocus();
@ -287,14 +287,14 @@ void UsernameEditor::updateFail(const QString &error) {
}
void UsernameEditor::checkFail(const QString &error) {
if (error == qstr("USERNAME_INVALID")) {
if (error == u"USERNAME_INVALID"_q) {
_errorText = tr::lng_username_invalid(tr::now);
checkInfoChange();
} else if ((error == qstr("USERNAME_OCCUPIED"))
} else if ((error == u"USERNAME_OCCUPIED"_q)
&& (_checkUsername != _session->user()->editableUsername())) {
_errorText = tr::lng_username_occupied(tr::now);
checkInfoChange();
} else if (error == qstr("USERNAME_PURCHASE_AVAILABLE")) {
} else if (error == u"USERNAME_PURCHASE_AVAILABLE"_q) {
checkInfoPurchaseAvailable();
} else {
_goodText = QString();

View File

@ -55,19 +55,19 @@ struct LangPackData {
const QString &word) {
if ((word.size() == 1) && !word[0].isLetter()) {
return true;
} else if (word == qstr("10")) {
} else if (word == u"10"_q) {
return true;
} else if (language != qstr("en")) {
} else if (language != u"en"_q) {
return false;
} else if ((word.size() == 1)
&& (word[0] != '$')
&& (word[0].unicode() != 8364)) { // Euro.
return true;
} else if ((word.size() == 2)
&& (word != qstr("us"))
&& (word != qstr("uk"))
&& (word != qstr("hi"))
&& (word != qstr("ok"))) {
&& (word != u"us"_q)
&& (word != u"uk"_q)
&& (word != u"hi"_q)
&& (word != u"ok"_q)) {
return true;
}
return false;
@ -80,7 +80,7 @@ struct LangPackData {
}
void CreateCacheFilePath() {
QDir().mkpath(internal::CacheFileFolder() + qstr("/keywords"));
QDir().mkpath(internal::CacheFileFolder() + u"/keywords"_q);
}
[[nodiscard]] QString CacheFilePath(QString id) {
@ -89,7 +89,7 @@ void CreateCacheFilePath() {
if (id.isEmpty()) {
return QString();
}
return internal::CacheFileFolder() + qstr("/keywords/") + id;
return internal::CacheFileFolder() + u"/keywords/"_q + id;
}
[[nodiscard]] LangPackData ReadLocalCache(const QString &id) {

View File

@ -153,9 +153,8 @@ QString StateDescription(const SetState &state) {
}
bool GoodSetPartName(const QString &name) {
return (name == qstr("config.json"))
|| (name.startsWith(qstr("emoji_"))
&& name.endsWith(qstr(".webp")));
return (name == u"config.json"_q)
|| (name.startsWith(u"emoji_"_q) && name.endsWith(u".webp"_q));
}
bool UnpackSet(const QString &path, const QString &folder) {

View File

@ -435,7 +435,7 @@ InlineBotQuery ParseInlineBotQuery(
auto inlineUsernameEqualsText = (inlineUsernameEnd == textLength);
auto validInlineUsername = false;
if (inlineUsernameEqualsText) {
validInlineUsername = text.endsWith(qstr("bot"));
validInlineUsername = text.endsWith(u"bot"_q);
} else if (inlineUsernameEnd < textLength && inlineUsernameLength) {
validInlineUsername = text[inlineUsernameEnd].isSpace();
}

View File

@ -570,7 +570,7 @@ bool Application::eventFilter(QObject *object, QEvent *e) {
const auto event = static_cast<QFileOpenEvent*>(e);
const auto url = QString::fromUtf8(
event->url().toEncoded().trimmed());
if (url.startsWith(qstr("tg://"), Qt::CaseInsensitive)) {
if (url.startsWith(u"tg://"_q, Qt::CaseInsensitive)) {
cSetStartUrl(url.mid(0, 8192));
checkStartUrl();
}

View File

@ -77,17 +77,17 @@ bool UrlRequiresConfirmation(const QUrl &url) {
}
QString HiddenUrlClickHandler::copyToClipboardText() const {
return url().startsWith(qstr("internal:url:"))
? url().mid(qstr("internal:url:").size())
return url().startsWith(u"internal:url:"_q)
? url().mid(u"internal:url:"_q.size())
: url();
}
QString HiddenUrlClickHandler::copyToClipboardContextItemText() const {
return url().isEmpty()
? QString()
: !url().startsWith(qstr("internal:"))
: !url().startsWith(u"internal:"_q)
? UrlClickHandler::copyToClipboardContextItemText()
: url().startsWith(qstr("internal:url:"))
: url().startsWith(u"internal:url:"_q)
? UrlClickHandler::copyToClipboardContextItemText()
: QString();
}
@ -105,8 +105,8 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) {
const auto open = [=] {
UrlClickHandler::Open(url, context);
};
if (url.startsWith(qstr("tg://"), Qt::CaseInsensitive)
|| url.startsWith(qstr("internal:"), Qt::CaseInsensitive)) {
if (url.startsWith(u"tg://"_q, Qt::CaseInsensitive)
|| url.startsWith(u"internal:"_q, Qt::CaseInsensitive)) {
open();
} else {
const auto parsedUrl = QUrl::fromUserInput(url);
@ -158,7 +158,7 @@ void BotGameUrlClickHandler::onClick(ClickContext context) const {
const auto open = [=] {
UrlClickHandler::Open(url, context.other);
};
if (url.startsWith(qstr("tg://"), Qt::CaseInsensitive)) {
if (url.startsWith(u"tg://"_q, Qt::CaseInsensitive)) {
open();
} else if (!_bot
|| _bot->isVerified()

View File

@ -210,7 +210,7 @@ void UnsafeOpenUrlDefault(const QString &url) {
}
void UnsafeOpenEmailLinkDefault(const QString &email) {
auto url = QUrl(qstr("mailto:") + email);
auto url = QUrl(u"mailto:"_q + email);
QDesktopServices::openUrl(url);
}

View File

@ -228,7 +228,7 @@ bool CheckPortableVersionFolder() {
Assert(*AlphaPrivateKey != 0);
cForceWorkingDir(portable + '/');
QDir().mkpath(cWorkingDir() + qstr("tdata"));
QDir().mkpath(cWorkingDir() + u"tdata"_q);
cSetAlphaPrivateKey(QByteArray(AlphaPrivateKey));
if (!key.open(QIODevice::WriteOnly)) {
LOG(("FATAL: Could not open '%1' for writing private key!"

View File

@ -57,18 +57,18 @@ QString MimeType::name() const {
}
MimeType MimeTypeForName(const QString &mime) {
if (mime == qstr("image/webp")) {
if (mime == u"image/webp"_q) {
return MimeType(MimeType::Known::WebP);
} else if (mime == qstr("application/x-tgsticker")) {
} else if (mime == u"application/x-tgsticker"_q) {
return MimeType(MimeType::Known::Tgs);
} else if (mime == qstr("application/x-tgwallpattern")) {
} else if (mime == u"application/x-tgwallpattern"_q) {
return MimeType(MimeType::Known::Tgv);
} else if (mime == qstr("application/x-tdesktop-theme")
|| mime == qstr("application/x-tgtheme-tdesktop")) {
} else if (mime == u"application/x-tdesktop-theme"_q
|| mime == u"application/x-tgtheme-tdesktop"_q) {
return MimeType(MimeType::Known::TDesktopTheme);
} else if (mime == qstr("application/x-tdesktop-palette")) {
} else if (mime == u"application/x-tdesktop-palette"_q) {
return MimeType(MimeType::Known::TDesktopPalette);
} else if (mime == qstr("audio/mpeg3")) {
} else if (mime == u"audio/mpeg3"_q) {
return MimeType(QMimeDatabase().mimeTypeForName("audio/mp3"));
}
return MimeType(QMimeDatabase().mimeTypeForName(mime));
@ -76,15 +76,15 @@ MimeType MimeTypeForName(const QString &mime) {
MimeType MimeTypeForFile(const QFileInfo &file) {
QString path = file.absoluteFilePath();
if (path.endsWith(qstr(".webp"), Qt::CaseInsensitive)) {
if (path.endsWith(u".webp"_q, Qt::CaseInsensitive)) {
return MimeType(MimeType::Known::WebP);
} else if (path.endsWith(qstr(".tgs"), Qt::CaseInsensitive)) {
} else if (path.endsWith(u".tgs"_q, Qt::CaseInsensitive)) {
return MimeType(MimeType::Known::Tgs);
} else if (path.endsWith(qstr(".tgv"))) {
} else if (path.endsWith(u".tgv"_q)) {
return MimeType(MimeType::Known::Tgv);
} else if (path.endsWith(qstr(".tdesktop-theme"), Qt::CaseInsensitive)) {
} else if (path.endsWith(u".tdesktop-theme"_q, Qt::CaseInsensitive)) {
return MimeType(MimeType::Known::TDesktopTheme);
} else if (path.endsWith(qstr(".tdesktop-palette"), Qt::CaseInsensitive)) {
} else if (path.endsWith(u".tdesktop-palette"_q, Qt::CaseInsensitive)) {
return MimeType(MimeType::Known::TDesktopPalette);
}
@ -138,18 +138,18 @@ bool IsMimeAcceptedForPhotoVideoAlbum(const QString &mime) {
bool FileIsImage(const QString &name, const QString &mime) {
QString lowermime = mime.toLower(), namelower = name.toLower();
if (lowermime.startsWith(qstr("image/"))) {
if (lowermime.startsWith(u"image/"_q)) {
return true;
} else if (namelower.endsWith(qstr(".bmp"))
|| namelower.endsWith(qstr(".jpg"))
|| namelower.endsWith(qstr(".jpeg"))
|| namelower.endsWith(qstr(".gif"))
|| namelower.endsWith(qstr(".webp"))
|| namelower.endsWith(qstr(".tga"))
|| namelower.endsWith(qstr(".tiff"))
|| namelower.endsWith(qstr(".tif"))
|| namelower.endsWith(qstr(".psd"))
|| namelower.endsWith(qstr(".png"))) {
} else if (namelower.endsWith(u".bmp"_q)
|| namelower.endsWith(u".jpg"_q)
|| namelower.endsWith(u".jpeg"_q)
|| namelower.endsWith(u".gif"_q)
|| namelower.endsWith(u".webp"_q)
|| namelower.endsWith(u".tga"_q)
|| namelower.endsWith(u".tiff"_q)
|| namelower.endsWith(u".tif"_q)
|| namelower.endsWith(u".psd"_q)
|| namelower.endsWith(u".png"_q)) {
return true;
}
return false;

View File

@ -226,10 +226,10 @@ bool UiIntegration::handleUrlClick(
if (UrlClickHandler::IsEmail(url)) {
File::OpenEmailLink(url);
return true;
} else if (local.startsWith(qstr("tg://"), Qt::CaseInsensitive)) {
} else if (local.startsWith(u"tg://"_q, Qt::CaseInsensitive)) {
Core::App().openLocalUrl(local, context);
return true;
} else if (local.startsWith(qstr("internal:"), Qt::CaseInsensitive)) {
} else if (local.startsWith(u"internal:"_q, Qt::CaseInsensitive)) {
Core::App().openInternalUrl(local, context);
return true;
}

View File

@ -221,7 +221,7 @@ void CloudThemes::resolve(
)).done([=](const MTPTheme &result) {
showPreview(controller, result);
}).fail([=](const MTP::Error &error) {
if (error.type() == qstr("THEME_FORMAT_INVALID")) {
if (error.type() == u"THEME_FORMAT_INVALID"_q) {
controller->show(Ui::MakeInformBox(tr::lng_theme_no_desktop()));
}
}).send();

View File

@ -201,7 +201,7 @@ QString FileNameForSave(
dir);
#ifdef Q_OS_WIN
const auto lower = result.trimmed().toLower();
const auto kBadExtensions = { qstr(".lnk"), qstr(".scf") };
const auto kBadExtensions = { u".lnk"_q, u".scf"_q };
const auto kMaskExtension = qsl(".download");
for (const auto extension : kBadExtensions) {
if (lower.endsWith(extension)) {
@ -227,7 +227,7 @@ QString DocumentFileNameForSave(
QStringList p = mimeType.globPatterns();
QString pattern = p.isEmpty() ? QString() : p.front();
if (data->isVoiceMessage()) {
auto mp3 = data->hasMimeType(qstr("audio/mp3"));
auto mp3 = data->hasMimeType(u"audio/mp3"_q);
name = already.isEmpty() ? (mp3 ? qsl(".mp3") : qsl(".ogg")) : already;
filter = mp3 ? qsl("MP3 Audio (*.mp3);;") : qsl("OGG Opus Audio (*.ogg);;");
filter += FileDialog::AllFilesFilter();
@ -430,7 +430,7 @@ void DocumentData::setattributes(
type = FileDocument;
_additional = nullptr;
} else if (type == FileDocument
&& hasMimeType(qstr("video/webm"))
&& hasMimeType(u"video/webm"_q)
&& (size < Storage::kMaxStickerBytesSize)
&& GoodStickerDimensions(dimensions.width(), dimensions.height())) {
type = StickerDocument;
@ -444,7 +444,7 @@ void DocumentData::setattributes(
void DocumentData::validateLottieSticker() {
if (type == FileDocument
&& hasMimeType(qstr("application/x-tgsticker"))) {
&& hasMimeType(u"application/x-tgsticker"_q)) {
type = StickerDocument;
_additional = std::make_unique<StickerData>();
sticker()->type = StickerType::Tgs;
@ -532,11 +532,11 @@ bool DocumentData::isPatternWallPaper() const {
}
bool DocumentData::isPatternWallPaperPNG() const {
return isWallPaper() && hasMimeType(qstr("image/png"));
return isWallPaper() && hasMimeType(u"image/png"_q);
}
bool DocumentData::isPatternWallPaperSVG() const {
return isWallPaper() && hasMimeType(qstr("application/x-tgwallpattern"));
return isWallPaper() && hasMimeType(u"application/x-tgwallpattern"_q);
}
bool DocumentData::isPremiumSticker() const {
@ -736,7 +736,7 @@ bool DocumentData::saveToCache() const {
|| isVoiceMessage()
|| isWallPaper()
|| isTheme()
|| (hasMimeType(qstr("image/png"))
|| (hasMimeType(u"image/png"_q)
&& _filename.startsWith("image_")));
}
@ -1157,7 +1157,7 @@ void DocumentData::refreshPossibleCoverThumbnail() {
if (songData->performer.isEmpty()
|| songData->title.isEmpty()
// Ignore cover for voice chat records.
|| hasMimeType(qstr("audio/ogg"))) {
|| hasMimeType(u"audio/ogg"_q)) {
return;
}
const auto size = kDefaultCoverThumbnailSize;
@ -1375,7 +1375,7 @@ QString DocumentData::mimeString() const {
return _mimeString;
}
bool DocumentData::hasMimeType(QLatin1String mime) const {
bool DocumentData::hasMimeType(const QString &mime) const {
return (_mimeString == mime);
}
@ -1438,19 +1438,19 @@ bool DocumentData::isVideoMessage() const {
bool DocumentData::isAnimation() const {
return (type == AnimatedDocument)
|| isVideoMessage()
|| (hasMimeType(qstr("image/gif"))
|| (hasMimeType(u"image/gif"_q)
&& !(_flags & Flag::StreamingPlaybackFailed));
}
bool DocumentData::isGifv() const {
return (type == AnimatedDocument)
&& hasMimeType(qstr("video/mp4"));
&& hasMimeType(u"video/mp4"_q);
}
bool DocumentData::isTheme() const {
return hasMimeType(qstr("application/x-tgtheme-tdesktop"))
|| _filename.endsWith(qstr(".tdesktop-theme"), Qt::CaseInsensitive)
|| _filename.endsWith(qstr(".tdesktop-palette"), Qt::CaseInsensitive);
return hasMimeType(u"application/x-tgtheme-tdesktop"_q)
|| _filename.endsWith(u".tdesktop-theme"_q, Qt::CaseInsensitive)
|| _filename.endsWith(u".tdesktop-palette"_q, Qt::CaseInsensitive);
}
bool DocumentData::isSong() const {
@ -1467,15 +1467,15 @@ bool DocumentData::isAudioFile() const {
} else if (isSong()) {
return true;
}
const auto prefix = qstr("audio/");
const auto prefix = u"audio/"_q;
if (!_mimeString.startsWith(prefix, Qt::CaseInsensitive)) {
if (_filename.endsWith(qstr(".opus"), Qt::CaseInsensitive)) {
if (_filename.endsWith(u".opus"_q, Qt::CaseInsensitive)) {
return true;
}
return false;
}
const auto left = _mimeString.mid(prefix.size());
const auto types = { qstr("x-wav"), qstr("wav"), qstr("mp4") };
const auto types = { u"x-wav"_q, u"wav"_q, u"mp4"_q };
return ranges::contains(types, left);
}

View File

@ -249,7 +249,7 @@ public:
[[nodiscard]] QString filename() const;
[[nodiscard]] QString mimeString() const;
[[nodiscard]] bool hasMimeType(QLatin1String mime) const;
[[nodiscard]] bool hasMimeType(const QString &mime) const;
void setMimeString(const QString &mime);
[[nodiscard]] bool hasAttachedStickers() const;

View File

@ -640,7 +640,7 @@ void Histories::deleteAllMessages(
)).done([=](const MTPUpdates &result) {
session().api().applyUpdates(result);
//}).fail([=](const MTP::Error &error) {
// if (error.type() == qstr("CHANNEL_TOO_LARGE")) {
// if (error.type() == u"CHANNEL_TOO_LARGE"_q) {
// Ui::show(Box<Ui::InformBox>(tr::lng_cant_delete_channel(tr::now)));
// }
}).send();

View File

@ -283,7 +283,7 @@ TextForMimeData WithCaptionClipboardText(
TextForMimeData &&caption) {
auto result = TextForMimeData();
result.reserve(5 + attachType.size() + caption.expanded.size());
result.append(qstr("[ ")).append(attachType).append(qstr(" ]"));
result.append(u"[ "_q).append(attachType).append(u" ]"_q);
if (!caption.empty()) {
result.append('\n').append(std::move(caption));
}
@ -914,7 +914,7 @@ TextForMimeData MediaFile::clipboardText() const {
const auto attachType = [&] {
const auto name = Ui::Text::FormatSongNameFor(_document).string();
const auto addName = !name.isEmpty()
? qstr(" : ") + name
? u" : "_q + name
: QString();
if (const auto sticker = _document->sticker()) {
if (!_emoji.isEmpty()) {
@ -1245,7 +1245,7 @@ QString MediaLocation::pinnedTextSubstring() const {
TextForMimeData MediaLocation::clipboardText() const {
auto result = TextForMimeData::Simple(
qstr("[ ") + tr::lng_maps_point(tr::now) + qstr(" ]\n"));
u"[ "_q + tr::lng_maps_point(tr::now) + u" ]\n"_q);
auto titleResult = TextUtilities::ParseEntities(
_title,
Ui::WebpageTextTitleOptions().flags);
@ -1690,11 +1690,11 @@ QString MediaPoll::pinnedTextSubstring() const {
}
TextForMimeData MediaPoll::clipboardText() const {
const auto text = qstr("[ ")
const auto text = u"[ "_q
+ tr::lng_in_dlg_poll(tr::now)
+ qstr(" : ")
+ u" : "_q
+ _poll->question
+ qstr(" ]")
+ u" ]"_q
+ ranges::accumulate(
ranges::views::all(
_poll->answers

View File

@ -140,11 +140,11 @@ std::vector<UnavailableReason> ExtractUnavailableReasons(
const auto platform = qs(data.vplatform());
return false
#ifdef OS_MAC_STORE
|| (platform == qstr("ios"))
|| (platform == u"ios"_q)
#elif defined OS_WIN_STORE // OS_MAC_STORE
|| (platform == qstr("ms"))
|| (platform == u"ms"_q)
#endif // OS_MAC_STORE || OS_WIN_STORE
|| (platform == qstr("all"));
|| (platform == u"all"_q);
});
}) | ranges::views::transform([](const MTPRestrictionReason &restriction) {
return restriction.match([&](const MTPDrestrictionReason &data) {
@ -3258,7 +3258,7 @@ void Session::webpageApplyFields(
};
const auto siteName = qs(data.vsite_name().value_or_empty());
auto parseFlags = TextParseLinks | TextParseMultiline;
if (siteName == qstr("Twitter") || siteName == qstr("Instagram")) {
if (siteName == u"Twitter"_q || siteName == u"Instagram"_q) {
parseFlags |= TextParseHashtags | TextParseMentions;
}
TextUtilities::ParseEntities(description, parseFlags);

View File

@ -348,7 +348,7 @@ WallPaper WallPaper::withUrlParams(
if (auto mode = params.value("mode"); !mode.isEmpty()) {
const auto list = mode.replace('+', ' ').split(' ');
for (const auto &change : list) {
if (change == qstr("blur")) {
if (change == u"blur"_q) {
result._blurred = true;
}
}

View File

@ -137,35 +137,35 @@ WebPageType ParseWebPageType(
const QString &type,
const QString &embedUrl,
bool hasIV) {
if (type == qstr("video") || !embedUrl.isEmpty()) {
if (type == u"video"_q || !embedUrl.isEmpty()) {
return WebPageType::Video;
} else if (type == qstr("photo")) {
} else if (type == u"photo"_q) {
return WebPageType::Photo;
} else if (type == qstr("profile")) {
} else if (type == u"profile"_q) {
return WebPageType::Profile;
} else if (type == qstr("telegram_background")) {
} else if (type == u"telegram_background"_q) {
return WebPageType::WallPaper;
} else if (type == qstr("telegram_theme")) {
} else if (type == u"telegram_theme"_q) {
return WebPageType::Theme;
} else if (type == qstr("telegram_channel")) {
} else if (type == u"telegram_channel"_q) {
return WebPageType::Channel;
} else if (type == qstr("telegram_channel_request")) {
} else if (type == u"telegram_channel_request"_q) {
return WebPageType::ChannelWithRequest;
} else if (type == qstr("telegram_megagroup")
|| type == qstr("telegram_chat")) {
} else if (type == u"telegram_megagroup"_q
|| type == u"telegram_chat"_q) {
return WebPageType::Group;
} else if (type == qstr("telegram_megagroup_request")
|| type == qstr("telegram_chat_request")) {
} else if (type == u"telegram_megagroup_request"_q
|| type == u"telegram_chat_request"_q) {
return WebPageType::GroupWithRequest;
} else if (type == qstr("telegram_message")) {
} else if (type == u"telegram_message"_q) {
return WebPageType::Message;
} else if (type == qstr("telegram_bot")) {
} else if (type == u"telegram_bot"_q) {
return WebPageType::Bot;
} else if (type == qstr("telegram_voicechat")) {
} else if (type == u"telegram_voicechat"_q) {
return WebPageType::VoiceChat;
} else if (type == qstr("telegram_livestream")) {
} else if (type == u"telegram_livestream"_q) {
return WebPageType::Livestream;
} else if (type == qstr("telegram_user")) {
} else if (type == u"telegram_user"_q) {
return WebPageType::User;
} else if (hasIV) {
return WebPageType::ArticleWithIV;

View File

@ -1620,7 +1620,8 @@ void Stickers::newSetReceived(const MTPDmessages_stickerSet &set) {
QString Stickers::getSetTitle(const MTPDstickerSet &s) {
auto title = qs(s.vtitle());
if ((s.vflags().v & MTPDstickerSet::Flag::f_official) && !title.compare(qstr("Great Minds"), Qt::CaseInsensitive)) {
if ((s.vflags().v & MTPDstickerSet::Flag::f_official)
&& !title.compare(u"Great Minds"_q, Qt::CaseInsensitive)) {
return tr::lng_stickers_default_set(tr::now);
}
return title;

View File

@ -2149,7 +2149,7 @@ void InnerWidget::parentGeometryChanged() {
}
void InnerWidget::applyFilterUpdate(QString newFilter, bool force) {
const auto mentionsSearch = (newFilter == qstr("@"));
const auto mentionsSearch = (newFilter == u"@"_q);
const auto words = mentionsSearch
? QStringList(newFilter)
: TextUtilities::PrepareSearchWords(newFilter);

View File

@ -1729,7 +1729,7 @@ void Widget::searchFailed(
SearchRequestType type,
const MTP::Error &error,
mtpRequestId requestId) {
if (error.type() == qstr("SEARCH_QUERY_EMPTY")) {
if (error.type() == u"SEARCH_QUERY_EMPTY"_q) {
searchReceived(
type,
MTP_messages_messages(

View File

@ -325,13 +325,13 @@ QString ComputeDocumentName(
}
const auto mimeString = QString::fromUtf8(data.mime);
const auto mimeType = Core::MimeTypeForName(mimeString);
const auto hasMimeType = [&](QLatin1String mime) {
const auto hasMimeType = [&](const auto &mime) {
return !mimeString.compare(mime, Qt::CaseInsensitive);
};
const auto patterns = mimeType.globPatterns();
const auto pattern = patterns.isEmpty() ? QString() : patterns.front();
if (data.isVoiceMessage) {
const auto isMP3 = hasMimeType(qstr("audio/mp3"));
const auto isMP3 = hasMimeType(u"audio/mp3"_q);
return qsl("audio_")
+ QString::number(++context.audios)
+ PrepareFileNameDatePart(date)

View File

@ -367,7 +367,7 @@ auto ApiWrap::fileRequest(const Data::FileLocation &location, int64 offset) {
MTP_int(kFileChunkSize))
)).fail([=](const MTP::Error &result) {
_fileProcess->requestId = 0;
if (result.type() == qstr("TAKEOUT_FILE_EMPTY")
if (result.type() == u"TAKEOUT_FILE_EMPTY"_q
&& _otherDataProcess != nullptr) {
filePartDone(
0,
@ -375,12 +375,12 @@ auto ApiWrap::fileRequest(const Data::FileLocation &location, int64 offset) {
MTP_storage_filePartial(),
MTP_int(0),
MTP_bytes()));
} else if (result.type() == qstr("LOCATION_INVALID")
|| result.type() == qstr("VERSION_INVALID")
|| result.type() == qstr("LOCATION_NOT_AVAILABLE")) {
} else if (result.type() == u"LOCATION_INVALID"_q
|| result.type() == u"VERSION_INVALID"_q
|| result.type() == u"LOCATION_NOT_AVAILABLE"_q) {
filePartUnavailable();
} else if (result.code() == 400
&& result.type().startsWith(qstr("FILE_REFERENCE_"))) {
&& result.type().startsWith(u"FILE_REFERENCE_"_q)) {
filePartRefreshReference(offset);
} else {
error(std::move(result));
@ -1443,7 +1443,7 @@ void ApiWrap::requestChatMessages(
)).fail([=](const MTP::Error &error) {
Expects(_chatProcess != nullptr);
if (error.type() == qstr("CHANNEL_PRIVATE")) {
if (error.type() == u"CHANNEL_PRIVATE"_q) {
if (realPeerInput.type() == mtpc_inputPeerChannel
&& !_chatProcess->info.onlyMyMessages) {

View File

@ -44,8 +44,8 @@ using PeersMap = details::PeersMap;
using MediaData = details::MediaData;
bool IsGlobalLink(const QString &link) {
return link.startsWith(qstr("http://"), Qt::CaseInsensitive)
|| link.startsWith(qstr("https://"), Qt::CaseInsensitive);
return link.startsWith(u"http://"_q, Qt::CaseInsensitive)
|| link.startsWith(u"https://"_q, Qt::CaseInsensitive);
}
QByteArray NoFileDescription(Data::File::SkipReason reason) {

View File

@ -220,12 +220,12 @@ void PanelController::showSettings() {
void PanelController::showError(const ApiErrorState &error) {
LOG(("Export Info: API Error '%1'.").arg(error.data.type()));
if (error.data.type() == qstr("TAKEOUT_INVALID")) {
if (error.data.type() == u"TAKEOUT_INVALID"_q) {
showError(tr::lng_export_invalid(tr::now));
} else if (error.data.type().startsWith(qstr("TAKEOUT_INIT_DELAY_"))) {
} else if (error.data.type().startsWith(u"TAKEOUT_INIT_DELAY_"_q)) {
const auto seconds = std::max(base::StringViewMid(
error.data.type(),
qstr("TAKEOUT_INIT_DELAY_").size()).toInt(), 1);
u"TAKEOUT_INIT_DELAY_"_q.size()).toInt(), 1);
const auto now = QDateTime::currentDateTime();
const auto when = now.addSecs(seconds);
const auto hours = seconds / 3600;

View File

@ -357,9 +357,9 @@ void SettingsWidget::addFormatAndLocationLabel(
st::exportLocationLabel),
st::exportLocationPadding);
label->overrideLinkClickHandler([=](const QString &url) {
if (url == qstr("internal:edit_export_path")) {
if (url == u"internal:edit_export_path"_q) {
chooseFolder();
} else if (url == qstr("internal:edit_format")) {
} else if (url == u"internal:edit_format"_q) {
chooseFormat();
} else {
Unexpected("Click handler URL in export limits edit.");
@ -409,7 +409,7 @@ void SettingsWidget::addLimitsLabel(
st::exportLocationLabel),
st::exportLimitsPadding);
label->overrideLinkClickHandler([=](const QString &url) {
if (url == qstr("internal:edit_from")) {
if (url == u"internal:edit_from"_q) {
const auto done = [=](TimeId limit) {
changeData([&](Settings &settings) {
settings.singlePeerFrom = limit;
@ -421,7 +421,7 @@ void SettingsWidget::addLimitsLabel(
readData().singlePeerTill,
tr::lng_export_from_beginning(),
done);
} else if (url == qstr("internal:edit_till")) {
} else if (url == u"internal:edit_till"_q) {
const auto done = [=](TimeId limit) {
changeData([&](Settings &settings) {
settings.singlePeerTill = limit;

View File

@ -96,7 +96,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
nullptr,
0);
if (error || !hwDeviceContext) {
LogError(qstr("av_hwdevice_ctx_create"), error);
LogError(u"av_hwdevice_ctx_create"_q, error);
return false;
}
DEBUG_LOG(("Video Info: "
@ -195,7 +195,7 @@ IOPointer MakeIOPointer(
int64_t(*seek)(void *opaque, int64_t offset, int whence)) {
auto buffer = reinterpret_cast<uchar*>(av_malloc(kAvioBlockSize));
if (!buffer) {
LogError(qstr("av_malloc"));
LogError(u"av_malloc"_q);
return {};
}
auto result = IOPointer(avio_alloc_context(
@ -208,7 +208,7 @@ IOPointer MakeIOPointer(
seek));
if (!result) {
av_freep(&buffer);
LogError(qstr("avio_alloc_context"));
LogError(u"avio_alloc_context"_q);
return {};
}
return result;
@ -232,7 +232,7 @@ FormatPointer MakeFormatPointer(
}
auto result = avformat_alloc_context();
if (!result) {
LogError(qstr("avformat_alloc_context"));
LogError(u"avformat_alloc_context"_q);
return {};
}
result->pb = io.get();
@ -247,7 +247,7 @@ FormatPointer MakeFormatPointer(
&options));
if (error) {
// avformat_open_input freed 'result' in case an error happened.
LogError(qstr("avformat_open_input"), error);
LogError(u"avformat_open_input"_q, error);
return {};
}
result->flags |= AVFMT_FLAG_FAST_SEEK;
@ -277,13 +277,13 @@ CodecPointer MakeCodecPointer(CodecDescriptor descriptor) {
auto result = CodecPointer(avcodec_alloc_context3(nullptr));
const auto context = result.get();
if (!context) {
LogError(qstr("avcodec_alloc_context3"));
LogError(u"avcodec_alloc_context3"_q);
return {};
}
const auto stream = descriptor.stream;
error = avcodec_parameters_to_context(context, stream->codecpar);
if (error) {
LogError(qstr("avcodec_parameters_to_context"), error);
LogError(u"avcodec_parameters_to_context"_q, error);
return {};
}
context->pkt_timebase = stream->time_base;
@ -292,7 +292,7 @@ CodecPointer MakeCodecPointer(CodecDescriptor descriptor) {
const auto codec = FindDecoder(context);
if (!codec) {
LogError(qstr("avcodec_find_decoder"), context->codec_id);
LogError(u"avcodec_find_decoder"_q, context->codec_id);
return {};
}
@ -305,7 +305,7 @@ CodecPointer MakeCodecPointer(CodecDescriptor descriptor) {
}
if ((error = avcodec_open2(context, codec, nullptr))) {
LogError(qstr("avcodec_open2"), error);
LogError(u"avcodec_open2"_q, error);
return {};
}
return result;
@ -356,7 +356,7 @@ SwscalePointer MakeSwscalePointer(
}
}
if (srcFormat <= AV_PIX_FMT_NONE || srcFormat >= AV_PIX_FMT_NB) {
LogError(qstr("frame->format"));
LogError(u"frame->format"_q);
return SwscalePointer();
}
@ -373,7 +373,7 @@ SwscalePointer MakeSwscalePointer(
nullptr,
nullptr);
if (!result) {
LogError(qstr("sws_getCachedContext"));
LogError(u"sws_getCachedContext"_q);
}
return SwscalePointer(
result,
@ -398,11 +398,11 @@ void SwscaleDeleter::operator()(SwsContext *value) {
}
}
void LogError(QLatin1String method) {
void LogError(const QString &method) {
LOG(("Streaming Error: Error in %1.").arg(method));
}
void LogError(QLatin1String method, AvErrorWrap error) {
void LogError(const QString &method, AvErrorWrap error) {
LOG(("Streaming Error: Error in %1 (code: %2, text: %3)."
).arg(method
).arg(error.code()

View File

@ -160,8 +160,8 @@ using SwscalePointer = std::unique_ptr<SwsContext, SwscaleDeleter>;
QSize resize,
SwscalePointer *existing = nullptr);
void LogError(QLatin1String method);
void LogError(QLatin1String method, FFmpeg::AvErrorWrap error);
void LogError(const QString &method);
void LogError(const QString &method, FFmpeg::AvErrorWrap error);
[[nodiscard]] const AVCodec *FindDecoder(not_null<AVCodecContext*> context);
[[nodiscard]] crl::time PtsToTime(int64_t pts, AVRational timeBase);

View File

@ -530,7 +530,7 @@ void InnerWidget::updateEmptyText() {
: _channel->isMegagroup()
? tr::lng_admin_log_no_events_text(tr::now)
: tr::lng_admin_log_no_events_text_channel(tr::now);
text.text.append(qstr("\n\n") + description);
text.text.append(u"\n\n"_q + description);
_emptyText.setMarkedText(st::defaultTextStyle, text);
}

View File

@ -336,13 +336,13 @@ QString InternalInviteLinkUrl(const MTPExportedChatInvite &data) {
QString GenerateInviteLinkText(const MTPExportedChatInvite &data) {
const auto label = ExtractInviteLinkLabel(data);
return label.isEmpty() ? ExtractInviteLink(data).replace(
qstr("https://"),
u"https://"_q,
QString()
).replace(
qstr("t.me/+"),
u"t.me/+"_q,
QString()
).replace(
qstr("t.me/joinchat/"),
u"t.me/joinchat/"_q,
QString()
) : label;
}

View File

@ -2798,7 +2798,7 @@ TextForMimeData HistoryInner::getSelectedText() const {
return texts.front().second.unwrapped;
}
auto result = TextForMimeData();
const auto sep = qstr("\n\n");
const auto sep = u"\n\n"_q;
result.reserve(fullSize + (texts.size() - 1) * sep.size());
for (auto i = texts.begin(), e = texts.end(); i != e;) {
result.append(i->second.name).append(i->second.time);

View File

@ -44,7 +44,7 @@ TextForMimeData HistoryItemText(not_null<HistoryItem*> item) {
if (result.empty()) {
result = std::move(logEntryOriginalResult);
} else if (!logEntryOriginalResult.empty()) {
result.append(qstr("\n\n")).append(std::move(logEntryOriginalResult));
result.append(u"\n\n"_q).append(std::move(logEntryOriginalResult));
}
return result;
}
@ -72,7 +72,7 @@ TextForMimeData HistoryGroupText(not_null<const Data::Group*> group) {
if (result.empty()) {
result = HistoryItemText(item);
} else {
result.append(qstr("\n\n")).append(HistoryItemText(item));
result.append(u"\n\n"_q).append(HistoryItemText(item));
}
}
return result;

View File

@ -120,7 +120,7 @@ QString GetErrorTextForSending(
for (const auto &item : *request.forward) {
if (const auto media = item->media()) {
const auto error = media->errorTextForForward(peer);
if (!error.isEmpty() && error != qstr("skip")) {
if (!error.isEmpty() && error != u"skip"_q) {
return error;
}
}

View File

@ -329,7 +329,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
result.text = tr::lng_action_bot_allowed_from_domain(
tr::now,
lt_domain,
Ui::Text::Link(domain, qstr("http://") + domain),
Ui::Text::Link(domain, u"http://"_q + domain),
Ui::Text::WithEntities);
return result;
};

View File

@ -2986,13 +2986,13 @@ void HistoryWidget::closeCurrent() {
}
void HistoryWidget::messagesFailed(const MTP::Error &error, int requestId) {
if (error.type() == qstr("CHANNEL_PRIVATE")
if (error.type() == u"CHANNEL_PRIVATE"_q
&& _peer->isChannel()
&& _peer->asChannel()->invitePeekExpires()) {
_peer->asChannel()->privateErrorReceived();
} else if (error.type() == qstr("CHANNEL_PRIVATE")
|| error.type() == qstr("CHANNEL_PUBLIC_GROUP_NA")
|| error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
} else if (error.type() == u"CHANNEL_PRIVATE"_q
|| error.type() == u"CHANNEL_PUBLIC_GROUP_NA"_q
|| error.type() == u"USER_BANNED_IN_CHANNEL"_q) {
auto was = _peer;
closeCurrent();
if (const auto primary = Core::App().primaryWindow()) {

View File

@ -2339,7 +2339,7 @@ TextForMimeData ListWidget::getSelectedText() const {
});
auto result = TextForMimeData();
auto sep = qstr("\n\n");
auto sep = u"\n\n"_q;
result.reserve(fullSize + (texts.size() - 1) * sep.size());
for (auto i = begin(texts), e = end(texts); i != e;) {
result.append(std::move(i->second));

View File

@ -2127,12 +2127,12 @@ TextForMimeData Message::selectedText(TextSelection selection) const {
if (result.empty()) {
result = std::move(mediaResult);
} else if (!mediaResult.empty()) {
result.append(qstr("\n\n")).append(std::move(mediaResult));
result.append(u"\n\n"_q).append(std::move(mediaResult));
}
if (result.empty()) {
result = std::move(logEntryOriginalResult);
} else if (!logEntryOriginalResult.empty()) {
result.append(qstr("\n\n")).append(std::move(logEntryOriginalResult));
result.append(u"\n\n"_q).append(std::move(logEntryOriginalResult));
}
return result;
}

View File

@ -71,7 +71,7 @@ TimeId DurationForTimestampLinks(not_null<WebPageData*> webpage) {
} else if (const auto document = webpage->document) {
return DurationForTimestampLinks(document);
} else if (webpage->type != WebPageType::Video
|| webpage->siteName != qstr("YouTube")) {
|| webpage->siteName != u"YouTube"_q) {
return TimeId(0);
} else if (webpage->duration > 0) {
return webpage->duration;

View File

@ -547,7 +547,7 @@ TextForMimeData GroupedMedia::selectedText(
if (result.empty()) {
result = std::move(text);
} else {
result.append(qstr("\n\n")).append(std::move(text));
result.append(u"\n\n"_q).append(std::move(text));
}
}
selection = part.content->skipSelection(selection);

View File

@ -116,7 +116,7 @@ QSize WebPage::countOptimalSize() {
if (result.endsWith('/')) {
result.chop(1);
}
const auto prefixes = { qstr("http://"), qstr("https://") };
const auto prefixes = { u"http://"_q, u"https://"_q };
for (const auto &prefix : prefixes) {
if (result.startsWith(prefix)) {
result = result.mid(prefix.size());
@ -166,8 +166,8 @@ QSize WebPage::countOptimalSize() {
&& _data->type != WebPageType::Video) {
if (_data->type == WebPageType::Profile) {
_asArticle = true;
} else if (_data->siteName == qstr("Twitter")
|| _data->siteName == qstr("Facebook")
} else if (_data->siteName == u"Twitter"_q
|| _data->siteName == u"Facebook"_q
|| _data->type == WebPageType::ArticleWithIV) {
_asArticle = false;
} else {
@ -216,9 +216,9 @@ QSize WebPage::countOptimalSize() {
.session = &history()->session(),
.customEmojiRepaint = [=] { _parent->customEmojiRepaint(); },
};
if (_data->siteName == qstr("Twitter")) {
if (_data->siteName == u"Twitter"_q) {
context.type = MarkedTextContext::HashtagMentionType::Twitter;
} else if (_data->siteName == qstr("Instagram")) {
} else if (_data->siteName == u"Instagram"_q) {
context.type = MarkedTextContext::HashtagMentionType::Instagram;
}
_description.setMarkedText(
@ -607,7 +607,7 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
&& _data->photo
&& !_data->document) {
if (_attach->isReadyForOpen()) {
if (_data->siteName == qstr("YouTube")) {
if (_data->siteName == u"YouTube"_q) {
st->youtubeIcon().paint(p, (pixwidth - st::youtubeIcon.width()) / 2, (pixheight - st::youtubeIcon.height()) / 2, width());
} else {
st->videoIcon().paint(p, (pixwidth - st::videoIcon.width()) / 2, (pixheight - st::videoIcon.height()) / 2, width());
@ -752,8 +752,8 @@ ClickHandlerPtr WebPage::replaceAttachLink(
|| _data->type == WebPageType::Video) {
return _openl;
} else if (_data->type == WebPageType::Photo
|| _data->siteName == qstr("Twitter")
|| _data->siteName == qstr("Facebook")) {
|| _data->siteName == u"Twitter"_q
|| _data->siteName == u"Facebook"_q) {
// leave photo link
} else {
return _openl;

View File

@ -458,8 +458,8 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
return link.isEmpty()
? TextWithEntities()
: Ui::Text::Link(
(link.startsWith(qstr("https://"))
? link.mid(qstr("https://").size())
(link.startsWith(u"https://"_q)
? link.mid(u"https://"_q.size())
: link) + addToLink,
link + addToLink);
});

View File

@ -816,8 +816,8 @@ void AttachWebView::show(
const auto handleLocalUri = [close](QString uri) {
const auto local = Core::TryConvertUrlToLocal(uri);
if (uri == local || Core::InternalPassportLink(local)) {
return local.startsWith(qstr("tg://"));
} else if (!local.startsWith(qstr("tg://"), Qt::CaseInsensitive)) {
return local.startsWith(u"tg://"_q);
} else if (!local.startsWith(u"tg://"_q, Qt::CaseInsensitive)) {
return false;
}
UrlClickHandler::Open(local, {});

View File

@ -474,7 +474,7 @@ MTPVector<MTPDocumentAttribute> Result::adjustAttributes(
const auto mime = qs(mimeType);
if (_type == Type::Gif) {
if (!exists(mtpc_documentAttributeFilename)) {
auto filename = (mime == qstr("video/mp4")
auto filename = (mime == u"video/mp4"_q
? "animation.gif.mp4"
: "animation.gif");
result.push_back(MTP_documentAttributeFilename(
@ -487,7 +487,7 @@ MTPVector<MTPDocumentAttribute> Result::adjustAttributes(
const auto audio = find(mtpc_documentAttributeAudio);
if (audio != result.cend()) {
using Flag = MTPDdocumentAttributeAudio::Flag;
if (mime == qstr("audio/ogg")) {
if (mime == u"audio/ogg"_q) {
// We always treat audio/ogg as a voice message.
// It was that way before we started to get attributes here.
const auto &fields = audio->c_documentAttributeAudio();

View File

@ -277,13 +277,13 @@ void CodeWidget::codeSubmitFail(const MTP::Error &error) {
stopCheck();
_sentRequest = 0;
auto &err = error.type();
if (err == qstr("PHONE_NUMBER_INVALID")
|| err == qstr("PHONE_CODE_EXPIRED")
|| err == qstr("PHONE_NUMBER_BANNED")) { // show error
if (err == u"PHONE_NUMBER_INVALID"_q
|| err == u"PHONE_CODE_EXPIRED"_q
|| err == u"PHONE_NUMBER_BANNED"_q) { // show error
goBack();
} else if (err == qstr("PHONE_CODE_EMPTY") || err == qstr("PHONE_CODE_INVALID")) {
} else if (err == u"PHONE_CODE_EMPTY"_q || err == u"PHONE_CODE_INVALID"_q) {
showCodeError(tr::lng_bad_code());
} else if (err == qstr("SESSION_PASSWORD_NEEDED")) {
} else if (err == u"SESSION_PASSWORD_NEEDED"_q) {
_checkRequestTimer.callEach(1000);
_sentRequest = api().request(MTPaccount_GetPassword(
)).done([=](const MTPaccount_Password &result) {

View File

@ -145,15 +145,15 @@ void PasswordCheckWidget::pwdSubmitFail(const MTP::Error &error) {
_sentRequest = 0;
const auto &type = error.type();
if (type == qstr("PASSWORD_HASH_INVALID")
|| type == qstr("SRP_PASSWORD_CHANGED")) {
if (type == u"PASSWORD_HASH_INVALID"_q
|| type == u"SRP_PASSWORD_CHANGED"_q) {
showError(tr::lng_signin_bad_password());
_pwdField->selectAll();
_pwdField->showError();
} else if (type == qstr("PASSWORD_EMPTY")
|| type == qstr("AUTH_KEY_UNREGISTERED")) {
} else if (type == u"PASSWORD_EMPTY"_q
|| type == u"AUTH_KEY_UNREGISTERED"_q) {
goBack();
} else if (type == qstr("SRP_ID_INVALID")) {
} else if (type == u"SRP_ID_INVALID"_q) {
handleSrpIdInvalid();
} else {
if (Logs::DebugEnabled()) { // internal server error
@ -251,15 +251,15 @@ void PasswordCheckWidget::codeSubmitFail(const MTP::Error &error) {
_sentRequest = 0;
const auto &type = error.type();
if (type == qstr("PASSWORD_EMPTY")
|| type == qstr("AUTH_KEY_UNREGISTERED")) {
if (type == u"PASSWORD_EMPTY"_q
|| type == u"AUTH_KEY_UNREGISTERED"_q) {
goBack();
} else if (type == qstr("PASSWORD_RECOVERY_NA")) {
} else if (type == u"PASSWORD_RECOVERY_NA"_q) {
recoverStartFail(error);
} else if (type == qstr("PASSWORD_RECOVERY_EXPIRED")) {
} else if (type == u"PASSWORD_RECOVERY_EXPIRED"_q) {
_emailPattern = QString();
toPassword();
} else if (type == qstr("CODE_INVALID")) {
} else if (type == u"CODE_INVALID"_q) {
showError(tr::lng_signin_wrong_code());
_codeField->selectAll();
_codeField->showError();

View File

@ -243,11 +243,11 @@ void PhoneWidget::phoneSubmitFail(const MTP::Error &error) {
stopCheck();
_sentRequest = 0;
auto &err = error.type();
if (err == qstr("PHONE_NUMBER_FLOOD")) {
if (err == u"PHONE_NUMBER_FLOOD"_q) {
Ui::show(Ui::MakeInformBox(tr::lng_error_phone_flood()));
} else if (err == qstr("PHONE_NUMBER_INVALID")) { // show error
} else if (err == u"PHONE_NUMBER_INVALID"_q) { // show error
showPhoneError(tr::lng_bad_phone());
} else if (err == qstr("PHONE_NUMBER_BANNED")) {
} else if (err == u"PHONE_NUMBER_BANNED"_q) {
Ui::ShowPhoneBannedError(getData()->controller, _sentPhone);
} else if (Logs::DebugEnabled()) { // internal server error
showPhoneError(rpl::single(err + ": " + error.description()));

View File

@ -347,7 +347,7 @@ void QrWidget::handleTokenResult(const MTPauth_LoginToken &result) {
void QrWidget::showTokenError(const MTP::Error &error) {
_requestId = 0;
if (error.type() == qstr("SESSION_PASSWORD_NEEDED")) {
if (error.type() == u"SESSION_PASSWORD_NEEDED"_q) {
sendCheckPasswordRequest();
} else if (base::take(_forceRefresh)) {
refreshCode();

View File

@ -129,14 +129,14 @@ void SignupWidget::nameSubmitFail(const MTP::Error &error) {
}
auto &err = error.type();
if (err == qstr("PHONE_NUMBER_FLOOD")) {
if (err == u"PHONE_NUMBER_FLOOD"_q) {
Ui::show(Ui::MakeInformBox(tr::lng_error_phone_flood()));
} else if (err == qstr("PHONE_NUMBER_INVALID")
|| err == qstr("PHONE_NUMBER_BANNED")
|| err == qstr("PHONE_CODE_EXPIRED")
|| err == qstr("PHONE_CODE_EMPTY")
|| err == qstr("PHONE_CODE_INVALID")
|| err == qstr("PHONE_NUMBER_OCCUPIED")) {
} else if (err == u"PHONE_NUMBER_INVALID"_q
|| err == u"PHONE_NUMBER_BANNED"_q
|| err == u"PHONE_CODE_EXPIRED"_q
|| err == u"PHONE_CODE_EMPTY"_q
|| err == u"PHONE_CODE_INVALID"_q
|| err == u"PHONE_NUMBER_OCCUPIED"_q) {
goBack();
} else if (err == "FIRSTNAME_INVALID") {
showError(tr::lng_bad_name());

View File

@ -509,10 +509,10 @@ void Widget::resetAccount() {
_resetRequest = 0;
const auto &type = error.type();
if (type.startsWith(qstr("2FA_CONFIRM_WAIT_"))) {
if (type.startsWith(u"2FA_CONFIRM_WAIT_"_q)) {
const auto seconds = base::StringViewMid(
type,
qstr("2FA_CONFIRM_WAIT_").size()).toInt();
u"2FA_CONFIRM_WAIT_"_q.size()).toInt();
const auto days = (seconds + 59) / 86400;
const auto hours = ((seconds + 59) % 86400) / 3600;
const auto minutes = ((seconds + 59) % 3600) / 60;
@ -552,7 +552,7 @@ void Widget::resetAccount() {
Ui::FormatPhone(getData()->phone),
lt_when,
when)));
} else if (type == qstr("2FA_RECENT_CONFIRM")) {
} else if (type == u"2FA_RECENT_CONFIRM"_q) {
Ui::show(Ui::MakeInformBox(
tr::lng_signin_reset_cancelled()));
} else {

View File

@ -396,7 +396,7 @@ void CloudManager::applyLangPackData(
}
bool CloudManager::canApplyWithoutRestart(const QString &id) const {
if (id == qstr("#TEST_X") || id == qstr("#TEST_0")) {
if (id == u"#TEST_X"_q || id == u"#TEST_0"_q) {
return true;
}
return Core::App().canApplyLangPackWithoutRestart();
@ -422,7 +422,7 @@ void CloudManager::requestLanguageAndSwitch(
if (LanguageIdOrDefault(_langpack.id()) == id) {
Ui::show(Ui::MakeInformBox(tr::lng_language_already()));
return;
} else if (id == qstr("#custom")) {
} else if (id == u"#custom"_q) {
performSwitchToCustom();
return;
}
@ -471,14 +471,14 @@ void CloudManager::sendSwitchingToLanguageRequest() {
}
void CloudManager::switchToLanguage(const Language &data) {
if (_langpack.id() == data.id && data.id != qstr("#custom")) {
if (_langpack.id() == data.id && data.id != u"#custom"_q) {
return;
} else if (!_api) {
return;
}
_api->request(base::take(_getKeysForSwitchRequestId)).cancel();
if (data.id == qstr("#custom")) {
if (data.id == u"#custom"_q) {
performSwitchToCustom();
} else if (canApplyWithoutRestart(data.id)) {
performSwitchAndAddToRecent(data);
@ -516,8 +516,8 @@ void CloudManager::switchToLanguage(const Language &data) {
}
void CloudManager::performSwitchToCustom() {
auto filter = qsl("Language files (*.strings)");
auto title = qsl("Choose language .strings file");
auto filter = u"Language files (*.strings)"_q;
auto title = u"Choose language .strings file"_q;
FileDialog::GetOpenPath(Core::App().getFileDialogParent(), title, filter, [=, weak = base::make_weak(this)](const FileDialog::OpenResult &result) {
if (!weak || result.paths.isEmpty()) {
return;
@ -533,7 +533,7 @@ void CloudManager::performSwitchToCustom() {
base::take(_switchingToLanguageRequest)
).cancel();
}
if (canApplyWithoutRestart(qsl("#custom"))) {
if (canApplyWithoutRestart(u"#custom"_q)) {
_langpack.switchToCustomFile(filePath);
} else {
const auto values = loader.found();
@ -568,9 +568,9 @@ void CloudManager::performSwitchToCustom() {
}
void CloudManager::switchToTestLanguage() {
const auto testLanguageId = (_langpack.id() == qstr("#TEST_X"))
? qsl("#TEST_0")
: qsl("#TEST_X");
const auto testLanguageId = (_langpack.id() == u"#TEST_X"_q)
? u"#TEST_0"_q
: u"#TEST_X"_q;
performSwitch({ testLanguageId });
}

View File

@ -254,7 +254,7 @@ Instance::Instance(not_null<Instance*> derived, const PrivateTag &)
void Instance::switchToId(const Language &data) {
reset(data);
if (_id == qstr("#TEST_X") || _id == qstr("#TEST_0")) {
if (_id == u"#TEST_X"_q || _id == u"#TEST_0"_q) {
for (auto &value : _values) {
value = PrepareTestValue(value, _id[5]);
}
@ -365,8 +365,8 @@ QString Instance::id(Pack pack) const {
bool Instance::isCustom() const {
return (_id == CustomLanguageId())
|| (_id == qstr("#TEST_X"))
|| (_id == qstr("#TEST_0"));
|| (_id == u"#TEST_X"_q)
|| (_id == u"#TEST_0"_q);
}
int Instance::version(Pack pack) const {

View File

@ -13,28 +13,28 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Lang {
QString Translator::translate(const char *context, const char *sourceText, const char *disambiguation, int n) const {
if (qstr("QMenuBar") == context) {
if (qstr("Services") == sourceText) return tr::lng_mac_menu_services(tr::now);
if (qstr("Hide %1") == sourceText) return tr::lng_mac_menu_hide_telegram(tr::now, lt_telegram, qsl("%1"));
if (qstr("Hide Others") == sourceText) return tr::lng_mac_menu_hide_others(tr::now);
if (qstr("Show All") == sourceText) return tr::lng_mac_menu_show_all(tr::now);
if (qstr("Preferences...") == sourceText) return tr::lng_mac_menu_preferences(tr::now);
if (qstr("Quit %1") == sourceText) return tr::lng_mac_menu_quit_telegram(tr::now, lt_telegram, qsl("%1"));
if (qstr("About %1") == sourceText) return tr::lng_mac_menu_about_telegram(tr::now, lt_telegram, qsl("%1"));
if (u"QMenuBar"_q == context) {
if (u"Services"_q == sourceText) return tr::lng_mac_menu_services(tr::now);
if (u"Hide %1"_q == sourceText) return tr::lng_mac_menu_hide_telegram(tr::now, lt_telegram, u"%1"_q);
if (u"Hide Others"_q == sourceText) return tr::lng_mac_menu_hide_others(tr::now);
if (u"Show All"_q == sourceText) return tr::lng_mac_menu_show_all(tr::now);
if (u"Preferences..."_q == sourceText) return tr::lng_mac_menu_preferences(tr::now);
if (u"Quit %1"_q == sourceText) return tr::lng_mac_menu_quit_telegram(tr::now, lt_telegram, u"%1"_q);
if (u"About %1"_q == sourceText) return tr::lng_mac_menu_about_telegram(tr::now, lt_telegram, u"%1"_q);
return QString();
}
if (qstr("QWidgetTextControl") == context || qstr("QLineEdit") == context) {
if (qstr("&Undo") == sourceText) return Platform::IsWindows() ? tr::lng_wnd_menu_undo(tr::now) : Platform::IsMac() ? tr::lng_mac_menu_undo(tr::now) : tr::lng_linux_menu_undo(tr::now);
if (qstr("&Redo") == sourceText) return Platform::IsWindows() ? tr::lng_wnd_menu_redo(tr::now) : Platform::IsMac() ? tr::lng_mac_menu_redo(tr::now) : tr::lng_linux_menu_redo(tr::now);
if (qstr("Cu&t") == sourceText) return tr::lng_mac_menu_cut(tr::now);
if (qstr("&Copy") == sourceText) return tr::lng_mac_menu_copy(tr::now);
if (qstr("&Paste") == sourceText) return tr::lng_mac_menu_paste(tr::now);
if (qstr("Delete") == sourceText) return tr::lng_mac_menu_delete(tr::now);
if (qstr("Select All") == sourceText) return tr::lng_mac_menu_select_all(tr::now);
if (u"QWidgetTextControl"_q == context || u"QLineEdit"_q == context) {
if (u"&Undo"_q == sourceText) return Platform::IsWindows() ? tr::lng_wnd_menu_undo(tr::now) : Platform::IsMac() ? tr::lng_mac_menu_undo(tr::now) : tr::lng_linux_menu_undo(tr::now);
if (u"&Redo"_q == sourceText) return Platform::IsWindows() ? tr::lng_wnd_menu_redo(tr::now) : Platform::IsMac() ? tr::lng_mac_menu_redo(tr::now) : tr::lng_linux_menu_redo(tr::now);
if (u"Cu&t"_q == sourceText) return tr::lng_mac_menu_cut(tr::now);
if (u"&Copy"_q == sourceText) return tr::lng_mac_menu_copy(tr::now);
if (u"&Paste"_q == sourceText) return tr::lng_mac_menu_paste(tr::now);
if (u"Delete"_q == sourceText) return tr::lng_mac_menu_delete(tr::now);
if (u"Select All"_q == sourceText) return tr::lng_mac_menu_select_all(tr::now);
return QString();
}
if (qstr("QUnicodeControlCharacterMenu") == context) {
if (qstr("Insert Unicode control character") == sourceText) return tr::lng_menu_insert_unicode(tr::now);
if (u"QUnicodeControlCharacterMenu"_q == context) {
if (u"Insert Unicode control character"_q == sourceText) return tr::lng_menu_insert_unicode(tr::now);
return QString();
}
return QString();

View File

@ -36,30 +36,30 @@ DocumentGenericPreview DocumentGenericPreview::Create(
: tr::lng_message_empty(tr::now)).toLower();
auto lastDot = name.lastIndexOf('.');
const auto mime = document ? document->mimeString() : QString();
if (name.endsWith(qstr(".doc")) ||
name.endsWith(qstr(".docx")) ||
name.endsWith(qstr(".txt")) ||
name.endsWith(qstr(".psd")) ||
mime.startsWith(qstr("text/"))) {
if (name.endsWith(u".doc"_q) ||
name.endsWith(u".docx"_q) ||
name.endsWith(u".txt"_q) ||
name.endsWith(u".psd"_q) ||
mime.startsWith(u"text/"_q)) {
colorIndex = 0;
} else if (
name.endsWith(qstr(".xls")) ||
name.endsWith(qstr(".xlsx")) ||
name.endsWith(qstr(".csv"))) {
name.endsWith(u".xls"_q) ||
name.endsWith(u".xlsx"_q) ||
name.endsWith(u".csv"_q)) {
colorIndex = 1;
} else if (
name.endsWith(qstr(".pdf")) ||
name.endsWith(qstr(".ppt")) ||
name.endsWith(qstr(".pptx")) ||
name.endsWith(qstr(".key"))) {
name.endsWith(u".pdf"_q) ||
name.endsWith(u".ppt"_q) ||
name.endsWith(u".pptx"_q) ||
name.endsWith(u".key"_q)) {
colorIndex = 2;
} else if (
name.endsWith(qstr(".zip")) ||
name.endsWith(qstr(".rar")) ||
name.endsWith(qstr(".ai")) ||
name.endsWith(qstr(".mp3")) ||
name.endsWith(qstr(".mov")) ||
name.endsWith(qstr(".avi"))) {
name.endsWith(u".zip"_q) ||
name.endsWith(u".rar"_q) ||
name.endsWith(u".ai"_q) ||
name.endsWith(u".mp3"_q) ||
name.endsWith(u".mov"_q) ||
name.endsWith(u".avi"_q)) {
colorIndex = 3;
} else {
auto ch = (lastDot >= 0 && lastDot + 1 < name.size())

View File

@ -52,10 +52,10 @@ QMutex *_logsMutex(LogDataType type, bool clear = false) {
QString _logsFilePath(LogDataType type, const QString &postfix = QString()) {
QString path(cWorkingDir());
switch (type) {
case LogDataMain: path += qstr("log") + postfix + qstr(".txt"); break;
case LogDataDebug: path += qstr("DebugLogs/log") + postfix + qstr(".txt"); break;
case LogDataTcp: path += qstr("DebugLogs/tcp") + postfix + qstr(".txt"); break;
case LogDataMtp: path += qstr("DebugLogs/mtp") + postfix + qstr(".txt"); break;
case LogDataMain: path += u"log"_q + postfix + u".txt"_q; break;
case LogDataDebug: path += u"DebugLogs/log"_q + postfix + u".txt"_q; break;
case LogDataTcp: path += u"DebugLogs/tcp"_q + postfix + u".txt"_q; break;
case LogDataMtp: path += u"DebugLogs/mtp"_q + postfix + u".txt"_q; break;
}
return path;
}
@ -165,8 +165,8 @@ private:
QDir working(cWorkingDir()); // delete all other log_startXX.txt that we can
QStringList oldlogs = working.entryList(QStringList("log_start*.txt"), QDir::Files);
for (QStringList::const_iterator i = oldlogs.cbegin(), e = oldlogs.cend(); i != e; ++i) {
QString oldlog = cWorkingDir() + *i, oldlogend = i->mid(qstr("log_start").size());
if (oldlogend.size() == 1 + qstr(".txt").size() && oldlogend.at(0).isDigit() && base::StringViewMid(oldlogend, 1) == qstr(".txt")) {
QString oldlog = cWorkingDir() + *i, oldlogend = i->mid(u"log_start"_q.size());
if (oldlogend.size() == 1 + u".txt"_q.size() && oldlogend.at(0).isDigit() && base::StringViewMid(oldlogend, 1) == u".txt"_q) {
bool removed = QFile(oldlog).remove();
LOG(("Old start log '%1' found, deleted: %2").arg(*i, Logs::b(removed)));
}
@ -209,7 +209,7 @@ private:
files[type]->close();
}
} else {
QDir().mkdir(cWorkingDir() + qstr("DebugLogs"));
QDir().mkdir(cWorkingDir() + u"DebugLogs"_q);
}
}
if (files[type]->open(mode)) {
@ -415,7 +415,7 @@ void start(not_null<Core::Launcher*> launcher) {
QDir().setCurrent(cWorkingDir());
#endif // !Q_OS_WINRT
QDir().mkpath(cWorkingDir() + qstr("tdata"));
QDir().mkpath(cWorkingDir() + u"tdata"_q);
launcher->workingFolderReady();
CrashReports::StartCatching(launcher);

View File

@ -59,8 +59,8 @@ constexpr auto kTmpPasswordReserveTime = TimeId(10);
// Like 'https://telegram.me/' or 'https://t.me/'.
const auto &domain = session->serverConfig().internalLinksDomain;
const auto prefixes = {
qstr("https://"),
qstr("http://"),
u"https://"_q,
u"http://"_q,
};
for (const auto &prefix : prefixes) {
if (domain.startsWith(prefix, Qt::CaseInsensitive)) {
@ -363,8 +363,8 @@ TextWithEntities Session::createInternalLink(
const TextWithEntities &query) const {
const auto result = createInternalLinkFull(query);
const auto prefixes = {
qstr("https://"),
qstr("http://"),
u"https://"_q,
u"http://"_q,
};
for (auto &prefix : prefixes) {
if (result.text.startsWith(prefix, Qt::CaseInsensitive)) {

View File

@ -2766,7 +2766,7 @@ void MainWidget::activate() {
if (_a_show.animating()) {
return;
} else if (!cSendPaths().isEmpty()) {
const auto interpret = qstr("interpret://");
const auto interpret = u"interpret://"_q;
const auto path = cSendPaths()[0];
if (path.startsWith(interpret)) {
cSetSendPaths(QStringList());

View File

@ -266,7 +266,7 @@ void Instance::Inner::start(Fn<void(Update)> updated, Fn<void()> error) {
const AVOutputFormat *fmt = nullptr;
void *i = nullptr;
while ((fmt = av_muxer_iterate(&i))) {
if (fmt->name == qstr("opus")) {
if (fmt->name == u"opus"_q) {
break;
}
}

View File

@ -51,7 +51,7 @@ FFmpeg::AvErrorWrap ProcessPacket(Stream &stream, FFmpeg::Packet &&packet) {
stream.codec.get(),
native->data ? native : nullptr); // Drain on eof.
if (error) {
LogError(qstr("avcodec_send_packet"), error);
LogError(u"avcodec_send_packet"_q, error);
if (error.code() == AVERROR_INVALIDDATA
// There is a sample voice message where skipping such packet
// results in a crash (read_access to nullptr) in swr_convert().
@ -119,7 +119,7 @@ bool TransferFrame(
const auto error = FFmpeg::AvErrorWrap(
av_hwframe_transfer_data(transferredFrame, decodedFrame, 0));
if (error) {
LogError(qstr("av_hwframe_transfer_data"), error);
LogError(u"av_hwframe_transfer_data"_q, error);
return false;
}
FFmpeg::ClearFrameMemory(decodedFrame);

View File

@ -4523,7 +4523,7 @@ void OverlayWidget::handleMouseRelease(
updateOver(position);
if (const auto activated = ClickHandler::unpressed()) {
if (activated->dragText() == qstr("internal:show_saved_message")) {
if (activated->dragText() == u"internal:show_saved_message"_q) {
showSaveMsgFile();
return;
}

View File

@ -1406,7 +1406,7 @@ bool Instance::Private::onErrorDefault(
(dcWithShift < 0) ? -newdcWithShift : newdcWithShift);
session->sendPrepared(request);
return true;
} else if (type == qstr("MSG_WAIT_TIMEOUT") || type == qstr("MSG_WAIT_FAILED")) {
} else if (type == u"MSG_WAIT_TIMEOUT"_q || type == u"MSG_WAIT_FAILED"_q) {
SerializedRequest request;
{
QReadLocker locker(&_requestMapLock);
@ -1477,7 +1477,7 @@ bool Instance::Private::onErrorDefault(
checkDelayedRequests();
return true;
} else if ((code == 401 && type != qstr("AUTH_KEY_PERM_EMPTY"))
} else if ((code == 401 && type != u"AUTH_KEY_PERM_EMPTY"_q)
|| (badGuestDc && _badGuestDcRequests.find(requestId) == _badGuestDcRequests.cend())) {
auto dcWithShift = ShiftedDcId(0);
if (const auto shiftedDcId = queryRequestByDc(requestId)) {
@ -1515,8 +1515,8 @@ bool Instance::Private::onErrorDefault(
waiters.push_back(requestId);
if (badGuestDc) _badGuestDcRequests.insert(requestId);
return true;
} else if (type == qstr("CONNECTION_NOT_INITED")
|| type == qstr("CONNECTION_LAYER_INVALID")) {
} else if (type == u"CONNECTION_NOT_INITED"_q
|| type == u"CONNECTION_LAYER_INVALID"_q) {
SerializedRequest request;
{
QReadLocker locker(&_requestMapLock);
@ -1539,7 +1539,7 @@ bool Instance::Private::onErrorDefault(
request->needsLayer = true;
session->sendPrepared(request);
return true;
} else if (type == qstr("CONNECTION_LANG_CODE_INVALID")) {
} else if (type == u"CONNECTION_LANG_CODE_INVALID"_q) {
Lang::CurrentCloudManager().resetToDefault();
}
if (badGuestDc) _badGuestDcRequests.erase(requestId);

View File

@ -784,9 +784,9 @@ bool DcOptions::loadFromFile(const QString &path) {
for (auto &option : components.mid(3)) {
if (option.startsWith('#')) {
break;
} else if (option == qstr("tcpo_only")) {
} else if (option == u"tcpo_only"_q) {
flags |= Flag::f_tcpo_only;
} else if (option == qstr("media_only")) {
} else if (option == u"media_only"_q) {
flags |= Flag::f_media_only;
} else {
return error();

View File

@ -39,7 +39,7 @@ private:
};
inline bool IsFloodError(const QString &type) {
return type.startsWith(qstr("FLOOD_WAIT_"));
return type.startsWith(u"FLOOD_WAIT_"_q);
}
inline bool IsFloodError(const Error &error) {

View File

@ -1563,8 +1563,8 @@ Link::Link(
if (_page->type == WebPageType::Profile || _page->type == WebPageType::Video) {
_photol = createHandler(_page->url);
} else if (_page->type == WebPageType::Photo
|| _page->siteName == qstr("Twitter")
|| _page->siteName == qstr("Facebook")) {
|| _page->siteName == u"Twitter"_q
|| _page->siteName == u"Facebook"_q) {
_photol = std::make_shared<PhotoOpenClickHandler>(
_page->photo,
crl::guard(this, [=](FullMsgId id) {

View File

@ -44,24 +44,24 @@ constexpr auto kShortPollTimeout = crl::time(3000);
constexpr auto kRememberCredentialsDelay = crl::time(1800 * 1000);
bool ForwardServiceErrorRequired(const QString &error) {
return (error == qstr("BOT_INVALID"))
|| (error == qstr("PUBLIC_KEY_REQUIRED"))
|| (error == qstr("PUBLIC_KEY_INVALID"))
|| (error == qstr("SCOPE_EMPTY"))
|| (error == qstr("PAYLOAD_EMPTY"));
return (error == u"BOT_INVALID"_q)
|| (error == u"PUBLIC_KEY_REQUIRED"_q)
|| (error == u"PUBLIC_KEY_INVALID"_q)
|| (error == u"SCOPE_EMPTY"_q)
|| (error == u"PAYLOAD_EMPTY"_q);
}
bool SaveErrorRequiresRestart(const QString &error) {
return (error == qstr("PASSWORD_REQUIRED"))
|| (error == qstr("SECURE_SECRET_REQUIRED"))
|| (error == qstr("SECURE_SECRET_INVALID"));
return (error == u"PASSWORD_REQUIRED"_q)
|| (error == u"SECURE_SECRET_REQUIRED"_q)
|| (error == u"SECURE_SECRET_INVALID"_q);
}
bool AcceptErrorRequiresRestart(const QString &error) {
return (error == qstr("PASSWORD_REQUIRED"))
|| (error == qstr("SECURE_SECRET_REQUIRED"))
|| (error == qstr("SECURE_VALUE_EMPTY"))
|| (error == qstr("SECURE_VALUE_HASH_INVALID"));
return (error == u"PASSWORD_REQUIRED"_q)
|| (error == u"SECURE_SECRET_REQUIRED"_q)
|| (error == u"SECURE_VALUE_EMPTY"_q)
|| (error == u"SECURE_VALUE_HASH_INVALID"_q);
}
std::map<QString, QString> GetTexts(const ValueMap &map) {
@ -884,7 +884,7 @@ void FormController::submitPassword(
}
}).fail([=](const MTP::Error &error) {
_passwordCheckRequestId = 0;
if (error.type() == qstr("SRP_ID_INVALID")) {
if (error.type() == u"SRP_ID_INVALID"_q) {
handleSrpIdInvalid(_passwordCheckRequestId);
} else if (submitSaved) {
// Force reload and show form.
@ -892,8 +892,8 @@ void FormController::submitPassword(
reloadPassword();
} else if (MTP::IsFloodError(error)) {
_passwordError.fire(tr::lng_flood_error(tr::now));
} else if (error.type() == qstr("PASSWORD_HASH_INVALID")
|| error.type() == qstr("SRP_PASSWORD_CHANGED")) {
} else if (error.type() == u"PASSWORD_HASH_INVALID"_q
|| error.type() == u"SRP_PASSWORD_CHANGED"_q) {
_passwordError.fire(tr::lng_passport_password_wrong(tr::now));
} else {
_passwordError.fire_copy(error.type());
@ -963,7 +963,7 @@ void FormController::checkSavedPasswordSettings(
}
}).fail([=](const MTP::Error &error) {
_passwordCheckRequestId = 0;
if (error.type() != qstr("SRP_ID_INVALID")
if (error.type() != u"SRP_ID_INVALID"_q
|| !handleSrpIdInvalid(_passwordCheckRequestId)) {
} else {
session().data().forgetPassportCredentials();
@ -1126,7 +1126,7 @@ void FormController::resetSecret(
generateSecret(password);
}).fail([=](const MTP::Error &error) {
_saveSecretRequestId = 0;
if (error.type() != qstr("SRP_ID_INVALID")
if (error.type() != u"SRP_ID_INVALID"_q
|| !handleSrpIdInvalid(_saveSecretRequestId)) {
formFail(error.type());
}
@ -1709,7 +1709,7 @@ void FormController::verify(
clearValueVerification(nonconst);
}).fail([=](const MTP::Error &error) {
nonconst->verification.requestId = 0;
if (error.type() == qstr("PHONE_CODE_INVALID")) {
if (error.type() == u"PHONE_CODE_INVALID"_q) {
verificationError(
nonconst,
tr::lng_signin_wrong_code(tr::now));
@ -1726,7 +1726,7 @@ void FormController::verify(
clearValueVerification(nonconst);
}).fail([=](const MTP::Error &error) {
nonconst->verification.requestId = 0;
if (error.type() == qstr("CODE_INVALID")) {
if (error.type() == u"CODE_INVALID"_q) {
verificationError(
nonconst,
tr::lng_signin_wrong_code(tr::now));
@ -2107,24 +2107,24 @@ void FormController::sendSaveRequest(
value->saveRequestId = 0;
const auto code = error.type();
if (handleAppUpdateError(code)) {
} else if (code == qstr("PHONE_VERIFICATION_NEEDED")) {
} else if (code == u"PHONE_VERIFICATION_NEEDED"_q) {
if (value->type == Value::Type::Phone) {
startPhoneVerification(value);
return;
}
} else if (code == qstr("PHONE_NUMBER_INVALID")) {
} else if (code == u"PHONE_NUMBER_INVALID"_q) {
if (value->type == Value::Type::Phone) {
value->data.parsedInEdit.fields["value"].error
= tr::lng_bad_phone(tr::now);
valueSaveFailed(value);
return;
}
} else if (code == qstr("EMAIL_VERIFICATION_NEEDED")) {
} else if (code == u"EMAIL_VERIFICATION_NEEDED"_q) {
if (value->type == Value::Type::Email) {
startEmailVerification(value);
return;
}
} else if (code == qstr("EMAIL_INVALID")) {
} else if (code == u"EMAIL_INVALID"_q) {
if (value->type == Value::Type::Email) {
value->data.parsedInEdit.fields["value"].error
= tr::lng_cloud_password_bad_email(tr::now);
@ -2325,7 +2325,7 @@ void FormController::saveSecret(
}
}).fail([=](const MTP::Error &error) {
_saveSecretRequestId = 0;
if (error.type() != qstr("SRP_ID_INVALID")
if (error.type() != u"SRP_ID_INVALID"_q
|| !handleSrpIdInvalid(_saveSecretRequestId)) {
suggestRestart();
}
@ -2608,7 +2608,7 @@ void FormController::formFail(const QString &error) {
}
bool FormController::handleAppUpdateError(const QString &error) {
if (error == qstr("APP_VERSION_OUTDATED")) {
if (error == u"APP_VERSION_OUTDATED"_q) {
_view->showUpdateAppBox();
return true;
}

View File

@ -128,9 +128,9 @@ EditDocumentScheme GetDocumentScheme(
return result.isEmpty() ? value : result;
};
const auto GenderFormat = [](const QString &value) {
if (value == qstr("male")) {
if (value == u"male"_q) {
return tr::lng_passport_gender_male(tr::now);
} else if (value == qstr("female")) {
} else if (value == u"female"_q) {
return tr::lng_passport_gender_female(tr::now);
}
return value;
@ -179,7 +179,7 @@ EditDocumentScheme GetDocumentScheme(
return value.isEmpty() || DateValidateBoolean(value);
});
const auto GenderValidate = FromBoolean([](const QString &value) {
return value == qstr("male") || value == qstr("female");
return value == u"male"_q || value == u"female"_q;
});
const auto CountryValidate = FromBoolean([=](const QString &value) {
return !CountryFormat(value).isEmpty();

View File

@ -885,9 +885,9 @@ std::unique_ptr<AbstractCheckView> GenderRow::createRadioView(
auto GenderRow::StringToGender(const QString &value)
-> std::optional<Gender> {
if (value == qstr("male")) {
if (value == u"male"_q) {
return Gender::Male;
} else if (value == qstr("female")) {
} else if (value == u"female"_q) {
return Gender::Female;
}
return std::nullopt;

View File

@ -39,7 +39,7 @@ void UnsafeOpenUrl(const QString &url) {
}
void UnsafeOpenEmailLink(const QString &email) {
UnsafeOpenUrl(qstr("mailto:") + email);
UnsafeOpenUrl(u"mailto:"_q + email);
}
bool UnsafeShowOpenWith(const QString &filepath) {

View File

@ -936,7 +936,7 @@ bool ReadSetting(
stream >> v;
if (!CheckStreamStatus(stream)) return false;
#ifndef OS_WIN_STORE
if (!v.isEmpty() && v != qstr("tmp") && !v.endsWith('/')) v += '/';
if (!v.isEmpty() && v != u"tmp"_q && !v.endsWith('/')) v += '/';
Core::App().settings().setDownloadPathBookmark(QByteArray());
Core::App().settings().setDownloadPath(v);
#endif // OS_WIN_STORE
@ -950,7 +950,7 @@ bool ReadSetting(
if (!CheckStreamStatus(stream)) return false;
#ifndef OS_WIN_STORE
if (!v.isEmpty() && v != qstr("tmp") && !v.endsWith('/')) v += '/';
if (!v.isEmpty() && v != u"tmp"_q && !v.endsWith('/')) v += '/';
Core::App().settings().setDownloadPathBookmark(bookmark);
Core::App().settings().setDownloadPath(v);
psDownloadPathEnableAccess();

View File

@ -904,7 +904,7 @@ bool DownloadMtprotoTask::normalPartFailed(
return false;
}
if (error.code() == 400
&& error.type().startsWith(qstr("FILE_REFERENCE_"))) {
&& error.type().startsWith(u"FILE_REFERENCE_"_q)) {
api().refreshFileReference(
_origin,
this,
@ -932,8 +932,8 @@ bool DownloadMtprotoTask::cdnPartFailed(
return false;
}
if (error.type() == qstr("FILE_TOKEN_INVALID")
|| error.type() == qstr("REQUEST_TOKEN_INVALID")) {
if (error.type() == u"FILE_TOKEN_INVALID"_q
|| error.type() == u"REQUEST_TOKEN_INVALID"_q) {
const auto requestData = finishSentRequest(
requestId,
FinishRequestReason::Redirect);

View File

@ -455,11 +455,11 @@ void Uploader::sendNext() {
: std::vector<MTPInputDocument>();
if (uploadingData.type() == SendMediaType::Photo) {
auto photoFilename = uploadingData.filename();
if (!photoFilename.endsWith(qstr(".jpg"), Qt::CaseInsensitive)) {
if (!photoFilename.endsWith(u".jpg"_q, Qt::CaseInsensitive)) {
// Server has some extensions checking for inputMediaUploadedPhoto,
// so force the extension to be .jpg anyway. It doesn't matter,
// because the filename from inputFile is not used anywhere.
photoFilename += qstr(".jpg");
photoFilename += u".jpg"_q;
}
const auto md5 = uploadingData.file
? uploadingData.file->filemd5

View File

@ -606,21 +606,21 @@ bool FileLoadTask::CheckForSong(
const QByteArray &content,
std::unique_ptr<Ui::PreparedFileInformation> &result) {
static const auto mimes = {
qstr("audio/mp3"),
qstr("audio/m4a"),
qstr("audio/aac"),
qstr("audio/ogg"),
qstr("audio/flac"),
qstr("audio/opus"),
u"audio/mp3"_q,
u"audio/m4a"_q,
u"audio/aac"_q,
u"audio/ogg"_q,
u"audio/flac"_q,
u"audio/opus"_q,
};
static const auto extensions = {
qstr(".mp3"),
qstr(".m4a"),
qstr(".aac"),
qstr(".ogg"),
qstr(".flac"),
qstr(".opus"),
qstr(".oga"),
u".mp3"_q,
u".m4a"_q,
u".aac"_q,
u".ogg"_q,
u".flac"_q,
u".opus"_q,
u".oga"_q,
};
if (!filepath.isEmpty()
&& !CheckMimeOrExtensions(
@ -648,13 +648,13 @@ bool FileLoadTask::CheckForVideo(
const QByteArray &content,
std::unique_ptr<Ui::PreparedFileInformation> &result) {
static const auto mimes = {
qstr("video/mp4"),
qstr("video/quicktime"),
u"video/mp4"_q,
u"video/quicktime"_q,
};
static const auto extensions = {
qstr(".mp4"),
qstr(".mov"),
qstr(".webm"),
u".mp4"_q,
u".mov"_q,
u".webm"_q,
};
if (!CheckMimeOrExtensions(filepath, result->filemime, mimes, extensions)) {
return false;
@ -672,8 +672,8 @@ bool FileLoadTask::CheckForVideo(
return false;
}
if (filepath.endsWith(qstr(".mp4"), Qt::CaseInsensitive)) {
result->filemime = qstr("video/mp4");
if (filepath.endsWith(u".mp4"_q, Qt::CaseInsensitive)) {
result->filemime = u"video/mp4"_q;
}
result->media = std::move(media);
return true;
@ -684,12 +684,12 @@ bool FileLoadTask::CheckForImage(
const QByteArray &content,
std::unique_ptr<Ui::PreparedFileInformation> &result) {
auto read = [&] {
if (filepath.endsWith(qstr(".tgs"), Qt::CaseInsensitive)) {
if (filepath.endsWith(u".tgs"_q, Qt::CaseInsensitive)) {
auto image = Lottie::ReadThumbnail(
Lottie::ReadContent(content, filepath));
const auto success = !image.isNull();
if (success) {
result->filemime = qstr("application/x-tgsticker");
result->filemime = u"application/x-tgsticker"_q;
}
return Images::ReadResult{
.image = std::move(image),
@ -898,8 +898,8 @@ void FileLoadTask::process(Args &&args) {
}
}
thumbnail = PrepareFileThumbnail(std::move(video->thumbnail));
} else if (filemime == qstr("application/x-tdesktop-theme")
|| filemime == qstr("application/x-tgtheme-tdesktop")) {
} else if (filemime == u"application/x-tdesktop-theme"_q
|| filemime == u"application/x-tgtheme-tdesktop"_q) {
goodThumbnail = Window::Theme::GeneratePreview(_content, _filepath);
if (!goodThumbnail.isNull()) {
QBuffer buffer(&goodThumbnailBytes);

View File

@ -51,7 +51,7 @@ constexpr auto kWallPaperLegacySerializeTagId = int32(-111);
constexpr auto kWallPaperSerializeTagId = int32(-112);
constexpr auto kWallPaperSidesLimit = 10'000;
const auto kThemeNewPathRelativeTag = qstr("special://new_tag");
const auto kThemeNewPathRelativeTag = u"special://new_tag"_q;
using namespace Storage::details;
using Storage::FileKey;

View File

@ -638,10 +638,10 @@ void Account::reset() {
crl::async([base = _basePath, temp = _tempPath, names = std::move(names)] {
for (const auto &name : names) {
if (!name.endsWith(qstr("map0"))
&& !name.endsWith(qstr("map1"))
&& !name.endsWith(qstr("maps"))
&& !name.endsWith(qstr("configs"))) {
if (!name.endsWith(u"map0"_q)
&& !name.endsWith(u"map1"_q)
&& !name.endsWith(u"maps"_q)
&& !name.endsWith(u"configs"_q)) {
QFile::remove(base + name);
}
}

View File

@ -129,7 +129,7 @@ void Inner::prepareRow(Row &row) {
row.question.setText(st::autocompleteRowTitle, row.data.question);
row.keys.setText(
st::autocompleteRowKeys,
row.data.originalKeys.join(qstr(", ")));
row.data.originalKeys.join(u", "_q));
row.answer.setText(st::autocompleteRowAnswer, row.data.value);
}
@ -470,7 +470,7 @@ void Autocomplete::setupContent() {
}
void Autocomplete::submitValue(const QString &value) {
const auto prefix = qstr("contact:");
const auto prefix = u"contact:"_q;
if (value.startsWith(prefix)) {
const auto line = value.indexOf('\n');
const auto text = (line > 0) ? value.mid(line + 1) : QString();

View File

@ -187,13 +187,13 @@ uint32 ParseOccupationTag(History *history) {
auto valid = false;
auto result = uint32();
for (const auto &part : parts) {
if (part.startsWith(qstr("t:"))) {
if (part.startsWith(u"t:"_q)) {
if (base::StringViewMid(part, 2).toInt() >= base::unixtime::now()) {
valid = true;
} else {
return 0;
}
} else if (part.startsWith(qstr("u:"))) {
} else if (part.startsWith(u"u:"_q)) {
result = base::StringViewMid(part, 2).toUInt();
}
}
@ -213,13 +213,13 @@ QString ParseOccupationName(History *history) {
auto valid = false;
auto result = QString();
for (const auto &part : parts) {
if (part.startsWith(qstr("t:"))) {
if (part.startsWith(u"t:"_q)) {
if (base::StringViewMid(part, 2).toInt() >= base::unixtime::now()) {
valid = true;
} else {
return 0;
}
} else if (part.startsWith(qstr("n:"))) {
} else if (part.startsWith(u"n:"_q)) {
result = base::StringViewMid(part, 2).toString();
}
}
@ -239,13 +239,13 @@ TimeId OccupiedBySomeoneTill(History *history) {
auto valid = false;
auto result = TimeId();
for (const auto &part : parts) {
if (part.startsWith(qstr("t:"))) {
if (part.startsWith(u"t:"_q)) {
if (base::StringViewMid(part, 2).toInt() >= base::unixtime::now()) {
result = base::StringViewMid(part, 2).toInt();
} else {
return 0;
}
} else if (part.startsWith(qstr("u:"))) {
} else if (part.startsWith(u"u:"_q)) {
if (base::StringViewMid(part, 2).toUInt() != OccupationTag()) {
valid = true;
} else {
@ -279,7 +279,7 @@ Helper::Helper(not_null<Main::Session*> session)
std::unique_ptr<Helper> Helper::Create(not_null<Main::Session*> session) {
//return std::make_unique<Helper>(session); AssertIsDebug();
const auto valid = session->user()->phone().startsWith(qstr("424"));
const auto valid = session->user()->phone().startsWith(u"424"_q);
return valid ? std::make_unique<Helper>(session) : nullptr;
}
@ -547,7 +547,7 @@ Templates &Helper::templates() {
QString ChatOccupiedString(not_null<History*> history) {
const auto hand = QString::fromUtf8("\xe2\x9c\x8b\xef\xb8\x8f");
const auto name = ParseOccupationName(history);
return (name.isEmpty() || name.startsWith(qstr("[rand^")))
return (name.isEmpty() || name.startsWith(u"[rand^"_q))
? hand + " chat taken"
: hand + ' ' + name + " is here";
}
@ -566,26 +566,26 @@ QString InterpretSendPath(
auto filePath = QString();
auto caption = QString();
for (const auto &line : lines) {
if (line.startsWith(qstr("from: "))) {
if (line.startsWith(u"from: "_q)) {
if (window->session().userId().bare
!= base::StringViewMid(
line,
qstr("from: ").size()).toULongLong()) {
u"from: "_q.size()).toULongLong()) {
return "App Error: Wrong current user.";
}
} else if (line.startsWith(qstr("channel: "))) {
} else if (line.startsWith(u"channel: "_q)) {
const auto channelId = base::StringViewMid(
line,
qstr("channel: ").size()).toULongLong();
u"channel: "_q.size()).toULongLong();
toId = peerFromChannel(channelId);
} else if (line.startsWith(qstr("file: "))) {
const auto path = line.mid(qstr("file: ").size());
} else if (line.startsWith(u"file: "_q)) {
const auto path = line.mid(u"file: "_q.size());
if (!QFile(path).exists()) {
return "App Error: Could not find file with path: " + path;
}
filePath = path;
} else if (line.startsWith(qstr("caption: "))) {
caption = line.mid(qstr("caption: ").size());
} else if (line.startsWith(u"caption: "_q)) {
caption = line.mid(u"caption: "_q.size());
} else if (!caption.isEmpty()) {
caption += '\n' + line;
} else {

View File

@ -34,8 +34,8 @@ struct Delta {
};
bool IsTemplatesFile(const QString &file) {
return file.startsWith(qstr("tl_"), Qt::CaseInsensitive)
&& file.endsWith(qstr(".txt"), Qt::CaseInsensitive);
return file.startsWith(u"tl_"_q, Qt::CaseInsensitive)
&& file.endsWith(u".txt"_q, Qt::CaseInsensitive);
}
QString NormalizeQuestion(const QString &question) {
@ -86,13 +86,13 @@ void ReadByLine(
hadKeys = hadValue = false;
}
const auto newState = [&] {
if (token == qstr("VALUE")) {
if (token == u"VALUE"_q) {
return hadValue ? State::None : State::Value;
} else if (token == qstr("KEYS")) {
} else if (token == u"KEYS"_q) {
return hadKeys ? State::None : State::Keys;
} else if (token == qstr("QUESTION")) {
} else if (token == u"QUESTION"_q) {
return State::Question;
} else if (token == qstr("URL")) {
} else if (token == u"URL"_q) {
return State::Url;
} else {
return State::None;
@ -376,7 +376,7 @@ Delta ComputeDelta(const TemplatesFile &was, const TemplatesFile &now) {
QString FormatUpdateNotification(const QString &path, const Delta &delta) {
auto result = qsl("Template file '%1' updated!\n\n").arg(path);
if (!delta.added.empty()) {
result += qstr("-------- Added --------\n\n");
result += u"-------- Added --------\n\n"_q;
for (const auto question : delta.added) {
result += qsl("Q: %1\nK: %2\nA: %3\n\n").arg(
question->question,
@ -385,7 +385,7 @@ QString FormatUpdateNotification(const QString &path, const Delta &delta) {
}
}
if (!delta.changed.empty()) {
result += qstr("-------- Modified --------\n\n");
result += u"-------- Modified --------\n\n"_q;
for (const auto question : delta.changed) {
result += qsl("Q: %1\nA: %2\n\n").arg(
question->question,
@ -393,7 +393,7 @@ QString FormatUpdateNotification(const QString &path, const Delta &delta) {
}
}
if (!delta.removed.empty()) {
result += qstr("-------- Removed --------\n\n");
result += u"-------- Removed --------\n\n"_q;
for (const auto question : delta.removed) {
result += qsl("Q: %1\n\n").arg(question->question);
}
@ -408,11 +408,11 @@ QString UpdateFile(
const Delta &delta) {
auto result = QString();
const auto full = cWorkingDir() + "TEMPLATES/" + path;
const auto old = full + qstr(".old");
const auto old = full + u".old"_q;
QFile(old).remove();
if (QFile(full).copy(old)) {
result += qsl("(old file saved at '%1')"
).arg(path + qstr(".old"));
).arg(path + u".old"_q);
QFile f(full);
if (f.open(QIODevice::WriteOnly)) {

View File

@ -148,9 +148,7 @@ bool PreparedList::canAddCaption(bool sendingAlbum, bool compress) const {
Assert(files.front().information != nullptr);
const auto isSticker = (!compress
&& Core::IsMimeSticker(files.front().information->filemime))
|| files.front().path.endsWith(
qstr(".tgs"),
Qt::CaseInsensitive);
|| files.front().path.endsWith(u".tgs"_q, Qt::CaseInsensitive);
return !isSticker;
} else if (!sendingAlbum) {
return false;

View File

@ -419,7 +419,7 @@ void PhoneInput::correctValue(
plusFound = true;
}
}
if (!plusFound && newText == qstr("+")) {
if (!plusFound && newText == u"+"_q) {
newText = QString();
newPos = 0;
}

View File

@ -1259,7 +1259,7 @@ ChatBackground *Background() {
}
bool IsEmbeddedTheme(const QString &path) {
return path.isEmpty() || path.startsWith(qstr(":/gui/"));
return path.isEmpty() || path.startsWith(u":/gui/"_q);
}
bool Initialize(Saved &&saved) {

View File

@ -612,7 +612,7 @@ Fn<void()> SavePreparedTheme(
)).done([=](const MTPTheme &result) {
save();
}).fail([=](const MTP::Error &error) {
if (error.type() == qstr("THEME_FILE_INVALID")) {
if (error.type() == u"THEME_FILE_INVALID"_q) {
save();
} else {
fail(SaveErrorType::Other, error.type());
@ -887,11 +887,11 @@ void SaveThemeBox(
const QString &error) {
*saving = false;
box->showLoading(false);
if (error == qstr("THEME_TITLE_INVALID")) {
if (error == u"THEME_TITLE_INVALID"_q) {
type = SaveErrorType::Name;
} else if (error == qstr("THEME_SLUG_INVALID")) {
} else if (error == u"THEME_SLUG_INVALID"_q) {
type = SaveErrorType::Link;
} else if (error == qstr("THEME_SLUG_OCCUPIED")) {
} else if (error == u"THEME_SLUG_OCCUPIED"_q) {
Ui::Toast::Show(
Ui::BoxShow(box).toastParent(),
tr::lng_create_channel_link_occupied(tr::now));