Use tr:: instead of langFactory in box titles.

This commit is contained in:
John Preston 2019-06-18 17:00:55 +02:00
parent 8ed433cc01
commit d1d98c3bb1
66 changed files with 234 additions and 230 deletions

View File

@ -58,7 +58,7 @@ AboutBox::AboutBox(QWidget *parent)
} }
void AboutBox::prepare() { void AboutBox::prepare() {
setTitle([] { return qsl("Telegram Desktop"); }); setTitle(rpl::single(qsl("Telegram Desktop")));
addButton(langFactory(lng_close), [this] { closeBox(); }); addButton(langFactory(lng_close), [this] { closeBox(); });

View File

@ -16,9 +16,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/labels.h" #include "ui/widgets/labels.h"
#include "ui/widgets/shadow.h" #include "ui/widgets/shadow.h"
#include "ui/wrap/fade_wrap.h" #include "ui/wrap/fade_wrap.h"
#include "ui/text/text_utilities.h"
#include "mainwidget.h" #include "mainwidget.h"
#include "mainwindow.h" #include "mainwindow.h"
void BoxContent::setTitle(rpl::producer<QString> title) {
getDelegate()->setTitle(std::move(title) | Ui::Text::ToWithEntities());
}
QPointer<Ui::RoundButton> BoxContent::addButton( QPointer<Ui::RoundButton> BoxContent::addButton(
Fn<QString()> textFactory, Fn<QString()> textFactory,
Fn<void()> clickCallback) { Fn<void()> clickCallback) {
@ -310,18 +315,10 @@ void AbstractBox::parentResized() {
update(); update();
} }
void AbstractBox::setTitle(Fn<TextWithEntities()> titleFactory) { void AbstractBox::setTitle(rpl::producer<TextWithEntities> title) {
_titleFactory = std::move(titleFactory); const auto wasTitle = hasTitle();
refreshTitle(); if (title) {
} _title.create(this, std::move(title), st::boxTitle);
void AbstractBox::refreshTitle() {
auto wasTitle = hasTitle();
if (_titleFactory) {
if (!_title) {
_title.create(this, st::boxTitle);
}
_title->setMarkedText(_titleFactory());
updateTitlePosition(); updateTitlePosition();
} else { } else {
_title.destroy(); _title.destroy();
@ -350,7 +347,6 @@ void AbstractBox::refreshAdditionalTitle() {
} }
void AbstractBox::refreshLang() { void AbstractBox::refreshLang() {
refreshTitle();
refreshAdditionalTitle(); refreshAdditionalTitle();
InvokeQueued(this, [this] { updateButtonsPositions(); }); InvokeQueued(this, [this] { updateButtonsPositions(); });
} }

View File

@ -30,7 +30,7 @@ class BoxContent;
class BoxContentDelegate { class BoxContentDelegate {
public: public:
virtual void setLayerType(bool layerType) = 0; virtual void setLayerType(bool layerType) = 0;
virtual void setTitle(Fn<TextWithEntities()> titleFactory) = 0; virtual void setTitle(rpl::producer<TextWithEntities> title) = 0;
virtual void setAdditionalTitle(Fn<QString()> additionalFactory) = 0; virtual void setAdditionalTitle(Fn<QString()> additionalFactory) = 0;
virtual void setCloseByOutsideClick(bool close) = 0; virtual void setCloseByOutsideClick(bool close) = 0;
@ -81,15 +81,9 @@ public:
getDelegate()->closeBox(); getDelegate()->closeBox();
} }
void setTitle(Fn<QString()> titleFactory) { void setTitle(rpl::producer<QString> title);
if (titleFactory) { void setTitle(rpl::producer<TextWithEntities> title) {
getDelegate()->setTitle([titleFactory] { return TextWithEntities { titleFactory(), EntitiesInText() }; }); getDelegate()->setTitle(std::move(title));
} else {
getDelegate()->setTitle(Fn<TextWithEntities()>());
}
}
void setTitle(Fn<TextWithEntities()> titleFactory) {
getDelegate()->setTitle(std::move(titleFactory));
} }
void setAdditionalTitle(Fn<QString()> additional) { void setAdditionalTitle(Fn<QString()> additional) {
getDelegate()->setAdditionalTitle(std::move(additional)); getDelegate()->setAdditionalTitle(std::move(additional));
@ -256,7 +250,7 @@ public:
void parentResized() override; void parentResized() override;
void setLayerType(bool layerType) override; void setLayerType(bool layerType) override;
void setTitle(Fn<TextWithEntities()> titleFactory) override; void setTitle(rpl::producer<TextWithEntities> title) override;
void setAdditionalTitle(Fn<QString()> additionalFactory) override; void setAdditionalTitle(Fn<QString()> additionalFactory) override;
void showBox( void showBox(
object_ptr<BoxContent> box, object_ptr<BoxContent> box,
@ -307,7 +301,6 @@ protected:
private: private:
void paintAdditionalTitle(Painter &p); void paintAdditionalTitle(Painter &p);
void updateTitlePosition(); void updateTitlePosition();
void refreshTitle();
void refreshAdditionalTitle(); void refreshAdditionalTitle();
void refreshLang(); void refreshLang();

View File

@ -212,10 +212,13 @@ void AddContactBox::prepare() {
setTabOrder(_last, _first); setTabOrder(_last, _first);
} }
if (_user) { if (_user) {
setTitle(langFactory(lng_edit_contact_title)); setTitle(tr::lng_edit_contact_title());
} else { } else {
auto readyToAdd = !_phone->getLastText().isEmpty() && (!_first->getLastText().isEmpty() || !_last->getLastText().isEmpty()); const auto readyToAdd = !_phone->getLastText().isEmpty()
setTitle(langFactory(readyToAdd ? lng_confirm_contact_data : lng_enter_contact_data)); && (!_first->getLastText().isEmpty() || !_last->getLastText().isEmpty());
setTitle(readyToAdd
? tr::lng_confirm_contact_data()
: tr::lng_enter_contact_data());
} }
updateButtons(); updateButtons();
@ -1092,7 +1095,7 @@ EditNameBox::EditNameBox(QWidget*, not_null<UserData*> user)
void EditNameBox::prepare() { void EditNameBox::prepare() {
auto newHeight = st::contactPadding.top() + _first->height(); auto newHeight = st::contactPadding.top() + _first->height();
setTitle(langFactory(lng_edit_self_title)); setTitle(tr::lng_edit_self_title());
newHeight += st::contactSkip + _last->height(); newHeight += st::contactSkip + _last->height();
newHeight += st::boxPadding.bottom() + st::contactPadding.bottom(); newHeight += st::boxPadding.bottom() + st::contactPadding.bottom();

View File

@ -43,7 +43,7 @@ void AutoDownloadBox::setupContent() {
using namespace rpl::mappers; using namespace rpl::mappers;
using Type = Data::AutoDownload::Type; using Type = Data::AutoDownload::Type;
setTitle(langFactory(lng_media_auto_title)); setTitle(tr::lng_media_auto_title());
const auto settings = &Auth().settings().autoDownload(); const auto settings = &Auth().settings().autoDownload();
const auto checked = [=](Source source, Type type) { const auto checked = [=](Source source, Type type) {

View File

@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
void AutoLockBox::prepare() { void AutoLockBox::prepare() {
setTitle(langFactory(lng_passcode_autolock)); setTitle(tr::lng_passcode_autolock());
addButton(langFactory(lng_box_ok), [this] { closeBox(); }); addButton(langFactory(lng_box_ok), [this] { closeBox(); });

View File

@ -122,7 +122,7 @@ BackgroundBox::BackgroundBox(QWidget*) {
} }
void BackgroundBox::prepare() { void BackgroundBox::prepare() {
setTitle(langFactory(lng_backgrounds_header)); setTitle(tr::lng_backgrounds_header());
addButton(langFactory(lng_close), [=] { closeBox(); }); addButton(langFactory(lng_close), [=] { closeBox(); });

View File

@ -407,7 +407,7 @@ not_null<HistoryView::ElementDelegate*> BackgroundPreviewBox::delegate() {
} }
void BackgroundPreviewBox::prepare() { void BackgroundPreviewBox::prepare() {
setTitle(langFactory(lng_background_header)); setTitle(tr::lng_background_header());
addButton(langFactory(lng_background_apply), [=] { apply(); }); addButton(langFactory(lng_background_apply), [=] { apply(); });
addButton(langFactory(lng_cancel), [=] { closeBox(); }); addButton(langFactory(lng_cancel), [=] { closeBox(); });

View File

@ -120,7 +120,7 @@ private:
}; };
void ChangePhoneBox::EnterPhone::prepare() { void ChangePhoneBox::EnterPhone::prepare() {
setTitle(langFactory(lng_change_phone_title)); setTitle(tr::lng_change_phone_title());
auto phoneValue = QString(); auto phoneValue = QString();
_phone.create(this, st::defaultInputField, tr::lng_change_phone_new_title(), phoneValue); _phone.create(this, st::defaultInputField, tr::lng_change_phone_new_title(), phoneValue);
@ -235,7 +235,7 @@ ChangePhoneBox::EnterCode::EnterCode(QWidget*, const QString &phone, const QStri
} }
void ChangePhoneBox::EnterCode::prepare() { void ChangePhoneBox::EnterCode::prepare() {
setTitle(langFactory(lng_change_phone_title)); setTitle(tr::lng_change_phone_title());
auto descriptionText = lng_change_phone_code_description__rich( auto descriptionText = lng_change_phone_code_description__rich(
lt_phone, lt_phone,
@ -338,7 +338,7 @@ bool ChangePhoneBox::EnterCode::sendCodeFail(const RPCError &error) {
} }
void ChangePhoneBox::prepare() { void ChangePhoneBox::prepare() {
setTitle(langFactory(lng_change_phone_title)); setTitle(tr::lng_change_phone_title());
addButton(langFactory(lng_change_phone_button), [] { addButton(langFactory(lng_change_phone_button), [] {
Ui::show(Box<ConfirmBox>(lang(lng_change_phone_warning), [] { Ui::show(Box<ConfirmBox>(lang(lng_change_phone_warning), [] {
Ui::show(Box<EnterPhone>()); Ui::show(Box<EnterPhone>());

View File

@ -282,7 +282,7 @@ void ConfirmPhoneBox::prepare() {
_code->setAutoSubmit(_sentCodeLength, [=] { sendCode(); }); _code->setAutoSubmit(_sentCodeLength, [=] { sendCode(); });
_code->setChangedCallback([=] { showError(QString()); }); _code->setChangedCallback([=] { showError(QString()); });
setTitle(langFactory(lng_confirm_phone_title)); setTitle(tr::lng_confirm_phone_title());
addButton(langFactory(lng_confirm_phone_send), [=] { sendCode(); }); addButton(langFactory(lng_confirm_phone_send), [=] { sendCode(); });
addButton(langFactory(lng_cancel), [=] { closeBox(); }); addButton(langFactory(lng_cancel), [=] { closeBox(); });

View File

@ -469,7 +469,7 @@ ProxiesBox::ProxiesBox(
} }
void ProxiesBox::prepare() { void ProxiesBox::prepare() {
setTitle(langFactory(lng_proxy_settings)); setTitle(tr::lng_proxy_settings());
addButton(langFactory(lng_proxy_add), [=] { addNewProxy(); }); addButton(langFactory(lng_proxy_add), [=] { addNewProxy(); });
addButton(langFactory(lng_close), [=] { closeBox(); }); addButton(langFactory(lng_close), [=] { closeBox(); });
@ -698,7 +698,7 @@ ProxyBox::ProxyBox(
} }
void ProxyBox::prepare() { void ProxyBox::prepare() {
setTitle(langFactory(lng_proxy_edit)); setTitle(tr::lng_proxy_edit());
refreshButtons(); refreshButtons();
setDimensionsToContent(st::boxWideWidth, _content); setDimensionsToContent(st::boxWideWidth, _content);

View File

@ -725,7 +725,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
} }
void CreatePollBox::prepare() { void CreatePollBox::prepare() {
setTitle(langFactory(lng_polls_create_title)); setTitle(tr::lng_polls_create_title());
const auto inner = setInnerWidget(setupContent()); const auto inner = setInnerWidget(setupContent());

View File

@ -29,7 +29,7 @@ void DownloadPathBox::prepare() {
addButton(langFactory(lng_connection_save), [this] { save(); }); addButton(langFactory(lng_connection_save), [this] { save(); });
addButton(langFactory(lng_cancel), [this] { closeBox(); }); addButton(langFactory(lng_cancel), [this] { closeBox(); });
setTitle(langFactory(lng_download_path_header)); setTitle(tr::lng_download_path_header());
_group->setChangedCallback([this](Directory value) { radioChanged(value); }); _group->setChangedCallback([this](Directory value) { radioChanged(value); });

View File

@ -631,7 +631,7 @@ EditColorBox::EditColorBox(QWidget*, const QString &title, QColor current) : Box
} }
void EditColorBox::prepare() { void EditColorBox::prepare() {
setTitle([=] { return _title; }); setTitle(rpl::single(_title));
const auto hsvChanged = [=] { updateFromHSVFields(); }; const auto hsvChanged = [=] { updateFromHSVFields(); };
const auto rgbChanged = [=] { updateFromRGBFields(); }; const auto rgbChanged = [=] { updateFromRGBFields(); };

View File

@ -32,7 +32,9 @@ namespace {
class PrivacyExceptionsBoxController : public ChatsListBoxController { class PrivacyExceptionsBoxController : public ChatsListBoxController {
public: public:
PrivacyExceptionsBoxController(Fn<QString()> titleFactory, const std::vector<not_null<PeerData*>> &selected); PrivacyExceptionsBoxController(
rpl::producer<QString> title,
const std::vector<not_null<PeerData*>> &selected);
void rowClicked(not_null<PeerListRow*> row) override; void rowClicked(not_null<PeerListRow*> row) override;
std::vector<not_null<PeerData*>> getResult() const; std::vector<not_null<PeerData*>> getResult() const;
@ -42,20 +44,20 @@ protected:
std::unique_ptr<Row> createRow(not_null<History*> history) override; std::unique_ptr<Row> createRow(not_null<History*> history) override;
private: private:
Fn<QString()> _titleFactory; rpl::producer<QString> _title;
std::vector<not_null<PeerData*>> _selected; std::vector<not_null<PeerData*>> _selected;
}; };
PrivacyExceptionsBoxController::PrivacyExceptionsBoxController( PrivacyExceptionsBoxController::PrivacyExceptionsBoxController(
Fn<QString()> titleFactory, rpl::producer<QString> title,
const std::vector<not_null<PeerData*>> &selected) const std::vector<not_null<PeerData*>> &selected)
: _titleFactory(std::move(titleFactory)) : _title(std::move(title))
, _selected(selected) { , _selected(selected) {
} }
void PrivacyExceptionsBoxController::prepareViewHook() { void PrivacyExceptionsBoxController::prepareViewHook() {
delegate()->peerListSetTitle(_titleFactory); delegate()->peerListSetTitle(std::move(_title));
delegate()->peerListAddSelectedRows(_selected); delegate()->peerListAddSelectedRows(_selected);
} }
@ -127,9 +129,7 @@ void EditPrivacyBox::editExceptions(
Exception exception, Exception exception,
Fn<void()> done) { Fn<void()> done) {
auto controller = std::make_unique<PrivacyExceptionsBoxController>( auto controller = std::make_unique<PrivacyExceptionsBoxController>(
crl::guard(this, [=] { _controller->exceptionBoxTitle(exception),
return _controller->exceptionBoxTitle(exception);
}),
exceptions(exception)); exceptions(exception));
auto initBox = [=, controller = controller.get()]( auto initBox = [=, controller = controller.get()](
not_null<PeerListBox*> box) { not_null<PeerListBox*> box) {
@ -272,7 +272,7 @@ Ui::FlatLabel *EditPrivacyBox::addLabel(
void EditPrivacyBox::setupContent() { void EditPrivacyBox::setupContent() {
using namespace Settings; using namespace Settings;
setTitle([=] { return _controller->title(); }); setTitle(_controller->title());
auto wrap = object_ptr<Ui::VerticalLayout>(this); auto wrap = object_ptr<Ui::VerticalLayout>(this);
const auto content = wrap.data(); const auto content = wrap.data();

View File

@ -39,7 +39,7 @@ public:
[[nodiscard]] virtual Key key() = 0; [[nodiscard]] virtual Key key() = 0;
[[nodiscard]] virtual MTPInputPrivacyKey apiKey() = 0; [[nodiscard]] virtual MTPInputPrivacyKey apiKey() = 0;
[[nodiscard]] virtual QString title() = 0; [[nodiscard]] virtual rpl::producer<QString> title() = 0;
[[nodiscard]] virtual bool hasOption(Option option) { [[nodiscard]] virtual bool hasOption(Option option) {
return true; return true;
} }
@ -50,7 +50,7 @@ public:
} }
[[nodiscard]] virtual rpl::producer<QString> exceptionButtonTextKey( [[nodiscard]] virtual rpl::producer<QString> exceptionButtonTextKey(
Exception exception) = 0; Exception exception) = 0;
[[nodiscard]] virtual QString exceptionBoxTitle( [[nodiscard]] virtual rpl::producer<QString> exceptionBoxTitle(
Exception exception) = 0; Exception exception) = 0;
[[nodiscard]] virtual auto exceptionsDescription() [[nodiscard]] virtual auto exceptionsDescription()
-> rpl::producer<QString> = 0; -> rpl::producer<QString> = 0;

View File

@ -1037,7 +1037,7 @@ Ui::ScrollToRequest Content::jump(int rows) {
void LanguageBox::prepare() { void LanguageBox::prepare() {
addButton(langFactory(lng_box_ok), [=] { closeBox(); }); addButton(langFactory(lng_box_ok), [=] { closeBox(); });
setTitle(langFactory(lng_languages)); setTitle(tr::lng_languages());
const auto select = createMultiSelect(); const auto select = createMultiSelect();

View File

@ -297,7 +297,7 @@ void LocalStorageBox::Show(
} }
void LocalStorageBox::prepare() { void LocalStorageBox::prepare() {
setTitle(langFactory(lng_local_storage_title)); setTitle(tr::lng_local_storage_title());
addButton(langFactory(lng_box_ok), [this] { closeBox(); }); addButton(langFactory(lng_box_ok), [this] { closeBox(); });

View File

@ -26,7 +26,7 @@ MuteSettingsBox::MuteSettingsBox(QWidget *parent, not_null<PeerData*> peer)
} }
void MuteSettingsBox::prepare() { void MuteSettingsBox::prepare() {
setTitle(langFactory(lng_disable_notifications_from_tray)); setTitle(tr::lng_disable_notifications_from_tray());
auto y = 0; auto y = 0;
object_ptr<Ui::FlatLabel> info(this, st::boxLabel); object_ptr<Ui::FlatLabel> info(this, st::boxLabel);

View File

@ -108,20 +108,24 @@ void PasscodeBox::prepare() {
const auto onlyCheck = onlyCheckCurrent(); const auto onlyCheck = onlyCheckCurrent();
if (onlyCheck) { if (onlyCheck) {
_oldPasscode->show(); _oldPasscode->show();
setTitle([=] { setTitle(_cloudFields.customTitle
return _cloudFields.customTitle.value_or(lang(_cloudPwd ? rpl::single(*_cloudFields.customTitle)
? lng_cloud_password_remove : _cloudPwd
: lng_passcode_remove)); ? tr::lng_cloud_password_remove()
}); : tr::lng_passcode_remove());
setDimensions(st::boxWidth, st::passcodePadding.top() + _oldPasscode->height() + st::passcodeTextLine + ((_cloudFields.hasRecovery && !_hintText.isEmpty()) ? st::passcodeTextLine : 0) + st::passcodeAboutSkip + _aboutHeight + st::passcodePadding.bottom()); setDimensions(st::boxWidth, st::passcodePadding.top() + _oldPasscode->height() + st::passcodeTextLine + ((_cloudFields.hasRecovery && !_hintText.isEmpty()) ? st::passcodeTextLine : 0) + st::passcodeAboutSkip + _aboutHeight + st::passcodePadding.bottom());
} else { } else {
if (currentlyHave()) { if (currentlyHave()) {
_oldPasscode->show(); _oldPasscode->show();
setTitle(langFactory(_cloudPwd ? lng_cloud_password_change : lng_passcode_change)); setTitle(_cloudPwd
? tr::lng_cloud_password_change()
: tr::lng_passcode_change());
setDimensions(st::boxWidth, st::passcodePadding.top() + _oldPasscode->height() + st::passcodeTextLine + ((_cloudFields.hasRecovery && !_hintText.isEmpty()) ? st::passcodeTextLine : 0) + _newPasscode->height() + st::passcodeLittleSkip + _reenterPasscode->height() + st::passcodeSkip + (_cloudPwd ? _passwordHint->height() + st::passcodeLittleSkip : 0) + st::passcodeAboutSkip + _aboutHeight + st::passcodePadding.bottom()); setDimensions(st::boxWidth, st::passcodePadding.top() + _oldPasscode->height() + st::passcodeTextLine + ((_cloudFields.hasRecovery && !_hintText.isEmpty()) ? st::passcodeTextLine : 0) + _newPasscode->height() + st::passcodeLittleSkip + _reenterPasscode->height() + st::passcodeSkip + (_cloudPwd ? _passwordHint->height() + st::passcodeLittleSkip : 0) + st::passcodeAboutSkip + _aboutHeight + st::passcodePadding.bottom());
} else { } else {
_oldPasscode->hide(); _oldPasscode->hide();
setTitle(langFactory(_cloudPwd ? lng_cloud_password_create : lng_passcode_create)); setTitle(_cloudPwd
? tr::lng_cloud_password_create()
: tr::lng_passcode_create());
setDimensions(st::boxWidth, st::passcodePadding.top() + _newPasscode->height() + st::passcodeLittleSkip + _reenterPasscode->height() + st::passcodeSkip + (_cloudPwd ? _passwordHint->height() + st::passcodeLittleSkip : 0) + st::passcodeAboutSkip + _aboutHeight + (_cloudPwd ? (st::passcodeLittleSkip + _recoverEmail->height() + st::passcodeSkip) : st::passcodePadding.bottom())); setDimensions(st::boxWidth, st::passcodePadding.top() + _newPasscode->height() + st::passcodeLittleSkip + _reenterPasscode->height() + st::passcodeSkip + (_cloudPwd ? _passwordHint->height() + st::passcodeLittleSkip : 0) + st::passcodeAboutSkip + _aboutHeight + (_cloudPwd ? (st::passcodeLittleSkip + _recoverEmail->height() + st::passcodeSkip) : st::passcodePadding.bottom()));
} }
} }
@ -908,7 +912,7 @@ rpl::producer<> RecoverBox::recoveryExpired() const {
} }
void RecoverBox::prepare() { void RecoverBox::prepare() {
setTitle(langFactory(lng_signin_recover_title)); setTitle(tr::lng_signin_recover_title());
addButton(langFactory(lng_passcode_submit), [=] { submit(); }); addButton(langFactory(lng_passcode_submit), [=] { submit(); });
addButton(langFactory(lng_cancel), [=] { closeBox(); }); addButton(langFactory(lng_cancel), [=] { closeBox(); });

View File

@ -225,7 +225,7 @@ struct PeerListState;
class PeerListDelegate { class PeerListDelegate {
public: public:
virtual void peerListSetTitle(Fn<QString()> title) = 0; virtual void peerListSetTitle(rpl::producer<QString> title) = 0;
virtual void peerListSetAdditionalTitle(Fn<QString()> title) = 0; virtual void peerListSetAdditionalTitle(Fn<QString()> title) = 0;
virtual void peerListSetDescription(object_ptr<Ui::FlatLabel> description) = 0; virtual void peerListSetDescription(object_ptr<Ui::FlatLabel> description) = 0;
virtual void peerListSetSearchLoading(object_ptr<Ui::FlatLabel> loading) = 0; virtual void peerListSetSearchLoading(object_ptr<Ui::FlatLabel> loading) = 0;
@ -755,7 +755,7 @@ public:
std::unique_ptr<PeerListController> controller, std::unique_ptr<PeerListController> controller,
Fn<void(not_null<PeerListBox*>)> init); Fn<void(not_null<PeerListBox*>)> init);
void peerListSetTitle(Fn<QString()> title) override { void peerListSetTitle(rpl::producer<QString> title) override {
setTitle(std::move(title)); setTitle(std::move(title));
} }
void peerListSetAdditionalTitle( void peerListSetAdditionalTitle(

View File

@ -325,7 +325,7 @@ ContactsBoxController::ContactsBoxController(
void ContactsBoxController::prepare() { void ContactsBoxController::prepare() {
setSearchNoResultsText(lang(lng_blocked_list_not_found)); setSearchNoResultsText(lang(lng_blocked_list_not_found));
delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled); delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled);
delegate()->peerListSetTitle(langFactory(lng_contacts_header)); delegate()->peerListSetTitle(tr::lng_contacts_header());
prepareViewHook(); prepareViewHook();
@ -497,9 +497,9 @@ void AddBotToGroupBoxController::updateLabels() {
} }
void AddBotToGroupBoxController::prepareViewHook() { void AddBotToGroupBoxController::prepareViewHook() {
delegate()->peerListSetTitle(langFactory(sharingBotGame() delegate()->peerListSetTitle(sharingBotGame()
? lng_bot_choose_chat ? tr::lng_bot_choose_chat()
: lng_bot_choose_group)); : tr::lng_bot_choose_group());
updateLabels(); updateLabels();
Auth().data().chatsListLoadedEvents( Auth().data().chatsListLoadedEvents(
) | rpl::filter([=](Data::Folder *folder) { ) | rpl::filter([=](Data::Folder *folder) {
@ -515,7 +515,7 @@ ChooseRecipientBoxController::ChooseRecipientBoxController(
} }
void ChooseRecipientBoxController::prepareViewHook() { void ChooseRecipientBoxController::prepareViewHook() {
delegate()->peerListSetTitle(langFactory(lng_forward_choose)); delegate()->peerListSetTitle(tr::lng_forward_choose());
} }
void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) { void ChooseRecipientBoxController::rowClicked(not_null<PeerListRow*> row) {

View File

@ -155,7 +155,7 @@ void AddParticipantsBoxController::updateTitle() {
&& !_peer->isMegagroup()) && !_peer->isMegagroup())
? QString() : ? QString() :
QString("%1 / %2").arg(fullCount()).arg(Global::MegagroupSizeMax()); QString("%1 / %2").arg(fullCount()).arg(Global::MegagroupSizeMax());
delegate()->peerListSetTitle(langFactory(lng_profile_add_participant)); delegate()->peerListSetTitle(tr::lng_profile_add_participant());
delegate()->peerListSetAdditionalTitle([=] { return additional; }); delegate()->peerListSetAdditionalTitle([=] { return additional; });
} }
@ -287,18 +287,18 @@ std::unique_ptr<PeerListRow> AddSpecialBoxController::createSearchRow(
void AddSpecialBoxController::prepare() { void AddSpecialBoxController::prepare() {
delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled); delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled);
const auto title = [&] { auto title = [&] {
switch (_role) { switch (_role) {
case Role::Admins: case Role::Admins:
return langFactory(lng_channel_add_admin); return tr::lng_channel_add_admin();
case Role::Restricted: case Role::Restricted:
return langFactory(lng_channel_add_exception); return tr::lng_channel_add_exception();
case Role::Kicked: case Role::Kicked:
return langFactory(lng_channel_add_removed); return tr::lng_channel_add_removed();
} }
Unexpected("Role in AddSpecialBoxController::prepare()"); Unexpected("Role in AddSpecialBoxController::prepare()");
}(); }();
delegate()->peerListSetTitle(title); delegate()->peerListSetTitle(std::move(title));
setDescriptionText(lang(lng_contacts_loading)); setDescriptionText(lang(lng_contacts_loading));
setSearchNoResultsText(lang(lng_blocked_list_not_found)); setSearchNoResultsText(lang(lng_blocked_list_not_found));

View File

@ -76,9 +76,9 @@ Controller::Controller(
void Controller::prepare() { void Controller::prepare() {
setupContent(); setupContent();
_box->setTitle(langFactory(_user->isContact() _box->setTitle(_user->isContact()
? lng_edit_contact_title ? tr::lng_edit_contact_title()
: lng_enter_contact_data)); : tr::lng_enter_contact_data());
_box->addButton(langFactory(lng_box_done), _save); _box->addButton(langFactory(lng_box_done), _save);
_box->addButton(langFactory(lng_cancel), [=] { _box->closeBox(); }); _box->addButton(langFactory(lng_cancel), [=] { _box->closeBox(); });

View File

@ -285,9 +285,9 @@ object_ptr<BoxContent> EditLinkedChatBox(
st::linkedChatAboutPadding); st::linkedChatAboutPadding);
box->peerListSetBelowWidget(std::move(below)); box->peerListSetBelowWidget(std::move(below));
box->setTitle(langFactory(channel->isBroadcast() box->setTitle(channel->isBroadcast()
? lng_manage_discussion_group ? tr::lng_manage_discussion_group()
: lng_manage_linked_channel)); : tr::lng_manage_linked_channel());
box->addButton(langFactory(lng_close), [=] { box->closeBox(); }); box->addButton(langFactory(lng_close), [=] { box->closeBox(); });
}; };
auto controller = std::make_unique<Controller>( auto controller = std::make_unique<Controller>(

View File

@ -69,7 +69,7 @@ void TransferPasswordError(
not_null<GenericBox*> box, not_null<GenericBox*> box,
not_null<UserData*> user, not_null<UserData*> user,
PasswordErrorType error) { PasswordErrorType error) {
box->setTitle(langFactory(lng_rights_transfer_check)); box->setTitle(tr::lng_rights_transfer_check());
box->setWidth(st::transferCheckWidth); box->setWidth(st::transferCheckWidth);
auto text = lng_rights_transfer_check_about__rich( auto text = lng_rights_transfer_check_about__rich(
@ -271,9 +271,9 @@ void EditAdminBox::prepare() {
EditParticipantBox::prepare(); EditParticipantBox::prepare();
auto hadRights = _oldRights.c_chatAdminRights().vflags.v; auto hadRights = _oldRights.c_chatAdminRights().vflags.v;
setTitle(langFactory(hadRights setTitle(hadRights
? lng_rights_edit_admin ? tr::lng_rights_edit_admin()
: lng_channel_add_admin)); : tr::lng_channel_add_admin());
addControl( addControl(
object_ptr<BoxContentDivider>(this), object_ptr<BoxContentDivider>(this),
@ -579,7 +579,7 @@ EditRestrictedBox::EditRestrictedBox(
void EditRestrictedBox::prepare() { void EditRestrictedBox::prepare() {
EditParticipantBox::prepare(); EditParticipantBox::prepare();
setTitle(langFactory(lng_rights_user_restrictions)); setTitle(tr::lng_rights_user_restrictions());
addControl( addControl(
object_ptr<BoxContentDivider>(this), object_ptr<BoxContentDivider>(this),

View File

@ -1012,18 +1012,18 @@ rpl::producer<int> ParticipantsBoxController::onlineCountValue() const {
} }
void ParticipantsBoxController::prepare() { void ParticipantsBoxController::prepare() {
const auto titleKey = [&] { auto title = [&] {
switch (_role) { switch (_role) {
case Role::Admins: return lng_channel_admins; case Role::Admins: return tr::lng_channel_admins();
case Role::Profile: case Role::Profile:
case Role::Members: return lng_profile_participants_section; case Role::Members: return tr::lng_profile_participants_section();
case Role::Restricted: return lng_exceptions_list_title; case Role::Restricted: return tr::lng_exceptions_list_title();
case Role::Kicked: return lng_removed_list_title; case Role::Kicked: return tr::lng_removed_list_title();
} }
Unexpected("Role in ParticipantsBoxController::prepare()"); Unexpected("Role in ParticipantsBoxController::prepare()");
}(); }();
delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled); delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled);
delegate()->peerListSetTitle(langFactory(titleKey)); delegate()->peerListSetTitle(std::move(title));
setDescriptionText(lang(lng_contacts_loading)); setDescriptionText(lang(lng_contacts_loading));
setSearchNoResultsText(lang(lng_blocked_list_not_found)); setSearchNoResultsText(lang(lng_blocked_list_not_found));

View File

@ -111,7 +111,7 @@ EditPeerHistoryVisibilityBox::EditPeerHistoryVisibilityBox(
void EditPeerHistoryVisibilityBox::prepare() { void EditPeerHistoryVisibilityBox::prepare() {
_peer->updateFull(); _peer->updateFull();
setTitle(langFactory(lng_manage_history_visibility_title)); setTitle(tr::lng_manage_history_visibility_title());
addButton(langFactory(lng_settings_save), [=] { addButton(langFactory(lng_settings_save), [=] {
auto local = std::move(_savedCallback); auto local = std::move(_savedCallback);
local(_historyVisibility->value()); local(_historyVisibility->value());

View File

@ -269,9 +269,9 @@ Controller::Controller(
: _box(box) : _box(box)
, _peer(peer) , _peer(peer)
, _isGroup(_peer->isChat() || _peer->isMegagroup()) { , _isGroup(_peer->isChat() || _peer->isMegagroup()) {
_box->setTitle(langFactory(_isGroup _box->setTitle(_isGroup
? lng_edit_group ? tr::lng_edit_group()
: lng_edit_channel_title)); : tr::lng_edit_channel_title());
_box->addButton(langFactory(lng_settings_save), [this] { _box->addButton(langFactory(lng_settings_save), [this] {
save(); save();
}); });

View File

@ -298,7 +298,7 @@ auto EditPeerPermissionsBox::saveEvents() const
} }
void EditPeerPermissionsBox::prepare() { void EditPeerPermissionsBox::prepare() {
setTitle(langFactory(lng_manage_peer_permissions)); setTitle(tr::lng_manage_peer_permissions());
const auto inner = setInnerWidget(object_ptr<Ui::VerticalLayout>(this)); const auto inner = setInnerWidget(object_ptr<Ui::VerticalLayout>(this));

View File

@ -58,12 +58,12 @@ public:
QString getUsernameInput(); QString getUsernameInput();
void setFocusUsername(); void setFocusUsername();
LangKey getTitle() { rpl::producer<QString> getTitle() {
return _isInviteLink return _isInviteLink
? lng_profile_invite_link_section ? tr::lng_profile_invite_link_section()
: _isGroup : _isGroup
? lng_manage_peer_group_type ? tr::lng_manage_peer_group_type()
: lng_manage_peer_channel_type; : tr::lng_manage_peer_channel_type();
} }
bool isInviteLink() { bool isInviteLink() {
@ -730,7 +730,7 @@ void EditPeerTypeBox::prepare() {
lifetime()); lifetime());
controller->createContent(); controller->createContent();
setTitle(langFactory(controller->getTitle())); setTitle(controller->getTitle());
if (!controller->isInviteLink() && _savedCallback.has_value()) { if (!controller->isInviteLink() && _savedCallback.has_value()) {
addButton(langFactory(lng_settings_save), [=] { addButton(langFactory(lng_settings_save), [=] {

View File

@ -31,7 +31,7 @@ RateCallBox::RateCallBox(QWidget*, uint64 callId, uint64 callAccessHash)
} }
void RateCallBox::prepare() { void RateCallBox::prepare() {
setTitle(langFactory(lng_call_rate_label)); setTitle(tr::lng_call_rate_label());
addButton(langFactory(lng_cancel), [this] { closeBox(); }); addButton(langFactory(lng_cancel), [this] { closeBox(); });
for (auto i = 0; i < kMaxRating; ++i) { for (auto i = 0; i < kMaxRating; ++i) {

View File

@ -34,17 +34,17 @@ ReportBox::ReportBox(QWidget*, not_null<PeerData*> peer, MessageIdsList ids)
} }
void ReportBox::prepare() { void ReportBox::prepare() {
setTitle(langFactory([&] { setTitle([&] {
if (_ids) { if (_ids) {
return lng_report_message_title; return tr::lng_report_message_title();
} else if (_peer->isUser()) { } else if (_peer->isUser()) {
return lng_report_bot_title; return tr::lng_report_bot_title();
} else if (_peer->isMegagroup()) { } else if (_peer->isMegagroup()) {
return lng_report_group_title; return tr::lng_report_group_title();
} else { } else {
return lng_report_title; return tr::lng_report_title();
} }
}())); }());
addButton(langFactory(lng_report_button), [=] { report(); }); addButton(langFactory(lng_report_button), [=] { report(); });
addButton(langFactory(lng_cancel), [=] { closeBox(); }); addButton(langFactory(lng_cancel), [=] { closeBox(); });

View File

@ -86,7 +86,7 @@ QString SelfDestructionBox::DaysLabel(int days) {
} }
void SelfDestructionBox::prepare() { void SelfDestructionBox::prepare() {
setTitle(langFactory(lng_self_destruct_title)); setTitle(tr::lng_self_destruct_title());
auto fake = object_ptr<Ui::FlatLabel>( auto fake = object_ptr<Ui::FlatLabel>(
this, this,

View File

@ -80,7 +80,7 @@ SessionsBox::SessionsBox(QWidget*)
} }
void SessionsBox::prepare() { void SessionsBox::prepare() {
setTitle(langFactory(lng_sessions_other_header)); setTitle(tr::lng_sessions_other_header());
addButton(langFactory(lng_close), [=] { closeBox(); }); addButton(langFactory(lng_close), [=] { closeBox(); });

View File

@ -205,7 +205,7 @@ void ShareBox::prepare() {
_select->resizeToWidth(st::boxWideWidth); _select->resizeToWidth(st::boxWideWidth);
Ui::SendPendingMoveResizeEvents(_select); Ui::SendPendingMoveResizeEvents(_select);
setTitle(langFactory(lng_share_title)); setTitle(tr::lng_share_title());
_inner = setInnerWidget( _inner = setInnerWidget(
object_ptr<Inner>( object_ptr<Inner>(

View File

@ -17,18 +17,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
SingleChoiceBox::SingleChoiceBox( SingleChoiceBox::SingleChoiceBox(
QWidget*, QWidget*,
LangKey title, rpl::producer<QString> title,
const std::vector<QString> &optionTexts, const std::vector<QString> &optionTexts,
int initialSelection, int initialSelection,
Fn<void(int)> callback) Fn<void(int)> callback)
: _title(title) : _title(std::move(title))
, _optionTexts(optionTexts) , _optionTexts(optionTexts)
, _initialSelection(initialSelection) , _initialSelection(initialSelection)
, _callback(callback) { , _callback(callback) {
} }
void SingleChoiceBox::prepare() { void SingleChoiceBox::prepare() {
setTitle(langFactory(_title)); setTitle(std::move(_title));
addButton(langFactory(lng_box_ok), [=] { closeBox(); }); addButton(langFactory(lng_box_ok), [=] { closeBox(); });

View File

@ -20,7 +20,7 @@ class SingleChoiceBox : public BoxContent {
public: public:
SingleChoiceBox( SingleChoiceBox(
QWidget*, QWidget*,
LangKey title, rpl::producer<QString> title,
const std::vector<QString> &optionTexts, const std::vector<QString> &optionTexts,
int initialSelection, int initialSelection,
Fn<void(int)> callback); Fn<void(int)> callback);
@ -29,7 +29,7 @@ protected:
void prepare() override; void prepare() override;
private: private:
LangKey _title; rpl::producer<QString> _title;
std::vector<QString> _optionTexts; std::vector<QString> _optionTexts;
int _initialSelection = 0; int _initialSelection = 0;
Fn<void(int)> _callback; Fn<void(int)> _callback;

View File

@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/scroll_area.h" #include "ui/widgets/scroll_area.h"
#include "ui/image/image.h" #include "ui/image/image.h"
#include "ui/text/text_utilities.h"
#include "ui/emoji_config.h" #include "ui/emoji_config.h"
#include "auth_session.h" #include "auth_session.h"
#include "apiwrap.h" #include "apiwrap.h"
@ -39,7 +40,7 @@ public:
bool loaded() const; bool loaded() const;
bool notInstalled() const; bool notInstalled() const;
bool official() const; bool official() const;
Fn<TextWithEntities()> title() const; rpl::producer<TextWithEntities> title() const;
QString shortName() const; QString shortName() const;
void install(); void install();
@ -113,7 +114,7 @@ void StickerSetBox::Show(DocumentData *document) {
} }
void StickerSetBox::prepare() { void StickerSetBox::prepare() {
setTitle(langFactory(lng_contacts_loading)); setTitle(tr::lng_contacts_loading());
_inner = setInnerWidget(object_ptr<Inner>(this, _set), st::stickersScroll); _inner = setInnerWidget(object_ptr<Inner>(this, _set), st::stickersScroll);
Auth().data().stickersUpdated( Auth().data().stickersUpdated(
@ -519,18 +520,15 @@ bool StickerSetBox::Inner::official() const {
return _loaded && _setShortName.isEmpty(); return _loaded && _setShortName.isEmpty();
} }
Fn<TextWithEntities()> StickerSetBox::Inner::title() const { rpl::producer<TextWithEntities> StickerSetBox::Inner::title() const {
auto text = TextWithEntities { _setTitle }; if (!_loaded) {
if (_loaded) { return tr::lng_contacts_loading() | Ui::Text::ToWithEntities();
if (_pack.isEmpty()) { } else if (_pack.isEmpty()) {
return [] { return TextWithEntities { lang(lng_attach_failed), EntitiesInText() }; }; return tr::lng_attach_failed() | Ui::Text::ToWithEntities();
} else {
TextUtilities::ParseEntities(text, TextParseMentions);
}
} else {
return [] { return TextWithEntities { lang(lng_contacts_loading), EntitiesInText() }; };
} }
return [text] { return text; }; auto text = TextWithEntities{ _setTitle };
TextUtilities::ParseEntities(text, TextParseMentions);
return rpl::single(text);
} }
QString StickerSetBox::Inner::shortName() const { QString StickerSetBox::Inner::shortName() const {

View File

@ -255,12 +255,12 @@ void StickersBox::prepare() {
if (_tabs) { if (_tabs) {
Local::readArchivedStickers(); Local::readArchivedStickers();
} else { } else {
setTitle(langFactory(lng_stickers_group_set)); setTitle(tr::lng_stickers_group_set());
} }
} else if (_section == Section::Archived) { } else if (_section == Section::Archived) {
requestArchivedSets(); requestArchivedSets();
} else if (_section == Section::Attached) { } else if (_section == Section::Attached) {
setTitle(langFactory(lng_stickers_attached_sets)); setTitle(tr::lng_stickers_attached_sets());
} }
if (_tabs) { if (_tabs) {
if (Auth().data().archivedStickerSetsOrder().isEmpty()) { if (Auth().data().archivedStickerSetsOrder().isEmpty()) {

View File

@ -42,7 +42,7 @@ void UsernameBox::prepare() {
? QString() ? QString()
: lang(lng_username_available); : lang(lng_username_available);
setTitle(langFactory(lng_username_title)); setTitle(tr::lng_username_title());
addButton(langFactory(lng_settings_save), [=] { save(); }); addButton(langFactory(lng_settings_save), [=] { save(); });
addButton(langFactory(lng_cancel), [=] { closeBox(); }); addButton(langFactory(lng_cancel), [=] { closeBox(); });

View File

@ -224,7 +224,7 @@ void BoxController::prepare() {
} }
}); });
delegate()->peerListSetTitle(langFactory(lng_call_box_title)); delegate()->peerListSetTitle(tr::lng_call_box_title());
setDescriptionText(lang(lng_contacts_loading)); setDescriptionText(lang(lng_contacts_loading));
delegate()->peerListRefreshRows(); delegate()->peerListRefreshRows();

View File

@ -48,7 +48,7 @@ DebugInfoBox::DebugInfoBox(QWidget*, base::weak_ptr<Call> call)
} }
void DebugInfoBox::prepare() { void DebugInfoBox::prepare() {
setTitle([] { return QString("Call Debug"); }); setTitle(rpl::single(qsl("Call Debug")));
addButton(langFactory(lng_close), [this] { closeBox(); }); addButton(langFactory(lng_close), [this] { closeBox(); });
_text = setInnerWidget( _text = setInnerWidget(

View File

@ -657,7 +657,7 @@ ManageSetsBox::ManageSetsBox(QWidget*) {
void ManageSetsBox::prepare() { void ManageSetsBox::prepare() {
const auto inner = setInnerWidget(object_ptr<Inner>(this)); const auto inner = setInnerWidget(object_ptr<Inner>(this));
setTitle(langFactory(lng_emoji_manage_sets)); setTitle(tr::lng_emoji_manage_sets());
addButton(langFactory(lng_close), [=] { closeBox(); }); addButton(langFactory(lng_close), [=] { closeBox(); });

View File

@ -157,10 +157,9 @@ void EditLinkBox::prepare() {
} }
}); });
const auto title = url->getLastText().isEmpty() setTitle(url->getLastText().isEmpty()
? lng_formatting_link_create_title ? tr::lng_formatting_link_create_title()
: lng_formatting_link_edit_title; : tr::lng_formatting_link_edit_title());
setTitle(langFactory(title));
addButton(langFactory(lng_formatting_link_create), submit); addButton(langFactory(lng_formatting_link_create), submit);
addButton(langFactory(lng_cancel), [=] { closeBox(); }); addButton(langFactory(lng_cancel), [=] { closeBox(); });

View File

@ -62,7 +62,7 @@ SearchFromController::SearchFromController(
void SearchFromController::prepare() { void SearchFromController::prepare() {
ParticipantsBoxController::prepare(); ParticipantsBoxController::prepare();
delegate()->peerListSetTitle(langFactory(lng_search_messages_from)); delegate()->peerListSetTitle(tr::lng_search_messages_from());
} }
void SearchFromController::rowClicked(not_null<PeerListRow*> row) { void SearchFromController::rowClicked(not_null<PeerListRow*> row) {

View File

@ -41,7 +41,7 @@ SuggestBox::SuggestBox(QWidget*) {
} }
void SuggestBox::prepare() { void SuggestBox::prepare() {
setTitle(langFactory(lng_export_suggest_title)); setTitle(tr::lng_export_suggest_title());
addButton(langFactory(lng_box_ok), [=] { addButton(langFactory(lng_box_ok), [=] {
closeBox(); closeBox();

View File

@ -384,7 +384,7 @@ FilterBox::FilterBox(QWidget*, not_null<ChannelData*> channel, const std::vector
} }
void FilterBox::prepare() { void FilterBox::prepare() {
setTitle(langFactory(lng_admin_log_filter_title)); setTitle(tr::lng_admin_log_filter_title());
_inner = setInnerWidget(object_ptr<Inner>(this, _channel, _admins, _initialFilter, [this] { refreshButtons(); })); _inner = setInnerWidget(object_ptr<Inner>(this, _channel, _admins, _initialFilter, [this] { refreshButtons(); }));
_inner->resizeToWidth(st::boxWideWidth); _inner->resizeToWidth(st::boxWideWidth);

View File

@ -83,7 +83,7 @@ std::unique_ptr<PeerListRow> ListController::createRow(
void ListController::prepare() { void ListController::prepare() {
setSearchNoResultsText(lang(lng_bot_groups_not_found)); setSearchNoResultsText(lang(lng_bot_groups_not_found));
delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled); delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled);
delegate()->peerListSetTitle(langFactory(lng_profile_common_groups_section)); delegate()->peerListSetTitle(tr::lng_profile_common_groups_section());
} }
void ListController::loadMoreRows() { void ListController::loadMoreRows() {
@ -240,7 +240,7 @@ object_ptr<InnerWidget::ListWidget> InnerWidget::setupList(
return result; return result;
} }
void InnerWidget::peerListSetTitle(Fn<QString()> title) { void InnerWidget::peerListSetTitle(rpl::producer<QString> title) {
} }
void InnerWidget::peerListSetAdditionalTitle( void InnerWidget::peerListSetAdditionalTitle(

View File

@ -48,7 +48,7 @@ private:
using ListWidget = PeerListContent; using ListWidget = PeerListContent;
// PeerListContentDelegate interface. // PeerListContentDelegate interface.
void peerListSetTitle(Fn<QString()> title) override; void peerListSetTitle(rpl::producer<QString> title) override;
void peerListSetAdditionalTitle( void peerListSetAdditionalTitle(
Fn<QString()> title) override; Fn<QString()> title) override;
bool peerListIsRowSelected(not_null<PeerData*> peer) override; bool peerListIsRowSelected(not_null<PeerData*> peer) override;

View File

@ -409,7 +409,7 @@ void Members::visibleTopBottomUpdated(
setChildVisibleTopBottom(_list, visibleTop, visibleBottom); setChildVisibleTopBottom(_list, visibleTop, visibleBottom);
} }
void Members::peerListSetTitle(Fn<QString()> title) { void Members::peerListSetTitle(rpl::producer<QString> title) {
} }
void Members::peerListSetAdditionalTitle( void Members::peerListSetAdditionalTitle(

View File

@ -59,7 +59,7 @@ private:
using ListWidget = PeerListContent; using ListWidget = PeerListContent;
// PeerListContentDelegate interface. // PeerListContentDelegate interface.
void peerListSetTitle(Fn<QString()> title) override; void peerListSetTitle(rpl::producer<QString> title) override;
void peerListSetAdditionalTitle( void peerListSetAdditionalTitle(
Fn<QString()> title) override; Fn<QString()> title) override;
bool peerListIsRowSelected(not_null<PeerData*> peer) override; bool peerListIsRowSelected(not_null<PeerData*> peer) override;

View File

@ -71,7 +71,7 @@ ConfirmSwitchBox::ConfirmSwitchBox(
} }
void ConfirmSwitchBox::prepare() { void ConfirmSwitchBox::prepare() {
setTitle(langFactory(lng_language_switch_title)); setTitle(tr::lng_language_switch_title());
const auto text = (_official const auto text = (_official
? lng_language_switch_about_official__rich ? lng_language_switch_about_official__rich
@ -113,7 +113,7 @@ NotReadyBox::NotReadyBox(
} }
void NotReadyBox::prepare() { void NotReadyBox::prepare() {
setTitle(langFactory(lng_language_not_ready_title)); setTitle(tr::lng_language_not_ready_title());
const auto text = lng_language_not_ready_about__rich( const auto text = lng_language_not_ready_about__rich(
lt_lang_name, lt_lang_name,

View File

@ -31,7 +31,7 @@ class VerifyBox : public BoxContent {
public: public:
VerifyBox( VerifyBox(
QWidget*, QWidget*,
const QString &title, rpl::producer<QString> title,
const QString &text, const QString &text,
int codeLength, int codeLength,
Fn<void(QString code)> submit, Fn<void(QString code)> submit,
@ -55,7 +55,7 @@ private:
rpl::producer<QString> error, rpl::producer<QString> error,
rpl::producer<QString> resent); rpl::producer<QString> resent);
QString _title; rpl::producer<QString> _title;
Fn<void()> _submit; Fn<void()> _submit;
QPointer<SentCodeField> _code; QPointer<SentCodeField> _code;
QPointer<Ui::VerticalLayout> _content; QPointer<Ui::VerticalLayout> _content;
@ -64,7 +64,7 @@ private:
VerifyBox::VerifyBox( VerifyBox::VerifyBox(
QWidget*, QWidget*,
const QString &title, rpl::producer<QString> title,
const QString &text, const QString &text,
int codeLength, int codeLength,
Fn<void(QString code)> submit, Fn<void(QString code)> submit,
@ -72,7 +72,7 @@ VerifyBox::VerifyBox(
rpl::producer<QString> call, rpl::producer<QString> call,
rpl::producer<QString> error, rpl::producer<QString> error,
rpl::producer<QString> resent) rpl::producer<QString> resent)
: _title(title) { : _title(std::move(title)) {
setupControls( setupControls(
text, text,
codeLength, codeLength,
@ -185,7 +185,7 @@ void VerifyBox::setInnerFocus() {
} }
void VerifyBox::prepare() { void VerifyBox::prepare() {
setTitle([=] { return _title; }); setTitle(std::move(_title));
addButton(langFactory(lng_change_phone_new_submit), _submit); addButton(langFactory(lng_change_phone_new_submit), _submit);
addButton(langFactory(lng_cancel), [=] { closeBox(); }); addButton(langFactory(lng_cancel), [=] { closeBox(); });
@ -391,7 +391,7 @@ object_ptr<BoxContent> VerifyPhoneBox(
rpl::producer<QString> call, rpl::producer<QString> call,
rpl::producer<QString> error) { rpl::producer<QString> error) {
return Box<VerifyBox>( return Box<VerifyBox>(
lang(lng_passport_phone_title), tr::lng_passport_phone_title(),
lng_passport_confirm_phone(lt_phone, App::formatPhone(phone)), lng_passport_confirm_phone(lt_phone, App::formatPhone(phone)),
codeLength, codeLength,
submit, submit,
@ -409,7 +409,7 @@ object_ptr<BoxContent> VerifyEmailBox(
rpl::producer<QString> error, rpl::producer<QString> error,
rpl::producer<QString> resent) { rpl::producer<QString> resent) {
return Box<VerifyBox>( return Box<VerifyBox>(
lang(lng_passport_email_title), tr::lng_passport_email_title(),
lng_passport_confirm_email(lt_email, email), lng_passport_confirm_email(lt_email, email),
codeLength, codeLength,
submit, submit,

View File

@ -35,7 +35,7 @@ class RequestTypeBox : public BoxContent {
public: public:
RequestTypeBox( RequestTypeBox(
QWidget*, QWidget*,
const QString &title, rpl::producer<QString> title,
const QString &about, const QString &about,
std::vector<QString> labels, std::vector<QString> labels,
Fn<void(int index)> submit); Fn<void(int index)> submit);
@ -49,7 +49,7 @@ private:
std::vector<QString> labels, std::vector<QString> labels,
Fn<void(int index)> submit); Fn<void(int index)> submit);
QString _title; rpl::producer<QString> _title;
Fn<void()> _submit; Fn<void()> _submit;
int _height = 0; int _height = 0;
@ -79,16 +79,16 @@ private:
RequestTypeBox::RequestTypeBox( RequestTypeBox::RequestTypeBox(
QWidget*, QWidget*,
const QString &title, rpl::producer<QString> title,
const QString &about, const QString &about,
std::vector<QString> labels, std::vector<QString> labels,
Fn<void(int index)> submit) Fn<void(int index)> submit)
: _title(title) { : _title(std::move(title)) {
setupControls(about, std::move(labels), submit); setupControls(about, std::move(labels), submit);
} }
void RequestTypeBox::prepare() { void RequestTypeBox::prepare() {
setTitle([=] { return _title; }); setTitle(std::move(_title));
addButton(langFactory(lng_passport_upload_document), _submit); addButton(langFactory(lng_passport_upload_document), _submit);
addButton(langFactory(lng_cancel), [=] { closeBox(); }); addButton(langFactory(lng_cancel), [=] { closeBox(); });
setDimensions(st::boxWidth, _height); setDimensions(st::boxWidth, _height);
@ -680,7 +680,7 @@ object_ptr<BoxContent> RequestIdentityType(
Fn<void(int index)> submit, Fn<void(int index)> submit,
std::vector<QString> labels) { std::vector<QString> labels) {
return Box<RequestTypeBox>( return Box<RequestTypeBox>(
lang(lng_passport_identity_title), tr::lng_passport_identity_title(),
lang(lng_passport_identity_about), lang(lng_passport_identity_about),
std::move(labels), std::move(labels),
submit); submit);
@ -690,7 +690,7 @@ object_ptr<BoxContent> RequestAddressType(
Fn<void(int index)> submit, Fn<void(int index)> submit,
std::vector<QString> labels) { std::vector<QString> labels) {
return Box<RequestTypeBox>( return Box<RequestTypeBox>(
lang(lng_passport_address_title), tr::lng_passport_address_title(),
lang(lng_passport_address_about), lang(lng_passport_address_about),
std::move(labels), std::move(labels),
submit); submit);

View File

@ -106,6 +106,10 @@ public:
return _implementation ? _implementation(consumer) : lifetime(); return _implementation ? _implementation(consumer) : lifetime();
} }
bool empty() const {
return !_implementation;
}
private: private:
std::function<lifetime(const consumer_type<type_erased_handlers<Value, Error>> &)> _implementation; std::function<lifetime(const consumer_type<type_erased_handlers<Value, Error>> &)> _implementation;
@ -439,7 +443,7 @@ public:
} }
explicit operator bool() const { explicit operator bool() const {
return (this->_generator != nullptr); return !this->_generator.empty();
} }
}; };

View File

@ -131,7 +131,7 @@ void Calls::setupContent() {
} }
}); });
Ui::show(Box<SingleChoiceBox>( Ui::show(Box<SingleChoiceBox>(
lng_settings_call_output_device, tr::lng_settings_call_output_device(),
options, options,
currentOption, currentOption,
save)); save));
@ -209,7 +209,7 @@ void Calls::setupContent() {
} }
}); });
Ui::show(Box<SingleChoiceBox>( Ui::show(Box<SingleChoiceBox>(
lng_settings_call_input_device, tr::lng_settings_call_input_device(),
options, options,
currentOption, currentOption,
save)); save));

View File

@ -66,7 +66,7 @@ private:
}; };
void BlockUserBoxController::prepareViewHook() { void BlockUserBoxController::prepareViewHook() {
delegate()->peerListSetTitle(langFactory(lng_blocked_list_add_title)); delegate()->peerListSetTitle(tr::lng_blocked_list_add_title());
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(Notify::PeerUpdate::Flag::UserIsBlocked, [this](const Notify::PeerUpdate &update) { subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(Notify::PeerUpdate::Flag::UserIsBlocked, [this](const Notify::PeerUpdate &update) {
if (auto user = update.peer->asUser()) { if (auto user = update.peer->asUser()) {
if (auto row = delegate()->peerListFindRow(user->id)) { if (auto row = delegate()->peerListFindRow(user->id)) {
@ -154,7 +154,7 @@ AdminLog::OwnedItem GenerateForwardedItem(
} // namespace } // namespace
void BlockedBoxController::prepare() { void BlockedBoxController::prepare() {
delegate()->peerListSetTitle(langFactory(lng_blocked_list_title)); delegate()->peerListSetTitle(tr::lng_blocked_list_title());
setDescriptionText(lang(lng_contacts_loading)); setDescriptionText(lang(lng_contacts_loading));
delegate()->peerListRefreshRows(); delegate()->peerListRefreshRows();
@ -311,8 +311,8 @@ MTPInputPrivacyKey PhoneNumberPrivacyController::apiKey() {
return MTP_inputPrivacyKeyPhoneNumber(); return MTP_inputPrivacyKeyPhoneNumber();
} }
QString PhoneNumberPrivacyController::title() { rpl::producer<QString> PhoneNumberPrivacyController::title() {
return lang(lng_edit_privacy_phone_number_title); return tr::lng_edit_privacy_phone_number_title();
} }
rpl::producer<QString> PhoneNumberPrivacyController::optionsTitleKey() { rpl::producer<QString> PhoneNumberPrivacyController::optionsTitleKey() {
@ -334,10 +334,11 @@ rpl::producer<QString> PhoneNumberPrivacyController::exceptionButtonTextKey(
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
QString PhoneNumberPrivacyController::exceptionBoxTitle(Exception exception) { rpl::producer<QString> PhoneNumberPrivacyController::exceptionBoxTitle(
Exception exception) {
switch (exception) { switch (exception) {
case Exception::Always: return lang(lng_edit_privacy_phone_number_always_title); case Exception::Always: return tr::lng_edit_privacy_phone_number_always_title();
case Exception::Never: return lang(lng_edit_privacy_phone_number_never_title); case Exception::Never: return tr::lng_edit_privacy_phone_number_never_title();
} }
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
@ -354,8 +355,8 @@ MTPInputPrivacyKey LastSeenPrivacyController::apiKey() {
return MTP_inputPrivacyKeyStatusTimestamp(); return MTP_inputPrivacyKeyStatusTimestamp();
} }
QString LastSeenPrivacyController::title() { rpl::producer<QString> LastSeenPrivacyController::title() {
return lang(lng_edit_privacy_lastseen_title); return tr::lng_edit_privacy_lastseen_title();
} }
rpl::producer<QString> LastSeenPrivacyController::optionsTitleKey() { rpl::producer<QString> LastSeenPrivacyController::optionsTitleKey() {
@ -377,10 +378,11 @@ rpl::producer<QString> LastSeenPrivacyController::exceptionButtonTextKey(
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
QString LastSeenPrivacyController::exceptionBoxTitle(Exception exception) { rpl::producer<QString> LastSeenPrivacyController::exceptionBoxTitle(
Exception exception) {
switch (exception) { switch (exception) {
case Exception::Always: return lang(lng_edit_privacy_lastseen_always_title); case Exception::Always: return tr::lng_edit_privacy_lastseen_always_title();
case Exception::Never: return lang(lng_edit_privacy_lastseen_never_title); case Exception::Never: return tr::lng_edit_privacy_lastseen_never_title();
} }
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
@ -419,8 +421,8 @@ MTPInputPrivacyKey GroupsInvitePrivacyController::apiKey() {
return MTP_inputPrivacyKeyChatInvite(); return MTP_inputPrivacyKeyChatInvite();
} }
QString GroupsInvitePrivacyController::title() { rpl::producer<QString> GroupsInvitePrivacyController::title() {
return lang(lng_edit_privacy_groups_title); return tr::lng_edit_privacy_groups_title();
} }
bool GroupsInvitePrivacyController::hasOption(Option option) { bool GroupsInvitePrivacyController::hasOption(Option option) {
@ -440,10 +442,11 @@ rpl::producer<QString> GroupsInvitePrivacyController::exceptionButtonTextKey(
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
QString GroupsInvitePrivacyController::exceptionBoxTitle(Exception exception) { rpl::producer<QString> GroupsInvitePrivacyController::exceptionBoxTitle(
Exception exception) {
switch (exception) { switch (exception) {
case Exception::Always: return lang(lng_edit_privacy_groups_always_title); case Exception::Always: return tr::lng_edit_privacy_groups_always_title();
case Exception::Never: return lang(lng_edit_privacy_groups_never_title); case Exception::Never: return tr::lng_edit_privacy_groups_never_title();
} }
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
@ -461,8 +464,8 @@ MTPInputPrivacyKey CallsPrivacyController::apiKey() {
return MTP_inputPrivacyKeyPhoneCall(); return MTP_inputPrivacyKeyPhoneCall();
} }
QString CallsPrivacyController::title() { rpl::producer<QString> CallsPrivacyController::title() {
return lang(lng_edit_privacy_calls_title); return tr::lng_edit_privacy_calls_title();
} }
rpl::producer<QString> CallsPrivacyController::optionsTitleKey() { rpl::producer<QString> CallsPrivacyController::optionsTitleKey() {
@ -478,10 +481,11 @@ rpl::producer<QString> CallsPrivacyController::exceptionButtonTextKey(
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
QString CallsPrivacyController::exceptionBoxTitle(Exception exception) { rpl::producer<QString> CallsPrivacyController::exceptionBoxTitle(
Exception exception) {
switch (exception) { switch (exception) {
case Exception::Always: return lang(lng_edit_privacy_calls_always_title); case Exception::Always: return tr::lng_edit_privacy_calls_always_title();
case Exception::Never: return lang(lng_edit_privacy_calls_never_title); case Exception::Never: return tr::lng_edit_privacy_calls_never_title();
} }
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
@ -516,8 +520,8 @@ MTPInputPrivacyKey CallsPeer2PeerPrivacyController::apiKey() {
return MTP_inputPrivacyKeyPhoneP2P(); return MTP_inputPrivacyKeyPhoneP2P();
} }
QString CallsPeer2PeerPrivacyController::title() { rpl::producer<QString> CallsPeer2PeerPrivacyController::title() {
return lang(lng_edit_privacy_calls_p2p_title); return tr::lng_edit_privacy_calls_p2p_title();
} }
rpl::producer<QString> CallsPeer2PeerPrivacyController::optionsTitleKey() { rpl::producer<QString> CallsPeer2PeerPrivacyController::optionsTitleKey() {
@ -547,10 +551,11 @@ rpl::producer<QString> CallsPeer2PeerPrivacyController::exceptionButtonTextKey(
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
QString CallsPeer2PeerPrivacyController::exceptionBoxTitle(Exception exception) { rpl::producer<QString> CallsPeer2PeerPrivacyController::exceptionBoxTitle(
Exception exception) {
switch (exception) { switch (exception) {
case Exception::Always: return lang(lng_edit_privacy_calls_p2p_always_title); case Exception::Always: return tr::lng_edit_privacy_calls_p2p_always_title();
case Exception::Never: return lang(lng_edit_privacy_calls_p2p_never_title); case Exception::Never: return tr::lng_edit_privacy_calls_p2p_never_title();
} }
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
@ -567,8 +572,8 @@ MTPInputPrivacyKey ForwardsPrivacyController::apiKey() {
return MTP_inputPrivacyKeyForwards(); return MTP_inputPrivacyKeyForwards();
} }
QString ForwardsPrivacyController::title() { rpl::producer<QString> ForwardsPrivacyController::title() {
return lang(lng_edit_privacy_forwards_title); return tr::lng_edit_privacy_forwards_title();
} }
rpl::producer<QString> ForwardsPrivacyController::optionsTitleKey() { rpl::producer<QString> ForwardsPrivacyController::optionsTitleKey() {
@ -588,10 +593,11 @@ rpl::producer<QString> ForwardsPrivacyController::exceptionButtonTextKey(
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
QString ForwardsPrivacyController::exceptionBoxTitle(Exception exception) { rpl::producer<QString> ForwardsPrivacyController::exceptionBoxTitle(
Exception exception) {
switch (exception) { switch (exception) {
case Exception::Always: return lang(lng_edit_privacy_forwards_always_title); case Exception::Always: return tr::lng_edit_privacy_forwards_always_title();
case Exception::Never: return lang(lng_edit_privacy_forwards_never_title); case Exception::Never: return tr::lng_edit_privacy_forwards_never_title();
} }
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
@ -759,8 +765,8 @@ MTPInputPrivacyKey ProfilePhotoPrivacyController::apiKey() {
return MTP_inputPrivacyKeyProfilePhoto(); return MTP_inputPrivacyKeyProfilePhoto();
} }
QString ProfilePhotoPrivacyController::title() { rpl::producer<QString> ProfilePhotoPrivacyController::title() {
return lang(lng_edit_privacy_profile_photo_title); return tr::lng_edit_privacy_profile_photo_title();
} }
bool ProfilePhotoPrivacyController::hasOption(Option option) { bool ProfilePhotoPrivacyController::hasOption(Option option) {
@ -780,10 +786,11 @@ rpl::producer<QString> ProfilePhotoPrivacyController::exceptionButtonTextKey(
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }
QString ProfilePhotoPrivacyController::exceptionBoxTitle(Exception exception) { rpl::producer<QString> ProfilePhotoPrivacyController::exceptionBoxTitle(
Exception exception) {
switch (exception) { switch (exception) {
case Exception::Always: return lang(lng_edit_privacy_profile_photo_always_title); case Exception::Always: return tr::lng_edit_privacy_profile_photo_always_title();
case Exception::Never: return lang(lng_edit_privacy_profile_photo_never_title); case Exception::Never: return tr::lng_edit_privacy_profile_photo_never_title();
} }
Unexpected("Invalid exception value."); Unexpected("Invalid exception value.");
} }

View File

@ -45,12 +45,12 @@ public:
Key key() override; Key key() override;
MTPInputPrivacyKey apiKey() override; MTPInputPrivacyKey apiKey() override;
QString title() override; rpl::producer<QString> title() override;
rpl::producer<QString> optionsTitleKey() override; rpl::producer<QString> optionsTitleKey() override;
rpl::producer<QString> warning() override; rpl::producer<QString> warning() override;
rpl::producer<QString> exceptionButtonTextKey( rpl::producer<QString> exceptionButtonTextKey(
Exception exception) override; Exception exception) override;
QString exceptionBoxTitle(Exception exception) override; rpl::producer<QString> exceptionBoxTitle(Exception exception) override;
rpl::producer<QString> exceptionsDescription() override; rpl::producer<QString> exceptionsDescription() override;
}; };
@ -63,12 +63,12 @@ public:
Key key() override; Key key() override;
MTPInputPrivacyKey apiKey() override; MTPInputPrivacyKey apiKey() override;
QString title() override; rpl::producer<QString> title() override;
rpl::producer<QString> optionsTitleKey() override; rpl::producer<QString> optionsTitleKey() override;
rpl::producer<QString> warning() override; rpl::producer<QString> warning() override;
rpl::producer<QString> exceptionButtonTextKey( rpl::producer<QString> exceptionButtonTextKey(
Exception exception) override; Exception exception) override;
QString exceptionBoxTitle(Exception exception) override; rpl::producer<QString> exceptionBoxTitle(Exception exception) override;
rpl::producer<QString> exceptionsDescription() override; rpl::producer<QString> exceptionsDescription() override;
void confirmSave( void confirmSave(
@ -85,12 +85,12 @@ public:
Key key() override; Key key() override;
MTPInputPrivacyKey apiKey() override; MTPInputPrivacyKey apiKey() override;
QString title() override; rpl::producer<QString> title() override;
bool hasOption(Option option) override; bool hasOption(Option option) override;
rpl::producer<QString> optionsTitleKey() override; rpl::producer<QString> optionsTitleKey() override;
rpl::producer<QString> exceptionButtonTextKey( rpl::producer<QString> exceptionButtonTextKey(
Exception exception) override; Exception exception) override;
QString exceptionBoxTitle(Exception exception) override; rpl::producer<QString> exceptionBoxTitle(Exception exception) override;
rpl::producer<QString> exceptionsDescription() override; rpl::producer<QString> exceptionsDescription() override;
}; };
@ -103,11 +103,11 @@ public:
Key key() override; Key key() override;
MTPInputPrivacyKey apiKey() override; MTPInputPrivacyKey apiKey() override;
QString title() override; rpl::producer<QString> title() override;
rpl::producer<QString> optionsTitleKey() override; rpl::producer<QString> optionsTitleKey() override;
rpl::producer<QString> exceptionButtonTextKey( rpl::producer<QString> exceptionButtonTextKey(
Exception exception) override; Exception exception) override;
QString exceptionBoxTitle(Exception exception) override; rpl::producer<QString> exceptionBoxTitle(Exception exception) override;
rpl::producer<QString> exceptionsDescription() override; rpl::producer<QString> exceptionsDescription() override;
object_ptr<Ui::RpWidget> setupBelowWidget( object_ptr<Ui::RpWidget> setupBelowWidget(
@ -123,13 +123,13 @@ public:
Key key() override; Key key() override;
MTPInputPrivacyKey apiKey() override; MTPInputPrivacyKey apiKey() override;
QString title() override; rpl::producer<QString> title() override;
rpl::producer<QString> optionsTitleKey() override; rpl::producer<QString> optionsTitleKey() override;
LangKey optionLabelKey(EditPrivacyBox::Option option) override; LangKey optionLabelKey(EditPrivacyBox::Option option) override;
rpl::producer<QString> warning() override; rpl::producer<QString> warning() override;
rpl::producer<QString> exceptionButtonTextKey( rpl::producer<QString> exceptionButtonTextKey(
Exception exception) override; Exception exception) override;
QString exceptionBoxTitle(Exception exception) override; rpl::producer<QString> exceptionBoxTitle(Exception exception) override;
rpl::producer<QString> exceptionsDescription() override; rpl::producer<QString> exceptionsDescription() override;
}; };
@ -144,12 +144,12 @@ public:
Key key() override; Key key() override;
MTPInputPrivacyKey apiKey() override; MTPInputPrivacyKey apiKey() override;
QString title() override; rpl::producer<QString> title() override;
rpl::producer<QString> optionsTitleKey() override; rpl::producer<QString> optionsTitleKey() override;
rpl::producer<QString> warning() override; rpl::producer<QString> warning() override;
rpl::producer<QString> exceptionButtonTextKey( rpl::producer<QString> exceptionButtonTextKey(
Exception exception) override; Exception exception) override;
QString exceptionBoxTitle(Exception exception) override; rpl::producer<QString> exceptionBoxTitle(Exception exception) override;
rpl::producer<QString> exceptionsDescription() override; rpl::producer<QString> exceptionsDescription() override;
object_ptr<Ui::RpWidget> setupAboveWidget( object_ptr<Ui::RpWidget> setupAboveWidget(
@ -176,12 +176,12 @@ public:
Key key() override; Key key() override;
MTPInputPrivacyKey apiKey() override; MTPInputPrivacyKey apiKey() override;
QString title() override; rpl::producer<QString> title() override;
bool hasOption(Option option) override; bool hasOption(Option option) override;
rpl::producer<QString> optionsTitleKey() override; rpl::producer<QString> optionsTitleKey() override;
rpl::producer<QString> exceptionButtonTextKey( rpl::producer<QString> exceptionButtonTextKey(
Exception exception) override; Exception exception) override;
QString exceptionBoxTitle(Exception exception) override; rpl::producer<QString> exceptionBoxTitle(Exception exception) override;
rpl::producer<QString> exceptionsDescription() override; rpl::producer<QString> exceptionsDescription() override;
}; };

View File

@ -507,7 +507,7 @@ ConfirmContactBox::ConfirmContactBox(
} }
void ConfirmContactBox::prepare() { void ConfirmContactBox::prepare() {
setTitle([] { return "Confirmation"; }); setTitle(rpl::single(qsl("Confirmation"))); // #TODO hard_lang
auto maxWidth = 0; auto maxWidth = 0;
if (_comment) { if (_comment) {

View File

@ -73,7 +73,7 @@ EditInfoBox::EditInfoBox(
} }
void EditInfoBox::prepare() { void EditInfoBox::prepare() {
setTitle([] { return QString("Edit support information"); }); // #TODO hard_lang setTitle(rpl::single(qsl("Edit support information"))); // #TODO hard_lang
const auto save = [=] { const auto save = [=] {
const auto done = crl::guard(this, [=](bool success) { const auto done = crl::guard(this, [=](bool success) {

View File

@ -230,7 +230,7 @@ QString CountrySelectBox::ISOByPhone(const QString &phone) {
} }
void CountrySelectBox::prepare() { void CountrySelectBox::prepare() {
setTitle(langFactory(lng_country_select)); setTitle(tr::lng_country_select());
_select->resizeToWidth(st::boxWidth); _select->resizeToWidth(st::boxWidth);
_select->setQueryChangedCallback([=](const QString &query) { _select->setQueryChangedCallback([=](const QString &query) {

View File

@ -568,7 +568,7 @@ ThemeExportBox::ThemeExportBox(QWidget*, const QByteArray &paletteContent, const
} }
void ThemeExportBox::prepare() { void ThemeExportBox::prepare() {
setTitle(langFactory(lng_theme_editor_background_image)); setTitle(tr::lng_theme_editor_background_image());
addButton(langFactory(lng_theme_editor_export), [this] { exportTheme(); }); addButton(langFactory(lng_theme_editor_export), [this] { exportTheme(); });
addButton(langFactory(lng_cancel), [this] { closeBox(); }); addButton(langFactory(lng_cancel), [this] { closeBox(); });

View File

@ -215,7 +215,7 @@ rpl::producer<> TermsBox::cancelClicks() const {
} }
void TermsBox::prepare() { void TermsBox::prepare() {
setTitle(langFactory(lng_terms_header)); setTitle(tr::lng_terms_header());
auto check = std::make_unique<Ui::CheckView>(st::defaultCheck, false); auto check = std::make_unique<Ui::CheckView>(st::defaultCheck, false);
const auto ageCheck = check.get(); const auto ageCheck = check.get();

View File

@ -742,9 +742,9 @@ void PeerMenuBlockUserBox(
box->addSkip(st::boxLittleSkip); box->addSkip(st::boxLittleSkip);
box->setTitle([=] { box->setTitle(tr::lng_blocked_list_confirm_title(
return lng_blocked_list_confirm_title(lt_name, name); lt_name,
}); rpl::single(name)));
box->addButton(langFactory(lng_blocked_list_confirm_ok), [=] { box->addButton(langFactory(lng_blocked_list_confirm_ok), [=] {
const auto reportChecked = report && report->checked(); const auto reportChecked = report && report->checked();

@ -1 +1 @@
Subproject commit eeeb4edb2a087c3f8175dafafcad330864d3efc0 Subproject commit a3fac9db920b167a5f91d678ee7968f100f6fe51