diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp index b9b9f0f4b..95382c99a 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp @@ -163,66 +163,6 @@ auto ChatStatusText(int fullCount, int onlineCount, bool isGroup) { } // namespace -SectionWithToggle *SectionWithToggle::setToggleShown( - rpl::producer &&shown) { - _toggle.create( - this, - QString(), - st::infoToggleCheckbox, - std::make_unique( - st::infoToggle, - false, - [this] { _toggle->updateCheck(); })); - _toggle->hide(); - _toggle->lower(); - _toggle->setCheckAlignment(style::al_right); - widthValue( - ) | rpl::start_with_next([this](int newValue) { - _toggle->setGeometry(0, 0, newValue, height()); - }, _toggle->lifetime()); - std::move( - shown - ) | rpl::start_with_next([this](bool shown) { - if (_toggle->isHidden() == shown) { - _toggle->setVisible(shown); - _toggleShown.fire_copy(shown); - } - }, lifetime()); - return this; -} - -void SectionWithToggle::toggle(bool toggled, anim::type animated) { - if (_toggle) { - _toggle->setChecked(toggled); - if (animated == anim::type::instant) { - _toggle->finishAnimating(); - } - } -} - -bool SectionWithToggle::toggled() const { - return _toggle ? _toggle->checked() : false; -} - -rpl::producer SectionWithToggle::toggledValue() const { - if (_toggle) { - return _toggle->checkedValue(); - } - return nullptr; -} - -rpl::producer SectionWithToggle::toggleShownValue() const { - return _toggleShown.events_starting_with( - _toggle && !_toggle->isHidden()); -} - -int SectionWithToggle::toggleSkip() const { - return (!_toggle || _toggle->isHidden()) - ? 0 - : st::infoToggleCheckbox.checkPosition.x() - + _toggle->checkRect().width(); -} - Cover::Cover( QWidget *parent, not_null peer, @@ -239,7 +179,7 @@ Cover::Cover( not_null peer, not_null controller, rpl::producer title) -: SectionWithToggle( +: FixedHeightWidget( parent, st::infoProfilePhotoTop + st::infoProfilePhoto.size.height() @@ -279,11 +219,7 @@ Cover::Cover( } void Cover::setupChildGeometry() { - using namespace rpl::mappers; - rpl::combine( - toggleShownValue(), - widthValue(), - _2 + widthValue( ) | rpl::start_with_next([this](int newWidth) { _userpic->moveToLeft( st::infoProfilePhotoLeft, @@ -451,8 +387,7 @@ void Cover::refreshNameGeometry(int newWidth) { auto nameTop = st::infoProfileNameTop; auto nameWidth = newWidth - nameLeft - - st::infoProfileNameRight - - toggleSkip(); + - st::infoProfileNameRight; if (_verifiedCheck) { nameWidth -= st::infoVerifiedCheckPosition.x() + _verifiedCheck->width(); @@ -484,8 +419,7 @@ void Cover::refreshNameGeometry(int newWidth) { void Cover::refreshStatusGeometry(int newWidth) { auto statusWidth = newWidth - st::infoProfileStatusLeft - - st::infoProfileStatusRight - - toggleSkip(); + - st::infoProfileStatusRight; _status->resizeToWidth(statusWidth); _status->moveToLeft( st::infoProfileStatusLeft, diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.h b/Telegram/SourceFiles/info/profile/info_profile_cover.h index 0c4d1b214..b4bfc0be5 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.h +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.h @@ -36,26 +36,7 @@ namespace Profile { enum class Badge; -class SectionWithToggle : public Ui::FixedHeightWidget { -public: - using FixedHeightWidget::FixedHeightWidget; - - SectionWithToggle *setToggleShown(rpl::producer &&shown); - void toggle(bool toggled, anim::type animated); - bool toggled() const; - rpl::producer toggledValue() const; - -protected: - rpl::producer toggleShownValue() const; - int toggleSkip() const; - -private: - object_ptr _toggle = { nullptr }; - rpl::event_stream _toggleShown; - -}; - -class Cover : public SectionWithToggle { +class Cover : public Ui::FixedHeightWidget { public: Cover( QWidget *parent, @@ -69,11 +50,6 @@ public: Cover *setOnlineCount(rpl::producer &&count); - Cover *setToggleShown(rpl::producer &&shown) { - return static_cast( - SectionWithToggle::setToggleShown(std::move(shown))); - } - rpl::producer
showSection() const { return _showSection.events(); } diff --git a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp index 1927430b9..33a9d77e9 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp @@ -61,16 +61,6 @@ InnerWidget::InnerWidget( }, lifetime()); } -bool InnerWidget::canHideDetailsEver() const { - return false;// (_peer->isChat() || _peer->isMegagroup()); -} - -rpl::producer InnerWidget::canHideDetails() const { - using namespace rpl::mappers; - return MembersCountValue(_peer) - | rpl::map(_1 > 0); -} - object_ptr InnerWidget::setupContent( not_null parent) { auto result = object_ptr(parent); @@ -85,19 +75,7 @@ object_ptr InnerWidget::setupContent( }, _cover->lifetime()); _cover->setOnlineCount(rpl::single(0)); auto details = SetupDetails(_controller, parent, _peer); - if (canHideDetailsEver()) { - _cover->setToggleShown(canHideDetails()); - _infoWrap = result->add(object_ptr>( - result, - std::move(details)) - )->setDuration( - st::infoSlideDuration - )->toggleOn( - _cover->toggledValue() - ); - } else { - result->add(std::move(details)); - } + result->add(std::move(details)); result->add(setupSharedMedia(result.data())); if (auto members = SetupChannelMembers(_controller, result.data(), _peer)) { result->add(std::move(members)); @@ -244,20 +222,15 @@ void InnerWidget::visibleTopBottomUpdated( } void InnerWidget::saveState(not_null memento) { - memento->setInfoExpanded(_cover->toggled()); if (_members) { memento->setMembersState(_members->saveState()); } } void InnerWidget::restoreState(not_null memento) { - _cover->toggle(memento->infoExpanded(), anim::type::instant); if (_members) { _members->restoreState(memento->membersState()); } - if (_infoWrap) { - _infoWrap->finishAnimating(); - } if (_sharedMediaWrap) { _sharedMediaWrap->finishAnimating(); } diff --git a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.h b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.h index 99cd4e152..26891b153 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.h +++ b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.h @@ -62,16 +62,12 @@ private: _desiredHeight.fire(countDesiredHeight()); } - bool canHideDetailsEver() const; - rpl::producer canHideDetails() const; - const not_null _controller; const not_null _peer; PeerData * const _migrated = nullptr; Members *_members = nullptr; Cover *_cover = nullptr; - Ui::SlideWrap *_infoWrap = nullptr; Ui::SlideWrap *_sharedMediaWrap = nullptr; object_ptr _content; diff --git a/Telegram/SourceFiles/info/profile/info_profile_widget.h b/Telegram/SourceFiles/info/profile/info_profile_widget.h index a50e2f16c..c61c833b2 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_widget.h +++ b/Telegram/SourceFiles/info/profile/info_profile_widget.h @@ -28,19 +28,12 @@ public: Section section() const override; - void setInfoExpanded(bool expanded) { - _infoExpanded = expanded; - } - bool infoExpanded() const { - return _infoExpanded; - } void setMembersState(std::unique_ptr state); std::unique_ptr membersState(); ~Memento(); private: - bool _infoExpanded = true; std::unique_ptr _membersState; };