MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / WrapWidget

Method WrapWidget

Telegram/SourceFiles/info/info_wrap_widget.cpp:113–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113WrapWidget::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
167void WrapWidget::setupShortcuts() {
168 const auto isSettings = [=] {

Callers

nothing calls this directly

Calls 14

setSelectedItemsMethod · 0.80
takeStackMethod · 0.80
hideSpecialLayerMethod · 0.80
SectionShowClass · 0.50
windowIdMethod · 0.45
contentMethod · 0.45
eventsMethod · 0.45
changesMethod · 0.45
topicMethod · 0.45
destroyedMethod · 0.45
currentMethod · 0.45
parentControllerMethod · 0.45

Tested by

no test coverage detected