Disable tabs in third column info.
This commit is contained in:
parent
131efa11be
commit
903aa46e5c
|
@ -394,7 +394,7 @@ notificationSampleSize: size(64px, 16px);
|
|||
|
||||
membersAboutLimitPadding: margins(0px, 12px, 0px, 12px);
|
||||
membersAbout: FlatLabel(defaultFlatLabel) {
|
||||
minWidth: 332px;
|
||||
minWidth: 240px;
|
||||
textFg: membersAboutLimitFg;
|
||||
align: align(top);
|
||||
style: boxLabelStyle;
|
||||
|
|
|
@ -883,15 +883,19 @@ int PeerListContent::resizeGetHeight(int newWidth) {
|
|||
}
|
||||
auto rowsCount = shownRowsCount();
|
||||
auto labelTop = rowsTop() + qMax(1, shownRowsCount()) * _rowHeight;
|
||||
auto labelWidth = newWidth - 2 * st::contactsPadding.left();
|
||||
if (_description) {
|
||||
_description->resizeToWidth(labelWidth);
|
||||
_description->moveToLeft(st::contactsPadding.left(), labelTop + st::membersAboutLimitPadding.top(), newWidth);
|
||||
_description->setVisible(!showingSearch());
|
||||
}
|
||||
if (_searchNoResults) {
|
||||
_searchNoResults->resizeToWidth(labelWidth);
|
||||
_searchNoResults->moveToLeft(st::contactsPadding.left(), labelTop + st::membersAboutLimitPadding.top(), newWidth);
|
||||
_searchNoResults->setVisible(showingSearch() && _filterResults.empty() && !_controller->isSearchLoading());
|
||||
}
|
||||
if (_searchLoading) {
|
||||
_searchLoading->resizeToWidth(labelWidth);
|
||||
_searchLoading->moveToLeft(st::contactsPadding.left(), labelTop + st::membersAboutLimitPadding.top(), newWidth);
|
||||
_searchLoading->setVisible(showingSearch() && _filterResults.empty() && _controller->isSearchLoading());
|
||||
}
|
||||
|
|
|
@ -130,6 +130,7 @@ infoTopBarTitle: FlatLabel(defaultFlatLabel) {
|
|||
}
|
||||
}
|
||||
infoTopBarClose: IconButton(infoTopBarBack) {
|
||||
width: infoTopBarHeight;
|
||||
icon: icon {{ "info_close", boxTitleCloseFg }};
|
||||
iconOver: icon {{ "info_close", boxTitleCloseFgOver }};
|
||||
}
|
||||
|
@ -179,6 +180,8 @@ infoTopBar: InfoTopBar {
|
|||
mediaDelete: infoTopBarDelete;
|
||||
search: infoTopBarSearch;
|
||||
searchRow: infoTopBarSearchRow;
|
||||
highlightBg: windowBgOver;
|
||||
highlightDuration: 240;
|
||||
}
|
||||
|
||||
infoLayerTopBarHeight: boxLayerTitleHeight;
|
||||
|
@ -224,7 +227,7 @@ infoLayerTopBarDelete: IconButton(infoLayerTopBarForward) {
|
|||
icon: icon {{ "info_media_delete", boxTitleCloseFg }};
|
||||
iconOver: icon {{ "info_media_delete", boxTitleCloseFgOver }};
|
||||
}
|
||||
infoLayerTopBar: InfoTopBar {
|
||||
infoLayerTopBar: InfoTopBar(infoTopBar) {
|
||||
height: infoLayerTopBarHeight;
|
||||
back: infoLayerTopBarBack;
|
||||
title: boxTitle;
|
||||
|
|
|
@ -221,7 +221,28 @@ void TopBar::updateControlsGeometry(int newWidth) {
|
|||
|
||||
void TopBar::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
p.fillRect(e->rect(), _st.bg);
|
||||
|
||||
auto ms = getms();
|
||||
auto highlight = _a_highlight.current(ms, _highlight ? 1. : 0.);
|
||||
if (_highlight && !_a_highlight.animating()) {
|
||||
_highlight = false;
|
||||
startHighlightAnimation();
|
||||
}
|
||||
auto brush = anim::brush(_st.bg, _st.highlightBg, highlight);
|
||||
p.fillRect(e->rect(), brush);
|
||||
}
|
||||
|
||||
void TopBar::highlight() {
|
||||
_highlight = true;
|
||||
startHighlightAnimation();
|
||||
}
|
||||
|
||||
void TopBar::startHighlightAnimation() {
|
||||
_a_highlight.start(
|
||||
[this] { update(); },
|
||||
_highlight ? 0. : 1.,
|
||||
_highlight ? 1. : 0.,
|
||||
_st.highlightDuration);
|
||||
}
|
||||
|
||||
rpl::producer<QString> TitleValue(
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
|
||||
void setTitle(rpl::producer<QString> &&title);
|
||||
void enableBackButton(bool enable);
|
||||
void highlight();
|
||||
|
||||
template <typename ButtonWidget>
|
||||
ButtonWidget *addButton(base::unique_qptr<ButtonWidget> button) {
|
||||
|
@ -71,6 +72,7 @@ private:
|
|||
void updateControlsGeometry(int newWidth);
|
||||
void pushButton(base::unique_qptr<Ui::RpWidget> button);
|
||||
void removeButton(not_null<Ui::RpWidget*> button);
|
||||
void startHighlightAnimation();
|
||||
|
||||
void setSearchField(
|
||||
base::unique_qptr<Ui::InputField> field,
|
||||
|
@ -80,6 +82,8 @@ private:
|
|||
rpl::producer<bool> &&shown);
|
||||
|
||||
const style::InfoTopBar &_st;
|
||||
Animation _a_highlight;
|
||||
bool _highlight = false;
|
||||
object_ptr<Ui::IconButton> _back = { nullptr };
|
||||
std::vector<base::unique_qptr<Ui::RpWidget>> _buttons;
|
||||
object_ptr<Ui::FlatLabel> _title = { nullptr };
|
||||
|
|
|
@ -119,133 +119,154 @@ not_null<PeerData*> WrapWidget::peer() const {
|
|||
return _controller->peer();
|
||||
}
|
||||
|
||||
void WrapWidget::createTabs() {
|
||||
_topTabs.create(this, st::infoTabs);
|
||||
auto sections = QStringList();
|
||||
sections.push_back(lang(lng_profile_info_section).toUpper());
|
||||
sections.push_back(lang(lng_info_tab_media).toUpper());
|
||||
_topTabs->setSections(sections);
|
||||
_topTabs->setActiveSection(static_cast<int>(_tab));
|
||||
_topTabs->finishAnimating();
|
||||
|
||||
_topTabs->sectionActivated()
|
||||
| rpl::map([](int index) { return static_cast<Tab>(index); })
|
||||
| rpl::start_with_next(
|
||||
[this](Tab tab) { showTab(tab); },
|
||||
lifetime());
|
||||
|
||||
_topTabs->move(0, 0);
|
||||
_topTabs->resizeToWidth(width());
|
||||
_topTabs->show();
|
||||
|
||||
_topTabsBackground.create(this, st::profileBg);
|
||||
_topTabsBackground->setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
|
||||
_topTabsBackground->move(0, 0);
|
||||
_topTabsBackground->resize(
|
||||
width(),
|
||||
_topTabs->height() - st::lineWidth);
|
||||
_topTabsBackground->show();
|
||||
}
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//void WrapWidget::createTabs() {
|
||||
// _topTabs.create(this, st::infoTabs);
|
||||
// auto sections = QStringList();
|
||||
// sections.push_back(lang(lng_profile_info_section).toUpper());
|
||||
// sections.push_back(lang(lng_info_tab_media).toUpper());
|
||||
// _topTabs->setSections(sections);
|
||||
// _topTabs->setActiveSection(static_cast<int>(_tab));
|
||||
// _topTabs->finishAnimating();
|
||||
//
|
||||
// _topTabs->sectionActivated()
|
||||
// | rpl::map([](int index) { return static_cast<Tab>(index); })
|
||||
// | rpl::start_with_next(
|
||||
// [this](Tab tab) { showTab(tab); },
|
||||
// lifetime());
|
||||
//
|
||||
// _topTabs->move(0, 0);
|
||||
// _topTabs->resizeToWidth(width());
|
||||
// _topTabs->show();
|
||||
//
|
||||
// _topTabsBackground.create(this, st::profileBg);
|
||||
// _topTabsBackground->setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
//
|
||||
// _topTabsBackground->move(0, 0);
|
||||
// _topTabsBackground->resize(
|
||||
// width(),
|
||||
// _topTabs->height() - st::lineWidth);
|
||||
// _topTabsBackground->show();
|
||||
//}
|
||||
|
||||
void WrapWidget::forceContentRepaint() {
|
||||
// WA_OpaquePaintEvent on TopBar creates render glitches when
|
||||
// animating the LayerWidget's height :( Fixing by repainting.
|
||||
if (_topTabs) {
|
||||
_topTabsBackground->update();
|
||||
} else if (_topBar) {
|
||||
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//if (_topTabs) {
|
||||
// _topTabsBackground->update();
|
||||
//}
|
||||
|
||||
if (_topBar) {
|
||||
_topBar->update();
|
||||
}
|
||||
_content->update();
|
||||
}
|
||||
|
||||
void WrapWidget::showTab(Tab tab) {
|
||||
if (_tab == tab) {
|
||||
return;
|
||||
}
|
||||
Expects(_content != nullptr);
|
||||
auto direction = (tab > _tab)
|
||||
? SlideDirection::FromRight
|
||||
: SlideDirection::FromLeft;
|
||||
auto newAnotherMemento = _content->createMemento();
|
||||
if (!_anotherTabMemento) {
|
||||
_anotherTabMemento = createTabMemento(tab);
|
||||
}
|
||||
auto newController = createController(
|
||||
_controller->window(),
|
||||
_anotherTabMemento.get());
|
||||
auto newContent = createContent(
|
||||
_anotherTabMemento.get(),
|
||||
newController.get());
|
||||
auto animationParams = SectionSlideParams();
|
||||
// animationParams.withFade = (wrap() == Wrap::Layer);
|
||||
animationParams.withTabs = true;
|
||||
animationParams.withTopBarShadow = hasTopBarShadow()
|
||||
&& newContent->hasTopBarShadow();
|
||||
animationParams.oldContentCache = grabForShowAnimation(
|
||||
animationParams);
|
||||
|
||||
_controller = std::move(newController);
|
||||
showContent(std::move(newContent));
|
||||
|
||||
showAnimated(direction, animationParams);
|
||||
|
||||
_anotherTabMemento = std::move(newAnotherMemento);
|
||||
_tab = tab;
|
||||
}
|
||||
|
||||
void WrapWidget::setupTabbedTop() {
|
||||
auto section = _controller->section();
|
||||
switch (section.type()) {
|
||||
case Section::Type::Profile:
|
||||
setupTabs(Tab::Profile);
|
||||
break;
|
||||
case Section::Type::Media:
|
||||
switch (section.mediaType()) {
|
||||
case Section::MediaType::Photo:
|
||||
case Section::MediaType::Video:
|
||||
case Section::MediaType::File:
|
||||
setupTabs(Tab::Media);
|
||||
break;
|
||||
default:
|
||||
setupTabs(Tab::None);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Section::Type::CommonGroups:
|
||||
setupTabs(Tab::None);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//void WrapWidget::showTab(Tab tab) {
|
||||
// if (_tab == tab) {
|
||||
// return;
|
||||
// }
|
||||
// Expects(_content != nullptr);
|
||||
// auto direction = (tab > _tab)
|
||||
// ? SlideDirection::FromRight
|
||||
// : SlideDirection::FromLeft;
|
||||
// auto newAnotherMemento = _content->createMemento();
|
||||
// if (!_anotherTabMemento) {
|
||||
// _anotherTabMemento = createTabMemento(tab);
|
||||
// }
|
||||
// auto newController = createController(
|
||||
// _controller->window(),
|
||||
// _anotherTabMemento.get());
|
||||
// auto newContent = createContent(
|
||||
// _anotherTabMemento.get(),
|
||||
// newController.get());
|
||||
// auto animationParams = SectionSlideParams();
|
||||
//// animationParams.withFade = (wrap() == Wrap::Layer);
|
||||
// animationParams.withTabs = true;
|
||||
// animationParams.withTopBarShadow = hasTopBarShadow()
|
||||
// && newContent->hasTopBarShadow();
|
||||
// animationParams.oldContentCache = grabForShowAnimation(
|
||||
// animationParams);
|
||||
//
|
||||
// _controller = std::move(newController);
|
||||
// showContent(std::move(newContent));
|
||||
//
|
||||
// showAnimated(direction, animationParams);
|
||||
//
|
||||
// _anotherTabMemento = std::move(newAnotherMemento);
|
||||
// _tab = tab;
|
||||
//}
|
||||
//
|
||||
//void WrapWidget::setupTabbedTop() {
|
||||
// auto section = _controller->section();
|
||||
// switch (section.type()) {
|
||||
// case Section::Type::Profile:
|
||||
// setupTabs(Tab::Profile);
|
||||
// break;
|
||||
// case Section::Type::Media:
|
||||
// switch (section.mediaType()) {
|
||||
// case Section::MediaType::Photo:
|
||||
// case Section::MediaType::Video:
|
||||
// case Section::MediaType::File:
|
||||
// setupTabs(Tab::Media);
|
||||
// break;
|
||||
// default:
|
||||
// setupTabs(Tab::None);
|
||||
// break;
|
||||
// }
|
||||
// break;
|
||||
// case Section::Type::CommonGroups:
|
||||
// setupTabs(Tab::None);
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
|
||||
void WrapWidget::setupTop() {
|
||||
if (wrap() == Wrap::Side && _historyStack.empty()) {
|
||||
setupTabbedTop();
|
||||
} else {
|
||||
setupTabs(Tab::None);
|
||||
}
|
||||
if (_topTabs) {
|
||||
_topBar.destroy();
|
||||
} else {
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//if (wrap() == Wrap::Side && _historyStack.empty()) {
|
||||
// setupTabbedTop();
|
||||
//} else {
|
||||
// setupTabs(Tab::None);
|
||||
//}
|
||||
//if (_topTabs) {
|
||||
// _topBar.destroy();
|
||||
//} else {
|
||||
// createTopBar();
|
||||
//}
|
||||
createTopBar();
|
||||
}
|
||||
refreshTopBarOverride();
|
||||
}
|
||||
|
||||
void WrapWidget::createTopBar() {
|
||||
_topBar.create(this, TopBarStyle(wrap()));
|
||||
auto wrapValue = wrap();
|
||||
_topBar.create(this, TopBarStyle(wrapValue));
|
||||
|
||||
_topBar->setTitle(TitleValue(
|
||||
_controller->section(),
|
||||
_controller->peer()));
|
||||
if (wrap() != Wrap::Layer || !_historyStack.empty()) {
|
||||
if (wrapValue == Wrap::Narrow || hasStackHistory()) {
|
||||
_topBar->enableBackButton(true);
|
||||
_topBar->backRequest()
|
||||
| rpl::start_with_next([this] {
|
||||
showBackFromStack();
|
||||
}, _topBar->lifetime());
|
||||
} else if (wrapValue == Wrap::Side) {
|
||||
auto close = _topBar->addButton(
|
||||
base::make_unique_q<Ui::IconButton>(
|
||||
_topBar,
|
||||
st::infoTopBarClose));
|
||||
close->addClickHandler([this] {
|
||||
_controller->window()->closeThirdSection();
|
||||
});
|
||||
}
|
||||
if (wrap() == Wrap::Layer) {
|
||||
if (wrapValue == Wrap::Layer) {
|
||||
auto close = _topBar->addButton(
|
||||
base::make_unique_q<Ui::IconButton>(
|
||||
_topBar,
|
||||
|
@ -260,7 +281,8 @@ void WrapWidget::createTopBar() {
|
|||
search,
|
||||
_controller->searchEnabledByContent());
|
||||
}
|
||||
if (_controller->section().type() == Section::Type::Profile) {
|
||||
if (_controller->section().type() == Section::Type::Profile
|
||||
&& (wrapValue != Wrap::Side || hasStackHistory())) {
|
||||
addProfileMenuButton();
|
||||
// addProfileNotificationsButton();
|
||||
}
|
||||
|
@ -381,9 +403,14 @@ void WrapWidget::destroyTopBarOverride() {
|
|||
_topBarOverrideAnimation.start([this, handle] {
|
||||
}, 1., 0., st::slideWrapDuration);
|
||||
widget.destroy();
|
||||
if (_topTabs) {
|
||||
_topTabs->show();
|
||||
} else if (_topBar) {
|
||||
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//if (_topTabs) {
|
||||
// _topTabs->show();
|
||||
//}
|
||||
|
||||
if (_topBar) {
|
||||
_topBar->show();
|
||||
}
|
||||
}
|
||||
|
@ -394,9 +421,14 @@ void WrapWidget::createTopBarOverride(SelectedItems &&items) {
|
|||
this,
|
||||
TopBarStyle(wrap()),
|
||||
std::move(items));
|
||||
if (_topTabs) {
|
||||
_topTabs->hide();
|
||||
} else if (_topBar) {
|
||||
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//if (_topTabs) {
|
||||
// _topTabs->hide();
|
||||
//}
|
||||
|
||||
if (_topBar) {
|
||||
_topBar->hide();
|
||||
}
|
||||
_topBarOverride->cancelRequests()
|
||||
|
@ -416,9 +448,12 @@ bool WrapWidget::requireTopBarSearch() const {
|
|||
} else if (hasStackHistory()) {
|
||||
return true;
|
||||
}
|
||||
auto section = _controller->section();
|
||||
return (section.type() != Section::Type::Media)
|
||||
|| !Media::TypeToTabIndex(section.mediaType()).has_value();
|
||||
// This was for top-level tabs support.
|
||||
//
|
||||
//auto section = _controller->section();
|
||||
//return (section.type() != Section::Type::Media)
|
||||
// || !Media::TypeToTabIndex(section.mediaType()).has_value();
|
||||
return false;
|
||||
}
|
||||
|
||||
void WrapWidget::showBackFromStack() {
|
||||
|
@ -437,9 +472,11 @@ void WrapWidget::showBackFromStack() {
|
|||
}
|
||||
|
||||
not_null<Ui::RpWidget*> WrapWidget::topWidget() const {
|
||||
if (_topTabs) {
|
||||
return _topTabsBackground;
|
||||
}
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//if (_topTabs) {
|
||||
// return _topTabsBackground;
|
||||
//}
|
||||
return _topBar;
|
||||
}
|
||||
|
||||
|
@ -458,17 +495,25 @@ void WrapWidget::finishShowContent() {
|
|||
_selectedLists.fire(_content->selectedListValue());
|
||||
_topShadow->raise();
|
||||
_topShadow->finishAnimating();
|
||||
if (_topTabs) {
|
||||
_topTabs->raise();
|
||||
}
|
||||
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//if (_topTabs) {
|
||||
// _topTabs->raise();
|
||||
//}
|
||||
}
|
||||
|
||||
rpl::producer<bool> WrapWidget::topShadowToggledValue() const {
|
||||
using namespace rpl::mappers;
|
||||
return rpl::combine(
|
||||
_controller->wrapValue(),
|
||||
_desiredShadowVisibilities.events() | rpl::flatten_latest(),
|
||||
($1 == Wrap::Side) || $2);
|
||||
// Allows always showing shadow for specific wrap value.
|
||||
// Was done for top level tabs support.
|
||||
//
|
||||
//using namespace rpl::mappers;
|
||||
//return rpl::combine(
|
||||
// _controller->wrapValue(),
|
||||
// _desiredShadowVisibilities.events() | rpl::flatten_latest(),
|
||||
// ($1 == Wrap::Side) || $2);
|
||||
return _desiredShadowVisibilities.events()
|
||||
| rpl::flatten_latest();
|
||||
}
|
||||
|
||||
rpl::producer<int> WrapWidget::desiredHeightForContent() const {
|
||||
|
@ -506,35 +551,39 @@ object_ptr<ContentWidget> WrapWidget::createContent(
|
|||
contentGeometry());
|
||||
}
|
||||
|
||||
void WrapWidget::convertProfileFromStackToTab() {
|
||||
if (_historyStack.empty()) {
|
||||
return;
|
||||
}
|
||||
auto &entry = _historyStack[0];
|
||||
if (entry.section->section().type() != Section::Type::Profile) {
|
||||
return;
|
||||
}
|
||||
auto convertInsideStack = (_historyStack.size() > 1);
|
||||
auto checkSection = convertInsideStack
|
||||
? _historyStack[1].section->section()
|
||||
: _controller->section();
|
||||
auto &anotherMemento = convertInsideStack
|
||||
? _historyStack[1].anotherTab
|
||||
: _anotherTabMemento;
|
||||
if (checkSection.type() != Section::Type::Media) {
|
||||
return;
|
||||
}
|
||||
if (!Info::Media::TypeToTabIndex(checkSection.mediaType())) {
|
||||
return;
|
||||
}
|
||||
anotherMemento = std::move(entry.section);
|
||||
_historyStack.erase(_historyStack.begin());
|
||||
}
|
||||
// Was done for top level tabs support.
|
||||
//
|
||||
//void WrapWidget::convertProfileFromStackToTab() {
|
||||
// if (_historyStack.empty()) {
|
||||
// return;
|
||||
// }
|
||||
// auto &entry = _historyStack[0];
|
||||
// if (entry.section->section().type() != Section::Type::Profile) {
|
||||
// return;
|
||||
// }
|
||||
// auto convertInsideStack = (_historyStack.size() > 1);
|
||||
// auto checkSection = convertInsideStack
|
||||
// ? _historyStack[1].section->section()
|
||||
// : _controller->section();
|
||||
// auto &anotherMemento = convertInsideStack
|
||||
// ? _historyStack[1].anotherTab
|
||||
// : _anotherTabMemento;
|
||||
// if (checkSection.type() != Section::Type::Media) {
|
||||
// return;
|
||||
// }
|
||||
// if (!Info::Media::TypeToTabIndex(checkSection.mediaType())) {
|
||||
// return;
|
||||
// }
|
||||
// anotherMemento = std::move(entry.section);
|
||||
// _historyStack.erase(_historyStack.begin());
|
||||
//}
|
||||
|
||||
void WrapWidget::setWrap(Wrap wrap) {
|
||||
if (_wrap.current() != Wrap::Side && wrap == Wrap::Side) {
|
||||
convertProfileFromStackToTab();
|
||||
}
|
||||
// Was done for top level tabs support.
|
||||
//
|
||||
//if (_wrap.current() != Wrap::Side && wrap == Wrap::Side) {
|
||||
// convertProfileFromStackToTab();
|
||||
//}
|
||||
_wrap = wrap;
|
||||
}
|
||||
|
||||
|
@ -549,25 +598,25 @@ QPixmap WrapWidget::grabForShowAnimation(
|
|||
} else {
|
||||
_topShadow->setVisible(_topShadow->toggled());
|
||||
}
|
||||
if (params.withTabs && _topTabs) {
|
||||
_topTabs->hide();
|
||||
}
|
||||
//if (params.withTabs && _topTabs) {
|
||||
// _topTabs->hide();
|
||||
//}
|
||||
auto result = myGrab(this);
|
||||
if (params.withTopBarShadow) {
|
||||
_topShadow->setVisible(true);
|
||||
}
|
||||
if (params.withTabs && _topTabs) {
|
||||
_topTabs->show();
|
||||
}
|
||||
//if (params.withTabs && _topTabs) {
|
||||
// _topTabs->show();
|
||||
//}
|
||||
return result;
|
||||
}
|
||||
|
||||
void WrapWidget::showAnimatedHook(
|
||||
const Window::SectionSlideParams ¶ms) {
|
||||
if (params.withTabs && _topTabs) {
|
||||
_topTabs->show();
|
||||
_topTabsBackground->show();
|
||||
}
|
||||
//if (params.withTabs && _topTabs) {
|
||||
// _topTabs->show();
|
||||
// _topTabsBackground->show();
|
||||
//}
|
||||
if (params.withTopBarShadow) {
|
||||
_topShadow->setVisible(true);
|
||||
}
|
||||
|
@ -595,23 +644,27 @@ bool WrapWidget::showInternal(
|
|||
if (_controller->validateMementoPeer(content)
|
||||
&& infoMemento->stackSize() == 1) {
|
||||
if (!skipInternal && _content->showInternal(content)) {
|
||||
highlightTopBar();
|
||||
return true;
|
||||
} else if (_topTabs) {
|
||||
// If we open the profile being in the media tab.
|
||||
// Just switch back to the profile tab.
|
||||
auto type = content->section().type();
|
||||
if (type == Section::Type::Profile
|
||||
&& _tab != Tab::Profile) {
|
||||
_anotherTabMemento = std::move(infoMemento->takeStack().back());
|
||||
_topTabs->setActiveSection(static_cast<int>(Tab::Profile));
|
||||
return true;
|
||||
} else if (type == Section::Type::Media
|
||||
&& _tab != Tab::Media
|
||||
&& Media::TypeToTabIndex(content->section().mediaType()).has_value()) {
|
||||
_anotherTabMemento = std::move(infoMemento->takeStack().back());
|
||||
_topTabs->setActiveSection(static_cast<int>(Tab::Media));
|
||||
return true;
|
||||
}
|
||||
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//} else if (_topTabs) {
|
||||
// // If we open the profile being in the media tab.
|
||||
// // Just switch back to the profile tab.
|
||||
// auto type = content->section().type();
|
||||
// if (type == Section::Type::Profile
|
||||
// && _tab != Tab::Profile) {
|
||||
// _anotherTabMemento = std::move(infoMemento->takeStack().back());
|
||||
// _topTabs->setActiveSection(static_cast<int>(Tab::Profile));
|
||||
// return true;
|
||||
// } else if (type == Section::Type::Media
|
||||
// && _tab != Tab::Media
|
||||
// && Media::TypeToTabIndex(content->section().mediaType()).has_value()) {
|
||||
// _anotherTabMemento = std::move(infoMemento->takeStack().back());
|
||||
// _topTabs->setActiveSection(static_cast<int>(Tab::Media));
|
||||
// return true;
|
||||
// }
|
||||
}
|
||||
}
|
||||
showNewContent(
|
||||
|
@ -622,6 +675,12 @@ bool WrapWidget::showInternal(
|
|||
return false;
|
||||
}
|
||||
|
||||
void WrapWidget::highlightTopBar() {
|
||||
if (_topBar) {
|
||||
_topBar->highlight();
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<Window::SectionMemento> WrapWidget::createMemento() {
|
||||
auto stack = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
stack.reserve(_historyStack.size() + 1);
|
||||
|
@ -700,25 +759,30 @@ void WrapWidget::showNewContent(not_null<ContentMemento*> memento) {
|
|||
showContent(createContent(memento, _controller.get()));
|
||||
}
|
||||
|
||||
void WrapWidget::setupTabs(Tab tab) {
|
||||
_tab = tab;
|
||||
if (_tab == Tab::None) {
|
||||
_topTabs.destroy();
|
||||
_topTabsBackground.destroy();
|
||||
} else if (!_topTabs) {
|
||||
createTabs();
|
||||
} else {
|
||||
_topTabs->setActiveSection(static_cast<int>(tab));
|
||||
}
|
||||
}
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//void WrapWidget::setupTabs(Tab tab) {
|
||||
// _tab = tab;
|
||||
// if (_tab == Tab::None) {
|
||||
// _topTabs.destroy();
|
||||
// _topTabsBackground.destroy();
|
||||
// } else if (!_topTabs) {
|
||||
// createTabs();
|
||||
// } else {
|
||||
// _topTabs->setActiveSection(static_cast<int>(tab));
|
||||
// }
|
||||
//}
|
||||
|
||||
void WrapWidget::resizeEvent(QResizeEvent *e) {
|
||||
if (_topTabs) {
|
||||
_topTabs->resizeToWidth(width());
|
||||
_topTabsBackground->resize(
|
||||
width(),
|
||||
_topTabs->height() - st::lineWidth);
|
||||
} else if (_topBar) {
|
||||
// This was done for tabs support.
|
||||
//
|
||||
//if (_topTabs) {
|
||||
// _topTabs->resizeToWidth(width());
|
||||
// _topTabsBackground->resize(
|
||||
// width(),
|
||||
// _topTabs->height() - st::lineWidth);
|
||||
//}
|
||||
if (_topBar) {
|
||||
_topBar->resizeToWidth(width());
|
||||
}
|
||||
if (_topBarOverride) {
|
||||
|
|
|
@ -152,10 +152,11 @@ private:
|
|||
not_null<ContentMemento*> memento,
|
||||
const Window::SectionShow ¶ms);
|
||||
void setupTop();
|
||||
void setupTabbedTop();
|
||||
void setupTabs(Tab tab);
|
||||
void createTabs();
|
||||
//void setupTabbedTop();
|
||||
//void setupTabs(Tab tab);
|
||||
//void createTabs();
|
||||
void createTopBar();
|
||||
void highlightTopBar();
|
||||
|
||||
not_null<RpWidget*> topWidget() const;
|
||||
|
||||
|
@ -165,7 +166,7 @@ private:
|
|||
rpl::producer<bool> topShadowToggledValue() const;
|
||||
void updateContentGeometry();
|
||||
|
||||
void showTab(Tab tab);
|
||||
//void showTab(Tab tab);
|
||||
void showContent(object_ptr<ContentWidget> content);
|
||||
std::unique_ptr<ContentMemento> createTabMemento(Tab tab);
|
||||
object_ptr<ContentWidget> createContent(
|
||||
|
@ -174,7 +175,7 @@ private:
|
|||
std::unique_ptr<Controller> createController(
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<ContentMemento*> memento);
|
||||
void convertProfileFromStackToTab();
|
||||
//void convertProfileFromStackToTab();
|
||||
|
||||
rpl::producer<SelectedItems> selectedListValue() const;
|
||||
void refreshTopBarOverride();
|
||||
|
@ -190,8 +191,8 @@ private:
|
|||
rpl::variable<Wrap> _wrap;
|
||||
std::unique_ptr<Controller> _controller;
|
||||
object_ptr<ContentWidget> _content = { nullptr };
|
||||
object_ptr<Ui::PlainShadow> _topTabsBackground = { nullptr };
|
||||
object_ptr<Ui::SettingsSlider> _topTabs = { nullptr };
|
||||
//object_ptr<Ui::PlainShadow> _topTabsBackground = { nullptr };
|
||||
//object_ptr<Ui::SettingsSlider> _topTabs = { nullptr };
|
||||
object_ptr<TopBar> _topBar = { nullptr };
|
||||
object_ptr<TopBarOverride> _topBarOverride = { nullptr };
|
||||
Animation _topBarOverrideAnimation;
|
||||
|
|
|
@ -49,128 +49,134 @@ InnerWidget::InnerWidget(
|
|||
[this] { refreshHeight(); },
|
||||
_empty->lifetime());
|
||||
_list = setupList();
|
||||
setupOtherTypes();
|
||||
// Allows showing additional shared media links and tabs.
|
||||
// Was done for top level tabs support.
|
||||
//
|
||||
//setupOtherTypes();
|
||||
}
|
||||
|
||||
void InnerWidget::setupOtherTypes() {
|
||||
_controller->wrapValue()
|
||||
| rpl::start_with_next([this](Wrap value) {
|
||||
if (value == Wrap::Side
|
||||
&& !_controller->hasStackHistory()
|
||||
&& TypeToTabIndex(type())) {
|
||||
createOtherTypes();
|
||||
} else {
|
||||
_otherTabs = nullptr;
|
||||
_otherTypes.destroy();
|
||||
refreshHeight();
|
||||
}
|
||||
}, lifetime());
|
||||
rpl::combine(
|
||||
_controller->wrapValue(),
|
||||
_controller->searchEnabledByContent())
|
||||
| rpl::start_with_next([this](Wrap wrap, bool enabled) {
|
||||
_searchEnabled = enabled;
|
||||
refreshSearchField();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void InnerWidget::createOtherTypes() {
|
||||
_otherTabsShadow.create(this);
|
||||
_otherTabsShadow->show();
|
||||
|
||||
_otherTabs = nullptr;
|
||||
_otherTypes.create(this);
|
||||
_otherTypes->show();
|
||||
|
||||
createTypeButtons();
|
||||
_otherTypes->add(object_ptr<BoxContentDivider>(_otherTypes));
|
||||
createTabs();
|
||||
|
||||
_otherTypes->heightValue()
|
||||
| rpl::start_with_next(
|
||||
[this] { refreshHeight(); },
|
||||
_otherTypes->lifetime());
|
||||
}
|
||||
|
||||
void InnerWidget::createTypeButtons() {
|
||||
auto wrap = _otherTypes->add(object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
_otherTypes,
|
||||
object_ptr<Ui::VerticalLayout>(_otherTypes)));
|
||||
auto content = wrap->entity();
|
||||
content->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
content,
|
||||
st::infoProfileSkip));
|
||||
|
||||
auto tracker = Ui::MultiSlideTracker();
|
||||
auto addMediaButton = [&](
|
||||
Type type,
|
||||
const style::icon &icon) {
|
||||
auto result = AddButton(
|
||||
content,
|
||||
_controller->window(),
|
||||
_controller->peer(),
|
||||
_controller->migrated(),
|
||||
type,
|
||||
tracker);
|
||||
object_ptr<Profile::FloatingIcon>(
|
||||
result,
|
||||
icon,
|
||||
st::infoSharedMediaButtonIconPosition);
|
||||
};
|
||||
auto addCommonGroupsButton = [&](
|
||||
not_null<UserData*> user,
|
||||
const style::icon &icon) {
|
||||
auto result = AddCommonGroupsButton(
|
||||
content,
|
||||
_controller->window(),
|
||||
user,
|
||||
tracker);
|
||||
object_ptr<Profile::FloatingIcon>(
|
||||
result,
|
||||
icon,
|
||||
st::infoSharedMediaButtonIconPosition);
|
||||
};
|
||||
|
||||
addMediaButton(Type::MusicFile, st::infoIconMediaAudio);
|
||||
addMediaButton(Type::Link, st::infoIconMediaLink);
|
||||
if (auto user = _controller->peer()->asUser()) {
|
||||
addCommonGroupsButton(user, st::infoIconMediaGroup);
|
||||
}
|
||||
addMediaButton(Type::VoiceFile, st::infoIconMediaVoice);
|
||||
// addMediaButton(Type::RoundFile, st::infoIconMediaRound);
|
||||
|
||||
content->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
content,
|
||||
st::infoProfileSkip));
|
||||
wrap->toggleOn(tracker.atLeastOneShownValue());
|
||||
wrap->finishAnimating();
|
||||
}
|
||||
|
||||
void InnerWidget::createTabs() {
|
||||
_otherTabs = _otherTypes->add(object_ptr<Ui::SettingsSlider>(
|
||||
this,
|
||||
st::infoTabs));
|
||||
auto sections = QStringList();
|
||||
sections.push_back(lang(lng_media_type_photos).toUpper());
|
||||
sections.push_back(lang(lng_media_type_videos).toUpper());
|
||||
sections.push_back(lang(lng_media_type_files).toUpper());
|
||||
_otherTabs->setSections(sections);
|
||||
_otherTabs->setActiveSection(*TypeToTabIndex(type()));
|
||||
_otherTabs->finishAnimating();
|
||||
|
||||
_otherTabs->sectionActivated()
|
||||
| rpl::map([](int index) { return TabIndexToType(index); })
|
||||
| rpl::start_with_next(
|
||||
[this](Type newType) {
|
||||
if (type() != newType) {
|
||||
switchToTab(Memento(
|
||||
_controller->peerId(),
|
||||
_controller->migratedPeerId(),
|
||||
newType));
|
||||
}
|
||||
},
|
||||
_otherTabs->lifetime());
|
||||
}
|
||||
// Allows showing additional shared media links and tabs.
|
||||
// Was done for top level tabs support.
|
||||
//
|
||||
//void InnerWidget::setupOtherTypes() {
|
||||
// _controller->wrapValue()
|
||||
// | rpl::start_with_next([this](Wrap value) {
|
||||
// if (value == Wrap::Side
|
||||
// && !_controller->hasStackHistory()
|
||||
// && TypeToTabIndex(type())) {
|
||||
// createOtherTypes();
|
||||
// } else {
|
||||
// _otherTabs = nullptr;
|
||||
// _otherTypes.destroy();
|
||||
// refreshHeight();
|
||||
// }
|
||||
// }, lifetime());
|
||||
// rpl::combine(
|
||||
// _controller->wrapValue(),
|
||||
// _controller->searchEnabledByContent())
|
||||
// | rpl::start_with_next([this](Wrap wrap, bool enabled) {
|
||||
// _searchEnabled = enabled;
|
||||
// refreshSearchField();
|
||||
// }, lifetime());
|
||||
//}
|
||||
//
|
||||
//void InnerWidget::createOtherTypes() {
|
||||
// _otherTabsShadow.create(this);
|
||||
// _otherTabsShadow->show();
|
||||
//
|
||||
// _otherTabs = nullptr;
|
||||
// _otherTypes.create(this);
|
||||
// _otherTypes->show();
|
||||
//
|
||||
// createTypeButtons();
|
||||
// _otherTypes->add(object_ptr<BoxContentDivider>(_otherTypes));
|
||||
// createTabs();
|
||||
//
|
||||
// _otherTypes->heightValue()
|
||||
// | rpl::start_with_next(
|
||||
// [this] { refreshHeight(); },
|
||||
// _otherTypes->lifetime());
|
||||
//}
|
||||
//
|
||||
//void InnerWidget::createTypeButtons() {
|
||||
// auto wrap = _otherTypes->add(object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
// _otherTypes,
|
||||
// object_ptr<Ui::VerticalLayout>(_otherTypes)));
|
||||
// auto content = wrap->entity();
|
||||
// content->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
// content,
|
||||
// st::infoProfileSkip));
|
||||
//
|
||||
// auto tracker = Ui::MultiSlideTracker();
|
||||
// auto addMediaButton = [&](
|
||||
// Type type,
|
||||
// const style::icon &icon) {
|
||||
// auto result = AddButton(
|
||||
// content,
|
||||
// _controller->window(),
|
||||
// _controller->peer(),
|
||||
// _controller->migrated(),
|
||||
// type,
|
||||
// tracker);
|
||||
// object_ptr<Profile::FloatingIcon>(
|
||||
// result,
|
||||
// icon,
|
||||
// st::infoSharedMediaButtonIconPosition);
|
||||
// };
|
||||
// auto addCommonGroupsButton = [&](
|
||||
// not_null<UserData*> user,
|
||||
// const style::icon &icon) {
|
||||
// auto result = AddCommonGroupsButton(
|
||||
// content,
|
||||
// _controller->window(),
|
||||
// user,
|
||||
// tracker);
|
||||
// object_ptr<Profile::FloatingIcon>(
|
||||
// result,
|
||||
// icon,
|
||||
// st::infoSharedMediaButtonIconPosition);
|
||||
// };
|
||||
//
|
||||
// addMediaButton(Type::MusicFile, st::infoIconMediaAudio);
|
||||
// addMediaButton(Type::Link, st::infoIconMediaLink);
|
||||
// if (auto user = _controller->peer()->asUser()) {
|
||||
// addCommonGroupsButton(user, st::infoIconMediaGroup);
|
||||
// }
|
||||
// addMediaButton(Type::VoiceFile, st::infoIconMediaVoice);
|
||||
//// addMediaButton(Type::RoundFile, st::infoIconMediaRound);
|
||||
//
|
||||
// content->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
// content,
|
||||
// st::infoProfileSkip));
|
||||
// wrap->toggleOn(tracker.atLeastOneShownValue());
|
||||
// wrap->finishAnimating();
|
||||
//}
|
||||
//
|
||||
//void InnerWidget::createTabs() {
|
||||
// _otherTabs = _otherTypes->add(object_ptr<Ui::SettingsSlider>(
|
||||
// this,
|
||||
// st::infoTabs));
|
||||
// auto sections = QStringList();
|
||||
// sections.push_back(lang(lng_media_type_photos).toUpper());
|
||||
// sections.push_back(lang(lng_media_type_videos).toUpper());
|
||||
// sections.push_back(lang(lng_media_type_files).toUpper());
|
||||
// _otherTabs->setSections(sections);
|
||||
// _otherTabs->setActiveSection(*TypeToTabIndex(type()));
|
||||
// _otherTabs->finishAnimating();
|
||||
//
|
||||
// _otherTabs->sectionActivated()
|
||||
// | rpl::map([](int index) { return TabIndexToType(index); })
|
||||
// | rpl::start_with_next(
|
||||
// [this](Type newType) {
|
||||
// if (type() != newType) {
|
||||
// switchToTab(Memento(
|
||||
// _controller->peerId(),
|
||||
// _controller->migratedPeerId(),
|
||||
// newType));
|
||||
// }
|
||||
// },
|
||||
// _otherTabs->lifetime());
|
||||
//}
|
||||
|
||||
Type InnerWidget::type() const {
|
||||
return _controller->section().mediaType();
|
||||
|
@ -190,54 +196,62 @@ bool InnerWidget::showInternal(not_null<Memento*> memento) {
|
|||
if (mementoType == type()) {
|
||||
restoreState(memento);
|
||||
return true;
|
||||
} else if (_otherTypes) {
|
||||
if (TypeToTabIndex(mementoType)) {
|
||||
switchToTab(std::move(*memento));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allows showing additional shared media links and tabs.
|
||||
// Was done for top level tabs support.
|
||||
//
|
||||
//} else if (_otherTypes) {
|
||||
// if (TypeToTabIndex(mementoType)) {
|
||||
// switchToTab(std::move(*memento));
|
||||
// return true;
|
||||
// }
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void InnerWidget::switchToTab(Memento &&memento) {
|
||||
// Save state of the tab before setSection() call.
|
||||
_controller->setSection(&memento);
|
||||
_list = setupList();
|
||||
restoreState(&memento);
|
||||
_list->show();
|
||||
_list->resizeToWidth(width());
|
||||
refreshHeight();
|
||||
if (_otherTypes) {
|
||||
_otherTabsShadow->raise();
|
||||
_otherTypes->raise();
|
||||
_otherTabs->setActiveSection(*TypeToTabIndex(type()));
|
||||
}
|
||||
}
|
||||
|
||||
void InnerWidget::refreshSearchField() {
|
||||
auto search = _controller->searchFieldController();
|
||||
if (search && _otherTabs && _searchEnabled) {
|
||||
_searchField = search->createRowView(
|
||||
this,
|
||||
st::infoMediaSearch);
|
||||
_searchField->resizeToWidth(width());
|
||||
_searchField->show();
|
||||
search->queryChanges()
|
||||
| rpl::start_with_next([this] {
|
||||
scrollToSearchField();
|
||||
}, _searchField->lifetime());
|
||||
} else {
|
||||
_searchField = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void InnerWidget::scrollToSearchField() {
|
||||
Expects(_searchField != nullptr);
|
||||
|
||||
auto top = _searchField->y();
|
||||
auto bottom = top + _searchField->height();
|
||||
_scrollToRequests.fire({ top, bottom });
|
||||
}
|
||||
// Allows showing additional shared media links and tabs.
|
||||
// Was done for top level tabs support.
|
||||
//
|
||||
//void InnerWidget::switchToTab(Memento &&memento) {
|
||||
// // Save state of the tab before setSection() call.
|
||||
// _controller->setSection(&memento);
|
||||
// _list = setupList();
|
||||
// restoreState(&memento);
|
||||
// _list->show();
|
||||
// _list->resizeToWidth(width());
|
||||
// refreshHeight();
|
||||
// if (_otherTypes) {
|
||||
// _otherTabsShadow->raise();
|
||||
// _otherTypes->raise();
|
||||
// _otherTabs->setActiveSection(*TypeToTabIndex(type()));
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void InnerWidget::refreshSearchField() {
|
||||
// auto search = _controller->searchFieldController();
|
||||
// if (search && _otherTabs && _searchEnabled) {
|
||||
// _searchField = search->createRowView(
|
||||
// this,
|
||||
// st::infoMediaSearch);
|
||||
// _searchField->resizeToWidth(width());
|
||||
// _searchField->show();
|
||||
// search->queryChanges()
|
||||
// | rpl::start_with_next([this] {
|
||||
// scrollToSearchField();
|
||||
// }, _searchField->lifetime());
|
||||
// } else {
|
||||
// _searchField = nullptr;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void InnerWidget::scrollToSearchField() {
|
||||
// Expects(_searchField != nullptr);
|
||||
//
|
||||
// auto top = _searchField->y();
|
||||
// auto bottom = top + _searchField->height();
|
||||
// _scrollToRequests.fire({ top, bottom });
|
||||
//}
|
||||
|
||||
object_ptr<ListWidget> InnerWidget::setupList() {
|
||||
auto result = object_ptr<ListWidget>(
|
||||
|
@ -291,13 +305,13 @@ int InnerWidget::resizeGetHeight(int newWidth) {
|
|||
_inResize = true;
|
||||
auto guard = gsl::finally([this] { _inResize = false; });
|
||||
|
||||
if (_otherTypes) {
|
||||
_otherTypes->resizeToWidth(newWidth);
|
||||
_otherTabsShadow->resizeToWidth(newWidth);
|
||||
}
|
||||
if (_searchField) {
|
||||
_searchField->resizeToWidth(newWidth);
|
||||
}
|
||||
//if (_otherTypes) {
|
||||
// _otherTypes->resizeToWidth(newWidth);
|
||||
// _otherTabsShadow->resizeToWidth(newWidth);
|
||||
//}
|
||||
//if (_searchField) {
|
||||
// _searchField->resizeToWidth(newWidth);
|
||||
//}
|
||||
_list->resizeToWidth(newWidth);
|
||||
_empty->resizeToWidth(newWidth);
|
||||
return recountHeight();
|
||||
|
@ -312,15 +326,15 @@ void InnerWidget::refreshHeight() {
|
|||
|
||||
int InnerWidget::recountHeight() {
|
||||
auto top = 0;
|
||||
if (_otherTypes) {
|
||||
_otherTypes->moveToLeft(0, top);
|
||||
top += _otherTypes->heightNoMargins() - st::lineWidth;
|
||||
_otherTabsShadow->moveToLeft(0, top);
|
||||
}
|
||||
if (_searchField) {
|
||||
_searchField->moveToLeft(0, top);
|
||||
top += _searchField->heightNoMargins() - st::lineWidth;
|
||||
}
|
||||
//if (_otherTypes) {
|
||||
// _otherTypes->moveToLeft(0, top);
|
||||
// top += _otherTypes->heightNoMargins() - st::lineWidth;
|
||||
// _otherTabsShadow->moveToLeft(0, top);
|
||||
//}
|
||||
//if (_searchField) {
|
||||
// _searchField->moveToLeft(0, top);
|
||||
// top += _searchField->heightNoMargins() - st::lineWidth;
|
||||
//}
|
||||
auto listHeight = 0;
|
||||
if (_list) {
|
||||
_list->moveToLeft(0, top);
|
||||
|
|
|
@ -72,27 +72,30 @@ protected:
|
|||
private:
|
||||
int recountHeight();
|
||||
void refreshHeight();
|
||||
void setupOtherTypes();
|
||||
void createOtherTypes();
|
||||
void createTypeButtons();
|
||||
void createTabs();
|
||||
void switchToTab(Memento &&memento);
|
||||
// Allows showing additional shared media links and tabs.
|
||||
// Was done for top level tabs support.
|
||||
//
|
||||
//void setupOtherTypes();
|
||||
//void createOtherTypes();
|
||||
//void createTypeButtons();
|
||||
//void createTabs();
|
||||
//void switchToTab(Memento &&memento);
|
||||
//void refreshSearchField();
|
||||
//void scrollToSearchField();
|
||||
|
||||
Type type() const;
|
||||
|
||||
void refreshSearchField();
|
||||
void scrollToSearchField();
|
||||
object_ptr<ListWidget> setupList();
|
||||
|
||||
const not_null<Controller*> _controller;
|
||||
|
||||
Ui::SettingsSlider *_otherTabs = nullptr;
|
||||
object_ptr<Ui::VerticalLayout> _otherTypes = { nullptr };
|
||||
object_ptr<Ui::PlainShadow> _otherTabsShadow = { nullptr };
|
||||
base::unique_qptr<Ui::RpWidget> _searchField = nullptr;
|
||||
//Ui::SettingsSlider *_otherTabs = nullptr;
|
||||
//object_ptr<Ui::VerticalLayout> _otherTypes = { nullptr };
|
||||
//object_ptr<Ui::PlainShadow> _otherTabsShadow = { nullptr };
|
||||
//base::unique_qptr<Ui::RpWidget> _searchField = nullptr;
|
||||
object_ptr<ListWidget> _list = { nullptr };
|
||||
object_ptr<EmptyWidget> _empty;
|
||||
bool _searchEnabled = false;
|
||||
//bool _searchEnabled = false;
|
||||
|
||||
bool _inResize = false;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ InnerWidget::InnerWidget(
|
|||
}
|
||||
|
||||
bool InnerWidget::canHideDetailsEver() const {
|
||||
return (_peer->isChat() || _peer->isMegagroup());
|
||||
return false;// (_peer->isChat() || _peer->isMegagroup());
|
||||
}
|
||||
|
||||
rpl::producer<bool> InnerWidget::canHideDetails() const {
|
||||
|
@ -188,28 +188,34 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
|||
object_ptr<Ui::VerticalLayout>(parent)
|
||||
);
|
||||
|
||||
using ToggledData = std::tuple<bool, Wrap, bool>;
|
||||
rpl::combine(
|
||||
tracker.atLeastOneShownValue(),
|
||||
_controller->wrapValue(),
|
||||
_isStackBottom.value())
|
||||
| rpl::combine_previous(ToggledData())
|
||||
| rpl::start_with_next([wrap = result.data()](
|
||||
const ToggledData &was,
|
||||
const ToggledData &now) {
|
||||
bool wasOneShown, wasStackBottom, nowOneShown, nowStackBottom;
|
||||
Wrap wasWrap, nowWrap;
|
||||
std::tie(wasOneShown, wasWrap, wasStackBottom) = was;
|
||||
std::tie(nowOneShown, nowWrap, nowStackBottom) = now;
|
||||
// MSVC Internal Compiler Error
|
||||
//auto [wasOneShown, wasWrap, wasStackBottom] = was;
|
||||
//auto [nowOneShown, nowWrap, nowStackBottom] = now;
|
||||
wrap->toggle(
|
||||
nowOneShown && (nowWrap != Wrap::Side || !nowStackBottom),
|
||||
(wasStackBottom == nowStackBottom && wasWrap == nowWrap)
|
||||
? anim::type::normal
|
||||
: anim::type::instant);
|
||||
}, result->lifetime());
|
||||
// Allows removing shared media links in third column.
|
||||
// Was done for tabs support.
|
||||
//
|
||||
//using ToggledData = std::tuple<bool, Wrap, bool>;
|
||||
//rpl::combine(
|
||||
// tracker.atLeastOneShownValue(),
|
||||
// _controller->wrapValue(),
|
||||
// _isStackBottom.value())
|
||||
// | rpl::combine_previous(ToggledData())
|
||||
// | rpl::start_with_next([wrap = result.data()](
|
||||
// const ToggledData &was,
|
||||
// const ToggledData &now) {
|
||||
// bool wasOneShown, wasStackBottom, nowOneShown, nowStackBottom;
|
||||
// Wrap wasWrap, nowWrap;
|
||||
// std::tie(wasOneShown, wasWrap, wasStackBottom) = was;
|
||||
// std::tie(nowOneShown, nowWrap, nowStackBottom) = now;
|
||||
// // MSVC Internal Compiler Error
|
||||
// //auto [wasOneShown, wasWrap, wasStackBottom] = was;
|
||||
// //auto [nowOneShown, nowWrap, nowStackBottom] = now;
|
||||
// wrap->toggle(
|
||||
// nowOneShown && (nowWrap != Wrap::Side || !nowStackBottom),
|
||||
// (wasStackBottom == nowStackBottom && wasWrap == nowWrap)
|
||||
// ? anim::type::normal
|
||||
// : anim::type::instant);
|
||||
// }, result->lifetime());
|
||||
//
|
||||
// Using that instead
|
||||
result->toggleOn(tracker.atLeastOneShownValue());
|
||||
|
||||
auto layout = result->entity();
|
||||
|
||||
|
|
|
@ -1158,4 +1158,6 @@ InfoTopBar {
|
|||
mediaDelete: IconButton;
|
||||
search: IconButton;
|
||||
searchRow: SearchFieldRow;
|
||||
highlightBg: color;
|
||||
highlightDuration: int;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue