| 111 | } |
| 112 | |
| 113 | WrapWidget::WrapWidget( |
| 114 | QWidget *parent, |
| 115 | not_null<Window::SessionController*> window, |
| 116 | Wrap wrap, |
| 117 | not_null<Memento*> memento) |
| 118 | : SectionWidget(parent, window, rpl::producer<PeerData*>()) |
| 119 | , _isSeparatedWindow( |
| 120 | window->windowId().type == Window::SeparateType::SharedMedia) |
| 121 | , _wrap(wrap) |
| 122 | , _controller(createController(window, memento->content())) |
| 123 | , _topShadow(this) |
| 124 | , _bottomShadow(this) { |
| 125 | _topShadow->toggleOn( |
| 126 | topShadowToggledValue( |
| 127 | ) | rpl::filter([](bool shown) { |
| 128 | return true; |
| 129 | })); |
| 130 | |
| 131 | _bottomShadow->toggleOn( |
| 132 | _desiredBottomShadowVisibilities.events( |
| 133 | ) | rpl::flatten_latest() | rpl::distinct_until_changed()); |
| 134 | |
| 135 | _wrap.changes( |
| 136 | ) | rpl::on_next([this] { |
| 137 | setupTop(); |
| 138 | finishShowContent(); |
| 139 | }, lifetime()); |
| 140 | selectedListValue( |
| 141 | ) | rpl::on_next([this](SelectedItems &&items) { |
| 142 | InvokeQueued(this, [this, items = std::move(items)]() mutable { |
| 143 | if (_topBar) { |
| 144 | _topBar->setSelectedItems(std::move(items)); |
| 145 | } |
| 146 | }); |
| 147 | }, lifetime()); |
| 148 | restoreHistoryStack(memento->takeStack()); |
| 149 | |
| 150 | if (const auto topic = _controller->topic()) { |
| 151 | topic->destroyed( |
| 152 | ) | rpl::on_next([=] { |
| 153 | if (_wrap.current() == Wrap::Layer) { |
| 154 | _controller->parentController()->hideSpecialLayer(); |
| 155 | } else if (_wrap.current() == Wrap::Narrow) { |
| 156 | _controller->parentController()->showBackFromStack( |
| 157 | Window::SectionShow( |
| 158 | anim::type::normal, |
| 159 | anim::activation::background)); |
| 160 | } else { |
| 161 | _removeRequests.fire({}); |
| 162 | } |
| 163 | }, lifetime()); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | void WrapWidget::setupShortcuts() { |
| 168 | const auto isSettings = [=] { |
nothing calls this directly
no test coverage detected