diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp index 9086dfce8..8883ad0a5 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp @@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "ui/layers/generic_box.h" +#include "ui/widgets/buttons.h" #include "ui/widgets/checkbox.h" #include "ui/widgets/labels.h" #include "styles/style_layers.h" @@ -23,6 +24,17 @@ void EditPeerHistoryVisibilityBox( Ui::RadioenumGroup >(historyVisibilitySavedValue); + const auto addButton = [=]( + not_null inner, + HistoryVisibility v) { + const auto button = Ui::CreateChild(inner.get()); + inner->sizeValue( + ) | rpl::start_with_next([=](const QSize &s) { + button->resize(s); + }, button->lifetime()); + button->setClickedCallback([=] { historyVisibility->setValue(v); }); + }; + box->setTitle(tr::lng_manage_history_visibility_title()); box->addButton(tr::lng_settings_save(), [=] { savedCallback(historyVisibility->current()); @@ -31,32 +43,36 @@ void EditPeerHistoryVisibilityBox( box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); box->addSkip(st::editPeerHistoryVisibilityTopSkip); - box->addRow(object_ptr>( + const auto visible = box->addRow(object_ptr(box)); + visible->add(object_ptr>( box, historyVisibility, HistoryVisibility::Visible, tr::lng_manage_history_visibility_shown(tr::now), st::defaultBoxCheckbox)); - box->addRow( + visible->add( object_ptr( box, tr::lng_manage_history_visibility_shown_about(), st::editPeerPrivacyLabel), - st::editPeerPreHistoryLabelMargins + st::boxRowPadding); + st::editPeerPreHistoryLabelMargins); + addButton(visible, HistoryVisibility::Visible); box->addSkip(st::editPeerHistoryVisibilityTopSkip); - box->addRow(object_ptr>( + const auto hidden = box->addRow(object_ptr(box)); + hidden->add(object_ptr>( box, historyVisibility, HistoryVisibility::Hidden, tr::lng_manage_history_visibility_hidden(tr::now), st::defaultBoxCheckbox)); - box->addRow( + hidden->add( object_ptr( box, (isLegacy ? tr::lng_manage_history_visibility_hidden_legacy : tr::lng_manage_history_visibility_hidden_about)(), st::editPeerPrivacyLabel), - st::editPeerPreHistoryLabelMargins + st::boxRowPadding); + st::editPeerPreHistoryLabelMargins); + addButton(hidden, HistoryVisibility::Hidden); }