2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Animate child topics list open / close.

This commit is contained in:
John Preston
2022-12-01 17:48:33 +04:00
parent 468d01fc1a
commit 32491ead5e
8 changed files with 224 additions and 58 deletions

View File

@@ -141,7 +141,8 @@ int InnerWidget::FilterResult::bottom() const {
InnerWidget::InnerWidget(
QWidget *parent,
not_null<Window::SessionController*> controller)
not_null<Window::SessionController*> controller,
rpl::producer<ChildListShown> childListShown)
: RpWidget(parent)
, _controller(controller)
, _shownList(controller->session().data().chatsList()->indexed())
@@ -153,7 +154,8 @@ InnerWidget::InnerWidget(
+ st::defaultDialogRow.photoSize
+ st::defaultDialogRow.padding.left())
, _cancelSearchInChat(this, st::dialogsCancelSearchInPeer)
, _cancelSearchFromUser(this, st::dialogsCancelSearchInPeer) {
, _cancelSearchFromUser(this, st::dialogsCancelSearchInPeer)
, _childListShown(std::move(childListShown)) {
setAttribute(Qt::WA_OpaquePaintEvent, true);
_cancelSearchInChat->hide();
@@ -546,7 +548,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
const auto r = e->rect();
auto dialogsClip = r;
const auto ms = crl::now();
const auto shownForum = _controller->shownForum().current();
const auto childListShown = _childListShown.current();
const auto paintRow = [&](
not_null<Row*> row,
bool selected,
@@ -558,23 +560,25 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
if (forum && !_topicJumpCache) {
_topicJumpCache = std::make_unique<Ui::TopicJumpCache>();
}
const auto expanded = !active
const auto expanded = (!active
&& forum
&& !_openedForum
&& (key.history()->peer->forum() == shownForum);
&& (key.history()->peer->id == childListShown.peerId))
? childListShown.shown
: 0.;
Ui::RowPainter::Paint(p, row, validateVideoUserpic(row), {
.st = (forum ? &st::forumDialogRow : _st.get()),
.topicJumpCache = _topicJumpCache.get(),
.folder = _openedFolder,
.forum = _openedForum,
.filter = _filterId,
.topicsExpanded = expanded,
.now = ms,
.width = fullWidth,
.active = active,
.selected = (_menuRow.key
? (row->key() == _menuRow.key)
: selected),
.topicsExpanded = expanded,
.topicJumpSelected = (selected
&& _selectedTopicJump
&& (!_pressed || _pressedTopicJump)),