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

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