mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 22:46:10 +00:00
Profile done as a new generic Window::SectionWidget.
Slide animation reimplemented.
This commit is contained in:
@@ -661,7 +661,7 @@ bool DialogsInner::menuPeerMuted() {
|
||||
|
||||
void DialogsInner::onContextProfile() {
|
||||
if (!_menuPeer) return;
|
||||
App::main()->showPeerProfile(_menuPeer);
|
||||
Ui::showPeerProfile(_menuPeer);
|
||||
}
|
||||
|
||||
void DialogsInner::onContextToggleNotifications() {
|
||||
@@ -1849,27 +1849,30 @@ void DialogsWidget::dialogsToUp() {
|
||||
}
|
||||
}
|
||||
|
||||
void DialogsWidget::animShow(const QPixmap &bgAnimCache) {
|
||||
void DialogsWidget::showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams ¶ms) {
|
||||
if (App::app()) App::app()->mtpPause();
|
||||
|
||||
bool back = true;
|
||||
(back ? _cacheOver : _cacheUnder) = bgAnimCache;
|
||||
_cacheUnder = params.oldContentCache;
|
||||
show();
|
||||
_cacheOver = App::main()->grabForShowAnimation(params);
|
||||
|
||||
_a_show.stop();
|
||||
|
||||
(back ? _cacheUnder : _cacheOver) = myGrab(this);
|
||||
|
||||
_scroll.hide();
|
||||
_filter.hide();
|
||||
_cancelSearch.hide();
|
||||
_newGroup.hide();
|
||||
|
||||
a_coordUnder = back ? anim::ivalue(-st::slideShift, 0) : anim::ivalue(0, -st::slideShift);
|
||||
a_coordOver = back ? anim::ivalue(0, width()) : anim::ivalue(width(), 0);
|
||||
a_shadow = back ? anim::fvalue(1, 0) : anim::fvalue(0, 1);
|
||||
int delta = st::slideShift;
|
||||
a_progress = anim::fvalue(0, 1);
|
||||
if (direction == Window::SlideDirection::FromLeft) {
|
||||
a_coordUnder = anim::ivalue(0, delta);
|
||||
a_coordOver = anim::ivalue(-delta, 0);
|
||||
} else {
|
||||
a_coordUnder = anim::ivalue(0, -delta);
|
||||
a_coordOver = anim::ivalue(delta, 0);
|
||||
}
|
||||
_a_show.start();
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
void DialogsWidget::step_show(float64 ms, bool timer) {
|
||||
@@ -1879,7 +1882,7 @@ void DialogsWidget::step_show(float64 ms, bool timer) {
|
||||
|
||||
a_coordUnder.finish();
|
||||
a_coordOver.finish();
|
||||
a_shadow.finish();
|
||||
a_progress.finish();
|
||||
|
||||
_cacheUnder = _cacheOver = QPixmap();
|
||||
|
||||
@@ -1894,7 +1897,7 @@ void DialogsWidget::step_show(float64 ms, bool timer) {
|
||||
} else {
|
||||
a_coordUnder.update(dt, st::slideFunction);
|
||||
a_coordOver.update(dt, st::slideFunction);
|
||||
a_shadow.update(dt, st::slideFunction);
|
||||
a_progress.update(dt, st::slideFunction);
|
||||
}
|
||||
if (timer) update();
|
||||
}
|
||||
@@ -2535,15 +2538,24 @@ void DialogsWidget::paintEvent(QPaintEvent *e) {
|
||||
p.setClipRect(r);
|
||||
}
|
||||
if (_a_show.animating()) {
|
||||
if (a_coordOver.current() > 0) {
|
||||
p.drawPixmap(QRect(0, 0, a_coordOver.current(), height()), _cacheUnder, QRect(-a_coordUnder.current() * cRetinaFactor(), 0, a_coordOver.current() * cRetinaFactor(), height() * cRetinaFactor()));
|
||||
p.setOpacity(a_shadow.current() * st::slideFadeOut);
|
||||
p.fillRect(0, 0, a_coordOver.current(), height(), st::black->b);
|
||||
p.setOpacity(1);
|
||||
int retina = cIntRetinaFactor();
|
||||
if (a_progress.current() < 1) {
|
||||
int underLeft = a_coordUnder.current();
|
||||
int underWidth = _cacheUnder.width() / retina;
|
||||
int underHeight = _cacheUnder.height() / retina;
|
||||
p.fillRect(r, st::white);
|
||||
QRect underDst(0, 0, underWidth + underLeft, underHeight);
|
||||
QRect underSrc(-underLeft * retina, 0, (underWidth + underLeft) * retina, underHeight * retina);
|
||||
p.setOpacity(1. - a_progress.current());
|
||||
p.drawPixmap(underDst, _cacheUnder, underSrc);
|
||||
p.setOpacity(a_progress.current());
|
||||
}
|
||||
p.drawPixmap(a_coordOver.current(), 0, _cacheOver);
|
||||
p.setOpacity(a_shadow.current());
|
||||
p.drawPixmap(QRect(a_coordOver.current() - st::slideShadow.pxWidth(), 0, st::slideShadow.pxWidth(), height()), App::sprite(), st::slideShadow.rect());
|
||||
int overLeft = a_coordOver.current();
|
||||
int overWidth = _cacheOver.width() / retina;
|
||||
int overHeight = _cacheOver.height() / retina;
|
||||
QRect overDst(overLeft, 0, overWidth - overLeft, overHeight);
|
||||
QRect overSrc(0, 0, (overWidth - overLeft) * retina, overHeight * retina);
|
||||
p.drawPixmap(overDst, _cacheOver, overSrc);
|
||||
return;
|
||||
}
|
||||
QRect above(0, 0, width(), _scroll.y());
|
||||
|
Reference in New Issue
Block a user