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:
@@ -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();
|
||||
}
|
||||
|
@@ -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()
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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!"
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user