Change *[Fast|Animated] to anim::type in FadeWrap.

This commit is contained in:
John Preston 2017-09-30 22:20:40 +03:00
parent 0c4bda71fd
commit 83850d9b86
44 changed files with 201 additions and 224 deletions

View File

@ -120,16 +120,12 @@ void BoxContent::updateShadowsVisibility() {
if (!_scroll) return;
auto top = _scroll->scrollTop();
if (top > 0 || _innerTopSkip > 0) {
_topShadow->showAnimated();
} else {
_topShadow->hideAnimated();
}
if (top < _scroll->scrollTopMax()) {
_bottomShadow->showAnimated();
} else {
_bottomShadow->hideAnimated();
}
_topShadow->toggle(
(top > 0 || _innerTopSkip > 0),
anim::type::normal);
_bottomShadow->toggle(
(top < _scroll->scrollTopMax()),
anim::type::normal);
}
void BoxContent::onScroll() {
@ -165,11 +161,11 @@ void BoxContent::setInnerVisible(bool scrollAreaVisible) {
QPixmap BoxContent::grabInnerCache() {
auto isTopShadowVisible = !_topShadow->isHidden();
auto isBottomShadowVisible = !_bottomShadow->isHidden();
if (isTopShadowVisible) _topShadow->hide();
if (isBottomShadowVisible) _bottomShadow->hide();
if (isTopShadowVisible) _topShadow->setVisible(false);
if (isBottomShadowVisible) _bottomShadow->setVisible(false);
auto result = myGrab(this, _scroll->geometry());
if (isTopShadowVisible) _topShadow->show();
if (isBottomShadowVisible) _bottomShadow->show();
if (isTopShadowVisible) _topShadow->setVisible(true);
if (isBottomShadowVisible) _bottomShadow->setVisible(true);
return result;
}
@ -191,8 +187,12 @@ void BoxContent::updateScrollAreaGeometry() {
updateInnerVisibleTopBottom();
auto top = _scroll->scrollTop();
_topShadow->toggleFast(top > 0 || _innerTopSkip > 0);
_bottomShadow->toggleFast(top < _scroll->scrollTopMax());
_topShadow->toggle(
(top > 0 || _innerTopSkip > 0),
anim::type::instant);
_bottomShadow->toggle(
(top < _scroll->scrollTopMax()),
anim::type::instant);
}
}

View File

@ -143,7 +143,7 @@ void AddContactBox::prepare() {
void AddContactBox::setInnerFocus() {
if ((_first->getLastText().isEmpty() && _last->getLastText().isEmpty()) || !_phone->isEnabled()) {
(_invertOrder ? _last : _first)->setFocusFast();
_phone->finishAnimations();
_phone->finishAnimating();
} else {
_phone->setFocusFast();
}

View File

@ -38,7 +38,7 @@ void createErrorLabel(
int x,
int y) {
if (label) {
label->hideAnimated();
label->hide(anim::type::normal);
auto context = label.data();
App::CallDelayed(
st::fadeWrapDuration,
@ -55,9 +55,9 @@ void createErrorLabel(
text,
Ui::FlatLabel::InitType::Simple,
st::changePhoneError));
label->hideFast();
label->hide(anim::type::instant);
label->moveToLeft(x, y);
label->showAnimated();
label->show(anim::type::normal);
}
}

View File

@ -169,7 +169,7 @@ void ConnectionBox::typeChanged(DBIConnectionType type) {
}
if ((type == dbictHttpProxy) && !_portInput->getLastText().toInt()) {
_portInput->setText(qsl("80"));
_portInput->finishAnimations();
_portInput->finishAnimating();
}
}
update();

View File

@ -283,7 +283,7 @@ void EditAdminBox::prepare() {
applyDependencies(nullptr);
for (auto &&checkbox : _checkboxes) {
checkbox.second->finishAnimations();
checkbox.second->finishAnimating();
}
resizeToContent();
@ -381,7 +381,7 @@ void EditRestrictedBox::prepare() {
applyDependencies(nullptr);
for (auto &&checkbox : _checkboxes) {
checkbox.second->finishAnimations();
checkbox.second->finishAnimating();
}
resizeToContent();

View File

@ -99,7 +99,7 @@ void PeerListBox::prepare() {
setDimensions(st::boxWideWidth, st::boxMaxListHeight);
if (_select) {
_select->finishAnimations();
_select->finishAnimating();
_scrollBottomFixed = true;
onScrollToY(0);
}

View File

@ -1223,7 +1223,7 @@ void StickersBox::Inner::rebuildMegagroupSet() {
if (_megagroupSetInput.type() != mtpc_inputStickerSetID) {
if (_megagroupSelectedSet) {
_megagroupSetField->setText(QString());
_megagroupSetField->finishAnimations();
_megagroupSetField->finishAnimating();
}
_megagroupSelectedSet.reset();
_megagroupSelectedRemove.destroy();
@ -1249,7 +1249,7 @@ void StickersBox::Inner::rebuildMegagroupSet() {
auto installed = true, official = false, unread = false, archived = false, removed = false;
if (!_megagroupSelectedSet || _megagroupSelectedSet->id != it->id) {
_megagroupSetField->setText(it->shortName);
_megagroupSetField->finishAnimations();
_megagroupSetField->finishAnimating();
}
_megagroupSelectedSet = std::make_unique<Row>(it->id, sticker, count, title, titleWidth, installed, official, unread, archived, removed, pixw, pixh);
_itemsTop += st::lineWidth + _rowHeight;

View File

@ -341,8 +341,8 @@ void Panel::initControls() {
reinitControls();
_decline->finishAnimations();
_cancel->finishAnimations();
_decline->finishAnimating();
_cancel->finishAnimating();
}
void Panel::reinitControls() {
@ -397,7 +397,7 @@ void Panel::toggleOpacityAnimation(bool visible) {
}
}
void Panel::finishAnimation() {
void Panel::finishAnimating() {
_animationCache = QPixmap();
if (_call) {
if (!_visible) {
@ -413,8 +413,8 @@ void Panel::finishAnimation() {
void Panel::showControls() {
Expects(_call != nullptr);
showChildren();
_decline->setVisible(!_decline->isHiddenOrHiding());
_cancel->setVisible(!_cancel->isHiddenOrHiding());
_decline->setVisible(_decline->toggled());
_cancel->setVisible(_cancel->toggled());
}
void Panel::destroyDelayed() {
@ -607,7 +607,7 @@ void Panel::paintEvent(QPaintEvent *e) {
if (!_animationCache.isNull()) {
auto opacity = _opacityAnimation.current(getms(), _call ? 1. : 0.);
if (!_opacityAnimation.animating()) {
finishAnimation();
finishAnimating();
if (!_call || isHidden()) return;
} else {
Platform::StartTranslucentPaint(p, e);
@ -722,11 +722,11 @@ void Panel::stateChanged(State state) {
&& (state != State::FailedHangingUp)
&& (state != State::Failed)) {
auto toggleButton = [this](auto &&button, bool visible) {
if (isHidden()) {
button->toggleFast(visible);
} else {
button->toggleAnimated(visible);
}
button->toggle(
visible,
isHidden()
? anim::type::instant
: anim::type::normal);
};
auto incomingWaiting = _call->isIncomingWaiting();
if (incomingWaiting) {
@ -734,7 +734,8 @@ void Panel::stateChanged(State state) {
}
toggleButton(_decline, incomingWaiting);
toggleButton(_cancel, (state == State::Busy));
auto hangupShown = _decline->isHiddenOrHiding() && _cancel->isHiddenOrHiding();
auto hangupShown = !_decline->toggled()
&& !_cancel->toggled();
if (_hangupShown != hangupShown) {
_hangupShown = hangupShown;
_hangupShownProgress.start([this] { updateHangupGeometry(); }, _hangupShown ? 0. : 1., _hangupShown ? 1. : 0., st::callPanelDuration, anim::sineInOut);

View File

@ -85,7 +85,7 @@ private:
void startDurationUpdateTimer(TimeMs currentDuration);
void fillFingerprint();
void toggleOpacityAnimation(bool visible);
void finishAnimation();
void finishAnimating();
void destroyDelayed();
Call *_call = nullptr;

View File

@ -259,9 +259,9 @@ void DialogsWidget::showAnimated(Window::SlideDirection direction, const Window:
_mainMenuToggle->hide();
if (_forwardCancel) _forwardCancel->hide();
_filter->hide();
_cancelSearch->hideFast();
_jumpToDate->hideFast();
_chooseFromUser->hideFast();
_cancelSearch->hide();
_jumpToDate->hide(anim::type::instant);
_chooseFromUser->hide(anim::type::instant);
_lockUnlock->hide();
int delta = st::slideShift;
@ -822,7 +822,7 @@ void DialogsWidget::onFilterUpdate(bool force) {
_peerSearchQuery = QString();
}
if (!_chooseFromUser->isHiddenOrHiding() || _searchFromUser) {
if (_chooseFromUser->toggled() || _searchFromUser) {
auto switchToChooseFrom = SwitchToChooseFromQuery();
if (_lastFilterText != switchToChooseFrom
&& switchToChooseFrom.startsWith(_lastFilterText)
@ -938,22 +938,17 @@ void DialogsWidget::updateLockUnlockVisibility() {
void DialogsWidget::updateJumpToDateVisibility(bool fast) {
if (_a_show.animating()) return;
auto jumpToDateVisible = (_searchInPeer && _filter->getLastText().isEmpty());
if (fast) {
_jumpToDate->toggleFast(jumpToDateVisible);
} else {
_jumpToDate->toggleAnimated(jumpToDateVisible);
}
_jumpToDate->toggle(
(_searchInPeer && _filter->getLastText().isEmpty()),
fast ? anim::type::instant : anim::type::normal);
}
void DialogsWidget::updateSearchFromVisibility(bool fast) {
auto visible = _searchInPeer && (_searchInPeer->isChat() || _searchInPeer->isMegagroup()) && !_searchFromUser;
auto changed = (visible == _chooseFromUser->isHiddenOrHiding());
if (fast) {
_chooseFromUser->toggleFast(visible);
} else {
_chooseFromUser->toggleAnimated(visible);
}
auto changed = (visible == !_chooseFromUser->toggled());
_chooseFromUser->toggle(
visible,
fast ? anim::type::instant : anim::type::normal);
if (changed) {
auto margins = st::dialogsFilter.textMrg;
if (visible) {

View File

@ -43,7 +43,7 @@ public:
};
void setChecked(bool checked, NotifyAboutChange notify = NotifyAboutChange::Notify);
void finishAnimations();
void finishAnimating();
QMargins getMargins() const override {
return _st.margin;
@ -125,8 +125,8 @@ void UserCheckbox::paintEvent(QPaintEvent *e) {
p.drawTextLeft(statusLeft, statusTop, width(), _statusText);
}
void UserCheckbox::finishAnimations() {
_check->finishAnimation();
void UserCheckbox::finishAnimating() {
_check->finishAnimating();
}
int UserCheckbox::resizeGetHeight(int newWidth) {

View File

@ -1656,7 +1656,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
onBotStart();
_history->clearLocalDraft();
applyDraft();
_send->finishAnimation();
_send->finishAnimating();
}
return;
}
@ -1791,7 +1791,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
_history->takeLocalDraft(_migrated);
}
applyDraft(false);
_send->finishAnimation();
_send->finishAnimating();
_tabbedSelector->showMegagroupSet(_peer->asMegagroup());
@ -3005,7 +3005,7 @@ void HistoryWidget::doneShow() {
}
}
void HistoryWidget::finishAnimation() {
void HistoryWidget::finishAnimating() {
if (!_a_show.animating()) return;
_a_show.finish();
_topShadow->setVisible(_peer != nullptr);

View File

@ -250,7 +250,7 @@ public:
return peer() != nullptr;
}
void showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams &params);
void finishAnimation();
void finishAnimating();
void doneShow();

View File

@ -173,9 +173,9 @@ void WrapWidget::finishShowContent() {
: _content->desiredShadowVisibility());
if (_topTabs) {
_topTabs->finishAnimations();
_topTabs->finishAnimating();
}
_topShadow->finishAnimations();
_topShadow->finishAnimating();
updateContentGeometry();
@ -219,14 +219,14 @@ object_ptr<Media::Widget> WrapWidget::createMediaWidget() {
}
bool WrapWidget::hasTopBarShadow() const {
return !_topShadow->isHiddenOrHiding();
return _topShadow->toggled();
}
QPixmap WrapWidget::grabForShowAnimation(
const Window::SectionSlideParams &params) {
if (params.withTopBarShadow) _topShadow->hide();
if (params.withTopBarShadow) _topShadow->hide(anim::type::instant);
auto result = myGrab(this);
if (params.withTopBarShadow) _topShadow->show();
if (params.withTopBarShadow) _topShadow->show(anim::type::instant);
return result;
}

View File

@ -59,7 +59,7 @@ Button *Button::toggleOn(rpl::producer<bool> &&toggled) {
| rpl::start_with_next([this](bool toggled) {
_toggle->setCheckedAnimated(toggled);
}, lifetime());
_toggle->finishAnimation();
_toggle->finishAnimating();
return this;
}

View File

@ -68,7 +68,7 @@ object_ptr<Ui::SlideWrap<Ui::VerticalLayout>> CreateTextWithLabel(
layout,
std::move(label),
st::infoLabel));
result->finishAnimations();
result->finishAnimating();
return result;
}

View File

@ -84,7 +84,7 @@ void PhoneWidget::showPhoneError(base::lambda<QString()> textFactory) {
void PhoneWidget::hidePhoneError() {
hideError();
if (_signup) {
_signup->hideAnimated();
_signup->hide(anim::type::instant);
showDescription();
}
}
@ -99,10 +99,10 @@ void PhoneWidget::showSignup() {
_signup->entity()->setLink(2, MakeShared<LambdaClickHandler>([this] {
toSignUp();
}));
_signup->hideFast();
_signup->hide(anim::type::instant);
updateSignupGeometry();
}
_signup->showAnimated();
_signup->show(anim::type::normal);
hideDescription();
}

View File

@ -71,7 +71,7 @@ Widget::Widget(QWidget *parent) : TWidget(parent)
getData()->country = country;
_back->entity()->setClickedCallback([this] { historyMove(Direction::Back); });
_back->hideFast();
_back->hide(anim::type::instant);
_next->setClickedCallback([this] { getStep()->submit(); });
@ -84,7 +84,7 @@ Widget::Widget(QWidget *parent) : TWidget(parent)
subscribe(Lang::CurrentCloudManager().firstLanguageSuggestion(), [this] { createLanguageLink(); });
createLanguageLink();
if (_changeLanguage) _changeLanguage->finishAnimations();
if (_changeLanguage) _changeLanguage->finishAnimating();
subscribe(Lang::Current().updated(), [this] { refreshLang(); });
@ -116,12 +116,11 @@ void Widget::createLanguageLink() {
_changeLanguage.create(
this,
object_ptr<Ui::LinkButton>(this, text));
_changeLanguage->show();
_changeLanguage->hideFast();
_changeLanguage->hide(anim::type::instant);
_changeLanguage->entity()->setClickedCallback([this, languageId] {
Lang::CurrentCloudManager().switchToLanguage(languageId);
});
_changeLanguage->toggleAnimated(!_resetAccount);
_changeLanguage->toggle(!_resetAccount, anim::type::normal);
updateControlsGeometry();
};
@ -151,7 +150,9 @@ void Widget::onCheckUpdateStatus() {
this,
langFactory(lng_menu_update),
st::defaultBoxButton));
if (!_a_show.animating()) _update->show();
if (!_a_show.animating()) {
_update->setVisible(true);
}
_update->entity()->setClickedCallback([] {
checkReadyUpdate();
App::restart();
@ -197,14 +198,14 @@ void Widget::historyMove(Direction direction) {
if (direction == Direction::Back || direction == Direction::Replace) {
delete base::take(wasStep);
}
_back->toggleAnimated(getStep()->hasBack());
_back->toggle(getStep()->hasBack(), anim::type::normal);
auto stepHasCover = getStep()->hasCover();
_settings->toggleAnimated(!stepHasCover);
if (_update) _update->toggleAnimated(!stepHasCover);
if (_changeLanguage) _changeLanguage->toggleAnimated(!_resetAccount);
_settings->toggle(!stepHasCover, anim::type::normal);
if (_update) _update->toggle(!stepHasCover, anim::type::normal);
if (_changeLanguage) _changeLanguage->toggle(!_resetAccount, anim::type::normal);
_next->setText([this] { return getStep()->nextButtonText(); });
if (_resetAccount) _resetAccount->hideAnimated();
if (_resetAccount) _resetAccount->hide(anim::type::normal);
getStep()->showAnimated(direction);
fixOrder();
}
@ -248,12 +249,12 @@ void Widget::showResetButton() {
_resetAccount.create(
this,
std::move(entity));
_resetAccount->hideFast();
_resetAccount->hide(anim::type::instant);
_resetAccount->entity()->setClickedCallback([this] { resetAccount(); });
updateControlsGeometry();
}
_resetAccount->showAnimated();
if (_changeLanguage) _changeLanguage->hideAnimated();
_resetAccount->show(anim::type::normal);
if (_changeLanguage) _changeLanguage->hide(anim::type::normal);
}
void Widget::resetAccount() {
@ -313,19 +314,19 @@ void Widget::showControls() {
_next->show();
_next->setText([this] { return getStep()->nextButtonText(); });
auto hasCover = getStep()->hasCover();
_settings->toggleFast(!hasCover);
if (_update) _update->toggleFast(!hasCover);
if (_changeLanguage) _changeLanguage->toggleFast(!_resetAccount);
_back->toggleFast(getStep()->hasBack());
_settings->toggle(!hasCover, anim::type::instant);
if (_update) _update->toggle(!hasCover, anim::type::instant);
if (_changeLanguage) _changeLanguage->toggle(!_resetAccount, anim::type::instant);
_back->toggle(getStep()->hasBack(), anim::type::instant);
}
void Widget::hideControls() {
getStep()->hide();
_next->hide();
_settings->hideFast();
if (_update) _update->hideFast();
if (_changeLanguage) _changeLanguage->hideFast();
_back->hideFast();
_settings->hide(anim::type::instant);
if (_update) _update->hide(anim::type::instant);
if (_changeLanguage) _changeLanguage->hide(anim::type::instant);
_back->hide(anim::type::instant);
}
void Widget::showAnimated(const QPixmap &bgAnimCache, bool back) {
@ -604,11 +605,11 @@ void Widget::Step::fillSentCodeData(const MTPauth_SentCodeType &type) {
}
void Widget::Step::showDescription() {
_description->showAnimated();
_description->show(anim::type::normal);
}
void Widget::Step::hideDescription() {
_description->hideAnimated();
_description->hide(anim::type::normal);
}
void Widget::Step::paintContentSnapshot(Painter &p, const QPixmap &snapshot, float64 alpha, float64 howMuchHidden) {
@ -712,7 +713,7 @@ void Widget::Step::showError(base::lambda<QString()> textFactory) {
void Widget::Step::refreshError() {
if (!_errorTextFactory) {
if (_error) _error->hideAnimated();
if (_error) _error->hide(anim::type::normal);
} else {
if (!_error) {
_error.create(
@ -722,11 +723,11 @@ void Widget::Step::refreshError() {
_errorCentered
? st::introErrorCentered
: st::introError));
_error->hideFast();
_error->hide(anim::type::instant);
}
_error->entity()->setText(_errorTextFactory());
updateLabelsPosition();
_error->showAnimated();
_error->show(anim::type::normal);
}
}
@ -827,9 +828,9 @@ bool Widget::Step::hasBack() const {
void Widget::Step::activate() {
_title->show();
_description->show();
_description->show(anim::type::instant);
if (_errorTextFactory) {
_error->showFast();
_error->show(anim::type::instant);
}
}

View File

@ -2752,7 +2752,7 @@ void MainWidget::showMediaOverview(PeerData *peer, MediaOverviewType type, bool
} else {
_overview->fastShow();
}
_history->finishAnimation();
_history->finishAnimating();
if (back) {
clearBotStartToken(_history->peer());
}
@ -3018,7 +3018,7 @@ void MainWidget::showNewSection(
}
_mainSection = std::move(newMainSection);
updateControlsGeometry();
_history->finishAnimation();
_history->finishAnimating();
_history->showHistory(0, 0);
_history->hide();
if (Adaptive::OneColumn()) _dialogs->hide();

View File

@ -108,7 +108,7 @@ void PasscodeWidget::showAnimated(const QPixmap &bgAnimCache, bool back) {
showAll();
setInnerFocus();
_passcode->finishAnimations();
_passcode->finishAnimating();
(_showBack ? _cacheUnder : _cacheOver) = myGrab(this);
hideAll();

View File

@ -54,7 +54,7 @@ SettingsWidget::SettingsWidget(QWidget *parent, PeerData *peer) : BlockWidget(pa
}));
refreshButtons();
_enableNotifications->finishAnimations();
_enableNotifications->finishAnimating();
show();
}

View File

@ -39,7 +39,7 @@ Widget::Widget(QWidget *parent, not_null<Window::Controller*> controller, PeerDa
_fixedBar->resizeToWidth(width());
_fixedBar->show();
_fixedBarShadow->hideFast();
_fixedBarShadow->hide(anim::type::instant);
_fixedBarShadow->raise();
updateAdaptiveLayout();
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
@ -65,9 +65,9 @@ bool Widget::hasTopBarShadow() const {
}
QPixmap Widget::grabForShowAnimation(const Window::SectionSlideParams &params) {
if (params.withTopBarShadow || !_scroll->scrollTop()) _fixedBarShadow->hide();
if (params.withTopBarShadow || !_scroll->scrollTop()) _fixedBarShadow->hide(anim::type::instant);
auto result = myGrab(this);
if (params.withTopBarShadow) _fixedBarShadow->show();
if (params.withTopBarShadow) _fixedBarShadow->show(anim::type::instant);
return result;
}
@ -107,7 +107,7 @@ void Widget::restoreState(not_null<SectionMemento*> memento) {
auto scrollTop = memento->getScrollTop();
_scroll->scrollToY(scrollTop);
updateScrollState();
_fixedBarShadow->finishAnimations();
_fixedBarShadow->finishAnimating();
}
void Widget::resizeEvent(QResizeEvent *e) {
@ -136,11 +136,7 @@ void Widget::resizeEvent(QResizeEvent *e) {
void Widget::updateScrollState() {
auto scrollTop = _scroll->scrollTop();
_inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height());
if (scrollTop > 0) {
_fixedBarShadow->showAnimated();
} else {
_fixedBarShadow->hideAnimated();
}
_fixedBarShadow->toggle(scrollTop > 0, anim::type::normal);
}
void Widget::onScroll() {
@ -154,7 +150,7 @@ void Widget::showAnimatedHook() {
void Widget::showFinishedHook() {
_fixedBar->setAnimatingMode(false);
if (!_scroll->scrollTop()) {
_fixedBarShadow->hide();
_fixedBarShadow->hide(anim::type::instant);
}
_inner->showFinished();
}

View File

@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "settings/settings_layer.h"
#include <rpl/mappers.h>
#include "settings/settings_inner_widget.h"
#include "settings/settings_fixed_bar.h"
#include "styles/style_settings.h"
@ -48,15 +49,12 @@ Layer::Layer()
_fixedBarClose->moveToRight(0, 0);
_fixedBarShadow->entity()->resize(width(), st::lineWidth);
_fixedBarShadow->moveToLeft(0, _fixedBar->y() + _fixedBar->height());
_fixedBarShadow->hideFast();
_fixedBarShadow->hide(anim::type::instant);
_scroll->moveToLeft(0, st::settingsFixedBarHeight);
_scroll->scrollTopValue()
| rpl::map([](int scrollTop) { return scrollTop > 0; })
| rpl::distinct_until_changed()
| rpl::start_with_next([this](bool scrolled) {
_fixedBarShadow->toggleAnimated(scrolled);
}, lifetime());
using namespace rpl::mappers;
_fixedBarShadow->toggleOn(_scroll->scrollTopValue()
| rpl::map($1 > 0));
}
void Layer::setCloseClickHandler(base::lambda<void()> callback) {

View File

@ -182,7 +182,7 @@ void SendButton::setRecordActive(bool recordActive) {
}
}
void SendButton::finishAnimation() {
void SendButton::finishAnimating() {
_a_typeChanged.finish();
_a_recordActive.finish();
update();

View File

@ -98,7 +98,7 @@ public:
}
void setType(Type state);
void setRecordActive(bool recordActive);
void finishAnimation();
void finishAnimating();
void setRecordStartCallback(base::lambda<void()> callback) {
_recordStartCallback = std::move(callback);

View File

@ -201,7 +201,7 @@ public:
}
void setText(const QString &text, int value);
void stepAnimation(TimeMs ms);
void finishAnimation();
void finishAnimating();
void paint(Painter &p, int x, int y, int outerWidth);
int countWidth() const;
@ -312,7 +312,7 @@ void RoundButton::Numbers::stepAnimation(TimeMs ms) {
_a_ready.step(ms);
}
void RoundButton::Numbers::finishAnimation() {
void RoundButton::Numbers::finishAnimating() {
auto width = countWidth();
_a_ready.finish();
if (_widthChangedCallback && countWidth() != width) {
@ -398,7 +398,7 @@ void RoundButton::stepNumbersAnimation(TimeMs ms) {
void RoundButton::finishNumbersAnimation() {
if (_numbers) {
_numbers->finishAnimation();
_numbers->finishAnimating();
}
}

View File

@ -43,7 +43,7 @@ AbstractCheckView::AbstractCheckView(int duration, bool checked, base::lambda<vo
void AbstractCheckView::setCheckedFast(bool checked) {
_checked = checked;
finishAnimation();
finishAnimating();
if (_updateCallback) {
_updateCallback();
}
@ -63,7 +63,7 @@ void AbstractCheckView::setCheckedAnimated(bool checked) {
}
}
void AbstractCheckView::finishAnimation() {
void AbstractCheckView::finishAnimating() {
_toggleAnimation.finish();
}
@ -372,8 +372,8 @@ void Checkbox::setChecked(bool checked, NotifyAboutChange notify) {
}
}
void Checkbox::finishAnimations() {
_check->finishAnimation();
void Checkbox::finishAnimating() {
_check->finishAnimating();
}
int Checkbox::naturalWidth() const {
@ -462,7 +462,7 @@ void Checkbox::onStateChanged(State was, StateChangeSource source) {
if (isDisabled() && !(was & StateFlag::Disabled)) {
setCursor(style::cur_default);
finishAnimations();
finishAnimating();
_checkCache = grabCheckCache();
} else if (!isDisabled() && (was & StateFlag::Disabled)) {
setCursor(style::cur_pointer);

View File

@ -32,7 +32,7 @@ public:
void setCheckedFast(bool checked);
void setCheckedAnimated(bool checked);
void finishAnimation();
void finishAnimating();
void setUpdateCallback(base::lambda<void()> updateCallback);
bool checked() const {
return _checked;
@ -140,7 +140,7 @@ public:
void setChecked(bool checked, NotifyAboutChange notify = NotifyAboutChange::Notify);
base::Observable<bool> checkedChanged;
void finishAnimations();
void finishAnimating();
QMargins getMargins() const override {
return _st.margin;

View File

@ -56,10 +56,10 @@ void DiscreteSlider::timerEvent(QTimerEvent *e) {
void DiscreteSlider::setActiveSectionFast(int index) {
setActiveSection(index);
finishAnimations();
finishAnimating();
}
void DiscreteSlider::finishAnimations() {
void DiscreteSlider::finishAnimating() {
_a_left.finish();
update();
}

View File

@ -39,7 +39,7 @@ public:
}
void setActiveSection(int index);
void setActiveSectionFast(int index);
void finishAnimations();
void finishAnimating();
auto sectionActivated() const {
return _sectionActivated.events();

View File

@ -79,7 +79,7 @@ void InnerDropdown::resizeToContent() {
if (newWidth != width() || newHeight != height()) {
resize(newWidth, newHeight);
update();
finishAnimations();
finishAnimating();
}
}
@ -194,7 +194,7 @@ void InnerDropdown::hideAnimated(HideOption option) {
startOpacityAnimation(true);
}
void InnerDropdown::finishAnimations() {
void InnerDropdown::finishAnimating() {
if (_a_show.animating()) {
_a_show.finish();
showAnimationCallback();
@ -211,7 +211,7 @@ void InnerDropdown::finishAnimations() {
void InnerDropdown::showFast() {
_hideTimer.stop();
finishAnimations();
finishAnimating();
if (isHidden()) {
showChildren();
show();
@ -223,7 +223,7 @@ void InnerDropdown::hideFast() {
if (isHidden()) return;
_hideTimer.stop();
finishAnimations();
finishAnimating();
_hiding = false;
hideFinished();
}

View File

@ -76,7 +76,7 @@ public:
void setOrigin(PanelAnimation::Origin origin);
void showAnimated(PanelAnimation::Origin origin);
void hideAnimated(HideOption option = HideOption::Default);
void finishAnimations();
void finishAnimating();
void showFast();
void hideFast();

View File

@ -1796,7 +1796,7 @@ InputArea::InputArea(QWidget *parent, const style::InputField &st, base::lambda<
startBorderAnimation();
startPlaceholderAnimation();
finishAnimations();
finishAnimating();
}
void InputArea::updatePalette() {
@ -2344,10 +2344,10 @@ void InputArea::onRedoAvailable(bool avail) {
void InputArea::setDisplayFocused(bool focused) {
setFocused(focused);
finishAnimations();
finishAnimating();
}
void InputArea::finishAnimations() {
void InputArea::finishAnimating() {
_a_focused.finish();
_a_error.finish();
_a_placeholderShifted.finish();
@ -2554,7 +2554,7 @@ InputField::InputField(QWidget *parent, const style::InputField &st, base::lambd
startPlaceholderAnimation();
startBorderAnimation();
finishAnimations();
finishAnimating();
}
void InputField::updatePalette() {
@ -3115,10 +3115,10 @@ void InputField::selectAll() {
void InputField::setDisplayFocused(bool focused) {
setFocused(focused);
finishAnimations();
finishAnimating();
}
void InputField::finishAnimations() {
void InputField::finishAnimating() {
_a_focused.finish();
_a_error.finish();
_a_placeholderShifted.finish();
@ -3304,7 +3304,7 @@ MaskedInputField::MaskedInputField(QWidget *parent, const style::InputField &st,
startPlaceholderAnimation();
startBorderAnimation();
finishAnimations();
finishAnimating();
}
void MaskedInputField::updatePalette() {
@ -3579,10 +3579,10 @@ QSize MaskedInputField::minimumSizeHint() const {
void MaskedInputField::setDisplayFocused(bool focused) {
setFocused(focused);
finishAnimations();
finishAnimating();
}
void MaskedInputField::finishAnimations() {
void MaskedInputField::finishAnimating() {
_a_focused.finish();
_a_error.finish();
_a_placeholderShifted.finish();

View File

@ -333,7 +333,7 @@ public:
}
void setPlaceholder(base::lambda<QString()> placeholderFactory);
void setDisplayFocused(bool focused);
void finishAnimations();
void finishAnimating();
void setFocusFast() {
setDisplayFocused(true);
setFocus();
@ -513,7 +513,7 @@ public:
void setPlaceholder(base::lambda<QString()> placeholderFactory);
void setPlaceholderHidden(bool forcePlaceholderHidden);
void setDisplayFocused(bool focused);
void finishAnimations();
void finishAnimating();
void setFocusFast() {
setDisplayFocused(true);
setFocus();
@ -699,7 +699,7 @@ public:
void setPlaceholder(base::lambda<QString()> placeholderFactory);
void setPlaceholderHidden(bool forcePlaceholderHidden);
void setDisplayFocused(bool focused);
void finishAnimations();
void finishAnimating();
void setFocusFast() {
setDisplayFocused(true);
setFocus();

View File

@ -112,13 +112,13 @@ void Menu::clearActions() {
}
}
void Menu::finishAnimations() {
void Menu::finishAnimating() {
for (auto &data : _actionsData) {
if (data.ripple) {
data.ripple.reset();
}
if (data.toggle) {
data.toggle->finishAnimation();
data.toggle->finishAnimating();
}
}
}

View File

@ -38,7 +38,7 @@ public:
QAction *addAction(const QString &text, base::lambda<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
QAction *addSeparator();
void clearActions();
void finishAnimations();
void finishAnimating();
void clearSelection();

View File

@ -647,7 +647,7 @@ void MultiSelect::Inner::finishItemsBunch(AddItemWay way) {
if (way != AddItemWay::SkipAnimation) {
_items.back()->showAnimated();
} else {
_field->finishAnimations();
_field->finishAnimating();
finishHeightAnimation();
}
}

View File

@ -38,34 +38,30 @@ FadeWrap<RpWidget> *FadeWrap<RpWidget>::setDuration(int duration) {
return this;
}
FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggleAnimated(
bool shown) {
FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggle(
bool shown,
anim::type animated) {
auto updated = (shown != _animation.visible());
if (shown) {
_animation.fadeIn(_duration);
if (animated == anim::type::normal) {
_animation.fadeIn(_duration);
} else {
_animation.show();
}
} else {
_animation.fadeOut(_duration);
if (animated == anim::type::normal) {
_animation.fadeOut(_duration);
} else {
_animation.hide();
}
}
if (updated) {
_shownUpdated.fire_copy(shown);
_toggledChanged.fire_copy(shown);
}
return this;
}
FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggleFast(bool shown) {
auto updated = (shown != _animation.visible());
if (shown) {
_animation.show();
} else {
_animation.hide();
}
if (updated) {
_shownUpdated.fire_copy(shown);
}
return this;
}
FadeWrap<RpWidget> *FadeWrap<RpWidget>::finishAnimations() {
FadeWrap<RpWidget> *FadeWrap<RpWidget>::finishAnimating() {
_animation.finish();
return this;
}
@ -74,9 +70,9 @@ FadeWrap<RpWidget> *FadeWrap<RpWidget>::toggleOn(
rpl::producer<bool> &&shown) {
std::move(shown)
| rpl::start_with_next([this](bool shown) {
toggleAnimated(shown);
toggle(shown, anim::type::normal);
}, lifetime());
finishAnimations();
finishAnimating();
return this;
}
@ -91,7 +87,7 @@ FadeShadow::FadeShadow(QWidget *parent)
FadeShadow::FadeShadow(QWidget *parent, style::color color)
: Parent(parent, object_ptr<PlainShadow>(parent, color)) {
hideFast();
hide(anim::type::instant);
}
} // namespace Ui

View File

@ -45,25 +45,24 @@ public:
bool scaled);
FadeWrap *setDuration(int duration);
FadeWrap *toggleAnimated(bool shown);
FadeWrap *toggleFast(bool shown);
FadeWrap *showAnimated() { return toggleAnimated(true); }
FadeWrap *hideAnimated() { return toggleAnimated(false); }
FadeWrap *showFast() { return toggleFast(true); }
FadeWrap *hideFast() { return toggleFast(false); }
FadeWrap *finishAnimations();
FadeWrap *toggle(bool shown, anim::type animated);
FadeWrap *show(anim::type animated) {
return toggle(true, animated);
}
FadeWrap *hide(anim::type animated) {
return toggle(false, animated);
}
FadeWrap *finishAnimating();
FadeWrap *toggleOn(rpl::producer<bool> &&shown);
bool animating() const {
return _animation.animating();
}
bool isHiddenOrHiding() const {
return !_animation.visible();
bool toggled() const {
return _animation.visible();
}
auto shownValue() const {
return _shownUpdated.events_starting_with(
auto toggledValue() const {
return _toggledChanged.events_starting_with(
_animation.visible());
}
@ -71,7 +70,7 @@ protected:
void paintEvent(QPaintEvent *e) final override;
private:
rpl::event_stream<bool> _shownUpdated;
rpl::event_stream<bool> _toggledChanged;
FadeAnimation _animation;
int _duration = 0;
@ -95,26 +94,17 @@ public:
FadeWrap *setDuration(int duration) {
return chain(Parent::setDuration(duration));
}
FadeWrap *toggleAnimated(bool shown) {
return chain(Parent::toggleAnimated(shown));
FadeWrap *toggle(bool shown, anim::type animated) {
return chain(Parent::toggle(shown, animated));
}
FadeWrap *toggleFast(bool shown) {
return chain(Parent::toggleFast(shown));
FadeWrap *show(anim::type animated) {
return chain(Parent::show(animated));
}
FadeWrap *showAnimated() {
return chain(Parent::showAnimated());
FadeWrap *hide(anim::type animated) {
return chain(Parent::hide(animated));
}
FadeWrap *hideAnimated() {
return chain(Parent::hideAnimated());
}
FadeWrap *showFast() {
return chain(Parent::showFast());
}
FadeWrap *hideFast() {
return chain(Parent::hideFast());
}
FadeWrap *finishAnimations() {
return chain(Parent::finishAnimations());
FadeWrap *finishAnimating() {
return chain(Parent::finishAnimating());
}
FadeWrap *toggleOn(rpl::producer<bool> &&shown) {
return chain(Parent::toggleOn(std::move(shown)));

View File

@ -72,11 +72,11 @@ SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggleAnimated(
SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggleFast(bool shown) {
setShown(shown);
finishAnimations();
finishAnimating();
return this;
}
SlideWrap<RpWidget> *SlideWrap<RpWidget>::finishAnimations() {
SlideWrap<RpWidget> *SlideWrap<RpWidget>::finishAnimating() {
_animation.finish();
animationStep();
return this;
@ -88,7 +88,7 @@ SlideWrap<RpWidget> *SlideWrap<RpWidget>::toggleOn(
| rpl::start_with_next([this](bool shown) {
toggleAnimated(shown);
}, lifetime());
finishAnimations();
finishAnimating();
return this;
}

View File

@ -50,7 +50,7 @@ public:
SlideWrap *hideAnimated() { return toggleAnimated(false); }
SlideWrap *showFast() { return toggleFast(true); }
SlideWrap *hideFast() { return toggleFast(false); }
SlideWrap *finishAnimations();
SlideWrap *finishAnimating();
SlideWrap *toggleOn(rpl::producer<bool> &&shown);
bool animating() const {
@ -125,8 +125,8 @@ public:
SlideWrap *hideFast() {
return chain(Parent::hideFast());
}
SlideWrap *finishAnimations() {
return chain(Parent::finishAnimations());
SlideWrap *finishAnimating() {
return chain(Parent::finishAnimating());
}
SlideWrap *toggleOn(rpl::producer<bool> &&shown) {
return chain(Parent::toggleOn(std::move(shown)));

View File

@ -59,7 +59,7 @@ public:
void setCacheImages(QPixmap &&bodyCache, QPixmap &&mainMenuCache, QPixmap &&specialLayerCache, QPixmap &&layerCache);
void startAnimation(Action action);
void skipAnimation(Action action);
void finishAnimation();
void finishAnimating();
bool animating() const {
return _a_mainMenuShown.animating() || _a_specialLayerShown.animating() || _a_layerShown.animating();
@ -140,7 +140,7 @@ void LayerStackWidget::BackgroundWidget::startAnimation(Action action) {
void LayerStackWidget::BackgroundWidget::skipAnimation(Action action) {
startAnimation(action);
finishAnimation();
finishAnimating();
}
void LayerStackWidget::BackgroundWidget::checkIfDone() {
@ -314,7 +314,7 @@ void LayerStackWidget::BackgroundWidget::paintEvent(QPaintEvent *e) {
}
}
void LayerStackWidget::BackgroundWidget::finishAnimation() {
void LayerStackWidget::BackgroundWidget::finishAnimating() {
_a_shown.finish();
_a_mainMenuShown.finish();
_a_specialLayerShown.finish();
@ -484,8 +484,8 @@ void LayerStackWidget::updateLayerBoxes() {
update();
}
void LayerStackWidget::finishAnimation() {
_background->finishAnimation();
void LayerStackWidget::finishAnimating() {
_background->finishAnimating();
}
bool LayerStackWidget::canSetFocus() const {

View File

@ -92,7 +92,7 @@ public:
Controller *controller() const {
return _controller;
}
void finishAnimation();
void finishAnimating();
void showBox(
object_ptr<BoxContent> box,

View File

@ -123,7 +123,7 @@ void MainMenu::refreshMenu() {
*_nightThemeAction = action;
action->setCheckable(true);
action->setChecked(Window::Theme::IsNightTheme());
_menu->finishAnimations();
_menu->finishAnimating();
}
updatePhone();