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

Use new animations engine in all Basic-s.

This commit is contained in:
John Preston
2019-04-01 21:44:54 +04:00
parent cd3c1c6dc0
commit a6e96f9a28
41 changed files with 479 additions and 487 deletions

View File

@@ -58,7 +58,7 @@ private:
QRect radialRect() const;
void radialStart();
crl::time radialTimeShift() const;
void step_radial(crl::time ms, bool timer);
void radialAnimationCallback(crl::time now);
QPixmap _background;
object_ptr<Ui::LinkButton> _chooseFromGallery;
@@ -114,7 +114,7 @@ BackgroundRow::BackgroundRow(QWidget *parent) : RpWidget(parent)
lang(lng_settings_bg_from_gallery),
st::settingsLink)
, _chooseFromFile(this, lang(lng_settings_bg_from_file), st::settingsLink)
, _radial(animation(this, &BackgroundRow::step_radial)) {
, _radial([=](crl::time now) { radialAnimationCallback(now); }) {
updateImage();
_chooseFromGallery->addClickHandler([] {
@@ -139,13 +139,8 @@ BackgroundRow::BackgroundRow(QWidget *parent) : RpWidget(parent)
void BackgroundRow::paintEvent(QPaintEvent *e) {
Painter p(this);
bool radial = false;
float64 radialOpacity = 0;
if (_radial.animating()) {
_radial.step(crl::now());
radial = _radial.animating();
radialOpacity = _radial.opacity();
}
const auto radial = _radial.animating();
const auto radialOpacity = radial ? _radial.opacity() : 0.;
if (radial) {
const auto backThumb = App::main()->newBackgroundThumb();
if (!backThumb) {
@@ -249,12 +244,12 @@ crl::time BackgroundRow::radialTimeShift() const {
return st::radialDuration;
}
void BackgroundRow::step_radial(crl::time ms, bool timer) {
void BackgroundRow::radialAnimationCallback(crl::time now) {
const auto updated = _radial.update(
radialProgress(),
!radialLoading(),
ms + radialTimeShift());
if (timer && _radial.animating() && (!anim::Disabled() || updated)) {
now + radialTimeShift());
if (!anim::Disabled() || updated) {
rtlupdate(radialRect());
}
}