mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Use crl::time/now instead of TimeMs/getms.
This commit is contained in:
@@ -110,7 +110,7 @@ void BotKeyboard::paintEvent(QPaintEvent *e) {
|
||||
if (_impl) {
|
||||
int x = rtl() ? st::botKbScroll.width : _st->margin;
|
||||
p.translate(x, st::botKbScroll.deltat);
|
||||
_impl->paint(p, width(), clip.translated(-x, -st::botKbScroll.deltat), getms());
|
||||
_impl->paint(p, width(), clip.translated(-x, -st::botKbScroll.deltat), crl::now());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,7 @@ public:
|
||||
bool hasMarkup() const;
|
||||
bool forceReply() const;
|
||||
|
||||
void step_selected(TimeMs ms, bool timer);
|
||||
void step_selected(crl::time ms, bool timer);
|
||||
void resizeToWidth(int newWidth, int maxOuterHeight) {
|
||||
_maxOuterHeight = maxOuterHeight;
|
||||
return TWidget::resizeToWidth(newWidth);
|
||||
|
@@ -186,7 +186,7 @@ void EmojiColorPicker::updateSize() {
|
||||
void EmojiColorPicker::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
auto opacity = _a_opacity.current(getms(), _hiding ? 0. : 1.);
|
||||
auto opacity = _a_opacity.current(crl::now(), _hiding ? 0. : 1.);
|
||||
if (opacity < 1.) {
|
||||
if (opacity > 0.) {
|
||||
p.setOpacity(opacity);
|
||||
|
@@ -119,12 +119,12 @@ private:
|
||||
void setupPreview(const Set &set);
|
||||
void setupAnimation();
|
||||
void paintPreview(Painter &p) const;
|
||||
void paintRadio(Painter &p, TimeMs ms);
|
||||
void updateAnimation(TimeMs ms);
|
||||
void paintRadio(Painter &p, crl::time ms);
|
||||
void updateAnimation(crl::time ms);
|
||||
void setupHandler();
|
||||
void load();
|
||||
|
||||
void step_radial(TimeMs ms, bool timer);
|
||||
void step_radial(crl::time ms, bool timer);
|
||||
|
||||
int _id = 0;
|
||||
bool _switching = false;
|
||||
@@ -355,7 +355,7 @@ void Row::paintEvent(QPaintEvent *e) {
|
||||
const auto bg = over ? st::windowBgOver : st::windowBg;
|
||||
p.fillRect(rect(), bg);
|
||||
|
||||
const auto ms = getms();
|
||||
const auto ms = crl::now();
|
||||
paintRipple(p, 0, 0, ms);
|
||||
|
||||
paintPreview(p);
|
||||
@@ -377,7 +377,7 @@ void Row::paintPreview(Painter &p) const {
|
||||
}
|
||||
}
|
||||
|
||||
void Row::paintRadio(Painter &p, TimeMs ms) {
|
||||
void Row::paintRadio(Painter &p, crl::time ms) {
|
||||
updateAnimation(ms);
|
||||
|
||||
const auto loading = _loading
|
||||
@@ -582,7 +582,7 @@ void Row::setupPreview(const Set &set) {
|
||||
}
|
||||
}
|
||||
|
||||
void Row::step_radial(TimeMs ms, bool timer) {
|
||||
void Row::step_radial(crl::time ms, bool timer) {
|
||||
if (timer && !anim::Disabled()) {
|
||||
update();
|
||||
}
|
||||
@@ -625,7 +625,7 @@ void Row::setupAnimation() {
|
||||
updateStatusColorOverride();
|
||||
}
|
||||
|
||||
void Row::updateAnimation(TimeMs ms) {
|
||||
void Row::updateAnimation(crl::time ms) {
|
||||
const auto state = _state.current();
|
||||
if (const auto loading = base::get_if<Loading>(&state)) {
|
||||
const auto progress = (loading->size > 0)
|
||||
@@ -636,10 +636,10 @@ void Row::updateAnimation(TimeMs ms) {
|
||||
animation(this, &Row::step_radial));
|
||||
_loading->start(progress);
|
||||
} else {
|
||||
_loading->update(progress, false, getms());
|
||||
_loading->update(progress, false, crl::now());
|
||||
}
|
||||
} else if (_loading) {
|
||||
_loading->update(state.is<Failed>() ? 0. : 1., true, getms());
|
||||
_loading->update(state.is<Failed>() ? 0. : 1., true, crl::now());
|
||||
} else {
|
||||
_loading = nullptr;
|
||||
}
|
||||
|
@@ -179,7 +179,7 @@ int SuggestionsWidget::countWidth(const Row &row) {
|
||||
void SuggestionsWidget::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
auto clip = e->rect();
|
||||
|
||||
auto topskip = QRect(0, 0, width(), _st->skip);
|
||||
|
@@ -47,7 +47,7 @@ FieldAutocomplete::FieldAutocomplete(QWidget *parent) : TWidget(parent)
|
||||
void FieldAutocomplete::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
auto opacity = _a_opacity.current(getms(), _hiding ? 0. : 1.);
|
||||
auto opacity = _a_opacity.current(crl::now(), _hiding ? 0. : 1.);
|
||||
if (opacity < 1.) {
|
||||
if (opacity > 0.) {
|
||||
p.setOpacity(opacity);
|
||||
|
@@ -176,7 +176,7 @@ void GifsListWidget::visibleTopBottomUpdated(
|
||||
auto top = getVisibleTop();
|
||||
Inner::visibleTopBottomUpdated(visibleTop, visibleBottom);
|
||||
if (top != getVisibleTop()) {
|
||||
_lastScrolled = getms();
|
||||
_lastScrolled = crl::now();
|
||||
}
|
||||
checkLoadMore();
|
||||
}
|
||||
@@ -274,7 +274,7 @@ void GifsListWidget::paintInlineItems(Painter &p, QRect clip) {
|
||||
return;
|
||||
}
|
||||
auto gifPaused = controller()->isGifPausedAtLeastFor(Window::GifPauseReason::SavedGifs);
|
||||
InlineBots::Layout::PaintContext context(getms(), false, gifPaused, false);
|
||||
InlineBots::Layout::PaintContext context(crl::now(), false, gifPaused, false);
|
||||
|
||||
auto top = st::stickerPanPadding;
|
||||
auto fromx = rtl() ? (width() - clip.x() - clip.width()) : clip.x();
|
||||
@@ -751,7 +751,7 @@ void GifsListWidget::inlineItemLayoutChanged(const InlineBots::Layout::ItemBase
|
||||
}
|
||||
|
||||
void GifsListWidget::inlineItemRepaint(const InlineBots::Layout::ItemBase *layout) {
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
if (_lastScrolled + 100 <= ms) {
|
||||
update();
|
||||
} else {
|
||||
@@ -1018,7 +1018,7 @@ void GifsListWidget::showPreview() {
|
||||
}
|
||||
|
||||
void GifsListWidget::updateInlineItems() {
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
if (_lastScrolled + 100 <= ms) {
|
||||
update();
|
||||
} else {
|
||||
|
@@ -117,7 +117,7 @@ private:
|
||||
void showPreview();
|
||||
|
||||
Section _section = Section::Gifs;
|
||||
TimeMs _lastScrolled = 0;
|
||||
crl::time _lastScrolled = 0;
|
||||
base::Timer _updateInlineItems;
|
||||
bool _inlineWithThumb = false;
|
||||
|
||||
|
@@ -27,7 +27,7 @@ namespace {
|
||||
using EditLinkAction = Ui::InputField::EditLinkAction;
|
||||
using EditLinkSelection = Ui::InputField::EditLinkSelection;
|
||||
|
||||
constexpr auto kParseLinksTimeout = TimeMs(1000);
|
||||
constexpr auto kParseLinksTimeout = crl::time(1000);
|
||||
const auto kMentionTagStart = qstr("mention://user.");
|
||||
|
||||
bool IsMentionLink(const QString &link) {
|
||||
|
@@ -98,7 +98,7 @@ private:
|
||||
template <typename Callback>
|
||||
void enumerateVisibleIcons(Callback callback);
|
||||
|
||||
void step_icons(TimeMs ms, bool timer);
|
||||
void step_icons(crl::time ms, bool timer);
|
||||
void setSelectedIcon(
|
||||
int newSelected,
|
||||
ValidateIconAnimations animations);
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
int _iconsMax = 0;
|
||||
anim::value _iconsX;
|
||||
anim::value _iconSelX;
|
||||
TimeMs _iconsStartAnim = 0;
|
||||
crl::time _iconsStartAnim = 0;
|
||||
|
||||
bool _horizontal = false;
|
||||
|
||||
@@ -312,7 +312,7 @@ void StickersListWidget::Footer::setSelectedIcon(
|
||||
_a_icons.stop();
|
||||
} else {
|
||||
_iconsX.start(iconsXFinal);
|
||||
_iconsStartAnim = getms();
|
||||
_iconsStartAnim = crl::now();
|
||||
_a_icons.start();
|
||||
}
|
||||
updateSelected();
|
||||
@@ -656,7 +656,7 @@ void StickersListWidget::Footer::paintSetIcon(
|
||||
}
|
||||
}
|
||||
|
||||
void StickersListWidget::Footer::step_icons(TimeMs ms, bool timer) {
|
||||
void StickersListWidget::Footer::step_icons(crl::time ms, bool timer) {
|
||||
if (anim::Disabled()) {
|
||||
ms += st::stickerIconMove;
|
||||
}
|
||||
@@ -1151,7 +1151,7 @@ void StickersListWidget::paintStickers(Painter &p, QRect clip) {
|
||||
toColumn = _columnCount - toColumn;
|
||||
}
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
auto &sets = shownSets();
|
||||
auto selectedSticker = base::get_if<OverSticker>(&_selected);
|
||||
auto selectedButton = base::get_if<OverButton>(_pressed ? &_pressed : &_selected);
|
||||
@@ -1309,7 +1309,7 @@ int StickersListWidget::megagroupSetInfoLeft() const {
|
||||
return st::emojiPanHeaderLeft - st::buttonRadius;
|
||||
}
|
||||
|
||||
void StickersListWidget::paintMegagroupEmptySet(Painter &p, int y, bool buttonSelected, TimeMs ms) {
|
||||
void StickersListWidget::paintMegagroupEmptySet(Painter &p, int y, bool buttonSelected, crl::time ms) {
|
||||
auto infoLeft = megagroupSetInfoLeft();
|
||||
_megagroupSetAbout.drawLeft(p, infoLeft, y, width() - infoLeft, width());
|
||||
|
||||
|
@@ -199,7 +199,7 @@ private:
|
||||
|
||||
void paintFeaturedStickers(Painter &p, QRect clip);
|
||||
void paintStickers(Painter &p, QRect clip);
|
||||
void paintMegagroupEmptySet(Painter &p, int y, bool buttonSelected, TimeMs ms);
|
||||
void paintMegagroupEmptySet(Painter &p, int y, bool buttonSelected, crl::time ms);
|
||||
void paintSticker(Painter &p, Set &set, int y, int index, bool selected, bool deleteSelected);
|
||||
void paintEmptySearchResults(Painter &p);
|
||||
|
||||
|
@@ -155,7 +155,7 @@ void TabbedPanel::windowActiveChanged() {
|
||||
void TabbedPanel::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
|
||||
// This call can finish _a_show animation and destroy _showAnimation.
|
||||
auto opacityAnimating = _a_opacity.animating(ms);
|
||||
@@ -208,7 +208,7 @@ void TabbedPanel::leaveEventHook(QEvent *e) {
|
||||
if (preventAutoHide()) {
|
||||
return;
|
||||
}
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
if (_a_show.animating(ms) || _a_opacity.animating(ms)) {
|
||||
hideAnimated();
|
||||
} else {
|
||||
@@ -226,7 +226,7 @@ void TabbedPanel::otherLeave() {
|
||||
return;
|
||||
}
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
if (_a_opacity.animating(ms)) {
|
||||
hideByTimerOrLeave();
|
||||
} else {
|
||||
|
@@ -494,7 +494,7 @@ void TabbedSelector::updateRestrictedLabelGeometry() {
|
||||
void TabbedSelector::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
|
||||
auto switching = (_slideAnimation != nullptr);
|
||||
if (switching) {
|
||||
@@ -509,7 +509,7 @@ void TabbedSelector::paintEvent(QPaintEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
void TabbedSelector::paintSlideFrame(Painter &p, TimeMs ms) {
|
||||
void TabbedSelector::paintSlideFrame(Painter &p, crl::time ms) {
|
||||
if (_roundRadius > 0) {
|
||||
if (full()) {
|
||||
auto topPart = QRect(0, 0, width(), _tabsSlider->height() + _roundRadius);
|
||||
|
@@ -149,7 +149,7 @@ private:
|
||||
SelectorTab type,
|
||||
not_null<Window::Controller*> controller);
|
||||
|
||||
void paintSlideFrame(Painter &p, TimeMs ms);
|
||||
void paintSlideFrame(Painter &p, crl::time ms);
|
||||
void paintContent(Painter &p);
|
||||
|
||||
void checkRestrictedPeer();
|
||||
|
Reference in New Issue
Block a user