2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Replaced some qstr with u""_q literal.

This commit is contained in:
23rd
2022-11-27 00:20:17 +03:00
parent 22dc7023fc
commit 2acedca6b7
99 changed files with 477 additions and 480 deletions

View File

@@ -396,7 +396,7 @@ void CloudManager::applyLangPackData(
}
bool CloudManager::canApplyWithoutRestart(const QString &id) const {
if (id == qstr("#TEST_X") || id == qstr("#TEST_0")) {
if (id == u"#TEST_X"_q || id == u"#TEST_0"_q) {
return true;
}
return Core::App().canApplyLangPackWithoutRestart();
@@ -422,7 +422,7 @@ void CloudManager::requestLanguageAndSwitch(
if (LanguageIdOrDefault(_langpack.id()) == id) {
Ui::show(Ui::MakeInformBox(tr::lng_language_already()));
return;
} else if (id == qstr("#custom")) {
} else if (id == u"#custom"_q) {
performSwitchToCustom();
return;
}
@@ -471,14 +471,14 @@ void CloudManager::sendSwitchingToLanguageRequest() {
}
void CloudManager::switchToLanguage(const Language &data) {
if (_langpack.id() == data.id && data.id != qstr("#custom")) {
if (_langpack.id() == data.id && data.id != u"#custom"_q) {
return;
} else if (!_api) {
return;
}
_api->request(base::take(_getKeysForSwitchRequestId)).cancel();
if (data.id == qstr("#custom")) {
if (data.id == u"#custom"_q) {
performSwitchToCustom();
} else if (canApplyWithoutRestart(data.id)) {
performSwitchAndAddToRecent(data);
@@ -516,8 +516,8 @@ void CloudManager::switchToLanguage(const Language &data) {
}
void CloudManager::performSwitchToCustom() {
auto filter = qsl("Language files (*.strings)");
auto title = qsl("Choose language .strings file");
auto filter = u"Language files (*.strings)"_q;
auto title = u"Choose language .strings file"_q;
FileDialog::GetOpenPath(Core::App().getFileDialogParent(), title, filter, [=, weak = base::make_weak(this)](const FileDialog::OpenResult &result) {
if (!weak || result.paths.isEmpty()) {
return;
@@ -533,7 +533,7 @@ void CloudManager::performSwitchToCustom() {
base::take(_switchingToLanguageRequest)
).cancel();
}
if (canApplyWithoutRestart(qsl("#custom"))) {
if (canApplyWithoutRestart(u"#custom"_q)) {
_langpack.switchToCustomFile(filePath);
} else {
const auto values = loader.found();
@@ -568,9 +568,9 @@ void CloudManager::performSwitchToCustom() {
}
void CloudManager::switchToTestLanguage() {
const auto testLanguageId = (_langpack.id() == qstr("#TEST_X"))
? qsl("#TEST_0")
: qsl("#TEST_X");
const auto testLanguageId = (_langpack.id() == u"#TEST_X"_q)
? u"#TEST_0"_q
: u"#TEST_X"_q;
performSwitch({ testLanguageId });
}

View File

@@ -254,7 +254,7 @@ Instance::Instance(not_null<Instance*> derived, const PrivateTag &)
void Instance::switchToId(const Language &data) {
reset(data);
if (_id == qstr("#TEST_X") || _id == qstr("#TEST_0")) {
if (_id == u"#TEST_X"_q || _id == u"#TEST_0"_q) {
for (auto &value : _values) {
value = PrepareTestValue(value, _id[5]);
}
@@ -365,8 +365,8 @@ QString Instance::id(Pack pack) const {
bool Instance::isCustom() const {
return (_id == CustomLanguageId())
|| (_id == qstr("#TEST_X"))
|| (_id == qstr("#TEST_0"));
|| (_id == u"#TEST_X"_q)
|| (_id == u"#TEST_0"_q);
}
int Instance::version(Pack pack) const {

View File

@@ -13,28 +13,28 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Lang {
QString Translator::translate(const char *context, const char *sourceText, const char *disambiguation, int n) const {
if (qstr("QMenuBar") == context) {
if (qstr("Services") == sourceText) return tr::lng_mac_menu_services(tr::now);
if (qstr("Hide %1") == sourceText) return tr::lng_mac_menu_hide_telegram(tr::now, lt_telegram, qsl("%1"));
if (qstr("Hide Others") == sourceText) return tr::lng_mac_menu_hide_others(tr::now);
if (qstr("Show All") == sourceText) return tr::lng_mac_menu_show_all(tr::now);
if (qstr("Preferences...") == sourceText) return tr::lng_mac_menu_preferences(tr::now);
if (qstr("Quit %1") == sourceText) return tr::lng_mac_menu_quit_telegram(tr::now, lt_telegram, qsl("%1"));
if (qstr("About %1") == sourceText) return tr::lng_mac_menu_about_telegram(tr::now, lt_telegram, qsl("%1"));
if (u"QMenuBar"_q == context) {
if (u"Services"_q == sourceText) return tr::lng_mac_menu_services(tr::now);
if (u"Hide %1"_q == sourceText) return tr::lng_mac_menu_hide_telegram(tr::now, lt_telegram, u"%1"_q);
if (u"Hide Others"_q == sourceText) return tr::lng_mac_menu_hide_others(tr::now);
if (u"Show All"_q == sourceText) return tr::lng_mac_menu_show_all(tr::now);
if (u"Preferences..."_q == sourceText) return tr::lng_mac_menu_preferences(tr::now);
if (u"Quit %1"_q == sourceText) return tr::lng_mac_menu_quit_telegram(tr::now, lt_telegram, u"%1"_q);
if (u"About %1"_q == sourceText) return tr::lng_mac_menu_about_telegram(tr::now, lt_telegram, u"%1"_q);
return QString();
}
if (qstr("QWidgetTextControl") == context || qstr("QLineEdit") == context) {
if (qstr("&Undo") == sourceText) return Platform::IsWindows() ? tr::lng_wnd_menu_undo(tr::now) : Platform::IsMac() ? tr::lng_mac_menu_undo(tr::now) : tr::lng_linux_menu_undo(tr::now);
if (qstr("&Redo") == sourceText) return Platform::IsWindows() ? tr::lng_wnd_menu_redo(tr::now) : Platform::IsMac() ? tr::lng_mac_menu_redo(tr::now) : tr::lng_linux_menu_redo(tr::now);
if (qstr("Cu&t") == sourceText) return tr::lng_mac_menu_cut(tr::now);
if (qstr("&Copy") == sourceText) return tr::lng_mac_menu_copy(tr::now);
if (qstr("&Paste") == sourceText) return tr::lng_mac_menu_paste(tr::now);
if (qstr("Delete") == sourceText) return tr::lng_mac_menu_delete(tr::now);
if (qstr("Select All") == sourceText) return tr::lng_mac_menu_select_all(tr::now);
if (u"QWidgetTextControl"_q == context || u"QLineEdit"_q == context) {
if (u"&Undo"_q == sourceText) return Platform::IsWindows() ? tr::lng_wnd_menu_undo(tr::now) : Platform::IsMac() ? tr::lng_mac_menu_undo(tr::now) : tr::lng_linux_menu_undo(tr::now);
if (u"&Redo"_q == sourceText) return Platform::IsWindows() ? tr::lng_wnd_menu_redo(tr::now) : Platform::IsMac() ? tr::lng_mac_menu_redo(tr::now) : tr::lng_linux_menu_redo(tr::now);
if (u"Cu&t"_q == sourceText) return tr::lng_mac_menu_cut(tr::now);
if (u"&Copy"_q == sourceText) return tr::lng_mac_menu_copy(tr::now);
if (u"&Paste"_q == sourceText) return tr::lng_mac_menu_paste(tr::now);
if (u"Delete"_q == sourceText) return tr::lng_mac_menu_delete(tr::now);
if (u"Select All"_q == sourceText) return tr::lng_mac_menu_select_all(tr::now);
return QString();
}
if (qstr("QUnicodeControlCharacterMenu") == context) {
if (qstr("Insert Unicode control character") == sourceText) return tr::lng_menu_insert_unicode(tr::now);
if (u"QUnicodeControlCharacterMenu"_q == context) {
if (u"Insert Unicode control character"_q == sourceText) return tr::lng_menu_insert_unicode(tr::now);
return QString();
}
return QString();