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