2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +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

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