From cfa60df1342c53453136a36acbaaae55ecf2daa2 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 1 Mar 2022 19:27:42 +0300 Subject: [PATCH] Show "No languages found." label. --- Telegram/SourceFiles/boxes/language_box.cpp | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Telegram/SourceFiles/boxes/language_box.cpp b/Telegram/SourceFiles/boxes/language_box.cpp index d0b9768f4..43517b7bd 100644 --- a/Telegram/SourceFiles/boxes/language_box.cpp +++ b/Telegram/SourceFiles/boxes/language_box.cpp @@ -907,6 +907,30 @@ void Content::setupContent( content, object_ptr(content))); const auto other = add(official, true); + const auto empty = content->add( + object_ptr>( + content, + object_ptr( + content, + st::membersAbout.style.font->height * 9))); + const auto label = Ui::CreateChild( + empty->entity(), + tr::lng_languages_none(), + st::membersAbout); + empty->entity()->sizeValue( + ) | rpl::start_with_next([=](QSize size) { + label->move( + (size.width() - label->width()) / 2, + (size.height() - label->height()) / 2); + }, label->lifetime()); + + empty->toggleOn( + rpl::combine( + main ? main->isEmpty() : rpl::single(true), + other ? other->isEmpty() : rpl::single(true), + _1 && _2), + anim::type::instant); + Ui::ResizeFitChild(this, content); if (main && other) {