2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

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

@@ -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;