2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Improve history -> profile top bar navigation.

This commit is contained in:
John Preston
2017-11-16 19:24:01 +04:00
parent 903aa46e5c
commit cf977cb41a
11 changed files with 124 additions and 102 deletions

View File

@@ -620,6 +620,7 @@ void WrapWidget::showAnimatedHook(
if (params.withTopBarShadow) {
_topShadow->setVisible(true);
}
_topBarSurrogate = createTopBarSurrogate(this);
}
void WrapWidget::doSetInnerFocus() {
@@ -629,6 +630,7 @@ void WrapWidget::doSetInnerFocus() {
void WrapWidget::showFinishedHook() {
// Restore shadow visibility after showChildren() call.
_topShadow->toggle(_topShadow->toggled(), anim::type::instant);
_topBarSurrogate.destroy();
}
bool WrapWidget::showInternal(
@@ -807,6 +809,24 @@ QRect WrapWidget::rectForFloatPlayer() const {
return _content->rectForFloatPlayer();
}
object_ptr<Ui::RpWidget> WrapWidget::createTopBarSurrogate(
QWidget *parent) {
if (hasStackHistory() || wrap() == Wrap::Narrow) {
Assert(_topBar != nullptr);
auto result = object_ptr<Ui::AbstractButton>(parent);
result->addClickHandler([wrap = weak(this)]{
if (wrap) {
wrap->showBackFromStack();
}
});
result->setGeometry(_topBar->geometry());
result->show();
return std::move(result);
}
return nullptr;
}
WrapWidget::~WrapWidget() = default;
} // namespace Info