Removed skip translation setting when it is disabled.

This commit is contained in:
23rd 2022-11-30 03:26:34 +03:00
parent f8a17bd9c9
commit 11165abc09

View file

@ -1118,8 +1118,16 @@ void LanguageBox::prepare() {
}, translateEnabled->lifetime()); }, translateEnabled->lifetime());
const auto label = lifetime().make_state<rpl::event_stream<QLocale>>(); const auto label = lifetime().make_state<rpl::event_stream<QLocale>>();
const auto translateSkipWrap = topContainer->add(
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
topContainer,
object_ptr<Ui::VerticalLayout>(topContainer)));
translateSkipWrap->toggle(
translateEnabled->toggled(),
anim::type::normal);
translateSkipWrap->toggleOn(translateEnabled->toggledValue());
const auto translateSkip = Settings::AddButtonWithLabel( const auto translateSkip = Settings::AddButtonWithLabel(
topContainer, translateSkipWrap->entity(),
tr::lng_translate_settings_choose(), tr::lng_translate_settings_choose(),
label->events() | rpl::map(Ui::LanguageName), label->events() | rpl::map(Ui::LanguageName),
st::settingsButtonNoIcon); st::settingsButtonNoIcon);
@ -1177,6 +1185,10 @@ void LanguageBox::prepare() {
accumulate_max(*max, height); accumulate_max(*max, height);
setDimensions(st::boxWidth, qMin(*max, st::boxMaxListHeight)); setDimensions(st::boxWidth, qMin(*max, st::boxMaxListHeight));
}, inner->lifetime()); }, inner->lifetime());
topContainer->heightValue(
) | rpl::start_with_next([=](int height) {
setInnerTopSkip(height);
}, inner->lifetime());
select->setSubmittedCallback([=](Qt::KeyboardModifiers) { select->setSubmittedCallback([=](Qt::KeyboardModifiers) {
inner->activateBySubmit(); inner->activateBySubmit();