mirror of https://github.com/procxx/kepka.git
				
				
				
			Finish animations disabling.
Replace some infinite animations with static layouts.
This commit is contained in:
		
							parent
							
								
									f68466b072
								
							
						
					
					
						commit
						1ffbec0215
					
				| 
						 | 
					@ -253,7 +253,7 @@ void ProxyRow::updateFields(View &&view) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ProxyRow::step_radial(TimeMs ms, bool timer) {
 | 
					void ProxyRow::step_radial(TimeMs ms, bool timer) {
 | 
				
			||||||
	if (timer) {
 | 
						if (timer && !anim::Disabled()) {
 | 
				
			||||||
		update();
 | 
							update();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -375,13 +375,20 @@ void ProxyRow::paintCheck(Painter &p, TimeMs ms) {
 | 
				
			||||||
	p.setPen(pen);
 | 
						p.setPen(pen);
 | 
				
			||||||
	p.setBrush(_st->bg);
 | 
						p.setBrush(_st->bg);
 | 
				
			||||||
	const auto rect = rtlrect(QRectF(left, top, _st->diameter, _st->diameter).marginsRemoved(QMarginsF(_st->thickness / 2., _st->thickness / 2., _st->thickness / 2., _st->thickness / 2.)), outerWidth);
 | 
						const auto rect = rtlrect(QRectF(left, top, _st->diameter, _st->diameter).marginsRemoved(QMarginsF(_st->thickness / 2., _st->thickness / 2., _st->thickness / 2., _st->thickness / 2.)), outerWidth);
 | 
				
			||||||
	if (loading.arcLength < FullArcLength) {
 | 
						if (_progress && loading.shown > 0 && anim::Disabled()) {
 | 
				
			||||||
 | 
							anim::DrawStaticLoading(
 | 
				
			||||||
 | 
								p,
 | 
				
			||||||
 | 
								rect,
 | 
				
			||||||
 | 
								_st->thickness,
 | 
				
			||||||
 | 
								pen.color(),
 | 
				
			||||||
 | 
								_st->bg);
 | 
				
			||||||
 | 
						} else if (loading.arcLength < FullArcLength) {
 | 
				
			||||||
		p.drawArc(rect, loading.arcFrom, loading.arcLength);
 | 
							p.drawArc(rect, loading.arcFrom, loading.arcLength);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		p.drawEllipse(rect);
 | 
							p.drawEllipse(rect);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (toggled > 0) {
 | 
						if (toggled > 0 && (!_progress || !anim::Disabled())) {
 | 
				
			||||||
		p.setPen(Qt::NoPen);
 | 
							p.setPen(Qt::NoPen);
 | 
				
			||||||
		p.setBrush(anim::brush(_st->untoggledFg, _st->toggledFg, toggled * set));
 | 
							p.setBrush(anim::brush(_st->untoggledFg, _st->toggledFg, toggled * set));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -186,7 +186,7 @@ void LocalStorageBox::Row::toggleProgress(bool shown) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void LocalStorageBox::Row::step_radial(TimeMs ms, bool timer) {
 | 
					void LocalStorageBox::Row::step_radial(TimeMs ms, bool timer) {
 | 
				
			||||||
	if (timer) {
 | 
						if (timer && !anim::Disabled()) {
 | 
				
			||||||
		RpWidget::update();
 | 
							RpWidget::update();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1204,6 +1204,9 @@ void StickersBox::Inner::leaveToChildEvent(QEvent *e, QWidget *child) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void StickersBox::Inner::step_shifting(TimeMs ms, bool timer) {
 | 
					void StickersBox::Inner::step_shifting(TimeMs ms, bool timer) {
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							ms += st::stickersRowDuration;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	auto animating = false;
 | 
						auto animating = false;
 | 
				
			||||||
	auto updateMin = -1;
 | 
						auto updateMin = -1;
 | 
				
			||||||
	auto updateMax = 0;
 | 
						auto updateMax = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -653,6 +653,9 @@ void StickersListWidget::Footer::paintSetIcon(
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void StickersListWidget::Footer::step_icons(TimeMs ms, bool timer) {
 | 
					void StickersListWidget::Footer::step_icons(TimeMs ms, bool timer) {
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							ms += st::stickerIconMove;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (_iconsStartAnim) {
 | 
						if (_iconsStartAnim) {
 | 
				
			||||||
		auto dt = (ms - _iconsStartAnim) / float64(st::stickerIconMove);
 | 
							auto dt = (ms - _iconsStartAnim) / float64(st::stickerIconMove);
 | 
				
			||||||
		if (dt >= 1) {
 | 
							if (dt >= 1) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1000,6 +1000,10 @@ bool DialogsInner::updateReorderPinned(QPoint localPosition) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DialogsInner::step_pinnedShifting(TimeMs ms, bool timer) {
 | 
					void DialogsInner::step_pinnedShifting(TimeMs ms, bool timer) {
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							ms += st::stickersRowDuration;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto animating = false;
 | 
						auto animating = false;
 | 
				
			||||||
	auto updateMin = -1;
 | 
						auto updateMin = -1;
 | 
				
			||||||
	auto updateMax = 0;
 | 
						auto updateMax = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -632,7 +632,7 @@ bool History::updateSendActionNeedsAnimating(TimeMs ms, bool force) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	auto result = (!_typing.isEmpty() || !_sendActions.isEmpty());
 | 
						auto result = (!_typing.isEmpty() || !_sendActions.isEmpty());
 | 
				
			||||||
	if (changed || result) {
 | 
						if (changed || (result && !anim::Disabled())) {
 | 
				
			||||||
		App::histories().sendActionAnimationUpdated().notify({
 | 
							App::histories().sendActionAnimationUpdated().notify({
 | 
				
			||||||
			this,
 | 
								this,
 | 
				
			||||||
			_sendActionAnimation.width(),
 | 
								_sendActionAnimation.width(),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -616,6 +616,9 @@ void ReplyKeyboard::startAnimation(int i, int j, int direction) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ReplyKeyboard::step_selected(TimeMs ms, bool timer) {
 | 
					void ReplyKeyboard::step_selected(TimeMs ms, bool timer) {
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							ms += st::botKbDuration;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	for (auto i = _animations.begin(); i != _animations.end();) {
 | 
						for (auto i = _animations.begin(); i != _animations.end();) {
 | 
				
			||||||
		const auto index = std::abs(i->first) - 1;
 | 
							const auto index = std::abs(i->first) - 1;
 | 
				
			||||||
		const auto row = (index / MatrixRowShift);
 | 
							const auto row = (index / MatrixRowShift);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -205,10 +205,18 @@ void HistoryFileMedia::setStatusSize(int newSize, int fullSize, int duration, qi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void HistoryFileMedia::step_radial(TimeMs ms, bool timer) {
 | 
					void HistoryFileMedia::step_radial(TimeMs ms, bool timer) {
 | 
				
			||||||
 | 
						const auto updateRadial = [&] {
 | 
				
			||||||
 | 
							return _animation->radial.update(
 | 
				
			||||||
 | 
								dataProgress(),
 | 
				
			||||||
 | 
								dataFinished(),
 | 
				
			||||||
 | 
								ms);
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
	if (timer) {
 | 
						if (timer) {
 | 
				
			||||||
 | 
							if (!anim::Disabled() || updateRadial()) {
 | 
				
			||||||
			Auth().data().requestViewRepaint(_parent);
 | 
								Auth().data().requestViewRepaint(_parent);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		_animation->radial.update(dataProgress(), dataFinished(), ms);
 | 
							updateRadial();
 | 
				
			||||||
		if (!_animation->radial.animating()) {
 | 
							if (!_animation->radial.animating()) {
 | 
				
			||||||
			checkAnimationFinished();
 | 
								checkAnimationFinished();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -1848,6 +1856,9 @@ QMargins HistoryDocument::bubbleMargins() const {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void HistoryDocument::step_voiceProgress(float64 ms, bool timer) {
 | 
					void HistoryDocument::step_voiceProgress(float64 ms, bool timer) {
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							ms += (2 * AudioVoiceMsgUpdateView);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (auto voice = Get<HistoryDocumentVoice>()) {
 | 
						if (auto voice = Get<HistoryDocumentVoice>()) {
 | 
				
			||||||
		if (voice->_playback) {
 | 
							if (voice->_playback) {
 | 
				
			||||||
			float64 dt = ms / (2 * AudioVoiceMsgUpdateView);
 | 
								float64 dt = ms / (2 * AudioVoiceMsgUpdateView);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3232,14 +3232,16 @@ void HistoryWidget::unreadMentionsAnimationFinish() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void HistoryWidget::step_recording(float64 ms, bool timer) {
 | 
					void HistoryWidget::step_recording(float64 ms, bool timer) {
 | 
				
			||||||
	float64 dt = ms / AudioVoiceMsgUpdateView;
 | 
						const auto dt = anim::Disabled() ? 1. : (ms / AudioVoiceMsgUpdateView);
 | 
				
			||||||
	if (dt >= 1) {
 | 
						if (dt >= 1) {
 | 
				
			||||||
		_a_recording.stop();
 | 
							_a_recording.stop();
 | 
				
			||||||
		a_recordingLevel.finish();
 | 
							a_recordingLevel.finish();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		a_recordingLevel.update(dt, anim::linear);
 | 
							a_recordingLevel.update(dt, anim::linear);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (timer) update(_attachToggle->geometry());
 | 
						if (timer && !anim::Disabled()) {
 | 
				
			||||||
 | 
							update(_attachToggle->geometry());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void HistoryWidget::chooseAttach() {
 | 
					void HistoryWidget::chooseAttach() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -152,7 +152,7 @@ void TopBarWidget::updateConnectingState() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TopBarWidget::step_connecting(TimeMs ms, bool timer) {
 | 
					void TopBarWidget::step_connecting(TimeMs ms, bool timer) {
 | 
				
			||||||
	if (timer) {
 | 
						if (timer && !anim::Disabled()) {
 | 
				
			||||||
		update();
 | 
							update();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -326,11 +326,19 @@ bool Gif::isRadialAnimation(TimeMs ms) const {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Gif::step_radial(TimeMs ms, bool timer) {
 | 
					void Gif::step_radial(TimeMs ms, bool timer) {
 | 
				
			||||||
 | 
						const auto document = getShownDocument();
 | 
				
			||||||
 | 
						const auto updateRadial = [&] {
 | 
				
			||||||
 | 
							return _animation->radial.update(
 | 
				
			||||||
 | 
								document->progress(),
 | 
				
			||||||
 | 
								!document->loading() || document->loaded(),
 | 
				
			||||||
 | 
								ms);
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
	if (timer) {
 | 
						if (timer) {
 | 
				
			||||||
 | 
							if (!anim::Disabled() || updateRadial()) {
 | 
				
			||||||
			update();
 | 
								update();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		DocumentData *document = getShownDocument();
 | 
							updateRadial();
 | 
				
			||||||
		_animation->radial.update(document->progress(), !document->loading() || document->loaded(), ms);
 | 
					 | 
				
			||||||
		if (!_animation->radial.animating() && document->loaded()) {
 | 
							if (!_animation->radial.animating() && document->loaded()) {
 | 
				
			||||||
			_animation.reset();
 | 
								_animation.reset();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -819,13 +827,18 @@ void File::thumbAnimationCallback() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void File::step_radial(TimeMs ms, bool timer) {
 | 
					void File::step_radial(TimeMs ms, bool timer) {
 | 
				
			||||||
	if (timer) {
 | 
						const auto updateRadial = [&] {
 | 
				
			||||||
		update();
 | 
							return _animation->radial.update(
 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		_animation->radial.update(
 | 
					 | 
				
			||||||
			_document->progress(),
 | 
								_document->progress(),
 | 
				
			||||||
			!_document->loading() || _document->loaded(),
 | 
								!_document->loading() || _document->loaded(),
 | 
				
			||||||
			ms);
 | 
								ms);
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
						if (timer) {
 | 
				
			||||||
 | 
							if (!anim::Disabled() || updateRadial()) {
 | 
				
			||||||
 | 
								update();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							updateRadial();
 | 
				
			||||||
		if (!_animation->radial.animating()) {
 | 
							if (!_animation->radial.animating()) {
 | 
				
			||||||
			checkAnimationFinished();
 | 
								checkAnimationFinished();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -1333,11 +1346,19 @@ bool Game::isRadialAnimation(TimeMs ms) const {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Game::step_radial(TimeMs ms, bool timer) {
 | 
					void Game::step_radial(TimeMs ms, bool timer) {
 | 
				
			||||||
 | 
						const auto document = getResultDocument();
 | 
				
			||||||
 | 
						const auto updateRadial = [&] {
 | 
				
			||||||
 | 
							return _radial->update(
 | 
				
			||||||
 | 
								document->progress(),
 | 
				
			||||||
 | 
								!document->loading() || document->loaded(),
 | 
				
			||||||
 | 
								ms);
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
	if (timer) {
 | 
						if (timer) {
 | 
				
			||||||
 | 
							if (!anim::Disabled() || updateRadial()) {
 | 
				
			||||||
			update();
 | 
								update();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		auto document = getResultDocument();
 | 
							updateRadial();
 | 
				
			||||||
		_radial->update(document->progress(), !document->loading() || document->loaded(), ms);
 | 
					 | 
				
			||||||
		if (!_radial->animating() && document->loaded()) {
 | 
							if (!_radial->animating() && document->loaded()) {
 | 
				
			||||||
			_radial.reset();
 | 
								_radial.reset();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -94,7 +94,7 @@ void Playback::setValue(float64 value, bool animated) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Playback::step_value(float64 ms, bool timer) {
 | 
					void Playback::step_value(float64 ms, bool timer) {
 | 
				
			||||||
	auto dt = ms / kPlaybackAnimationDurationMs;
 | 
						auto dt = anim::Disabled() ? 1. : (ms / kPlaybackAnimationDurationMs);
 | 
				
			||||||
	if (dt >= 1.) {
 | 
						if (dt >= 1.) {
 | 
				
			||||||
		_a_value.stop();
 | 
							_a_value.stop();
 | 
				
			||||||
		a_value.finish();
 | 
							a_value.finish();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -480,8 +480,11 @@ auto MediaView::computeOverviewType() const
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MediaView::step_state(TimeMs ms, bool timer) {
 | 
					void MediaView::step_state(TimeMs ms, bool timer) {
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							ms += st::mediaviewShowDuration + st::mediaviewHideDuration;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	bool result = false;
 | 
						bool result = false;
 | 
				
			||||||
	for (Showing::iterator i = _animations.begin(); i != _animations.end();) {
 | 
						for (auto i = _animations.begin(); i != _animations.end();) {
 | 
				
			||||||
		TimeMs start = i.value();
 | 
							TimeMs start = i.value();
 | 
				
			||||||
		switch (i.key()) {
 | 
							switch (i.key()) {
 | 
				
			||||||
		case OverLeftNav: update(_leftNav); break;
 | 
							case OverLeftNav: update(_leftNav); break;
 | 
				
			||||||
| 
						 | 
					@ -584,8 +587,11 @@ void MediaView::step_radial(TimeMs ms, bool timer) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	const auto wasAnimating = _radial.animating();
 | 
						const auto wasAnimating = _radial.animating();
 | 
				
			||||||
	_radial.update(radialProgress(), !radialLoading(), ms + radialTimeShift());
 | 
						const auto updated = _radial.update(
 | 
				
			||||||
	if (timer && (wasAnimating || _radial.animating())) {
 | 
							radialProgress(), 
 | 
				
			||||||
 | 
							!radialLoading(), 
 | 
				
			||||||
 | 
							ms + radialTimeShift());
 | 
				
			||||||
 | 
						if (timer && (wasAnimating || _radial.animating()) && (!anim::Disabled() || updated)) {
 | 
				
			||||||
		update(radialRect());
 | 
							update(radialRect());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	const auto ready = _doc && _doc->loaded();
 | 
						const auto ready = _doc && _doc->loaded();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -227,10 +227,15 @@ void RadialProgressItem::setLinks(ClickHandlerPtr &&openl, ClickHandlerPtr &&sav
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RadialProgressItem::step_radial(TimeMs ms, bool timer) {
 | 
					void RadialProgressItem::step_radial(TimeMs ms, bool timer) {
 | 
				
			||||||
 | 
						const auto updateRadial = [&] {
 | 
				
			||||||
 | 
							return _radial->update(dataProgress(), dataFinished(), ms);
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
	if (timer) {
 | 
						if (timer) {
 | 
				
			||||||
 | 
							if (!anim::Disabled() || updateRadial()) {
 | 
				
			||||||
			Auth().data().requestItemRepaint(parent());
 | 
								Auth().data().requestItemRepaint(parent());
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		_radial->update(dataProgress(), dataFinished(), ms);
 | 
							updateRadial();
 | 
				
			||||||
		if (!_radial->animating()) {
 | 
							if (!_radial->animating()) {
 | 
				
			||||||
			checkRadialFinished();
 | 
								checkRadialFinished();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -203,11 +203,11 @@ TimeMs BackgroundRow::radialTimeShift() const {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void BackgroundRow::step_radial(TimeMs ms, bool timer) {
 | 
					void BackgroundRow::step_radial(TimeMs ms, bool timer) {
 | 
				
			||||||
	_radial.update(
 | 
						const auto updated = _radial.update(
 | 
				
			||||||
		radialProgress(),
 | 
							radialProgress(),
 | 
				
			||||||
		!radialLoading(),
 | 
							!radialLoading(),
 | 
				
			||||||
		ms + radialTimeShift());
 | 
							ms + radialTimeShift());
 | 
				
			||||||
	if (timer && _radial.animating()) {
 | 
						if (timer && _radial.animating() && (!anim::Disabled() || updated)) {
 | 
				
			||||||
		rtlupdate(radialRect());
 | 
							rtlupdate(radialRect());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -93,8 +93,10 @@ void stopManager() {
 | 
				
			||||||
	Media::Clip::Finish();
 | 
						Media::Clip::Finish();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void registerClipManager(Media::Clip::Manager *manager) {
 | 
					void registerClipManager(not_null<Media::Clip::Manager*> manager) {
 | 
				
			||||||
	manager->connect(manager, SIGNAL(callback(Media::Clip::Reader*,qint32,qint32)), _manager, SLOT(clipCallback(Media::Clip::Reader*,qint32,qint32)));
 | 
						Expects(_manager != nullptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_manager->registerClip(manager);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Disabled() {
 | 
					bool Disabled() {
 | 
				
			||||||
| 
						 | 
					@ -104,7 +106,35 @@ bool Disabled() {
 | 
				
			||||||
void SetDisabled(bool disabled) {
 | 
					void SetDisabled(bool disabled) {
 | 
				
			||||||
	AnimationsDisabled = disabled;
 | 
						AnimationsDisabled = disabled;
 | 
				
			||||||
	if (disabled && _manager) {
 | 
						if (disabled && _manager) {
 | 
				
			||||||
		_manager->timeout();
 | 
							_manager->step();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void DrawStaticLoading(
 | 
				
			||||||
 | 
							QPainter &p,
 | 
				
			||||||
 | 
							QRectF rect,
 | 
				
			||||||
 | 
							int stroke,
 | 
				
			||||||
 | 
							QPen pen,
 | 
				
			||||||
 | 
							QBrush brush) {
 | 
				
			||||||
 | 
						PainterHighQualityEnabler hq(p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p.setBrush(brush);
 | 
				
			||||||
 | 
						pen.setWidthF(stroke);
 | 
				
			||||||
 | 
						pen.setCapStyle(Qt::RoundCap);
 | 
				
			||||||
 | 
						pen.setJoinStyle(Qt::RoundJoin);
 | 
				
			||||||
 | 
						p.setPen(pen);
 | 
				
			||||||
 | 
						p.drawEllipse(rect);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const auto center = rect.center();
 | 
				
			||||||
 | 
						const auto first = QPointF(center.x(), rect.y() + 1.5 * stroke);
 | 
				
			||||||
 | 
						const auto delta = center.y() - first.y();
 | 
				
			||||||
 | 
						const auto second = QPointF(center.x() + delta * 2 / 3., center.y());
 | 
				
			||||||
 | 
						if (delta > 0) {
 | 
				
			||||||
 | 
							QPainterPath path;
 | 
				
			||||||
 | 
							path.moveTo(first);
 | 
				
			||||||
 | 
							path.lineTo(center);
 | 
				
			||||||
 | 
							path.lineTo(second);
 | 
				
			||||||
 | 
							p.drawPath(path);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,19 +155,19 @@ void BasicAnimation::stop() {
 | 
				
			||||||
	_manager->stop(this);
 | 
						_manager->stop(this);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AnimationManager::AnimationManager() : _timer(this), _iterating(false) {
 | 
					AnimationManager::AnimationManager() : _timer(this) {
 | 
				
			||||||
	_timer.setSingleShot(false);
 | 
						_timer.setSingleShot(false);
 | 
				
			||||||
	connect(&_timer, SIGNAL(timeout()), this, SLOT(timeout()));
 | 
						connect(&_timer, &QTimer::timeout, this, &AnimationManager::step);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AnimationManager::start(BasicAnimation *obj) {
 | 
					void AnimationManager::start(BasicAnimation *obj) {
 | 
				
			||||||
	if (_iterating) {
 | 
						if (_iterating) {
 | 
				
			||||||
		_starting.insert(obj);
 | 
							_starting.insert(obj);
 | 
				
			||||||
		if (!_stopping.isEmpty()) {
 | 
							if (!_stopping.empty()) {
 | 
				
			||||||
			_stopping.remove(obj);
 | 
								_stopping.erase(obj);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		if (_objects.isEmpty()) {
 | 
							if (_objects.empty()) {
 | 
				
			||||||
			_timer.start(AnimationTimerDelta);
 | 
								_timer.start(AnimationTimerDelta);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		_objects.insert(obj);
 | 
							_objects.insert(obj);
 | 
				
			||||||
| 
						 | 
					@ -147,8 +177,8 @@ void AnimationManager::start(BasicAnimation *obj) {
 | 
				
			||||||
void AnimationManager::stop(BasicAnimation *obj) {
 | 
					void AnimationManager::stop(BasicAnimation *obj) {
 | 
				
			||||||
	if (_iterating) {
 | 
						if (_iterating) {
 | 
				
			||||||
		_stopping.insert(obj);
 | 
							_stopping.insert(obj);
 | 
				
			||||||
		if (!_starting.isEmpty()) {
 | 
							if (!_starting.empty()) {
 | 
				
			||||||
			_starting.remove(obj);
 | 
								_starting.erase(obj);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		auto i = _objects.find(obj);
 | 
							auto i = _objects.find(obj);
 | 
				
			||||||
| 
						 | 
					@ -161,25 +191,33 @@ void AnimationManager::stop(BasicAnimation *obj) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AnimationManager::timeout() {
 | 
					void AnimationManager::registerClip(not_null<Media::Clip::Manager*> clip) {
 | 
				
			||||||
 | 
						connect(
 | 
				
			||||||
 | 
							clip,
 | 
				
			||||||
 | 
							&Media::Clip::Manager::callback,
 | 
				
			||||||
 | 
							this,
 | 
				
			||||||
 | 
							&AnimationManager::clipCallback);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void AnimationManager::step() {
 | 
				
			||||||
	_iterating = true;
 | 
						_iterating = true;
 | 
				
			||||||
	auto ms = getms();
 | 
						const auto ms = getms();
 | 
				
			||||||
	for_const (auto object, _objects) {
 | 
						for (const auto object : _objects) {
 | 
				
			||||||
		if (!_stopping.contains(object)) {
 | 
							if (!_stopping.contains(object)) {
 | 
				
			||||||
			object->step(ms, true);
 | 
								object->step(ms, true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_iterating = false;
 | 
						_iterating = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!_starting.isEmpty()) {
 | 
						if (!_starting.empty()) {
 | 
				
			||||||
		for_const (auto object, _starting) {
 | 
							for (const auto object : _starting) {
 | 
				
			||||||
			_objects.insert(object);
 | 
								_objects.emplace(object);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		_starting.clear();
 | 
							_starting.clear();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!_stopping.isEmpty()) {
 | 
						if (!_stopping.empty()) {
 | 
				
			||||||
		for_const (auto object, _stopping) {
 | 
							for (const auto object : _stopping) {
 | 
				
			||||||
			_objects.remove(object);
 | 
								_objects.erase(object);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		_stopping.clear();
 | 
							_stopping.clear();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -188,7 +226,13 @@ void AnimationManager::timeout() {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AnimationManager::clipCallback(Media::Clip::Reader *reader, qint32 threadIndex, qint32 notification) {
 | 
					void AnimationManager::clipCallback(
 | 
				
			||||||
	Media::Clip::Reader::callback(reader, threadIndex, Media::Clip::Notification(notification));
 | 
							Media::Clip::Reader *reader,
 | 
				
			||||||
 | 
							qint32 threadIndex,
 | 
				
			||||||
 | 
							qint32 notification) {
 | 
				
			||||||
 | 
						Media::Clip::Reader::callback(
 | 
				
			||||||
 | 
							reader,
 | 
				
			||||||
 | 
							threadIndex,
 | 
				
			||||||
 | 
							Media::Clip::Notification(notification));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QtCore/QTimer>
 | 
					#include <QtCore/QTimer>
 | 
				
			||||||
#include <QtGui/QColor>
 | 
					#include <QtGui/QColor>
 | 
				
			||||||
 | 
					#include "base/binary_guard.h"
 | 
				
			||||||
 | 
					#include "base/flat_set.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Media {
 | 
					namespace Media {
 | 
				
			||||||
namespace Clip {
 | 
					namespace Clip {
 | 
				
			||||||
| 
						 | 
					@ -161,7 +163,7 @@ private:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void startManager();
 | 
					void startManager();
 | 
				
			||||||
void stopManager();
 | 
					void stopManager();
 | 
				
			||||||
void registerClipManager(Media::Clip::Manager *manager);
 | 
					void registerClipManager(not_null<Media::Clip::Manager*> manager);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TG_FORCE_INLINE int interpolate(int a, int b, float64 b_ratio) {
 | 
					TG_FORCE_INLINE int interpolate(int a, int b, float64 b_ratio) {
 | 
				
			||||||
	return qRound(a + float64(b - a) * b_ratio);
 | 
						return qRound(a + float64(b - a) * b_ratio);
 | 
				
			||||||
| 
						 | 
					@ -416,6 +418,13 @@ QPainterPath path(QPointF (&from)[N]) {
 | 
				
			||||||
bool Disabled();
 | 
					bool Disabled();
 | 
				
			||||||
void SetDisabled(bool disabled);
 | 
					void SetDisabled(bool disabled);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void DrawStaticLoading(
 | 
				
			||||||
 | 
						QPainter &p,
 | 
				
			||||||
 | 
						QRectF rect,
 | 
				
			||||||
 | 
						int stroke,
 | 
				
			||||||
 | 
						QPen pen,
 | 
				
			||||||
 | 
						QBrush brush = Qt::NoBrush);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class BasicAnimation;
 | 
					class BasicAnimation;
 | 
				
			||||||
| 
						 | 
					@ -667,7 +676,9 @@ private:
 | 
				
			||||||
		, updateCallback(std::move(updateCallback)) {
 | 
							, updateCallback(std::move(updateCallback)) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		void step(float64 ms, bool timer) {
 | 
							void step(float64 ms, bool timer) {
 | 
				
			||||||
			auto dt = (ms >= duration || anim::Disabled()) ? 1. : (ms / duration);
 | 
								const auto dt = (ms >= duration || anim::Disabled())
 | 
				
			||||||
 | 
									? 1.
 | 
				
			||||||
 | 
									: (ms / duration);
 | 
				
			||||||
			if (dt >= 1) {
 | 
								if (dt >= 1) {
 | 
				
			||||||
				value.finish();
 | 
									value.finish();
 | 
				
			||||||
				a_animation.stop();
 | 
									a_animation.stop();
 | 
				
			||||||
| 
						 | 
					@ -690,23 +701,23 @@ private:
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class AnimationManager : public QObject {
 | 
					class AnimationManager : public QObject {
 | 
				
			||||||
	Q_OBJECT
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	AnimationManager();
 | 
						AnimationManager();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void start(BasicAnimation *obj);
 | 
						void start(BasicAnimation *obj);
 | 
				
			||||||
	void stop(BasicAnimation *obj);
 | 
						void stop(BasicAnimation *obj);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public slots:
 | 
						void registerClip(not_null<Media::Clip::Manager*> clip);
 | 
				
			||||||
	void timeout();
 | 
						void step();
 | 
				
			||||||
 | 
					 | 
				
			||||||
	void clipCallback(Media::Clip::Reader *reader, qint32 threadIndex, qint32 notification);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	using AnimatingObjects = OrderedSet<BasicAnimation*>;
 | 
						void clipCallback(
 | 
				
			||||||
	AnimatingObjects _objects, _starting, _stopping;
 | 
							Media::Clip::Reader *reader,
 | 
				
			||||||
 | 
							qint32 threadIndex,
 | 
				
			||||||
 | 
							qint32 notification);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						base::flat_set<BasicAnimation*> _objects, _starting, _stopping;
 | 
				
			||||||
	QTimer _timer;
 | 
						QTimer _timer;
 | 
				
			||||||
	bool _iterating;
 | 
						bool _iterating = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@ namespace Ui {
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
constexpr auto kPointCount = 12;
 | 
					constexpr auto kPointCount = 12;
 | 
				
			||||||
 | 
					constexpr auto kStaticLoadingValue = float64(-666);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//     1         3
 | 
					//     1         3
 | 
				
			||||||
| 
						 | 
					@ -90,7 +91,26 @@ void transformLoadingCross(float64 loading, std::array<QPointF, kPointCount> &po
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace
 | 
					} // namespace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CrossAnimation::paint(Painter &p, const style::CrossAnimation &st, style::color color, int x, int y, int outerWidth, float64 shown, float64 loading) {
 | 
					void CrossAnimation::paintStaticLoading(
 | 
				
			||||||
 | 
							Painter &p,
 | 
				
			||||||
 | 
							const style::CrossAnimation &st,
 | 
				
			||||||
 | 
							style::color color,
 | 
				
			||||||
 | 
							int x,
 | 
				
			||||||
 | 
							int y,
 | 
				
			||||||
 | 
							int outerWidth,
 | 
				
			||||||
 | 
							float64 shown) {
 | 
				
			||||||
 | 
						paint(p, st, color, x, y, outerWidth, shown, kStaticLoadingValue);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void CrossAnimation::paint(
 | 
				
			||||||
 | 
							Painter &p,
 | 
				
			||||||
 | 
							const style::CrossAnimation &st,
 | 
				
			||||||
 | 
							style::color color,
 | 
				
			||||||
 | 
							int x,
 | 
				
			||||||
 | 
							int y,
 | 
				
			||||||
 | 
							int outerWidth,
 | 
				
			||||||
 | 
							float64 shown,
 | 
				
			||||||
 | 
							float64 loading) {
 | 
				
			||||||
	PainterHighQualityEnabler hq(p);
 | 
						PainterHighQualityEnabler hq(p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto sqrt2 = sqrt(2.);
 | 
						auto sqrt2 = sqrt(2.);
 | 
				
			||||||
| 
						 | 
					@ -117,7 +137,8 @@ void CrossAnimation::paint(Painter &p, const style::CrossAnimation &st, style::c
 | 
				
			||||||
	} };
 | 
						} };
 | 
				
			||||||
	auto pathDeleteSize = kPointCount;
 | 
						auto pathDeleteSize = kPointCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto loadingArcLength = 0;
 | 
						const auto staticLoading = (loading == kStaticLoadingValue);
 | 
				
			||||||
 | 
						auto loadingArcLength = staticLoading ? FullArcLength : 0;
 | 
				
			||||||
	if (loading > 0.) {
 | 
						if (loading > 0.) {
 | 
				
			||||||
		transformLoadingCross(loading, pathDelete, pathDeleteSize);
 | 
							transformLoadingCross(loading, pathDelete, pathDeleteSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -125,6 +146,7 @@ void CrossAnimation::paint(Painter &p, const style::CrossAnimation &st, style::c
 | 
				
			||||||
		loadingArcLength = qRound(-loadingArc * 2 * FullArcLength);
 | 
							loadingArcLength = qRound(-loadingArc * 2 * FullArcLength);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!staticLoading) {
 | 
				
			||||||
		if (shown < 1.) {
 | 
							if (shown < 1.) {
 | 
				
			||||||
			auto alpha = -(shown - 1.) * M_PI_2;
 | 
								auto alpha = -(shown - 1.) * M_PI_2;
 | 
				
			||||||
			auto cosalpha = cos(alpha);
 | 
								auto cosalpha = cos(alpha);
 | 
				
			||||||
| 
						 | 
					@ -145,25 +167,30 @@ void CrossAnimation::paint(Painter &p, const style::CrossAnimation &st, style::c
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		path.lineTo(pathDelete[0]);
 | 
							path.lineTo(pathDelete[0]);
 | 
				
			||||||
		p.fillPath(path, color);
 | 
							p.fillPath(path, color);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (loadingArcLength != 0) {
 | 
						if (loadingArcLength != 0) {
 | 
				
			||||||
		auto loadingArcStart = FullArcLength / 8;
 | 
					 | 
				
			||||||
		auto roundSkip = (st.size * (1 - sqrt2) + 2 * sqrt2 * deleteSkip + st.stroke) / 2;
 | 
							auto roundSkip = (st.size * (1 - sqrt2) + 2 * sqrt2 * deleteSkip + st.stroke) / 2;
 | 
				
			||||||
		auto roundPart = QRectF(x + roundSkip, y + roundSkip, st.size - 2 * roundSkip, st.size - 2 * roundSkip);
 | 
							auto roundPart = QRectF(x + roundSkip, y + roundSkip, st.size - 2 * roundSkip, st.size - 2 * roundSkip);
 | 
				
			||||||
 | 
							if (staticLoading) {
 | 
				
			||||||
 | 
								anim::DrawStaticLoading(p, roundPart, st.stroke, color);
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								auto loadingArcStart = FullArcLength / 8;
 | 
				
			||||||
			if (shown < 1.) {
 | 
								if (shown < 1.) {
 | 
				
			||||||
				loadingArcStart -= qRound(-(shown - 1.) * FullArcLength / 4.);
 | 
									loadingArcStart -= qRound(-(shown - 1.) * FullArcLength / 4.);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								if (loadingArcLength < 0) {
 | 
				
			||||||
 | 
									loadingArcStart += loadingArcLength;
 | 
				
			||||||
 | 
									loadingArcLength = -loadingArcLength;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			p.setBrush(Qt::NoBrush);
 | 
								p.setBrush(Qt::NoBrush);
 | 
				
			||||||
			auto pen = color->p;
 | 
								auto pen = color->p;
 | 
				
			||||||
			pen.setWidthF(st.stroke);
 | 
								pen.setWidthF(st.stroke);
 | 
				
			||||||
			pen.setCapStyle(Qt::RoundCap);
 | 
								pen.setCapStyle(Qt::RoundCap);
 | 
				
			||||||
			p.setPen(pen);
 | 
								p.setPen(pen);
 | 
				
			||||||
		if (loadingArcLength < 0) {
 | 
					 | 
				
			||||||
			loadingArcStart += loadingArcLength;
 | 
					 | 
				
			||||||
			loadingArcLength = -loadingArcLength;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
			p.drawArc(roundPart, loadingArcStart, loadingArcLength);
 | 
								p.drawArc(roundPart, loadingArcStart, loadingArcLength);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} // namespace Ui
 | 
					} // namespace Ui
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,7 +13,23 @@ namespace Ui {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class CrossAnimation {
 | 
					class CrossAnimation {
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	static void paint(Painter &p, const style::CrossAnimation &st, style::color color, int x, int y, int outerWidth, float64 shown, float64 loading = 0.);
 | 
						static void paint(
 | 
				
			||||||
 | 
							Painter &p,
 | 
				
			||||||
 | 
							const style::CrossAnimation &st,
 | 
				
			||||||
 | 
							style::color color,
 | 
				
			||||||
 | 
							int x,
 | 
				
			||||||
 | 
							int y,
 | 
				
			||||||
 | 
							int outerWidth,
 | 
				
			||||||
 | 
							float64 shown,
 | 
				
			||||||
 | 
							float64 loading = 0.);
 | 
				
			||||||
 | 
						static void paintStaticLoading(
 | 
				
			||||||
 | 
							Painter &p,
 | 
				
			||||||
 | 
							const style::CrossAnimation &st,
 | 
				
			||||||
 | 
							style::color color,
 | 
				
			||||||
 | 
							int x,
 | 
				
			||||||
 | 
							int y,
 | 
				
			||||||
 | 
							int outerWidth,
 | 
				
			||||||
 | 
							float64 shown);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,9 +23,10 @@ void RadialAnimation::start(float64 prg) {
 | 
				
			||||||
	_animation.start();
 | 
						_animation.start();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RadialAnimation::update(float64 prg, bool finished, TimeMs ms) {
 | 
					bool RadialAnimation::update(float64 prg, bool finished, TimeMs ms) {
 | 
				
			||||||
	auto iprg = qRound(qMax(prg, 0.0001) * AlmostFullArcLength);
 | 
						const auto iprg = qRound(qMax(prg, 0.0001) * AlmostFullArcLength);
 | 
				
			||||||
	if (iprg != qRound(a_arcEnd.to())) {
 | 
						const auto result = (iprg != qRound(a_arcEnd.to()));
 | 
				
			||||||
 | 
						if (result) {
 | 
				
			||||||
		a_arcEnd.start(iprg);
 | 
							a_arcEnd.start(iprg);
 | 
				
			||||||
		_lastStart = _lastTime;
 | 
							_lastStart = _lastTime;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -34,7 +35,12 @@ void RadialAnimation::update(float64 prg, bool finished, TimeMs ms) {
 | 
				
			||||||
	auto dt = float64(ms - _lastStart);
 | 
						auto dt = float64(ms - _lastStart);
 | 
				
			||||||
	auto fulldt = float64(ms - _firstStart);
 | 
						auto fulldt = float64(ms - _firstStart);
 | 
				
			||||||
	_opacity = qMin(fulldt / st::radialDuration, 1.);
 | 
						_opacity = qMin(fulldt / st::radialDuration, 1.);
 | 
				
			||||||
	if (!finished) {
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							a_arcEnd.update(1., anim::linear);
 | 
				
			||||||
 | 
							if (finished) {
 | 
				
			||||||
 | 
								stop();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						} else if (!finished) {
 | 
				
			||||||
		a_arcEnd.update(1. - (st::radialDuration / (st::radialDuration + dt)), anim::linear);
 | 
							a_arcEnd.update(1. - (st::radialDuration / (st::radialDuration + dt)), anim::linear);
 | 
				
			||||||
	} else if (dt >= st::radialDuration) {
 | 
						} else if (dt >= st::radialDuration) {
 | 
				
			||||||
		a_arcEnd.update(1., anim::linear);
 | 
							a_arcEnd.update(1., anim::linear);
 | 
				
			||||||
| 
						 | 
					@ -46,6 +52,7 @@ void RadialAnimation::update(float64 prg, bool finished, TimeMs ms) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	auto fromstart = fulldt / st::radialPeriod;
 | 
						auto fromstart = fulldt / st::radialPeriod;
 | 
				
			||||||
	a_arcStart.update(fromstart - std::floor(fromstart), anim::linear);
 | 
						a_arcStart.update(fromstart - std::floor(fromstart), anim::linear);
 | 
				
			||||||
 | 
						return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RadialAnimation::stop() {
 | 
					void RadialAnimation::stop() {
 | 
				
			||||||
| 
						 | 
					@ -69,7 +76,9 @@ void RadialAnimation::draw(Painter &p, const QRect &inner, int32 thickness, styl
 | 
				
			||||||
	p.setPen(pen);
 | 
						p.setPen(pen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto len = MinArcLength + qRound(a_arcEnd.current());
 | 
						auto len = MinArcLength + qRound(a_arcEnd.current());
 | 
				
			||||||
	auto from = QuarterArcLength - qRound(a_arcStart.current()) - len;
 | 
						auto from = QuarterArcLength
 | 
				
			||||||
 | 
							- len
 | 
				
			||||||
 | 
							- (anim::Disabled() ? 0 : qRound(a_arcStart.current()));
 | 
				
			||||||
	if (rtl()) {
 | 
						if (rtl()) {
 | 
				
			||||||
		from = QuarterArcLength - (from - QuarterArcLength) - len;
 | 
							from = QuarterArcLength - (from - QuarterArcLength) - len;
 | 
				
			||||||
		if (from < 0) from += FullArcLength;
 | 
							if (from < 0) from += FullArcLength;
 | 
				
			||||||
| 
						 | 
					@ -104,6 +113,9 @@ void InfiniteRadialAnimation::start() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void InfiniteRadialAnimation::stop() {
 | 
					void InfiniteRadialAnimation::stop() {
 | 
				
			||||||
	const auto now = getms();
 | 
						const auto now = getms();
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							_workFinished = now;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (!_workFinished) {
 | 
						if (!_workFinished) {
 | 
				
			||||||
		const auto zero = _workStarted - _st.sineDuration;
 | 
							const auto zero = _workStarted - _st.sineDuration;
 | 
				
			||||||
		const auto index = (now - zero + _st.sinePeriod - _st.sineShift)
 | 
							const auto index = (now - zero + _st.sinePeriod - _st.sineShift)
 | 
				
			||||||
| 
						 | 
					@ -138,8 +150,18 @@ void InfiniteRadialAnimation::draw(
 | 
				
			||||||
	auto o = p.opacity();
 | 
						auto o = p.opacity();
 | 
				
			||||||
	p.setOpacity(o * state.shown);
 | 
						p.setOpacity(o * state.shown);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const auto rect = rtlrect(
 | 
				
			||||||
 | 
							position.x(),
 | 
				
			||||||
 | 
							position.y(),
 | 
				
			||||||
 | 
							size.width(),
 | 
				
			||||||
 | 
							size.height(),
 | 
				
			||||||
 | 
							outerWidth);
 | 
				
			||||||
 | 
						const auto was = p.pen();
 | 
				
			||||||
 | 
						const auto brush = p.brush();
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							anim::DrawStaticLoading(p, rect, _st.thickness, _st.color);
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
		auto pen = _st.color->p;
 | 
							auto pen = _st.color->p;
 | 
				
			||||||
	auto was = p.pen();
 | 
					 | 
				
			||||||
		pen.setWidth(_st.thickness);
 | 
							pen.setWidth(_st.thickness);
 | 
				
			||||||
		pen.setCapStyle(Qt::RoundCap);
 | 
							pen.setCapStyle(Qt::RoundCap);
 | 
				
			||||||
		p.setPen(pen);
 | 
							p.setPen(pen);
 | 
				
			||||||
| 
						 | 
					@ -147,17 +169,13 @@ void InfiniteRadialAnimation::draw(
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			PainterHighQualityEnabler hq(p);
 | 
								PainterHighQualityEnabler hq(p);
 | 
				
			||||||
			p.drawArc(
 | 
								p.drawArc(
 | 
				
			||||||
			rtlrect(
 | 
									rect,
 | 
				
			||||||
				position.x(),
 | 
					 | 
				
			||||||
				position.y(),
 | 
					 | 
				
			||||||
				size.width(),
 | 
					 | 
				
			||||||
				size.height(),
 | 
					 | 
				
			||||||
				outerWidth),
 | 
					 | 
				
			||||||
				state.arcFrom,
 | 
									state.arcFrom,
 | 
				
			||||||
				state.arcLength);
 | 
									state.arcLength);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	p.setPen(was);
 | 
						p.setPen(was);
 | 
				
			||||||
 | 
						p.setBrush(brush);
 | 
				
			||||||
	p.setOpacity(o);
 | 
						p.setOpacity(o);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -173,6 +191,10 @@ auto InfiniteRadialAnimation::computeState() -> State {
 | 
				
			||||||
			linear,
 | 
								linear,
 | 
				
			||||||
			FullArcLength };
 | 
								FullArcLength };
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							const auto shown = 1.;
 | 
				
			||||||
 | 
							return { 1., 0, FullArcLength };
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	const auto min = int(std::round(FullArcLength * _st.arcMin));
 | 
						const auto min = int(std::round(FullArcLength * _st.arcMin));
 | 
				
			||||||
	const auto max = int(std::round(FullArcLength * _st.arcMax));
 | 
						const auto max = int(std::round(FullArcLength * _st.arcMax));
 | 
				
			||||||
	if (now <= _workStarted) {
 | 
						if (now <= _workStarted) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,7 @@ public:
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void start(float64 prg);
 | 
						void start(float64 prg);
 | 
				
			||||||
	void update(float64 prg, bool finished, TimeMs ms);
 | 
						bool update(float64 prg, bool finished, TimeMs ms);
 | 
				
			||||||
	void stop();
 | 
						void stop();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void step(TimeMs ms);
 | 
						void step(TimeMs ms);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -190,6 +190,23 @@ bool SendActionAnimation::Impl::supports(Type type) const {
 | 
				
			||||||
	return Implementations->value(type, &TypingAnimation::kMeta) == metaData();
 | 
						return Implementations->value(type, &TypingAnimation::kMeta) == metaData();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SendActionAnimation::Impl::paint(
 | 
				
			||||||
 | 
							Painter &p,
 | 
				
			||||||
 | 
							style::color color,
 | 
				
			||||||
 | 
							int x,
 | 
				
			||||||
 | 
							int y,
 | 
				
			||||||
 | 
							int outerWidth,
 | 
				
			||||||
 | 
							TimeMs ms) {
 | 
				
			||||||
 | 
						paintFrame(
 | 
				
			||||||
 | 
							p,
 | 
				
			||||||
 | 
							color,
 | 
				
			||||||
 | 
							x,
 | 
				
			||||||
 | 
							y,
 | 
				
			||||||
 | 
							outerWidth,
 | 
				
			||||||
 | 
							anim::Disabled() ? 0 : (qMax(ms - _started, 0LL) % _period));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SendActionAnimation::start(Type type) {
 | 
					void SendActionAnimation::start(Type type) {
 | 
				
			||||||
	if (!_impl || !_impl->supports(type)) {
 | 
						if (!_impl || !_impl->supports(type)) {
 | 
				
			||||||
		_impl = createByType(type);
 | 
							_impl = createByType(type);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,9 +44,13 @@ public:
 | 
				
			||||||
		bool supports(Type type) const;
 | 
							bool supports(Type type) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		virtual int width() const = 0;
 | 
							virtual int width() const = 0;
 | 
				
			||||||
		void paint(Painter &p, style::color color, int x, int y, int outerWidth, TimeMs ms) {
 | 
							void paint(
 | 
				
			||||||
			paintFrame(p, color, x, y, outerWidth, qMax(ms - _started, 0LL) % _period);
 | 
								Painter &p,
 | 
				
			||||||
		}
 | 
								style::color color,
 | 
				
			||||||
 | 
								int x,
 | 
				
			||||||
 | 
								int y,
 | 
				
			||||||
 | 
								int outerWidth,
 | 
				
			||||||
 | 
								TimeMs ms);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		virtual ~Impl() = default;
 | 
							virtual ~Impl() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -182,30 +182,52 @@ void EmojiButton::paintEvent(QPaintEvent *e) {
 | 
				
			||||||
	p.fillRect(e->rect(), st::historyComposeAreaBg);
 | 
						p.fillRect(e->rect(), st::historyComposeAreaBg);
 | 
				
			||||||
	paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms, _rippleOverride ? &(*_rippleOverride)->c : nullptr);
 | 
						paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms, _rippleOverride ? &(*_rippleOverride)->c : nullptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						const auto over = isOver();
 | 
				
			||||||
	const auto loadingState = _loading
 | 
						const auto loadingState = _loading
 | 
				
			||||||
		? _loading->computeState()
 | 
							? _loading->computeState()
 | 
				
			||||||
		: Ui::InfiniteRadialAnimation::State{ 0., 0, FullArcLength };
 | 
							: Ui::InfiniteRadialAnimation::State{ 0., 0, FullArcLength };
 | 
				
			||||||
 | 
						if (loadingState.shown < 1.) {
 | 
				
			||||||
		p.setOpacity(1. - loadingState.shown);
 | 
							p.setOpacity(1. - loadingState.shown);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto over = isOver();
 | 
					 | 
				
			||||||
		auto icon = _iconOverride ? _iconOverride : &(over ? _st.iconOver : _st.icon);
 | 
							auto icon = _iconOverride ? _iconOverride : &(over ? _st.iconOver : _st.icon);
 | 
				
			||||||
		icon->paint(p, _st.iconPosition, width());
 | 
							icon->paint(p, _st.iconPosition, width());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		p.setOpacity(1.);
 | 
							p.setOpacity(1.);
 | 
				
			||||||
	auto pen = _colorOverride ? (*_colorOverride)->p : (over ? st::historyEmojiCircleFgOver : st::historyEmojiCircleFg)->p;
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						QRect inner(QPoint((width() - st::historyEmojiCircle.width()) / 2, st::historyEmojiCircleTop), st::historyEmojiCircle);
 | 
				
			||||||
 | 
						const auto color = (_colorOverride
 | 
				
			||||||
 | 
							? *_colorOverride
 | 
				
			||||||
 | 
							: (over
 | 
				
			||||||
 | 
								? st::historyEmojiCircleFgOver
 | 
				
			||||||
 | 
								: st::historyEmojiCircleFg));
 | 
				
			||||||
 | 
						if (_loading && anim::Disabled()) {
 | 
				
			||||||
 | 
							anim::DrawStaticLoading(
 | 
				
			||||||
 | 
								p,
 | 
				
			||||||
 | 
								inner,
 | 
				
			||||||
 | 
								st::historyEmojiCircleLine,
 | 
				
			||||||
 | 
								color);
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							auto pen = color->p;
 | 
				
			||||||
		pen.setWidth(st::historyEmojiCircleLine);
 | 
							pen.setWidth(st::historyEmojiCircleLine);
 | 
				
			||||||
		pen.setCapStyle(Qt::RoundCap);
 | 
							pen.setCapStyle(Qt::RoundCap);
 | 
				
			||||||
		p.setPen(pen);
 | 
							p.setPen(pen);
 | 
				
			||||||
		p.setBrush(Qt::NoBrush);
 | 
							p.setBrush(Qt::NoBrush);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		PainterHighQualityEnabler hq(p);
 | 
							PainterHighQualityEnabler hq(p);
 | 
				
			||||||
	QRect inner(QPoint((width() - st::historyEmojiCircle.width()) / 2, st::historyEmojiCircleTop), st::historyEmojiCircle);
 | 
					 | 
				
			||||||
		if (loadingState.arcLength < FullArcLength) {
 | 
							if (loadingState.arcLength < FullArcLength) {
 | 
				
			||||||
			p.drawArc(inner, loadingState.arcFrom, loadingState.arcLength);
 | 
								p.drawArc(inner, loadingState.arcFrom, loadingState.arcLength);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			p.drawEllipse(inner);
 | 
								p.drawEllipse(inner);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void EmojiButton::step_loading(TimeMs ms, bool timer) {
 | 
				
			||||||
 | 
						if (timer && !anim::Disabled()) {
 | 
				
			||||||
 | 
							update();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EmojiButton::setLoading(bool loading) {
 | 
					void EmojiButton::setLoading(bool loading) {
 | 
				
			||||||
	if (loading && !_loading) {
 | 
						if (loading && !_loading) {
 | 
				
			||||||
| 
						 | 
					@ -215,8 +237,10 @@ void EmojiButton::setLoading(bool loading) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (loading) {
 | 
						if (loading) {
 | 
				
			||||||
		_loading->start();
 | 
							_loading->start();
 | 
				
			||||||
 | 
							update();
 | 
				
			||||||
	} else if (_loading) {
 | 
						} else if (_loading) {
 | 
				
			||||||
		_loading->stop();
 | 
							_loading->stop();
 | 
				
			||||||
 | 
							update();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,11 +65,7 @@ protected:
 | 
				
			||||||
	QPoint prepareRippleStartPosition() const override;
 | 
						QPoint prepareRippleStartPosition() const override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	void step_loading(TimeMs ms, bool timer) {
 | 
						void step_loading(TimeMs ms, bool timer);
 | 
				
			||||||
		if (timer) {
 | 
					 | 
				
			||||||
			update();
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const style::IconButton &_st;
 | 
						const style::IconButton &_st;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -179,7 +179,7 @@ private:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PainterHighQualityEnabler {
 | 
					class PainterHighQualityEnabler {
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	PainterHighQualityEnabler(Painter &p) : _painter(p) {
 | 
						PainterHighQualityEnabler(QPainter &p) : _painter(p) {
 | 
				
			||||||
		static constexpr QPainter::RenderHint Hints[] = {
 | 
							static constexpr QPainter::RenderHint Hints[] = {
 | 
				
			||||||
			QPainter::Antialiasing,
 | 
								QPainter::Antialiasing,
 | 
				
			||||||
			QPainter::SmoothPixmapTransform,
 | 
								QPainter::SmoothPixmapTransform,
 | 
				
			||||||
| 
						 | 
					@ -187,8 +187,8 @@ public:
 | 
				
			||||||
			QPainter::HighQualityAntialiasing
 | 
								QPainter::HighQualityAntialiasing
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		auto hints = _painter.renderHints();
 | 
							const auto hints = _painter.renderHints();
 | 
				
			||||||
		for_const (auto hint, Hints) {
 | 
							for (const auto hint : Hints) {
 | 
				
			||||||
			if (!(hints & hint)) {
 | 
								if (!(hints & hint)) {
 | 
				
			||||||
				_hints |= hint;
 | 
									_hints |= hint;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -197,8 +197,12 @@ public:
 | 
				
			||||||
			_painter.setRenderHints(_hints);
 | 
								_painter.setRenderHints(_hints);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	PainterHighQualityEnabler(const PainterHighQualityEnabler &other) = delete;
 | 
					
 | 
				
			||||||
	PainterHighQualityEnabler &operator=(const PainterHighQualityEnabler &other) = delete;
 | 
						PainterHighQualityEnabler(
 | 
				
			||||||
 | 
							const PainterHighQualityEnabler &other) = delete;
 | 
				
			||||||
 | 
						PainterHighQualityEnabler &operator=(
 | 
				
			||||||
 | 
							const PainterHighQualityEnabler &other) = delete;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	~PainterHighQualityEnabler() {
 | 
						~PainterHighQualityEnabler() {
 | 
				
			||||||
		if (_hints) {
 | 
							if (_hints) {
 | 
				
			||||||
			_painter.setRenderHints(_hints, false);
 | 
								_painter.setRenderHints(_hints, false);
 | 
				
			||||||
| 
						 | 
					@ -206,7 +210,7 @@ public:
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	Painter &_painter;
 | 
						QPainter &_painter;
 | 
				
			||||||
	QPainter::RenderHints _hints = 0;
 | 
						QPainter::RenderHints _hints = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -538,8 +538,8 @@ CrossButton::CrossButton(QWidget *parent, const style::CrossButton &st) : Ripple
 | 
				
			||||||
void CrossButton::step_loading(TimeMs ms, bool timer) {
 | 
					void CrossButton::step_loading(TimeMs ms, bool timer) {
 | 
				
			||||||
	if (stopLoadingAnimation(ms)) {
 | 
						if (stopLoadingAnimation(ms)) {
 | 
				
			||||||
		_a_loading.stop();
 | 
							_a_loading.stop();
 | 
				
			||||||
	}
 | 
							update();
 | 
				
			||||||
	if (timer) {
 | 
						} else if (timer && !anim::Disabled()) {
 | 
				
			||||||
		update();
 | 
							update();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -584,11 +584,30 @@ void CrossButton::paintEvent(QPaintEvent *e) {
 | 
				
			||||||
	if (_a_loading.animating()) {
 | 
						if (_a_loading.animating()) {
 | 
				
			||||||
		if (stopLoadingAnimation(ms)) {
 | 
							if (stopLoadingAnimation(ms)) {
 | 
				
			||||||
			_a_loading.stop();
 | 
								_a_loading.stop();
 | 
				
			||||||
 | 
							} else if (anim::Disabled()) {
 | 
				
			||||||
 | 
								CrossAnimation::paintStaticLoading(
 | 
				
			||||||
 | 
									p,
 | 
				
			||||||
 | 
									_st.cross,
 | 
				
			||||||
 | 
									over ? _st.crossFgOver : _st.crossFg,
 | 
				
			||||||
 | 
									_st.crossPosition.x(),
 | 
				
			||||||
 | 
									_st.crossPosition.y(),
 | 
				
			||||||
 | 
									width(),
 | 
				
			||||||
 | 
									shown);
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			loading = ((ms - _loadingStartMs) % _st.loadingPeriod) / float64(_st.loadingPeriod);
 | 
								loading = ((ms - _loadingStartMs) % _st.loadingPeriod)
 | 
				
			||||||
 | 
									/ float64(_st.loadingPeriod);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	CrossAnimation::paint(p, _st.cross, over ? _st.crossFgOver : _st.crossFg, _st.crossPosition.x(), _st.crossPosition.y(), width(), shown, loading);
 | 
						CrossAnimation::paint(
 | 
				
			||||||
 | 
							p,
 | 
				
			||||||
 | 
							_st.cross,
 | 
				
			||||||
 | 
							over ? _st.crossFgOver : _st.crossFg,
 | 
				
			||||||
 | 
							_st.crossPosition.x(),
 | 
				
			||||||
 | 
							_st.crossPosition.y(),
 | 
				
			||||||
 | 
							width(),
 | 
				
			||||||
 | 
							shown,
 | 
				
			||||||
 | 
							loading);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool CrossButton::stopLoadingAnimation(TimeMs ms) {
 | 
					bool CrossButton::stopLoadingAnimation(TimeMs ms) {
 | 
				
			||||||
| 
						 | 
					@ -617,6 +636,9 @@ void CrossButton::setLoadingAnimation(bool enabled) {
 | 
				
			||||||
			_a_loading.stop();
 | 
								_a_loading.stop();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							update();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void CrossButton::onStateChanged(State was, StateChangeSource source) {
 | 
					void CrossButton::onStateChanged(State was, StateChangeSource source) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -393,6 +393,9 @@ void Widget::opacityAnimationCallback() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Widget::step_shift(float64 ms, bool timer) {
 | 
					void Widget::step_shift(float64 ms, bool timer) {
 | 
				
			||||||
 | 
						if (anim::Disabled()) {
 | 
				
			||||||
 | 
							ms += st::notifyFastAnim;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	float64 dt = ms / float64(st::notifyFastAnim);
 | 
						float64 dt = ms / float64(st::notifyFastAnim);
 | 
				
			||||||
	if (dt >= 1) {
 | 
						if (dt >= 1) {
 | 
				
			||||||
		a_shift.finish();
 | 
							a_shift.finish();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ void Progress::paintEvent(QPaintEvent *e) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Progress::step(TimeMs ms, bool timer) {
 | 
					void Progress::step(TimeMs ms, bool timer) {
 | 
				
			||||||
	if (timer) {
 | 
						if (timer && !anim::Disabled()) {
 | 
				
			||||||
		update();
 | 
							update();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue