mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 17:51:41 -05:00
Use tr:: instead of langFactory and __rich.
This commit is contained in:
parent
d1d98c3bb1
commit
a7c8feaecb
103 changed files with 699 additions and 628 deletions
|
@ -866,8 +866,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_manage_linked_channel_about" = "{channel} is linking the group as its discussion board.";
|
||||
"lng_manage_linked_channel_unlink" = "Unlink channel";
|
||||
"lng_manage_linked_channel_posted" = "All new messages posted in this channel are forwarded to the group.";
|
||||
"lng_manage_discussion_group_warning" = "\"Chat history for new members\" will be switched to {visible}.";
|
||||
"lng_manage_discussion_group_visible" = "Visible";
|
||||
"lng_manage_discussion_group_warning" = "\"Chat history for new members\" will be switched to **Visible**.";
|
||||
|
||||
"lng_manage_history_visibility_title" = "Chat history for new members";
|
||||
"lng_manage_history_visibility_shown" = "Visible";
|
||||
|
|
|
@ -23,29 +23,31 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace {
|
||||
|
||||
rpl::producer<TextWithEntities> Text1() {
|
||||
return rpl::single(lng_about_text1__rich(
|
||||
return tr::lng_about_text1(
|
||||
lt_api_link,
|
||||
Ui::Text::Link(
|
||||
lang(lng_about_text1_api),
|
||||
"https://core.telegram.org/api")));
|
||||
tr::lng_about_text1_api(
|
||||
) | Ui::Text::ToLink("https://core.telegram.org/api"),
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
|
||||
rpl::producer<TextWithEntities> Text2() {
|
||||
return rpl::single(lng_about_text2__rich(
|
||||
return tr::lng_about_text2(
|
||||
lt_gpl_link,
|
||||
Ui::Text::Link(
|
||||
lang(lng_about_text2_gpl),
|
||||
tr::lng_about_text2_gpl(
|
||||
) | Ui::Text::ToLink(
|
||||
"https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE"),
|
||||
lt_github_link,
|
||||
Ui::Text::Link(
|
||||
lang(lng_about_text2_github),
|
||||
"https://github.com/telegramdesktop/tdesktop")));
|
||||
tr::lng_about_text2_github(
|
||||
) | Ui::Text::ToLink(
|
||||
"https://github.com/telegramdesktop/tdesktop"),
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
|
||||
rpl::producer<TextWithEntities> Text3() {
|
||||
return rpl::single(lng_about_text3__rich(
|
||||
return tr::lng_about_text3(
|
||||
lt_faq_link,
|
||||
Ui::Text::Link(lang(lng_about_text3_faq), telegramFaqLink())));
|
||||
tr::lng_about_text3_faq() | Ui::Text::ToLink(telegramFaqLink()),
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -60,7 +62,7 @@ AboutBox::AboutBox(QWidget *parent)
|
|||
void AboutBox::prepare() {
|
||||
setTitle(rpl::single(qsl("Telegram Desktop")));
|
||||
|
||||
addButton(langFactory(lng_close), [this] { closeBox(); });
|
||||
addButton(tr::lng_close(), [this] { closeBox(); });
|
||||
|
||||
_text1->setLinksTrusted();
|
||||
_text2->setLinksTrusted();
|
||||
|
|
|
@ -25,19 +25,19 @@ void BoxContent::setTitle(rpl::producer<QString> title) {
|
|||
}
|
||||
|
||||
QPointer<Ui::RoundButton> BoxContent::addButton(
|
||||
Fn<QString()> textFactory,
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback) {
|
||||
return addButton(
|
||||
std::move(textFactory),
|
||||
std::move(text),
|
||||
std::move(clickCallback),
|
||||
st::defaultBoxButton);
|
||||
}
|
||||
|
||||
QPointer<Ui::RoundButton> BoxContent::addLeftButton(
|
||||
Fn<QString()> textFactory,
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback) {
|
||||
return getDelegate()->addLeftButton(
|
||||
std::move(textFactory),
|
||||
std::move(text),
|
||||
std::move(clickCallback),
|
||||
st::defaultBoxButton);
|
||||
}
|
||||
|
@ -252,13 +252,21 @@ void BoxContent::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
}
|
||||
|
||||
AbstractBox::AbstractBox(not_null<Window::LayerStackWidget*> layer, object_ptr<BoxContent> content)
|
||||
AbstractBox::AbstractBox(
|
||||
not_null<Window::LayerStackWidget*> layer,
|
||||
object_ptr<BoxContent> content)
|
||||
: LayerWidget(layer)
|
||||
, _layer(layer)
|
||||
, _content(std::move(content)) {
|
||||
subscribe(Lang::Current().updated(), [this] { refreshLang(); });
|
||||
subscribe(Lang::Current().updated(), [=] { refreshLang(); });
|
||||
_content->setParent(this);
|
||||
_content->setDelegate(this);
|
||||
|
||||
_additionalTitle.changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateSize();
|
||||
update();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void AbstractBox::setLayerType(bool layerType) {
|
||||
|
@ -297,7 +305,8 @@ void AbstractBox::paintEvent(QPaintEvent *e) {
|
|||
p.fillRect(rect, st::boxBg);
|
||||
}
|
||||
}
|
||||
if (!_additionalTitle.isEmpty() && clip.intersects(QRect(0, 0, width(), titleHeight()))) {
|
||||
if (!_additionalTitle.current().isEmpty()
|
||||
&& clip.intersects(QRect(0, 0, width(), titleHeight()))) {
|
||||
paintAdditionalTitle(p);
|
||||
}
|
||||
}
|
||||
|
@ -305,7 +314,7 @@ void AbstractBox::paintEvent(QPaintEvent *e) {
|
|||
void AbstractBox::paintAdditionalTitle(Painter &p) {
|
||||
p.setFont(st::boxLayerTitleAdditionalFont);
|
||||
p.setPen(st::boxTitleAdditionalFg);
|
||||
p.drawTextLeft(_titleLeft + (_title ? _title->width() : 0) + st::boxLayerTitleAdditionalSkip, _titleTop + st::boxTitleFont->ascent - st::boxLayerTitleAdditionalFont->ascent, width(), _additionalTitle);
|
||||
p.drawTextLeft(_titleLeft + (_title ? _title->width() : 0) + st::boxLayerTitleAdditionalSkip, _titleTop + st::boxTitleFont->ascent - st::boxLayerTitleAdditionalFont->ascent, width(), _additionalTitle.current());
|
||||
}
|
||||
|
||||
void AbstractBox::parentResized() {
|
||||
|
@ -328,9 +337,8 @@ void AbstractBox::setTitle(rpl::producer<TextWithEntities> title) {
|
|||
}
|
||||
}
|
||||
|
||||
void AbstractBox::setAdditionalTitle(Fn<QString()> additionalFactory) {
|
||||
_additionalTitleFactory = std::move(additionalFactory);
|
||||
refreshAdditionalTitle();
|
||||
void AbstractBox::setAdditionalTitle(rpl::producer<QString> additional) {
|
||||
_additionalTitle = std::move(additional);
|
||||
}
|
||||
|
||||
void AbstractBox::setCloseByOutsideClick(bool close) {
|
||||
|
@ -341,18 +349,12 @@ bool AbstractBox::closeByOutsideClick() const {
|
|||
return _closeByOutsideClick;
|
||||
}
|
||||
|
||||
void AbstractBox::refreshAdditionalTitle() {
|
||||
_additionalTitle = _additionalTitleFactory ? _additionalTitleFactory() : QString();
|
||||
update();
|
||||
}
|
||||
|
||||
void AbstractBox::refreshLang() {
|
||||
refreshAdditionalTitle();
|
||||
InvokeQueued(this, [this] { updateButtonsPositions(); });
|
||||
}
|
||||
|
||||
bool AbstractBox::hasTitle() const {
|
||||
return (_title != nullptr) || !_additionalTitle.isEmpty();
|
||||
return (_title != nullptr) || !_additionalTitle.current().isEmpty();
|
||||
}
|
||||
|
||||
void AbstractBox::showBox(
|
||||
|
@ -405,8 +407,11 @@ void AbstractBox::clearButtons() {
|
|||
_topButton = nullptr;
|
||||
}
|
||||
|
||||
QPointer<Ui::RoundButton> AbstractBox::addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) {
|
||||
_buttons.push_back(object_ptr<Ui::RoundButton>(this, std::move(textFactory), st));
|
||||
QPointer<Ui::RoundButton> AbstractBox::addButton(
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) {
|
||||
_buttons.emplace_back(this, std::move(text), st);
|
||||
auto result = QPointer<Ui::RoundButton>(_buttons.back());
|
||||
result->setClickedCallback(std::move(clickCallback));
|
||||
result->show();
|
||||
|
@ -414,8 +419,11 @@ QPointer<Ui::RoundButton> AbstractBox::addButton(Fn<QString()> textFactory, Fn<v
|
|||
return result;
|
||||
}
|
||||
|
||||
QPointer<Ui::RoundButton> AbstractBox::addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) {
|
||||
_leftButton = object_ptr<Ui::RoundButton>(this, std::move(textFactory), st);
|
||||
QPointer<Ui::RoundButton> AbstractBox::addLeftButton(
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) {
|
||||
_leftButton = object_ptr<Ui::RoundButton>(this, std::move(text), st);
|
||||
auto result = QPointer<Ui::RoundButton>(_leftButton);
|
||||
result->setClickedCallback(std::move(clickCallback));
|
||||
result->show();
|
||||
|
|
|
@ -31,13 +31,21 @@ class BoxContentDelegate {
|
|||
public:
|
||||
virtual void setLayerType(bool layerType) = 0;
|
||||
virtual void setTitle(rpl::producer<TextWithEntities> title) = 0;
|
||||
virtual void setAdditionalTitle(Fn<QString()> additionalFactory) = 0;
|
||||
virtual void setAdditionalTitle(rpl::producer<QString> additional) = 0;
|
||||
virtual void setCloseByOutsideClick(bool close) = 0;
|
||||
|
||||
virtual void clearButtons() = 0;
|
||||
virtual QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) = 0;
|
||||
virtual QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) = 0;
|
||||
virtual QPointer<Ui::IconButton> addTopButton(const style::IconButton &st, Fn<void()> clickCallback) = 0;
|
||||
virtual QPointer<Ui::RoundButton> addButton(
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) = 0;
|
||||
virtual QPointer<Ui::RoundButton> addLeftButton(
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) = 0;
|
||||
virtual QPointer<Ui::IconButton> addTopButton(
|
||||
const style::IconButton &st,
|
||||
Fn<void()> clickCallback) = 0;
|
||||
virtual void updateButtonsPositions() = 0;
|
||||
|
||||
virtual void showBox(
|
||||
|
@ -85,7 +93,7 @@ public:
|
|||
void setTitle(rpl::producer<TextWithEntities> title) {
|
||||
getDelegate()->setTitle(std::move(title));
|
||||
}
|
||||
void setAdditionalTitle(Fn<QString()> additional) {
|
||||
void setAdditionalTitle(rpl::producer<QString> additional) {
|
||||
getDelegate()->setAdditionalTitle(std::move(additional));
|
||||
}
|
||||
void setCloseByEscape(bool close) {
|
||||
|
@ -100,16 +108,30 @@ public:
|
|||
void clearButtons() {
|
||||
getDelegate()->clearButtons();
|
||||
}
|
||||
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback = nullptr);
|
||||
QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback = nullptr);
|
||||
QPointer<Ui::IconButton> addTopButton(const style::IconButton &st, Fn<void()> clickCallback = nullptr) {
|
||||
QPointer<Ui::RoundButton> addButton(
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback = nullptr);
|
||||
QPointer<Ui::RoundButton> addLeftButton(
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback = nullptr);
|
||||
QPointer<Ui::IconButton> addTopButton(
|
||||
const style::IconButton &st,
|
||||
Fn<void()> clickCallback = nullptr) {
|
||||
return getDelegate()->addTopButton(st, std::move(clickCallback));
|
||||
}
|
||||
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, const style::RoundButton &st) {
|
||||
return getDelegate()->addButton(std::move(textFactory), nullptr, st);
|
||||
QPointer<Ui::RoundButton> addButton(
|
||||
rpl::producer<QString> text,
|
||||
const style::RoundButton &st) {
|
||||
return getDelegate()->addButton(std::move(text), nullptr, st);
|
||||
}
|
||||
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) {
|
||||
return getDelegate()->addButton(std::move(textFactory), std::move(clickCallback), st);
|
||||
QPointer<Ui::RoundButton> addButton(
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) {
|
||||
return getDelegate()->addButton(
|
||||
std::move(text),
|
||||
std::move(clickCallback),
|
||||
st);
|
||||
}
|
||||
void updateButtonsGeometry() {
|
||||
getDelegate()->updateButtonsPositions();
|
||||
|
@ -156,10 +178,13 @@ protected:
|
|||
getDelegate()->setNoContentMargin(noContentMargin);
|
||||
}
|
||||
void setDimensions(
|
||||
int newWidth,
|
||||
int maxHeight,
|
||||
bool forceCenterPosition = false) {
|
||||
getDelegate()->setDimensions(newWidth, maxHeight, forceCenterPosition);
|
||||
int newWidth,
|
||||
int maxHeight,
|
||||
bool forceCenterPosition = false) {
|
||||
getDelegate()->setDimensions(
|
||||
newWidth,
|
||||
maxHeight,
|
||||
forceCenterPosition);
|
||||
}
|
||||
void setDimensionsToContent(
|
||||
int newWidth,
|
||||
|
@ -251,16 +276,24 @@ public:
|
|||
|
||||
void setLayerType(bool layerType) override;
|
||||
void setTitle(rpl::producer<TextWithEntities> title) override;
|
||||
void setAdditionalTitle(Fn<QString()> additionalFactory) override;
|
||||
void setAdditionalTitle(rpl::producer<QString> additional) override;
|
||||
void showBox(
|
||||
object_ptr<BoxContent> box,
|
||||
LayerOptions options,
|
||||
anim::type animated) override;
|
||||
|
||||
void clearButtons() override;
|
||||
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) override;
|
||||
QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) override;
|
||||
QPointer<Ui::IconButton> addTopButton(const style::IconButton &st, Fn<void()> clickCallback) override;
|
||||
QPointer<Ui::RoundButton> addButton(
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) override;
|
||||
QPointer<Ui::RoundButton> addLeftButton(
|
||||
rpl::producer<QString> text,
|
||||
Fn<void()> clickCallback,
|
||||
const style::RoundButton &st) override;
|
||||
QPointer<Ui::IconButton> addTopButton(
|
||||
const style::IconButton &st,
|
||||
Fn<void()> clickCallback) override;
|
||||
void updateButtonsPositions() override;
|
||||
QPointer<QWidget> outerContainer() override;
|
||||
|
||||
|
@ -301,7 +334,6 @@ protected:
|
|||
private:
|
||||
void paintAdditionalTitle(Painter &p);
|
||||
void updateTitlePosition();
|
||||
void refreshAdditionalTitle();
|
||||
void refreshLang();
|
||||
|
||||
bool hasTitle() const;
|
||||
|
@ -322,8 +354,7 @@ private:
|
|||
|
||||
object_ptr<Ui::FlatLabel> _title = { nullptr };
|
||||
Fn<TextWithEntities()> _titleFactory;
|
||||
QString _additionalTitle;
|
||||
Fn<QString()> _additionalTitleFactory;
|
||||
rpl::variable<QString> _additionalTitle;
|
||||
int _titleLeft = 0;
|
||||
int _titleTop = 0;
|
||||
bool _layerType = false;
|
||||
|
|
|
@ -400,10 +400,12 @@ void AddContactBox::retry() {
|
|||
void AddContactBox::updateButtons() {
|
||||
clearButtons();
|
||||
if (_retrying) {
|
||||
addButton(langFactory(lng_try_other_contact), [this] { retry(); });
|
||||
addButton(tr::lng_try_other_contact(), [=] { retry(); });
|
||||
} else {
|
||||
addButton(langFactory(_user ? lng_settings_save : lng_add_contact), [this] { save(); });
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(
|
||||
_user ? tr::lng_settings_save() : tr::lng_add_contact(),
|
||||
[=] { save(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -464,8 +466,12 @@ void GroupInfoBox::prepare() {
|
|||
|
||||
connect(_title, &Ui::InputField::submitted, [=] { submitName(); });
|
||||
|
||||
addButton(langFactory((_type != Type::Group) ? lng_create_group_create : lng_create_group_next), [this] { submit(); });
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(
|
||||
(_type != Type::Group
|
||||
? tr::lng_create_group_create()
|
||||
: tr::lng_create_group_next()),
|
||||
[=] { submit(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
updateMaxHeight();
|
||||
}
|
||||
|
@ -618,12 +624,8 @@ void GroupInfoBox::submit() {
|
|||
}
|
||||
}
|
||||
};
|
||||
box->addButton(
|
||||
langFactory(lng_create_group_create),
|
||||
std::move(create));
|
||||
box->addButton(
|
||||
langFactory(lng_cancel),
|
||||
[box] { box->closeBox(); });
|
||||
box->addButton(tr::lng_create_group_create(), std::move(create));
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
};
|
||||
Ui::show(
|
||||
Box<PeerListBox>(
|
||||
|
@ -744,10 +746,17 @@ void SetupChannelBox::prepare() {
|
|||
|
||||
setMouseTracking(true);
|
||||
|
||||
_checkRequestId = MTP::send(MTPchannels_CheckUsername(_channel->inputChannel, MTP_string("preston")), RPCDoneHandlerPtr(), rpcFail(&SetupChannelBox::onFirstCheckFail));
|
||||
_checkRequestId = MTP::send(
|
||||
MTPchannels_CheckUsername(
|
||||
_channel->inputChannel,
|
||||
MTP_string("preston")),
|
||||
RPCDoneHandlerPtr(),
|
||||
rpcFail(&SetupChannelBox::onFirstCheckFail));
|
||||
|
||||
addButton(langFactory(lng_settings_save), [=] { save(); });
|
||||
addButton(langFactory(_existing ? lng_cancel : lng_create_group_skip), [=] { closeBox(); });
|
||||
addButton(tr::lng_settings_save(), [=] { save(); });
|
||||
addButton(
|
||||
_existing ? tr::lng_cancel() : tr::lng_create_group_skip(),
|
||||
[=] { closeBox(); });
|
||||
|
||||
connect(_link, &Ui::MaskedInputField::changed, [=] { handleChange(); });
|
||||
_link->setVisible(_privacyGroup->value() == Privacy::Public);
|
||||
|
@ -1101,8 +1110,8 @@ void EditNameBox::prepare() {
|
|||
newHeight += st::boxPadding.bottom() + st::contactPadding.bottom();
|
||||
setDimensions(st::boxWideWidth, newHeight);
|
||||
|
||||
addButton(langFactory(lng_settings_save), [=] { save(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_settings_save(), [=] { save(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
if (_invertOrder) {
|
||||
setTabOrder(_last, _first);
|
||||
}
|
||||
|
@ -1266,7 +1275,7 @@ void RevokePublicLinkBox::prepare() {
|
|||
}
|
||||
}), st::boxLayerScroll, _innerTop);
|
||||
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
subscribe(Auth().downloaderTaskFinished(), [=] { update(); });
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ void AutoDownloadBox::setupContent() {
|
|||
limits->fire_copy(value);
|
||||
});
|
||||
|
||||
addButton(langFactory(lng_connection_save), [=] {
|
||||
addButton(tr::lng_connection_save(), [=] {
|
||||
auto allowMore = ranges::view::all(
|
||||
*values
|
||||
) | ranges::view::filter([&](Pair pair) {
|
||||
|
@ -173,7 +173,7 @@ void AutoDownloadBox::setupContent() {
|
|||
}
|
||||
closeBox();
|
||||
});
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
setDimensionsToContent(st::boxWidth, content);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
void AutoLockBox::prepare() {
|
||||
setTitle(tr::lng_passcode_autolock());
|
||||
|
||||
addButton(langFactory(lng_box_ok), [this] { closeBox(); });
|
||||
addButton(tr::lng_box_ok(), [this] { closeBox(); });
|
||||
|
||||
auto options = { 60, 300, 3600, 18000 };
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ BackgroundBox::BackgroundBox(QWidget*) {
|
|||
void BackgroundBox::prepare() {
|
||||
setTitle(tr::lng_backgrounds_header());
|
||||
|
||||
addButton(langFactory(lng_close), [=] { closeBox(); });
|
||||
addButton(tr::lng_close(), [=] { closeBox(); });
|
||||
|
||||
setDimensions(st::boxWideWidth, st::boxMaxListHeight);
|
||||
|
||||
|
|
|
@ -409,10 +409,10 @@ not_null<HistoryView::ElementDelegate*> BackgroundPreviewBox::delegate() {
|
|||
void BackgroundPreviewBox::prepare() {
|
||||
setTitle(tr::lng_background_header());
|
||||
|
||||
addButton(langFactory(lng_background_apply), [=] { apply(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_background_apply(), [=] { apply(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
if (_paper.hasShareUrl()) {
|
||||
addLeftButton(langFactory(lng_background_share), [=] { share(); });
|
||||
addLeftButton(tr::lng_background_share(), [=] { share(); });
|
||||
}
|
||||
updateServiceBg(_paper.backgroundColor());
|
||||
|
||||
|
|
|
@ -501,7 +501,7 @@ void CalendarBox::prepare() {
|
|||
// _inner = setInnerWidget(object_ptr<Inner>(this, _context.get()), st::calendarScroll, st::calendarTitleHeight);
|
||||
_inner->setDateChosenCallback(std::move(_callback));
|
||||
|
||||
addButton(langFactory(lng_close), [this] { closeBox(); });
|
||||
addButton(tr::lng_close(), [this] { closeBox(); });
|
||||
|
||||
subscribe(_context->month(), [this](QDate month) { monthChanged(month); });
|
||||
|
||||
|
|
|
@ -135,8 +135,8 @@ void ChangePhoneBox::EnterPhone::prepare() {
|
|||
|
||||
setDimensions(st::boxWidth, description->bottomNoMargins() + st::boxLittleSkip);
|
||||
|
||||
addButton(langFactory(lng_change_phone_new_submit), [this] { submit(); });
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_change_phone_new_submit(), [this] { submit(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
}
|
||||
|
||||
void ChangePhoneBox::EnterPhone::submit() {
|
||||
|
@ -237,9 +237,11 @@ ChangePhoneBox::EnterCode::EnterCode(QWidget*, const QString &phone, const QStri
|
|||
void ChangePhoneBox::EnterCode::prepare() {
|
||||
setTitle(tr::lng_change_phone_title());
|
||||
|
||||
auto descriptionText = lng_change_phone_code_description__rich(
|
||||
auto descriptionText = tr::lng_change_phone_code_description(
|
||||
tr::now,
|
||||
lt_phone,
|
||||
Ui::Text::Bold(App::formatPhone(_phone)));
|
||||
Ui::Text::Bold(App::formatPhone(_phone)),
|
||||
Ui::Text::WithEntities);
|
||||
auto description = object_ptr<Ui::FlatLabel>(this, rpl::single(descriptionText), st::changePhoneLabel);
|
||||
description->moveToLeft(st::boxPadding.left(), 0);
|
||||
|
||||
|
@ -259,8 +261,8 @@ void ChangePhoneBox::EnterCode::prepare() {
|
|||
updateCall();
|
||||
}
|
||||
|
||||
addButton(langFactory(lng_change_phone_new_submit), [=] { submit(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_change_phone_new_submit(), [=] { submit(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
}
|
||||
|
||||
int ChangePhoneBox::EnterCode::countHeight() {
|
||||
|
@ -339,12 +341,12 @@ bool ChangePhoneBox::EnterCode::sendCodeFail(const RPCError &error) {
|
|||
|
||||
void ChangePhoneBox::prepare() {
|
||||
setTitle(tr::lng_change_phone_title());
|
||||
addButton(langFactory(lng_change_phone_button), [] {
|
||||
addButton(tr::lng_change_phone_button(), [] {
|
||||
Ui::show(Box<ConfirmBox>(lang(lng_change_phone_warning), [] {
|
||||
Ui::show(Box<EnterPhone>());
|
||||
}));
|
||||
});
|
||||
addButton(langFactory(lng_cancel), [this] {
|
||||
addButton(tr::lng_cancel(), [this] {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/empty_userpic.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "window/window_session_controller.h"
|
||||
|
@ -183,12 +184,12 @@ void ConfirmBox::init(const TextWithEntities &text) {
|
|||
|
||||
void ConfirmBox::prepare() {
|
||||
addButton(
|
||||
[=] { return _confirmText; },
|
||||
rpl::single(_confirmText),
|
||||
[=] { confirmed(); },
|
||||
_confirmStyle);
|
||||
if (!_informative) {
|
||||
addButton(
|
||||
[=] { return _cancelText; },
|
||||
rpl::single(_cancelText),
|
||||
[=] { _cancelled = true; closeBox(); });
|
||||
}
|
||||
|
||||
|
@ -320,7 +321,7 @@ MaxInviteBox::MaxInviteBox(QWidget*, not_null<ChannelData*> channel) : BoxConten
|
|||
void MaxInviteBox::prepare() {
|
||||
setMouseTracking(true);
|
||||
|
||||
addButton(langFactory(lng_box_ok), [this] { closeBox(); });
|
||||
addButton(tr::lng_box_ok(), [=] { closeBox(); });
|
||||
|
||||
_textWidth = st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right();
|
||||
_textHeight = qMin(_text.countHeight(_textWidth), 16 * st::boxLabelStyle.lineHeight);
|
||||
|
@ -396,8 +397,8 @@ PinMessageBox::PinMessageBox(
|
|||
}
|
||||
|
||||
void PinMessageBox::prepare() {
|
||||
addButton(langFactory(lng_pinned_pin), [this] { pinMessage(); });
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_pinned_pin(), [this] { pinMessage(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
if (_peer->isChat() || _peer->isMegagroup()) {
|
||||
_notify.create(this, lang(lng_pinned_notify), true, st::defaultBoxCheckbox);
|
||||
|
@ -488,7 +489,7 @@ void DeleteMessagesBox::prepare() {
|
|||
const auto appendDetails = [&](TextWithEntities &&text) {
|
||||
details.append(qstr("\n\n")).append(std::move(text));
|
||||
};
|
||||
auto deleteKey = lng_box_delete;
|
||||
auto deleteText = tr::lng_box_delete();
|
||||
auto deleteStyle = &st::defaultBoxButton;
|
||||
if (const auto peer = _wipeHistoryPeer) {
|
||||
if (_wipeHistoryJustClear) {
|
||||
|
@ -508,9 +509,9 @@ void DeleteMessagesBox::prepare() {
|
|||
: lang(peer->isMegagroup()
|
||||
? lng_sure_leave_group
|
||||
: lng_sure_leave_channel);
|
||||
deleteKey = _wipeHistoryPeer->isUser()
|
||||
? lng_box_delete
|
||||
: lng_box_leave;
|
||||
deleteText = _wipeHistoryPeer->isUser()
|
||||
? tr::lng_box_delete()
|
||||
: tr::lng_box_leave();
|
||||
deleteStyle = &(peer->isChannel()
|
||||
? st::defaultBoxButton
|
||||
: st::attentionBoxButton);
|
||||
|
@ -521,6 +522,7 @@ void DeleteMessagesBox::prepare() {
|
|||
}
|
||||
} else if (_moderateFrom) {
|
||||
Assert(_moderateInChannel != nullptr);
|
||||
|
||||
details.text = lang(lng_selected_delete_sure_this);
|
||||
if (_moderateBan) {
|
||||
_banUser.create(this, lang(lng_ban_user), false, st::defaultBoxCheckbox);
|
||||
|
@ -552,10 +554,10 @@ void DeleteMessagesBox::prepare() {
|
|||
_text.create(this, rpl::single(std::move(details)), st::boxLabel);
|
||||
|
||||
addButton(
|
||||
langFactory(deleteKey),
|
||||
std::move(deleteText),
|
||||
[=] { deleteAndClear(); },
|
||||
*deleteStyle);
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
auto fullHeight = st::boxPadding.top() + _text->height() + st::boxPadding.bottom();
|
||||
if (_moderateFrom) {
|
||||
|
@ -639,34 +641,37 @@ auto DeleteMessagesBox::revokeText(not_null<PeerData*> peer) const
|
|||
lt_user,
|
||||
user->firstName);
|
||||
} else {
|
||||
result.checkbox = lang(lng_delete_for_everyone_check);
|
||||
result.checkbox = tr::lng_delete_for_everyone_check(tr::now);
|
||||
}
|
||||
return result;
|
||||
} else if (canRevokeOutgoingCount > 0) {
|
||||
result.checkbox = lang(lng_delete_for_other_my);
|
||||
result.checkbox = tr::lng_delete_for_other_my(tr::now);
|
||||
if (const auto user = peer->asUser()) {
|
||||
auto boldName = TextWithEntities{ user->firstName };
|
||||
boldName.entities.push_back(
|
||||
{ EntityType::Bold, 0, boldName.text.size() });
|
||||
if (canRevokeOutgoingCount == 1) {
|
||||
result.description = lng_selected_unsend_about_user_one__rich(
|
||||
result.description = tr::lng_selected_unsend_about_user_one(
|
||||
tr::now,
|
||||
lt_user,
|
||||
boldName);
|
||||
Ui::Text::Bold(user->shortName()),
|
||||
Ui::Text::WithEntities);
|
||||
} else {
|
||||
result.description = lng_selected_unsend_about_user__rich(
|
||||
result.description = tr::lng_selected_unsend_about_user(
|
||||
tr::now,
|
||||
lt_count,
|
||||
canRevokeOutgoingCount,
|
||||
lt_user,
|
||||
boldName);
|
||||
Ui::Text::Bold(user->shortName()),
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
} else if (canRevokeOutgoingCount == 1) {
|
||||
result.description = TextWithEntities{
|
||||
lang(lng_selected_unsend_about_group_one) };
|
||||
result.description = tr::lng_selected_unsend_about_group_one(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities);
|
||||
} else {
|
||||
result.description = TextWithEntities{
|
||||
lng_selected_unsend_about_group(
|
||||
lt_count,
|
||||
canRevokeOutgoingCount) };
|
||||
result.description = tr::lng_selected_unsend_about_group(
|
||||
tr::now,
|
||||
lt_count,
|
||||
canRevokeOutgoingCount,
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -836,11 +841,12 @@ std::vector<not_null<UserData*>> ConfirmInviteBox::GetParticipants(
|
|||
}
|
||||
|
||||
void ConfirmInviteBox::prepare() {
|
||||
const auto joinKey = _isChannel
|
||||
? lng_profile_join_channel
|
||||
: lng_profile_join_group;
|
||||
addButton(langFactory(joinKey), _submit);
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(
|
||||
(_isChannel
|
||||
? tr::lng_profile_join_channel()
|
||||
: tr::lng_profile_join_group()),
|
||||
_submit);
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
while (_participants.size() > 4) {
|
||||
_participants.pop_back();
|
||||
|
@ -913,16 +919,16 @@ ConfirmDontWarnBox::ConfirmDontWarnBox(
|
|||
QWidget*,
|
||||
rpl::producer<TextWithEntities> text,
|
||||
const QString &checkbox,
|
||||
const QString &confirm,
|
||||
rpl::producer<QString> confirm,
|
||||
FnMut<void(bool)> callback)
|
||||
: _confirm(confirm)
|
||||
: _confirm(std::move(confirm))
|
||||
, _content(setupContent(std::move(text), checkbox, std::move(callback))) {
|
||||
}
|
||||
|
||||
void ConfirmDontWarnBox::prepare() {
|
||||
setDimensionsToContent(st::boxWidth, _content);
|
||||
addButton([=] { return _confirm; }, [=] { _callback(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(std::move(_confirm), [=] { _callback(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
}
|
||||
|
||||
not_null<Ui::RpWidget*> ConfirmDontWarnBox::setupContent(
|
||||
|
|
|
@ -226,7 +226,7 @@ public:
|
|||
QWidget*,
|
||||
rpl::producer<TextWithEntities> text,
|
||||
const QString &checkbox,
|
||||
const QString &confirm,
|
||||
rpl::producer<QString> confirm,
|
||||
FnMut<void(bool)> callback);
|
||||
|
||||
protected:
|
||||
|
@ -238,7 +238,7 @@ private:
|
|||
const QString &checkbox,
|
||||
FnMut<void(bool)> callback);
|
||||
|
||||
QString _confirm;
|
||||
rpl::producer<QString> _confirm;
|
||||
FnMut<void()> _callback;
|
||||
not_null<Ui::RpWidget*> _content;
|
||||
|
||||
|
|
|
@ -284,8 +284,8 @@ void ConfirmPhoneBox::prepare() {
|
|||
|
||||
setTitle(tr::lng_confirm_phone_title());
|
||||
|
||||
addButton(langFactory(lng_confirm_phone_send), [=] { sendCode(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_confirm_phone_send(), [=] { sendCode(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
setDimensions(st::boxWidth, st::usernamePadding.top() + _code->height() + st::usernameSkip + _about->height() + st::usernameSkip);
|
||||
|
||||
|
|
|
@ -471,8 +471,8 @@ ProxiesBox::ProxiesBox(
|
|||
void ProxiesBox::prepare() {
|
||||
setTitle(tr::lng_proxy_settings());
|
||||
|
||||
addButton(langFactory(lng_proxy_add), [=] { addNewProxy(); });
|
||||
addButton(langFactory(lng_close), [=] { closeBox(); });
|
||||
addButton(tr::lng_proxy_add(), [=] { addNewProxy(); });
|
||||
addButton(tr::lng_close(), [=] { closeBox(); });
|
||||
|
||||
setupContent();
|
||||
}
|
||||
|
@ -706,12 +706,12 @@ void ProxyBox::prepare() {
|
|||
|
||||
void ProxyBox::refreshButtons() {
|
||||
clearButtons();
|
||||
addButton(langFactory(lng_settings_save), [=] { save(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_settings_save(), [=] { save(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
const auto type = _type->value();
|
||||
if (type == Type::Socks5 || type == Type::Mtproto) {
|
||||
addLeftButton(langFactory(lng_proxy_share), [=] { share(); });
|
||||
addLeftButton(tr::lng_proxy_share(), [=] { share(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -700,10 +700,10 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
|||
clearButtons();
|
||||
if (valid) {
|
||||
addButton(
|
||||
langFactory(lng_polls_create_button),
|
||||
tr::lng_polls_create_button(),
|
||||
[=] { _submitRequests.fire(collectResult()); });
|
||||
}
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
}, lifetime());
|
||||
|
||||
options->isValidChanged(
|
||||
|
|
|
@ -26,8 +26,8 @@ DownloadPathBox::DownloadPathBox(QWidget *parent)
|
|||
}
|
||||
|
||||
void DownloadPathBox::prepare() {
|
||||
addButton(langFactory(lng_connection_save), [this] { save(); });
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_connection_save(), [this] { save(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
setTitle(tr::lng_download_path_header());
|
||||
|
||||
|
|
|
@ -583,13 +583,13 @@ void EditCaptionBox::createEditMediaButton() {
|
|||
}
|
||||
|
||||
void EditCaptionBox::prepare() {
|
||||
addButton(langFactory(lng_settings_save), [this] { save(); });
|
||||
addButton(tr::lng_settings_save(), [this] { save(); });
|
||||
if (_isAllowedEditMedia) {
|
||||
createEditMediaButton();
|
||||
} else {
|
||||
_preparedList.files.clear();
|
||||
}
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
updateBoxSize();
|
||||
connect(_field, &Ui::InputField::submitted, [=] { save(); });
|
||||
|
|
|
@ -654,8 +654,8 @@ void EditColorBox::prepare() {
|
|||
connect(_blueField, &Ui::MaskedInputField::submitted, submitted);
|
||||
connect(_result, &Ui::MaskedInputField::submitted, submitted);
|
||||
|
||||
addButton(langFactory(lng_settings_save), [=] { saveColor(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_settings_save(), [=] { saveColor(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
auto height = st::colorEditSkip + st::colorPickerSize + st::colorEditSkip + st::colorSliderWidth + st::colorEditSkip;
|
||||
setDimensions(st::colorEditWidth, height);
|
||||
|
|
|
@ -133,7 +133,7 @@ void EditPrivacyBox::editExceptions(
|
|||
exceptions(exception));
|
||||
auto initBox = [=, controller = controller.get()](
|
||||
not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_settings_save), crl::guard(this, [=] {
|
||||
box->addButton(tr::lng_settings_save(), crl::guard(this, [=] {
|
||||
exceptions(exception) = controller->getResult();
|
||||
const auto type = [&] {
|
||||
switch (exception) {
|
||||
|
@ -151,7 +151,7 @@ void EditPrivacyBox::editExceptions(
|
|||
done();
|
||||
box->closeBox();
|
||||
}));
|
||||
box->addButton(langFactory(lng_cancel), [=] { box->closeBox(); });
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
};
|
||||
Ui::show(
|
||||
Box<PeerListBox>(std::move(controller), std::move(initBox)),
|
||||
|
@ -354,7 +354,7 @@ void EditPrivacyBox::setupContent() {
|
|||
content->add(std::move(below));
|
||||
}
|
||||
|
||||
addButton(langFactory(lng_settings_save), [=] {
|
||||
addButton(tr::lng_settings_save(), [=] {
|
||||
const auto someAreDisallowed = (_value.option != Option::Everyone)
|
||||
|| !_value.never.empty();
|
||||
_controller->confirmSave(someAreDisallowed, crl::guard(this, [=] {
|
||||
|
@ -364,7 +364,7 @@ void EditPrivacyBox::setupContent() {
|
|||
closeBox();
|
||||
}));
|
||||
});
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
const auto linkHeight = st::settingsButton.padding.top()
|
||||
+ st::settingsButton.height
|
||||
|
|
|
@ -1035,7 +1035,7 @@ Ui::ScrollToRequest Content::jump(int rows) {
|
|||
} // namespace
|
||||
|
||||
void LanguageBox::prepare() {
|
||||
addButton(langFactory(lng_box_ok), [=] { closeBox(); });
|
||||
addButton(tr::lng_box_ok(), [=] { closeBox(); });
|
||||
|
||||
setTitle(tr::lng_languages());
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
Row(
|
||||
QWidget *parent,
|
||||
Fn<QString(size_type)> title,
|
||||
Fn<QString()> clear,
|
||||
rpl::producer<QString> clear,
|
||||
const Database::TaggedSummary &data);
|
||||
|
||||
void update(const Database::TaggedSummary &data);
|
||||
|
@ -153,7 +153,7 @@ private:
|
|||
LocalStorageBox::Row::Row(
|
||||
QWidget *parent,
|
||||
Fn<QString(size_type)> title,
|
||||
Fn<QString()> clear,
|
||||
rpl::producer<QString> clear,
|
||||
const Database::TaggedSummary &data)
|
||||
: RpWidget(parent)
|
||||
, _titleFactory(std::move(title))
|
||||
|
@ -299,7 +299,7 @@ void LocalStorageBox::Show(
|
|||
void LocalStorageBox::prepare() {
|
||||
setTitle(tr::lng_local_storage_title());
|
||||
|
||||
addButton(langFactory(lng_box_ok), [this] { closeBox(); });
|
||||
addButton(tr::lng_box_ok(), [this] { closeBox(); });
|
||||
|
||||
setupControls();
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ void LocalStorageBox::setupControls() {
|
|||
const auto createRow = [&](
|
||||
uint16 tag,
|
||||
Fn<QString(size_type)> title,
|
||||
Fn<QString()> clear,
|
||||
rpl::producer<QString> clear,
|
||||
const Database::TaggedSummary &data) {
|
||||
auto result = container->add(object_ptr<Ui::SlideWrap<Row>>(
|
||||
container,
|
||||
|
@ -395,7 +395,7 @@ void LocalStorageBox::setupControls() {
|
|||
tracker.track(createRow(
|
||||
tag,
|
||||
std::move(title),
|
||||
langFactory(lng_local_storage_clear_some),
|
||||
tr::lng_local_storage_clear_some(),
|
||||
data));
|
||||
};
|
||||
auto summaryTitle = [](size_type) {
|
||||
|
@ -407,7 +407,7 @@ void LocalStorageBox::setupControls() {
|
|||
createRow(
|
||||
0,
|
||||
std::move(summaryTitle),
|
||||
langFactory(lng_local_storage_clear),
|
||||
tr::lng_local_storage_clear(),
|
||||
summary());
|
||||
setupLimits(container);
|
||||
const auto shadow = container->add(object_ptr<Ui::SlideWrap<>>(
|
||||
|
@ -422,7 +422,7 @@ void LocalStorageBox::setupControls() {
|
|||
tracker.track(createRow(
|
||||
kFakeMediaCacheTag,
|
||||
std::move(mediaCacheTitle),
|
||||
langFactory(lng_local_storage_clear_some),
|
||||
tr::lng_local_storage_clear_some(),
|
||||
_statsBig.full));
|
||||
shadow->toggleOn(
|
||||
std::move(tracker).atLeastOneShownValue()
|
||||
|
@ -572,10 +572,10 @@ void LocalStorageBox::limitsChanged() {
|
|||
_limitsChanged = changed;
|
||||
clearButtons();
|
||||
if (_limitsChanged) {
|
||||
addButton(langFactory(lng_settings_save), [=] { save(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_settings_save(), [=] { save(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
} else {
|
||||
addButton(langFactory(lng_box_ok), [=] { closeBox(); });
|
||||
addButton(tr::lng_box_ok(), [=] { closeBox(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ void MuteSettingsBox::prepare() {
|
|||
muteForSeconds);
|
||||
closeBox();
|
||||
};
|
||||
addButton(langFactory(lng_box_ok), _save);
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_box_ok(), _save);
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
setDimensions(st::boxWidth, y);
|
||||
}
|
||||
|
|
|
@ -92,12 +92,14 @@ bool PasscodeBox::onlyCheckCurrent() const {
|
|||
}
|
||||
|
||||
void PasscodeBox::prepare() {
|
||||
addButton([=] {
|
||||
return _cloudFields.customSubmitButton.value_or(lang(_turningOff
|
||||
? lng_passcode_remove_button
|
||||
: lng_settings_save));
|
||||
}, [=] { save(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(
|
||||
(_cloudFields.customSubmitButton
|
||||
? rpl::single(*_cloudFields.customSubmitButton)
|
||||
: _turningOff
|
||||
? tr::lng_passcode_remove_button()
|
||||
: tr::lng_settings_save()),
|
||||
[=] { save(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
_about.setText(
|
||||
st::passcodeTextStyle,
|
||||
|
@ -914,8 +916,8 @@ rpl::producer<> RecoverBox::recoveryExpired() const {
|
|||
void RecoverBox::prepare() {
|
||||
setTitle(tr::lng_signin_recover_title());
|
||||
|
||||
addButton(langFactory(lng_passcode_submit), [=] { submit(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_passcode_submit(), [=] { submit(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
setDimensions(st::boxWidth, st::passcodePadding.top() + st::passcodePadding.bottom() + st::passcodeTextLine + _recoverCode->height() + st::passcodeTextLine);
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ struct PeerListState;
|
|||
class PeerListDelegate {
|
||||
public:
|
||||
virtual void peerListSetTitle(rpl::producer<QString> title) = 0;
|
||||
virtual void peerListSetAdditionalTitle(Fn<QString()> title) = 0;
|
||||
virtual void peerListSetAdditionalTitle(rpl::producer<QString> title) = 0;
|
||||
virtual void peerListSetDescription(object_ptr<Ui::FlatLabel> description) = 0;
|
||||
virtual void peerListSetSearchLoading(object_ptr<Ui::FlatLabel> loading) = 0;
|
||||
virtual void peerListSetSearchNoResults(object_ptr<Ui::FlatLabel> noResults) = 0;
|
||||
|
@ -758,8 +758,7 @@ public:
|
|||
void peerListSetTitle(rpl::producer<QString> title) override {
|
||||
setTitle(std::move(title));
|
||||
}
|
||||
void peerListSetAdditionalTitle(
|
||||
Fn<QString()> title) override {
|
||||
void peerListSetAdditionalTitle(rpl::producer<QString> title) override {
|
||||
setAdditionalTitle(std::move(title));
|
||||
}
|
||||
void peerListSetSearchMode(PeerListSearchMode mode) override;
|
||||
|
|
|
@ -393,7 +393,7 @@ std::unique_ptr<PeerListRow> ContactsBoxController::createRow(not_null<UserData*
|
|||
|
||||
void AddBotToGroupBoxController::Start(not_null<UserData*> bot) {
|
||||
auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
||||
box->addButton(tr::lng_cancel(), [box] { box->closeBox(); });
|
||||
};
|
||||
Ui::show(Box<PeerListBox>(std::make_unique<AddBotToGroupBoxController>(bot), std::move(initBox)));
|
||||
}
|
||||
|
|
|
@ -153,10 +153,10 @@ void AddParticipantsBoxController::updateTitle() {
|
|||
const auto additional = (_peer
|
||||
&& _peer->isChannel()
|
||||
&& !_peer->isMegagroup())
|
||||
? QString() :
|
||||
QString("%1 / %2").arg(fullCount()).arg(Global::MegagroupSizeMax());
|
||||
? QString()
|
||||
: qsl("%1 / %2").arg(fullCount()).arg(Global::MegagroupSizeMax());
|
||||
delegate()->peerListSetTitle(tr::lng_profile_add_participant());
|
||||
delegate()->peerListSetAdditionalTitle([=] { return additional; });
|
||||
delegate()->peerListSetAdditionalTitle(rpl::single(additional));
|
||||
}
|
||||
|
||||
bool AddParticipantsBoxController::inviteSelectedUsers(
|
||||
|
@ -183,12 +183,12 @@ void AddParticipantsBoxController::Start(not_null<ChatData*> chat) {
|
|||
auto controller = std::make_unique<AddParticipantsBoxController>(chat);
|
||||
const auto weak = controller.get();
|
||||
auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_participant_invite), [=] {
|
||||
box->addButton(tr::lng_participant_invite(), [=] {
|
||||
if (weak->inviteSelectedUsers(box)) {
|
||||
Ui::showPeerHistory(chat, ShowAtTheEndMsgId);
|
||||
}
|
||||
});
|
||||
box->addButton(langFactory(lng_cancel), [=] { box->closeBox(); });
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
};
|
||||
Ui::show(
|
||||
Box<PeerListBox>(
|
||||
|
@ -206,7 +206,7 @@ void AddParticipantsBoxController::Start(
|
|||
std::move(alreadyIn));
|
||||
const auto weak = controller.get();
|
||||
auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_participant_invite), [=] {
|
||||
box->addButton(tr::lng_participant_invite(), [=] {
|
||||
if (weak->inviteSelectedUsers(box)) {
|
||||
if (channel->isMegagroup()) {
|
||||
Ui::showPeerHistory(channel, ShowAtTheEndMsgId);
|
||||
|
@ -216,7 +216,7 @@ void AddParticipantsBoxController::Start(
|
|||
}
|
||||
});
|
||||
box->addButton(
|
||||
langFactory(justCreated ? lng_create_group_skip : lng_cancel),
|
||||
justCreated ? tr::lng_create_group_skip() : tr::lng_cancel(),
|
||||
[=] { box->closeBox(); });
|
||||
if (justCreated) {
|
||||
box->boxClosing() | rpl::start_with_next([=] {
|
||||
|
|
|
@ -80,8 +80,8 @@ void Controller::prepare() {
|
|||
? tr::lng_edit_contact_title()
|
||||
: tr::lng_enter_contact_data());
|
||||
|
||||
_box->addButton(langFactory(lng_box_done), _save);
|
||||
_box->addButton(langFactory(lng_cancel), [=] { _box->closeBox(); });
|
||||
_box->addButton(tr::lng_box_done(), _save);
|
||||
_box->addButton(tr::lng_cancel(), [=] { _box->closeBox(); });
|
||||
_box->setFocusCallback(_focus);
|
||||
}
|
||||
|
||||
|
|
|
@ -116,22 +116,25 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
|
|||
}
|
||||
|
||||
void Controller::choose(not_null<ChannelData*> chat) {
|
||||
auto text = lng_manage_discussion_group_sure__rich(
|
||||
auto text = tr::lng_manage_discussion_group_sure(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(chat->name),
|
||||
lt_channel,
|
||||
Ui::Text::Bold(_channel->name));
|
||||
Ui::Text::Bold(_channel->name),
|
||||
Ui::Text::WithEntities);
|
||||
if (!_channel->isPublic()) {
|
||||
text.append(
|
||||
"\n\n" + lang(lng_manage_linked_channel_private));
|
||||
"\n\n" + tr::lng_manage_linked_channel_private(tr::now));
|
||||
}
|
||||
if (!chat->isPublic()) {
|
||||
text.append("\n\n" + lang(lng_manage_discussion_group_private));
|
||||
text.append(
|
||||
"\n\n" + tr::lng_manage_discussion_group_private(tr::now));
|
||||
if (chat->hiddenPreHistory()) {
|
||||
text.append("\n\n");
|
||||
text.append(lng_manage_discussion_group_warning__rich(
|
||||
lt_visible,
|
||||
Ui::Text::Bold(lang(lng_manage_discussion_group_visible))));
|
||||
text.append(tr::lng_manage_discussion_group_warning(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
}
|
||||
}
|
||||
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||
|
@ -151,20 +154,21 @@ void Controller::choose(not_null<ChannelData*> chat) {
|
|||
}
|
||||
|
||||
void Controller::choose(not_null<ChatData*> chat) {
|
||||
auto text = lng_manage_discussion_group_sure__rich(
|
||||
auto text = tr::lng_manage_discussion_group_sure(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(chat->name),
|
||||
lt_channel,
|
||||
Ui::Text::Bold(_channel->name));
|
||||
Ui::Text::Bold(_channel->name),
|
||||
Ui::Text::WithEntities);
|
||||
if (!_channel->isPublic()) {
|
||||
text.append(
|
||||
"\n\n" + lang(lng_manage_linked_channel_private));
|
||||
text.append("\n\n" + tr::lng_manage_linked_channel_private(tr::now));
|
||||
}
|
||||
text.append("\n\n" + lang(lng_manage_discussion_group_private));
|
||||
text.append("\n\n" + tr::lng_manage_discussion_group_private(tr::now));
|
||||
text.append("\n\n");
|
||||
text.append(lng_manage_discussion_group_warning__rich(
|
||||
lt_visible,
|
||||
Ui::Text::Bold(lang(lng_manage_discussion_group_visible))));
|
||||
text.append(tr::lng_manage_discussion_group_warning(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||
const auto sure = [=] {
|
||||
if (*box) {
|
||||
|
@ -192,18 +196,23 @@ object_ptr<Ui::RpWidget> SetupAbout(
|
|||
parent,
|
||||
QString(),
|
||||
st::linkedChatAbout);
|
||||
about->setMarkedText([&]() -> TextWithEntities {
|
||||
about->setMarkedText([&] {
|
||||
if (!channel->isBroadcast()) {
|
||||
return lng_manage_linked_channel_about__rich(
|
||||
return tr::lng_manage_linked_channel_about(
|
||||
tr::now,
|
||||
lt_channel,
|
||||
Ui::Text::Bold(chat->name));
|
||||
Ui::Text::Bold(chat->name),
|
||||
Ui::Text::WithEntities);
|
||||
} else if (chat != nullptr) {
|
||||
return lng_manage_discussion_group_about_chosen__rich(
|
||||
return tr::lng_manage_discussion_group_about_chosen(
|
||||
tr::now,
|
||||
lt_group,
|
||||
Ui::Text::Bold(chat->name));
|
||||
} else {
|
||||
return { lang(lng_manage_discussion_group_about) };
|
||||
Ui::Text::Bold(chat->name),
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
return tr::lng_manage_discussion_group_about(
|
||||
tr::now,
|
||||
Ui::Text::WithEntities);
|
||||
}());
|
||||
return std::move(about);
|
||||
}
|
||||
|
@ -288,7 +297,7 @@ object_ptr<BoxContent> EditLinkedChatBox(
|
|||
box->setTitle(channel->isBroadcast()
|
||||
? tr::lng_manage_discussion_group()
|
||||
: tr::lng_manage_linked_channel());
|
||||
box->addButton(langFactory(lng_close), [=] { box->closeBox(); });
|
||||
box->addButton(tr::lng_close(), [=] { box->closeBox(); });
|
||||
};
|
||||
auto controller = std::make_unique<Controller>(
|
||||
channel,
|
||||
|
|
|
@ -72,30 +72,37 @@ void TransferPasswordError(
|
|||
box->setTitle(tr::lng_rights_transfer_check());
|
||||
box->setWidth(st::transferCheckWidth);
|
||||
|
||||
auto text = lng_rights_transfer_check_about__rich(
|
||||
auto text = tr::lng_rights_transfer_check_about(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Bold(user->shortName())
|
||||
Ui::Text::Bold(user->shortName()),
|
||||
Ui::Text::WithEntities
|
||||
).append('\n').append('\n').append(
|
||||
Ui::Text::RichLangValue(lang(lng_rights_transfer_check_password))
|
||||
tr::lng_rights_transfer_check_password(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue)
|
||||
).append('\n').append('\n').append(
|
||||
Ui::Text::RichLangValue(lang(lng_rights_transfer_check_session))
|
||||
tr::lng_rights_transfer_check_session(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue)
|
||||
);
|
||||
if (error == PasswordErrorType::Later) {
|
||||
text.append('\n').append('\n').append(
|
||||
Ui::Text::RichLangValue(lang(lng_rights_transfer_check_later))
|
||||
);
|
||||
tr::lng_rights_transfer_check_later(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
}
|
||||
box->addRow(object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
rpl::single(text),
|
||||
st::boxLabel));
|
||||
if (error == PasswordErrorType::Later) {
|
||||
box->addButton(langFactory(lng_box_ok), [=] { box->closeBox(); });
|
||||
box->addButton(tr::lng_box_ok(), [=] { box->closeBox(); });
|
||||
} else {
|
||||
box->addButton(langFactory(lng_rights_transfer_set_password), [=] {
|
||||
box->addButton(tr::lng_rights_transfer_set_password(), [=] {
|
||||
SetCloudPassword(box, user);
|
||||
});
|
||||
box->addButton(langFactory(lng_cancel), [=] { box->closeBox(); });
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +362,7 @@ void EditAdminBox::prepare() {
|
|||
}, lifetime());
|
||||
|
||||
if (canSave()) {
|
||||
addButton(langFactory(lng_settings_save), [=, value = getChecked] {
|
||||
addButton(tr::lng_settings_save(), [=, value = getChecked] {
|
||||
if (!_saveCallback) {
|
||||
return;
|
||||
}
|
||||
|
@ -367,9 +374,9 @@ void EditAdminBox::prepare() {
|
|||
_oldRights,
|
||||
MTP_chatAdminRights(MTP_flags(newFlags)));
|
||||
});
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
} else {
|
||||
addButton(langFactory(lng_box_ok), [this] { closeBox(); });
|
||||
addButton(tr::lng_box_ok(), [this] { closeBox(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -652,10 +659,10 @@ void EditRestrictedBox::prepare() {
|
|||
MTP_flags(value()),
|
||||
MTP_int(getRealUntilValue())));
|
||||
};
|
||||
addButton(langFactory(lng_settings_save), save);
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_settings_save(), save);
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
} else {
|
||||
addButton(langFactory(lng_box_ok), [=] { closeBox(); });
|
||||
addButton(tr::lng_box_ok(), [=] { closeBox(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -682,7 +689,7 @@ void EditRestrictedBox::showRestrictUntil() {
|
|||
QDate::currentDate().addDays(kMaxRestrictDelayDays));
|
||||
_restrictUntilBox->setMinDate(tomorrow);
|
||||
_restrictUntilBox->addLeftButton(
|
||||
langFactory(lng_rights_chat_banned_forever),
|
||||
tr::lng_rights_chat_banned_forever(),
|
||||
[=] { setRestrictUntil(0); });
|
||||
}
|
||||
|
||||
|
|
|
@ -787,7 +787,7 @@ void ParticipantsBoxController::Start(
|
|||
role);
|
||||
auto initBox = [=, controller = controller.get()](
|
||||
not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_close), [=] { box->closeBox(); });
|
||||
box->addButton(tr::lng_close(), [=] { box->closeBox(); });
|
||||
|
||||
const auto chat = peer->asChat();
|
||||
const auto channel = peer->asChannel();
|
||||
|
@ -814,23 +814,23 @@ void ParticipantsBoxController::Start(
|
|||
|
||||
Unexpected("Role value in ParticipantsBoxController::Start()");
|
||||
}();
|
||||
const auto addNewItemText = [&] {
|
||||
auto addNewItemText = [&] {
|
||||
switch (role) {
|
||||
case Role::Members:
|
||||
return langFactory((chat || channel->isMegagroup())
|
||||
? lng_channel_add_members
|
||||
: lng_channel_add_users);
|
||||
return (chat || channel->isMegagroup())
|
||||
? tr::lng_channel_add_members()
|
||||
: tr::lng_channel_add_users();
|
||||
case Role::Admins:
|
||||
return langFactory(lng_channel_add_admin);
|
||||
return tr::lng_channel_add_admin();
|
||||
case Role::Restricted:
|
||||
return langFactory(lng_channel_add_exception);
|
||||
return tr::lng_channel_add_exception();
|
||||
case Role::Kicked:
|
||||
return langFactory(lng_channel_add_removed);
|
||||
return tr::lng_channel_add_removed();
|
||||
}
|
||||
Unexpected("Role value in ParticipantsBoxController::Start()");
|
||||
}();
|
||||
if (canAddNewItem) {
|
||||
box->addLeftButton(addNewItemText, [=] {
|
||||
box->addLeftButton(std::move(addNewItemText), [=] {
|
||||
controller->addNewItem();
|
||||
});
|
||||
}
|
||||
|
@ -858,7 +858,7 @@ void ParticipantsBoxController::addNewItem() {
|
|||
editRestrictedDone(user, rights);
|
||||
});
|
||||
const auto initBox = [](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_cancel), [=] { box->closeBox(); });
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
};
|
||||
|
||||
_addBox = Ui::show(
|
||||
|
|
|
@ -112,12 +112,12 @@ void EditPeerHistoryVisibilityBox::prepare() {
|
|||
_peer->updateFull();
|
||||
|
||||
setTitle(tr::lng_manage_history_visibility_title());
|
||||
addButton(langFactory(lng_settings_save), [=] {
|
||||
addButton(tr::lng_settings_save(), [=] {
|
||||
auto local = std::move(_savedCallback);
|
||||
local(_historyVisibility->value());
|
||||
closeBox();
|
||||
});
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
setupContent();
|
||||
}
|
||||
|
|
|
@ -272,10 +272,10 @@ Controller::Controller(
|
|||
_box->setTitle(_isGroup
|
||||
? tr::lng_edit_group()
|
||||
: tr::lng_edit_channel_title());
|
||||
_box->addButton(langFactory(lng_settings_save), [this] {
|
||||
_box->addButton(tr::lng_settings_save(), [this] {
|
||||
save();
|
||||
});
|
||||
_box->addButton(langFactory(lng_cancel), [this] {
|
||||
_box->addButton(tr::lng_cancel(), [this] {
|
||||
_box->closeBox();
|
||||
});
|
||||
subscribeToMigration();
|
||||
|
|
|
@ -345,8 +345,8 @@ void EditPeerPermissionsBox::prepare() {
|
|||
addBannedButtons(inner);
|
||||
|
||||
_value = getRestrictions;
|
||||
_save = addButton(langFactory(lng_settings_save));
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
_save = addButton(tr::lng_settings_save());
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
setDimensionsToContent(st::boxWidth, inner);
|
||||
}
|
||||
|
|
|
@ -733,7 +733,7 @@ void EditPeerTypeBox::prepare() {
|
|||
setTitle(controller->getTitle());
|
||||
|
||||
if (!controller->isInviteLink() && _savedCallback.has_value()) {
|
||||
addButton(langFactory(lng_settings_save), [=] {
|
||||
addButton(tr::lng_settings_save(), [=] {
|
||||
const auto v = controller->getPrivacy();
|
||||
if (!controller->isAllowSave() && (v == Privacy::Public)) {
|
||||
controller->setFocusUsername();
|
||||
|
@ -749,7 +749,7 @@ void EditPeerTypeBox::prepare() {
|
|||
});
|
||||
}
|
||||
addButton(
|
||||
langFactory(controller->isInviteLink() ? lng_close : lng_cancel),
|
||||
controller->isInviteLink() ? tr::lng_close() : tr::lng_cancel(),
|
||||
[=] { closeBox(); });
|
||||
|
||||
setDimensionsToContent(st::boxWideWidth, content);
|
||||
|
|
|
@ -20,8 +20,8 @@ PhotoCropBox::PhotoCropBox(
|
|||
}
|
||||
|
||||
void PhotoCropBox::prepare() {
|
||||
addButton(langFactory(lng_settings_save), [this] { sendPhoto(); });
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_settings_save(), [this] { sendPhoto(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
int32 s = st::boxWideWidth - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
|
||||
_thumb = App::pixmapFromImageInPlace(_img.scaled(s * cIntRetinaFactor(), s * cIntRetinaFactor(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
|
|
|
@ -32,7 +32,7 @@ RateCallBox::RateCallBox(QWidget*, uint64 callId, uint64 callAccessHash)
|
|||
|
||||
void RateCallBox::prepare() {
|
||||
setTitle(tr::lng_call_rate_label());
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
for (auto i = 0; i < kMaxRating; ++i) {
|
||||
_stars.push_back(object_ptr<Ui::IconButton>(this, st::callRatingStar));
|
||||
|
@ -62,8 +62,8 @@ void RateCallBox::ratingChanged(int value) {
|
|||
Expects(value > 0 && value <= kMaxRating);
|
||||
if (!_rating) {
|
||||
clearButtons();
|
||||
addButton(langFactory(lng_send_button), [this] { send(); });
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_send_button(), [this] { send(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
}
|
||||
_rating = value;
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ void ReportBox::prepare() {
|
|||
}
|
||||
}());
|
||||
|
||||
addButton(langFactory(lng_report_button), [=] { report(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_report_button(), [=] { report(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
_reasonGroup = std::make_shared<Ui::RadioenumGroup<Reason>>(
|
||||
Reason::Spam);
|
||||
|
|
|
@ -72,11 +72,11 @@ void SelfDestructionBox::showContent() {
|
|||
showChildren();
|
||||
|
||||
clearButtons();
|
||||
addButton(langFactory(lng_settings_save), [=] {
|
||||
addButton(tr::lng_settings_save(), [=] {
|
||||
Auth().api().saveSelfDestruct(_ttlGroup->value());
|
||||
closeBox();
|
||||
});
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
}
|
||||
|
||||
QString SelfDestructionBox::DaysLabel(int days) {
|
||||
|
@ -102,7 +102,7 @@ void SelfDestructionBox::prepare() {
|
|||
|
||||
setDimensions(st::boxWidth, boxHeight);
|
||||
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
if (_loading) {
|
||||
_loading->moveToLeft(
|
||||
|
|
|
@ -1441,8 +1441,8 @@ void SendFilesBox::setupShadows(
|
|||
}
|
||||
|
||||
void SendFilesBox::prepare() {
|
||||
_send = addButton(langFactory(lng_send_button), [=] { send(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
_send = addButton(tr::lng_send_button(), [=] { send(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
initSendWay();
|
||||
setupCaption();
|
||||
preparePreview();
|
||||
|
|
|
@ -82,7 +82,7 @@ SessionsBox::SessionsBox(QWidget*)
|
|||
void SessionsBox::prepare() {
|
||||
setTitle(tr::lng_sessions_other_header());
|
||||
|
||||
addButton(langFactory(lng_close), [=] { closeBox(); });
|
||||
addButton(tr::lng_close(), [=] { closeBox(); });
|
||||
|
||||
setDimensions(st::boxWideWidth, st::sessionsHeight);
|
||||
|
||||
|
|
|
@ -400,11 +400,11 @@ void ShareBox::keyPressEvent(QKeyEvent *e) {
|
|||
void ShareBox::createButtons() {
|
||||
clearButtons();
|
||||
if (_hasSelected) {
|
||||
addButton(langFactory(lng_share_confirm), [=] { submit(); });
|
||||
addButton(tr::lng_share_confirm(), [=] { submit(); });
|
||||
} else if (_copyCallback) {
|
||||
addButton(langFactory(lng_share_copy_link), [=] { copyLink(); });
|
||||
addButton(tr::lng_share_copy_link(), [=] { copyLink(); });
|
||||
}
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
}
|
||||
|
||||
void ShareBox::applyFilterUpdate(const QString &query) {
|
||||
|
|
|
@ -30,7 +30,7 @@ SingleChoiceBox::SingleChoiceBox(
|
|||
void SingleChoiceBox::prepare() {
|
||||
setTitle(std::move(_title));
|
||||
|
||||
addButton(langFactory(lng_box_ok), [=] { closeBox(); });
|
||||
addButton(tr::lng_box_ok(), [=] { closeBox(); });
|
||||
|
||||
const auto group = std::make_shared<Ui::RadiobuttonGroup>(_initialSelection);
|
||||
|
||||
|
|
|
@ -157,16 +157,16 @@ void StickerSetBox::updateButtons() {
|
|||
clearButtons();
|
||||
if (_inner->loaded()) {
|
||||
if (_inner->notInstalled()) {
|
||||
addButton(langFactory(lng_stickers_add_pack), [=] { addStickers(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_stickers_add_pack(), [=] { addStickers(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
} else if (_inner->official()) {
|
||||
addButton(langFactory(lng_about_done), [=] { closeBox(); });
|
||||
addButton(tr::lng_about_done(), [=] { closeBox(); });
|
||||
} else {
|
||||
addButton(langFactory(lng_stickers_share_pack), [=] { shareStickers(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_stickers_share_pack(), [=] { shareStickers(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
}
|
||||
} else {
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -291,11 +291,15 @@ void StickersBox::prepare() {
|
|||
}
|
||||
|
||||
if (_megagroupSet) {
|
||||
addButton(langFactory(lng_settings_save), [this] { _installed.widget()->saveGroupSet(); closeBox(); });
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(
|
||||
tr::lng_settings_save(),
|
||||
[=] { _installed.widget()->saveGroupSet(); closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
} else {
|
||||
const auto close = _section == Section::Attached;
|
||||
addButton(langFactory(close ? lng_close : lng_about_done), [this] { closeBox(); });
|
||||
addButton(
|
||||
close ? tr::lng_close() : tr::lng_about_done(),
|
||||
[=] { closeBox(); });
|
||||
}
|
||||
|
||||
if (_section == Section::Installed) {
|
||||
|
|
|
@ -135,8 +135,8 @@ UrlAuthBox::UrlAuthBox(
|
|||
|
||||
void UrlAuthBox::prepare() {
|
||||
setDimensionsToContent(st::boxWidth, _content);
|
||||
addButton(langFactory(lng_open_link), [=] { _callback(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_open_link(), [=] { _callback(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
}
|
||||
|
||||
not_null<Ui::RpWidget*> UrlAuthBox::setupContent(
|
||||
|
|
|
@ -44,8 +44,8 @@ void UsernameBox::prepare() {
|
|||
|
||||
setTitle(tr::lng_username_title());
|
||||
|
||||
addButton(langFactory(lng_settings_save), [=] { save(); });
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_settings_save(), [=] { save(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
connect(_username, &Ui::MaskedInputField::changed, [=] { changed(); });
|
||||
connect(_username, &Ui::MaskedInputField::submitted, [=] { save(); });
|
||||
|
|
|
@ -50,7 +50,7 @@ DebugInfoBox::DebugInfoBox(QWidget*, base::weak_ptr<Call> call)
|
|||
void DebugInfoBox::prepare() {
|
||||
setTitle(rpl::single(qsl("Call Debug")));
|
||||
|
||||
addButton(langFactory(lng_close), [this] { closeBox(); });
|
||||
addButton(tr::lng_close(), [this] { closeBox(); });
|
||||
_text = setInnerWidget(
|
||||
object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
this,
|
||||
|
|
|
@ -659,7 +659,7 @@ void ManageSetsBox::prepare() {
|
|||
|
||||
setTitle(tr::lng_emoji_manage_sets());
|
||||
|
||||
addButton(langFactory(lng_close), [=] { closeBox(); });
|
||||
addButton(tr::lng_close(), [=] { closeBox(); });
|
||||
|
||||
setDimensionsToContent(st::boxWidth, inner);
|
||||
}
|
||||
|
|
|
@ -161,8 +161,8 @@ void EditLinkBox::prepare() {
|
|||
? tr::lng_formatting_link_create_title()
|
||||
: tr::lng_formatting_link_edit_title());
|
||||
|
||||
addButton(langFactory(lng_formatting_link_create), submit);
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_formatting_link_create(), submit);
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
content->resizeToWidth(st::boxWidth);
|
||||
content->moveToLeft(0, 0);
|
||||
|
|
|
@ -188,7 +188,6 @@ ResultString " << (isPlural ? entry.keyBase : key) << "__generic(" << genericPar
|
|||
return result;\n\
|
||||
}\n\
|
||||
inline constexpr auto " << (isPlural ? entry.keyBase : key) << " = &" << (isPlural ? entry.keyBase : key) << "__generic<QString>;\n\
|
||||
inline constexpr auto " << (isPlural ? entry.keyBase : key) << "__rich = &" << (isPlural ? entry.keyBase : key) << "__generic<TextWithEntities>;\n\
|
||||
\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,11 +97,12 @@ void LaunchWithWarning(const QString &name, HistoryItem *item) {
|
|||
File::Launch(name);
|
||||
};
|
||||
Ui::show(Box<ConfirmDontWarnBox>(
|
||||
rpl::single(lng_launch_exe_warning__rich(
|
||||
tr::lng_launch_exe_warning(
|
||||
lt_extension,
|
||||
Ui::Text::Bold(extension))),
|
||||
rpl::single(Ui::Text::Bold(extension)),
|
||||
Ui::Text::WithEntities),
|
||||
lang(lng_launch_exe_dont_ask),
|
||||
lang(lng_launch_exe_sure),
|
||||
tr::lng_launch_exe_sure(),
|
||||
callback));
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ void ShowSearchFromBox(
|
|||
if (auto controller = createController()) {
|
||||
auto subscription = std::make_shared<rpl::lifetime>();
|
||||
auto box = Ui::show(Box<PeerListBox>(std::move(controller), [subscription](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_cancel), [box, subscription] {
|
||||
box->addButton(tr::lng_cancel(), [box, subscription] {
|
||||
box->closeBox();
|
||||
});
|
||||
}), LayerOption::KeepOther);
|
||||
|
|
|
@ -43,11 +43,11 @@ SuggestBox::SuggestBox(QWidget*) {
|
|||
void SuggestBox::prepare() {
|
||||
setTitle(tr::lng_export_suggest_title());
|
||||
|
||||
addButton(langFactory(lng_box_ok), [=] {
|
||||
addButton(tr::lng_box_ok(), [=] {
|
||||
closeBox();
|
||||
Auth().data().startExport(Local::ReadExportSettings().singlePeer);
|
||||
});
|
||||
addButton(langFactory(lng_export_suggest_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_export_suggest_cancel(), [=] { closeBox(); });
|
||||
setCloseByOutsideClick(false);
|
||||
|
||||
const auto content = Ui::CreateChild<Ui::FlatLabel>(
|
||||
|
|
|
@ -257,7 +257,7 @@ ProgressWidget::ProgressWidget(
|
|||
|
||||
_cancel = base::make_unique_q<Ui::RoundButton>(
|
||||
this,
|
||||
langFactory(lng_export_stop),
|
||||
tr::lng_export_stop(),
|
||||
st::exportCancelButton);
|
||||
setupBottomButton(_cancel.get());
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ void ProgressWidget::showDone() {
|
|||
_about->setText(lang(lng_export_about_done));
|
||||
_done = base::make_unique_q<Ui::RoundButton>(
|
||||
this,
|
||||
langFactory(lng_export_done),
|
||||
tr::lng_export_done(),
|
||||
st::exportDoneButton);
|
||||
const auto desired = std::min(
|
||||
st::exportDoneButton.font->width(lang(lng_export_done).toUpper())
|
||||
|
|
|
@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/fade_wrap.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "platform/platform_specific.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "boxes/calendar_box.h"
|
||||
|
@ -246,30 +247,24 @@ void SettingsWidget::setupPathAndFormat(
|
|||
void SettingsWidget::addLocationLabel(
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
#ifndef OS_MAC_STORE
|
||||
auto pathLabel = value() | rpl::map([](const Settings &data) {
|
||||
auto pathLink = value() | rpl::map([](const Settings &data) {
|
||||
return data.path;
|
||||
}) | rpl::distinct_until_changed(
|
||||
) | rpl::map([](const QString &path) {
|
||||
const auto text = IsDefaultPath(path)
|
||||
? QString("Downloads/Telegram Desktop")
|
||||
: path;
|
||||
auto pathLink = TextWithEntities{
|
||||
return Ui::Text::Link(
|
||||
QDir::toNativeSeparators(text),
|
||||
EntitiesInText()
|
||||
};
|
||||
pathLink.entities.push_back({
|
||||
EntityType::CustomUrl,
|
||||
0,
|
||||
text.size(),
|
||||
QString("internal:edit_export_path") });
|
||||
return lng_export_option_location__rich(
|
||||
lt_path,
|
||||
pathLink);
|
||||
QString("internal:edit_export_path"));
|
||||
});
|
||||
const auto label = container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
std::move(pathLabel),
|
||||
tr::lng_export_option_location(
|
||||
lt_path,
|
||||
std::move(pathLink),
|
||||
Ui::Text::WithEntities),
|
||||
st::exportLocationLabel),
|
||||
st::exportLocationPadding);
|
||||
label->setClickHandlerFilter([=](auto&&...) {
|
||||
|
@ -281,40 +276,40 @@ void SettingsWidget::addLocationLabel(
|
|||
|
||||
void SettingsWidget::addLimitsLabel(
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
auto pathLabel = value() | rpl::map([](const Settings &data) {
|
||||
return std::make_tuple(data.singlePeerFrom, data.singlePeerTill);
|
||||
auto fromLink = value() | rpl::map([](const Settings &data) {
|
||||
return data.singlePeerFrom;
|
||||
}) | rpl::distinct_until_changed(
|
||||
) | rpl::map([](TimeId from, TimeId till) {
|
||||
const auto begin = from
|
||||
? langDayOfMonthFull(ParseDateTime(from).date())
|
||||
: lang(lng_export_beginning);
|
||||
const auto end = till
|
||||
? langDayOfMonthFull(ParseDateTime(till).date())
|
||||
: lang(lng_export_end);
|
||||
auto fromLink = TextWithEntities{ begin };
|
||||
fromLink.entities.push_back({
|
||||
EntityType::CustomUrl,
|
||||
0,
|
||||
begin.size(),
|
||||
QString("internal:edit_from") });
|
||||
auto tillLink = TextWithEntities{ end };
|
||||
tillLink.entities.push_back({
|
||||
EntityType::CustomUrl,
|
||||
0,
|
||||
end.size(),
|
||||
QString("internal:edit_till") });
|
||||
return lng_export_limits__rich(
|
||||
lt_from,
|
||||
fromLink,
|
||||
lt_till,
|
||||
tillLink);
|
||||
}) | rpl::after_next([=] {
|
||||
) | rpl::map([](TimeId from) {
|
||||
return (from
|
||||
? rpl::single(langDayOfMonthFull(ParseDateTime(from).date()))
|
||||
: tr::lng_export_beginning()
|
||||
) | Ui::Text::ToLink(qsl("internal:edit_from"));
|
||||
}) | rpl::flatten_latest();
|
||||
|
||||
auto tillLink = value() | rpl::map([](const Settings &data) {
|
||||
return data.singlePeerTill;
|
||||
}) | rpl::distinct_until_changed(
|
||||
) | rpl::map([](TimeId till) {
|
||||
return (till
|
||||
? rpl::single(langDayOfMonthFull(ParseDateTime(till).date()))
|
||||
: tr::lng_export_end()
|
||||
) | Ui::Text::ToLink(qsl("internal:edit_till"));
|
||||
}) | rpl::flatten_latest();
|
||||
|
||||
auto datesText = tr::lng_export_limits(
|
||||
lt_from,
|
||||
std::move(fromLink),
|
||||
lt_till,
|
||||
std::move(tillLink),
|
||||
Ui::Text::WithEntities
|
||||
) | rpl::after_next([=] {
|
||||
container->resizeToWidth(container->width());
|
||||
});
|
||||
|
||||
const auto label = container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
std::move(pathLabel),
|
||||
std::move(datesText),
|
||||
st::exportLocationLabel),
|
||||
st::exportLimitsPadding);
|
||||
label->setClickHandlerFilter([=](
|
||||
|
@ -331,7 +326,7 @@ void SettingsWidget::addLimitsLabel(
|
|||
readData().singlePeerFrom,
|
||||
0,
|
||||
readData().singlePeerTill,
|
||||
lng_export_from_beginning,
|
||||
tr::lng_export_from_beginning(),
|
||||
done);
|
||||
} else if (url == qstr("internal:edit_till")) {
|
||||
const auto done = [=](TimeId limit) {
|
||||
|
@ -343,7 +338,7 @@ void SettingsWidget::addLimitsLabel(
|
|||
readData().singlePeerTill,
|
||||
readData().singlePeerFrom,
|
||||
0,
|
||||
lng_export_till_end,
|
||||
tr::lng_export_till_end(),
|
||||
done);
|
||||
} else {
|
||||
Unexpected("Click handler URL in export limits edit.");
|
||||
|
@ -357,7 +352,7 @@ void SettingsWidget::editDateLimit(
|
|||
TimeId current,
|
||||
TimeId min,
|
||||
TimeId max,
|
||||
LangKey resetLabel,
|
||||
rpl::producer<QString> resetLabel,
|
||||
Fn<void(TimeId)> done) {
|
||||
Expects(_showBoxCallback != nullptr);
|
||||
|
||||
|
@ -377,7 +372,7 @@ void SettingsWidget::editDateLimit(
|
|||
box->setMinDate(min
|
||||
? ParseDateTime(min).date()
|
||||
: QDate(2013, 8, 1)); // Telegram was launched in August 2013 :)
|
||||
box->addLeftButton(langFactory(resetLabel), crl::guard(this, [=] {
|
||||
box->addLeftButton(std::move(resetLabel), crl::guard(this, [=] {
|
||||
done(0);
|
||||
if (const auto weak = shared->data()) {
|
||||
weak->closeBox();
|
||||
|
@ -632,7 +627,7 @@ void SettingsWidget::refreshButtons(
|
|||
const auto start = canStart
|
||||
? Ui::CreateChild<Ui::RoundButton>(
|
||||
container.get(),
|
||||
langFactory(lng_export_start),
|
||||
tr::lng_export_start(),
|
||||
st::defaultBoxButton)
|
||||
: nullptr;
|
||||
if (start) {
|
||||
|
@ -652,7 +647,7 @@ void SettingsWidget::refreshButtons(
|
|||
|
||||
const auto cancel = Ui::CreateChild<Ui::RoundButton>(
|
||||
container.get(),
|
||||
langFactory(lng_cancel),
|
||||
tr::lng_cancel(),
|
||||
st::defaultBoxButton);
|
||||
cancel->show();
|
||||
_cancelClicks = cancel->clicks(
|
||||
|
|
|
@ -88,7 +88,7 @@ private:
|
|||
TimeId current,
|
||||
TimeId min,
|
||||
TimeId max,
|
||||
LangKey resetLabel,
|
||||
rpl::producer<QString> resetLabel,
|
||||
Fn<void(TimeId)> done);
|
||||
|
||||
const Settings &readData() const;
|
||||
|
|
|
@ -396,13 +396,13 @@ void FilterBox::prepare() {
|
|||
void FilterBox::refreshButtons() {
|
||||
clearButtons();
|
||||
if (_inner->canSave()) {
|
||||
addButton(langFactory(lng_settings_save), [this] {
|
||||
addButton(tr::lng_settings_save(), [this] {
|
||||
if (_saveCallback) {
|
||||
_saveCallback(_inner->filter());
|
||||
}
|
||||
});
|
||||
}
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
}
|
||||
|
||||
void FilterBox::resizeToContent() {
|
||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_user.h"
|
||||
#include "data/data_session.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "boxes/sticker_set_box.h"
|
||||
#include "core/application.h"
|
||||
#include "auth_session.h"
|
||||
|
@ -134,7 +135,7 @@ TextWithEntities GenerateAdminChangeText(
|
|||
|
||||
auto newFlags = newRights ? newRights->c_chatAdminRights().vflags.v : MTPDchatAdminRights::Flags(0);
|
||||
auto prevFlags = prevRights ? prevRights->c_chatAdminRights().vflags.v : MTPDchatAdminRights::Flags(0);
|
||||
auto result = lng_admin_log_promoted__rich(lt_user, user);
|
||||
auto result = tr::lng_admin_log_promoted(tr::now, lt_user, user, Ui::Text::WithEntities);
|
||||
|
||||
auto useInviteLinkPhrase = channel->isMegagroup() && channel->anyoneCanAddMembers();
|
||||
auto invitePhrase = (useInviteLinkPhrase ? lng_admin_log_admin_invite_link : lng_admin_log_admin_invite_users);
|
||||
|
@ -202,18 +203,21 @@ TextWithEntities GenerateBannedChangeText(
|
|||
auto newUntil = newRights ? newRights->c_chatBannedRights().vuntil_date.v : TimeId(0);
|
||||
auto indefinitely = ChannelData::IsRestrictedForever(newUntil);
|
||||
if (newFlags & Flag::f_view_messages) {
|
||||
return lng_admin_log_banned__rich(lt_user, user);
|
||||
return tr::lng_admin_log_banned(tr::now, lt_user, user, Ui::Text::WithEntities);
|
||||
}
|
||||
auto untilText = indefinitely
|
||||
? lang(lng_admin_log_restricted_forever)
|
||||
: lng_admin_log_restricted_until(
|
||||
? tr::lng_admin_log_restricted_forever(tr::now)
|
||||
: tr::lng_admin_log_restricted_until(
|
||||
tr::now,
|
||||
lt_date,
|
||||
langDateTime(ParseDateTime(newUntil)));
|
||||
auto result = lng_admin_log_restricted__rich(
|
||||
auto result = tr::lng_admin_log_restricted(
|
||||
tr::now,
|
||||
lt_user,
|
||||
user,
|
||||
lt_until,
|
||||
TextWithEntities { untilText });
|
||||
TextWithEntities { untilText },
|
||||
Ui::Text::WithEntities);
|
||||
const auto changes = GenerateBannedChangeText(newRights, prevRights);
|
||||
if (!changes.isEmpty()) {
|
||||
result.text.append('\n' + changes);
|
||||
|
@ -242,7 +246,13 @@ auto GenerateUserString(MTPint userId) {
|
|||
EntityType::Mention,
|
||||
0,
|
||||
mention.text.size() });
|
||||
return lng_admin_log_user_with_username__rich(lt_name, name, lt_mention, mention);
|
||||
return tr::lng_admin_log_user_with_username(
|
||||
tr::now,
|
||||
lt_name,
|
||||
name,
|
||||
lt_mention,
|
||||
mention,
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
|
||||
auto GenerateParticipantChangeTextInner(
|
||||
|
@ -252,9 +262,11 @@ auto GenerateParticipantChangeTextInner(
|
|||
const auto oldType = oldParticipant ? oldParticipant->type() : 0;
|
||||
return participant.match([&](const MTPDchannelParticipantCreator &data) {
|
||||
// No valid string here :(
|
||||
return lng_admin_log_invited__rich(
|
||||
return tr::lng_admin_log_invited(
|
||||
tr::now,
|
||||
lt_user,
|
||||
GenerateUserString(data.vuser_id));
|
||||
GenerateUserString(data.vuser_id),
|
||||
Ui::Text::WithEntities);
|
||||
}, [&](const MTPDchannelParticipantAdmin &data) {
|
||||
auto user = GenerateUserString(data.vuser_id);
|
||||
return GenerateAdminChangeText(
|
||||
|
@ -286,7 +298,7 @@ auto GenerateParticipantChangeTextInner(
|
|||
nullptr,
|
||||
&oldParticipant->c_channelParticipantBanned().vbanned_rights);
|
||||
}
|
||||
return lng_admin_log_invited__rich(lt_user, user);
|
||||
return tr::lng_admin_log_invited(tr::now, lt_user, user, Ui::Text::WithEntities);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ FixedBar::FixedBar(
|
|||
, _backButton(this, lang(lng_admin_log_title_all))
|
||||
, _search(this, st::topBarSearch)
|
||||
, _cancel(this, st::historyAdminLogCancelSearch)
|
||||
, _filter(this, langFactory(lng_admin_log_filter), st::topBarButton) {
|
||||
, _filter(this, tr::lng_admin_log_filter(), st::topBarButton) {
|
||||
_backButton->moveToLeft(0, 0);
|
||||
_backButton->setClickedCallback([=] { goBack(); });
|
||||
_filter->setClickedCallback([=] { showFilterSignal.notify(); });
|
||||
|
|
|
@ -49,9 +49,9 @@ TopBarWidget::TopBarWidget(
|
|||
not_null<Window::SessionController*> controller)
|
||||
: RpWidget(parent)
|
||||
, _controller(controller)
|
||||
, _clear(this, langFactory(lng_selected_clear), st::topBarClearButton)
|
||||
, _forward(this, langFactory(lng_selected_forward), st::defaultActiveButton)
|
||||
, _delete(this, langFactory(lng_selected_delete), st::defaultActiveButton)
|
||||
, _clear(this, tr::lng_selected_clear(), st::topBarClearButton)
|
||||
, _forward(this, tr::lng_selected_forward(), st::defaultActiveButton)
|
||||
, _delete(this, tr::lng_selected_delete(), st::defaultActiveButton)
|
||||
, _back(this, st::historyTopBarBack)
|
||||
, _call(this, st::topBarCall)
|
||||
, _search(this, st::topBarSearch)
|
||||
|
|
|
@ -243,8 +243,7 @@ object_ptr<InnerWidget::ListWidget> InnerWidget::setupList(
|
|||
void InnerWidget::peerListSetTitle(rpl::producer<QString> title) {
|
||||
}
|
||||
|
||||
void InnerWidget::peerListSetAdditionalTitle(
|
||||
Fn<QString()> title) {
|
||||
void InnerWidget::peerListSetAdditionalTitle(rpl::producer<QString> title) {
|
||||
}
|
||||
|
||||
bool InnerWidget::peerListIsRowSelected(not_null<PeerData*> peer) {
|
||||
|
|
|
@ -49,8 +49,7 @@ private:
|
|||
|
||||
// PeerListContentDelegate interface.
|
||||
void peerListSetTitle(rpl::producer<QString> title) override;
|
||||
void peerListSetAdditionalTitle(
|
||||
Fn<QString()> title) override;
|
||||
void peerListSetAdditionalTitle(rpl::producer<QString> title) override;
|
||||
bool peerListIsRowSelected(not_null<PeerData*> peer) override;
|
||||
int peerListSelectedRowsCount() override;
|
||||
std::vector<not_null<PeerData*>> peerListCollectSelectedRows() override;
|
||||
|
|
|
@ -412,8 +412,7 @@ void Members::visibleTopBottomUpdated(
|
|||
void Members::peerListSetTitle(rpl::producer<QString> title) {
|
||||
}
|
||||
|
||||
void Members::peerListSetAdditionalTitle(
|
||||
Fn<QString()> title) {
|
||||
void Members::peerListSetAdditionalTitle(rpl::producer<QString> title) {
|
||||
}
|
||||
|
||||
bool Members::peerListIsRowSelected(not_null<PeerData*> peer) {
|
||||
|
|
|
@ -60,8 +60,7 @@ private:
|
|||
|
||||
// PeerListContentDelegate interface.
|
||||
void peerListSetTitle(rpl::producer<QString> title) override;
|
||||
void peerListSetAdditionalTitle(
|
||||
Fn<QString()> title) override;
|
||||
void peerListSetAdditionalTitle(rpl::producer<QString> title) override;
|
||||
bool peerListIsRowSelected(not_null<PeerData*> peer) override;
|
||||
int peerListSelectedRowsCount() override;
|
||||
std::vector<not_null<PeerData*>> peerListCollectSelectedRows() override;
|
||||
|
|
|
@ -428,15 +428,14 @@ void Inner::refreshSwitchPmButton(const CacheEntry *entry) {
|
|||
_switchPmStartToken.clear();
|
||||
} else {
|
||||
if (!_switchPmButton) {
|
||||
_switchPmButton.create(this, Fn<QString()>(), st::switchPmButton);
|
||||
_switchPmButton.create(this, nullptr, st::switchPmButton);
|
||||
_switchPmButton->show();
|
||||
_switchPmButton->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||
connect(_switchPmButton, SIGNAL(clicked()), this, SLOT(onSwitchPm()));
|
||||
}
|
||||
auto text = entry->switchPmText;
|
||||
_switchPmButton->setText([text] { return text; }); // doesn't perform text.toUpper()
|
||||
_switchPmButton->setText(rpl::single(entry->switchPmText));
|
||||
_switchPmStartToken = entry->switchPmStartToken;
|
||||
auto buttonTop = st::stickerPanPadding;
|
||||
const auto buttonTop = st::stickerPanPadding;
|
||||
_switchPmButton->move(st::inlineResultsLeft - st::buttonRadius, buttonTop);
|
||||
if (isRestrictedView()) {
|
||||
_switchPmButton->hide();
|
||||
|
|
|
@ -91,7 +91,7 @@ CodeWidget::CodeWidget(QWidget *parent, Widget::Data *data) : Step(parent, data)
|
|||
_code->setDigitsCountMax(getData()->codeLength);
|
||||
setErrorBelowLink(true);
|
||||
|
||||
setTitleText([text = App::formatPhone(getData()->phone)] { return text; });
|
||||
setTitleText(rpl::single(App::formatPhone(getData()->phone)));
|
||||
updateDescText();
|
||||
}
|
||||
|
||||
|
@ -103,10 +103,9 @@ void CodeWidget::refreshLang() {
|
|||
|
||||
void CodeWidget::updateDescText() {
|
||||
const auto byTelegram = getData()->codeByTelegram;
|
||||
setDescriptionText([=] {
|
||||
return Ui::Text::RichLangValue(
|
||||
lang(byTelegram ? lng_code_from_telegram : lng_code_desc));
|
||||
});
|
||||
setDescriptionText(
|
||||
(byTelegram ? tr::lng_code_from_telegram : tr::lng_code_desc)(
|
||||
Ui::Text::RichLangValue));
|
||||
if (getData()->codeByTelegram) {
|
||||
_noTelegramCode->show();
|
||||
_callTimer->stop();
|
||||
|
@ -155,9 +154,9 @@ void CodeWidget::updateControlsGeometry() {
|
|||
_callLabel->moveToLeft(contentLeft() + st::buttonRadius, linkTop);
|
||||
}
|
||||
|
||||
void CodeWidget::showCodeError(Fn<QString()> textFactory) {
|
||||
if (textFactory) _code->showError();
|
||||
showError(std::move(textFactory));
|
||||
void CodeWidget::showCodeError(rpl::producer<QString> text) {
|
||||
_code->showError();
|
||||
showError(std::move(text));
|
||||
}
|
||||
|
||||
void CodeWidget::setInnerFocus() {
|
||||
|
@ -217,7 +216,7 @@ void CodeWidget::codeSubmitDone(const MTPauth_Authorization &result) {
|
|||
_sentRequest = 0;
|
||||
auto &d = result.c_auth_authorization();
|
||||
if (d.vuser.type() != mtpc_user || !d.vuser.c_user().is_self()) { // wtf?
|
||||
showCodeError(&Lang::Hard::ServerError);
|
||||
showCodeError(rpl::single(Lang::Hard::ServerError()));
|
||||
return;
|
||||
}
|
||||
cSetLoggedPhoneNumber(getData()->phone);
|
||||
|
@ -228,7 +227,7 @@ bool CodeWidget::codeSubmitFail(const RPCError &error) {
|
|||
if (MTP::isFloodError(error)) {
|
||||
stopCheck();
|
||||
_sentRequest = 0;
|
||||
showCodeError(langFactory(lng_flood_error));
|
||||
showCodeError(tr::lng_flood_error());
|
||||
return true;
|
||||
}
|
||||
if (MTP::isDefaultHandledError(error)) return false;
|
||||
|
@ -242,7 +241,7 @@ bool CodeWidget::codeSubmitFail(const RPCError &error) {
|
|||
goBack();
|
||||
return true;
|
||||
} else if (err == qstr("PHONE_CODE_EMPTY") || err == qstr("PHONE_CODE_INVALID")) {
|
||||
showCodeError(langFactory(lng_bad_code));
|
||||
showCodeError(tr::lng_bad_code());
|
||||
return true;
|
||||
} else if (err == qstr("PHONE_NUMBER_UNOCCUPIED")) { // success, need to signUp
|
||||
getData()->code = _sentCode;
|
||||
|
@ -255,10 +254,9 @@ bool CodeWidget::codeSubmitFail(const RPCError &error) {
|
|||
return true;
|
||||
}
|
||||
if (Logs::DebugEnabled()) { // internal server error
|
||||
auto text = err + ": " + error.description();
|
||||
showCodeError([text] { return text; });
|
||||
showCodeError(rpl::single(err + ": " + error.description()));
|
||||
} else {
|
||||
showCodeError(&Lang::Hard::ServerError);
|
||||
showCodeError(rpl::single(Lang::Hard::ServerError()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -358,7 +356,7 @@ void CodeWidget::noTelegramCodeDone(const MTPauth_SentCode &result) {
|
|||
_noTelegramCodeRequestId = 0;
|
||||
|
||||
if (result.type() != mtpc_auth_sentCode) {
|
||||
showCodeError(&Lang::Hard::ServerError);
|
||||
showCodeError(rpl::single(Lang::Hard::ServerError()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -379,7 +377,7 @@ void CodeWidget::noTelegramCodeDone(const MTPauth_SentCode &result) {
|
|||
bool CodeWidget::noTelegramCodeFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
_noTelegramCodeRequestId = 0;
|
||||
showCodeError(langFactory(lng_flood_error));
|
||||
showCodeError(tr::lng_flood_error());
|
||||
return true;
|
||||
}
|
||||
if (MTP::isDefaultHandledError(error)) {
|
||||
|
@ -388,10 +386,9 @@ bool CodeWidget::noTelegramCodeFail(const RPCError &error) {
|
|||
|
||||
_noTelegramCodeRequestId = 0;
|
||||
if (Logs::DebugEnabled()) { // internal server error
|
||||
auto text = error.type() + ": " + error.description();
|
||||
showCodeError([text] { return text; });
|
||||
showCodeError(rpl::single(error.type() + ": " + error.description()));
|
||||
} else {
|
||||
showCodeError(&Lang::Hard::ServerError);
|
||||
showCodeError(rpl::single(Lang::Hard::ServerError()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ private:
|
|||
void codeSubmitDone(const MTPauth_Authorization &result);
|
||||
bool codeSubmitFail(const RPCError &error);
|
||||
|
||||
void showCodeError(Fn<QString()> textFactory);
|
||||
void showCodeError(rpl::producer<QString> text);
|
||||
void callDone(const MTPauth_SentCode &v);
|
||||
void gotPassword(const MTPaccount_Password &result);
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ PhoneWidget::PhoneWidget(QWidget *parent, Widget::Data *data) : Step(parent, dat
|
|||
connect(_code, SIGNAL(changed()), this, SLOT(onInputChange()));
|
||||
connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));
|
||||
|
||||
setTitleText(langFactory(lng_phone_title));
|
||||
setDescriptionText(langFactory(lng_phone_desc));
|
||||
setTitleText(tr::lng_phone_title());
|
||||
setDescriptionText(tr::lng_phone_desc());
|
||||
subscribe(getData()->updated, [this] { countryChanged(); });
|
||||
setErrorCentered(true);
|
||||
|
||||
|
@ -72,9 +72,9 @@ void PhoneWidget::updateSignupGeometry() {
|
|||
}
|
||||
}
|
||||
|
||||
void PhoneWidget::showPhoneError(Fn<QString()> textFactory) {
|
||||
void PhoneWidget::showPhoneError(rpl::producer<QString> text) {
|
||||
_phone->showError();
|
||||
showError(std::move(textFactory));
|
||||
showError(std::move(text));
|
||||
}
|
||||
|
||||
void PhoneWidget::hidePhoneError() {
|
||||
|
@ -101,7 +101,7 @@ void PhoneWidget::submit() {
|
|||
|
||||
const auto phone = fullNumber();
|
||||
if (!AllowPhoneAttempt(phone)) {
|
||||
showPhoneError(langFactory(lng_bad_phone));
|
||||
showPhoneError(tr::lng_bad_phone());
|
||||
_phone->setFocus();
|
||||
return;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ void PhoneWidget::phoneSubmitDone(const MTPauth_SentCode &result) {
|
|||
_sentRequest = 0;
|
||||
|
||||
if (result.type() != mtpc_auth_sentCode) {
|
||||
showPhoneError(&Lang::Hard::ServerError);
|
||||
showPhoneError(rpl::single(Lang::Hard::ServerError()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ bool PhoneWidget::phoneSubmitFail(const RPCError &error) {
|
|||
if (MTP::isFloodError(error)) {
|
||||
stopCheck();
|
||||
_sentRequest = 0;
|
||||
showPhoneError(langFactory(lng_flood_error));
|
||||
showPhoneError(tr::lng_flood_error());
|
||||
return true;
|
||||
}
|
||||
if (MTP::isDefaultHandledError(error)) return false;
|
||||
|
@ -181,17 +181,16 @@ bool PhoneWidget::phoneSubmitFail(const RPCError &error) {
|
|||
Ui::show(Box<InformBox>(lang(lng_error_phone_flood)));
|
||||
return true;
|
||||
} else if (err == qstr("PHONE_NUMBER_INVALID")) { // show error
|
||||
showPhoneError(langFactory(lng_bad_phone));
|
||||
showPhoneError(tr::lng_bad_phone());
|
||||
return true;
|
||||
} else if (err == qstr("PHONE_NUMBER_BANNED")) {
|
||||
ShowPhoneBannedError(_sentPhone);
|
||||
return true;
|
||||
}
|
||||
if (Logs::DebugEnabled()) { // internal server error
|
||||
auto text = err + ": " + error.description();
|
||||
showPhoneError([text] { return text; });
|
||||
showPhoneError(rpl::single(err + ": " + error.description()));
|
||||
} else {
|
||||
showPhoneError(&Lang::Hard::ServerError);
|
||||
showPhoneError(rpl::single(Lang::Hard::ServerError()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ private:
|
|||
QString fullNumber() const;
|
||||
void stopCheck();
|
||||
|
||||
void showPhoneError(Fn<QString()> textFactory);
|
||||
void showPhoneError(rpl::producer<QString> text);
|
||||
void hidePhoneError();
|
||||
|
||||
bool _changed = false;
|
||||
|
|
|
@ -45,7 +45,7 @@ PwdCheckWidget::PwdCheckWidget(
|
|||
connect(_pwdField, SIGNAL(changed()), this, SLOT(onInputChange()));
|
||||
connect(_codeField, SIGNAL(changed()), this, SLOT(onInputChange()));
|
||||
|
||||
setTitleText(langFactory(lng_signin_title));
|
||||
setTitleText(tr::lng_signin_title());
|
||||
updateDescriptionText();
|
||||
setErrorBelowLink(true);
|
||||
|
||||
|
@ -130,7 +130,7 @@ void PwdCheckWidget::pwdSubmitDone(bool recover, const MTPauth_Authorization &re
|
|||
}
|
||||
auto &d = result.c_auth_authorization();
|
||||
if (d.vuser.type() != mtpc_user || !d.vuser.c_user().is_self()) { // wtf?
|
||||
showError(&Lang::Hard::ServerError);
|
||||
showError(rpl::single(Lang::Hard::ServerError()));
|
||||
return;
|
||||
}
|
||||
finish(d.vuser);
|
||||
|
@ -140,7 +140,7 @@ void PwdCheckWidget::pwdSubmitFail(const RPCError &error) {
|
|||
if (MTP::isFloodError(error)) {
|
||||
_sentRequest = 0;
|
||||
stopCheck();
|
||||
showError(langFactory(lng_flood_error));
|
||||
showError(tr::lng_flood_error());
|
||||
_pwdField->showError();
|
||||
return;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ void PwdCheckWidget::pwdSubmitFail(const RPCError &error) {
|
|||
const auto &type = error.type();
|
||||
if (type == qstr("PASSWORD_HASH_INVALID")
|
||||
|| type == qstr("SRP_PASSWORD_CHANGED")) {
|
||||
showError(langFactory(lng_signin_bad_password));
|
||||
showError(tr::lng_signin_bad_password());
|
||||
_pwdField->selectAll();
|
||||
_pwdField->showError();
|
||||
} else if (type == qstr("PASSWORD_EMPTY")
|
||||
|
@ -160,10 +160,9 @@ void PwdCheckWidget::pwdSubmitFail(const RPCError &error) {
|
|||
handleSrpIdInvalid();
|
||||
} else {
|
||||
if (Logs::DebugEnabled()) { // internal server error
|
||||
const auto text = type + ": " + error.description();
|
||||
showError([=] { return text; });
|
||||
showError(rpl::single(type + ": " + error.description()));
|
||||
} else {
|
||||
showError(&Lang::Hard::ServerError);
|
||||
showError(rpl::single(Lang::Hard::ServerError()));
|
||||
}
|
||||
_pwdField->setFocus();
|
||||
}
|
||||
|
@ -174,7 +173,7 @@ void PwdCheckWidget::handleSrpIdInvalid() {
|
|||
if (_lastSrpIdInvalidTime > 0
|
||||
&& now - _lastSrpIdInvalidTime < Core::kHandleSrpIdInvalidTimeout) {
|
||||
_request.id = 0;
|
||||
showError(&Lang::Hard::ServerError);
|
||||
showError(rpl::single(Lang::Hard::ServerError()));
|
||||
} else {
|
||||
_lastSrpIdInvalidTime = now;
|
||||
requestPasswordData();
|
||||
|
@ -223,12 +222,12 @@ void PwdCheckWidget::passwordChecked() {
|
|||
}
|
||||
|
||||
void PwdCheckWidget::serverError() {
|
||||
showError(&Lang::Hard::ServerError);
|
||||
showError(rpl::single(Lang::Hard::ServerError()));
|
||||
}
|
||||
|
||||
void PwdCheckWidget::codeSubmitFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
showError(langFactory(lng_flood_error));
|
||||
showError(tr::lng_flood_error());
|
||||
_codeField->showError();
|
||||
return;
|
||||
}
|
||||
|
@ -245,15 +244,14 @@ void PwdCheckWidget::codeSubmitFail(const RPCError &error) {
|
|||
_emailPattern = QString();
|
||||
onToPassword();
|
||||
} else if (type == qstr("CODE_INVALID")) {
|
||||
showError(langFactory(lng_signin_wrong_code));
|
||||
showError(tr::lng_signin_wrong_code());
|
||||
_codeField->selectAll();
|
||||
_codeField->showError();
|
||||
} else {
|
||||
if (Logs::DebugEnabled()) { // internal server error
|
||||
const auto text = type + ": " + error.description();
|
||||
showError([=] { return text; });
|
||||
showError(rpl::single(type + ": " + error.description()));
|
||||
} else {
|
||||
showError(&Lang::Hard::ServerError);
|
||||
showError(rpl::single(Lang::Hard::ServerError()));
|
||||
}
|
||||
_codeField->setFocus();
|
||||
}
|
||||
|
@ -326,9 +324,9 @@ void PwdCheckWidget::showReset() {
|
|||
void PwdCheckWidget::updateDescriptionText() {
|
||||
auto pwdHidden = _pwdField->isHidden();
|
||||
auto emailPattern = _emailPattern;
|
||||
setDescriptionText([=] {
|
||||
return pwdHidden ? lng_signin_recover_desc(lt_email, emailPattern) : lang(lng_signin_desc);
|
||||
});
|
||||
setDescriptionText(pwdHidden
|
||||
? tr::lng_signin_recover_desc(lt_email, rpl::single(emailPattern))
|
||||
: tr::lng_signin_desc());
|
||||
}
|
||||
|
||||
void PwdCheckWidget::onInputChange() {
|
||||
|
@ -379,8 +377,8 @@ void PwdCheckWidget::submit() {
|
|||
}
|
||||
}
|
||||
|
||||
QString PwdCheckWidget::nextButtonText() const {
|
||||
return lang(lng_intro_submit);
|
||||
rpl::producer<QString> PwdCheckWidget::nextButtonText() const {
|
||||
return tr::lng_intro_submit();
|
||||
}
|
||||
|
||||
} // namespace Intro
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
void activate() override;
|
||||
void cancelled() override;
|
||||
void submit() override;
|
||||
QString nextButtonText() const override;
|
||||
rpl::producer<QString> nextButtonText() const override;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
|
|
@ -41,8 +41,8 @@ SignupWidget::SignupWidget(QWidget *parent, Widget::Data *data) : Step(parent, d
|
|||
|
||||
setErrorCentered(true);
|
||||
|
||||
setTitleText(langFactory(lng_signup_title));
|
||||
setDescriptionText(langFactory(lng_signup_desc));
|
||||
setTitleText(tr::lng_signup_title());
|
||||
setDescriptionText(tr::lng_signup_desc());
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ void SignupWidget::nameSubmitDone(const MTPauth_Authorization &result) {
|
|||
stopCheck();
|
||||
auto &d = result.c_auth_authorization();
|
||||
if (d.vuser.type() != mtpc_user || !d.vuser.c_user().is_self()) { // wtf?
|
||||
showError(&Lang::Hard::ServerError);
|
||||
showError(rpl::single(Lang::Hard::ServerError()));
|
||||
return;
|
||||
}
|
||||
finish(d.vuser, _photo->takeResultImage());
|
||||
|
@ -131,7 +131,7 @@ void SignupWidget::nameSubmitDone(const MTPauth_Authorization &result) {
|
|||
bool SignupWidget::nameSubmitFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
stopCheck();
|
||||
showError(langFactory(lng_flood_error));
|
||||
showError(tr::lng_flood_error());
|
||||
if (_invertOrder) {
|
||||
_first->setFocus();
|
||||
} else {
|
||||
|
@ -155,19 +155,18 @@ bool SignupWidget::nameSubmitFail(const RPCError &error) {
|
|||
goBack();
|
||||
return true;
|
||||
} else if (err == "FIRSTNAME_INVALID") {
|
||||
showError(langFactory(lng_bad_name));
|
||||
showError(tr::lng_bad_name());
|
||||
_first->setFocus();
|
||||
return true;
|
||||
} else if (err == "LASTNAME_INVALID") {
|
||||
showError(langFactory(lng_bad_name));
|
||||
showError(tr::lng_bad_name());
|
||||
_last->setFocus();
|
||||
return true;
|
||||
}
|
||||
if (Logs::DebugEnabled()) { // internal server error
|
||||
auto text = err + ": " + error.description();
|
||||
showError([text] { return text; });
|
||||
showError(rpl::single(err + ": " + error.description()));
|
||||
} else {
|
||||
showError(&Lang::Hard::ServerError);
|
||||
showError(rpl::single(Lang::Hard::ServerError()));
|
||||
}
|
||||
if (_invertOrder) {
|
||||
_last->setFocus();
|
||||
|
@ -230,8 +229,8 @@ void SignupWidget::submit() {
|
|||
}
|
||||
}
|
||||
|
||||
QString SignupWidget::nextButtonText() const {
|
||||
return lang(lng_intro_finish);
|
||||
rpl::producer<QString> SignupWidget::nextButtonText() const {
|
||||
return tr::lng_intro_finish();
|
||||
}
|
||||
|
||||
} // namespace Intro
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
void activate() override;
|
||||
void cancelled() override;
|
||||
void submit() override;
|
||||
QString nextButtonText() const override;
|
||||
rpl::producer<QString> nextButtonText() const override;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace Intro {
|
|||
|
||||
StartWidget::StartWidget(QWidget *parent, Widget::Data *data) : Step(parent, data, true) {
|
||||
setMouseTracking(true);
|
||||
setTitleText([] { return qsl("Telegram Desktop"); });
|
||||
setDescriptionText(langFactory(lng_intro_about));
|
||||
setTitleText(rpl::single(qsl("Telegram Desktop")));
|
||||
setDescriptionText(tr::lng_intro_about());
|
||||
show();
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ void StartWidget::submit() {
|
|||
goNext(new Intro::PhoneWidget(parentWidget(), getData()));
|
||||
}
|
||||
|
||||
QString StartWidget::nextButtonText() const {
|
||||
return lang(lng_start_msgs);
|
||||
rpl::producer<QString> StartWidget::nextButtonText() const {
|
||||
return tr::lng_start_msgs();
|
||||
}
|
||||
|
||||
} // namespace Intro
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
StartWidget(QWidget *parent, Widget::Data *data);
|
||||
|
||||
void submit() override;
|
||||
QString nextButtonText() const override;
|
||||
rpl::producer<QString> nextButtonText() const override;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -65,9 +65,9 @@ Widget::Widget(QWidget *parent) : RpWidget(parent)
|
|||
this,
|
||||
object_ptr<Ui::RoundButton>(
|
||||
this,
|
||||
langFactory(lng_menu_settings),
|
||||
tr::lng_menu_settings(),
|
||||
st::defaultBoxButton))
|
||||
, _next(this, Fn<QString()>(), st::introNextButton) {
|
||||
, _next(this, nullptr, st::introNextButton) {
|
||||
auto country = Platform::SystemCountry();
|
||||
if (country.isEmpty()) {
|
||||
country = str_const_toString(kDefaultCountry);
|
||||
|
@ -174,7 +174,7 @@ void Widget::onCheckUpdateStatus() {
|
|||
this,
|
||||
object_ptr<Ui::RoundButton>(
|
||||
this,
|
||||
langFactory(lng_menu_update),
|
||||
tr::lng_menu_update(),
|
||||
st::defaultBoxButton));
|
||||
if (!_a_show.animating()) {
|
||||
_update->setVisible(true);
|
||||
|
@ -241,7 +241,7 @@ void Widget::historyMove(Direction direction) {
|
|||
if (_update) {
|
||||
_update->toggle(!stepHasCover, anim::type::normal);
|
||||
}
|
||||
_next->setText([this] { return getStep()->nextButtonText(); });
|
||||
_next->setText(getStep()->nextButtonText());
|
||||
if (_resetAccount) _resetAccount->show(anim::type::normal);
|
||||
if (_terms) _terms->show(anim::type::normal);
|
||||
if (_changeLanguage) {
|
||||
|
@ -307,7 +307,10 @@ void Widget::appendStep(Step *step) {
|
|||
|
||||
void Widget::showResetButton() {
|
||||
if (!_resetAccount) {
|
||||
auto entity = object_ptr<Ui::RoundButton>(this, langFactory(lng_signin_reset_account), st::introResetButton);
|
||||
auto entity = object_ptr<Ui::RoundButton>(
|
||||
this,
|
||||
tr::lng_signin_reset_account(),
|
||||
st::introResetButton);
|
||||
_resetAccount.create(this, std::move(entity));
|
||||
_resetAccount->hide(anim::type::instant);
|
||||
_resetAccount->entity()->setClickedCallback([this] { resetAccount(); });
|
||||
|
@ -325,9 +328,10 @@ void Widget::showTerms() {
|
|||
} else if (!_terms) {
|
||||
auto entity = object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
rpl::single(lng_terms_signup__rich(
|
||||
tr::lng_terms_signup(
|
||||
lt_link,
|
||||
Ui::Text::Link(lang(lng_terms_signup_link)))),
|
||||
tr::lng_terms_signup_link() | Ui::Text::ToLink(),
|
||||
Ui::Text::WithEntities),
|
||||
st::introTermsLabel);
|
||||
_terms.create(this, std::move(entity));
|
||||
_terms->entity()->setClickHandlerFilter([=](
|
||||
|
@ -385,7 +389,7 @@ void Widget::resetAccount() {
|
|||
Ui::show(Box<InformBox>(lang(lng_signin_reset_cancelled)));
|
||||
} else {
|
||||
Ui::hideLayer();
|
||||
getStep()->showError(&Lang::Hard::ServerError);
|
||||
getStep()->showError(rpl::single(Lang::Hard::ServerError()));
|
||||
}
|
||||
}).send();
|
||||
})));
|
||||
|
@ -415,11 +419,11 @@ void Widget::showTerms(Fn<void()> callback) {
|
|||
const auto box = Ui::show(callback
|
||||
? Box<Window::TermsBox>(
|
||||
getData()->termsLock,
|
||||
langFactory(lng_terms_agree),
|
||||
langFactory(lng_terms_decline))
|
||||
tr::lng_terms_agree(),
|
||||
tr::lng_terms_decline())
|
||||
: Box<Window::TermsBox>(
|
||||
getData()->termsLock.text,
|
||||
langFactory(lng_box_ok),
|
||||
tr::lng_box_ok(),
|
||||
nullptr));
|
||||
|
||||
box->setCloseByEscape(false);
|
||||
|
@ -439,8 +443,8 @@ void Widget::showTerms(Fn<void()> callback) {
|
|||
) | rpl::start_with_next([=] {
|
||||
const auto box = Ui::show(Box<Window::TermsBox>(
|
||||
TextWithEntities{ lang(lng_terms_signup_sorry) },
|
||||
langFactory(lng_intro_finish),
|
||||
langFactory(lng_terms_decline)));
|
||||
tr::lng_intro_finish(),
|
||||
tr::lng_terms_decline()));
|
||||
box->agreeClicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
if (weak) {
|
||||
|
@ -459,7 +463,7 @@ void Widget::showTerms(Fn<void()> callback) {
|
|||
void Widget::showControls() {
|
||||
getStep()->show();
|
||||
_next->show();
|
||||
_next->setText([this] { return getStep()->nextButtonText(); });
|
||||
_next->setText(getStep()->nextButtonText());
|
||||
_connecting->setForceHidden(false);
|
||||
auto hasCover = getStep()->hasCover();
|
||||
_settings->toggle(!hasCover, anim::type::instant);
|
||||
|
@ -605,8 +609,8 @@ Widget::~Widget() {
|
|||
if (App::wnd()) App::wnd()->noIntro(this);
|
||||
}
|
||||
|
||||
QString Widget::Step::nextButtonText() const {
|
||||
return lang(lng_intro_next);
|
||||
rpl::producer<QString> Widget::Step::nextButtonText() const {
|
||||
return tr::lng_intro_next();
|
||||
}
|
||||
|
||||
void Widget::Step::finish(const MTPUser &user, QImage &&photo) {
|
||||
|
@ -673,39 +677,19 @@ void Widget::Step::updateLabelsPosition() {
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::Step::setTitleText(Fn<QString()> titleTextFactory) {
|
||||
_titleTextFactory = std::move(titleTextFactory);
|
||||
refreshTitle();
|
||||
updateLabelsPosition();
|
||||
void Widget::Step::setTitleText(rpl::producer<QString> titleText) {
|
||||
_titleText = std::move(titleText);
|
||||
}
|
||||
|
||||
void Widget::Step::refreshTitle() {
|
||||
_title->setText(_titleTextFactory());
|
||||
void Widget::Step::setDescriptionText(
|
||||
rpl::producer<QString> descriptionText) {
|
||||
setDescriptionText(
|
||||
std::move(descriptionText) | Ui::Text::ToWithEntities());
|
||||
}
|
||||
|
||||
void Widget::Step::setDescriptionText(Fn<QString()> descriptionTextFactory) {
|
||||
_descriptionTextFactory = [=] {
|
||||
return TextWithEntities{ descriptionTextFactory() };
|
||||
};
|
||||
refreshDescription();
|
||||
updateLabelsPosition();
|
||||
}
|
||||
|
||||
void Widget::Step::setDescriptionText(Fn<TextWithEntities()> richDescriptionTextFactory) {
|
||||
_descriptionTextFactory = std::move(richDescriptionTextFactory);
|
||||
refreshDescription();
|
||||
updateLabelsPosition();
|
||||
}
|
||||
|
||||
void Widget::Step::refreshDescription() {
|
||||
_description->entity()->setMarkedText(_descriptionTextFactory());
|
||||
}
|
||||
|
||||
void Widget::Step::refreshLang() {
|
||||
refreshTitle();
|
||||
refreshDescription();
|
||||
refreshError();
|
||||
updateLabelsPosition();
|
||||
void Widget::Step::setDescriptionText(
|
||||
rpl::producer<TextWithEntities> richDescriptionText) {
|
||||
_descriptionText = std::move(richDescriptionText);
|
||||
}
|
||||
|
||||
void Widget::Step::showFinished() {
|
||||
|
@ -886,14 +870,12 @@ void Widget::Step::setErrorBelowLink(bool below) {
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::Step::showError(Fn<QString()> textFactory) {
|
||||
_errorTextFactory = std::move(textFactory);
|
||||
refreshError();
|
||||
updateLabelsPosition();
|
||||
void Widget::Step::showError(rpl::producer<QString> text) {
|
||||
_errorText = std::move(text);
|
||||
}
|
||||
|
||||
void Widget::Step::refreshError() {
|
||||
if (!_errorTextFactory) {
|
||||
void Widget::Step::refreshError(const QString &text) {
|
||||
if (text.isEmpty()) {
|
||||
if (_error) _error->hide(anim::type::normal);
|
||||
} else {
|
||||
if (!_error) {
|
||||
|
@ -906,13 +888,14 @@ void Widget::Step::refreshError() {
|
|||
: st::introError));
|
||||
_error->hide(anim::type::instant);
|
||||
}
|
||||
_error->entity()->setText(_errorTextFactory());
|
||||
_error->entity()->setText(text);
|
||||
updateLabelsPosition();
|
||||
_error->show(anim::type::normal);
|
||||
}
|
||||
}
|
||||
|
||||
Widget::Step::Step(QWidget *parent, Data *data, bool hasCover) : TWidget(parent)
|
||||
Widget::Step::Step(QWidget *parent, Data *data, bool hasCover)
|
||||
: RpWidget(parent)
|
||||
, _data(data)
|
||||
, _hasCover(hasCover)
|
||||
, _title(this, _hasCover ? st::introCoverTitle : st::introTitle)
|
||||
|
@ -933,7 +916,23 @@ Widget::Step::Step(QWidget *parent, Data *data, bool hasCover) : TWidget(parent)
|
|||
}
|
||||
}
|
||||
});
|
||||
subscribe(Lang::Current().updated(), [this] { refreshLang(); });
|
||||
|
||||
_errorText.value(
|
||||
) | rpl::start_with_next([=](const QString &text) {
|
||||
refreshError(text);
|
||||
}, lifetime());
|
||||
|
||||
_titleText.value(
|
||||
) | rpl::start_with_next([=](const QString &text) {
|
||||
_title->setText(text);
|
||||
updateLabelsPosition();
|
||||
}, lifetime());
|
||||
|
||||
_descriptionText.value(
|
||||
) | rpl::start_with_next([=](const TextWithEntities &text) {
|
||||
_description->entity()->setMarkedText(text);
|
||||
updateLabelsPosition();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void Widget::Step::prepareShowAnimated(Step *after) {
|
||||
|
@ -1030,7 +1029,7 @@ bool Widget::Step::hasBack() const {
|
|||
void Widget::Step::activate() {
|
||||
_title->show();
|
||||
_description->show(anim::type::instant);
|
||||
if (_errorTextFactory) {
|
||||
if (!_errorText.current().isEmpty()) {
|
||||
_error->show(anim::type::instant);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
Forward,
|
||||
Replace,
|
||||
};
|
||||
class Step : public TWidget, public RPCSender, protected base::Subscriber {
|
||||
class Step : public Ui::RpWidget, public RPCSender, protected base::Subscriber {
|
||||
public:
|
||||
Step(QWidget *parent, Data *data, bool hasCover = false);
|
||||
|
||||
|
@ -120,16 +120,16 @@ public:
|
|||
virtual void finished();
|
||||
|
||||
virtual void submit() = 0;
|
||||
virtual QString nextButtonText() const;
|
||||
virtual rpl::producer<QString> nextButtonText() const;
|
||||
|
||||
int contentLeft() const;
|
||||
int contentTop() const;
|
||||
|
||||
void setErrorCentered(bool centered);
|
||||
void setErrorBelowLink(bool below);
|
||||
void showError(Fn<QString()> textFactory);
|
||||
void showError(rpl::producer<QString> text);
|
||||
void hideError() {
|
||||
showError(Fn<QString()>());
|
||||
showError(rpl::single(QString()));
|
||||
}
|
||||
|
||||
~Step();
|
||||
|
@ -138,9 +138,10 @@ public:
|
|||
void paintEvent(QPaintEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
void setTitleText(Fn<QString()> titleTextFactory);
|
||||
void setDescriptionText(Fn<QString()> descriptionTextFactory);
|
||||
void setDescriptionText(Fn<TextWithEntities()> richDescriptionTextFactory);
|
||||
void setTitleText(rpl::producer<QString> titleText);
|
||||
void setDescriptionText(rpl::producer<QString> descriptionText);
|
||||
void setDescriptionText(
|
||||
rpl::producer<TextWithEntities> richDescriptionText);
|
||||
bool paintAnimated(Painter &p, QRect clip);
|
||||
|
||||
void fillSentCodeData(const MTPDauth_sentCode &type);
|
||||
|
@ -190,7 +191,7 @@ public:
|
|||
};
|
||||
void updateLabelsPosition();
|
||||
void paintContentSnapshot(Painter &p, const QPixmap &snapshot, float64 alpha, float64 howMuchHidden);
|
||||
void refreshError();
|
||||
void refreshError(const QString &text);
|
||||
void refreshTitle();
|
||||
void refreshDescription();
|
||||
void refreshLang();
|
||||
|
@ -208,17 +209,16 @@ public:
|
|||
Fn<void(Step *step, Direction direction)> _goCallback;
|
||||
Fn<void()> _showResetCallback;
|
||||
Fn<void()> _showTermsCallback;
|
||||
Fn<void(
|
||||
Fn<void()> callback)> _acceptTermsCallback;
|
||||
Fn<void(Fn<void()> callback)> _acceptTermsCallback;
|
||||
|
||||
rpl::variable<QString> _titleText;
|
||||
object_ptr<Ui::FlatLabel> _title;
|
||||
Fn<QString()> _titleTextFactory;
|
||||
rpl::variable<TextWithEntities> _descriptionText;
|
||||
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _description;
|
||||
Fn<TextWithEntities()> _descriptionTextFactory;
|
||||
|
||||
bool _errorCentered = false;
|
||||
bool _errorBelowLink = false;
|
||||
Fn<QString()> _errorTextFactory;
|
||||
rpl::variable<QString> _errorText;
|
||||
object_ptr<Ui::FadeWrap<Ui::FlatLabel>> _error = { nullptr };
|
||||
|
||||
Ui::Animations::Simple _a_show;
|
||||
|
|
|
@ -73,30 +73,31 @@ ConfirmSwitchBox::ConfirmSwitchBox(
|
|||
void ConfirmSwitchBox::prepare() {
|
||||
setTitle(tr::lng_language_switch_title());
|
||||
|
||||
const auto text = (_official
|
||||
? lng_language_switch_about_official__rich
|
||||
: lng_language_switch_about_unofficial__rich)(
|
||||
lt_lang_name,
|
||||
Ui::Text::Bold(_name),
|
||||
lt_percent,
|
||||
Ui::Text::Bold(QString::number(_percent)),
|
||||
lt_link,
|
||||
Ui::Text::Link(lang(lng_language_switch_link), _editLink));
|
||||
auto text = (_official
|
||||
? tr::lng_language_switch_about_official
|
||||
: tr::lng_language_switch_about_unofficial)(
|
||||
lt_lang_name,
|
||||
rpl::single(Ui::Text::Bold(_name)),
|
||||
lt_percent,
|
||||
rpl::single(Ui::Text::Bold(QString::number(_percent))),
|
||||
lt_link,
|
||||
tr::lng_language_switch_link() | Ui::Text::ToLink(_editLink),
|
||||
Ui::Text::WithEntities);
|
||||
const auto content = Ui::CreateChild<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
this,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
rpl::single(text),
|
||||
std::move(text),
|
||||
st::boxLabel),
|
||||
QMargins{ st::boxPadding.left(), 0, st::boxPadding.right(), 0 });
|
||||
content->entity()->setLinksTrusted();
|
||||
|
||||
addButton(langFactory(lng_language_switch_apply), [=] {
|
||||
addButton(tr::lng_language_switch_apply(), [=] {
|
||||
const auto apply = _apply;
|
||||
closeBox();
|
||||
apply();
|
||||
});
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
content->resizeToWidth(st::boxWideWidth);
|
||||
content->heightValue(
|
||||
|
@ -115,21 +116,22 @@ NotReadyBox::NotReadyBox(
|
|||
void NotReadyBox::prepare() {
|
||||
setTitle(tr::lng_language_not_ready_title());
|
||||
|
||||
const auto text = lng_language_not_ready_about__rich(
|
||||
auto text = tr::lng_language_not_ready_about(
|
||||
lt_lang_name,
|
||||
TextWithEntities{ _name },
|
||||
rpl::single(_name) | Ui::Text::ToWithEntities(),
|
||||
lt_link,
|
||||
Ui::Text::Link(lang(lng_language_not_ready_link), _editLink));
|
||||
tr::lng_language_not_ready_link() | Ui::Text::ToLink(_editLink),
|
||||
Ui::Text::WithEntities);
|
||||
const auto content = Ui::CreateChild<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
this,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
rpl::single(text),
|
||||
std::move(text),
|
||||
st::boxLabel),
|
||||
QMargins{ st::boxPadding.left(), 0, st::boxPadding.right(), 0 });
|
||||
content->entity()->setLinksTrusted();
|
||||
|
||||
addButton(langFactory(lng_box_ok), [=] { closeBox(); });
|
||||
addButton(tr::lng_box_ok(), [=] { closeBox(); });
|
||||
|
||||
content->resizeToWidth(st::boxWidth);
|
||||
content->heightValue(
|
||||
|
|
|
@ -14,10 +14,6 @@ inline QString lang(LangKey key) {
|
|||
return Lang::Current().getValue(key);
|
||||
}
|
||||
|
||||
inline Fn<QString()> langFactory(LangKey key) {
|
||||
return [key] { return Lang::Current().getValue(key); };
|
||||
}
|
||||
|
||||
template <typename WithYear, typename WithoutYear>
|
||||
inline QString langDateMaybeWithYear(QDate date, WithYear withYear, WithoutYear withoutYear) {
|
||||
auto month = date.month();
|
||||
|
|
|
@ -236,11 +236,13 @@ OverlayWidget::OverlayWidget()
|
|||
setWindowIcon(Window::CreateIcon(&Core::App().activeAccount()));
|
||||
setWindowTitle(qsl("Media viewer"));
|
||||
|
||||
const auto text = lng_mediaview_saved_to__rich(
|
||||
const auto text = tr::lng_mediaview_saved_to(
|
||||
tr::now,
|
||||
lt_downloads,
|
||||
Ui::Text::Link(
|
||||
lang(lng_mediaview_downloads),
|
||||
"internal:show_saved_message"));
|
||||
tr::lng_mediaview_downloads(tr::now),
|
||||
"internal:show_saved_message"),
|
||||
Ui::Text::WithEntities);
|
||||
_saveMsgText.setMarkedText(st::mediaviewSaveMsgStyle, text, Ui::DialogTextOptions());
|
||||
_saveMsg = QRect(0, 0, _saveMsgText.maxWidth() + st::mediaviewSaveMsgPadding.left() + st::mediaviewSaveMsgPadding.right(), st::mediaviewSaveMsgStyle.font->height + st::mediaviewSaveMsgPadding.top() + st::mediaviewSaveMsgPadding.bottom());
|
||||
|
||||
|
@ -2241,7 +2243,7 @@ void OverlayWidget::initThemePreview() {
|
|||
if (_themePreview) {
|
||||
_themeApply.create(
|
||||
this,
|
||||
langFactory(lng_theme_preview_apply),
|
||||
tr::lng_theme_preview_apply(),
|
||||
st::themePreviewApplyButton);
|
||||
_themeApply->show();
|
||||
_themeApply->setClickedCallback([this] {
|
||||
|
@ -2251,7 +2253,7 @@ void OverlayWidget::initThemePreview() {
|
|||
});
|
||||
_themeCancel.create(
|
||||
this,
|
||||
langFactory(lng_cancel),
|
||||
tr::lng_cancel(),
|
||||
st::themePreviewCancelButton);
|
||||
_themeCancel->show();
|
||||
_themeCancel->setClickedCallback([this] { close(); });
|
||||
|
|
|
@ -187,8 +187,8 @@ void VerifyBox::setInnerFocus() {
|
|||
void VerifyBox::prepare() {
|
||||
setTitle(std::move(_title));
|
||||
|
||||
addButton(langFactory(lng_change_phone_new_submit), _submit);
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_change_phone_new_submit(), _submit);
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
_content->resizeToWidth(st::boxWidth);
|
||||
_content->heightValue(
|
||||
|
@ -214,7 +214,7 @@ PanelEditContact::PanelEditContact(
|
|||
, _bottomShadow(this)
|
||||
, _done(
|
||||
this,
|
||||
langFactory(lng_passport_save_value),
|
||||
tr::lng_passport_save_value(),
|
||||
st::passportPanelSaveValue) {
|
||||
setupControls(data, existing);
|
||||
}
|
||||
|
|
|
@ -89,8 +89,8 @@ RequestTypeBox::RequestTypeBox(
|
|||
|
||||
void RequestTypeBox::prepare() {
|
||||
setTitle(std::move(_title));
|
||||
addButton(langFactory(lng_passport_upload_document), _submit);
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_passport_upload_document(), _submit);
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
setDimensions(st::boxWidth, _height);
|
||||
}
|
||||
|
||||
|
@ -154,8 +154,8 @@ DeleteDocumentBox::DeleteDocumentBox(
|
|||
}
|
||||
|
||||
void DeleteDocumentBox::prepare() {
|
||||
addButton(langFactory(lng_box_delete), _submit);
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_box_delete(), _submit);
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
setDimensions(st::boxWidth, _height);
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ PanelEditDocument::PanelEditDocument(
|
|||
, _bottomShadow(this)
|
||||
, _done(
|
||||
this,
|
||||
langFactory(lng_passport_save_value),
|
||||
tr::lng_passport_save_value(),
|
||||
st::passportPanelSaveValue) {
|
||||
setupControls(
|
||||
&error,
|
||||
|
@ -249,7 +249,7 @@ PanelEditDocument::PanelEditDocument(
|
|||
, _bottomShadow(this)
|
||||
, _done(
|
||||
this,
|
||||
langFactory(lng_passport_save_value),
|
||||
tr::lng_passport_save_value(),
|
||||
st::passportPanelSaveValue) {
|
||||
setupControls(
|
||||
nullptr,
|
||||
|
@ -274,7 +274,7 @@ PanelEditDocument::PanelEditDocument(
|
|||
, _bottomShadow(this)
|
||||
, _done(
|
||||
this,
|
||||
langFactory(lng_passport_save_value),
|
||||
tr::lng_passport_save_value(),
|
||||
st::passportPanelSaveValue) {
|
||||
setupControls(&error, &data, nullptr, nullptr, {}, {}, {});
|
||||
}
|
||||
|
|
|
@ -313,7 +313,7 @@ ScanButton::ScanButton(
|
|||
this,
|
||||
object_ptr<Ui::RoundButton>(
|
||||
this,
|
||||
langFactory(lng_passport_delete_scan_undo),
|
||||
tr::lng_passport_delete_scan_undo(),
|
||||
_st.restore)) {
|
||||
_delete->toggle(!deleted, anim::type::instant);
|
||||
_restore->toggle(deleted, anim::type::instant);
|
||||
|
|
|
@ -177,7 +177,7 @@ PanelForm::PanelForm(
|
|||
, _bottomShadow(this)
|
||||
, _submit(
|
||||
this,
|
||||
langFactory(lng_passport_authorize),
|
||||
tr::lng_passport_authorize(),
|
||||
st::passportPanelAuthorize) {
|
||||
setupControls();
|
||||
}
|
||||
|
@ -292,19 +292,24 @@ not_null<Ui::RpWidget*> PanelForm::setupContent() {
|
|||
});
|
||||
}, lifetime());
|
||||
const auto policyUrl = _controller->privacyPolicyUrl();
|
||||
const auto richText = policyUrl.isEmpty()
|
||||
? TextWithEntities{ lng_passport_allow(lt_bot, '@' + bot->username) }
|
||||
: lng_passport_accept_allow__rich(
|
||||
lt_policy,
|
||||
Ui::Text::Link(
|
||||
lng_passport_policy(lt_bot, App::peerName(bot)),
|
||||
policyUrl),
|
||||
auto text = policyUrl.isEmpty()
|
||||
? tr::lng_passport_allow(
|
||||
lt_bot,
|
||||
TextWithEntities{ '@' + bot->username });
|
||||
rpl::single('@' + bot->username)
|
||||
) | Ui::Text::ToWithEntities()
|
||||
: tr::lng_passport_accept_allow(
|
||||
lt_policy,
|
||||
tr::lng_passport_policy(
|
||||
lt_bot,
|
||||
rpl::single(App::peerName(bot))
|
||||
) | Ui::Text::ToLink(policyUrl),
|
||||
lt_bot,
|
||||
rpl::single('@' + bot->username) | Ui::Text::ToWithEntities(),
|
||||
Ui::Text::WithEntities);
|
||||
const auto policy = inner->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
inner,
|
||||
rpl::single(richText),
|
||||
std::move(text),
|
||||
st::passportFormPolicy),
|
||||
st::passportFormPolicyPadding);
|
||||
policy->setLinksTrusted();
|
||||
|
|
|
@ -45,7 +45,7 @@ PanelAskPassword::PanelAskPassword(
|
|||
this,
|
||||
st::defaultInputField,
|
||||
tr::lng_passport_password_placeholder())
|
||||
, _submit(this, langFactory(lng_passport_next), st::passportPasswordSubmit)
|
||||
, _submit(this, tr::lng_passport_next(), st::passportPasswordSubmit)
|
||||
, _forgot(this, lang(lng_signin_recover), st::defaultLinkButton) {
|
||||
connect(_password, &Ui::PasswordInput::submitted, this, [=] {
|
||||
submit();
|
||||
|
@ -230,7 +230,7 @@ void PanelNoPassword::refreshBottom() {
|
|||
_inner,
|
||||
object_ptr<Ui::RoundButton>(
|
||||
_inner,
|
||||
langFactory(lng_passport_password_create),
|
||||
tr::lng_passport_password_create(),
|
||||
st::defaultBoxButton)));
|
||||
button->entity()->addClickHandler([=] {
|
||||
_controller->setupPassword();
|
||||
|
@ -242,14 +242,14 @@ void PanelNoPassword::refreshBottom() {
|
|||
st::defaultBoxButton.height));
|
||||
const auto cancel = Ui::CreateChild<Ui::RoundButton>(
|
||||
container,
|
||||
langFactory(lng_cancel),
|
||||
tr::lng_cancel(),
|
||||
st::defaultBoxButton);
|
||||
cancel->addClickHandler([=] {
|
||||
_controller->cancelPasswordSubmit();
|
||||
});
|
||||
const auto validate = Ui::CreateChild<Ui::RoundButton>(
|
||||
container,
|
||||
langFactory(lng_passport_email_validate),
|
||||
tr::lng_passport_email_validate(),
|
||||
st::defaultBoxButton);
|
||||
validate->addClickHandler([=] {
|
||||
_controller->validateRecoveryEmail();
|
||||
|
|
|
@ -674,8 +674,8 @@ void MainWindow::createGlobalMenu() {
|
|||
return;
|
||||
}
|
||||
Ui::show(Box<PeerListBox>(std::make_unique<ContactsBoxController>(), [](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_close), [box] { box->closeBox(); });
|
||||
box->addLeftButton(langFactory(lng_profile_add_contact), [] { App::wnd()->onShowAddContact(); });
|
||||
box->addButton(tr::lng_close(), [box] { box->closeBox(); });
|
||||
box->addLeftButton(tr::lng_profile_add_contact(), [] { App::wnd()->onShowAddContact(); });
|
||||
}));
|
||||
}));
|
||||
psAddContact = window->addAction(lang(lng_mac_menu_add_contact), App::wnd(), SLOT(onShowAddContact()));
|
||||
|
|
|
@ -51,7 +51,7 @@ void SetupPhoto(
|
|||
st::settingsInfoPhoto);
|
||||
const auto upload = Ui::CreateChild<Ui::RoundButton>(
|
||||
wrap,
|
||||
langFactory(lng_settings_upload),
|
||||
tr::lng_settings_upload(),
|
||||
st::settingsInfoPhotoSet);
|
||||
upload->setFullRadius(true);
|
||||
upload->addClickHandler([=] {
|
||||
|
|
|
@ -260,7 +260,7 @@ void BlockedBoxController::BlockNewUser() {
|
|||
Auth().api().blockUser(user);
|
||||
box->closeBox();
|
||||
});
|
||||
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
||||
box->addButton(tr::lng_cancel(), [box] { box->closeBox(); });
|
||||
};
|
||||
Ui::show(
|
||||
Box<PeerListBox>(std::move(controller), std::move(initBox)),
|
||||
|
|
|
@ -119,10 +119,10 @@ void SetupPrivacy(not_null<Ui::VerticalLayout*> container) {
|
|||
st::settingsButton
|
||||
)->addClickHandler([] {
|
||||
const auto initBox = [](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_close), [=] {
|
||||
box->addButton(tr::lng_close(), [=] {
|
||||
box->closeBox();
|
||||
});
|
||||
box->addLeftButton(langFactory(lng_blocked_list_add), [] {
|
||||
box->addLeftButton(tr::lng_blocked_list_add(), [] {
|
||||
BlockedBoxController::BlockNewUser();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -539,7 +539,7 @@ void ConfirmContactBox::prepare() {
|
|||
}
|
||||
};
|
||||
|
||||
const auto button = addButton(langFactory(lng_send_button), [] {});
|
||||
const auto button = addButton(tr::lng_send_button(), [] {});
|
||||
button->clicks(
|
||||
) | rpl::start_with_next([=](Qt::MouseButton which) {
|
||||
_submit((which == Qt::RightButton)
|
||||
|
@ -548,7 +548,7 @@ void ConfirmContactBox::prepare() {
|
|||
}, button->lifetime());
|
||||
button->setAcceptBoth(true);
|
||||
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
}
|
||||
|
||||
void ConfirmContactBox::keyPressEvent(QKeyEvent *e) {
|
||||
|
|
|
@ -85,8 +85,8 @@ void EditInfoBox::prepare() {
|
|||
});
|
||||
_submit(_field->getTextWithAppliedMarkdown(), done);
|
||||
};
|
||||
addButton(langFactory(lng_settings_save), save);
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
addButton(tr::lng_settings_save(), save);
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
connect(_field, &Ui::InputField::submitted, save);
|
||||
connect(_field, &Ui::InputField::cancelled, [=] { closeBox(); });
|
||||
|
|
|
@ -245,7 +245,7 @@ void CountrySelectBox::prepare() {
|
|||
st::countriesScroll,
|
||||
_select->height());
|
||||
|
||||
addButton(langFactory(lng_close), [=] { closeBox(); });
|
||||
addButton(tr::lng_close(), [=] { closeBox(); });
|
||||
|
||||
setDimensions(st::boxWidth, st::boxMaxListHeight);
|
||||
|
||||
|
|
|
@ -230,21 +230,26 @@ void FlatButton::setTextMargins(QMargins margins) {
|
|||
update();
|
||||
}
|
||||
|
||||
RoundButton::RoundButton(QWidget *parent, Fn<QString()> textFactory, const style::RoundButton &st) : RippleButton(parent, st.ripple)
|
||||
, _textFactory(std::move(textFactory))
|
||||
RoundButton::RoundButton(
|
||||
QWidget *parent,
|
||||
rpl::producer<QString> text,
|
||||
const style::RoundButton &st)
|
||||
: RippleButton(parent, st.ripple)
|
||||
, _textFull(std::move(text))
|
||||
, _st(st) {
|
||||
subscribe(Lang::Current().updated(), [this] { refreshText(); });
|
||||
refreshText();
|
||||
_textFull.value(
|
||||
) | rpl::start_with_next([=](const QString &text) {
|
||||
resizeToText(text);
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void RoundButton::setTextTransform(TextTransform transform) {
|
||||
_transform = transform;
|
||||
refreshText();
|
||||
resizeToText(_textFull.current());
|
||||
}
|
||||
|
||||
void RoundButton::setText(Fn<QString()> textFactory) {
|
||||
_textFactory = std::move(textFactory);
|
||||
refreshText();
|
||||
void RoundButton::setText(rpl::producer<QString> text) {
|
||||
_textFull = std::move(text);
|
||||
}
|
||||
|
||||
void RoundButton::setNumbersText(const QString &numbersText, int numbers) {
|
||||
|
@ -258,7 +263,7 @@ void RoundButton::setNumbersText(const QString &numbersText, int numbers) {
|
|||
}
|
||||
_numbers->setText(numbersText, numbers);
|
||||
}
|
||||
refreshText();
|
||||
resizeToText(_textFull.current());
|
||||
}
|
||||
|
||||
void RoundButton::setWidthChangedCallback(Fn<void()> callback) {
|
||||
|
@ -277,13 +282,12 @@ void RoundButton::finishNumbersAnimation() {
|
|||
}
|
||||
|
||||
void RoundButton::numbersAnimationCallback() {
|
||||
resizeToText();
|
||||
update();
|
||||
resizeToText(_textFull.current());
|
||||
}
|
||||
|
||||
void RoundButton::setFullWidth(int newFullWidth) {
|
||||
_fullWidthOverride = newFullWidth;
|
||||
refreshText();
|
||||
resizeToText(_textFull.current());
|
||||
}
|
||||
|
||||
void RoundButton::setFullRadius(bool enabled) {
|
||||
|
@ -291,24 +295,14 @@ void RoundButton::setFullRadius(bool enabled) {
|
|||
update();
|
||||
}
|
||||
|
||||
void RoundButton::refreshText() {
|
||||
_text = computeFullText();
|
||||
_textWidth = _text.isEmpty() ? 0 : _st.font->width(_text);
|
||||
void RoundButton::resizeToText(const QString &text) {
|
||||
_text = (_transform == TextTransform::ToUpper) ? text.toUpper() : text;
|
||||
_textWidth = _st.font->width(_text);
|
||||
|
||||
resizeToText();
|
||||
update();
|
||||
}
|
||||
|
||||
QString RoundButton::computeFullText() const {
|
||||
auto result = _textFactory ? _textFactory() : QString();
|
||||
return (_transform == TextTransform::ToUpper) ? result.toUpper() : result;
|
||||
}
|
||||
|
||||
void RoundButton::resizeToText() {
|
||||
int innerWidth = contentWidth();
|
||||
if (_fullWidthOverride > 0) {
|
||||
if (_fullWidthOverride < innerWidth + (_st.height - _st.font->height)) {
|
||||
_text = _st.font->elided(computeFullText(), qMax(_fullWidthOverride - (_st.height - _st.font->height), 1));
|
||||
_text = _st.font->elided(text, qMax(_fullWidthOverride - (_st.height - _st.font->height), 1));
|
||||
_textWidth = _st.font->width(_text);
|
||||
}
|
||||
resize(_fullWidthOverride, _st.height + _st.padding.top() + _st.padding.bottom());
|
||||
|
@ -318,11 +312,13 @@ void RoundButton::resizeToText() {
|
|||
resize(innerWidth - _st.width + _st.padding.left() + _st.padding.right(), _st.height + _st.padding.top() + _st.padding.bottom());
|
||||
} else {
|
||||
if (_st.width < innerWidth + (_st.height - _st.font->height)) {
|
||||
_text = _st.font->elided(computeFullText(), qMax(_st.width - (_st.height - _st.font->height), 1));
|
||||
_text = _st.font->elided(_text, qMax(_st.width - (_st.height - _st.font->height), 1));
|
||||
_textWidth = _st.font->width(_text);
|
||||
}
|
||||
resize(_st.width + _st.padding.left() + _st.padding.right(), _st.height + _st.padding.top() + _st.padding.bottom());
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
int RoundButton::contentWidth() const {
|
||||
|
|
|
@ -105,10 +105,10 @@ class RoundButton : public RippleButton, private base::Subscriber {
|
|||
public:
|
||||
RoundButton(
|
||||
QWidget *parent,
|
||||
Fn<QString()> textFactory,
|
||||
rpl::producer<QString> text,
|
||||
const style::RoundButton &st);
|
||||
|
||||
void setText(Fn<QString()> textFactory);
|
||||
void setText(rpl::producer<QString> text);
|
||||
|
||||
void setNumbersText(const QString &numbersText) {
|
||||
setNumbersText(numbersText, numbersText.toInt());
|
||||
|
@ -139,14 +139,12 @@ protected:
|
|||
QPoint prepareRippleStartPosition() const override;
|
||||
|
||||
private:
|
||||
void refreshText();
|
||||
QString computeFullText() const;
|
||||
void setNumbersText(const QString &numbersText, int numbers);
|
||||
void numbersAnimationCallback();
|
||||
void resizeToText();
|
||||
void resizeToText(const QString &text);
|
||||
|
||||
rpl::variable<QString> _textFull;
|
||||
QString _text;
|
||||
Fn<QString()> _textFactory;
|
||||
int _textWidth;
|
||||
|
||||
std::unique_ptr<NumbersAnimation> _numbers;
|
||||
|
|
|
@ -170,8 +170,8 @@ void MainWindow::checkLockByTerms() {
|
|||
Ui::hideSettingsAndLayer(anim::type::instant);
|
||||
const auto box = Ui::show(Box<TermsBox>(
|
||||
*data,
|
||||
langFactory(lng_terms_agree),
|
||||
langFactory(lng_terms_decline)));
|
||||
tr::lng_terms_agree(),
|
||||
tr::lng_terms_decline()));
|
||||
|
||||
box->setCloseByEscape(false);
|
||||
box->setCloseByOutsideClick(false);
|
||||
|
@ -205,8 +205,8 @@ void MainWindow::showTermsDecline() {
|
|||
const auto box = Ui::show(
|
||||
Box<Window::TermsBox>(
|
||||
TextWithEntities{ lang(lng_terms_update_sorry) },
|
||||
langFactory(lng_terms_decline_and_delete),
|
||||
langFactory(lng_terms_back),
|
||||
tr::lng_terms_decline_and_delete(),
|
||||
tr::lng_terms_back(),
|
||||
true),
|
||||
LayerOption::KeepOther);
|
||||
|
||||
|
|
|
@ -518,7 +518,7 @@ Notification::Notification(
|
|||
, _item(msg)
|
||||
, _forwardedCount(forwardedCount)
|
||||
, _close(this, st::notifyClose)
|
||||
, _reply(this, langFactory(lng_notification_reply), st::defaultBoxButton) {
|
||||
, _reply(this, tr::lng_notification_reply(), st::defaultBoxButton) {
|
||||
subscribe(Lang::Current().updated(), [this] { refreshLang(); });
|
||||
|
||||
auto position = computePosition(st::notifyMinHeight);
|
||||
|
|
|
@ -570,8 +570,8 @@ ThemeExportBox::ThemeExportBox(QWidget*, const QByteArray &paletteContent, const
|
|||
void ThemeExportBox::prepare() {
|
||||
setTitle(tr::lng_theme_editor_background_image());
|
||||
|
||||
addButton(langFactory(lng_theme_editor_export), [this] { exportTheme(); });
|
||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||
addButton(tr::lng_theme_editor_export(), [this] { exportTheme(); });
|
||||
addButton(tr::lng_cancel(), [this] { closeBox(); });
|
||||
|
||||
auto height = st::themesSmallSkip + st::themesBackgroundSize + st::themesSmallSkip + _tileBackground->height();
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ WarningWidget::WarningWidget(QWidget *parent)
|
|||
: TWidget(parent)
|
||||
, _timer([=] { handleTimer(); })
|
||||
, _secondsLeft(kWaitBeforeRevertMs / 1000)
|
||||
, _keepChanges(this, langFactory(lng_theme_keep_changes), st::defaultBoxButton)
|
||||
, _revert(this, langFactory(lng_theme_revert), st::defaultBoxButton) {
|
||||
, _keepChanges(this, tr::lng_theme_keep_changes(), st::defaultBoxButton)
|
||||
, _revert(this, tr::lng_theme_revert(), st::defaultBoxButton) {
|
||||
_keepChanges->setClickedCallback([] { Window::Theme::KeepApplied(); });
|
||||
_revert->setClickedCallback([] { Window::Theme::Revert(); });
|
||||
updateText();
|
||||
|
|
|
@ -97,7 +97,7 @@ void LockWidget::paintContent(Painter &p) {
|
|||
PasscodeLockWidget::PasscodeLockWidget(QWidget *parent)
|
||||
: LockWidget(parent)
|
||||
, _passcode(this, st::passcodeInput, tr::lng_passcode_ph())
|
||||
, _submit(this, langFactory(lng_passcode_submit), st::passcodeSubmit)
|
||||
, _submit(this, tr::lng_passcode_submit(), st::passcodeSubmit)
|
||||
, _logout(this, lang(lng_passcode_logout)) {
|
||||
connect(_passcode, &Ui::MaskedInputField::changed, [=] { changed(); });
|
||||
connect(_passcode, &Ui::MaskedInputField::submitted, [=] { submit(); });
|
||||
|
@ -187,22 +187,22 @@ TermsLock TermsLock::FromMTP(const MTPDhelp_termsOfService &data) {
|
|||
TermsBox::TermsBox(
|
||||
QWidget*,
|
||||
const TermsLock &data,
|
||||
Fn<QString()> agree,
|
||||
Fn<QString()> cancel)
|
||||
rpl::producer<QString> agree,
|
||||
rpl::producer<QString> cancel)
|
||||
: _data(data)
|
||||
, _agree(agree)
|
||||
, _cancel(cancel) {
|
||||
, _agree(std::move(agree))
|
||||
, _cancel(std::move(cancel)) {
|
||||
}
|
||||
|
||||
TermsBox::TermsBox(
|
||||
QWidget*,
|
||||
const TextWithEntities &text,
|
||||
Fn<QString()> agree,
|
||||
Fn<QString()> cancel,
|
||||
rpl::producer<QString> agree,
|
||||
rpl::producer<QString> cancel,
|
||||
bool attentionAgree)
|
||||
: _data{ {}, text, std::nullopt, false }
|
||||
, _agree(agree)
|
||||
, _cancel(cancel)
|
||||
, _agree(std::move(agree))
|
||||
, _cancel(std::move(cancel))
|
||||
, _attentionAgree(attentionAgree) {
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ void TermsBox::prepare() {
|
|||
const auto &agreeStyle = _attentionAgree
|
||||
? st::attentionBoxButton
|
||||
: st::defaultBoxButton;
|
||||
addButton(_agree, [=] {}, agreeStyle)->clicks(
|
||||
addButton(std::move(_agree), [=] {}, agreeStyle)->clicks(
|
||||
) | rpl::filter([=] {
|
||||
if (age && !age->entity()->checked()) {
|
||||
toggleAgeError(true);
|
||||
|
@ -297,7 +297,7 @@ void TermsBox::prepare() {
|
|||
}) | rpl::start_to_stream(_agreeClicks, lifetime());
|
||||
|
||||
if (_cancel) {
|
||||
addButton(_cancel, [=] {})->clicks(
|
||||
addButton(std::move(_cancel), [=] {})->clicks(
|
||||
) | rpl::map([] {
|
||||
return rpl::empty_value();
|
||||
}) | rpl::start_to_stream(_cancelClicks, lifetime());
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue