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