From 4fabb3f2a201b6799ddc093812fc57b05c64f840 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 30 Nov 2022 00:46:36 +0300 Subject: [PATCH] Replaced some qsl with u""_q literal. --- .../SourceFiles/api/api_authorizations.cpp | 4 +- Telegram/SourceFiles/apiwrap.cpp | 4 +- .../SourceFiles/boxes/add_contact_box.cpp | 10 +- Telegram/SourceFiles/boxes/connection_box.cpp | 21 +- .../SourceFiles/boxes/download_path_box.cpp | 6 +- .../SourceFiles/boxes/download_path_box.h | 2 +- .../boxes/filters/edit_filter_chats_list.cpp | 2 +- Telegram/SourceFiles/boxes/language_box.cpp | 2 +- .../boxes/peers/add_participants_box.cpp | 2 +- Telegram/SourceFiles/boxes/share_box.cpp | 8 +- Telegram/SourceFiles/boxes/stickers_box.cpp | 4 +- Telegram/SourceFiles/calls/calls_call.cpp | 8 +- Telegram/SourceFiles/calls/calls_top_bar.cpp | 2 +- .../calls/group/calls_group_call.cpp | 4 +- .../chat_helpers/emoji_sets_manager.cpp | 2 +- .../chat_helpers/field_autocomplete.cpp | 2 +- .../chat_helpers/message_field.cpp | 2 +- .../chat_helpers/spellchecker_common.cpp | 10 +- Telegram/SourceFiles/config.h | 2 +- Telegram/SourceFiles/core/application.cpp | 14 +- Telegram/SourceFiles/core/changelogs.cpp | 2 +- Telegram/SourceFiles/core/core_settings.cpp | 2 +- .../SourceFiles/core/crash_report_window.cpp | 112 ++++---- Telegram/SourceFiles/core/crash_reports.cpp | 26 +- Telegram/SourceFiles/core/file_utilities.cpp | 12 +- Telegram/SourceFiles/core/launcher.cpp | 28 +- Telegram/SourceFiles/core/sandbox.cpp | 22 +- Telegram/SourceFiles/core/shortcuts.cpp | 242 +++++++++--------- Telegram/SourceFiles/core/ui_integration.cpp | 10 +- Telegram/SourceFiles/core/update_checker.cpp | 36 +-- Telegram/SourceFiles/core/utils.cpp | 180 ++++++------- Telegram/SourceFiles/core/utils.h | 2 +- Telegram/SourceFiles/data/data_document.cpp | 46 ++-- .../data/data_document_resolver.cpp | 12 +- .../SourceFiles/data/data_media_types.cpp | 8 +- Telegram/SourceFiles/data/data_peer.cpp | 4 +- Telegram/SourceFiles/data/data_web_page.cpp | 9 +- .../dialogs/dialogs_inner_widget.cpp | 2 +- .../SourceFiles/dialogs/dialogs_widget.cpp | 2 +- .../SourceFiles/dialogs/ui/dialogs_layout.cpp | 2 +- .../export/data/export_data_types.cpp | 12 +- .../export/view/export_view_settings.cpp | 4 +- .../admin_log/history_admin_log_inner.cpp | 10 +- .../history/history_inner_widget.cpp | 10 +- Telegram/SourceFiles/history/history_item.cpp | 2 +- .../history/history_location_manager.cpp | 6 +- .../SourceFiles/history/history_service.cpp | 4 +- .../SourceFiles/history/history_widget.cpp | 8 +- .../history/view/history_view_bottom_info.cpp | 2 +- .../view/history_view_context_menu.cpp | 4 +- .../history/view/history_view_list_widget.cpp | 4 +- .../view/history_view_top_bar_widget.cpp | 2 +- .../history/view/media/history_view_file.cpp | 2 +- .../info/media/info_media_list_widget.cpp | 6 +- .../info/profile/info_profile_actions.cpp | 6 +- .../inline_bot_layout_internal.cpp | 2 +- .../inline_bots/inline_bot_result.cpp | 4 +- Telegram/SourceFiles/intro/intro_code.cpp | 6 +- Telegram/SourceFiles/intro/intro_phone.cpp | 2 +- Telegram/SourceFiles/intro/intro_start.cpp | 2 +- Telegram/SourceFiles/lang/lang_instance.cpp | 8 +- .../layout_document_generic_preview.cpp | 2 +- Telegram/SourceFiles/logs.cpp | 8 +- Telegram/SourceFiles/mainwidget.cpp | 2 +- .../media/system_media_controls_manager.cpp | 2 +- .../media/view/media_view_overlay_widget.cpp | 28 +- .../SourceFiles/mtproto/connection_http.cpp | 22 +- .../SourceFiles/mtproto/connection_tcp.cpp | 10 +- Telegram/SourceFiles/mtproto/mtp_instance.cpp | 2 +- .../mtproto/special_config_request.cpp | 26 +- .../SourceFiles/overview/overview_layout.cpp | 6 +- .../passport/passport_edit_identity_box.cpp | 6 +- .../passport/passport_form_controller.cpp | 7 +- .../passport/passport_panel_controller.cpp | 64 ++--- .../platform/linux/launcher_linux.cpp | 6 +- .../linux/linux_desktop_environment.cpp | 10 +- .../platform/linux/main_window_linux.cpp | 4 +- .../linux/notifications_manager_linux.cpp | 20 +- .../platform/linux/specific_linux.cpp | 44 ++-- .../platform/mac/file_utilities_mac.mm | 4 +- .../SourceFiles/platform/mac/launcher_mac.mm | 2 +- .../platform/mac/main_window_mac.mm | 4 +- .../SourceFiles/platform/mac/specific_mac.mm | 4 +- .../platform/mac/window_title_mac.mm | 2 +- .../SourceFiles/platform/win/launcher_win.cpp | 30 +-- .../SourceFiles/platform/win/specific_win.cpp | 16 +- .../win/windows_app_user_model_id.cpp | 2 +- Telegram/SourceFiles/settings.cpp | 4 +- .../SourceFiles/settings/settings_chat.cpp | 14 +- .../SourceFiles/settings/settings_codes.cpp | 73 +++--- .../SourceFiles/settings/settings_main.cpp | 2 +- .../settings/settings_notifications.cpp | 2 +- Telegram/SourceFiles/storage/file_upload.cpp | 2 +- .../SourceFiles/storage/localimageloader.cpp | 14 +- Telegram/SourceFiles/storage/localstorage.cpp | 14 +- .../SourceFiles/storage/storage_account.cpp | 12 +- .../SourceFiles/storage/storage_domain.cpp | 2 +- .../storage/storage_media_prepare.cpp | 2 +- .../support/support_autocomplete.cpp | 4 +- .../SourceFiles/support/support_helper.cpp | 6 +- .../SourceFiles/support/support_templates.cpp | 27 +- Telegram/SourceFiles/window/main_window.cpp | 2 +- .../window/notifications_manager.cpp | 2 +- .../window/notifications_utilities.cpp | 4 +- .../window/themes/window_theme.cpp | 4 +- .../window/themes/window_theme_editor.cpp | 4 +- .../themes/window_theme_editor_block.cpp | 2 +- .../window/themes/window_theme_editor_box.cpp | 10 +- .../SourceFiles/window/window_main_menu.cpp | 4 +- 109 files changed, 762 insertions(+), 757 deletions(-) diff --git a/Telegram/SourceFiles/api/api_authorizations.cpp b/Telegram/SourceFiles/api/api_authorizations.cpp index d37736d98..59ae1038e 100644 --- a/Telegram/SourceFiles/api/api_authorizations.cpp +++ b/Telegram/SourceFiles/api/api_authorizations.cpp @@ -34,8 +34,8 @@ Authorizations::Entry ParseEntry(const MTPDauthorization &data) { || isTest; const auto appName = isDesktop - ? QString("Telegram Desktop%1").arg(isTest ? " (GitHub)" : QString()) - : qs(data.vapp_name());// +qsl(" for ") + qs(d.vplatform()); + ? u"Telegram Desktop%1"_q.arg(isTest ? " (GitHub)" : QString()) + : qs(data.vapp_name());// + u" for "_q + qs(d.vplatform()); const auto appVer = [&] { const auto version = qs(data.vapp_version()); if (isDesktop) { diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index fa016ffb4..93d52ff6c 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -486,7 +486,7 @@ void ApiWrap::sendMessageFail( } 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"))); + session().createInternalLinkFull(u"spambot"_q)); show->showBox( Ui::MakeInformBox( tr::lng_error_public_groups_denied( @@ -734,7 +734,7 @@ QString ApiWrap::exportDirectMessageLink( if (const auto media = item->media()) { if (const auto document = media->document()) { if (document->isVideoMessage()) { - return qsl("https://telesco.pe/") + query; + return u"https://telesco.pe/"_q + query; } } } diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index d6fe2a8db..a9243a7d6 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -53,14 +53,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace { bool IsValidPhone(QString phone) { - phone = phone.replace(QRegularExpression(qsl("[^\\d]")), QString()); + phone = phone.replace(QRegularExpression(u"[^\\d]"_q), QString()); return (phone.length() >= 8) - || (phone == qsl("333")) - || (phone.startsWith(qsl("42")) + || (phone == u"333"_q) + || (phone.startsWith(u"42"_q) && (phone.length() == 2 || phone.length() == 5 || phone.length() == 6 - || phone == qsl("4242"))); + || phone == u"4242"_q)); } void ChatCreateDone( @@ -112,7 +112,7 @@ TextWithEntities PeerFloodErrorText( PeerFloodType type) { const auto link = Ui::Text::Link( tr::lng_cant_more_info(tr::now), - session->createInternalLinkFull(qsl("spambot"))); + session->createInternalLinkFull(u"spambot"_q)); return ((type == PeerFloodType::InviteGroup) ? tr::lng_cant_invite_not_contact : tr::lng_cant_send_to_not_contact)( diff --git a/Telegram/SourceFiles/boxes/connection_box.cpp b/Telegram/SourceFiles/boxes/connection_box.cpp index 7b4f14783..3170be3c3 100644 --- a/Telegram/SourceFiles/boxes/connection_box.cpp +++ b/Telegram/SourceFiles/boxes/connection_box.cpp @@ -1092,17 +1092,17 @@ ProxiesBoxController::ProxiesBoxController(not_null account) void ProxiesBoxController::ShowApplyConfirmation( Type type, const QMap &fields) { - const auto server = fields.value(qsl("server")); - const auto port = fields.value(qsl("port")).toUInt(); + const auto server = fields.value(u"server"_q); + const auto port = fields.value(u"port"_q).toUInt(); auto proxy = ProxyData(); proxy.type = type; proxy.host = server; proxy.port = port; if (type == Type::Socks5) { - proxy.user = fields.value(qsl("user")); - proxy.password = fields.value(qsl("pass")); + proxy.user = fields.value(u"user"_q); + proxy.password = fields.value(u"pass"_q); } else if (type == Type::Mtproto) { - proxy.password = fields.value(qsl("secret")); + proxy.password = fields.value(u"secret"_q); } if (proxy) { const auto displayed = "https://" + server + "/"; @@ -1504,12 +1504,9 @@ void ProxiesBoxController::updateView(const Item &item) { const auto deleted = item.deleted; const auto type = [&] { switch (item.data.type) { - case Type::Http: - return qsl("HTTP"); - case Type::Socks5: - return qsl("SOCKS5"); - case Type::Mtproto: - return qsl("MTPROTO"); + case Type::Http: return u"HTTP"_q; + case Type::Socks5: return u"SOCKS5"_q; + case Type::Mtproto: return u"MTPROTO"_q; } Unexpected("Proxy type in ProxiesBoxController::updateView."); }(); @@ -1541,7 +1538,7 @@ void ProxiesBoxController::share(const ProxyData &proxy) { if (proxy.type == Type::Http) { return; } - const auto link = qsl("https://t.me/") + const auto link = u"https://t.me/"_q + (proxy.type == Type::Socks5 ? "socks" : "proxy") + "?server=" + proxy.host + "&port=" + QString::number(proxy.port) + ((proxy.type == Type::Socks5 && !proxy.user.isEmpty()) diff --git a/Telegram/SourceFiles/boxes/download_path_box.cpp b/Telegram/SourceFiles/boxes/download_path_box.cpp index 16d4d843a..8f28d96a8 100644 --- a/Telegram/SourceFiles/boxes/download_path_box.cpp +++ b/Telegram/SourceFiles/boxes/download_path_box.cpp @@ -40,7 +40,7 @@ void DownloadPathBox::prepare() { _group->setChangedCallback([this](Directory value) { radioChanged(value); }); _pathLink->addClickHandler([=] { editPath(); }); - if (!_path.isEmpty() && _path != qsl("tmp")) { + if (!_path.isEmpty() && _path != u"tmp"_q) { setPathText(QDir::toNativeSeparators(_path)); } updateControlsVisibility(); @@ -73,14 +73,14 @@ void DownloadPathBox::resizeEvent(QResizeEvent *e) { void DownloadPathBox::radioChanged(Directory value) { if (value == Directory::Custom) { - if (_path.isEmpty() || _path == qsl("tmp")) { + if (_path.isEmpty() || _path == u"tmp"_q) { _group->setValue(_path.isEmpty() ? Directory::Downloads : Directory::Temp); editPath(); } else { setPathText(QDir::toNativeSeparators(_path)); } } else if (value == Directory::Temp) { - _path = qsl("tmp"); + _path = u"tmp"_q; } else { _path = QString(); } diff --git a/Telegram/SourceFiles/boxes/download_path_box.h b/Telegram/SourceFiles/boxes/download_path_box.h index 65f7ba7dd..43d04cd4a 100644 --- a/Telegram/SourceFiles/boxes/download_path_box.h +++ b/Telegram/SourceFiles/boxes/download_path_box.h @@ -42,7 +42,7 @@ private: Directory typeFromPath(const QString &path) { if (path.isEmpty()) { return Directory::Downloads; - } else if (path == qsl("tmp")) { + } else if (path == u"tmp"_q) { return Directory::Temp; } return Directory::Custom; diff --git a/Telegram/SourceFiles/boxes/filters/edit_filter_chats_list.cpp b/Telegram/SourceFiles/boxes/filters/edit_filter_chats_list.cpp index 54dd7898d..5874ab873 100644 --- a/Telegram/SourceFiles/boxes/filters/edit_filter_chats_list.cpp +++ b/Telegram/SourceFiles/boxes/filters/edit_filter_chats_list.cpp @@ -463,6 +463,6 @@ auto EditFilterChatsListController::createRow(not_null history) void EditFilterChatsListController::updateTitle() { const auto count = delegate()->peerListSelectedRowsCount() - selectedTypesCount(); - const auto additional = qsl("%1 / %2").arg(count).arg(_limit); + const auto additional = u"%1 / %2"_q.arg(count).arg(_limit); delegate()->peerListSetAdditionalTitle(rpl::single(additional)); } diff --git a/Telegram/SourceFiles/boxes/language_box.cpp b/Telegram/SourceFiles/boxes/language_box.cpp index 41e662824..f1dba4f8a 100644 --- a/Telegram/SourceFiles/boxes/language_box.cpp +++ b/Telegram/SourceFiles/boxes/language_box.cpp @@ -416,7 +416,7 @@ bool Rows::hasMenu(not_null row) const { } void Rows::share(not_null row) const { - const auto link = qsl("https://t.me/setlanguage/") + row->data.id; + const auto link = u"https://t.me/setlanguage/"_q + row->data.id; QGuiApplication::clipboard()->setText(link); Ui::Toast::Show(tr::lng_username_copied(tr::now)); } diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp index 419e9cf2d..27d1d1589 100644 --- a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp @@ -166,7 +166,7 @@ void AddParticipantsBoxController::updateTitle() { && _peer->isChannel() && !_peer->isMegagroup()) ? QString() - : qsl("%1 / %2" + : (u"%1 / %2"_q ).arg(fullCount() ).arg(session().serverConfig().megagroupSizeMax); delegate()->peerListSetTitle(tr::lng_profile_add_participant()); diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index bb33abb4a..40009beb2 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -693,7 +693,7 @@ ShareBox::Inner::Inner( } addList(_descriptor.session->data().contactsNoChatsList()); - _filter = qsl("a"); + _filter = u"a"_q; updateFilter(); _descriptor.session->changes().peerUpdates( @@ -1325,9 +1325,9 @@ QString AppendShareGameScoreUrl( } auto shareHash = shareHashEncrypted.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals); - auto shareUrl = qsl("tg://share_game_score?hash=") + QString::fromLatin1(shareHash); + auto shareUrl = u"tg://share_game_score?hash="_q + QString::fromLatin1(shareHash); - auto shareComponent = qsl("tgShareScoreUrl=") + qthelp::url_encode(shareUrl); + auto shareComponent = u"tgShareScoreUrl="_q + qthelp::url_encode(shareUrl); auto hashPosition = url.indexOf('#'); if (hashPosition < 0) { @@ -1391,7 +1391,7 @@ void FastShareMessage( if (const auto media = item->media()) { if (const auto game = media->game()) { const auto link = session->createInternalLinkFull( - bot->username() + qsl("?game=") + game->shortName); + bot->username() + u"?game="_q + game->shortName); QGuiApplication::clipboard()->setText(link); diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index 8ce42517d..0886dd768 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -1179,13 +1179,13 @@ StickersBox::Inner::Inner( , _megagroupSetField( this, st::groupStickersField, - rpl::single(qsl("stickerset")), + rpl::single(u"stickerset"_q), QString(), _controller->session().createInternalLink(QString())) , _megagroupDivider(this) , _megagroupSubTitle(this, tr::lng_stickers_group_from_your(tr::now), st::boxTitle) { _megagroupSetField->setLinkPlaceholder( - _controller->session().createInternalLink(qsl("addstickers/"))); + _controller->session().createInternalLink(u"addstickers/"_q)); _megagroupSetField->setPlaceholderHidden(false); _megagroupSetAddressChangedTimer.setCallback([this] { handleMegagroupSetAddressChange(); }); connect( diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index 6894d5d90..64fa5d98a 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -500,8 +500,8 @@ void Call::startWaitingTrack() { _waitingTrack = Media::Audio::Current().createTrack(); const auto trackFileName = Core::App().settings().getSoundPath( (_type == Type::Outgoing) - ? qsl("call_outgoing") - : qsl("call_incoming")); + ? u"call_outgoing"_q + : u"call_incoming"_q); _waitingTrack->samplePeakEach(kSoundSampleMs); _waitingTrack->fillFromFile(trackFileName); _waitingTrack->playInLoop(); @@ -893,8 +893,8 @@ void Call::createAndStartController(const MTPDphoneCall &call) { settings.callAudioBackend()), }; if (Logs::DebugEnabled()) { - const auto callLogFolder = cWorkingDir() + qsl("DebugLogs"); - const auto callLogPath = callLogFolder + qsl("/last_call_log.txt"); + const auto callLogFolder = cWorkingDir() + u"DebugLogs"_q; + const auto callLogPath = callLogFolder + u"/last_call_log.txt"_q; const auto callLogNative = QDir::toNativeSeparators(callLogPath); #ifdef Q_OS_WIN descriptor.config.logPath.data = callLogNative.toStdWString(); diff --git a/Telegram/SourceFiles/calls/calls_top_bar.cpp b/Telegram/SourceFiles/calls/calls_top_bar.cpp index 93012c43c..dc82be644 100644 --- a/Telegram/SourceFiles/calls/calls_top_bar.cpp +++ b/Telegram/SourceFiles/calls/calls_top_bar.cpp @@ -147,7 +147,7 @@ DebugInfoBox::DebugInfoBox(QWidget*, base::weak_ptr call) } void DebugInfoBox::prepare() { - setTitle(rpl::single(qsl("Call Debug"))); + setTitle(rpl::single(u"Call Debug"_q)); addButton(tr::lng_close(), [this] { closeBox(); }); _text = setInnerWidget( diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index d4d9f17af..f62573c90 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -2427,8 +2427,8 @@ bool GroupCall::tryCreateController() { }, }; if (Logs::DebugEnabled()) { - auto callLogFolder = cWorkingDir() + qsl("DebugLogs"); - auto callLogPath = callLogFolder + qsl("/last_group_call_log.txt"); + auto callLogFolder = cWorkingDir() + u"DebugLogs"_q; + auto callLogPath = callLogFolder + u"/last_group_call_log.txt"_q; auto callLogNative = QDir::toNativeSeparators(callLogPath); descriptor.config.need_log = true; #ifdef Q_OS_WIN diff --git a/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp b/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp index 1b3f24d36..4c1e58044 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp @@ -36,7 +36,7 @@ struct Set : public Blob { }; inline auto PreviewPath(int i) { - return qsl(":/gui/emoji/set%1_preview.webp").arg(i); + return u":/gui/emoji/set%1_preview.webp"_q.arg(i); } const auto kSets = { diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp index 5417dee12..477937cd1 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp @@ -693,7 +693,7 @@ void FieldAutocomplete::hideAnimated() { void FieldAutocomplete::hideFinish() { hide(); _hiding = false; - _filter = qsl("-"); + _filter = u"-"_q; _inner->clearSel(true); } diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index f5c21ae72..3891ab82b 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -225,7 +225,7 @@ void EditLinkBox( TextWithEntities StripSupportHashtag(TextWithEntities &&text) { static const auto expression = QRegularExpression( - qsl("\\n?#tsf[a-z0-9_-]*[\\s#a-z0-9_-]*$"), + u"\\n?#tsf[a-z0-9_-]*[\\s#a-z0-9_-]*$"_q, QRegularExpression::CaseInsensitiveOption); const auto match = expression.match(text.text); if (!match.hasMatch()) { diff --git a/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp b/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp index c6e1186c9..42b980f93 100644 --- a/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp +++ b/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp @@ -245,13 +245,13 @@ MTP::DedicatedLoader::Location GetDownloadLocation(int id) { QString DictPathByLangId(int langId) { EnsurePath(); - return qsl("%1/%2").arg( + return u"%1/%2"_q.arg( DictionariesPath(), Spellchecker::LocaleFromLangId(langId).name()); } QString DictionariesPath() { - return cWorkingDir() + qsl("tdata/dictionaries"); + return cWorkingDir() + u"tdata/dictionaries"_q; } bool UnpackDictionary(const QString &path, int langId) { @@ -275,7 +275,7 @@ bool RemoveDictionary(int langId) { return true; } const auto fileName = Spellchecker::LocaleFromLangId(langId).name(); - const auto folder = qsl("%1/%2/").arg( + const auto folder = u"%1/%2/"_q.arg( DictionariesPath(), fileName); return QDir(folder).removeRecursively(); @@ -288,14 +288,14 @@ bool WriteDefaultDictionary() { return false; } const auto fileName = QLocale(en).name(); - const auto folder = qsl("%1/%2/").arg( + const auto folder = u"%1/%2/"_q.arg( DictionariesPath(), fileName); QDir(folder).removeRecursively(); const auto path = folder + fileName; QDir().mkpath(folder); - auto input = QFile(qsl(":/misc/en_US_dictionary")); + auto input = QFile(u":/misc/en_US_dictionary"_q); auto output = QFile(path); if (input.open(QIODevice::ReadOnly) && output.open(QIODevice::WriteOnly)) { diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index e034a118e..5dc8b7ce7 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -108,7 +108,7 @@ static const char *AlphaPrivateKey = ""; extern QString gKeyFile; inline const QString &cDataFile() { if (!gKeyFile.isEmpty()) return gKeyFile; - static const QString res(qsl("data")); + static const QString res(u"data"_q); return res; } diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index 50e89c79f..a85181034 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -290,7 +290,7 @@ void Application::run() { DEBUG_LOG(("Application Info: starting app...")); // Create mime database, so it won't be slow later. - QMimeDatabase().mimeTypeForName(qsl("text/plain")); + QMimeDatabase().mimeTypeForName(u"text/plain"_q); _primaryWindow = std::make_unique(); _lastActiveWindow = _primaryWindow.get(); @@ -863,10 +863,10 @@ void Application::switchDebugMode() { void Application::switchFreeType() { if (cUseFreeType()) { - QFile(cWorkingDir() + qsl("tdata/withfreetype")).remove(); + QFile(cWorkingDir() + u"tdata/withfreetype"_q).remove(); cSetUseFreeType(false); } else { - QFile f(cWorkingDir() + qsl("tdata/withfreetype")); + QFile f(cWorkingDir() + u"tdata/withfreetype"_q); if (f.open(QIODevice::WriteOnly)) { f.write("1"); f.close(); @@ -1471,11 +1471,11 @@ void Application::RegisterUrlScheme() { base::Platform::RegisterUrlScheme(base::Platform::UrlSchemeDescriptor{ .executable = cExeDir() + cExeName(), .arguments = Sandbox::Instance().customWorkingDir() - ? qsl("-workdir \"%1\"").arg(cWorkingDir()) + ? u"-workdir \"%1\""_q.arg(cWorkingDir()) : QString(), - .protocol = qsl("tg"), - .protocolName = qsl("Telegram Link"), - .shortAppName = qsl("tdesktop"), + .protocol = u"tg"_q, + .protocolName = u"Telegram Link"_q, + .shortAppName = u"tdesktop"_q, .longAppName = QCoreApplication::applicationName(), .displayAppName = AppName.utf16(), .displayAppDescription = AppName.utf16(), diff --git a/Telegram/SourceFiles/core/changelogs.cpp b/Telegram/SourceFiles/core/changelogs.cpp index 0c6068539..d2b39b791 100644 --- a/Telegram/SourceFiles/core/changelogs.cpp +++ b/Telegram/SourceFiles/core/changelogs.cpp @@ -180,7 +180,7 @@ void Changelogs::addBetaLog(int changeVersion, const char *changes) { return result.replace(simple, separator); }(); const auto version = FormatVersionDisplay(changeVersion); - const auto log = qsl("New in version %1 beta:\n\n").arg(version) + text; + const auto log = u"New in version %1 beta:\n\n"_q.arg(version) + text; addLocalLog(log); } diff --git a/Telegram/SourceFiles/core/core_settings.cpp b/Telegram/SourceFiles/core/core_settings.cpp index f0ef543f5..c36c39c62 100644 --- a/Telegram/SourceFiles/core/core_settings.cpp +++ b/Telegram/SourceFiles/core/core_settings.cpp @@ -739,7 +739,7 @@ QString Settings::getSoundPath(const QString &key) const { if (it != _soundOverrides.end()) { return it->second; } - return qsl(":/sounds/") + key + qsl(".mp3"); + return u":/sounds/"_q + key + u".mp3"_q; } void Settings::setTabbedSelectorSectionEnabled(bool enabled) { diff --git a/Telegram/SourceFiles/core/crash_report_window.cpp b/Telegram/SourceFiles/core/crash_report_window.cpp index 60826a86a..e848b41bf 100644 --- a/Telegram/SourceFiles/core/crash_report_window.cpp +++ b/Telegram/SourceFiles/core/crash_report_window.cpp @@ -37,7 +37,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) { setWindowIcon(Window::CreateIcon()); setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); - setWindowTitle(title.isEmpty() ? qsl("Telegram") : title); + setWindowTitle(title.isEmpty() ? u"Telegram"_q : title); QPalette p(palette()); p.setColor(QPalette::Window, QColor(255, 255, 255)); @@ -48,7 +48,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) { int paddingVertical = (_size / 2); int paddingHorizontal = _size; int borderRadius = (_size / 5); - setStyleSheet(qsl("QPushButton { padding: %1px %2px; background-color: #ffffff; border-radius: %3px; }\nQPushButton#confirm:hover, QPushButton#cancel:hover { background-color: #e3f1fa; color: #2f9fea; }\nQPushButton#confirm { color: #2f9fea; }\nQPushButton#cancel { color: #aeaeae; }\nQLineEdit { border: 1px solid #e0e0e0; padding: 5px; }\nQLineEdit:focus { border: 2px solid #37a1de; padding: 4px; }").arg(paddingVertical).arg(paddingHorizontal).arg(borderRadius)); + setStyleSheet(u"QPushButton { padding: %1px %2px; background-color: #ffffff; border-radius: %3px; }\nQPushButton#confirm:hover, QPushButton#cancel:hover { background-color: #e3f1fa; color: #2f9fea; }\nQPushButton#confirm { color: #2f9fea; }\nQPushButton#cancel { color: #aeaeae; }\nQLineEdit { border: 1px solid #e0e0e0; padding: 5px; }\nQLineEdit:focus { border: 2px solid #37a1de; padding: 4px; }"_q.arg(paddingVertical).arg(paddingHorizontal).arg(borderRadius)); if (!PreLaunchWindowInstance) { PreLaunchWindowInstance = this; } @@ -179,12 +179,12 @@ NotStartedWindow::NotStartedWindow() : _label(this) , _log(this) , _close(this) { - _label.setText(qsl("Could not start Telegram Desktop!\nYou can see complete log below:")); + _label.setText(u"Could not start Telegram Desktop!\nYou can see complete log below:"_q); _log.setPlainText(Logs::full()); connect(&_close, &QPushButton::clicked, [=] { close(); }); - _close.setText(qsl("CLOSE")); + _close.setText(u"CLOSE"_q); QRect scr(QApplication::primaryScreen()->availableGeometry()); move(scr.x() + (scr.width() / 6), scr.y() + (scr.height() / 6)); @@ -261,9 +261,9 @@ LastCrashedWindow::LastCrashedWindow( } if (_sendingState != SendingNoReport) { qint64 dumpsize = 0; - QString dumpspath = cWorkingDir() + qsl("tdata/dumps"); + QString dumpspath = cWorkingDir() + u"tdata/dumps"_q; #if defined Q_OS_MAC && !defined MAC_USE_BREAKPAD - dumpspath += qsl("/completed"); + dumpspath += u"/completed"_q; #endif QString possibleDump = getReportField(qstr("minidump"), qstr("Minidump:")); if (!possibleDump.isEmpty()) { @@ -271,7 +271,7 @@ LastCrashedWindow::LastCrashedWindow( possibleDump = dumpspath + '/' + possibleDump; } if (!possibleDump.endsWith(qstr(".dmp"))) { - possibleDump += qsl(".dmp"); + possibleDump += u".dmp"_q; } QFileInfo possibleInfo(possibleDump); if (possibleInfo.exists()) { @@ -282,7 +282,7 @@ LastCrashedWindow::LastCrashedWindow( } if (_minidumpFull.isEmpty()) { QString maxDump, maxDumpFull; - QDateTime maxDumpModified, workingModified = QFileInfo(cWorkingDir() + qsl("tdata/working")).lastModified(); + QDateTime maxDumpModified, workingModified = QFileInfo(cWorkingDir() + u"tdata/working"_q).lastModified(); QFileInfoList list = QDir(dumpspath).entryInfoList(); for (int32 i = 0, l = list.size(); i < l; ++i) { QString name = list.at(i).fileName(); @@ -304,36 +304,36 @@ LastCrashedWindow::LastCrashedWindow( if (_minidumpName.isEmpty()) { // currently don't accept crash reports without dumps from google libraries _sendingState = SendingNoReport; } else { - _minidump.setText(qsl("+ %1 (%2 KB)").arg(_minidumpName).arg(dumpsize / 1024)); + _minidump.setText(u"+ %1 (%2 KB)"_q.arg(_minidumpName).arg(dumpsize / 1024)); } } if (_sendingState != SendingNoReport) { QString version = getReportField(qstr("version"), qstr("Version:")); - QString current = cAlphaVersion() ? qsl("-%1").arg(cAlphaVersion()) : QString::number(AppVersion); + QString current = cAlphaVersion() ? u"-%1"_q.arg(cAlphaVersion()) : QString::number(AppVersion); if (version != current) { // currently don't accept crash reports from not current app version _sendingState = SendingNoReport; } } - _networkSettings.setText(qsl("NETWORK SETTINGS")); + _networkSettings.setText(u"NETWORK SETTINGS"_q); connect( &_networkSettings, &QPushButton::clicked, [=] { networkSettings(); }); if (_sendingState == SendingNoReport) { - _label.setText(qsl("Last time Telegram Desktop was not closed properly.")); + _label.setText(u"Last time Telegram Desktop was not closed properly."_q); } else { - _label.setText(qsl("Last time Telegram Desktop crashed :(")); + _label.setText(u"Last time Telegram Desktop crashed :("_q); } if (_updaterData) { - _updaterData->check.setText(qsl("TRY AGAIN")); + _updaterData->check.setText(u"TRY AGAIN"_q); connect( &_updaterData->check, &QPushButton::clicked, [=] { updateRetry(); }); - _updaterData->skip.setText(qsl("SKIP")); + _updaterData->skip.setText(u"SKIP"_q); connect( &_updaterData->skip, &QPushButton::clicked, @@ -393,39 +393,39 @@ LastCrashedWindow::LastCrashedWindow( cSetLastUpdateCheck(0); checker.start(); } else { - _updating.setText(qsl("Please check if there is a new version available.")); + _updating.setText(u"Please check if there is a new version available."_q); if (_sendingState != SendingNoReport) { _sendingState = SendingNone; } } - _pleaseSendReport.setText(qsl("Please send us a crash report.")); - _yourReportName.setText(qsl("Your Report Tag: %1\nYour User Tag: %2").arg(QString(_minidumpName).replace(".dmp", "")).arg(launcher->installationTag(), 0, 16)); + _pleaseSendReport.setText(u"Please send us a crash report."_q); + _yourReportName.setText(u"Your Report Tag: %1\nYour User Tag: %2"_q.arg(QString(_minidumpName).replace(".dmp", "")).arg(launcher->installationTag(), 0, 16)); _yourReportName.setCursor(style::cur_text); _yourReportName.setTextInteractionFlags(Qt::TextSelectableByMouse); - _includeUsername.setText(qsl("Include username @%1 as your contact info").arg(_reportUsername)); + _includeUsername.setText(u"Include username @%1 as your contact info"_q.arg(_reportUsername)); _report.setPlainText(_reportTextNoUsername); - _showReport.setText(qsl("VIEW REPORT")); + _showReport.setText(u"VIEW REPORT"_q); connect(&_showReport, &QPushButton::clicked, [=] { _reportShown = !_reportShown; updateControls(); }); - _saveReport.setText(qsl("SAVE TO FILE")); + _saveReport.setText(u"SAVE TO FILE"_q); connect(&_saveReport, &QPushButton::clicked, [=] { saveReport(); }); - _getApp.setText(qsl("GET THE LATEST OFFICIAL VERSION OF TELEGRAM DESKTOP")); + _getApp.setText(u"GET THE LATEST OFFICIAL VERSION OF TELEGRAM DESKTOP"_q); connect(&_getApp, &QPushButton::clicked, [=] { - QDesktopServices::openUrl(qsl("https://desktop.telegram.org")); + QDesktopServices::openUrl(u"https://desktop.telegram.org"_q); }); - _send.setText(qsl("SEND CRASH REPORT")); + _send.setText(u"SEND CRASH REPORT"_q); connect(&_send, &QPushButton::clicked, [=] { sendReport(); }); - _sendSkip.setText(qsl("SKIP")); + _sendSkip.setText(u"SKIP"_q); connect(&_sendSkip, &QPushButton::clicked, [=] { processContinue(); }); - _continue.setText(qsl("CONTINUE")); + _continue.setText(u"CONTINUE"_q); connect(&_continue, &QPushButton::clicked, [=] { processContinue(); }); QRect scr(QApplication::primaryScreen()->availableGeometry()); @@ -435,7 +435,7 @@ LastCrashedWindow::LastCrashedWindow( } void LastCrashedWindow::saveReport() { - QString to = QFileDialog::getSaveFileName(0, qsl("Telegram Crash Report"), QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + qsl("/report.telegramcrash"), qsl("Telegram crash report (*.telegramcrash)")); + QString to = QFileDialog::getSaveFileName(0, u"Telegram Crash Report"_q, QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + u"/report.telegramcrash"_q, u"Telegram crash report (*.telegramcrash)"_q); if (!to.isEmpty()) { QFile file(to); if (file.open(QIODevice::WriteOnly)) { @@ -450,7 +450,7 @@ QByteArray LastCrashedWindow::getCrashReportRaw() const { auto result = _dumpraw; if (!_reportUsername.isEmpty() && _includeUsername.checkState() != Qt::Checked) { result.replace( - (qsl("Username: ") + _reportUsername).toUtf8(), + (u"Username: "_q + _reportUsername).toUtf8(), "Username: _not_included_"); } return result; @@ -477,9 +477,9 @@ QString LastCrashedWindow::getReportField(const QLatin1String &name, const QLati if (name == qstr("version")) { if (data.endsWith(qstr(" alpha"))) { - data = QString::number(-data.replace(QRegularExpression(qsl("[^\\d]")), "").toLongLong()); + data = QString::number(-data.replace(QRegularExpression(u"[^\\d]"_q), "").toLongLong()); } else { - data = QString::number(data.replace(QRegularExpression(qsl("[^\\d]")), "").toLongLong()); + data = QString::number(data.replace(QRegularExpression(u"[^\\d]"_q), "").toLongLong()); } } @@ -493,7 +493,7 @@ void LastCrashedWindow::addReportFieldPart(const QLatin1String &name, const QLat QString data = getReportField(name, prefix); if (!data.isEmpty()) { QHttpPart reportPart; - reportPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(qsl("form-data; name=\"%1\"").arg(name))); + reportPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(u"form-data; name=\"%1\""_q.arg(name))); reportPart.setBody(data.toUtf8()); multipart->append(reportPart); } @@ -510,7 +510,7 @@ void LastCrashedWindow::sendReport() { } QString apiid = getReportField(qstr("apiid"), qstr("ApiId:")), version = getReportField(qstr("version"), qstr("Version:")); - _checkReply = _sendManager.get(QNetworkRequest(qsl("https://tdesktop.com/crash.php?act=query_report&apiid=%1&version=%2&dmp=%3&platform=%4").arg( + _checkReply = _sendManager.get(QNetworkRequest(u"https://tdesktop.com/crash.php?act=query_report&apiid=%1&version=%2&dmp=%3&platform=%4"_q.arg( apiid, version, QString::number(minidumpFileName().isEmpty() ? 0 : 1), @@ -525,7 +525,7 @@ void LastCrashedWindow::sendReport() { &QNetworkReply::finished, [=] { checkingFinished(); }); - _pleaseSendReport.setText(qsl("Sending crash report...")); + _pleaseSendReport.setText(u"Sending crash report..."_q); _sendingState = SendingProgress; _reportShown = false; updateControls(); @@ -534,7 +534,7 @@ void LastCrashedWindow::sendReport() { QString LastCrashedWindow::minidumpFileName() { QFileInfo dmpFile(_minidumpFull); if (dmpFile.exists() && dmpFile.size() > 0 && dmpFile.size() < 20 * 1024 * 1024 && - QRegularExpression(qsl("^[a-zA-Z0-9\\-]{1,64}\\.dmp$")).match(dmpFile.fileName()).hasMatch()) { + QRegularExpression(u"^[a-zA-Z0-9\\-]{1,64}\\.dmp$"_q).match(dmpFile.fileName()).hasMatch()) { return dmpFile.fileName(); } return QString(); @@ -550,17 +550,17 @@ void LastCrashedWindow::checkingFinished() { LOG(("Crash report check for sending done, result: %1").arg(QString::fromUtf8(result))); if (result == "Old") { - _pleaseSendReport.setText(qsl("This report is about some old version of Telegram Desktop.")); + _pleaseSendReport.setText(u"This report is about some old version of Telegram Desktop."_q); _sendingState = SendingTooOld; updateControls(); return; } else if (result == "Unofficial") { - _pleaseSendReport.setText(qsl("You use some custom version of Telegram Desktop.")); + _pleaseSendReport.setText(u"You use some custom version of Telegram Desktop."_q); _sendingState = SendingUnofficial; updateControls(); return; } else if (result != "Report") { - _pleaseSendReport.setText(qsl("Thank you for your report!")); + _pleaseSendReport.setText(u"Thank you for your report!"_q); _sendingState = SendingDone; updateControls(); @@ -600,16 +600,16 @@ void LastCrashedWindow::checkingFinished() { if (minidumpZip.error() == ZIP_OK) { QHttpPart dumpPart; dumpPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/octet-stream")); - dumpPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(qsl("form-data; name=\"dump\"; filename=\"%1\"").arg(zipName))); + dumpPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(u"form-data; name=\"dump\"; filename=\"%1\""_q.arg(zipName))); dumpPart.setBody(minidumpZip.result()); multipart->append(dumpPart); - _minidump.setText(qsl("+ %1 (%2 KB)").arg(zipName).arg(minidumpZip.result().size() / 1024)); + _minidump.setText(u"+ %1 (%2 KB)"_q.arg(zipName).arg(minidumpZip.result().size() / 1024)); } } } - _sendReply = _sendManager.post(QNetworkRequest(qsl("https://tdesktop.com/crash.php?act=report")), multipart); + _sendReply = _sendManager.post(QNetworkRequest(u"https://tdesktop.com/crash.php?act=report"_q), multipart); multipart->setParent(_sendReply); connect( @@ -843,7 +843,7 @@ void LastCrashedWindow::updateControls() { h += _networkSettings.height() + padding; } - QSize s(2 * padding + QFontMetrics(_label.font()).horizontalAdvance(qsl("Last time Telegram Desktop was not closed properly.")) + padding + _networkSettings.width(), h); + QSize s(2 * padding + QFontMetrics(_label.font()).horizontalAdvance(u"Last time Telegram Desktop was not closed properly."_q) + padding + _networkSettings.width(), h); if (s == size()) { resizeEvent(0); } else { @@ -896,7 +896,7 @@ void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) { _updaterData->state = state; switch (state) { case UpdatingLatest: - _updating.setText(qsl("Latest version is installed.")); + _updating.setText(u"Latest version is installed."_q); if (_sendingState == SendingNoReport) { InvokeQueued(this, [=] { processContinue(); }); } else { @@ -914,10 +914,10 @@ void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) { } break; case UpdatingCheck: - _updating.setText(qsl("Checking for updates...")); + _updating.setText(u"Checking for updates..."_q); break; case UpdatingFail: - _updating.setText(qsl("Update check failed :(")); + _updating.setText(u"Update check failed :("_q); break; } updateControls(); @@ -930,7 +930,7 @@ void LastCrashedWindow::setDownloadProgress(qint64 ready, qint64 total) { qint64 readyTenthMb = (ready * 10 / (1024 * 1024)), totalTenthMb = (total * 10 / (1024 * 1024)); QString readyStr = QString::number(readyTenthMb / 10) + '.' + QString::number(readyTenthMb % 10); QString totalStr = QString::number(totalTenthMb / 10) + '.' + QString::number(totalTenthMb % 10); - QString res = qsl("Downloading update {ready} / {total} MB..").replace(qstr("{ready}"), readyStr).replace(qstr("{total}"), totalStr); + QString res = u"Downloading update {ready} / {total} MB.."_q.replace(qstr("{ready}"), readyStr).replace(qstr("{total}"), totalStr); if (_updaterData->newVersionDownload != res) { _updaterData->newVersionDownload = res; _updating.setText(_updaterData->newVersionDownload); @@ -970,7 +970,7 @@ void LastCrashedWindow::processContinue() { void LastCrashedWindow::sendingError(QNetworkReply::NetworkError e) { LOG(("Crash report sending error: %1").arg(e)); - _pleaseSendReport.setText(qsl("Sending crash report failed :(")); + _pleaseSendReport.setText(u"Sending crash report failed :("_q); _sendingState = SendingFail; if (_checkReply) { _checkReply->deleteLater(); @@ -990,7 +990,7 @@ void LastCrashedWindow::sendingFinished() { _sendReply->deleteLater(); _sendReply = nullptr; - _pleaseSendReport.setText(qsl("Thank you for your report!")); + _pleaseSendReport.setText(u"Thank you for your report!"_q); _sendingState = SendingDone; updateControls(); @@ -1003,9 +1003,9 @@ void LastCrashedWindow::sendingProgress(qint64 uploaded, qint64 total) { _sendingState = SendingUploading; if (total < 0) { - _pleaseSendReport.setText(qsl("Sending crash report %1 KB...").arg(uploaded / 1024)); + _pleaseSendReport.setText(u"Sending crash report %1 KB..."_q.arg(uploaded / 1024)); } else { - _pleaseSendReport.setText(qsl("Sending crash report %1 / %2 KB...").arg(uploaded / 1024).arg(total / 1024)); + _pleaseSendReport.setText(u"Sending crash report %1 / %2 KB..."_q.arg(uploaded / 1024).arg(total / 1024)); } updateControls(); } @@ -1076,7 +1076,7 @@ void LastCrashedWindow::resizeEvent(QResizeEvent *e) { } NetworkSettingsWindow::NetworkSettingsWindow(QWidget *parent, QString host, quint32 port, QString username, QString password) -: PreLaunchWindow(qsl("HTTP Proxy Settings")) +: PreLaunchWindow(u"HTTP Proxy Settings"_q) , _hostLabel(this) , _portLabel(this) , _usernameLabel(this) @@ -1090,14 +1090,14 @@ NetworkSettingsWindow::NetworkSettingsWindow(QWidget *parent, QString host, quin , _parent(parent) { setWindowModality(Qt::ApplicationModal); - _hostLabel.setText(qsl("Hostname")); - _portLabel.setText(qsl("Port")); - _usernameLabel.setText(qsl("Username")); - _passwordLabel.setText(qsl("Password")); + _hostLabel.setText(u"Hostname"_q); + _portLabel.setText(u"Port"_q); + _usernameLabel.setText(u"Username"_q); + _passwordLabel.setText(u"Password"_q); - _save.setText(qsl("SAVE")); + _save.setText(u"SAVE"_q); connect(&_save, &QPushButton::clicked, [=] { save(); }); - _cancel.setText(qsl("CANCEL")); + _cancel.setText(u"CANCEL"_q); connect(&_cancel, &QPushButton::clicked, [=] { close(); }); _hostInput.setText(host); diff --git a/Telegram/SourceFiles/core/crash_reports.cpp b/Telegram/SourceFiles/core/crash_reports.cpp index bc6266973..ffa1fac7e 100644 --- a/Telegram/SourceFiles/core/crash_reports.cpp +++ b/Telegram/SourceFiles/core/crash_reports.cpp @@ -300,18 +300,18 @@ bool DumpCallback(const google_breakpad::MinidumpDescriptor &md, void *context, QString PlatformString() { if (Platform::IsWindowsStoreBuild()) { return Platform::IsWindows64Bit() - ? qsl("WinStore64Bit") - : qsl("WinStore32Bit"); + ? u"WinStore64Bit"_q + : u"WinStore32Bit"_q; } else if (Platform::IsWindows32Bit()) { - return qsl("Windows32Bit"); + return u"Windows32Bit"_q; } else if (Platform::IsWindows64Bit()) { - return qsl("Windows64Bit"); + return u"Windows64Bit"_q; } else if (Platform::IsMacStoreBuild()) { - return qsl("MacAppStore"); + return u"MacAppStore"_q; } else if (Platform::IsMac()) { - return qsl("MacOS"); + return u"MacOS"_q; } else if (Platform::IsLinux()) { - return qsl("Linux"); + return u"Linux"_q; } Unexpected("Platform in CrashReports::PlatformString."); } @@ -320,12 +320,16 @@ void StartCatching(not_null launcher) { #ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS ProcessAnnotations["Binary"] = cExeName().toUtf8().constData(); ProcessAnnotations["ApiId"] = QString::number(ApiId).toUtf8().constData(); - ProcessAnnotations["Version"] = (cAlphaVersion() ? qsl("%1 alpha").arg(cAlphaVersion()) : (AppBetaVersion ? qsl("%1 beta") : qsl("%1")).arg(AppVersion)).toUtf8().constData(); + ProcessAnnotations["Version"] = (cAlphaVersion() + ? u"%1 alpha"_q.arg(cAlphaVersion()) + : (AppBetaVersion + ? u"%1 beta"_q + : u"%1"_q).arg(AppVersion)).toUtf8().constData(); ProcessAnnotations["Launched"] = QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss").toUtf8().constData(); ProcessAnnotations["Platform"] = PlatformString().toUtf8().constData(); ProcessAnnotations["UserTag"] = QString::number(launcher->installationTag(), 16).toUtf8().constData(); - QString dumpspath = cWorkingDir() + qsl("tdata/dumps"); + QString dumpspath = cWorkingDir() + u"tdata/dumps"_q; QDir().mkpath(dumpspath); #ifdef Q_OS_WIN @@ -356,7 +360,7 @@ void StartCatching(not_null launcher) { SetSignalHandlers = false; #else // MAC_USE_BREAKPAD crashpad::CrashpadClient crashpad_client; - std::string handler = (cExeDir() + cExeName() + qsl("/Contents/Helpers/crashpad_handler")).toUtf8().constData(); + std::string handler = (cExeDir() + cExeName() + u"/Contents/Helpers/crashpad_handler"_q).toUtf8().constData(); std::string database = QFile::encodeName(dumpspath).constData(); if (crashpad_client.StartHandler( base::FilePath(handler), @@ -394,7 +398,7 @@ void FinishCatching() { StartResult Start() { #ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS - ReportPath = cWorkingDir() + qsl("tdata/working"); + ReportPath = cWorkingDir() + u"tdata/working"_q; #ifdef Q_OS_WIN FILE *f = nullptr; diff --git a/Telegram/SourceFiles/core/file_utilities.cpp b/Telegram/SourceFiles/core/file_utilities.cpp index a271763cd..ae26d6495 100644 --- a/Telegram/SourceFiles/core/file_utilities.cpp +++ b/Telegram/SourceFiles/core/file_utilities.cpp @@ -83,8 +83,8 @@ QString filedialogDefaultName( time_t t = time(NULL); mylocaltime(&tm, &t); - QChar zero('0'); - base = prefix + qsl("_%1-%2-%3_%4-%5-%6").arg(tm.tm_year + 1900).arg(tm.tm_mon + 1, 2, 10, zero).arg(tm.tm_mday, 2, 10, zero).arg(tm.tm_hour, 2, 10, zero).arg(tm.tm_min, 2, 10, zero).arg(tm.tm_sec, 2, 10, zero); + const auto zero = QChar('0'); + base = prefix + u"_%1-%2-%3_%4-%5-%6"_q.arg(tm.tm_year + 1900).arg(tm.tm_mon + 1, 2, 10, zero).arg(tm.tm_mday, 2, 10, zero).arg(tm.tm_hour, 2, 10, zero).arg(tm.tm_min, 2, 10, zero).arg(tm.tm_sec, 2, 10, zero); } QString name; @@ -97,7 +97,7 @@ QString filedialogDefaultName( + base; name = nameBase + extension; for (int i = 0; QFileInfo::exists(name); ++i) { - name = nameBase + qsl(" (%1)").arg(i + 2) + extension; + name = nameBase + u" (%1)"_q.arg(i + 2) + extension; } } return name; @@ -118,7 +118,7 @@ QString filedialogNextFilename( const auto nameBase = (dir.endsWith('/') ? dir : (dir + '/')) + prefix; auto result = nameBase + extension; for (int i = 0; result.toLower() != cur.toLower() && QFileInfo::exists(result); ++i) { - result = nameBase + qsl(" (%1)").arg(i + 2) + extension; + result = nameBase + u" (%1)"_q.arg(i + 2) + extension; } return result; } @@ -336,9 +336,9 @@ void GetFolder( QString AllFilesFilter() { #ifdef Q_OS_WIN - return qsl("All files (*.*)"); + return u"All files (*.*)"_q; #else // Q_OS_WIN - return qsl("All files (*)"); + return u"All files (*)"_q; #endif // Q_OS_WIN } diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index 4f611d805..526a5cf85 100644 --- a/Telegram/SourceFiles/core/launcher.cpp +++ b/Telegram/SourceFiles/core/launcher.cpp @@ -61,7 +61,7 @@ FilteredCommandLineArguments::FilteredCommandLineArguments( #endif // !Q_OS_WIN } #elif defined Q_OS_UNIX - if (QFile::exists(cWorkingDir() + qsl("tdata/nowayland")) + if (QFile::exists(cWorkingDir() + u"tdata/nowayland"_q) && qEnvironmentVariableIsEmpty("QT_QPA_PLATFORM")) { LOG(("Wayland: Disable on old installations")); pushArgument("-platform"); @@ -87,7 +87,7 @@ void FilteredCommandLineArguments::pushArgument(const char *text) { } QString DebugModeSettingPath() { - return cWorkingDir() + qsl("tdata/withdebug"); + return cWorkingDir() + u"tdata/withdebug"_q; } void WriteDebugModeSetting() { @@ -113,7 +113,7 @@ void ComputeDebugMode() { } void ComputeExternalUpdater() { - QFile file(qsl("/etc/tdesktop/externalupdater")); + QFile file(u"/etc/tdesktop/externalupdater"_q); if (file.exists() && file.open(QIODevice::ReadOnly)) { QTextStream fileStream(&file); @@ -129,13 +129,13 @@ void ComputeExternalUpdater() { } void ComputeFreeType() { - if (QFile::exists(cWorkingDir() + qsl("tdata/withfreetype"))) { + if (QFile::exists(cWorkingDir() + u"tdata/withfreetype"_q)) { cSetUseFreeType(true); } } QString InstallBetaVersionsSettingPath() { - return cWorkingDir() + qsl("tdata/devversion"); + return cWorkingDir() + u"tdata/devversion"_q; } void WriteInstallBetaVersionsSetting() { @@ -161,7 +161,7 @@ void ComputeInstallBetaVersions() { void ComputeInstallationTag() { InstallationTag = 0; - auto file = QFile(cWorkingDir() + qsl("tdata/usertag")); + auto file = QFile(cWorkingDir() + u"tdata/usertag"_q); if (file.open(QIODevice::ReadOnly)) { const auto result = file.read( reinterpret_cast(&InstallationTag), @@ -189,7 +189,7 @@ void ComputeInstallationTag() { bool MoveLegacyAlphaFolder(const QString &folder, const QString &file) { const auto was = cExeDir() + folder; - const auto now = cExeDir() + qsl("TelegramForcePortable"); + const auto now = cExeDir() + u"TelegramForcePortable"_q; if (QDir(was).exists() && !QDir(now).exists()) { const auto oldFile = was + "/tdata/" + file; const auto newFile = was + "/tdata/alpha"; @@ -210,8 +210,8 @@ bool MoveLegacyAlphaFolder(const QString &folder, const QString &file) { } bool MoveLegacyAlphaFolder() { - if (!MoveLegacyAlphaFolder(qsl("TelegramAlpha_data"), qsl("alpha")) - || !MoveLegacyAlphaFolder(qsl("TelegramBeta_data"), qsl("beta"))) { + if (!MoveLegacyAlphaFolder(u"TelegramAlpha_data"_q, u"alpha"_q) + || !MoveLegacyAlphaFolder(u"TelegramBeta_data"_q, u"beta"_q)) { return false; } return true; @@ -222,8 +222,8 @@ bool CheckPortableVersionFolder() { return false; } - const auto portable = cExeDir() + qsl("TelegramForcePortable"); - QFile key(portable + qsl("/tdata/alpha")); + const auto portable = cExeDir() + u"TelegramForcePortable"_q; + QFile key(portable + u"/tdata/alpha"_q); if (cAlphaVersion()) { Assert(*AlphaPrivateKey != 0); @@ -293,7 +293,7 @@ void Launcher::init() { prepareSettings(); initQtMessageLogging(); - QApplication::setApplicationName(qsl("TelegramDesktop")); + QApplication::setApplicationName(u"TelegramDesktop"_q); QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true); QApplication::setHighDpiScaleFactorRoundingPolicy( Qt::HighDpiScaleFactorRoundingPolicy::Floor); @@ -326,7 +326,7 @@ int Launcher::exec() { if (Logs::DebugEnabled()) { const auto openalLogPath = QDir::toNativeSeparators( - cWorkingDir() + qsl("DebugLogs/last_openal_log.txt")); + cWorkingDir() + u"DebugLogs/last_openal_log.txt"_q); qputenv("ALSOFT_LOGLEVEL", "3"); @@ -350,7 +350,7 @@ int Launcher::exec() { if (!UpdaterDisabled() && cRestartingUpdate()) { DEBUG_LOG(("Sandbox Info: executing updater to install update.")); if (!launchUpdater(UpdaterLaunch::PerformUpdate)) { - base::Platform::DeleteDirectory(cWorkingDir() + qsl("tupdates/temp")); + base::Platform::DeleteDirectory(cWorkingDir() + u"tupdates/temp"_q); } } else if (cRestarting()) { DEBUG_LOG(("Sandbox Info: executing Telegram because of restart.")); diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp index ea2cc28b4..d7936094b 100644 --- a/Telegram/SourceFiles/core/sandbox.cpp +++ b/Telegram/SourceFiles/core/sandbox.cpp @@ -264,17 +264,17 @@ void Sandbox::socketConnected() { QString commands; const QStringList &lst(cSendPaths()); for (QStringList::const_iterator i = lst.cbegin(), e = lst.cend(); i != e; ++i) { - commands += qsl("SEND:") + _escapeTo7bit(*i) + ';'; + commands += u"SEND:"_q + _escapeTo7bit(*i) + ';'; } if (qEnvironmentVariableIsSet("XDG_ACTIVATION_TOKEN")) { - commands += qsl("XDG_ACTIVATION_TOKEN:") + _escapeTo7bit(qEnvironmentVariable("XDG_ACTIVATION_TOKEN")) + ';'; + commands += u"XDG_ACTIVATION_TOKEN:"_q + _escapeTo7bit(qEnvironmentVariable("XDG_ACTIVATION_TOKEN")) + ';'; } if (!cStartUrl().isEmpty()) { - commands += qsl("OPEN:") + _escapeTo7bit(cStartUrl()) + ';'; + commands += u"OPEN:"_q + _escapeTo7bit(cStartUrl()) + ';'; } else if (cQuit()) { - commands += qsl("CMD:quit;"); + commands += u"CMD:quit;"_q; } else { - commands += qsl("CMD:show;"); + commands += u"CMD:show;"_q; } DEBUG_LOG(("Sandbox Info: writing commands %1").arg(commands)); @@ -425,17 +425,17 @@ void Sandbox::readClients() { int32 from = 0, l = cmds.length(); for (int32 to = cmds.indexOf(QChar(';'), from); to >= from; to = (from < l) ? cmds.indexOf(QChar(';'), from) : -1) { auto cmd = base::StringViewMid(cmds, from, to - from); - if (cmd.startsWith(qsl("CMD:"))) { + if (cmd.startsWith(u"CMD:"_q)) { execExternal(cmds.mid(from + 4, to - from - 4)); - const auto response = qsl("RES:%1;").arg(QApplication::applicationPid()).toLatin1(); + const auto response = u"RES:%1;"_q.arg(QApplication::applicationPid()).toLatin1(); i->first->write(response.data(), response.size()); - } else if (cmd.startsWith(qsl("SEND:"))) { + } else if (cmd.startsWith(u"SEND:"_q)) { if (cSendPaths().isEmpty()) { toSend.append(_escapeFrom7bit(cmds.mid(from + 5, to - from - 5))); } - } else if (cmd.startsWith(qsl("XDG_ACTIVATION_TOKEN:"))) { + } else if (cmd.startsWith(u"XDG_ACTIVATION_TOKEN:"_q)) { qputenv("XDG_ACTIVATION_TOKEN", _escapeFrom7bit(cmds.mid(from + 21, to - from - 21)).toUtf8()); - } else if (cmd.startsWith(qsl("OPEN:"))) { + } else if (cmd.startsWith(u"OPEN:"_q)) { startUrl = _escapeFrom7bit(cmds.mid(from + 5, to - from - 5)).mid(0, 8192); auto activateRequired = StartUrlRequiresActivate(startUrl); if (activateRequired) { @@ -444,7 +444,7 @@ void Sandbox::readClients() { const auto responsePid = activateRequired ? QApplication::applicationPid() : kEmptyPidForCommandResponse; - const auto response = qsl("RES:%1;").arg(responsePid).toLatin1(); + const auto response = u"RES:%1;"_q.arg(responsePid).toLatin1(); i->first->write(response.data(), response.size()); } else { LOG(("Sandbox Error: unknown command %1 passed in local socket").arg(cmd.toString())); diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 4d142beb5..fce2fbc43 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -55,87 +55,87 @@ const auto SupportCommands = base::flat_set{ }; const auto CommandByName = base::flat_map{ - { qsl("close_telegram") , Command::Close }, - { qsl("lock_telegram") , Command::Lock }, - { qsl("minimize_telegram") , Command::Minimize }, - { qsl("quit_telegram") , Command::Quit }, + { u"close_telegram"_q , Command::Close }, + { u"lock_telegram"_q , Command::Lock }, + { u"minimize_telegram"_q , Command::Minimize }, + { u"quit_telegram"_q , Command::Quit }, - { qsl("media_play") , Command::MediaPlay }, - { qsl("media_pause") , Command::MediaPause }, - { qsl("media_playpause") , Command::MediaPlayPause }, - { qsl("media_stop") , Command::MediaStop }, - { qsl("media_previous") , Command::MediaPrevious }, - { qsl("media_next") , Command::MediaNext }, + { u"media_play"_q , Command::MediaPlay }, + { u"media_pause"_q , Command::MediaPause }, + { u"media_playpause"_q , Command::MediaPlayPause }, + { u"media_stop"_q , Command::MediaStop }, + { u"media_previous"_q , Command::MediaPrevious }, + { u"media_next"_q , Command::MediaNext }, - { qsl("search") , Command::Search }, + { u"search"_q , Command::Search }, - { qsl("previous_chat") , Command::ChatPrevious }, - { qsl("next_chat") , Command::ChatNext }, - { qsl("first_chat") , Command::ChatFirst }, - { qsl("last_chat") , Command::ChatLast }, - { qsl("self_chat") , Command::ChatSelf }, + { u"previous_chat"_q , Command::ChatPrevious }, + { u"next_chat"_q , Command::ChatNext }, + { u"first_chat"_q , Command::ChatFirst }, + { u"last_chat"_q , Command::ChatLast }, + { u"self_chat"_q , Command::ChatSelf }, - { qsl("previous_folder") , Command::FolderPrevious }, - { qsl("next_folder") , Command::FolderNext }, - { qsl("all_chats") , Command::ShowAllChats }, + { u"previous_folder"_q , Command::FolderPrevious }, + { u"next_folder"_q , Command::FolderNext }, + { u"all_chats"_q , Command::ShowAllChats }, - { qsl("folder1") , Command::ShowFolder1 }, - { qsl("folder2") , Command::ShowFolder2 }, - { qsl("folder3") , Command::ShowFolder3 }, - { qsl("folder4") , Command::ShowFolder4 }, - { qsl("folder5") , Command::ShowFolder5 }, - { qsl("folder6") , Command::ShowFolder6 }, - { qsl("last_folder") , Command::ShowFolderLast }, + { u"folder1"_q , Command::ShowFolder1 }, + { u"folder2"_q , Command::ShowFolder2 }, + { u"folder3"_q , Command::ShowFolder3 }, + { u"folder4"_q , Command::ShowFolder4 }, + { u"folder5"_q , Command::ShowFolder5 }, + { u"folder6"_q , Command::ShowFolder6 }, + { u"last_folder"_q , Command::ShowFolderLast }, - { qsl("show_archive") , Command::ShowArchive }, - { qsl("show_contacts") , Command::ShowContacts }, + { u"show_archive"_q , Command::ShowArchive }, + { u"show_contacts"_q , Command::ShowContacts }, - { qsl("read_chat") , Command::ReadChat }, + { u"read_chat"_q , Command::ReadChat }, // Shortcuts that have no default values. - { qsl("message") , Command::JustSendMessage }, - { qsl("message_silently") , Command::SendSilentMessage }, - { qsl("message_scheduled") , Command::ScheduleMessage }, + { u"message"_q , Command::JustSendMessage }, + { u"message_silently"_q , Command::SendSilentMessage }, + { u"message_scheduled"_q , Command::ScheduleMessage }, // }; const auto CommandNames = base::flat_map{ - { Command::Close , qsl("close_telegram") }, - { Command::Lock , qsl("lock_telegram") }, - { Command::Minimize , qsl("minimize_telegram") }, - { Command::Quit , qsl("quit_telegram") }, + { Command::Close , u"close_telegram"_q }, + { Command::Lock , u"lock_telegram"_q }, + { Command::Minimize , u"minimize_telegram"_q }, + { Command::Quit , u"quit_telegram"_q }, - { Command::MediaPlay , qsl("media_play") }, - { Command::MediaPause , qsl("media_pause") }, - { Command::MediaPlayPause , qsl("media_playpause") }, - { Command::MediaStop , qsl("media_stop") }, - { Command::MediaPrevious , qsl("media_previous") }, - { Command::MediaNext , qsl("media_next") }, + { Command::MediaPlay , u"media_play"_q }, + { Command::MediaPause , u"media_pause"_q }, + { Command::MediaPlayPause , u"media_playpause"_q }, + { Command::MediaStop , u"media_stop"_q }, + { Command::MediaPrevious , u"media_previous"_q }, + { Command::MediaNext , u"media_next"_q }, - { Command::Search , qsl("search") }, + { Command::Search , u"search"_q }, - { Command::ChatPrevious , qsl("previous_chat") }, - { Command::ChatNext , qsl("next_chat") }, - { Command::ChatFirst , qsl("first_chat") }, - { Command::ChatLast , qsl("last_chat") }, - { Command::ChatSelf , qsl("self_chat") }, + { Command::ChatPrevious , u"previous_chat"_q }, + { Command::ChatNext , u"next_chat"_q }, + { Command::ChatFirst , u"first_chat"_q }, + { Command::ChatLast , u"last_chat"_q }, + { Command::ChatSelf , u"self_chat"_q }, - { Command::FolderPrevious , qsl("previous_folder") }, - { Command::FolderNext , qsl("next_folder") }, - { Command::ShowAllChats , qsl("all_chats") }, + { Command::FolderPrevious , u"previous_folder"_q }, + { Command::FolderNext , u"next_folder"_q }, + { Command::ShowAllChats , u"all_chats"_q }, - { Command::ShowFolder1 , qsl("folder1") }, - { Command::ShowFolder2 , qsl("folder2") }, - { Command::ShowFolder3 , qsl("folder3") }, - { Command::ShowFolder4 , qsl("folder4") }, - { Command::ShowFolder5 , qsl("folder5") }, - { Command::ShowFolder6 , qsl("folder6") }, - { Command::ShowFolderLast , qsl("last_folder") }, + { Command::ShowFolder1 , u"folder1"_q }, + { Command::ShowFolder2 , u"folder2"_q }, + { Command::ShowFolder3 , u"folder3"_q }, + { Command::ShowFolder4 , u"folder4"_q }, + { Command::ShowFolder5 , u"folder5"_q }, + { Command::ShowFolder6 , u"folder6"_q }, + { Command::ShowFolderLast , u"last_folder"_q }, - { Command::ShowArchive , qsl("show_archive") }, - { Command::ShowContacts , qsl("show_contacts") }, + { Command::ShowArchive , u"show_archive"_q }, + { Command::ShowContacts , u"show_contacts"_q }, - { Command::ReadChat , qsl("read_chat") }, + { Command::ReadChat , u"read_chat"_q }, }; class Manager { @@ -169,11 +169,11 @@ private: }; QString DefaultFilePath() { - return cWorkingDir() + qsl("tdata/shortcuts-default.json"); + return cWorkingDir() + u"tdata/shortcuts-default.json"_q; } QString CustomFilePath() { - return cWorkingDir() + qsl("tdata/shortcuts-custom.json"); + return cWorkingDir() + u"tdata/shortcuts-custom.json"_q; } bool DefaultFileIsValid() { @@ -195,7 +195,7 @@ bool DefaultFileIsValid() { return false; } const auto versionObject = (*shortcuts.constBegin()).toObject(); - const auto version = versionObject.constFind(qsl("version")); + const auto version = versionObject.constFind(u"version"_q); if (version == versionObject.constEnd() || !(*version).isString() || (*version).toString() != QString::number(AppVersion)) { @@ -266,12 +266,12 @@ bool Manager::readCustomFile() { } const auto guard = gsl::finally([&] { if (!_errors.isEmpty()) { - _errors.push_front(qsl("While reading file '%1'..." + _errors.push_front((u"While reading file '%1'..."_q ).arg(file.fileName())); } }); if (!file.open(QIODevice::ReadOnly)) { - _errors.push_back(qsl("Could not read the file!")); + _errors.push_back(u"Could not read the file!"_q); return true; } auto error = QJsonParseError{ 0, QJsonParseError::NoError }; @@ -281,23 +281,23 @@ bool Manager::readCustomFile() { file.close(); if (error.error != QJsonParseError::NoError) { - _errors.push_back(qsl("Failed to parse! Error: %2" + _errors.push_back((u"Failed to parse! Error: %2"_q ).arg(error.errorString())); return true; } else if (!document.isArray()) { - _errors.push_back(qsl("Failed to parse! Error: array expected")); + _errors.push_back(u"Failed to parse! Error: array expected"_q); return true; } const auto shortcuts = document.array(); auto limit = kCountLimit; for (auto i = shortcuts.constBegin(), e = shortcuts.constEnd(); i != e; ++i) { if (!(*i).isObject()) { - _errors.push_back(qsl("Bad entry! Error: object expected")); + _errors.push_back(u"Bad entry! Error: object expected"_q); continue; } const auto entry = (*i).toObject(); - const auto keys = entry.constFind(qsl("keys")); - const auto command = entry.constFind(qsl("command")); + const auto keys = entry.constFind(u"keys"_q); + const auto command = entry.constFind(u"command"_q); if (keys == entry.constEnd() || command == entry.constEnd() || !(*keys).isString() @@ -319,8 +319,8 @@ bool Manager::readCustomFile() { } } if (!--limit) { - _errors.push_back(qsl("Too many entries! Limit is %1" - ).arg(kCountLimit)); + _errors.push_back(u"Too many entries! Limit is %1"_q.arg( + kCountLimit)); break; } } @@ -328,66 +328,66 @@ bool Manager::readCustomFile() { } void Manager::fillDefaults() { - const auto ctrl = Platform::IsMac() ? qsl("meta") : qsl("ctrl"); + const auto ctrl = Platform::IsMac() ? u"meta"_q : u"ctrl"_q; - set(qsl("ctrl+w"), Command::Close); - set(qsl("ctrl+f4"), Command::Close); - set(qsl("ctrl+l"), Command::Lock); - set(qsl("ctrl+m"), Command::Minimize); - set(qsl("ctrl+q"), Command::Quit); + set(u"ctrl+w"_q, Command::Close); + set(u"ctrl+f4"_q, Command::Close); + set(u"ctrl+l"_q, Command::Lock); + set(u"ctrl+m"_q, Command::Minimize); + set(u"ctrl+q"_q, Command::Quit); - set(qsl("media play"), Command::MediaPlay); - set(qsl("media pause"), Command::MediaPause); - set(qsl("toggle media play/pause"), Command::MediaPlayPause); - set(qsl("media stop"), Command::MediaStop); - set(qsl("media previous"), Command::MediaPrevious); - set(qsl("media next"), Command::MediaNext); + set(u"media play"_q, Command::MediaPlay); + set(u"media pause"_q, Command::MediaPause); + set(u"toggle media play/pause"_q, Command::MediaPlayPause); + set(u"media stop"_q, Command::MediaStop); + set(u"media previous"_q, Command::MediaPrevious); + set(u"media next"_q, Command::MediaNext); - set(qsl("ctrl+f"), Command::Search); - set(qsl("search"), Command::Search); - set(qsl("find"), Command::Search); + set(u"ctrl+f"_q, Command::Search); + set(u"search"_q, Command::Search); + set(u"find"_q, Command::Search); - set(qsl("ctrl+pgdown"), Command::ChatNext); - set(qsl("alt+down"), Command::ChatNext); - set(qsl("ctrl+pgup"), Command::ChatPrevious); - set(qsl("alt+up"), Command::ChatPrevious); + set(u"ctrl+pgdown"_q, Command::ChatNext); + set(u"alt+down"_q, Command::ChatNext); + set(u"ctrl+pgup"_q, Command::ChatPrevious); + set(u"alt+up"_q, Command::ChatPrevious); - set(qsl("%1+tab").arg(ctrl), Command::ChatNext); - set(qsl("%1+shift+tab").arg(ctrl), Command::ChatPrevious); - set(qsl("%1+backtab").arg(ctrl), Command::ChatPrevious); + set(u"%1+tab"_q.arg(ctrl), Command::ChatNext); + set(u"%1+shift+tab"_q.arg(ctrl), Command::ChatPrevious); + set(u"%1+backtab"_q.arg(ctrl), Command::ChatPrevious); - set(qsl("ctrl+alt+home"), Command::ChatFirst); - set(qsl("ctrl+alt+end"), Command::ChatLast); + set(u"ctrl+alt+home"_q, Command::ChatFirst); + set(u"ctrl+alt+end"_q, Command::ChatLast); - set(qsl("f5"), Command::SupportReloadTemplates); - set(qsl("ctrl+delete"), Command::SupportToggleMuted); - set(qsl("ctrl+insert"), Command::SupportScrollToCurrent); - set(qsl("ctrl+shift+x"), Command::SupportHistoryBack); - set(qsl("ctrl+shift+c"), Command::SupportHistoryForward); + set(u"f5"_q, Command::SupportReloadTemplates); + set(u"ctrl+delete"_q, Command::SupportToggleMuted); + set(u"ctrl+insert"_q, Command::SupportScrollToCurrent); + set(u"ctrl+shift+x"_q, Command::SupportHistoryBack); + set(u"ctrl+shift+c"_q, Command::SupportHistoryForward); - set(qsl("ctrl+1"), Command::ChatPinned1); - set(qsl("ctrl+2"), Command::ChatPinned2); - set(qsl("ctrl+3"), Command::ChatPinned3); - set(qsl("ctrl+4"), Command::ChatPinned4); - set(qsl("ctrl+5"), Command::ChatPinned5); + set(u"ctrl+1"_q, Command::ChatPinned1); + set(u"ctrl+2"_q, Command::ChatPinned2); + set(u"ctrl+3"_q, Command::ChatPinned3); + set(u"ctrl+4"_q, Command::ChatPinned4); + set(u"ctrl+5"_q, Command::ChatPinned5); auto &&folders = ranges::views::zip( kShowFolder, ranges::views::ints(1, ranges::unreachable)); for (const auto [command, index] : folders) { - set(qsl("%1+%2").arg(ctrl).arg(index), command); + set(u"%1+%2"_q.arg(ctrl).arg(index), command); } - set(qsl("%1+shift+down").arg(ctrl), Command::FolderNext); - set(qsl("%1+shift+up").arg(ctrl), Command::FolderPrevious); + set(u"%1+shift+down"_q.arg(ctrl), Command::FolderNext); + set(u"%1+shift+up"_q.arg(ctrl), Command::FolderPrevious); - set(qsl("ctrl+0"), Command::ChatSelf); + set(u"ctrl+0"_q, Command::ChatSelf); - set(qsl("ctrl+9"), Command::ShowArchive); - set(qsl("ctrl+j"), Command::ShowContacts); + set(u"ctrl+9"_q, Command::ShowArchive); + set(u"ctrl+j"_q, Command::ShowContacts); - set(qsl("ctrl+r"), Command::ReadChat); + set(u"ctrl+r"_q, Command::ReadChat); } void Manager::writeDefaultFile() { @@ -405,7 +405,7 @@ void Manager::writeDefaultFile() { auto shortcuts = QJsonArray(); auto version = QJsonObject(); - version.insert(qsl("version"), QString::number(AppVersion)); + version.insert(u"version"_q, QString::number(AppVersion)); shortcuts.push_back(version); for (const auto &[sequence, shortcut] : _shortcuts) { @@ -416,8 +416,8 @@ void Manager::writeDefaultFile() { const auto j = CommandNames.find(i->second); if (j != CommandNames.end()) { QJsonObject entry; - entry.insert(qsl("keys"), sequence.toString().toLower()); - entry.insert(qsl("command"), j->second); + entry.insert(u"keys"_q, sequence.toString().toLower()); + entry.insert(u"command"_q, j->second); shortcuts.append(entry); } } @@ -435,8 +435,7 @@ void Manager::set(const QString &keys, Command command, bool replace) { const auto result = QKeySequence(keys, QKeySequence::PortableText); if (result.isEmpty()) { - _errors.push_back(qsl("Could not derive key sequence '%1'!" - ).arg(keys)); + _errors.push_back(u"Could not derive key sequence '%1'!"_q.arg(keys)); return; } auto shortcut = base::make_unique_q( @@ -463,7 +462,7 @@ void Manager::set(const QString &keys, Command command, bool replace) { id = i->second->id(); } if (!id) { - _errors.push_back(qsl("Could not create shortcut '%1'!").arg(keys)); + _errors.push_back(u"Could not create shortcut '%1'!"_q.arg(keys)); return; } _commandByShortcutId.emplace(id, command); @@ -482,8 +481,7 @@ void Manager::remove(const QString &keys) { const auto result = QKeySequence(keys, QKeySequence::PortableText); if (result.isEmpty()) { - _errors.push_back(qsl("Could not derive key sequence '%1'!" - ).arg(keys)); + _errors.push_back(u"Could not derive key sequence '%1'!"_q.arg(keys)); return; } const auto i = _shortcuts.find(result); diff --git a/Telegram/SourceFiles/core/ui_integration.cpp b/Telegram/SourceFiles/core/ui_integration.cpp index 41ad9fce9..746910faa 100644 --- a/Telegram/SourceFiles/core/ui_integration.cpp +++ b/Telegram/SourceFiles/core/ui_integration.cpp @@ -164,13 +164,13 @@ std::shared_ptr UiIntegration::createLinkHandler( using HashtagMentionType = MarkedTextContext::HashtagMentionType; if (my && my->type == HashtagMentionType::Twitter) { return std::make_shared( - (qsl("https://twitter.com/hashtag/") + (u"https://twitter.com/hashtag/"_q + data.data.mid(1) - + qsl("?src=hash")), + + u"?src=hash"_q), true); } else if (my && my->type == HashtagMentionType::Instagram) { return std::make_shared( - (qsl("https://instagram.com/explore/tags/") + (u"https://instagram.com/explore/tags/"_q + data.data.mid(1) + '/'), true); @@ -184,11 +184,11 @@ std::shared_ptr UiIntegration::createLinkHandler( using HashtagMentionType = MarkedTextContext::HashtagMentionType; if (my && my->type == HashtagMentionType::Twitter) { return std::make_shared( - qsl("https://twitter.com/") + data.data.mid(1), + u"https://twitter.com/"_q + data.data.mid(1), true); } else if (my && my->type == HashtagMentionType::Instagram) { return std::make_shared( - qsl("https://instagram.com/") + data.data.mid(1) + '/', + u"https://instagram.com/"_q + data.data.mid(1) + '/', true); } return std::make_shared(data.data); diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp index 30d652063..9b534c24a 100644 --- a/Telegram/SourceFiles/core/update_checker.cpp +++ b/Telegram/SourceFiles/core/update_checker.cpp @@ -228,7 +228,7 @@ std::shared_ptr GetUpdaterInstance() { } QString UpdatesFolder() { - return cWorkingDir() + qsl("tupdates"); + return cWorkingDir() + u"tupdates"_q; } void ClearAll() { @@ -259,10 +259,10 @@ QString FindUpdateFile() { } QString ExtractFilename(const QString &url) { - const auto expression = QRegularExpression(qsl("/([^/\\?]+)(\\?|$)")); + const auto expression = QRegularExpression(u"/([^/\\?]+)(\\?|$)"_q); if (const auto match = expression.match(url); match.hasMatch()) { return match.captured(1).replace( - QRegularExpression(qsl("[^a-zA-Z0-9_\\-]")), + QRegularExpression(u"[^a-zA-Z0-9_\\-]"_q), QString()); } return QString(); @@ -290,7 +290,7 @@ bool UnpackUpdate(const QString &filepath) { } input.close(); - QString tempDirPath = cWorkingDir() + qsl("tupdates/temp"), readyFilePath = cWorkingDir() + qsl("tupdates/temp/ready"); + QString tempDirPath = cWorkingDir() + u"tupdates/temp"_q, readyFilePath = cWorkingDir() + u"tupdates/temp/ready"_q; base::Platform::DeleteDirectory(tempDirPath); QDir tempDir(tempDirPath); @@ -485,7 +485,7 @@ bool UnpackUpdate(const QString &filepath) { } // create tdata/version file - tempDir.mkdir(QDir(tempDirPath + qsl("/tdata")).absolutePath()); + tempDir.mkdir(QDir(tempDirPath + u"/tdata"_q).absolutePath()); std::wstring versionString = FormatVersionDisplay(version).toStdWString(); const auto versionNum = VersionInt(version); @@ -493,9 +493,9 @@ bool UnpackUpdate(const QString &filepath) { VersionChar versionStr[32]; memcpy(versionStr, versionString.c_str(), versionLen); - QFile fVersion(tempDirPath + qsl("/tdata/version")); + QFile fVersion(tempDirPath + u"/tdata/version"_q); if (!fVersion.open(QIODevice::WriteOnly)) { - LOG(("Update Error: cant write version file '%1'").arg(tempDirPath + qsl("/version"))); + LOG(("Update Error: cant write version file '%1'").arg(tempDirPath + u"/version"_q)); return false; } fVersion.write((const char*)&versionNum, sizeof(VersionInt)); @@ -723,7 +723,7 @@ std::optional HttpChecker::parseOldResponse( const QByteArray &response) const { const auto string = QString::fromLatin1(response); const auto old = QRegularExpression( - qsl("^\\s*(\\d+)\\s*:\\s*([\\x21-\\x7f]+)\\s*$") + u"^\\s*(\\d+)\\s*:\\s*([\\x21-\\x7f]+)\\s*$"_q ).match(string); if (!old.hasMatch()) { return std::nullopt; @@ -871,7 +871,7 @@ void HttpLoaderActor::gotMetaData() { const auto pairs = _reply->rawHeaderPairs(); for (const auto &pair : pairs) { if (QString::fromUtf8(pair.first).toLower() == "content-range") { - const auto m = QRegularExpression(qsl("/(\\d+)([^\\d]|$)")).match(QString::fromUtf8(pair.second)); + const auto m = QRegularExpression(u"/(\\d+)([^\\d]|$)"_q).match(QString::fromUtf8(pair.second)); if (m.hasMatch()) { _parent->writeChunk({}, m.captured(1).toInt()); } @@ -1506,16 +1506,16 @@ int UpdateChecker::size() const { //} bool checkReadyUpdate() { - QString readyFilePath = cWorkingDir() + qsl("tupdates/temp/ready"), readyPath = cWorkingDir() + qsl("tupdates/temp"); + QString readyFilePath = cWorkingDir() + u"tupdates/temp/ready"_q, readyPath = cWorkingDir() + u"tupdates/temp"_q; if (!QFile(readyFilePath).exists() || cExeName().isEmpty()) { - if (QDir(cWorkingDir() + qsl("tupdates/ready")).exists() || QDir(cWorkingDir() + qsl("tupdates/temp")).exists()) { + if (QDir(cWorkingDir() + u"tupdates/ready"_q).exists() || QDir(cWorkingDir() + u"tupdates/temp"_q).exists()) { ClearAll(); } return false; } // check ready version - QString versionPath = readyPath + qsl("/tdata/version"); + QString versionPath = readyPath + u"/tdata/version"_q; { QFile fVersion(versionPath); if (!fVersion.open(QIODevice::ReadOnly)) { @@ -1550,14 +1550,14 @@ bool checkReadyUpdate() { } #ifdef Q_OS_WIN - QString curUpdater = (cExeDir() + qsl("Updater.exe")); - QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater.exe")); + QString curUpdater = (cExeDir() + u"Updater.exe"_q); + QFileInfo updater(cWorkingDir() + u"tupdates/temp/Updater.exe"_q); #elif defined Q_OS_MAC // Q_OS_WIN - QString curUpdater = (cExeDir() + cExeName() + qsl("/Contents/Frameworks/Updater")); - QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Telegram.app/Contents/Frameworks/Updater")); + QString curUpdater = (cExeDir() + cExeName() + u"/Contents/Frameworks/Updater"_q); + QFileInfo updater(cWorkingDir() + u"tupdates/temp/Telegram.app/Contents/Frameworks/Updater"_q); #elif defined Q_OS_UNIX // Q_OS_MAC - QString curUpdater = (cExeDir() + qsl("Updater")); - QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater")); + QString curUpdater = (cExeDir() + u"Updater"_q); + QFileInfo updater(cWorkingDir() + u"tupdates/temp/Updater"_q); #endif // Q_OS_UNIX if (!updater.exists()) { QFileInfo current(curUpdater); diff --git a/Telegram/SourceFiles/core/utils.cpp b/Telegram/SourceFiles/core/utils.cpp index 00d07d25b..bcc0068e0 100644 --- a/Telegram/SourceFiles/core/utils.cpp +++ b/Telegram/SourceFiles/core/utils.cpp @@ -339,12 +339,12 @@ namespace { QString translitLetterRusEng(QChar letter, QChar next, int32 &toSkip) { if (fastDoubleLetterRusEng.isEmpty()) { - fastDoubleLetterRusEng.insert((QString::fromUtf8("Ы").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), qsl("Y")); - fastDoubleLetterRusEng.insert((QString::fromUtf8("и").at(0).unicode() << 16) | QString::fromUtf8("я").at(0).unicode(), qsl("ia")); - fastDoubleLetterRusEng.insert((QString::fromUtf8("и").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), qsl("y")); - fastDoubleLetterRusEng.insert((QString::fromUtf8("к").at(0).unicode() << 16) | QString::fromUtf8("с").at(0).unicode(), qsl("x")); - fastDoubleLetterRusEng.insert((QString::fromUtf8("ы").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), qsl("y")); - fastDoubleLetterRusEng.insert((QString::fromUtf8("ь").at(0).unicode() << 16) | QString::fromUtf8("е").at(0).unicode(), qsl("ye")); + fastDoubleLetterRusEng.insert((QString::fromUtf8("Ы").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), u"Y"_q); + fastDoubleLetterRusEng.insert((QString::fromUtf8("и").at(0).unicode() << 16) | QString::fromUtf8("я").at(0).unicode(), u"ia"_q); + fastDoubleLetterRusEng.insert((QString::fromUtf8("и").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), u"y"_q); + fastDoubleLetterRusEng.insert((QString::fromUtf8("к").at(0).unicode() << 16) | QString::fromUtf8("с").at(0).unicode(), u"x"_q); + fastDoubleLetterRusEng.insert((QString::fromUtf8("ы").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), u"y"_q); + fastDoubleLetterRusEng.insert((QString::fromUtf8("ь").at(0).unicode() << 16) | QString::fromUtf8("е").at(0).unicode(), u"ye"_q); } QMap::const_iterator i = fastDoubleLetterRusEng.constFind((letter.unicode() << 16) | next.unicode()); if (i != fastDoubleLetterRusEng.cend()) { @@ -354,81 +354,81 @@ QString translitLetterRusEng(QChar letter, QChar next, int32 &toSkip) { toSkip = 1; if (fastLetterRusEng.isEmpty()) { - fastLetterRusEng.insert(QString::fromUtf8("А").at(0), qsl("A")); - fastLetterRusEng.insert(QString::fromUtf8("Б").at(0), qsl("B")); - fastLetterRusEng.insert(QString::fromUtf8("В").at(0), qsl("V")); - fastLetterRusEng.insert(QString::fromUtf8("Г").at(0), qsl("G")); - fastLetterRusEng.insert(QString::fromUtf8("Ґ").at(0), qsl("G")); - fastLetterRusEng.insert(QString::fromUtf8("Д").at(0), qsl("D")); - fastLetterRusEng.insert(QString::fromUtf8("Е").at(0), qsl("E")); - fastLetterRusEng.insert(QString::fromUtf8("Є").at(0), qsl("Ye")); - fastLetterRusEng.insert(QString::fromUtf8("Ё").at(0), qsl("Yo")); - fastLetterRusEng.insert(QString::fromUtf8("Ж").at(0), qsl("Zh")); - fastLetterRusEng.insert(QString::fromUtf8("З").at(0), qsl("Z")); - fastLetterRusEng.insert(QString::fromUtf8("И").at(0), qsl("I")); - fastLetterRusEng.insert(QString::fromUtf8("Ї").at(0), qsl("Yi")); - fastLetterRusEng.insert(QString::fromUtf8("І").at(0), qsl("I")); - fastLetterRusEng.insert(QString::fromUtf8("Й").at(0), qsl("J")); - fastLetterRusEng.insert(QString::fromUtf8("К").at(0), qsl("K")); - fastLetterRusEng.insert(QString::fromUtf8("Л").at(0), qsl("L")); - fastLetterRusEng.insert(QString::fromUtf8("М").at(0), qsl("M")); - fastLetterRusEng.insert(QString::fromUtf8("Н").at(0), qsl("N")); - fastLetterRusEng.insert(QString::fromUtf8("О").at(0), qsl("O")); - fastLetterRusEng.insert(QString::fromUtf8("П").at(0), qsl("P")); - fastLetterRusEng.insert(QString::fromUtf8("Р").at(0), qsl("R")); - fastLetterRusEng.insert(QString::fromUtf8("С").at(0), qsl("S")); - fastLetterRusEng.insert(QString::fromUtf8("Т").at(0), qsl("T")); - fastLetterRusEng.insert(QString::fromUtf8("У").at(0), qsl("U")); - fastLetterRusEng.insert(QString::fromUtf8("Ў").at(0), qsl("W")); - fastLetterRusEng.insert(QString::fromUtf8("Ф").at(0), qsl("F")); - fastLetterRusEng.insert(QString::fromUtf8("Х").at(0), qsl("Kh")); - fastLetterRusEng.insert(QString::fromUtf8("Ц").at(0), qsl("Ts")); - fastLetterRusEng.insert(QString::fromUtf8("Ч").at(0), qsl("Ch")); - fastLetterRusEng.insert(QString::fromUtf8("Ш").at(0), qsl("Sh")); - fastLetterRusEng.insert(QString::fromUtf8("Щ").at(0), qsl("Sch")); - fastLetterRusEng.insert(QString::fromUtf8("Э").at(0), qsl("E")); - fastLetterRusEng.insert(QString::fromUtf8("Ю").at(0), qsl("Yu")); - fastLetterRusEng.insert(QString::fromUtf8("Я").at(0), qsl("Ya")); - fastLetterRusEng.insert(QString::fromUtf8("Ў").at(0), qsl("W")); - fastLetterRusEng.insert(QString::fromUtf8("а").at(0), qsl("a")); - fastLetterRusEng.insert(QString::fromUtf8("б").at(0), qsl("b")); - fastLetterRusEng.insert(QString::fromUtf8("в").at(0), qsl("v")); - fastLetterRusEng.insert(QString::fromUtf8("г").at(0), qsl("g")); - fastLetterRusEng.insert(QString::fromUtf8("ґ").at(0), qsl("g")); - fastLetterRusEng.insert(QString::fromUtf8("д").at(0), qsl("d")); - fastLetterRusEng.insert(QString::fromUtf8("е").at(0), qsl("e")); - fastLetterRusEng.insert(QString::fromUtf8("є").at(0), qsl("ye")); - fastLetterRusEng.insert(QString::fromUtf8("ё").at(0), qsl("yo")); - fastLetterRusEng.insert(QString::fromUtf8("ж").at(0), qsl("zh")); - fastLetterRusEng.insert(QString::fromUtf8("з").at(0), qsl("z")); - fastLetterRusEng.insert(QString::fromUtf8("й").at(0), qsl("y")); - fastLetterRusEng.insert(QString::fromUtf8("ї").at(0), qsl("yi")); - fastLetterRusEng.insert(QString::fromUtf8("і").at(0), qsl("i")); - fastLetterRusEng.insert(QString::fromUtf8("л").at(0), qsl("l")); - fastLetterRusEng.insert(QString::fromUtf8("м").at(0), qsl("m")); - fastLetterRusEng.insert(QString::fromUtf8("н").at(0), qsl("n")); - fastLetterRusEng.insert(QString::fromUtf8("о").at(0), qsl("o")); - fastLetterRusEng.insert(QString::fromUtf8("п").at(0), qsl("p")); - fastLetterRusEng.insert(QString::fromUtf8("р").at(0), qsl("r")); - fastLetterRusEng.insert(QString::fromUtf8("с").at(0), qsl("s")); - fastLetterRusEng.insert(QString::fromUtf8("т").at(0), qsl("t")); - fastLetterRusEng.insert(QString::fromUtf8("у").at(0), qsl("u")); - fastLetterRusEng.insert(QString::fromUtf8("ў").at(0), qsl("w")); - fastLetterRusEng.insert(QString::fromUtf8("ф").at(0), qsl("f")); - fastLetterRusEng.insert(QString::fromUtf8("х").at(0), qsl("kh")); - fastLetterRusEng.insert(QString::fromUtf8("ц").at(0), qsl("ts")); - fastLetterRusEng.insert(QString::fromUtf8("ч").at(0), qsl("ch")); - fastLetterRusEng.insert(QString::fromUtf8("ш").at(0), qsl("sh")); - fastLetterRusEng.insert(QString::fromUtf8("щ").at(0), qsl("sch")); + fastLetterRusEng.insert(QString::fromUtf8("А").at(0), u"A"_q); + fastLetterRusEng.insert(QString::fromUtf8("Б").at(0), u"B"_q); + fastLetterRusEng.insert(QString::fromUtf8("В").at(0), u"V"_q); + fastLetterRusEng.insert(QString::fromUtf8("Г").at(0), u"G"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ґ").at(0), u"G"_q); + fastLetterRusEng.insert(QString::fromUtf8("Д").at(0), u"D"_q); + fastLetterRusEng.insert(QString::fromUtf8("Е").at(0), u"E"_q); + fastLetterRusEng.insert(QString::fromUtf8("Є").at(0), u"Ye"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ё").at(0), u"Yo"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ж").at(0), u"Zh"_q); + fastLetterRusEng.insert(QString::fromUtf8("З").at(0), u"Z"_q); + fastLetterRusEng.insert(QString::fromUtf8("И").at(0), u"I"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ї").at(0), u"Yi"_q); + fastLetterRusEng.insert(QString::fromUtf8("І").at(0), u"I"_q); + fastLetterRusEng.insert(QString::fromUtf8("Й").at(0), u"J"_q); + fastLetterRusEng.insert(QString::fromUtf8("К").at(0), u"K"_q); + fastLetterRusEng.insert(QString::fromUtf8("Л").at(0), u"L"_q); + fastLetterRusEng.insert(QString::fromUtf8("М").at(0), u"M"_q); + fastLetterRusEng.insert(QString::fromUtf8("Н").at(0), u"N"_q); + fastLetterRusEng.insert(QString::fromUtf8("О").at(0), u"O"_q); + fastLetterRusEng.insert(QString::fromUtf8("П").at(0), u"P"_q); + fastLetterRusEng.insert(QString::fromUtf8("Р").at(0), u"R"_q); + fastLetterRusEng.insert(QString::fromUtf8("С").at(0), u"S"_q); + fastLetterRusEng.insert(QString::fromUtf8("Т").at(0), u"T"_q); + fastLetterRusEng.insert(QString::fromUtf8("У").at(0), u"U"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ў").at(0), u"W"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ф").at(0), u"F"_q); + fastLetterRusEng.insert(QString::fromUtf8("Х").at(0), u"Kh"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ц").at(0), u"Ts"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ч").at(0), u"Ch"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ш").at(0), u"Sh"_q); + fastLetterRusEng.insert(QString::fromUtf8("Щ").at(0), u"Sch"_q); + fastLetterRusEng.insert(QString::fromUtf8("Э").at(0), u"E"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ю").at(0), u"Yu"_q); + fastLetterRusEng.insert(QString::fromUtf8("Я").at(0), u"Ya"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ў").at(0), u"W"_q); + fastLetterRusEng.insert(QString::fromUtf8("а").at(0), u"a"_q); + fastLetterRusEng.insert(QString::fromUtf8("б").at(0), u"b"_q); + fastLetterRusEng.insert(QString::fromUtf8("в").at(0), u"v"_q); + fastLetterRusEng.insert(QString::fromUtf8("г").at(0), u"g"_q); + fastLetterRusEng.insert(QString::fromUtf8("ґ").at(0), u"g"_q); + fastLetterRusEng.insert(QString::fromUtf8("д").at(0), u"d"_q); + fastLetterRusEng.insert(QString::fromUtf8("е").at(0), u"e"_q); + fastLetterRusEng.insert(QString::fromUtf8("є").at(0), u"ye"_q); + fastLetterRusEng.insert(QString::fromUtf8("ё").at(0), u"yo"_q); + fastLetterRusEng.insert(QString::fromUtf8("ж").at(0), u"zh"_q); + fastLetterRusEng.insert(QString::fromUtf8("з").at(0), u"z"_q); + fastLetterRusEng.insert(QString::fromUtf8("й").at(0), u"y"_q); + fastLetterRusEng.insert(QString::fromUtf8("ї").at(0), u"yi"_q); + fastLetterRusEng.insert(QString::fromUtf8("і").at(0), u"i"_q); + fastLetterRusEng.insert(QString::fromUtf8("л").at(0), u"l"_q); + fastLetterRusEng.insert(QString::fromUtf8("м").at(0), u"m"_q); + fastLetterRusEng.insert(QString::fromUtf8("н").at(0), u"n"_q); + fastLetterRusEng.insert(QString::fromUtf8("о").at(0), u"o"_q); + fastLetterRusEng.insert(QString::fromUtf8("п").at(0), u"p"_q); + fastLetterRusEng.insert(QString::fromUtf8("р").at(0), u"r"_q); + fastLetterRusEng.insert(QString::fromUtf8("с").at(0), u"s"_q); + fastLetterRusEng.insert(QString::fromUtf8("т").at(0), u"t"_q); + fastLetterRusEng.insert(QString::fromUtf8("у").at(0), u"u"_q); + fastLetterRusEng.insert(QString::fromUtf8("ў").at(0), u"w"_q); + fastLetterRusEng.insert(QString::fromUtf8("ф").at(0), u"f"_q); + fastLetterRusEng.insert(QString::fromUtf8("х").at(0), u"kh"_q); + fastLetterRusEng.insert(QString::fromUtf8("ц").at(0), u"ts"_q); + fastLetterRusEng.insert(QString::fromUtf8("ч").at(0), u"ch"_q); + fastLetterRusEng.insert(QString::fromUtf8("ш").at(0), u"sh"_q); + fastLetterRusEng.insert(QString::fromUtf8("щ").at(0), u"sch"_q); fastLetterRusEng.insert(QString::fromUtf8("ъ").at(0), QString()); - fastLetterRusEng.insert(QString::fromUtf8("э").at(0), qsl("e")); - fastLetterRusEng.insert(QString::fromUtf8("ю").at(0), qsl("yu")); - fastLetterRusEng.insert(QString::fromUtf8("я").at(0), qsl("ya")); - fastLetterRusEng.insert(QString::fromUtf8("ў").at(0), qsl("w")); - fastLetterRusEng.insert(QString::fromUtf8("Ы").at(0), qsl("Y")); - fastLetterRusEng.insert(QString::fromUtf8("и").at(0), qsl("i")); - fastLetterRusEng.insert(QString::fromUtf8("к").at(0), qsl("k")); - fastLetterRusEng.insert(QString::fromUtf8("ы").at(0), qsl("y")); + fastLetterRusEng.insert(QString::fromUtf8("э").at(0), u"e"_q); + fastLetterRusEng.insert(QString::fromUtf8("ю").at(0), u"yu"_q); + fastLetterRusEng.insert(QString::fromUtf8("я").at(0), u"ya"_q); + fastLetterRusEng.insert(QString::fromUtf8("ў").at(0), u"w"_q); + fastLetterRusEng.insert(QString::fromUtf8("Ы").at(0), u"Y"_q); + fastLetterRusEng.insert(QString::fromUtf8("и").at(0), u"i"_q); + fastLetterRusEng.insert(QString::fromUtf8("к").at(0), u"k"_q); + fastLetterRusEng.insert(QString::fromUtf8("ы").at(0), u"y"_q); fastLetterRusEng.insert(QString::fromUtf8("ь").at(0), QString()); } QHash::const_iterator j = fastLetterRusEng.constFind(letter); @@ -440,16 +440,16 @@ QString translitLetterRusEng(QChar letter, QChar next, int32 &toSkip) { QString translitRusEng(const QString &rus) { if (fastRusEng.isEmpty()) { - fastRusEng.insert(QString::fromUtf8("Александр"), qsl("Alexander")); - fastRusEng.insert(QString::fromUtf8("александр"), qsl("alexander")); - fastRusEng.insert(QString::fromUtf8("Филипп"), qsl("Philip")); - fastRusEng.insert(QString::fromUtf8("филипп"), qsl("philip")); - fastRusEng.insert(QString::fromUtf8("Пётр"), qsl("Petr")); - fastRusEng.insert(QString::fromUtf8("пётр"), qsl("petr")); - fastRusEng.insert(QString::fromUtf8("Гай"), qsl("Gai")); - fastRusEng.insert(QString::fromUtf8("гай"), qsl("gai")); - fastRusEng.insert(QString::fromUtf8("Ильин"), qsl("Ilyin")); - fastRusEng.insert(QString::fromUtf8("ильин"), qsl("ilyin")); + fastRusEng.insert(QString::fromUtf8("Александр"), u"Alexander"_q); + fastRusEng.insert(QString::fromUtf8("александр"), u"alexander"_q); + fastRusEng.insert(QString::fromUtf8("Филипп"), u"Philip"_q); + fastRusEng.insert(QString::fromUtf8("филипп"), u"philip"_q); + fastRusEng.insert(QString::fromUtf8("Пётр"), u"Petr"_q); + fastRusEng.insert(QString::fromUtf8("пётр"), u"petr"_q); + fastRusEng.insert(QString::fromUtf8("Гай"), u"Gai"_q); + fastRusEng.insert(QString::fromUtf8("гай"), u"gai"_q); + fastRusEng.insert(QString::fromUtf8("Ильин"), u"Ilyin"_q); + fastRusEng.insert(QString::fromUtf8("ильин"), u"ilyin"_q); } QMap::const_iterator i = fastRusEng.constFind(rus); if (i != fastRusEng.cend()) { diff --git a/Telegram/SourceFiles/core/utils.h b/Telegram/SourceFiles/core/utils.h index f0f097b3b..7444ed1d6 100644 --- a/Telegram/SourceFiles/core/utils.h +++ b/Telegram/SourceFiles/core/utils.h @@ -56,7 +56,7 @@ inline QList GetMimeUrls(const QMimeData *data) { inline QString IconName() { static const auto Result = KSandbox::isFlatpak() ? qEnvironmentVariable("FLATPAK_ID") - : qsl("telegram"); + : u"telegram"_q; return Result; } #endif diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index 7c679fb50..41fa5e26a 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -104,7 +104,7 @@ QString FileNameUnsafe( if (Core::App().settings().askDownloadPath() || savingAs) { if (!name.isEmpty() && name.at(0) == QChar::fromLatin1('.')) { name = filedialogDefaultName(prefix, name); - } else if (dir.path() != qsl(".")) { + } else if (dir.path() != u"."_q) { QString path = dir.absolutePath(); if (path != cDialogLastPath()) { cSetDialogLastPath(path); @@ -115,21 +115,21 @@ QString FileNameUnsafe( // check if extension of filename is present in filter // it should be in first filter section on the first place // place it there, if it is not - QString ext = QFileInfo(name).suffix(), fil = filter, sep = qsl(";;"); + QString ext = QFileInfo(name).suffix(), fil = filter, sep = u";;"_q; if (!ext.isEmpty()) { - if (QRegularExpression(qsl("^[a-zA-Z_0-9]+$")).match(ext).hasMatch()) { + if (QRegularExpression(u"^[a-zA-Z_0-9]+$"_q).match(ext).hasMatch()) { QStringList filters = filter.split(sep); if (filters.size() > 1) { const auto &first = filters.at(0); - int32 start = first.indexOf(qsl("(*.")); + int32 start = first.indexOf(u"(*."_q); if (start >= 0) { - if (!QRegularExpression(qsl("\\(\\*\\.") + ext + qsl("[\\)\\s]"), QRegularExpression::CaseInsensitiveOption).match(first).hasMatch()) { - QRegularExpressionMatch m = QRegularExpression(qsl(" \\*\\.") + ext + qsl("[\\)\\s]"), QRegularExpression::CaseInsensitiveOption).match(first); + if (!QRegularExpression(u"\\(\\*\\."_q + ext + u"[\\)\\s]"_q, QRegularExpression::CaseInsensitiveOption).match(first).hasMatch()) { + QRegularExpressionMatch m = QRegularExpression(u" \\*\\."_q + ext + u"[\\)\\s]"_q, QRegularExpression::CaseInsensitiveOption).match(first); if (m.hasMatch() && m.capturedStart() > start + 3) { int32 oldpos = m.capturedStart(), oldend = m.capturedEnd(); - fil = first.mid(0, start + 3) + ext + qsl(" *.") + first.mid(start + 3, oldpos - start - 3) + first.mid(oldend - 1) + sep + JoinStringList(filters.mid(1), sep); + fil = first.mid(0, start + 3) + ext + u" *."_q + first.mid(start + 3, oldpos - start - 3) + first.mid(oldend - 1) + sep + JoinStringList(filters.mid(1), sep); } else { - fil = first.mid(0, start + 3) + ext + qsl(" *.") + first.mid(start + 3) + sep + JoinStringList(filters.mid(1), sep); + fil = first.mid(0, start + 3) + ext + u" *."_q + first.mid(start + 3) + sep + JoinStringList(filters.mid(1), sep); } } } else { @@ -149,19 +149,19 @@ QString FileNameUnsafe( const auto path = Core::App().settings().downloadPath(); if (path.isEmpty()) { return File::DefaultDownloadPath(session); - } else if (path == qsl("tmp")) { + } else if (path == u"tmp"_q) { return session->local().tempDirectory(); } else { return path; } }(); if (path.isEmpty()) return QString(); - if (name.isEmpty()) name = qsl(".unknown"); + if (name.isEmpty()) name = u".unknown"_q; if (name.at(0) == QChar::fromLatin1('.')) { if (!QDir().exists(path)) QDir().mkpath(path); return filedialogDefaultName(prefix, name, path); } - if (dir.path() != qsl(".")) { + if (dir.path() != u"."_q) { path = dir.absolutePath() + '/'; } @@ -176,7 +176,7 @@ QString FileNameUnsafe( QString nameBase = path + nameStart; name = nameBase + extension; for (int i = 0; QFileInfo::exists(name); ++i) { - name = nameBase + QString(" (%1)").arg(i + 2) + extension; + name = nameBase + u" (%1)"_q.arg(i + 2) + extension; } if (!QDir().exists(path)) QDir().mkpath(path); @@ -202,7 +202,7 @@ QString FileNameForSave( #ifdef Q_OS_WIN const auto lower = result.trimmed().toLower(); const auto kBadExtensions = { u".lnk"_q, u".scf"_q }; - const auto kMaskExtension = qsl(".download"); + const auto kMaskExtension = u".download"_q; for (const auto extension : kBadExtensions) { if (lower.endsWith(extension)) { return result + kMaskExtension; @@ -228,37 +228,37 @@ QString DocumentFileNameForSave( QString pattern = p.isEmpty() ? QString() : p.front(); if (data->isVoiceMessage()) { 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);;"); + name = already.isEmpty() ? (mp3 ? u".mp3"_q : u".ogg"_q) : already; + filter = mp3 ? u"MP3 Audio (*.mp3);;"_q : u"OGG Opus Audio (*.ogg);;"_q; filter += FileDialog::AllFilesFilter(); caption = tr::lng_save_audio(tr::now); - prefix = qsl("audio"); + prefix = u"audio"_q; } else if (data->isVideoFile()) { name = already.isEmpty() ? data->filename() : already; if (name.isEmpty()) { - name = pattern.isEmpty() ? qsl(".mov") : pattern.replace('*', QString()); + name = pattern.isEmpty() ? u".mov"_q : pattern.replace('*', QString()); } if (pattern.isEmpty()) { - filter = qsl("MOV Video (*.mov);;") + FileDialog::AllFilesFilter(); + filter = u"MOV Video (*.mov);;"_q + FileDialog::AllFilesFilter(); } else { - filter = mimeType.filterString() + qsl(";;") + FileDialog::AllFilesFilter(); + filter = mimeType.filterString() + u";;"_q + FileDialog::AllFilesFilter(); } caption = tr::lng_save_video(tr::now); - prefix = qsl("video"); + prefix = u"video"_q; } else { name = already.isEmpty() ? data->filename() : already; if (name.isEmpty()) { - name = pattern.isEmpty() ? qsl(".unknown") : pattern.replace('*', QString()); + name = pattern.isEmpty() ? u".unknown"_q : pattern.replace('*', QString()); } if (pattern.isEmpty()) { filter = QString(); } else { - filter = mimeType.filterString() + qsl(";;") + FileDialog::AllFilesFilter(); + filter = mimeType.filterString() + u";;"_q + FileDialog::AllFilesFilter(); } caption = data->isAudioFile() ? tr::lng_save_audio_file(tr::now) : tr::lng_save_file(tr::now); - prefix = qsl("doc"); + prefix = u"doc"_q; } return FileNameForSave( diff --git a/Telegram/SourceFiles/data/data_document_resolver.cpp b/Telegram/SourceFiles/data/data_document_resolver.cpp index ebde49cb1..ad9e6c9fc 100644 --- a/Telegram/SourceFiles/data/data_document_resolver.cpp +++ b/Telegram/SourceFiles/data/data_document_resolver.cpp @@ -152,14 +152,14 @@ bool IsExecutableName(const QString &filepath) { static const auto kExtensions = [] { const auto joined = #ifdef Q_OS_MAC - qsl("\ + u"\ applescript action app bin command csh osx workflow terminal url caction \ -mpkg pkg scpt scptd xhtm webarchive"); +mpkg pkg scpt scptd xhtm webarchive"_q; #elif defined Q_OS_UNIX // Q_OS_MAC - qsl("bin csh deb desktop ksh out pet pkg pup rpm run sh shar \ -slp zsh"); + u"bin csh deb desktop ksh out pet pkg pup rpm run sh shar \ +slp zsh"_q; #else // Q_OS_MAC || Q_OS_UNIX - qsl("\ + u"\ ad ade adp app application appref-ms asp asx bas bat bin cab cdxml cer cfg \ chi chm cmd cnt com cpl crt csh der diagcab dll drv eml exe fon fxp gadget \ grp hlp hpj hta htt inf ini ins inx isp isu its jar jnlp job js jse key ksh \ @@ -170,7 +170,7 @@ php-s pht phtml pif pl plg pm pod prf prg ps1 ps2 ps1xml ps2xml psc1 psc2 \ psd1 psm1 pssc pst py py3 pyc pyd pyi pyo pyw pywz pyz rb reg rgs scf scr \ sct search-ms settingcontent-ms sh shb shs slk sys t tmp u3p url vb vbe vbp \ vbs vbscript vdx vsmacros vsd vsdm vsdx vss vssm vssx vst vstm vstx vsw vsx \ -vtx website ws wsc wsf wsh xbap xll xnk xs"); +vtx website ws wsc wsf wsh xbap xll xnk xs"_q; #endif // !Q_OS_MAC && !Q_OS_UNIX const auto list = joined.split(' '); return base::flat_set(list.begin(), list.end()); diff --git a/Telegram/SourceFiles/data/data_media_types.cpp b/Telegram/SourceFiles/data/data_media_types.cpp index 3bb881583..988e048f7 100644 --- a/Telegram/SourceFiles/data/data_media_types.cpp +++ b/Telegram/SourceFiles/data/data_media_types.cpp @@ -871,7 +871,7 @@ TextWithEntities MediaFile::notificationText() const { if (_document->isVideoMessage()) { return tr::lng_in_dlg_video_message(tr::now); } else if (_document->isAnimation()) { - return qsl("GIF"); + return u"GIF"_q; } else if (_document->isVideoFile()) { return tr::lng_in_dlg_video(tr::now); } else if (_document->isVoiceMessage()) { @@ -928,7 +928,7 @@ TextForMimeData MediaFile::clipboardText() const { if (_document->isVideoMessage()) { return tr::lng_in_dlg_video_message(tr::now); } - return qsl("GIF"); + return u"GIF"_q; } else if (_document->isVideoFile()) { return tr::lng_in_dlg_video(tr::now); } else if (_document->isVoiceMessage()) { @@ -1147,9 +1147,9 @@ QString MediaContact::pinnedTextSubstring() const { } TextForMimeData MediaContact::clipboardText() const { - const auto text = qsl("[ ") + const auto text = u"[ "_q + tr::lng_in_dlg_contact(tr::now) - + qsl(" ]\n") + + u" ]\n"_q + tr::lng_full_name( tr::now, lt_first_name, diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index 41f466499..28901d3a2 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -650,14 +650,14 @@ void PeerData::fillNames() { } appendToIndex(user->username()); if (isSelf()) { - const auto english = qsl("Saved messages"); + const auto english = u"Saved messages"_q; const auto localized = tr::lng_saved_messages(tr::now); appendToIndex(english); if (localized != english) { appendToIndex(localized); } } else if (isRepliesChat()) { - const auto english = qsl("Replies"); + const auto english = u"Replies"_q; const auto localized = tr::lng_replies_messages(tr::now); appendToIndex(english); if (localized != english) { diff --git a/Telegram/SourceFiles/data/data_web_page.cpp b/Telegram/SourceFiles/data/data_web_page.cpp index ecdd9092d..db3a51d9b 100644 --- a/Telegram/SourceFiles/data/data_web_page.cpp +++ b/Telegram/SourceFiles/data/data_web_page.cpp @@ -20,16 +20,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace { QString SiteNameFromUrl(const QString &url) { - QUrl u(url); + const auto u = QUrl(url); QString pretty = u.isValid() ? u.toDisplayString() : url; - QRegularExpressionMatch m = QRegularExpression(qsl("^[a-zA-Z0-9]+://")).match(pretty); + const auto m = QRegularExpression(u"^[a-zA-Z0-9]+://"_q).match(pretty); if (m.hasMatch()) pretty = pretty.mid(m.capturedLength()); int32 slash = pretty.indexOf('/'); if (slash > 0) pretty = pretty.mid(0, slash); QStringList components = pretty.split('.', Qt::SkipEmptyParts); if (components.size() >= 2) { components = components.mid(components.size() - 2); - return components.at(0).at(0).toUpper() + components.at(0).mid(1) + '.' + components.at(1); + return components.at(0).at(0).toUpper() + + components.at(0).mid(1) + + '.' + + components.at(1); } return QString(); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 9b6364600..046ee0901 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -799,7 +799,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) { const auto text = _searchResults.empty() ? tr::lng_search_no_results(tr::now) : showUnreadInSearchResults - ? qsl("Search results") + ? u"Search results"_q : tr::lng_search_found_results( tr::now, lt_count, diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 0da71e720..a051e8aab 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -1771,7 +1771,7 @@ void Widget::dragEnterEvent(QDragEnterEvent *e) { const auto data = e->mimeData(); _dragInScroll = false; _dragForward = !controller()->adaptive().isOneColumn() - && data->hasFormat(qsl("application/x-td-forward")); + && data->hasFormat(u"application/x-td-forward"_q); if (_dragForward) { e->setDropAction(Qt::CopyAction); e->accept(); diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index f7ce0571a..df3926c42 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -792,7 +792,7 @@ void PaintUnreadBadge(QPainter &p, const QRect &rect, const UnreadBadgeStyle &st const QString &unreadCount, int allowDigits) { return (allowDigits > 0) && (unreadCount.size() > allowDigits + 1) - ? qsl("..") + unreadCount.mid(unreadCount.size() - allowDigits) + ? u".."_q + unreadCount.mid(unreadCount.size() - allowDigits) : unreadCount; } diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp index 11b9b50fc..72b7e377b 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.cpp +++ b/Telegram/SourceFiles/export/data/export_data_types.cpp @@ -332,23 +332,23 @@ QString ComputeDocumentName( const auto pattern = patterns.isEmpty() ? QString() : patterns.front(); if (data.isVoiceMessage) { const auto isMP3 = hasMimeType(u"audio/mp3"_q); - return qsl("audio_") + return u"audio_"_q + QString::number(++context.audios) + PrepareFileNameDatePart(date) - + (isMP3 ? qsl(".mp3") : qsl(".ogg")); + + (isMP3 ? u".mp3"_q : u".ogg"_q); } else if (data.isVideoFile) { const auto extension = pattern.isEmpty() - ? qsl(".mov") + ? u".mov"_q : QString(pattern).replace('*', QString()); - return qsl("video_") + return u"video_"_q + QString::number(++context.videos) + PrepareFileNameDatePart(date) + extension; } else { const auto extension = pattern.isEmpty() - ? qsl(".unknown") + ? u".unknown"_q : QString(pattern).replace('*', QString()); - return qsl("file_") + return u"file_"_q + QString::number(++context.files) + PrepareFileNameDatePart(date) + extension; diff --git a/Telegram/SourceFiles/export/view/export_view_settings.cpp b/Telegram/SourceFiles/export/view/export_view_settings.cpp index 4ff6c0398..d01d4eb53 100644 --- a/Telegram/SourceFiles/export/view/export_view_settings.cpp +++ b/Telegram/SourceFiles/export/view/export_view_settings.cpp @@ -378,7 +378,7 @@ void SettingsWidget::addLimitsLabel( ? rpl::single(langDayOfMonthFull( base::unixtime::parse(from).date())) : tr::lng_export_beginning() - ) | Ui::Text::ToLink(qsl("internal:edit_from")); + ) | Ui::Text::ToLink(u"internal:edit_from"_q); }) | rpl::flatten_latest(); auto tillLink = value() | rpl::map([](const Settings &data) { @@ -389,7 +389,7 @@ void SettingsWidget::addLimitsLabel( ? rpl::single(langDayOfMonthFull( base::unixtime::parse(till).date())) : tr::lng_export_end() - ) | Ui::Text::ToLink(qsl("internal:edit_till")); + ) | Ui::Text::ToLink(u"internal:edit_till"_q); }) | rpl::flatten_latest(); auto datesText = tr::lng_export_limits( diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index fba616d02..b93b849e3 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -1330,12 +1330,12 @@ void InnerWidget::savePhotoToFile(not_null photo) { return; } - auto filter = qsl("JPEG Image (*.jpg);;") + FileDialog::AllFilesFilter(); + auto filter = u"JPEG Image (*.jpg);;"_q + FileDialog::AllFilesFilter(); FileDialog::GetWritePath( this, tr::lng_save_photo(tr::now), filter, - filedialogDefaultName(qsl("photo"), qsl(".jpg")), + filedialogDefaultName(u"photo"_q, u".jpg"_q), crl::guard(this, [=](const QString &result) { if (!result.isEmpty()) { media->saveToFile(result); @@ -1885,7 +1885,7 @@ void InnerWidget::performDrag() { // auto selectedState = getSelectionState(); // if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) { // session().data().setMimeForwardIds(getSelectedItems()); - // mimeData->setData(qsl("application/x-td-forward"), "1"); + // mimeData->setData(u"application/x-td-forward"_q, "1"); // } // } // _controller->window()->launchDrag(std::move(mimeData)); @@ -1897,7 +1897,7 @@ void InnerWidget::performDrag() { // pressedMedia = pressedItem->media(); // if (_mouseCursorState == CursorState::Date // || (pressedMedia && pressedMedia->dragItem())) { - // forwardMimeType = qsl("application/x-td-forward"); + // forwardMimeType = u"application/x-td-forward"_q; // session().data().setMimeForwardIds( // session().data().itemOrItsGroup(pressedItem->data())); // } @@ -1906,7 +1906,7 @@ void InnerWidget::performDrag() { // if ((pressedMedia = pressedLnkItem->media())) { // if (forwardMimeType.isEmpty() // && pressedMedia->dragItemByHandler(pressedHandler)) { - // forwardMimeType = qsl("application/x-td-forward"); + // forwardMimeType = u"application/x-td-forward"_q; // session().data().setMimeForwardIds( // { 1, pressedLnkItem->fullId() }); // } diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 647037df9..af62f91e7 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -1707,7 +1707,7 @@ std::unique_ptr HistoryInner::prepareDrag() { auto selectedState = getSelectionState(); if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) { session().data().setMimeForwardIds(getSelectedItems()); - mimeData->setData(qsl("application/x-td-forward"), "1"); + mimeData->setData(u"application/x-td-forward"_q, "1"); } } return mimeData; @@ -1732,7 +1732,7 @@ std::unique_ptr HistoryInner::prepareDrag() { } session().data().setMimeForwardIds(std::move(forwardIds)); auto result = std::make_unique(); - result->setData(qsl("application/x-td-forward"), "1"); + result->setData(u"application/x-td-forward"_q, "1"); if (const auto media = view->media()) { if (const auto document = media->getDocument()) { const auto filepath = document->filepath(true); @@ -2628,14 +2628,12 @@ void HistoryInner::savePhotoToFile(not_null photo) { return; } - auto filter = qsl("JPEG Image (*.jpg);;") + FileDialog::AllFilesFilter(); + auto filter = u"JPEG Image (*.jpg);;"_q + FileDialog::AllFilesFilter(); FileDialog::GetWritePath( this, tr::lng_save_photo(tr::now), filter, - filedialogDefaultName( - qsl("photo"), - qsl(".jpg")), + filedialogDefaultName(u"photo"_q, u".jpg"_q), crl::guard(this, [=](const QString &result) { if (!result.isEmpty()) { media->saveToFile(result); diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 542ebbaed..80c99fc1c 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -78,7 +78,7 @@ not_null CreateUnsupportedMessage( UserId viaBotId, TimeId date, PeerId from) { - const auto siteLink = qsl("https://desktop.telegram.org"); + const auto siteLink = u"https://desktop.telegram.org"_q; auto text = TextWithEntities{ tr::lng_message_unsupported(tr::now, lt_link, siteLink) }; diff --git a/Telegram/SourceFiles/history/history_location_manager.cpp b/Telegram/SourceFiles/history/history_location_manager.cpp index 13142c1da..17434e8b6 100644 --- a/Telegram/SourceFiles/history/history_location_manager.cpp +++ b/Telegram/SourceFiles/history/history_location_manager.cpp @@ -34,5 +34,9 @@ void LocationClickHandler::setup() { QString LocationClickHandler::Url(const Data::LocationPoint &point) { const auto latlon = point.latAsString() + ',' + point.lonAsString(); - return qsl("https://maps.google.com/maps?q=") + latlon + qsl("&ll=") + latlon + qsl("&z=16"); + return u"https://maps.google.com/maps?q="_q + + latlon + + u"&ll="_q + + latlon + + u"&z=16"_q; } diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp index 74cf153e6..10492a3a8 100644 --- a/Telegram/SourceFiles/history/history_service.cpp +++ b/Telegram/SourceFiles/history/history_service.cpp @@ -138,7 +138,7 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) { lt_from, fromLinkText(), // Link 1. lt_user, - { .text = qsl("somebody") }, + { .text = u"somebody"_q }, Ui::Text::WithEntities); } else { result.links.push_back(fromLink()); @@ -928,7 +928,7 @@ HistoryService::PreparedText HistoryService::prepareInvitedToCallText( lt_from, fromLinkText(), // Link 1. lt_user, - { .text = qsl("somebody") }, + { .text = u"somebody"_q }, lt_chat, chatText, Ui::Text::WithEntities); diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 610c710f6..b4fc56fe3 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -4273,7 +4273,7 @@ bool HistoryWidget::insertBotCommand(const QString &cmd) { if (!insertingInlineBot) { auto &textWithTags = _field->getTextWithTags(); TextWithTags textWithTagsToSet; - QRegularExpressionMatch m = QRegularExpression(qsl("^/[A-Za-z_0-9]{0,64}(@[A-Za-z_0-9]{0,32})?(\\s|$)")).match(textWithTags.text); + const auto m = QRegularExpression(u"^/[A-Za-z_0-9]{0,64}(@[A-Za-z_0-9]{0,32})?(\\s|$)"_q).match(textWithTags.text); if (m.hasMatch()) { textWithTagsToSet = _field->getTextWithTagsPart(m.capturedLength()); } else { @@ -4631,7 +4631,7 @@ void HistoryWidget::toggleKeyboard(bool manual) { void HistoryWidget::startBotCommand() { setFieldText( - { qsl("/"), TextWithTags::Tags() }, + { u"/"_q, TextWithTags::Tags() }, 0, Ui::InputField::HistoryAction::NewEntry); } @@ -7610,7 +7610,7 @@ void HistoryWidget::paintEditHeader(Painter &p, const QRect &rect, int left, int auto timeSinceMessage = ItemDateTime(_replyEditMsg).msecsTo(QDateTime::currentDateTime()); auto editTimeLeft = (session().serverConfig().editTimeLimit * 1000LL) - timeSinceMessage; if (editTimeLeft < 2) { - editTimeLeftText = qsl("0:00"); + editTimeLeftText = u"0:00"_q; } else if (editTimeLeft > kDisplayEditTimeWarningMs) { updateIn = static_cast(qMin(editTimeLeft - kDisplayEditTimeWarningMs, qint64(kFullDayInMs))); } else { @@ -7621,7 +7621,7 @@ void HistoryWidget::paintEditHeader(Painter &p, const QRect &rect, int left, int ++updateIn; editTimeLeft = (editTimeLeft - 1) / 1000; // seconds - editTimeLeftText = qsl("%1:%2").arg(editTimeLeft / 60).arg(editTimeLeft % 60, 2, 10, QChar('0')); + editTimeLeftText = u"%1:%2"_q.arg(editTimeLeft / 60).arg(editTimeLeft % 60, 2, 10, QChar('0')); } // Restart timer only if we are sure that we've painted the whole timer. diff --git a/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp b/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp index ff00b2c45..ce88d565b 100644 --- a/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp +++ b/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp @@ -465,7 +465,7 @@ void BottomInfo::layoutDateText() { ? (tr::lng_edited(tr::now) + ' ') : QString(); const auto author = _data.author; - const auto prefix = !author.isEmpty() ? qsl(", ") : QString(); + const auto prefix = !author.isEmpty() ? u", "_q : QString(); const auto date = edited + QLocale().toString(_data.date, cTimeFormat()); const auto afterAuthor = prefix + date; const auto afterAuthorWidth = st::msgDateFont->width(afterAuthor); diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index fd8ba00ab..e91f4cbc5 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -110,8 +110,8 @@ void SavePhotoToFile(not_null photo) { FileDialog::GetWritePath( Core::App().getFileDialogParent(), tr::lng_save_photo(tr::now), - qsl("JPEG Image (*.jpg);;") + FileDialog::AllFilesFilter(), - filedialogDefaultName(qsl("photo"), qsl(".jpg")), + u"JPEG Image (*.jpg);;"_q + FileDialog::AllFilesFilter(), + filedialogDefaultName(u"photo"_q, u".jpg"_q), crl::guard(&photo->session(), [=](const QString &result) { if (!result.isEmpty()) { media->saveToFile(result); diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index 462a4f551..9d32fdff9 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -3559,7 +3559,7 @@ std::unique_ptr ListWidget::prepareDrag() { : MessageIdsList(); if (!items.empty()) { session().data().setMimeForwardIds(std::move(items)); - mimeData->setData(qsl("application/x-td-forward"), "1"); + mimeData->setData(u"application/x-td-forward"_q, "1"); } } return mimeData; @@ -3589,7 +3589,7 @@ std::unique_ptr ListWidget::prepareDrag() { } session().data().setMimeForwardIds(std::move(forwardIds)); auto result = std::make_unique(); - result->setData(qsl("application/x-td-forward"), "1"); + result->setData(u"application/x-td-forward"_q, "1"); if (const auto media = pressedView->media()) { if (const auto document = media->getDocument()) { const auto filepath = document->filepath(true); diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index dd932c2c3..f6017327e 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -1402,7 +1402,7 @@ void TopBarWidget::updateUnreadBadge() { return QString(); } return (counter > 999) - ? qsl("..%1").arg(counter % 100, 2, 10, QChar('0')) + ? u"..%1"_q.arg(counter % 100, 2, 10, QChar('0')) : QString::number(counter); }(); _unreadBadge->setText(text, !muted); diff --git a/Telegram/SourceFiles/history/view/media/history_view_file.cpp b/Telegram/SourceFiles/history/view/media/history_view_file.cpp index 8b5b851c5..3a77d6d2a 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_file.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_file.cpp @@ -75,7 +75,7 @@ void File::setStatusSize( if (_statusSize == Ui::FileStatusSizeReady) { _statusText = (duration >= 0) ? Ui::FormatDurationAndSizeText(duration, fullSize) : (duration < -1 ? Ui::FormatGifAndSizeText(fullSize) : Ui::FormatSizeText(fullSize)); } else if (_statusSize == Ui::FileStatusSizeLoaded) { - _statusText = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? qsl("GIF") : Ui::FormatSizeText(fullSize)); + _statusText = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? u"GIF"_q : Ui::FormatSizeText(fullSize)); } else if (_statusSize == Ui::FileStatusSizeFailed) { _statusText = tr::lng_attach_failed(tr::now); } else if (_statusSize >= 0) { diff --git a/Telegram/SourceFiles/info/media/info_media_list_widget.cpp b/Telegram/SourceFiles/info/media/info_media_list_widget.cpp index d19c3131e..2f053fbdc 100644 --- a/Telegram/SourceFiles/info/media/info_media_list_widget.cpp +++ b/Telegram/SourceFiles/info/media/info_media_list_widget.cpp @@ -1645,7 +1645,7 @@ void ListWidget::performDrag() { // auto selectedState = getSelectionState(); // if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) { // session().data().setMimeForwardIds(collectSelectedIds()); - // mimeData->setData(qsl("application/x-td-forward"), "1"); + // mimeData->setData(u"application/x-td-forward"_q, "1"); // } // } // _controller->parentController()->window()->launchDrag(std::move(mimeData)); @@ -1657,14 +1657,14 @@ void ListWidget::performDrag() { // pressedMedia = pressedItem->getMedia(); // if (_mouseCursorState == CursorState::Date || (pressedMedia && pressedMedia->dragItem())) { // session().data().setMimeForwardIds(session().data().itemOrItsGroup(pressedItem)); - // forwardMimeType = qsl("application/x-td-forward"); + // forwardMimeType = u"application/x-td-forward"_q; // } // } // if (auto pressedLnkItem = App::pressedLinkItem()) { // if ((pressedMedia = pressedLnkItem->getMedia())) { // if (forwardMimeType.isEmpty() && pressedMedia->dragItemByHandler(pressedHandler)) { // session().data().setMimeForwardIds({ 1, pressedLnkItem->fullId() }); - // forwardMimeType = qsl("application/x-td-forward"); + // forwardMimeType = u"application/x-td-forward"_q; // } // } // } diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index b05a4f6cd..83795cb23 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -853,10 +853,10 @@ void ActionsFiller::addBotCommandActions(not_null user) { }; addBotCommand( tr::lng_profile_bot_help(), - qsl("help"), + u"help"_q, &st::infoIconInformation); - addBotCommand(tr::lng_profile_bot_settings(), qsl("settings")); - addBotCommand(tr::lng_profile_bot_privacy(), qsl("privacy")); + addBotCommand(tr::lng_profile_bot_settings(), u"settings"_q); + addBotCommand(tr::lng_profile_bot_privacy(), u"privacy"_q); } void ActionsFiller::addReportAction() { diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp index b38bd84d8..f13e0d0ca 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp @@ -1154,7 +1154,7 @@ void File::setStatusSize( if (_statusSize == Ui::FileStatusSizeReady) { _statusText = (duration >= 0) ? Ui::FormatDurationAndSizeText(duration, fullSize) : (duration < -1 ? Ui::FormatGifAndSizeText(fullSize) : Ui::FormatSizeText(fullSize)); } else if (_statusSize == Ui::FileStatusSizeLoaded) { - _statusText = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? qsl("GIF") : Ui::FormatSizeText(fullSize)); + _statusText = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? u"GIF"_q : Ui::FormatSizeText(fullSize)); } else if (_statusSize == Ui::FileStatusSizeFailed) { _statusText = tr::lng_attach_failed(tr::now); } else if (_statusSize >= 0) { diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp index fbcd41df2..40888f5b1 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp @@ -507,10 +507,10 @@ MTPVector Result::adjustAttributes( const auto p = Core::MimeTypeForName(mime).globPatterns(); auto pattern = p.isEmpty() ? QString() : p.front(); const auto extension = pattern.isEmpty() - ? qsl(".unknown") + ? u".unknown"_q : pattern.replace('*', QString()); const auto filename = filedialogDefaultName( - qsl("inline"), + u"inline"_q, extension, QString(), true); diff --git a/Telegram/SourceFiles/intro/intro_code.cpp b/Telegram/SourceFiles/intro/intro_code.cpp index 00cb0f93c..2932decb5 100644 --- a/Telegram/SourceFiles/intro/intro_code.cpp +++ b/Telegram/SourceFiles/intro/intro_code.cpp @@ -145,18 +145,18 @@ void CodeWidget::updateCallText() { return tr::lng_code_call( tr::now, lt_minutes, - qsl("%1:%2" + (u"%1:%2"_q ).arg(_callTimeout / 3600 ).arg((_callTimeout / 60) % 60, 2, 10, QChar('0')), lt_seconds, - qsl("%1").arg(_callTimeout % 60, 2, 10, QChar('0'))); + u"%1"_q.arg(_callTimeout % 60, 2, 10, QChar('0'))); } else { return tr::lng_code_call( tr::now, lt_minutes, QString::number(_callTimeout / 60), lt_seconds, - qsl("%1").arg(_callTimeout % 60, 2, 10, QChar('0'))); + u"%1"_q.arg(_callTimeout % 60, 2, 10, QChar('0'))); } } break; case CallStatus::Calling: diff --git a/Telegram/SourceFiles/intro/intro_phone.cpp b/Telegram/SourceFiles/intro/intro_phone.cpp index 137312bca..397b4a5c5 100644 --- a/Telegram/SourceFiles/intro/intro_phone.cpp +++ b/Telegram/SourceFiles/intro/intro_phone.cpp @@ -86,7 +86,7 @@ PhoneWidget::PhoneWidget( setupQrLogin(); if (!_country->chooseCountry(getData()->country)) { - _country->chooseCountry(qsl("US")); + _country->chooseCountry(u"US"_q); } _changed = false; } diff --git a/Telegram/SourceFiles/intro/intro_start.cpp b/Telegram/SourceFiles/intro/intro_start.cpp index c3b5c1e54..d4ebdec0b 100644 --- a/Telegram/SourceFiles/intro/intro_start.cpp +++ b/Telegram/SourceFiles/intro/intro_start.cpp @@ -24,7 +24,7 @@ StartWidget::StartWidget( not_null data) : Step(parent, account, data, true) { setMouseTracking(true); - setTitleText(rpl::single(qsl("Telegram Desktop"))); + setTitleText(rpl::single(u"Telegram Desktop"_q)); setDescriptionText(tr::lng_intro_about()); show(); } diff --git a/Telegram/SourceFiles/lang/lang_instance.cpp b/Telegram/SourceFiles/lang/lang_instance.cpp index e84036060..48ce55f1c 100644 --- a/Telegram/SourceFiles/lang/lang_instance.cpp +++ b/Telegram/SourceFiles/lang/lang_instance.cpp @@ -19,7 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Lang { namespace { -const auto kSerializeVersionTag = qsl("#new"); +const auto kSerializeVersionTag = u"#new"_q; constexpr auto kSerializeVersion = 1; constexpr auto kDefaultLanguage = "en"_cs; constexpr auto kCloudLangPackName = "tdesktop"_cs; @@ -231,11 +231,11 @@ QString CustomLanguageId() { Language DefaultLanguage() { return Language{ - qsl("en"), + u"en"_q, QString(), QString(), - qsl("English"), - qsl("English"), + u"English"_q, + u"English"_q, }; } diff --git a/Telegram/SourceFiles/layout/layout_document_generic_preview.cpp b/Telegram/SourceFiles/layout/layout_document_generic_preview.cpp index d28a5bece..a0a92850e 100644 --- a/Telegram/SourceFiles/layout/layout_document_generic_preview.cpp +++ b/Telegram/SourceFiles/layout/layout_document_generic_preview.cpp @@ -31,7 +31,7 @@ DocumentGenericPreview DocumentGenericPreview::Create( ? (document->filename().isEmpty() ? (document->sticker() ? tr::lng_in_dlg_sticker(tr::now) - : qsl("Unknown File")) + : u"Unknown File"_q) : document->filename()) : tr::lng_message_empty(tr::now)).toLower(); auto lastDot = name.lastIndexOf('.'); diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index 02affba17..b6905dcd1 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -80,7 +80,7 @@ public: } bool openMain() { - return reopen(LogDataMain, 0, qsl("start")); + return reopen(LogDataMain, 0, u"start"_q); } void closeMain() { @@ -181,7 +181,7 @@ private: int32 oldest = -1; // find not existing log_startX.txt or pick the oldest one (by lastModified) QDateTime oldestLastModified; for (int32 i = 0; i < 10; ++i) { - QString trying = _logsFilePath(type, qsl("_start%1").arg(i)); + QString trying = _logsFilePath(type, u"_start%1"_q.arg(i)); files[type]->setFileName(trying); if (!files[type]->exists()) { LogsStartIndexChosen = i; @@ -195,7 +195,7 @@ private: } } if (!found) { - files[type]->setFileName(_logsFilePath(type, qsl("_start%1").arg(oldest))); + files[type]->setFileName(_logsFilePath(type, u"_start%1"_q.arg(oldest))); LogsStartIndexChosen = oldest; } } @@ -437,7 +437,7 @@ void start(not_null launcher) { if (!LogsData) { LOG(("FATAL: Could not open '%1' for writing log!" - ).arg(_logsFilePath(LogDataMain, qsl("_startXX")))); + ).arg(_logsFilePath(LogDataMain, u"_startXX"_q))); return; } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 8906df3b7..994089b4e 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -634,7 +634,7 @@ bool MainWidget::filesOrForwardDrop( } return true; } - if (data->hasFormat(qsl("application/x-td-forward"))) { + if (data->hasFormat(u"application/x-td-forward"_q)) { auto draft = Data::ForwardDraft{ .ids = session().data().takeMimeForwardIds(), }; diff --git a/Telegram/SourceFiles/media/system_media_controls_manager.cpp b/Telegram/SourceFiles/media/system_media_controls_manager.cpp index ef8487f9c..b4e45348a 100644 --- a/Telegram/SourceFiles/media/system_media_controls_manager.cpp +++ b/Telegram/SourceFiles/media/system_media_controls_manager.cpp @@ -55,7 +55,7 @@ SystemMediaControlsManager::SystemMediaControlsManager( // Flatpak provides default permission to MPRIS, but not snap if (!KSandbox::isFlatpak()) { - _controls->setServiceName(qsl("tdesktop")); + _controls->setServiceName(u"tdesktop"_q); } _controls->setApplicationName(AppName.utf16()); const auto inited = _controls->init(controller->widget()); diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index a32bf38fa..44e66f528 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -314,7 +314,7 @@ OverlayWidget::OverlayWidget() ? Core::App().settings().videoVolume() : Core::Settings::kDefaultVolume; - _widget->setWindowTitle(qsl("Media viewer")); + _widget->setWindowTitle(u"Media viewer"_q); const auto text = tr::lng_mediaview_saved_to( tr::now, @@ -1617,20 +1617,20 @@ void OverlayWidget::saveAs() { QStringList p = mimeType.globPatterns(); QString pattern = p.isEmpty() ? QString() : p.front(); if (name.isEmpty()) { - name = pattern.isEmpty() ? qsl(".unknown") : pattern.replace('*', QString()); + name = pattern.isEmpty() ? u".unknown"_q : pattern.replace('*', QString()); } if (pattern.isEmpty()) { filter = QString(); } else { - filter = mimeType.filterString() + qsl(";;") + FileDialog::AllFilesFilter(); + filter = mimeType.filterString() + u";;"_q + FileDialog::AllFilesFilter(); } file = FileNameForSave( _session, tr::lng_save_file(tr::now), filter, - qsl("doc"), + u"doc"_q, name, true, alreadyDir); @@ -1667,14 +1667,14 @@ void OverlayWidget::saveAs() { constexpr auto large = Data::PhotoSize::Large; if (const auto bytes = _photoMedia->videoContent(large); !bytes.isEmpty()) { const auto photo = _photo; - auto filter = qsl("Video Files (*.mp4);;") + FileDialog::AllFilesFilter(); + auto filter = u"Video Files (*.mp4);;"_q + FileDialog::AllFilesFilter(); FileDialog::GetWritePath( _widget.get(), tr::lng_save_video(tr::now), filter, filedialogDefaultName( - qsl("photo"), - qsl(".mp4"), + u"photo"_q, + u".mp4"_q, QString(), false, _photo->date), @@ -1697,15 +1697,15 @@ void OverlayWidget::saveAs() { const auto media = _photoMedia; const auto photo = _photo; - const auto filter = qsl("JPEG Image (*.jpg);;") + const auto filter = u"JPEG Image (*.jpg);;"_q + FileDialog::AllFilesFilter(); FileDialog::GetWritePath( _widget.get(), tr::lng_save_photo(tr::now), filter, filedialogDefaultName( - qsl("photo"), - qsl(".jpg"), + u"photo"_q, + u".jpg"_q, QString(), false, _photo->date), @@ -1745,7 +1745,7 @@ void OverlayWidget::downloadMedia() { const auto session = _photo ? &_photo->session() : &_document->session(); if (Core::App().settings().downloadPath().isEmpty()) { path = File::DefaultDownloadPath(session); - } else if (Core::App().settings().downloadPath() == qsl("tmp")) { + } else if (Core::App().settings().downloadPath() == u"tmp"_q) { path = session->local().tempDirectory(); } else { path = Core::App().settings().downloadPath(); @@ -1792,7 +1792,7 @@ void OverlayWidget::downloadMedia() { if (!QDir().exists(path)) { QDir().mkpath(path); } - toName = filedialogDefaultName(qsl("photo"), qsl(".mp4"), path); + toName = filedialogDefaultName(u"photo"_q, u".mp4"_q, path); if (!_photoMedia->saveToFile(toName)) { toName = QString(); } @@ -1808,7 +1808,7 @@ void OverlayWidget::downloadMedia() { if (!QDir().exists(path)) { QDir().mkpath(path); } - toName = filedialogDefaultName(qsl("photo"), qsl(".jpg"), path); + toName = filedialogDefaultName(u"photo"_q, u".jpg"_q, path); const auto saved = _photoMedia->saveToFile(toName); if (!saved) { toName = QString(); @@ -2676,7 +2676,7 @@ void OverlayWidget::displayDocument( _docName = (_document->type == StickerDocument) ? tr::lng_in_dlg_sticker(tr::now) : (_document->type == AnimatedDocument - ? qsl("GIF") + ? u"GIF"_q : (_document->filename().isEmpty() ? tr::lng_mediaview_doc_image(tr::now) : _document->filename())); diff --git a/Telegram/SourceFiles/mtproto/connection_http.cpp b/Telegram/SourceFiles/mtproto/connection_http.cpp index 3e7e04d87..37b9d2198 100644 --- a/Telegram/SourceFiles/mtproto/connection_http.cpp +++ b/Telegram/SourceFiles/mtproto/connection_http.cpp @@ -40,8 +40,12 @@ void HttpConnection::sendData(mtpBuffer &&buffer) { int32 requestSize = (buffer.size() - 2) * sizeof(mtpPrime); QNetworkRequest request(url()); - request.setHeader(QNetworkRequest::ContentLengthHeader, QVariant(requestSize)); - request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(qsl("application/x-www-form-urlencoded"))); + request.setHeader( + QNetworkRequest::ContentLengthHeader, + QVariant(requestSize)); + request.setHeader( + QNetworkRequest::ContentTypeHeader, + QVariant(u"application/x-www-form-urlencoded"_q)); CONNECTION_LOG_INFO(u"Sending %1 len request."_q.arg(requestSize)); _requests.insert(_manager.post(request, QByteArray((const char*)(&buffer[2]), requestSize))); @@ -255,27 +259,27 @@ QString HttpConnection::transport() const { if (!isConnected()) { return QString(); } - auto result = qsl("HTTP"); + auto result = u"HTTP"_q; if (qthelp::is_ipv6(_address)) { - result += qsl("/IPv6"); + result += u"/IPv6"_q; } return result; } QString HttpConnection::tag() const { - auto result = qsl("HTTP"); + auto result = u"HTTP"_q; if (qthelp::is_ipv6(_address)) { - result += qsl("/IPv6"); + result += u"/IPv6"_q; } else { - result += qsl("/IPv4"); + result += u"/IPv4"_q; } return result; } QUrl HttpConnection::url() const { const auto pattern = qthelp::is_ipv6(_address) - ? qsl("http://[%1]:%2/api") - : qsl("http://%1:%2/api"); + ? u"http://[%1]:%2/api"_q + : u"http://%1:%2/api"_q; // Not endpoint.port - always 80 port for http transport. return QUrl(pattern.arg(_address).arg(kForceHttpPort)); diff --git a/Telegram/SourceFiles/mtproto/connection_tcp.cpp b/Telegram/SourceFiles/mtproto/connection_tcp.cpp index d50234127..6fa51a999 100644 --- a/Telegram/SourceFiles/mtproto/connection_tcp.cpp +++ b/Telegram/SourceFiles/mtproto/connection_tcp.cpp @@ -636,19 +636,19 @@ QString TcpConnection::transport() const { if (!isConnected()) { return QString(); } - auto result = qsl("TCP"); + auto result = u"TCP"_q; if (qthelp::is_ipv6(_address)) { - result += qsl("/IPv6"); + result += u"/IPv6"_q; } return result; } QString TcpConnection::tag() const { - auto result = qsl("TCP"); + auto result = u"TCP"_q; if (qthelp::is_ipv6(_address)) { - result += qsl("/IPv6"); + result += u"/IPv6"_q; } else { - result += qsl("/IPv4"); + result += u"/IPv4"_q; } return result; } diff --git a/Telegram/SourceFiles/mtproto/mtp_instance.cpp b/Telegram/SourceFiles/mtproto/mtp_instance.cpp index d0f703570..5ea8954bd 100644 --- a/Telegram/SourceFiles/mtproto/mtp_instance.cpp +++ b/Telegram/SourceFiles/mtproto/mtp_instance.cpp @@ -1342,7 +1342,7 @@ bool Instance::Private::onErrorDefault( const auto requestId = response.requestId; const auto &type = error.type(); const auto code = error.code(); - auto badGuestDc = (code == 400) && (type == qsl("FILE_ID_INVALID")); + auto badGuestDc = (code == 400) && (type == u"FILE_ID_INVALID"_q); QRegularExpressionMatch m1, m2; if ((m1 = QRegularExpression("^(FILE|PHONE|NETWORK|USER)_MIGRATE_(\\d+)$").match(type)).hasMatch()) { if (!requestId) return false; diff --git a/Telegram/SourceFiles/mtproto/special_config_request.cpp b/Telegram/SourceFiles/mtproto/special_config_request.cpp index 4b014fc75..c6743fcd9 100644 --- a/Telegram/SourceFiles/mtproto/special_config_request.cpp +++ b/Telegram/SourceFiles/mtproto/special_config_request.cpp @@ -100,7 +100,7 @@ QByteArray ParseRemoteConfigResponse(const QByteArray &bytes) { return document.object().value( "entries" ).toObject().value( - qsl("%1%2").arg(kConfigKey, kConfigSubKey) + u"%1%2"_q.arg(kConfigKey, kConfigSubKey) ).toString().toLatin1(); } @@ -283,22 +283,22 @@ void SpecialConfigRequest::sendNextRequest() { void SpecialConfigRequest::performRequest(const Attempt &attempt) { const auto type = attempt.type; auto url = QUrl(); - url.setScheme(qsl("https")); + url.setScheme(u"https"_q); auto request = QNetworkRequest(); auto payload = QByteArray(); switch (type) { case Type::Mozilla: { url.setHost(attempt.data); - url.setPath(qsl("/dns-query")); - url.setQuery(qsl("name=%1&type=16&random_padding=%2").arg( + url.setPath(u"/dns-query"_q); + url.setQuery(u"name=%1&type=16&random_padding=%2"_q.arg( _domainString, GenerateDnsRandomPadding())); request.setRawHeader("accept", "application/dns-json"); } break; case Type::Google: { url.setHost(attempt.data); - url.setPath(qsl("/resolve")); - url.setQuery(qsl("name=%1&type=ANY&random_padding=%2").arg( + url.setPath(u"/resolve"_q); + url.setQuery(u"name=%1&type=ANY&random_padding=%2"_q.arg( _domainString, GenerateDnsRandomPadding())); if (!attempt.host.isEmpty()) { @@ -308,23 +308,23 @@ void SpecialConfigRequest::performRequest(const Attempt &attempt) { } break; case Type::RemoteConfig: { url.setHost(ApiDomain(attempt.data)); - url.setPath(qsl("/v1/projects/%1/namespaces/firebase:fetch" + url.setPath((u"/v1/projects/%1/namespaces/firebase:fetch"_q ).arg(kRemoteProject)); - url.setQuery(qsl("key=%1").arg(kApiKey)); - payload = qsl("{\"app_id\":\"%1\",\"app_instance_id\":\"%2\"}").arg( + url.setQuery(u"key=%1"_q.arg(kApiKey)); + payload = u"{\"app_id\":\"%1\",\"app_instance_id\":\"%2\"}"_q.arg( kAppId, InstanceId()).toLatin1(); request.setRawHeader("Content-Type", "application/json"); } break; case Type::Realtime: { - url.setHost(kFireProject + qsl(".%1").arg(attempt.data)); - url.setPath(qsl("/%1%2.json").arg(kConfigKey, kConfigSubKey)); + url.setHost(kFireProject + u".%1"_q.arg(attempt.data)); + url.setPath(u"/%1%2.json"_q.arg(kConfigKey, kConfigSubKey)); } break; case Type::FireStore: { url.setHost(attempt.host.isEmpty() ? ApiDomain(attempt.data) : attempt.data); - url.setPath(qsl("/v1/projects/%1/databases/(default)/documents/%2/%3" + url.setPath((u"/v1/projects/%1/databases/(default)/documents/%2/%3"_q ).arg( kFireProject, kConfigKey, @@ -517,7 +517,7 @@ void SpecialConfigRequest::handleResponse(const QByteArray &bytes) { for (const auto &address : data.vips().v) { const auto parseIp = [](const MTPint &ipv4) { const auto ip = *reinterpret_cast(&ipv4.v); - return qsl("%1.%2.%3.%4" + return (u"%1.%2.%3.%4"_q ).arg((ip >> 24) & 0xFF ).arg((ip >> 16) & 0xFF ).arg((ip >> 8) & 0xFF diff --git a/Telegram/SourceFiles/overview/overview_layout.cpp b/Telegram/SourceFiles/overview/overview_layout.cpp index 4ac13b6ea..5a60b599b 100644 --- a/Telegram/SourceFiles/overview/overview_layout.cpp +++ b/Telegram/SourceFiles/overview/overview_layout.cpp @@ -276,7 +276,7 @@ void StatusText::update( if (_size == Ui::FileStatusSizeReady) { _text = (duration >= 0) ? Ui::FormatDurationAndSizeText(duration, fullSize) : (duration < -1 ? Ui::FormatGifAndSizeText(fullSize) : Ui::FormatSizeText(fullSize)); } else if (_size == Ui::FileStatusSizeLoaded) { - _text = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? qsl("GIF") : Ui::FormatSizeText(fullSize)); + _text = (duration >= 0) ? Ui::FormatDurationText(duration) : (duration < -1 ? u"GIF"_q : Ui::FormatSizeText(fullSize)); } else if (_size == Ui::FileStatusSizeFailed) { _text = tr::lng_attach_failed(tr::now); } else if (_size >= 0) { @@ -1531,7 +1531,7 @@ Link::Link( } int32 afterLinkStart = entity.offset() + entity.length(); if (till > afterLinkStart) { - if (!QRegularExpression(qsl("^[,.\\s_=+\\-;:`'\"\\(\\)\\[\\]\\{\\}<>*&^%\\$#@!\\\\/]+$")).match(text.mid(afterLinkStart, till - afterLinkStart)).hasMatch()) { + if (!QRegularExpression(u"^[,.\\s_=+\\-;:`'\"\\(\\)\\[\\]\\{\\}<>*&^%\\$#@!\\\\/]+$"_q).match(text.mid(afterLinkStart, till - afterLinkStart)).hasMatch()) { ++lnk; break; } @@ -1539,7 +1539,7 @@ Link::Link( till = entity.offset(); } if (!lnk) { - if (QRegularExpression(qsl("^[,.\\s\\-;:`'\"\\(\\)\\[\\]\\{\\}<>*&^%\\$#@!\\\\/]+$")).match(text.mid(from, till - from)).hasMatch()) { + if (QRegularExpression(u"^[,.\\s\\-;:`'\"\\(\\)\\[\\]\\{\\}<>*&^%\\$#@!\\\\/]+$"_q).match(text.mid(from, till - from)).hasMatch()) { till = from; } } diff --git a/Telegram/SourceFiles/passport/passport_edit_identity_box.cpp b/Telegram/SourceFiles/passport/passport_edit_identity_box.cpp index 145a55ab1..b76d5bf45 100644 --- a/Telegram/SourceFiles/passport/passport_edit_identity_box.cpp +++ b/Telegram/SourceFiles/passport/passport_edit_identity_box.cpp @@ -267,9 +267,9 @@ void IdentityBox::updateControlsPosition() { void IdentityBox::chooseScan() { const auto filter = FileDialog::AllFilesFilter() - + qsl(";;Image files (*") - + cImgExtensions().join(qsl(" *")) - + qsl(")"); + + u";;Image files (*"_q + + cImgExtensions().join(u" *"_q) + + u")"_q; const auto callback = [=](FileDialog::OpenResult &&result) { if (result.paths.size() == 1) { encryptScan(result.paths.front()); diff --git a/Telegram/SourceFiles/passport/passport_form_controller.cpp b/Telegram/SourceFiles/passport/passport_form_controller.cpp index bbfedaab5..3b3e871a8 100644 --- a/Telegram/SourceFiles/passport/passport_form_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_form_controller.cpp @@ -268,10 +268,9 @@ auto ParseConfig(const QByteArray &json) { } // namespace QString NonceNameByScope(const QString &scope) { - if (scope.startsWith('{') && scope.endsWith('}')) { - return qsl("nonce"); - } - return qsl("payload"); + return (scope.startsWith('{') && scope.endsWith('}')) + ? u"nonce"_q + : u"payload"_q; } bool ValueChanged(not_null value, const ValueMap &data) { diff --git a/Telegram/SourceFiles/passport/passport_panel_controller.cpp b/Telegram/SourceFiles/passport/passport_panel_controller.cpp index 0e72eef40..dc7cc4164 100644 --- a/Telegram/SourceFiles/passport/passport_panel_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_controller.cpp @@ -217,7 +217,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Text, - qsl("first_name"), + "first_name"_q, tr::lng_passport_first_name(tr::now), NameValidate, DontFormat, @@ -226,27 +226,27 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Text, - qsl("middle_name"), + "middle_name"_q, tr::lng_passport_middle_name(tr::now), NameOrEmptyValidate, DontFormat, kMaxNameSize, - qsl("first_name"), + "first_name"_q, }, { ValueClass::Fields, Ui::PanelDetailsType::Text, - qsl("last_name"), + "last_name"_q, tr::lng_passport_last_name(tr::now), NameValidate, DontFormat, kMaxNameSize, - qsl("first_name"), + "first_name"_q, }, { ValueClass::Fields, Ui::PanelDetailsType::Date, - qsl("birth_date"), + "birth_date"_q, tr::lng_passport_birth_date(tr::now), DateValidate, DontFormat, @@ -254,7 +254,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Gender, - qsl("gender"), + "gender"_q, tr::lng_passport_gender(tr::now), GenderValidate, GenderFormat, @@ -262,7 +262,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Country, - qsl("country_code"), + "country_code"_q, tr::lng_passport_country(tr::now), CountryValidate, CountryFormat, @@ -270,7 +270,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Country, - qsl("residence_country_code"), + "residence_country_code"_q, tr::lng_passport_residence_country(tr::now), CountryValidate, CountryFormat, @@ -278,7 +278,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Scans, Ui::PanelDetailsType::Text, - qsl("document_no"), + "document_no"_q, tr::lng_passport_document_number(tr::now), DocumentValidate, DontFormat, @@ -287,14 +287,14 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Scans, Ui::PanelDetailsType::Date, - qsl("expiry_date"), + "expiry_date"_q, tr::lng_passport_expiry_date(tr::now), DateOrEmptyValidate, DontFormat, }, }; if (nativeNames) { - result.additionalDependencyKey = qsl("residence_country_code"); + result.additionalDependencyKey = "residence_country_code"_q; result.preferredLanguage = preferredLanguage ? std::move(preferredLanguage) @@ -342,35 +342,35 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Additional, Ui::PanelDetailsType::Text, - qsl("first_name_native"), + "first_name_native"_q, tr::lng_passport_first_name(tr::now), NativeNameValidate, DontFormat, kMaxNameSize, QString(), - qsl("first_name"), + "first_name"_q, }, { ValueClass::Additional, Ui::PanelDetailsType::Text, - qsl("middle_name_native"), + "middle_name_native"_q, tr::lng_passport_middle_name(tr::now), NativeNameOrEmptyValidate, DontFormat, kMaxNameSize, - qsl("first_name_native"), - qsl("middle_name"), + "first_name_native"_q, + "middle_name"_q, }, { ValueClass::Additional, Ui::PanelDetailsType::Text, - qsl("last_name_native"), + "last_name_native"_q, tr::lng_passport_last_name(tr::now), NativeNameValidate, DontFormat, kMaxNameSize, - qsl("first_name_native"), - qsl("last_name"), + "first_name_native"_q, + "last_name"_q, }, }; for (auto &row : additional) { @@ -409,7 +409,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Text, - qsl("street_line1"), + "street_line1"_q, tr::lng_passport_street(tr::now), StreetValidate, DontFormat, @@ -418,7 +418,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Text, - qsl("street_line2"), + "street_line2"_q, tr::lng_passport_street(tr::now), DontValidate, DontFormat, @@ -427,7 +427,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Text, - qsl("city"), + "city"_q, tr::lng_passport_city(tr::now), CityValidate, DontFormat, @@ -436,7 +436,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Text, - qsl("state"), + "state"_q, tr::lng_passport_state(tr::now), DontValidate, DontFormat, @@ -445,7 +445,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Country, - qsl("country_code"), + "country_code"_q, tr::lng_passport_country(tr::now), CountryValidate, CountryFormat, @@ -453,7 +453,7 @@ EditDocumentScheme GetDocumentScheme( { ValueClass::Fields, Ui::PanelDetailsType::Postcode, - qsl("post_code"), + "post_code"_q, tr::lng_passport_postcode(tr::now), PostcodeValidate, DontFormat, @@ -512,18 +512,18 @@ EditContactScheme GetContactScheme(Scope::Type type) { const std::map &LatinToNativeMap() { static const auto result = std::map { - { qsl("first_name"), qsl("first_name_native") }, - { qsl("last_name"), qsl("last_name_native") }, - { qsl("middle_name"), qsl("middle_name_native") }, + { "first_name"_q, "first_name_native"_q }, + { "last_name"_q, "last_name_native"_q }, + { "middle_name"_q, "middle_name_native"_q }, }; return result; } const std::map &NativeToLatinMap() { static const auto result = std::map { - { qsl("first_name_native"), qsl("first_name") }, - { qsl("last_name_native"), qsl("last_name") }, - { qsl("middle_name_native"), qsl("middle_name") }, + { "first_name_native"_q, "first_name"_q }, + { "last_name_native"_q, "last_name"_q }, + { "middle_name_native"_q, "middle_name"_q }, }; return result; } diff --git a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp index 38d2bbabe..a2200f6f7 100644 --- a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp @@ -84,8 +84,8 @@ bool Launcher::launchUpdater(UpdaterLaunch action) { const auto binaryPath = (action == UpdaterLaunch::JustRelaunch) ? (cExeDir() + cExeName()) : (cWriteProtected() - ? (cWorkingDir() + qsl("tupdates/temp/Updater")) - : (cExeDir() + qsl("Updater"))); + ? (cWorkingDir() + u"tupdates/temp/Updater"_q) + : (cExeDir() + u"Updater"_q)); auto argumentsList = Arguments(); if (action == UpdaterLaunch::PerformUpdate && cWriteProtected()) { @@ -102,7 +102,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) { if (cStartInTray()) { argumentsList.push("-startintray"); } - if (cDataFile() != qsl("data")) { + if (cDataFile() != u"data"_q) { argumentsList.push("-key"); argumentsList.push(QFile::encodeName(cDataFile())); } diff --git a/Telegram/SourceFiles/platform/linux/linux_desktop_environment.cpp b/Telegram/SourceFiles/platform/linux/linux_desktop_environment.cpp index 2d95e02dc..32d7f4e38 100644 --- a/Telegram/SourceFiles/platform/linux/linux_desktop_environment.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_desktop_environment.cpp @@ -105,11 +105,11 @@ std::vector ComputeAndLog() { const auto names = ranges::accumulate( result | ranges::views::transform([](auto type) { switch (type) { - case Type::Gnome: return qsl("Gnome, "); - case Type::Cinnamon: return qsl("Cinnamon, "); - case Type::KDE: return qsl("KDE, "); - case Type::Unity: return qsl("Unity, "); - case Type::MATE: return qsl("MATE, "); + case Type::Gnome: return u"Gnome, "_q; + case Type::Cinnamon: return u"Cinnamon, "_q; + case Type::KDE: return u"KDE, "_q; + case Type::Unity: return u"Unity, "_q; + case Type::MATE: return u"MATE, "_q; } Unexpected("Type in Platform::DesktopEnvironment::ComputeAndLog"); }), diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 79376e385..02a28c667 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -324,7 +324,7 @@ void MainWindow::createGlobalMenu() { }); auto quit = file->addAction( - tr::lng_mac_menu_quit_telegram(tr::now, lt_telegram, qsl("Telegram")), + tr::lng_mac_menu_quit_telegram(tr::now, lt_telegram, u"Telegram"_q), this, [=] { quitFromTray(); }, QKeySequence::Quit); @@ -485,7 +485,7 @@ void MainWindow::createGlobalMenu() { tr::lng_mac_menu_about_telegram( tr::now, lt_telegram, - qsl("Telegram")), + u"Telegram"_q), [=] { ensureWindowShown(); controller().show(Box()); diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 1b0bd93d6..8bb32c4b3 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -387,7 +387,7 @@ bool NotificationData::init( _notification->set_body( subtitle.isEmpty() ? msg.toStdString() - : qsl("%1\n%2").arg(subtitle, msg).toStdString()); + : u("%1\n%2"_q.arg(subtitle, msg).toStdString()); _notification->set_icon( Gio::ThemedIcon::create(base::IconName().toStdString())); @@ -500,16 +500,16 @@ bool NotificationData::init( _title = title.toStdString(); _imageKey = GetImageKey(CurrentServerInformationValue().specVersion); - if (capabilities.contains(qsl("body-markup"))) { + if (capabilities.contains(u"body-markup"_q)) { _body = subtitle.isEmpty() ? msg.toHtmlEscaped().toStdString() - : qsl("%1\n%2").arg( + : u"%1\n%2"_q.arg( subtitle.toHtmlEscaped(), msg.toHtmlEscaped()).toStdString(); } else { _body = subtitle.isEmpty() ? msg.toStdString() - : qsl("%1\n%2").arg(subtitle, msg).toStdString(); + : u"%1\n%2"_q.arg(subtitle, msg).toStdString(); } if (capabilities.contains("actions")) { @@ -812,16 +812,16 @@ bool ByDefault() { // with custom notifications static const auto NeededCapabilities = { // To show message content - qsl("body"), + u"body"_q, // To make the sender name bold - qsl("body-markup"), + u"body-markup"_q, // To have buttons on notifications - qsl("actions"), + u"actions"_q, // To have quick reply - qsl("inline-reply"), + u"inline-reply"_q, // To not to play sound with Don't Disturb activated // (no, using sound capability is not a way) - qsl("inhibitions"), + u"inhibitions"_q, }; return ranges::all_of(NeededCapabilities, [&](const auto &capability) { @@ -962,7 +962,7 @@ Manager::Private::Private(not_null manager) .arg(capabilities.join(", "))); } - if (capabilities.contains(qsl("inhibitions"))) { + if (capabilities.contains(u"inhibitions"_q)) { Noexcept([&] { _dbusConnection = Gio::DBus::Connection::get_sync( Gio::DBus::BusType::SESSION); diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index efc47dd88..be604117b 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -464,7 +464,7 @@ bool GenerateDesktopFile( QStringList exec; exec.append(cExeDir() + cExeName()); if (Core::Sandbox::Instance().customWorkingDir()) { - exec.append(qsl("-workdir")); + exec.append(u"-workdir"_q); exec.append(cWorkingDir()); } exec.append(args); @@ -485,7 +485,7 @@ bool GenerateDesktopFile( if (!exec.isEmpty()) { exec[0] = cExeDir() + cExeName(); if (Core::Sandbox::Instance().customWorkingDir()) { - exec.insert(1, qsl("-workdir")); + exec.insert(1, u"-workdir"_q); exec.insert(2, cWorkingDir()); } target->set_string( @@ -509,10 +509,10 @@ bool GenerateDesktopFile( if (!Core::UpdaterDisabled()) { DEBUG_LOG(("App Info: removing old .desktop files")); - QFile::remove(qsl("%1telegram.desktop").arg(targetPath)); - QFile::remove(qsl("%1telegramdesktop.desktop").arg(targetPath)); + QFile::remove(u"%1telegram.desktop"_q.arg(targetPath)); + QFile::remove(u"%1telegramdesktop.desktop"_q.arg(targetPath)); - const auto appimagePath = qsl("file://%1%2").arg( + const auto appimagePath = u"file://%1%2"_q.arg( cExeDir(), cExeName()).toUtf8(); @@ -522,7 +522,7 @@ bool GenerateDesktopFile( appimagePath.size(), md5Hash); - QFile::remove(qsl("%1appimagekit_%2-%3.desktop").arg( + QFile::remove(u"%1appimagekit_%2-%3.desktop"_q.arg( targetPath, md5Hash, AppName.utf16().replace(' ', '_'))); @@ -536,7 +536,7 @@ bool GenerateDesktopFile( hashMd5Hex(exePath.constData(), exePath.size(), md5Hash); } - QFile::remove(qsl("%1org.telegram.desktop.%2.desktop").arg( + QFile::remove(u"%1org.telegram.desktop.%2.desktop"_q.arg( targetPath, md5Hash)); } @@ -622,10 +622,10 @@ void AutostartToggle(bool enabled, Fn done) { } else { const auto autostart = QStandardPaths::writableLocation( QStandardPaths::GenericConfigLocation) - + qsl("/autostart/"); + + u"/autostart/"_q; if (enabled) { - GenerateDesktopFile(autostart, { qsl("-autostart") }, silent); + GenerateDesktopFile(autostart, { u"-autostart"_q }, silent); } else { QFile::remove(autostart + QGuiApplication::desktopFileName()); } @@ -668,8 +668,8 @@ QString psAppDataPath() { // If we find data there, we should still use it. auto home = QDir::homePath(); if (!home.isEmpty()) { - auto oldPath = home + qsl("/.TelegramDesktop/"); - auto oldSettingsBase = oldPath + qsl("tdata/settings"); + auto oldPath = home + u"/.TelegramDesktop/"_q; + auto oldSettingsBase = oldPath + u"tdata/settings"_q; if (QFile::exists(oldSettingsBase + '0') || QFile::exists(oldSettingsBase + '1') || QFile::exists(oldSettingsBase + 's')) { @@ -710,14 +710,14 @@ void start() { QGuiApplication::setDesktopFileName([&] { if (KSandbox::isFlatpak()) { - return qEnvironmentVariable("FLATPAK_ID") + qsl(".desktop"); + return qEnvironmentVariable("FLATPAK_ID") + u".desktop"_q; } if (KSandbox::isSnap()) { return qEnvironmentVariable("SNAP_INSTANCE_NAME") + '_' + cExeName() - + qsl(".desktop"); + + u".desktop"_q; } if (!Core::UpdaterDisabled()) { @@ -732,10 +732,10 @@ void start() { md5Hash.data()); } - return qsl("org.telegram.desktop._%1.desktop").arg(md5Hash); + return u"org.telegram.desktop._%1.desktop"_q.arg(md5Hash); } - return qsl("org.telegram.desktop.desktop"); + return u"org.telegram.desktop.desktop"_q; }()); LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName())); @@ -768,11 +768,11 @@ void start() { #endif // DESKTOP_APP_USE_PACKAGED_FONTS #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION - Webview::WebKit2Gtk::SetSocketPath(qsl("%1/%2-%3-webview-%4").arg( + Webview::WebKit2Gtk::SetSocketPath(u"%1/%2-%3-webview-%4"_q.arg( QDir::tempPath(), h, cGUIDStr(), - qsl("%1")).toStdString()); + u"%1"_q).toStdString()); } void finish() { @@ -795,11 +795,11 @@ void InstallLauncher(bool force) { GenerateDesktopFile(applicationsPath); const auto icons = QStandardPaths::writableLocation( - QStandardPaths::GenericDataLocation) + qsl("/icons/"); + QStandardPaths::GenericDataLocation) + u"/icons/"_q; if (!QDir(icons).exists()) QDir().mkpath(icons); - const auto icon = icons + base::IconName() + qsl(".png"); + const auto icon = icons + base::IconName() + u".png"_q; auto iconExists = QFile::exists(icon); if (Local::oldSettingsVersion() < 2008012 && iconExists) { // Icon was changed. @@ -808,7 +808,7 @@ void InstallLauncher(bool force) { } } if (!iconExists) { - if (QFile::copy(qsl(":/gui/art/logo_256.png"), icon)) { + if (QFile::copy(u":/gui/art/logo_256.png"_q, icon)) { DEBUG_LOG(("App Info: Icon copied to '%1'").arg(icon)); } } @@ -876,8 +876,8 @@ void NewVersionLaunched(int oldVersion) { && oldVersion <= 4000002 && qEnvironmentVariableIsSet("WAYLAND_DISPLAY") && DesktopEnvironment::IsGnome() - && !QFile::exists(cWorkingDir() + qsl("tdata/nowayland"))) { - QFile f(cWorkingDir() + qsl("tdata/nowayland")); + && !QFile::exists(cWorkingDir() + u"tdata/nowayland"_q)) { + QFile f(cWorkingDir() + u"tdata/nowayland"_q); if (f.open(QIODevice::WriteOnly)) { f.write("1"); f.close(); diff --git a/Telegram/SourceFiles/platform/mac/file_utilities_mac.mm b/Telegram/SourceFiles/platform/mac/file_utilities_mac.mm index 995f8f598..2b21d4526 100644 --- a/Telegram/SourceFiles/platform/mac/file_utilities_mac.mm +++ b/Telegram/SourceFiles/platform/mac/file_utilities_mac.mm @@ -383,8 +383,8 @@ namespace File { QString UrlToLocal(const QUrl &url) { auto result = url.toLocalFile(); - if (result.startsWith(qsl("/.file/id="))) { - NSString *nsurl = [[[NSURL URLWithString: [NSString stringWithUTF8String: (qsl("file://") + result).toUtf8().constData()]] filePathURL] path]; + if (result.startsWith(u"/.file/id="_q)) { + NSString *nsurl = [[[NSURL URLWithString: [NSString stringWithUTF8String: (u"file://"_q + result).toUtf8().constData()]] filePathURL] path]; if (!nsurl) return QString(); return NS2QString(nsurl); diff --git a/Telegram/SourceFiles/platform/mac/launcher_mac.mm b/Telegram/SourceFiles/platform/mac/launcher_mac.mm index 95d15a8ef..599dcbb50 100644 --- a/Telegram/SourceFiles/platform/mac/launcher_mac.mm +++ b/Telegram/SourceFiles/platform/mac/launcher_mac.mm @@ -64,7 +64,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) { if (Logs::DebugEnabled()) [args addObject:@"-debug"]; if (cStartInTray()) [args addObject:@"-startintray"]; if (cUseFreeType()) [args addObject:@"-freetype"]; - if (cDataFile() != qsl("data")) { + if (cDataFile() != u"data"_q) { [args addObject:@"-key"]; [args addObject:Q2NSString(cDataFile())]; } diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.mm b/Telegram/SourceFiles/platform/mac/main_window_mac.mm index ab4554f65..e865cd228 100644 --- a/Telegram/SourceFiles/platform/mac/main_window_mac.mm +++ b/Telegram/SourceFiles/platform/mac/main_window_mac.mm @@ -291,7 +291,7 @@ void MainWindow::createGlobalMenu() { } }; - auto main = psMainMenu.addMenu(qsl("Telegram")); + auto main = psMainMenu.addMenu(u"Telegram"_q); { auto callback = [=] { ensureWindowShown(); @@ -301,7 +301,7 @@ void MainWindow::createGlobalMenu() { tr::lng_mac_menu_about_telegram( tr::now, lt_telegram, - qsl("Telegram")), + u"Telegram"_q), std::move(callback)) ->setMenuRole(QAction::AboutQtRole); } diff --git a/Telegram/SourceFiles/platform/mac/specific_mac.mm b/Telegram/SourceFiles/platform/mac/specific_mac.mm index bdf10e0c8..2a528bb2e 100644 --- a/Telegram/SourceFiles/platform/mac/specific_mac.mm +++ b/Telegram/SourceFiles/platform/mac/specific_mac.mm @@ -79,7 +79,7 @@ void finish() { QString SingleInstanceLocalServerName(const QString &hash) { #ifndef OS_MAC_STORE - return qsl("/tmp/") + hash + '-' + cGUIDStr(); + return u"/tmp/"_q + hash + '-' + cGUIDStr(); #else // OS_MAC_STORE return objc_documentsPath() + hash.left(4); #endif // OS_MAC_STORE @@ -208,7 +208,7 @@ QByteArray psDownloadPathBookmark(const QString &path) { } bool psLaunchMaps(const Data::LocationPoint &point) { - return QDesktopServices::openUrl(qsl("https://maps.apple.com/?q=Point&z=16&ll=%1,%2").arg(point.latAsString()).arg(point.lonAsString())); + return QDesktopServices::openUrl(u"https://maps.apple.com/?q=Point&z=16&ll=%1,%2"_q.arg(point.latAsString()).arg(point.lonAsString())); } QString strNotificationAboutThemeChange() { diff --git a/Telegram/SourceFiles/platform/mac/window_title_mac.mm b/Telegram/SourceFiles/platform/mac/window_title_mac.mm index aa513cd6e..e1aed9a19 100644 --- a/Telegram/SourceFiles/platform/mac/window_title_mac.mm +++ b/Telegram/SourceFiles/platform/mac/window_title_mac.mm @@ -79,7 +79,7 @@ void PreviewWindowTitle(Painter &p, const style::palette &palette, QRect body, i p.setPen(st::titleFgActive[palette]); p.setFont(font); - p.drawText(titleRect, qsl("Telegram"), style::al_center); + p.drawText(titleRect, u"Telegram"_q, style::al_center); auto isGraphite = ([NSColor currentControlTint] == NSGraphiteControlTint); auto buttonSkip = 8; diff --git a/Telegram/SourceFiles/platform/win/launcher_win.cpp b/Telegram/SourceFiles/platform/win/launcher_win.cpp index ea9f1b237..e105c8932 100644 --- a/Telegram/SourceFiles/platform/win/launcher_win.cpp +++ b/Telegram/SourceFiles/platform/win/launcher_win.cpp @@ -46,50 +46,50 @@ bool Launcher::launchUpdater(UpdaterLaunch action) { const auto operation = (action == UpdaterLaunch::JustRelaunch) ? QString() : (cWriteProtected() - ? qsl("runas") + ? u"runas"_q : QString()); const auto binaryPath = (action == UpdaterLaunch::JustRelaunch) ? (cExeDir() + cExeName()) : (cWriteProtected() - ? (cWorkingDir() + qsl("tupdates/temp/Updater.exe")) - : (cExeDir() + qsl("Updater.exe"))); + ? (cWorkingDir() + u"tupdates/temp/Updater.exe"_q) + : (cExeDir() + u"Updater.exe"_q)); auto argumentsList = QStringList(); const auto pushArgument = [&](const QString &argument) { argumentsList.push_back(argument.trimmed()); }; if (cLaunchMode() == LaunchModeAutoStart) { - pushArgument(qsl("-autostart")); + pushArgument(u"-autostart"_q); } if (Logs::DebugEnabled()) { - pushArgument(qsl("-debug")); + pushArgument(u"-debug"_q); } if (cStartInTray()) { - pushArgument(qsl("-startintray")); + pushArgument(u"-startintray"_q); } if (cUseFreeType()) { - pushArgument(qsl("-freetype")); + pushArgument(u"-freetype"_q); } if (customWorkingDir()) { - pushArgument(qsl("-workdir")); + pushArgument(u"-workdir"_q); pushArgument('"' + cWorkingDir() + '"'); } - if (cDataFile() != qsl("data")) { - pushArgument(qsl("-key")); + if (cDataFile() != u"data"_q) { + pushArgument(u"-key"_q); pushArgument('"' + cDataFile() + '"'); } if (action == UpdaterLaunch::JustRelaunch) { - pushArgument(qsl("-noupdate")); + pushArgument(u"-noupdate"_q); if (cRestartingToSettings()) { - pushArgument(qsl("-tosettings")); + pushArgument(u"-tosettings"_q); } } else { - pushArgument(qsl("-update")); - pushArgument(qsl("-exename")); + pushArgument(u"-update"_q); + pushArgument(u"-exename"_q); pushArgument('"' + cExeName() + '"'); if (cWriteProtected()) { - pushArgument(qsl("-writeprotected")); + pushArgument(u"-writeprotected"_q); pushArgument('"' + cExeDir() + '"'); } } diff --git a/Telegram/SourceFiles/platform/win/specific_win.cpp b/Telegram/SourceFiles/platform/win/specific_win.cpp index bb398dbc0..5786252af 100644 --- a/Telegram/SourceFiles/platform/win/specific_win.cpp +++ b/Telegram/SourceFiles/platform/win/specific_win.cpp @@ -88,7 +88,7 @@ BOOL CALLBACK ActivateProcessByPid(HWND hWnd, LPARAM lParam) { WCHAR nameBuf[nameBufSize]; int32 len = GetWindowText(hWnd, nameBuf, nameBufSize); if (len && len < nameBufSize) { - if (QRegularExpression(qsl("^Telegram(\\s*\\(\\d+\\))?$")).match(QString::fromStdWString(nameBuf)).hasMatch()) { + if (QRegularExpression(u"^Telegram(\\s*\\(\\d+\\))?$"_q).match(QString::fromStdWString(nameBuf)).hasMatch()) { BOOL res = ::SetForegroundWindow(hWnd); ::SetFocus(hWnd); return FALSE; @@ -149,7 +149,7 @@ void ManageAppLink(bool create, bool silent, int path_csidl, const wchar_t *args WCHAR startupFolder[MAX_PATH]; HRESULT hr = SHGetFolderPath(0, path_csidl, 0, SHGFP_TYPE_CURRENT, startupFolder); if (SUCCEEDED(hr)) { - QString lnk = QString::fromWCharArray(startupFolder) + '\\' + AppFile.utf16() + qsl(".lnk"); + QString lnk = QString::fromWCharArray(startupFolder) + '\\' + AppFile.utf16() + u".lnk"_q; if (create) { const auto shellLink = base::WinRT::TryCreateInstance( CLSID_ShellLink, @@ -203,7 +203,7 @@ QString psAppDataPath() { if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) { QDir appData(QString::fromStdWString(std::wstring(wstrPath))); #ifdef OS_WIN_STORE - return appData.absolutePath() + qsl("/Telegram Desktop UWP/"); + return appData.absolutePath() + u"/Telegram Desktop UWP/"_q; #else // OS_WIN_STORE return appData.absolutePath() + '/' + AppName.utf16() + '/'; #endif // OS_WIN_STORE @@ -341,7 +341,7 @@ void SetApplicationIcon(const QIcon &icon) { } QString SingleInstanceLocalServerName(const QString &hash) { - return qsl("Global\\") + hash + '-' + cGUIDStr(); + return u"Global\\"_q + hash + '-' + cGUIDStr(); } std::optional IsDarkMode() { @@ -485,12 +485,12 @@ namespace { if (status == ERROR_FILE_NOT_FOUND) { status = RegCreateKeyEx(HKEY_CURRENT_USER, key, 0, 0, REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE | KEY_WRITE, 0, rkey, 0); if (status != ERROR_SUCCESS) { - QString msg = qsl("App Error: could not create '%1' registry key, error %2").arg(QString::fromStdWString(key)).arg(qsl("%1: %2")); + QString msg = u"App Error: could not create '%1' registry key, error %2"_q.arg(QString::fromStdWString(key)).arg(u"%1: %2"_q); _psLogError(msg.toUtf8().constData(), status); return false; } } else { - QString msg = qsl("App Error: could not open '%1' registry key, error %2").arg(QString::fromStdWString(key)).arg(qsl("%1: %2")); + QString msg = u"App Error: could not open '%1' registry key, error %2"_q.arg(QString::fromStdWString(key)).arg(u"%1: %2"_q); _psLogError(msg.toUtf8().constData(), status); return false; } @@ -504,10 +504,10 @@ namespace { WCHAR defaultStr[bufSize] = { 0 }; if (RegQueryValueEx(rkey, value, 0, &defaultType, (BYTE*)defaultStr, &defaultSize) != ERROR_SUCCESS || defaultType != REG_SZ || defaultSize != (v.size() + 1) * 2 || QString::fromStdWString(defaultStr) != v) { WCHAR tmp[bufSize] = { 0 }; - if (!v.isEmpty()) StringCbPrintf(tmp, bufSize, v.replace(QChar('%'), qsl("%%")).toStdWString().c_str()); + if (!v.isEmpty()) StringCbPrintf(tmp, bufSize, v.replace(QChar('%'), u"%%"_q).toStdWString().c_str()); LSTATUS status = RegSetValueEx(rkey, value, 0, REG_SZ, (BYTE*)tmp, (wcslen(tmp) + 1) * sizeof(WCHAR)); if (status != ERROR_SUCCESS) { - QString msg = qsl("App Error: could not set %1, error %2").arg(value ? ('\'' + QString::fromStdWString(value) + '\'') : qsl("(Default)")).arg("%1: %2"); + QString msg = u"App Error: could not set %1, error %2"_q.arg(value ? ('\'' + QString::fromStdWString(value) + '\'') : u"(Default)"_q).arg("%1: %2"); _psLogError(msg.toUtf8().constData(), status); return false; } diff --git a/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp b/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp index 690a220ff..1f5b8ad8d 100644 --- a/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp +++ b/Telegram/SourceFiles/platform/win/windows_app_user_model_id.cpp @@ -188,7 +188,7 @@ QString systemShortcutPath() { void cleanupShortcut() { static const int maxFileLen = MAX_PATH * 10; - QString path = systemShortcutPath() + qsl("Telegram.lnk"); + QString path = systemShortcutPath() + u"Telegram.lnk"_q; std::wstring p = QDir::toNativeSeparators(path).toStdWString(); DWORD attributes = GetFileAttributes(p.c_str()); diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index 7a8402b06..ed0c4571b 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -47,8 +47,8 @@ QByteArray gLocalSalt; int gScreenScale = style::kScaleAuto; int gConfigScale = style::kScaleAuto; -QString gDateFormat = qsl("dd.MM.yy"); -QString gTimeFormat = qsl("hh:mm"); +QString gDateFormat = u"dd.MM.yy"_q; +QString gTimeFormat = u"hh:mm"_q; RecentStickerPreload gRecentStickersPreload; RecentStickerPack gRecentStickers; diff --git a/Telegram/SourceFiles/settings/settings_chat.cpp b/Telegram/SourceFiles/settings/settings_chat.cpp index 4c0fce9b9..1441de581 100644 --- a/Telegram/SourceFiles/settings/settings_chat.cpp +++ b/Telegram/SourceFiles/settings/settings_chat.cpp @@ -636,9 +636,9 @@ void ChooseFromFile( not_null controller, not_null parent) { auto filters = QStringList( - qsl("Theme files (*.tdesktop-theme *.tdesktop-palette *") - + Ui::ImageExtensions().join(qsl(" *")) - + qsl(")")); + u"Theme files (*.tdesktop-theme *.tdesktop-palette *"_q + + Ui::ImageExtensions().join(u" *"_q) + + u")"_q); filters.push_back(FileDialog::AllFilesFilter()); const auto callback = crl::guard(controller, [=]( const FileDialog::OpenResult &result) { @@ -674,7 +674,7 @@ void ChooseFromFile( FileDialog::GetOpenPath( parent.get(), tr::lng_choose_image(tr::now), - filters.join(qsl(";;")), + filters.join(u";;"_q), crl::guard(parent, callback)); } @@ -1056,7 +1056,7 @@ void SetupDataStorage( ) | rpl::map([](const QString &text) { if (text.isEmpty()) { return tr::lng_download_path_default(tr::now); - } else if (text == qsl("tmp")) { + } else if (text == u"tmp"_q) { return tr::lng_download_path_temp(tr::now); } return QDir::toNativeSeparators(text); @@ -1630,7 +1630,7 @@ void SetupSupport( not_null container) { AddSkip(container); - AddSubsectionTitle(container, rpl::single(qsl("Support settings"))); + AddSubsectionTitle(container, rpl::single(u"Support settings"_q)); AddSkip(container, st::settingsSendTypeSkip); @@ -1677,7 +1677,7 @@ void SetupSupport( AddSkip(inner, st::settingsCheckboxesSkip); - AddSubsectionTitle(inner, rpl::single(qsl("Load chats for a period"))); + AddSubsectionTitle(inner, rpl::single(u"Load chats for a period"_q)); SetupSupportChatsLimitSlice(controller, inner); diff --git a/Telegram/SourceFiles/settings/settings_codes.cpp b/Telegram/SourceFiles/settings/settings_codes.cpp index 409ff780f..47d49ab30 100644 --- a/Telegram/SourceFiles/settings/settings_codes.cpp +++ b/Telegram/SourceFiles/settings/settings_codes.cpp @@ -75,61 +75,62 @@ using SessionController = Window::SessionController; auto GenerateCodes() { auto codes = std::map>(); - codes.emplace(qsl("debugmode"), [](SessionController *window) { + codes.emplace(u"debugmode"_q, [](SessionController *window) { QString text = Logs::DebugEnabled() - ? qsl("Do you want to disable DEBUG logs?") - : qsl("Do you want to enable DEBUG logs?\n\n" - "All network events will be logged."); + ? u"Do you want to disable DEBUG logs?"_q + : u"Do you want to enable DEBUG logs?\n\nAll network events will be logged."_q; Ui::show(Ui::MakeConfirmBox({ text, [] { Core::App().switchDebugMode(); } })); }); - codes.emplace(qsl("viewlogs"), [](SessionController *window) { + codes.emplace(u"viewlogs"_q, [](SessionController *window) { File::ShowInFolder(cWorkingDir() + "log.txt"); }); if (!Core::UpdaterDisabled()) { - codes.emplace(qsl("testupdate"), [](SessionController *window) { + codes.emplace(u"testupdate"_q, [](SessionController *window) { Core::UpdateChecker().test(); }); } - codes.emplace(qsl("loadlang"), [](SessionController *window) { - Lang::CurrentCloudManager().switchToLanguage({ qsl("#custom") }); + codes.emplace(u"loadlang"_q, [](SessionController *window) { + Lang::CurrentCloudManager().switchToLanguage({ u"#custom"_q }); }); - codes.emplace(qsl("crashplease"), [](SessionController *window) { + codes.emplace(u"crashplease"_q, [](SessionController *window) { Unexpected("Crashed in Settings!"); }); - codes.emplace(qsl("moderate"), [](SessionController *window) { - auto text = Core::App().settings().moderateModeEnabled() ? qsl("Disable moderate mode?") : qsl("Enable moderate mode?"); + codes.emplace(u"moderate"_q, [](SessionController *window) { + auto text = Core::App().settings().moderateModeEnabled() ? u"Disable moderate mode?"_q : u"Enable moderate mode?"_q; Ui::show(Ui::MakeConfirmBox({ text, [=] { Core::App().settings().setModerateModeEnabled(!Core::App().settings().moderateModeEnabled()); Core::App().saveSettingsDelayed(); Ui::hideLayer(); } })); }); - codes.emplace(qsl("getdifference"), [](SessionController *window) { + codes.emplace(u"getdifference"_q, [](SessionController *window) { if (window) { window->session().updates().getDifference(); } }); - codes.emplace(qsl("loadcolors"), [](SessionController *window) { + codes.emplace(u"loadcolors"_q, [](SessionController *window) { FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open palette file", "Palette (*.tdesktop-palette)", [](const FileDialog::OpenResult &result) { if (!result.paths.isEmpty()) { Window::Theme::Apply(result.paths.front()); } }); }); - codes.emplace(qsl("videoplayer"), [](SessionController *window) { + codes.emplace(u"videoplayer"_q, [](SessionController *window) { if (!window) { return; } - auto text = cUseExternalVideoPlayer() ? qsl("Use internal video player?") : qsl("Use external video player?"); + auto text = cUseExternalVideoPlayer() + ? u"Use internal video player?"_q + : u"Use external video player?"_q; Ui::show(Ui::MakeConfirmBox({ text, [=] { cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer()); window->session().saveSettingsDelayed(); Ui::hideLayer(); } })); }); - codes.emplace(qsl("endpoints"), [](SessionController *window) { + codes.emplace(u"endpoints"_q, [](SessionController *window) { if (!Core::App().domain().started()) { return; } @@ -154,7 +155,7 @@ auto GenerateCodes() { } }); }); - codes.emplace(qsl("testmode"), [](SessionController *window) { + codes.emplace(u"testmode"_q, [](SessionController *window) { auto &domain = Core::App().domain(); if (domain.started() && (domain.accounts().size() == 1) @@ -170,29 +171,29 @@ auto GenerateCodes() { : "Switched to the production environment."); } }); - codes.emplace(qsl("folders"), [](SessionController *window) { + codes.emplace(u"folders"_q, [](SessionController *window) { if (window) { window->showSettings(Settings::Folders::Id()); } }); - codes.emplace(qsl("registertg"), [](SessionController *window) { + codes.emplace(u"registertg"_q, [](SessionController *window) { Core::Application::RegisterUrlScheme(); Ui::Toast::Show("Forced custom scheme register."); }); - codes.emplace(qsl("installlauncher"), [](SessionController *window) { + codes.emplace(u"installlauncher"_q, [](SessionController *window) { Platform::InstallLauncher(true); Ui::Toast::Show("Forced launcher installation."); }); #if defined Q_OS_WIN || defined Q_OS_MAC - codes.emplace(qsl("freetype"), [](SessionController *window) { + codes.emplace(u"freetype"_q, [](SessionController *window) { auto text = cUseFreeType() #ifdef Q_OS_WIN - ? qsl("Switch font engine to GDI?") + ? u"Switch font engine to GDI?"_q #else // Q_OS_WIN - ? qsl("Switch font engine to Cocoa?") + ? u"Switch font engine to Cocoa?"_q #endif // !Q_OS_WIN - : qsl("Switch font engine to FreeType?"); + : u"Switch font engine to FreeType?"_q; Ui::show(Ui::MakeConfirmBox({ text, [] { Core::App().switchFreeType(); @@ -200,14 +201,14 @@ auto GenerateCodes() { }); #endif // Q_OS_WIN || Q_OS_MAC - auto audioFilters = qsl("Audio files (*.wav *.mp3);;") + FileDialog::AllFilesFilter(); + auto audioFilters = u"Audio files (*.wav *.mp3);;"_q + FileDialog::AllFilesFilter(); auto audioKeys = { - qsl("msg_incoming"), - qsl("call_incoming"), - qsl("call_outgoing"), - qsl("call_busy"), - qsl("call_connect"), - qsl("call_end"), + u"msg_incoming"_q, + u"call_incoming"_q, + u"call_outgoing"_q, + u"call_busy"_q, + u"call_connect"_q, + u"call_end"_q, }; for (auto &key : audioKeys) { codes.emplace(key, [=](SessionController *window) { @@ -228,12 +229,12 @@ auto GenerateCodes() { }); }); } - codes.emplace(qsl("sounds_reset"), [](SessionController *window) { + codes.emplace(u"sounds_reset"_q, [](SessionController *window) { Core::App().settings().clearSoundOverrides(); Core::App().saveSettingsDelayed(); Ui::show(Ui::MakeInformBox("All sound overrides were reset.")); }); - codes.emplace(qsl("unpacklog"), [](SessionController *window) { + codes.emplace(u"unpacklog"_q, [](SessionController *window) { FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open crash log file", "Crash dump (*.txt)", [=](const FileDialog::OpenResult &result) { if (result.paths.isEmpty()) { return; @@ -277,15 +278,15 @@ auto GenerateCodes() { }); }); }); - codes.emplace(qsl("testchatcolors"), [](SessionController *window) { + codes.emplace(u"testchatcolors"_q, [](SessionController *window) { const auto now = !Data::CloudThemes::TestingColors(); Data::CloudThemes::SetTestingColors(now); Ui::Toast::Show(now ? "Testing chat theme colors!" : "Not testing.."); }); #ifdef Q_OS_MAC - codes.emplace(qsl("customicon"), [](SessionController *window) { - const auto iconFilters = qsl("Icon files (*.icns *.png);;") + FileDialog::AllFilesFilter(); + codes.emplace(u"customicon"_q, [](SessionController *window) { + const auto iconFilters = u"Icon files (*.icns *.png);;"_q + FileDialog::AllFilesFilter(); const auto change = [](const QString &path) { const auto success = path.isEmpty() ? base::ClearCustomAppIcon() diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp index 2251c2ec5..adf4594f4 100644 --- a/Telegram/SourceFiles/settings/settings_main.cpp +++ b/Telegram/SourceFiles/settings/settings_main.cpp @@ -265,7 +265,7 @@ void SetupLanguageButton( button->addClickHandler([=] { const auto m = button->clickModifiers(); if ((m & Qt::ShiftModifier) && (m & Qt::AltModifier)) { - Lang::CurrentCloudManager().switchToLanguage({ qsl("#custom") }); + Lang::CurrentCloudManager().switchToLanguage({ u"#custom"_q }); } else { *guard = LanguageBox::Show(); } diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp index f9b8e0925..6e0163629 100644 --- a/Telegram/SourceFiles/settings/settings_notifications.cpp +++ b/Telegram/SourceFiles/settings/settings_notifications.cpp @@ -309,7 +309,7 @@ void NotificationsCount::prepareNotificationSampleLarge() { p.setPen(st::dialogsNameFg); p.setFont(st::msgNameFont); - auto notifyTitle = st::msgNameFont->elided(qsl("Telegram Desktop"), rectForName.width()); + auto notifyTitle = st::msgNameFont->elided(u"Telegram Desktop"_q, rectForName.width()); p.drawText(rectForName.left(), rectForName.top() + st::msgNameFont->ascent, notifyTitle); st::notifyClose.icon.paint(p, w - st::notifyClosePos.x() - st::notifyClose.width + st::notifyClose.iconPosition.x(), st::notifyClosePos.y() + st::notifyClose.iconPosition.y(), w); diff --git a/Telegram/SourceFiles/storage/file_upload.cpp b/Telegram/SourceFiles/storage/file_upload.cpp index a30b6a495..08990076f 100644 --- a/Telegram/SourceFiles/storage/file_upload.cpp +++ b/Telegram/SourceFiles/storage/file_upload.cpp @@ -502,7 +502,7 @@ void Uploader::sendNext() { } const auto thumbFilename = uploadingData.file ? uploadingData.file->thumbname - : (qsl("thumb.") + uploadingData.media.thumbExt); + : (u"thumb."_q + uploadingData.media.thumbExt); const auto thumbMd5 = uploadingData.file ? uploadingData.file->thumbmd5 : uploadingData.media.jpeg_md5; diff --git a/Telegram/SourceFiles/storage/localimageloader.cpp b/Telegram/SourceFiles/storage/localimageloader.cpp index 0060fcf7d..5ccaec59a 100644 --- a/Telegram/SourceFiles/storage/localimageloader.cpp +++ b/Telegram/SourceFiles/storage/localimageloader.cpp @@ -113,7 +113,7 @@ struct PreparedFileThumbnail { const QString &filemime, int64 filesize, bool isSticker) { - prepared.name = isSticker ? qsl("thumb.webp") : qsl("thumb.jpg"); + prepared.name = isSticker ? u"thumb.webp"_q : u"thumb.jpg"_q; if (FileThumbnailUploadRequired(filemime, filesize)) { const auto format = isSticker ? "WEBP" : "JPG"; auto buffer = QBuffer(&prepared.bytes); @@ -784,7 +784,7 @@ void FileLoadTask::process(Args &&args) { } else if (!_content.isEmpty()) { filesize = _content.size(); if (isVoice) { - filename = filedialogDefaultName(qsl("audio"), qsl(".ogg"), QString(), true); + filename = filedialogDefaultName(u"audio"_q, u".ogg"_q, QString(), true); filemime = "audio/ogg"; } else { if (_information) { @@ -803,16 +803,16 @@ void FileLoadTask::process(Args &&args) { fullimagebytes = fullimageformat = QByteArray(); } if (filemime == "image/jpeg") { - filename = filedialogDefaultName(qsl("photo"), qsl(".jpg"), QString(), true); + filename = filedialogDefaultName(u"photo"_q, u".jpg"_q, QString(), true); } else if (filemime == "image/png") { - filename = filedialogDefaultName(qsl("image"), qsl(".png"), QString(), true); + filename = filedialogDefaultName(u"image"_q, u".png"_q, QString(), true); } else { QString ext; QStringList patterns = mimeType.globPatterns(); if (!patterns.isEmpty()) { ext = patterns.front().replace('*', QString()); } - filename = filedialogDefaultName(qsl("file"), ext, QString(), true); + filename = filedialogDefaultName(u"file"_q, ext, QString(), true); } } } else { @@ -829,14 +829,14 @@ void FileLoadTask::process(Args &&args) { if (ValidateThumbDimensions(fullimage.width(), fullimage.height())) { filesize = -1; // Fill later. filemime = Core::MimeTypeForName("image/jpeg").name(); - filename = filedialogDefaultName(qsl("image"), qsl(".jpg"), QString(), true); + filename = filedialogDefaultName(u"image"_q, u".jpg"_q, QString(), true); } else { _type = SendMediaType::File; } } if (_type == SendMediaType::File) { filemime = Core::MimeTypeForName("image/png").name(); - filename = filedialogDefaultName(qsl("image"), qsl(".png"), QString(), true); + filename = filedialogDefaultName(u"image"_q, u".png"_q, QString(), true); { QBuffer buffer(&_content); fullimage.save(&buffer, "PNG"); diff --git a/Telegram/SourceFiles/storage/localstorage.cpp b/Telegram/SourceFiles/storage/localstorage.cpp index f097c1806..b97ca35f5 100644 --- a/Telegram/SourceFiles/storage/localstorage.cpp +++ b/Telegram/SourceFiles/storage/localstorage.cpp @@ -143,7 +143,7 @@ void applyReadContext(ReadSettingsContext &&context) { bool _readOldSettings(bool remove, ReadSettingsContext &context) { bool result = false; - QFile file(cWorkingDir() + qsl("tdata/config")); + auto file = QFile(cWorkingDir() + u"tdata/config"_q); if (file.open(QIODevice::ReadOnly)) { LOG(("App Info: reading old config...")); QDataStream stream(&file); @@ -240,9 +240,9 @@ void _readOldUserSettingsFields( bool _readOldUserSettings(bool remove, ReadSettingsContext &context) { bool result = false; // We dropped old test authorizations when migrated to multi auth. - //const auto testPrefix = (cTestMode() ? qsl("_test") : QString()); + //const auto testPrefix = (cTestMode() ? u"_test"_q : QString()); const auto testPrefix = QString(); - QFile file(cWorkingDir() + cDataFile() + testPrefix + qsl("_config")); + QFile file(cWorkingDir() + cDataFile() + testPrefix + u"_config"_q); if (file.open(QIODevice::ReadOnly)) { LOG(("App Info: reading old user config...")); qint32 version = 0; @@ -321,7 +321,7 @@ void _readOldMtpDataFields( bool _readOldMtpData(bool remove, ReadSettingsContext &context) { bool result = false; // We dropped old test authorizations when migrated to multi auth. - //const auto testPostfix = (cTestMode() ? qsl("_test") : QString()); + //const auto testPostfix = (cTestMode() ? u"_test"_q : QString()); const auto testPostfix = QString(); QFile file(cWorkingDir() + cDataFile() + testPostfix); if (file.open(QIODevice::ReadOnly)) { @@ -355,13 +355,13 @@ void start() { _localLoader = new TaskQueue(kFileLoaderQueueStopTimeout); - _basePath = cWorkingDir() + qsl("tdata/"); + _basePath = cWorkingDir() + u"tdata/"_q; if (!QDir().exists(_basePath)) QDir().mkpath(_basePath); ReadSettingsContext context; FileReadDescriptor settingsData; // We dropped old test authorizations when migrated to multi auth. - //const auto name = cTestMode() ? qsl("settings_test") : qsl("settings"); + //const auto name = cTestMode() ? u"settings_test"_q : u"settings"_q; const auto name = u"settings"_q; if (!ReadFile(settingsData, name, _basePath)) { _readOldSettings(true, context); @@ -442,7 +442,7 @@ void writeSettings() { if (!QDir().exists(_basePath)) QDir().mkpath(_basePath); // We dropped old test authorizations when migrated to multi auth. - //const auto name = cTestMode() ? qsl("settings_test") : qsl("settings"); + //const auto name = cTestMode() ? u"settings_test"_q : u"settings"_q; const auto name = u"settings"_q; FileWriteDescriptor settings(name, _basePath); if (_settingsSalt.isEmpty() || !SettingsKey) { diff --git a/Telegram/SourceFiles/storage/storage_account.cpp b/Telegram/SourceFiles/storage/storage_account.cpp index fb97de46e..429881119 100644 --- a/Telegram/SourceFiles/storage/storage_account.cpp +++ b/Telegram/SourceFiles/storage/storage_account.cpp @@ -97,7 +97,7 @@ auto EmptyMessageDraftSources() [[nodiscard]] FileKey ComputeDataNameKey(const QString &dataName) { // We dropped old test authorizations when migrated to multi auth. - //const auto testAddition = (cTestMode() ? qsl(":/test/") : QString()); + //const auto testAddition = (cTestMode() ? u":/test/"_q : QString()); const auto testAddition = QString(); const auto dataNameUtf8 = (dataName + testAddition).toUtf8(); FileKey dataNameHash[2] = { 0 }; @@ -106,7 +106,7 @@ auto EmptyMessageDraftSources() } [[nodiscard]] QString BaseGlobalPath() { - return cWorkingDir() + qsl("tdata/"); + return cWorkingDir() + u"tdata/"_q; } [[nodiscard]] QString ComputeDatabasePath(const QString &dataName) { @@ -118,7 +118,7 @@ auto EmptyMessageDraftSources() } [[nodiscard]] QString LegacyTempDirectory() { - return cWorkingDir() + qsl("tdata/tdld/"); + return cWorkingDir() + u"tdata/tdld/"_q; } } // namespace @@ -243,7 +243,7 @@ Account::ReadMapResult Account::readMapWith( auto ms = crl::now(); FileReadDescriptor mapData; - if (!ReadFile(mapData, qsl("map"), _basePath)) { + if (!ReadFile(mapData, u"map"_q, _basePath)) { return ReadMapResult::Failed; } LOG(("App Info: reading map...")); @@ -1839,7 +1839,7 @@ void Account::readStickerSets( setTitle = tr::lng_stickers_default_set(tr::now); setFlags |= SetFlag::Official | SetFlag::Special; } else if (setId == Data::Stickers::CustomSetId) { - setTitle = qsl("Custom stickers"); + setTitle = u"Custom stickers"_q; setFlags |= SetFlag::Special; } else if ((setId == Data::Stickers::CloudRecentSetId) || (setId == Data::Stickers::CloudRecentAttachedSetId)) { @@ -2199,7 +2199,7 @@ void Account::importOldRecentStickers() { Data::Stickers::CustomSetId, uint64(0), // accessHash uint64(0), // hash - qsl("Custom stickers"), + u"Custom stickers"_q, QString(), 0, // count (SetFlag::Installed | SetFlag::Special), diff --git a/Telegram/SourceFiles/storage/storage_domain.cpp b/Telegram/SourceFiles/storage/storage_domain.cpp index b10efea36..1ea0e0f46 100644 --- a/Telegram/SourceFiles/storage/storage_domain.cpp +++ b/Telegram/SourceFiles/storage/storage_domain.cpp @@ -20,7 +20,7 @@ namespace { using namespace details; [[nodiscard]] QString BaseGlobalPath() { - return cWorkingDir() + qsl("tdata/"); + return cWorkingDir() + u"tdata/"_q; } [[nodiscard]] QString ComputeKeyName(const QString &dataName) { diff --git a/Telegram/SourceFiles/storage/storage_media_prepare.cpp b/Telegram/SourceFiles/storage/storage_media_prepare.cpp index 05876d20b..b26758185 100644 --- a/Telegram/SourceFiles/storage/storage_media_prepare.cpp +++ b/Telegram/SourceFiles/storage/storage_media_prepare.cpp @@ -132,7 +132,7 @@ bool ValidateEditMediaDragData( } MimeDataState ComputeMimeDataState(const QMimeData *data) { - if (!data || data->hasFormat(qsl("application/x-td-forward"))) { + if (!data || data->hasFormat(u"application/x-td-forward"_q)) { return MimeDataState::None; } diff --git a/Telegram/SourceFiles/support/support_autocomplete.cpp b/Telegram/SourceFiles/support/support_autocomplete.cpp index 1e7bb00d4..b9c41b8f4 100644 --- a/Telegram/SourceFiles/support/support_autocomplete.cpp +++ b/Telegram/SourceFiles/support/support_autocomplete.cpp @@ -398,7 +398,7 @@ void Autocomplete::setupContent() { object_ptr( this, st::gifsSearchField, - rpl::single(qsl("Search for templates"))), // #TODO hard_lang + rpl::single(u"Search for templates"_q)), // #TODO hard_lang st::autocompleteSearchPadding); const auto input = inputWrap->entity(); const auto scroll = Ui::CreateChild(this); @@ -510,7 +510,7 @@ ConfirmContactBox::ConfirmContactBox( } void ConfirmContactBox::prepare() { - setTitle(rpl::single(qsl("Confirmation"))); // #TODO hard_lang + setTitle(rpl::single(u"Confirmation"_q)); // #TODO hard_lang auto maxWidth = 0; if (_comment) { diff --git a/Telegram/SourceFiles/support/support_helper.cpp b/Telegram/SourceFiles/support/support_helper.cpp index 95d189590..77cd27a32 100644 --- a/Telegram/SourceFiles/support/support_helper.cpp +++ b/Telegram/SourceFiles/support/support_helper.cpp @@ -77,7 +77,7 @@ EditInfoBox::EditInfoBox( this, st::supportInfoField, Ui::InputField::Mode::MultiLine, - rpl::single(qsl("Support information")), // #TODO hard_lang + rpl::single(u"Support information"_q), // #TODO hard_lang text) , _submit(std::move(submit)) { _field->setMaxLength(kMaxSupportInfoLength); @@ -95,7 +95,7 @@ EditInfoBox::EditInfoBox( } void EditInfoBox::prepare() { - setTitle(rpl::single(qsl("Edit support information"))); // #TODO hard_lang + setTitle(rpl::single(u"Edit support information"_q)); // #TODO hard_lang const auto save = [=] { const auto done = crl::guard(this, [=](bool success) { @@ -270,7 +270,7 @@ Helper::Helper(not_null session) }); }).fail([=] { setSupportName( - qsl("[rand^") + u"[rand^"_q + QString::number(Core::Sandbox::Instance().installationTag()) + ']'); }).send(); diff --git a/Telegram/SourceFiles/support/support_templates.cpp b/Telegram/SourceFiles/support/support_templates.cpp index c06f45566..ccfac3bf1 100644 --- a/Telegram/SourceFiles/support/support_templates.cpp +++ b/Telegram/SourceFiles/support/support_templates.cpp @@ -78,7 +78,7 @@ void ReadByLine( for (const auto &utf : blob.split('\n')) { const auto line = QString::fromUtf8(utf).trimmed(); const auto match = QRegularExpression( - qsl("^\\{([A-Z_]+)\\}$") + u"^\\{([A-Z_]+)\\}$"_q ).match(line); if (match.hasMatch()) { const auto token = match.captured(1); @@ -180,7 +180,7 @@ FileResult ReadFile(const QString &path) { if (!f.open(QIODevice::ReadOnly)) { auto result = FileResult(); result.errors.push_back( - qsl("Couldn't open '%1' for reading!").arg(path)); + u"Couldn't open '%1' for reading!"_q.arg(path)); return result; } @@ -374,20 +374,20 @@ 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); + auto result = u"Template file '%1' updated!\n\n"_q.arg(path); if (!delta.added.empty()) { result += u"-------- Added --------\n\n"_q; for (const auto question : delta.added) { - result += qsl("Q: %1\nK: %2\nA: %3\n\n").arg( + result += u"Q: %1\nK: %2\nA: %3\n\n"_q.arg( question->question, - question->originalKeys.join(qsl(", ")), + question->originalKeys.join(u", "_q), question->value.trimmed()); } } if (!delta.changed.empty()) { result += u"-------- Modified --------\n\n"_q; for (const auto question : delta.changed) { - result += qsl("Q: %1\nA: %2\n\n").arg( + result += u"Q: %1\nA: %2\n\n"_q.arg( question->question, question->value.trimmed()); } @@ -395,7 +395,7 @@ QString FormatUpdateNotification(const QString &path, const Delta &delta) { if (!delta.removed.empty()) { result += u"-------- Removed --------\n\n"_q; for (const auto question : delta.removed) { - result += qsl("Q: %1\n\n").arg(question->question); + result += u"Q: %1\n\n"_q.arg(question->question); } } return result; @@ -411,19 +411,16 @@ QString UpdateFile( const auto old = full + u".old"_q; QFile(old).remove(); if (QFile(full).copy(old)) { - result += qsl("(old file saved at '%1')" - ).arg(path + u".old"_q); + result += u"(old file saved at '%1')"_q.arg(path + u".old"_q); QFile f(full); if (f.open(QIODevice::WriteOnly)) { WriteWithOwnUrlAndKeys(f, content, url, delta); } else { - result += qsl("\n\nError: could not open new file '%1'!" - ).arg(full); + result += u"\n\nError: could not open new file '%1'!"_q.arg(full); } } else { - result += qsl("Error: could not save old file '%1'!" - ).arg(old); + result += u"Error: could not save old file '%1'!"_q.arg(old); } return result; } @@ -555,8 +552,8 @@ void Templates::updateRequestFinished(QNetworkReply *reply) { } _updates->requests[path] = nullptr; if (reply->error() != QNetworkReply::NoError) { - const auto message = qsl( - "Error: template update failed, url '%1', error %2, %3" + const auto message = ( + u"Error: template update failed, url '%1', error %2, %3"_q ).arg(reply->url().toDisplayString() ).arg(reply->error() ).arg(reply->errorString()); diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 3de694b61..2a7e58555 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -798,7 +798,7 @@ void MainWindow::updateUnreadCounter() { } const auto counter = Core::App().unreadBadge(); - setTitle((counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram")); + setTitle((counter > 0) ? u"Telegram (%1)"_q.arg(counter) : u"Telegram"_q); Core::App().tray().updateIconCounters(); unreadCounterChangedHook(); diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 5029eb968..8e2899003 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -783,7 +783,7 @@ void System::ensureSoundCreated() { _soundTrack = Media::Audio::Current().createTrack(); _soundTrack->fillFromFile( - Core::App().settings().getSoundPath(qsl("msg_incoming"))); + Core::App().settings().getSoundPath(u"msg_incoming"_q)); } void System::updateAll() { diff --git a/Telegram/SourceFiles/window/notifications_utilities.cpp b/Telegram/SourceFiles/window/notifications_utilities.cpp index 2911ed575..8167f2d4b 100644 --- a/Telegram/SourceFiles/window/notifications_utilities.cpp +++ b/Telegram/SourceFiles/window/notifications_utilities.cpp @@ -27,7 +27,7 @@ constexpr int kNotifyDeletePhotoAfterMs = 60000; CachedUserpics::CachedUserpics(Type type) : _type(type) , _clearTimer([=] { clear(); }) { - QDir().mkpath(cWorkingDir() + qsl("tdata/temp")); + QDir().mkpath(cWorkingDir() + u"tdata/temp"_q); } CachedUserpics::~CachedUserpics() { @@ -37,7 +37,7 @@ CachedUserpics::~CachedUserpics() { } // This works about 1200ms on Windows for a folder with one image O_o - // base::Platform::DeleteDirectory(cWorkingDir() + qsl("tdata/temp")); + // base::Platform::DeleteDirectory(cWorkingDir() + u"tdata/temp"_q); } } diff --git a/Telegram/SourceFiles/window/themes/window_theme.cpp b/Telegram/SourceFiles/window/themes/window_theme.cpp index 60def7370..174b2f128 100644 --- a/Telegram/SourceFiles/window/themes/window_theme.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme.cpp @@ -482,7 +482,7 @@ SendMediaReady PrepareWallPaper(MTP::DcId dcId, const QImage &image) { }; push("s", scaled(320)); - const auto filename = qsl("wallpaper.jpg"); + const auto filename = u"wallpaper.jpg"_q; auto attributes = QVector( 1, MTP_documentAttributeFilename(MTP_string(filename))); @@ -702,7 +702,7 @@ void ChatBackground::set(const Data::WallPaper &paper, QImage image) { setPreparedAfterPaper(std::move(image)); } else { if (Data::IsLegacy1DefaultWallPaper(_paper)) { - image.load(qsl(":/gui/art/bg_initial.jpg")); + image.load(u":/gui/art/bg_initial.jpg"_q); const auto scale = cScale() * cIntRetinaFactor(); if (scale != 100) { image = image.scaledToWidth( diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp index 1d366233d..3f87b0cab 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp @@ -778,7 +778,7 @@ void Editor::exportTheme() { void Editor::importTheme() { auto filters = QStringList( - qsl("Theme files (*.tdesktop-theme *.tdesktop-palette)")); + u"Theme files (*.tdesktop-theme *.tdesktop-palette)"_q); filters.push_back(FileDialog::AllFilesFilter()); const auto callback = crl::guard(this, [=]( const FileDialog::OpenResult &result) { @@ -817,7 +817,7 @@ void Editor::importTheme() { FileDialog::GetOpenPath( this, tr::lng_theme_editor_menu_import(tr::now), - filters.join(qsl(";;")), + filters.join(u";;"_q), crl::guard(this, callback)); } diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp index e4e5ec98a..6ca4cb303 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp @@ -19,7 +19,7 @@ namespace Window { namespace Theme { namespace { -auto SearchSplitter = QRegularExpression(qsl("[\\@\\s\\-\\+\\(\\)\\[\\]\\{\\}\\<\\>\\,\\.\\:\\!\\_\\;\\\"\\'\\x0\\#]")); +auto SearchSplitter = QRegularExpression(u"[\\@\\s\\-\\+\\(\\)\\[\\]\\{\\}\\<\\>\\,\\.\\:\\!\\_\\;\\\"\\'\\x0\\#]"_q); } // namespace diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp index f3a3f04d1..d1c648fc0 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp @@ -236,7 +236,7 @@ void ImportFromFile( not_null session, not_null parent) { auto filters = QStringList( - qsl("Theme files (*.tdesktop-theme *.tdesktop-palette)")); + u"Theme files (*.tdesktop-theme *.tdesktop-palette)"_q); filters.push_back(FileDialog::AllFilesFilter()); const auto callback = crl::guard(session, [=]( const FileDialog::OpenResult &result) { @@ -250,7 +250,7 @@ void ImportFromFile( FileDialog::GetOpenPath( parent.get(), tr::lng_theme_editor_menu_import(tr::now), - filters.join(qsl(";;")), + filters.join(u";;"_q), crl::guard(parent, callback)); } @@ -420,7 +420,7 @@ SendMediaReady PrepareThemeMedia( push("s", std::move(thumbnail), thumbnailBytes); const auto filename = base::FileNameFromUserString(name) - + qsl(".tdesktop-theme"); + + u".tdesktop-theme"_q; auto attributes = QVector( 1, MTP_documentAttributeFilename(MTP_string(filename))); @@ -822,7 +822,7 @@ void SaveThemeBox( const auto link = Ui::CreateChild( linkWrap, st::createThemeLink, - rpl::single(qsl("link")), + rpl::single(u"link"_q), cloud.slug.isEmpty() ? GenerateSlug() : cloud.slug, window->account().session().createInternalLink(QString())); linkWrap->widthValue( @@ -835,7 +835,7 @@ void SaveThemeBox( linkWrap->resize(linkWrap->width(), height); }, link->lifetime()); link->setLinkPlaceholder( - window->account().session().createInternalLink(qsl("addtheme/"))); + window->account().session().createInternalLink(u"addtheme/"_q)); link->setPlaceholderHidden(false); link->setMaxLength(kMaxSlugSize); diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index 0c1bb3461..dc7f5cbd2 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -432,8 +432,8 @@ MainMenu::MainMenu( parentResized(); _telegram->setMarkedText(Ui::Text::Link( - qsl("Telegram Desktop"), - qsl("https://desktop.telegram.org"))); + u"Telegram Desktop"_q, + u"https://desktop.telegram.org"_q)); _telegram->setLinksTrusted(); _version->setMarkedText( Ui::Text::Link(