2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +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

@@ -52,7 +52,7 @@ protected:
private:
void setupControls(View &&view);
int countAvailableWidth() const;
void step_radial(crl::time ms, bool timer);
void radialAnimationCallback();
void paintCheck(Painter &p, crl::time ms);
void showMenu();
@@ -209,7 +209,7 @@ void ProxyRow::updateFields(View &&view) {
if (state == State::Connecting) {
if (!_progress) {
_progress = std::make_unique<Ui::InfiniteRadialAnimation>(
animation(this, &ProxyRow::step_radial),
[=] { radialAnimationCallback(); },
st::proxyCheckingAnimation);
}
_progress->start();
@@ -219,7 +219,7 @@ void ProxyRow::updateFields(View &&view) {
if (state == State::Checking) {
if (!_checking) {
_checking = std::make_unique<Ui::InfiniteRadialAnimation>(
animation(this, &ProxyRow::step_radial),
[=] { radialAnimationCallback(); },
st::proxyCheckingAnimation);
_checking->start();
}
@@ -241,8 +241,8 @@ void ProxyRow::updateFields(View &&view) {
update();
}
void ProxyRow::step_radial(crl::time ms, bool timer) {
if (timer && !anim::Disabled()) {
void ProxyRow::radialAnimationCallback() {
if (!anim::Disabled()) {
update();
}
}
@@ -323,28 +323,22 @@ void ProxyRow::paintEvent(QPaintEvent *e) {
auto statusLeft = left;
if (_checking) {
_checking->step(ms);
if (_checking) {
_checking->draw(
p,
{
st::proxyCheckingPosition.x() + statusLeft,
st::proxyCheckingPosition.y() + top
},
width());
statusLeft += st::proxyCheckingPosition.x()
+ st::proxyCheckingAnimation.size.width()
+ st::proxyCheckingSkip;
}
_checking->draw(
p,
{
st::proxyCheckingPosition.x() + statusLeft,
st::proxyCheckingPosition.y() + top
},
width());
statusLeft += st::proxyCheckingPosition.x()
+ st::proxyCheckingAnimation.size.width()
+ st::proxyCheckingSkip;
}
p.drawTextLeft(statusLeft, top, width(), status);
top += st::normalFont->height + st::proxyRowPadding.bottom();
}
void ProxyRow::paintCheck(Painter &p, crl::time ms) {
if (_progress) {
_progress->step(ms);
}
const auto loading = _progress
? _progress->computeState()
: Ui::RadialState{ 0., 0, FullArcLength };