mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Use tr:: instead of lang().
This commit is contained in:
@@ -204,7 +204,7 @@ void MainWindow::checkLockByTerms() {
|
||||
void MainWindow::showTermsDecline() {
|
||||
const auto box = Ui::show(
|
||||
Box<Window::TermsBox>(
|
||||
TextWithEntities{ lang(lng_terms_update_sorry) },
|
||||
TextWithEntities{ tr::lng_terms_update_sorry(tr::now) },
|
||||
tr::lng_terms_decline_and_delete(),
|
||||
tr::lng_terms_back(),
|
||||
true),
|
||||
@@ -237,8 +237,8 @@ void MainWindow::showTermsDelete() {
|
||||
};
|
||||
*box = Ui::show(
|
||||
Box<ConfirmBox>(
|
||||
lang(lng_terms_delete_warning),
|
||||
lang(lng_terms_delete_now),
|
||||
tr::lng_terms_delete_warning(tr::now),
|
||||
tr::lng_terms_delete_now(tr::now),
|
||||
st::attentionBoxButton,
|
||||
deleteByTerms,
|
||||
[=] { if (*box) (*box)->closeBox(); }),
|
||||
|
@@ -518,9 +518,9 @@ void NativeManager::doShowNotification(HistoryItem *item, int forwardedCount) {
|
||||
const auto title = options.hideNameAndPhoto ? qsl("Telegram Desktop") : item->history()->peer->name;
|
||||
const auto subtitle = options.hideNameAndPhoto ? QString() : item->notificationHeader();
|
||||
const auto text = options.hideMessageText
|
||||
? lang(lng_notification_preview)
|
||||
? tr::lng_notification_preview(tr::now)
|
||||
: (forwardedCount < 2
|
||||
? (item->groupId() ? lang(lng_in_dlg_album) : item->notificationText())
|
||||
? (item->groupId() ? tr::lng_in_dlg_album(tr::now) : item->notificationText())
|
||||
: lng_forward_messages(lt_count, forwardedCount));
|
||||
|
||||
doShowNativeNotification(
|
||||
|
@@ -708,7 +708,7 @@ void Notification::updateNotifyDisplay() {
|
||||
p.drawText(r.left(), r.top() + st::dialogsTextFont->ascent, lng_forward_messages(lt_count, _forwardedCount));
|
||||
}
|
||||
} else {
|
||||
static QString notifyText = st::dialogsTextFont->elided(lang(lng_notification_preview), itemWidth);
|
||||
static QString notifyText = st::dialogsTextFont->elided(tr::lng_notification_preview(tr::now), itemWidth);
|
||||
p.setFont(st::dialogsTextFont);
|
||||
p.setPen(st::dialogsTextFgService);
|
||||
p.drawText(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyItemTop + st::msgNameFont->height + st::dialogsTextFont->ascent, notifyText);
|
||||
@@ -958,7 +958,7 @@ void HideAllButton::paintEvent(QPaintEvent *e) {
|
||||
|
||||
p.setFont(st::defaultLinkButton.font);
|
||||
p.setPen(_mouseOver ? st::lightButtonFgOver : st::lightButtonFg);
|
||||
p.drawText(rect(), lang(lng_notification_hide_all), style::al_center);
|
||||
p.drawText(rect(), tr::lng_notification_hide_all(tr::now), style::al_center);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@@ -306,7 +306,7 @@ Editor::Inner::Inner(QWidget *parent, const QString &path) : TWidget(parent)
|
||||
if (update.type == BackgroundUpdate::Type::TestingTheme) {
|
||||
Revert();
|
||||
App::CallDelayed(st::slideDuration, this, [] {
|
||||
Ui::show(Box<InformBox>(lang(lng_theme_editor_cant_change_theme)));
|
||||
Ui::show(Box<InformBox>(tr::lng_theme_editor_cant_change_theme(tr::now)));
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -394,7 +394,7 @@ void Editor::Inner::paintEvent(QPaintEvent *e) {
|
||||
p.setFont(st::boxTitleFont);
|
||||
p.setPen(st::windowFg);
|
||||
if (!_newRows->isHidden()) {
|
||||
p.drawTextLeft(st::themeEditorMargin.left(), _existingRows->y() + _existingRows->height() + st::boxLayerTitlePosition.y(), width(), lang(lng_theme_editor_new_keys));
|
||||
p.drawTextLeft(st::themeEditorMargin.left(), _existingRows->y() + _existingRows->height() + st::boxLayerTitlePosition.y(), width(), tr::lng_theme_editor_new_keys(tr::now));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,8 +561,8 @@ ThemeExportBox::ThemeExportBox(QWidget*, const QByteArray &paletteContent, const
|
||||
, _paletteContent(paletteContent)
|
||||
, _background(background)
|
||||
, _backgroundContent(backgroundContent)
|
||||
, _chooseFromFile(this, lang(lng_settings_bg_from_file), st::boxLinkButton)
|
||||
, _tileBackground(this, lang(lng_settings_bg_tile), tileBackground, st::defaultBoxCheckbox) {
|
||||
, _chooseFromFile(this, tr::lng_settings_bg_from_file(tr::now), st::boxLinkButton)
|
||||
, _tileBackground(this, tr::lng_settings_bg_tile(tr::now), tileBackground, st::defaultBoxCheckbox) {
|
||||
_imageText = lng_theme_editor_saved_to_jpg(lt_size, formatSizeText(_backgroundContent.size()));
|
||||
_chooseFromFile->setClickedCallback([this] { chooseBackgroundFromFile(); });
|
||||
}
|
||||
@@ -621,7 +621,7 @@ void ThemeExportBox::updateThumbnail() {
|
||||
}
|
||||
|
||||
void ThemeExportBox::chooseBackgroundFromFile() {
|
||||
FileDialog::GetOpenPath(this, lang(lng_theme_editor_choose_image), "Image files (*.jpeg *.jpg *.png)", crl::guard(this, [this](const FileDialog::OpenResult &result) {
|
||||
FileDialog::GetOpenPath(this, tr::lng_theme_editor_choose_image(tr::now), "Image files (*.jpeg *.jpg *.png)", crl::guard(this, [this](const FileDialog::OpenResult &result) {
|
||||
auto content = result.remoteContent;
|
||||
if (!result.paths.isEmpty()) {
|
||||
QFile f(result.paths.front());
|
||||
@@ -648,7 +648,7 @@ void ThemeExportBox::chooseBackgroundFromFile() {
|
||||
|
||||
void ThemeExportBox::exportTheme() {
|
||||
App::CallDelayed(st::defaultRippleAnimation.hideDuration, this, [this] {
|
||||
auto caption = lang(lng_theme_editor_choose_name);
|
||||
auto caption = tr::lng_theme_editor_choose_name(tr::now);
|
||||
auto filter = "Themes (*.tdesktop-theme)";
|
||||
auto name = "awesome.tdesktop-theme";
|
||||
FileDialog::GetWritePath(this, caption, filter, name, crl::guard(this, [this](const QString &path) {
|
||||
@@ -667,7 +667,7 @@ void ThemeExportBox::exportTheme() {
|
||||
|
||||
if (zip.error() != ZIP_OK) {
|
||||
LOG(("Theme Error: could not export zip-ed theme, status: %1").arg(zip.error()));
|
||||
Ui::show(Box<InformBox>(lang(lng_theme_editor_error)));
|
||||
Ui::show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
return;
|
||||
}
|
||||
auto result = zip.result();
|
||||
@@ -675,16 +675,16 @@ void ThemeExportBox::exportTheme() {
|
||||
QFile f(path);
|
||||
if (!f.open(QIODevice::WriteOnly)) {
|
||||
LOG(("Theme Error: could not open zip-ed theme file '%1' for writing").arg(path));
|
||||
Ui::show(Box<InformBox>(lang(lng_theme_editor_error)));
|
||||
Ui::show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
return;
|
||||
}
|
||||
if (f.write(result) != result.size()) {
|
||||
LOG(("Theme Error: could not write zip-ed theme to file '%1'").arg(path));
|
||||
Ui::show(Box<InformBox>(lang(lng_theme_editor_error)));
|
||||
Ui::show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
return;
|
||||
}
|
||||
Ui::hideLayer();
|
||||
Ui::Toast::Show(lang(lng_theme_editor_done));
|
||||
Ui::Toast::Show(tr::lng_theme_editor_done(tr::now));
|
||||
}));
|
||||
});
|
||||
}
|
||||
@@ -695,13 +695,13 @@ Editor::Editor(QWidget*, const QString &path)
|
||||
, _select(this, st::contactsMultiSelect, tr::lng_country_ph())
|
||||
, _leftShadow(this)
|
||||
, _topShadow(this)
|
||||
, _export(this, lang(lng_theme_editor_export_button).toUpper(), st::dialogsUpdateButton) {
|
||||
, _export(this, tr::lng_theme_editor_export_button(tr::now).toUpper(), st::dialogsUpdateButton) {
|
||||
_inner = _scroll->setOwnedWidget(object_ptr<Inner>(this, path));
|
||||
|
||||
_export->setClickedCallback(_inner->exportCallback());
|
||||
|
||||
_inner->setErrorCallback([this] {
|
||||
Ui::show(Box<InformBox>(lang(lng_theme_editor_error)));
|
||||
Ui::show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
|
||||
// This could be from inner->_context observable notification.
|
||||
// We should not destroy it while iterating in subscribers.
|
||||
@@ -781,7 +781,7 @@ void Editor::paintEvent(QPaintEvent *e) {
|
||||
|
||||
p.setFont(st::boxTitleFont);
|
||||
p.setPen(st::windowFg);
|
||||
p.drawTextLeft(st::themeEditorMargin.left(), st::themeEditorMargin.top(), width(), lang(lng_theme_editor_title));
|
||||
p.drawTextLeft(st::themeEditorMargin.left(), st::themeEditorMargin.top(), width(), tr::lng_theme_editor_title(tr::now));
|
||||
}
|
||||
|
||||
void Editor::Start() {
|
||||
@@ -792,7 +792,7 @@ void Editor::Start() {
|
||||
writeDefaultPalette(path);
|
||||
}
|
||||
if (!Apply(path)) {
|
||||
Ui::show(Box<InformBox>(lang(lng_theme_editor_error)));
|
||||
Ui::show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
return;
|
||||
}
|
||||
KeepApplied();
|
||||
@@ -802,7 +802,7 @@ void Editor::Start() {
|
||||
};
|
||||
FileDialog::GetWritePath(
|
||||
App::wnd(),
|
||||
lang(lng_theme_editor_save_palette),
|
||||
tr::lng_theme_editor_save_palette(tr::now),
|
||||
"Palette (*.tdesktop-palette)",
|
||||
"colors.tdesktop-palette",
|
||||
start);
|
||||
|
@@ -620,7 +620,7 @@ void EditorBlock::paintEvent(QPaintEvent *e) {
|
||||
p.fillRect(clip, st::dialogsBg);
|
||||
p.setFont(st::noContactsFont);
|
||||
p.setPen(st::noContactsColor);
|
||||
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_theme_editor_no_keys));
|
||||
p.drawText(QRect(0, 0, width(), st::noContactsHeight), tr::lng_theme_editor_no_keys(tr::now));
|
||||
}
|
||||
|
||||
auto cliptop = clip.y();
|
||||
|
@@ -515,7 +515,7 @@ void Generator::paintComposeArea() {
|
||||
field.y() + st::historyComposeField.textMargins.top() + st::historyComposeField.placeholderMargins.top(),
|
||||
field.width() - st::historyComposeField.textMargins.left() - st::historyComposeField.textMargins.right(),
|
||||
field.height() - st::historyComposeField.textMargins.top() - st::historyComposeField.textMargins.bottom());
|
||||
_p->drawText(placeholderRect, lang(lng_message_ph), QTextOption(st::historyComposeField.placeholderAlign));
|
||||
_p->drawText(placeholderRect, tr::lng_message_ph(tr::now), QTextOption(st::historyComposeField.placeholderAlign));
|
||||
|
||||
_p->restore();
|
||||
_p->setClipping(false);
|
||||
@@ -551,7 +551,7 @@ void Generator::paintDialogs() {
|
||||
auto phRect = QRect(filter.x() + st::dialogsFilter.textMrg.left() + st::dialogsFilter.phPos.x(), filter.y() + st::dialogsFilter.textMrg.top() + st::dialogsFilter.phPos.y(), filter.width() - st::dialogsFilter.textMrg.left() - st::dialogsFilter.textMrg.right(), filter.height() - st::dialogsFilter.textMrg.top() - st::dialogsFilter.textMrg.bottom());;
|
||||
_p->setFont(st::dialogsFilter.font);
|
||||
_p->setPen(st::dialogsFilter.phColor[_palette]);
|
||||
_p->drawText(phRect, lang(lng_dlg_filter), QTextOption(st::dialogsFilter.phAlign));
|
||||
_p->drawText(phRect, tr::lng_dlg_filter(tr::now), QTextOption(st::dialogsFilter.phAlign));
|
||||
_p->restore();
|
||||
_p->setClipping(false);
|
||||
|
||||
|
@@ -63,7 +63,7 @@ void WarningWidget::paintEvent(QPaintEvent *e) {
|
||||
|
||||
p.setFont(st::boxTitleFont);
|
||||
p.setPen(st::boxTitleFg);
|
||||
p.drawTextLeft(_inner.x() + st::boxTitlePosition.x(), _inner.y() + st::boxTitlePosition.y(), width(), lang(lng_theme_sure_keep));
|
||||
p.drawTextLeft(_inner.x() + st::boxTitlePosition.x(), _inner.y() + st::boxTitlePosition.y(), width(), tr::lng_theme_sure_keep(tr::now));
|
||||
|
||||
p.setFont(st::boxTextFont);
|
||||
p.setPen(st::boxTextFg);
|
||||
|
@@ -399,7 +399,7 @@ auto ConnectionState::computeLayout(const State &state) const -> Layout {
|
||||
|| state.type == State::Type::Waiting;
|
||||
switch (state.type) {
|
||||
case State::Type::Connecting:
|
||||
result.text = state.underCursor ? lang(lng_connecting) : QString();
|
||||
result.text = state.underCursor ? tr::lng_connecting(tr::now) : QString();
|
||||
break;
|
||||
|
||||
case State::Type::Waiting:
|
||||
@@ -419,7 +419,7 @@ auto ConnectionState::computeLayout(const State &state) const -> Layout {
|
||||
if (state.type == State::Type::Waiting) {
|
||||
result.contentWidth += st::connectingRetryLink.padding.left()
|
||||
+ st::connectingRetryLink.font->width(
|
||||
lang(lng_reconnecting_try_now))
|
||||
tr::lng_reconnecting_try_now(tr::now))
|
||||
+ st::connectingRetryLink.padding.right();
|
||||
}
|
||||
result.hasRetry = (state.type == State::Type::Waiting);
|
||||
@@ -576,7 +576,7 @@ void ConnectionState::Widget::refreshRetryLink(bool hasRetry) {
|
||||
if (hasRetry && !_retry) {
|
||||
_retry = base::make_unique_q<Ui::LinkButton>(
|
||||
this,
|
||||
lang(lng_reconnecting_try_now),
|
||||
tr::lng_reconnecting_try_now(tr::now),
|
||||
st::connectingRetryLink);
|
||||
_retry->addClickHandler([=] {
|
||||
MTP::restart();
|
||||
|
@@ -98,7 +98,7 @@ PasscodeLockWidget::PasscodeLockWidget(QWidget *parent)
|
||||
: LockWidget(parent)
|
||||
, _passcode(this, st::passcodeInput, tr::lng_passcode_ph())
|
||||
, _submit(this, tr::lng_passcode_submit(), st::passcodeSubmit)
|
||||
, _logout(this, lang(lng_passcode_logout)) {
|
||||
, _logout(this, tr::lng_passcode_logout(tr::now)) {
|
||||
connect(_passcode, &Ui::MaskedInputField::changed, [=] { changed(); });
|
||||
connect(_passcode, &Ui::MaskedInputField::submitted, [=] { submit(); });
|
||||
|
||||
@@ -111,7 +111,7 @@ void PasscodeLockWidget::paintContent(Painter &p) {
|
||||
|
||||
p.setFont(st::passcodeHeaderFont);
|
||||
p.setPen(st::windowFg);
|
||||
p.drawText(QRect(0, _passcode->y() - st::passcodeHeaderHeight, width(), st::passcodeHeaderHeight), lang(lng_passcode_enter), style::al_center);
|
||||
p.drawText(QRect(0, _passcode->y() - st::passcodeHeaderHeight, width(), st::passcodeHeaderHeight), tr::lng_passcode_enter(tr::now), style::al_center);
|
||||
|
||||
if (!_error.isEmpty()) {
|
||||
p.setFont(st::boxTextFont);
|
||||
@@ -126,7 +126,7 @@ void PasscodeLockWidget::submit() {
|
||||
return;
|
||||
}
|
||||
if (!passcodeCanTry()) {
|
||||
_error = lang(lng_flood_error);
|
||||
_error = tr::lng_flood_error(tr::now);
|
||||
_passcode->showError();
|
||||
update();
|
||||
return;
|
||||
@@ -147,7 +147,7 @@ void PasscodeLockWidget::submit() {
|
||||
}
|
||||
|
||||
void PasscodeLockWidget::error() {
|
||||
_error = lang(lng_passcode_wrong);
|
||||
_error = tr::lng_passcode_wrong(tr::now);
|
||||
_passcode->selectAll();
|
||||
_passcode->showError();
|
||||
update();
|
||||
|
@@ -168,7 +168,7 @@ MainMenu::MainMenu(
|
||||
}
|
||||
_contextMenu = base::make_unique_q<Ui::PopupMenu>(this);
|
||||
_contextMenu->addAction(
|
||||
lang(lng_context_archive_to_list), [=] {
|
||||
tr::lng_context_archive_to_list(tr::now), [=] {
|
||||
_controller->session().settings().setArchiveInMainMenu(false);
|
||||
_controller->session().saveSettingsDelayed();
|
||||
Ui::hideSettingsAndLayer();
|
||||
@@ -197,7 +197,7 @@ MainMenu::MainMenu(
|
||||
qsl("Telegram Desktop"),
|
||||
qsl("https://desktop.telegram.org")));
|
||||
_telegram->setLinksTrusted();
|
||||
_version->setRichText(textcmdLink(1, lng_settings_current_version(lt_version, currentVersionText())) + QChar(' ') + QChar(8211) + QChar(' ') + textcmdLink(2, lang(lng_menu_about)));
|
||||
_version->setRichText(textcmdLink(1, lng_settings_current_version(lt_version, currentVersionText())) + QChar(' ') + QChar(8211) + QChar(' ') + textcmdLink(2, tr::lng_menu_about(tr::now)));
|
||||
_version->setLink(1, std::make_shared<UrlClickHandler>(qsl("https://desktop.telegram.org/changelog")));
|
||||
_version->setLink(2, std::make_shared<LambdaClickHandler>([] { Ui::show(Box<AboutBox>()); }));
|
||||
|
||||
@@ -231,20 +231,20 @@ MainMenu::MainMenu(
|
||||
void MainMenu::refreshMenu() {
|
||||
_menu->clearActions();
|
||||
if (!Auth().supportMode()) {
|
||||
_menu->addAction(lang(lng_create_group_title), [] {
|
||||
_menu->addAction(tr::lng_create_group_title(tr::now), [] {
|
||||
App::wnd()->onShowNewGroup();
|
||||
}, &st::mainMenuNewGroup, &st::mainMenuNewGroupOver);
|
||||
_menu->addAction(lang(lng_create_channel_title), [] {
|
||||
_menu->addAction(tr::lng_create_channel_title(tr::now), [] {
|
||||
App::wnd()->onShowNewChannel();
|
||||
}, &st::mainMenuNewChannel, &st::mainMenuNewChannelOver);
|
||||
_menu->addAction(lang(lng_menu_contacts), [] {
|
||||
_menu->addAction(tr::lng_menu_contacts(tr::now), [] {
|
||||
Ui::show(Box<PeerListBox>(std::make_unique<ContactsBoxController>(), [](not_null<PeerListBox*> box) {
|
||||
box->addButton(tr::lng_close(), [box] { box->closeBox(); });
|
||||
box->addLeftButton(tr::lng_profile_add_contact(), [] { App::wnd()->onShowAddContact(); });
|
||||
}));
|
||||
}, &st::mainMenuContacts, &st::mainMenuContactsOver);
|
||||
if (Global::PhoneCallsEnabled()) {
|
||||
_menu->addAction(lang(lng_menu_calls), [] {
|
||||
_menu->addAction(tr::lng_menu_calls(tr::now), [] {
|
||||
Ui::show(Box<PeerListBox>(std::make_unique<Calls::BoxController>(), [](not_null<PeerListBox*> box) {
|
||||
box->addButton(tr::lng_close(), [=] {
|
||||
box->closeBox();
|
||||
@@ -258,7 +258,7 @@ void MainMenu::refreshMenu() {
|
||||
}, &st::mainMenuCalls, &st::mainMenuCallsOver);
|
||||
}
|
||||
} else {
|
||||
_menu->addAction(lang(lng_profile_add_contact), [] {
|
||||
_menu->addAction(tr::lng_profile_add_contact(tr::now), [] {
|
||||
App::wnd()->onShowAddContact();
|
||||
}, &st::mainMenuContacts, &st::mainMenuContactsOver);
|
||||
|
||||
@@ -275,12 +275,12 @@ void MainMenu::refreshMenu() {
|
||||
Auth().supportTemplates().reload();
|
||||
}, &st::mainMenuReload, &st::mainMenuReloadOver);
|
||||
}
|
||||
_menu->addAction(lang(lng_menu_settings), [] {
|
||||
_menu->addAction(tr::lng_menu_settings(tr::now), [] {
|
||||
App::wnd()->showSettings();
|
||||
}, &st::mainMenuSettings, &st::mainMenuSettingsOver);
|
||||
|
||||
_nightThemeAction = std::make_shared<QPointer<QAction>>();
|
||||
auto action = _menu->addAction(lang(lng_menu_night_mode), [=] {
|
||||
auto action = _menu->addAction(tr::lng_menu_night_mode(tr::now), [=] {
|
||||
if (auto action = *_nightThemeAction) {
|
||||
action->setChecked(!action->isChecked());
|
||||
_nightThemeSwitch.callOnce(st::mainMenu.itemToggle.duration);
|
||||
|
@@ -57,7 +57,7 @@ Bar::Bar(not_null<QWidget*> parent, QDate date)
|
||||
_details->setTryMakeSimilarLines(true);
|
||||
_details->setText(_soon
|
||||
? lng_outdated_soon(lt_date, langDayOfMonthFull(date))
|
||||
: lang(lng_outdated_now));
|
||||
: tr::lng_outdated_now(tr::now));
|
||||
}
|
||||
|
||||
rpl::producer<> Bar::hideClicks() const {
|
||||
|
@@ -233,9 +233,9 @@ void Filler::addTogglePin() {
|
||||
isPinned = history->isPinnedDialog();
|
||||
}
|
||||
auto pinText = [](bool isPinned) {
|
||||
return lang(isPinned
|
||||
? lng_context_unpin_from_top
|
||||
: lng_context_pin_to_top);
|
||||
return isPinned
|
||||
? tr::lng_context_unpin_from_top(tr::now)
|
||||
: tr::lng_context_pin_to_top(tr::now);
|
||||
};
|
||||
auto pinToggle = [=] {
|
||||
TogglePinnedDialog(peer->owner().history(peer));
|
||||
@@ -255,18 +255,18 @@ void Filler::addTogglePin() {
|
||||
void Filler::addInfo() {
|
||||
const auto controller = _controller;
|
||||
const auto peer = _peer;
|
||||
const auto infoKey = (peer->isChat() || peer->isMegagroup())
|
||||
? lng_context_view_group
|
||||
const auto text = (peer->isChat() || peer->isMegagroup())
|
||||
? tr::lng_context_view_group(tr::now)
|
||||
: (peer->isUser()
|
||||
? lng_context_view_profile
|
||||
: lng_context_view_channel);
|
||||
_addAction(lang(infoKey), [=] {
|
||||
? tr::lng_context_view_profile(tr::now)
|
||||
: tr::lng_context_view_channel(tr::now));
|
||||
_addAction(text, [=] {
|
||||
controller->showPeerInfo(peer);
|
||||
});
|
||||
}
|
||||
|
||||
//void Filler::addSearch() {
|
||||
// _addAction(lang(lng_profile_search_messages), [peer = _peer] {
|
||||
// _addAction(tr::lng_profile_search_messages(tr::now), [peer = _peer] {
|
||||
// App::main()->searchInChat(peer->owner().history(peer));
|
||||
// });
|
||||
//}
|
||||
@@ -281,9 +281,9 @@ void Filler::addToggleUnreadMark() {
|
||||
return false;
|
||||
};
|
||||
const auto label = [=](not_null<PeerData*> peer) {
|
||||
return lang(isUnread(peer)
|
||||
? lng_context_mark_read
|
||||
: lng_context_mark_unread);
|
||||
return isUnread(peer)
|
||||
? tr::lng_context_mark_read(tr::now)
|
||||
: tr::lng_context_mark_unread(tr::now);
|
||||
};
|
||||
auto action = _addAction(label(peer), [=] {
|
||||
const auto markAsRead = isUnread(peer);
|
||||
@@ -324,20 +324,22 @@ void Filler::addToggleArchive() {
|
||||
!archived);
|
||||
};
|
||||
_addAction(
|
||||
lang(archived ? lng_archived_remove : lng_archived_add),
|
||||
(archived
|
||||
? tr::lng_archived_remove(tr::now)
|
||||
: tr::lng_archived_add(tr::now)),
|
||||
toggle);
|
||||
}
|
||||
|
||||
void Filler::addBlockUser(not_null<UserData*> user) {
|
||||
const auto window = &_controller->window()->controller();
|
||||
const auto blockText = [](not_null<UserData*> user) {
|
||||
return lang(user->isBlocked()
|
||||
return user->isBlocked()
|
||||
? ((user->isBot() && !user->isSupport())
|
||||
? lng_profile_restart_bot
|
||||
: lng_profile_unblock_user)
|
||||
? tr::lng_profile_restart_bot(tr::now)
|
||||
: tr::lng_profile_unblock_user(tr::now))
|
||||
: ((user->isBot() && !user->isSupport())
|
||||
? lng_profile_block_bot
|
||||
: lng_profile_block_user));
|
||||
? tr::lng_profile_block_bot(tr::now)
|
||||
: tr::lng_profile_block_user(tr::now));
|
||||
};
|
||||
const auto blockAction = _addAction(blockText(user), [=] {
|
||||
if (user->isBlocked()) {
|
||||
@@ -372,38 +374,38 @@ void Filler::addUserActions(not_null<UserData*> user) {
|
||||
}
|
||||
if (!user->isContact() && !user->isSelf() && !user->isBot()) {
|
||||
_addAction(
|
||||
lang(lng_info_add_as_contact),
|
||||
tr::lng_info_add_as_contact(tr::now),
|
||||
[=] { window->show(Box(EditContactBox, window, user)); });
|
||||
}
|
||||
if (user->canShareThisContact()) {
|
||||
_addAction(
|
||||
lang(lng_info_share_contact),
|
||||
tr::lng_info_share_contact(tr::now),
|
||||
[=] { PeerMenuShareContactBox(user); });
|
||||
}
|
||||
if (user->isContact() && !user->isSelf()) {
|
||||
_addAction(
|
||||
lang(lng_info_edit_contact),
|
||||
tr::lng_info_edit_contact(tr::now),
|
||||
[=] { window->show(Box(EditContactBox, window, user)); });
|
||||
_addAction(
|
||||
lang(lng_info_delete_contact),
|
||||
tr::lng_info_delete_contact(tr::now),
|
||||
[=] { PeerMenuDeleteContact(user); });
|
||||
}
|
||||
if (user->isBot() && !user->botInfo->cantJoinGroups) {
|
||||
_addAction(
|
||||
lang(lng_profile_invite_to_group),
|
||||
tr::lng_profile_invite_to_group(tr::now),
|
||||
[=] { AddBotToGroupBoxController::Start(user); });
|
||||
}
|
||||
if (user->canExportChatHistory()) {
|
||||
_addAction(
|
||||
lang(lng_profile_export_chat),
|
||||
tr::lng_profile_export_chat(tr::now),
|
||||
[=] { PeerMenuExportChat(user); });
|
||||
}
|
||||
}
|
||||
_addAction(
|
||||
lang(lng_profile_delete_conversation),
|
||||
tr::lng_profile_delete_conversation(tr::now),
|
||||
DeleteAndLeaveHandler(user));
|
||||
_addAction(
|
||||
lang(lng_profile_clear_history),
|
||||
tr::lng_profile_clear_history(tr::now),
|
||||
ClearHistoryHandler(user));
|
||||
if (!user->isInaccessible()
|
||||
&& user != Auth().user()
|
||||
@@ -416,32 +418,32 @@ void Filler::addChatActions(not_null<ChatData*> chat) {
|
||||
if (_source != PeerMenuSource::ChatsList) {
|
||||
const auto controller = _controller;
|
||||
if (EditPeerInfoBox::Available(chat)) {
|
||||
const auto text = lang(lng_manage_group_title);
|
||||
const auto text = tr::lng_manage_group_title(tr::now);
|
||||
_addAction(text, [=] {
|
||||
controller->showEditPeerBox(chat);
|
||||
});
|
||||
}
|
||||
if (chat->canAddMembers()) {
|
||||
_addAction(
|
||||
lang(lng_profile_add_participant),
|
||||
tr::lng_profile_add_participant(tr::now),
|
||||
[chat] { AddChatMembers(chat); });
|
||||
}
|
||||
if (chat->canSendPolls()) {
|
||||
_addAction(
|
||||
lang(lng_polls_create),
|
||||
tr::lng_polls_create(tr::now),
|
||||
[=] { PeerMenuCreatePoll(chat); });
|
||||
}
|
||||
if (chat->canExportChatHistory()) {
|
||||
_addAction(
|
||||
lang(lng_profile_export_chat),
|
||||
tr::lng_profile_export_chat(tr::now),
|
||||
[=] { PeerMenuExportChat(chat); });
|
||||
}
|
||||
}
|
||||
_addAction(
|
||||
lang(lng_profile_clear_and_exit),
|
||||
tr::lng_profile_clear_and_exit(tr::now),
|
||||
DeleteAndLeaveHandler(_peer));
|
||||
_addAction(
|
||||
lang(lng_profile_clear_history),
|
||||
tr::lng_profile_clear_history(tr::now),
|
||||
ClearHistoryHandler(_peer));
|
||||
}
|
||||
|
||||
@@ -452,52 +454,52 @@ void Filler::addChannelActions(not_null<ChannelData*> channel) {
|
||||
// const auto grouped = (feed != nullptr);
|
||||
// if (!grouped || feed->channels().size() > 1) {
|
||||
// _addAction( // #feed
|
||||
// lang(grouped ? lng_feed_ungroup : lng_feed_group),
|
||||
// (grouped ? tr::lng_feed_ungroup(tr::now) : tr::lng_feed_group(tr::now)),
|
||||
// [=] { ToggleChannelGrouping(channel, !grouped); });
|
||||
// }
|
||||
//}
|
||||
if (_source != PeerMenuSource::ChatsList) {
|
||||
if (EditPeerInfoBox::Available(channel)) {
|
||||
const auto controller = _controller;
|
||||
const auto text = lang(isGroup
|
||||
? lng_manage_group_title
|
||||
: lng_manage_channel_title);
|
||||
const auto text = isGroup
|
||||
? tr::lng_manage_group_title(tr::now)
|
||||
: tr::lng_manage_channel_title(tr::now);
|
||||
_addAction(text, [=] {
|
||||
controller->showEditPeerBox(channel);
|
||||
});
|
||||
}
|
||||
if (channel->canAddMembers()) {
|
||||
_addAction(
|
||||
lang(lng_channel_add_members),
|
||||
tr::lng_channel_add_members(tr::now),
|
||||
[channel] { PeerMenuAddChannelMembers(channel); });
|
||||
}
|
||||
if (channel->canSendPolls()) {
|
||||
_addAction(
|
||||
lang(lng_polls_create),
|
||||
tr::lng_polls_create(tr::now),
|
||||
[=] { PeerMenuCreatePoll(channel); });
|
||||
}
|
||||
if (channel->canExportChatHistory()) {
|
||||
_addAction(
|
||||
lang(isGroup
|
||||
? lng_profile_export_chat
|
||||
: lng_profile_export_channel),
|
||||
(isGroup
|
||||
? tr::lng_profile_export_chat(tr::now)
|
||||
: tr::lng_profile_export_channel(tr::now)),
|
||||
[=] { PeerMenuExportChat(channel); });
|
||||
}
|
||||
}
|
||||
if (channel->amIn()) {
|
||||
if (isGroup && !channel->isPublic()) {
|
||||
_addAction(
|
||||
lang(lng_profile_clear_history),
|
||||
tr::lng_profile_clear_history(tr::now),
|
||||
ClearHistoryHandler(channel));
|
||||
}
|
||||
auto text = lang(isGroup
|
||||
? lng_profile_leave_group
|
||||
: lng_profile_leave_channel);
|
||||
auto text = isGroup
|
||||
? tr::lng_profile_leave_group(tr::now)
|
||||
: tr::lng_profile_leave_channel(tr::now);
|
||||
_addAction(text, DeleteAndLeaveHandler(channel));
|
||||
} else {
|
||||
auto text = lang(isGroup
|
||||
? lng_profile_join_group
|
||||
: lng_profile_join_channel);
|
||||
auto text = isGroup
|
||||
? tr::lng_profile_join_group(tr::now)
|
||||
: tr::lng_profile_join_channel(tr::now);
|
||||
_addAction(
|
||||
text,
|
||||
[channel] { Auth().api().joinChannel(channel); });
|
||||
@@ -506,7 +508,7 @@ void Filler::addChannelActions(not_null<ChannelData*> channel) {
|
||||
auto needReport = !channel->amCreator()
|
||||
&& (!isGroup || channel->isPublic());
|
||||
if (needReport) {
|
||||
_addAction(lang(lng_profile_report), [channel] {
|
||||
_addAction(tr::lng_profile_report(tr::now), [channel] {
|
||||
Ui::show(Box<ReportBox>(channel));
|
||||
});
|
||||
}
|
||||
@@ -563,17 +565,17 @@ void FolderFiller::addTogglesForArchive() {
|
||||
}
|
||||
const auto controller = _controller;
|
||||
const auto hidden = controller->session().settings().archiveCollapsed();
|
||||
const auto text = lang(hidden
|
||||
? lng_context_archive_expand
|
||||
: lng_context_archive_collapse);
|
||||
const auto text = hidden
|
||||
? tr::lng_context_archive_expand(tr::now)
|
||||
: tr::lng_context_archive_collapse(tr::now);
|
||||
_addAction(text, [=] {
|
||||
controller->session().settings().setArchiveCollapsed(!hidden);
|
||||
controller->session().saveSettingsDelayed();
|
||||
});
|
||||
|
||||
_addAction(lang(lng_context_archive_to_menu), [=] {
|
||||
_addAction(tr::lng_context_archive_to_menu(tr::now), [=] {
|
||||
Ui::Toast::Config toast;
|
||||
toast.text = lang(lng_context_archive_to_menu_info);
|
||||
toast.text = tr::lng_context_archive_to_menu_info(tr::now);
|
||||
toast.maxWidth = st::boxWideWidth;
|
||||
toast.durationMs = kArchivedToastDuration;
|
||||
Ui::Toast::Show(toast);
|
||||
@@ -587,7 +589,7 @@ void FolderFiller::addTogglesForArchive() {
|
||||
//void FolderFiller::addInfo() {
|
||||
// auto controller = _controller;
|
||||
// auto feed = _feed;
|
||||
// _addAction(lang(lng_context_view_feed_info), [=] {
|
||||
// _addAction(tr::lng_context_view_feed_info(tr::now), [=] {
|
||||
// controller->showSection(Info::Memento(
|
||||
// feed,
|
||||
// Info::Section(Info::Section::Type::Profile)));
|
||||
@@ -596,21 +598,21 @@ void FolderFiller::addTogglesForArchive() {
|
||||
//
|
||||
//void FolderFiller::addNotifications() {
|
||||
// const auto feed = _feed;
|
||||
// _addAction(lang(lng_feed_notifications), [=] {
|
||||
// _addAction(tr::lng_feed_notifications(tr::now), [=] {
|
||||
// Info::FeedProfile::NotificationsController::Start(feed);
|
||||
// });
|
||||
//}
|
||||
//
|
||||
//void FolderFiller::addSearch() {
|
||||
// const auto feed = _feed;
|
||||
// _addAction(lang(lng_profile_search_messages), [=] {
|
||||
// _addAction(tr::lng_profile_search_messages(tr::now), [=] {
|
||||
// App::main()->searchInChat(feed);
|
||||
// });
|
||||
//}
|
||||
//
|
||||
//void FolderFiller::addUngroup() {
|
||||
// const auto feed = _feed;
|
||||
// //_addAction(lang(lng_feed_ungroup_all), [=] { // #feed
|
||||
// //_addAction(tr::lng_feed_ungroup_all(tr::now), [=] { // #feed
|
||||
// // PeerMenuUngroupFeed(feed);
|
||||
// //});
|
||||
//}
|
||||
@@ -635,7 +637,7 @@ void PeerMenuDeleteContact(not_null<UserData*> user) {
|
||||
};
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
text,
|
||||
lang(lng_box_delete),
|
||||
tr::lng_box_delete(tr::now),
|
||||
deleteSure));
|
||||
}
|
||||
|
||||
@@ -644,13 +646,13 @@ void PeerMenuShareContactBox(not_null<UserData*> user) {
|
||||
auto callback = [=](not_null<PeerData*> peer) {
|
||||
if (!peer->canWrite()) {
|
||||
Ui::show(Box<InformBox>(
|
||||
lang(lng_forward_share_cant)),
|
||||
tr::lng_forward_share_cant(tr::now)),
|
||||
LayerOption::KeepOther);
|
||||
return;
|
||||
} else if (peer->isSelf()) {
|
||||
auto options = ApiWrap::SendOptions(peer->owner().history(peer));
|
||||
Auth().api().shareContact(user, options);
|
||||
Ui::Toast::Show(lang(lng_share_done));
|
||||
Ui::Toast::Show(tr::lng_share_done(tr::now));
|
||||
if (auto strong = *weak) {
|
||||
strong->closeBox();
|
||||
}
|
||||
@@ -661,7 +663,7 @@ void PeerMenuShareContactBox(not_null<UserData*> user) {
|
||||
: '\xAB' + peer->name + '\xBB';
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
lng_forward_share_contact(lt_recipient, recipient),
|
||||
lang(lng_forward_send),
|
||||
tr::lng_forward_send(tr::now),
|
||||
[peer, user] {
|
||||
const auto history = peer->owner().history(peer);
|
||||
Ui::showPeerHistory(history, ShowAtTheEndMsgId);
|
||||
@@ -698,7 +700,7 @@ void PeerMenuCreatePoll(not_null<PeerData*> peer) {
|
||||
box->closeBox();
|
||||
}), crl::guard(box, [=](const RPCError &error) {
|
||||
*lock = false;
|
||||
box->submitFailed(lang(lng_attach_failed));
|
||||
box->submitFailed(tr::lng_attach_failed(tr::now));
|
||||
}));
|
||||
}, box->lifetime());
|
||||
}
|
||||
@@ -725,7 +727,7 @@ void PeerMenuBlockUserBox(
|
||||
const auto report = (settings & Flag::f_report_spam)
|
||||
? box->addRow(object_ptr<Ui::Checkbox>(
|
||||
box,
|
||||
lang(lng_report_spam),
|
||||
tr::lng_report_spam(tr::now),
|
||||
true,
|
||||
st::defaultBoxCheckbox))
|
||||
: nullptr;
|
||||
@@ -736,7 +738,7 @@ void PeerMenuBlockUserBox(
|
||||
|
||||
const auto clear = box->addRow(object_ptr<Ui::Checkbox>(
|
||||
box,
|
||||
lang(lng_blocked_list_confirm_clear),
|
||||
tr::lng_blocked_list_confirm_clear(tr::now),
|
||||
true,
|
||||
st::defaultBoxCheckbox));
|
||||
|
||||
@@ -789,7 +791,7 @@ QPointer<Ui::RpWidget> ShowForwardMessagesBox(
|
||||
auto options = ApiWrap::SendOptions(peer->owner().history(peer));
|
||||
options.generateLocal = false;
|
||||
Auth().api().forwardMessages(std::move(items), options, [] {
|
||||
Ui::Toast::Show(lang(lng_share_done));
|
||||
Ui::Toast::Show(tr::lng_share_done(tr::now));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@@ -850,9 +852,9 @@ void PeerMenuAddMuteAction(
|
||||
const PeerMenuCallback &addAction) {
|
||||
Auth().data().requestNotifySettings(peer);
|
||||
const auto muteText = [](bool isMuted) {
|
||||
return lang(isMuted
|
||||
? lng_enable_notifications_from_tray
|
||||
: lng_disable_notifications_from_tray);
|
||||
return isMuted
|
||||
? tr::lng_enable_notifications_from_tray(tr::now)
|
||||
: tr::lng_disable_notifications_from_tray(tr::now);
|
||||
};
|
||||
const auto muteAction = addAction(QString("-"), [=] {
|
||||
if (!Auth().data().notifyIsMuted(peer)) {
|
||||
@@ -872,17 +874,17 @@ void PeerMenuAddMuteAction(
|
||||
// #feed
|
||||
//void PeerMenuUngroupFeed(not_null<Data::Feed*> feed) {
|
||||
// Ui::show(Box<ConfirmBox>(
|
||||
// lang(lng_feed_sure_ungroup_all),
|
||||
// lang(lng_feed_ungroup_sure),
|
||||
// tr::lng_feed_sure_ungroup_all(tr::now),
|
||||
// tr::lng_feed_ungroup_sure(tr::now),
|
||||
// [=] { Ui::hideLayer(); Auth().api().ungroupAllFromFeed(feed); }));
|
||||
//}
|
||||
//
|
||||
void ToggleHistoryArchived(not_null<History*> history, bool archived) {
|
||||
const auto callback = [=] {
|
||||
Ui::Toast::Config toast;
|
||||
toast.text = lang(archived
|
||||
? lng_archived_added
|
||||
: lng_archived_removed);
|
||||
toast.text = archived
|
||||
? tr::lng_archived_added(tr::now)
|
||||
: tr::lng_archived_removed(tr::now);
|
||||
toast.maxWidth = st::boxWideWidth;
|
||||
if (archived) {
|
||||
toast.durationMs = kArchivedToastDuration;
|
||||
|
Reference in New Issue
Block a user