void PopupMenu::startShowAnimation() { if (!_useTransparency) { _a_show.finish(); update(); return; } if (!_a_show.animating()) { auto opacityAnimation = base::take(_a_opacity); showChildren(); auto cache = grabForPanelAnimation(); _a_opacity = base::take(opacityAnimation); _showAnimation = std::make_unique<PanelAnimation>(_st.animation, _origin); _showAnimation->setFinalImage(std::move(cache), QRect(_inner.topLeft() * cIntRetinaFactor(), _inner.size() * cIntRetinaFactor())); if (_useTransparency) { auto corners = App::cornersMask(ImageRoundRadius::Small); _showAnimation->setCornerMasks(QImage(*corners[0]), QImage(*corners[1]), QImage(*corners[2]), QImage(*corners[3])); } else { _showAnimation->setSkipShadow(true); } _showAnimation->start(); } hideChildren(); _a_show.start([this] { showAnimationCallback(); }, 0., 1., _st.showDuration); }
void BookmarkFolder::buttonClicked(Button* btnThatClicked) { if (btnThatClicked == triBtn) { bExpanded = triBtn->getArrowDirection() == 0.0f; } bExpanded ? showChildren() : hideChildren(); setNewSize(); }
void InnerDropdown::startAnimation() { auto from = _hiding ? 1. : 0.; auto to = _hiding ? 0. : 1.; if (!_a_appearance.animating()) { showChildren(); _cache = myGrab(this); } hideChildren(); _a_appearance.start([this] { repaintCallback(); }, from, to, _st.duration); }
void InnerDropdown::prepareCache() { if (_a_opacity.animating()) return; auto showAnimation = base::take(_a_show); auto showAnimationData = base::take(_showAnimation); showChildren(); _cache = GrabWidget(this); _showAnimation = base::take(showAnimationData); _a_show = base::take(showAnimation); if (_a_show.animating()) { hideChildren(); } }
void InnerDropdown::startOpacityAnimation(bool hiding) { if (hiding) { if (_hideStartCallback) { _hideStartCallback(); } } else if (_showStartCallback) { _showStartCallback(); } _hiding = false; prepareCache(); _hiding = hiding; hideChildren(); _a_opacity.start([this] { opacityAnimationCallback(); }, _hiding ? 1. : 0., _hiding ? 0. : 1., _st.duration); }
void PopupMenu::startOpacityAnimation(bool hiding) { _hiding = false; if (!_useTransparency) { _a_opacity.finish(); if (hiding) { hideFinished(); } else { update(); } return; } prepareCache(); _hiding = hiding; hideChildren(); _a_opacity.start([this] { opacityAnimationCallback(); }, _hiding ? 1. : 0., _hiding ? 0. : 1., _st.duration); }
void SectionWidget::showAnimated(SlideDirection direction, const SectionSlideParams ¶ms) { if (_showAnimation) return; showChildren(); auto myContentCache = grabForShowAnimation(params); hideChildren(); showAnimatedHook(); _showAnimation = std_::make_unique<SlideAnimation>(); _showAnimation->setDirection(direction); _showAnimation->setRepaintCallback([this] { update(); }); _showAnimation->setFinishedCallback([this] { showFinished(); }); _showAnimation->setPixmaps(params.oldContentCache, myContentCache); _showAnimation->setTopBarShadow(params.withTopBarShadow); _showAnimation->start(); show(); }
void WarningWidget::startAnimation(bool hiding) { _timer.cancel(); _hiding = hiding; if (_cache.isNull()) { showChildren(); Ui::SendPendingMoveResizeEvents(this); _cache = Ui::GrabWidget(this, _outer); } hideChildren(); _animation.start([this] { update(); if (_hiding) { hide(); if (_hiddenCallback) { _hiddenCallback(); } } }, _hiding ? 1. : 0., _hiding ? 0. : 1., st::boxDuration); }
void WarningWidget::startAnimation(bool hiding) { _timer.stop(); _hiding = hiding; if (_cache.isNull()) { showChildren(); myEnsureResized(this); _cache = myGrab(this, _outer); } hideChildren(); _animation.start([this] { update(); if (_hiding) { hide(); if (_hiddenCallback) { _hiddenCallback(); } } }, _hiding ? 1. : 0., _hiding ? 0. : 1., st::boxDuration); }
void InnerDropdown::startShowAnimation() { if (_showStartCallback) { _showStartCallback(); } if (!_a_show.animating()) { auto opacityAnimation = base::take(_a_opacity); showChildren(); auto cache = grabForPanelAnimation(); _a_opacity = base::take(opacityAnimation); _showAnimation = std::make_unique<PanelAnimation>(_st.animation, _origin); auto inner = rect().marginsRemoved(_st.padding); _showAnimation->setFinalImage(std::move(cache), QRect(inner.topLeft() * cIntRetinaFactor(), inner.size() * cIntRetinaFactor())); auto corners = App::cornersMask(ImageRoundRadius::Small); _showAnimation->setCornerMasks(corners[0], corners[1], corners[2], corners[3]); _showAnimation->start(); } hideChildren(); _a_show.start([this] { showAnimationCallback(); }, 0., 1., _st.showDuration); }
void AddContactBox::onImportDone(const MTPcontacts_ImportedContacts &res) { if (!isBoxShown() || !App::main()) return; auto &d = res.c_contacts_importedContacts(); App::feedUsers(d.vusers); auto &v = d.vimported.c_vector().v; UserData *user = nullptr; if (!v.isEmpty()) { const auto &c(v.front().c_importedContact()); if (c.vclient_id.v != _contactId) return; user = App::userLoaded(c.vuser_id.v); } if (user) { Notify::userIsContactChanged(user, true); Ui::hideLayer(); } else { hideChildren(); _retrying = true; updateButtons(); update(); } }