mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Use crl::time/now instead of TimeMs/getms.
This commit is contained in:
parent
d208236994
commit
fe618bd652
310 changed files with 1133 additions and 1141 deletions
|
@ -81,11 +81,11 @@ constexpr auto kUnreadMentionsFirstRequestLimit = 10;
|
|||
constexpr auto kUnreadMentionsNextRequestLimit = 100;
|
||||
constexpr auto kSharedMediaLimit = 100;
|
||||
constexpr auto kFeedMessagesLimit = 50;
|
||||
constexpr auto kReadFeaturedSetsTimeout = TimeMs(1000);
|
||||
constexpr auto kFileLoaderQueueStopTimeout = TimeMs(5000);
|
||||
constexpr auto kFeedReadTimeout = TimeMs(1000);
|
||||
constexpr auto kStickersByEmojiInvalidateTimeout = TimeMs(60 * 60 * 1000);
|
||||
constexpr auto kNotifySettingSaveTimeout = TimeMs(1000);
|
||||
constexpr auto kReadFeaturedSetsTimeout = crl::time(1000);
|
||||
constexpr auto kFileLoaderQueueStopTimeout = crl::time(5000);
|
||||
constexpr auto kFeedReadTimeout = crl::time(1000);
|
||||
constexpr auto kStickersByEmojiInvalidateTimeout = crl::time(60 * 60 * 1000);
|
||||
constexpr auto kNotifySettingSaveTimeout = crl::time(1000);
|
||||
|
||||
using SimpleFileLocationId = Data::SimpleFileLocationId;
|
||||
using DocumentFileLocationId = Data::DocumentFileLocationId;
|
||||
|
@ -253,7 +253,7 @@ void ApiWrap::refreshProxyPromotion() {
|
|||
void ApiWrap::getProxyPromotionDelayed(TimeId now, TimeId next) {
|
||||
_proxyPromotionTimer.callOnce(std::min(
|
||||
std::max(next - now, kProxyPromotionMinDelay),
|
||||
kProxyPromotionInterval) * TimeMs(1000));
|
||||
kProxyPromotionInterval) * crl::time(1000));
|
||||
};
|
||||
|
||||
void ApiWrap::proxyPromotionDone(const MTPhelp_ProxyData &proxy) {
|
||||
|
@ -296,7 +296,7 @@ void ApiWrap::requestTermsUpdate() {
|
|||
if (_termsUpdateRequestId) {
|
||||
return;
|
||||
}
|
||||
const auto now = getms(true);
|
||||
const auto now = crl::now();
|
||||
if (_termsUpdateSendAt && now < _termsUpdateSendAt) {
|
||||
App::CallDelayed(_termsUpdateSendAt - now, _session, [=] {
|
||||
requestTermsUpdate();
|
||||
|
@ -304,8 +304,8 @@ void ApiWrap::requestTermsUpdate() {
|
|||
return;
|
||||
}
|
||||
|
||||
constexpr auto kTermsUpdateTimeoutMin = 10 * TimeMs(1000);
|
||||
constexpr auto kTermsUpdateTimeoutMax = 86400 * TimeMs(1000);
|
||||
constexpr auto kTermsUpdateTimeoutMin = 10 * crl::time(1000);
|
||||
constexpr auto kTermsUpdateTimeoutMax = 86400 * crl::time(1000);
|
||||
|
||||
_termsUpdateRequestId = request(MTPhelp_GetTermsOfServiceUpdate(
|
||||
)).done([=](const MTPhelp_TermsOfServiceUpdate &result) {
|
||||
|
@ -313,8 +313,8 @@ void ApiWrap::requestTermsUpdate() {
|
|||
|
||||
const auto requestNext = [&](auto &&data) {
|
||||
const auto timeout = (data.vexpires.v - unixtime());
|
||||
_termsUpdateSendAt = getms(true) + snap(
|
||||
timeout * TimeMs(1000),
|
||||
_termsUpdateSendAt = crl::now() + snap(
|
||||
timeout * crl::time(1000),
|
||||
kTermsUpdateTimeoutMin,
|
||||
kTermsUpdateTimeoutMax);
|
||||
requestTermsUpdate();
|
||||
|
@ -336,7 +336,7 @@ void ApiWrap::requestTermsUpdate() {
|
|||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
_termsUpdateRequestId = 0;
|
||||
_termsUpdateSendAt = getms(true) + kTermsUpdateTimeoutMin;
|
||||
_termsUpdateSendAt = crl::now() + kTermsUpdateTimeoutMin;
|
||||
requestTermsUpdate();
|
||||
}).send();
|
||||
}
|
||||
|
@ -1091,7 +1091,7 @@ void ApiWrap::gotUserFull(
|
|||
const auto &d = result.c_userFull();
|
||||
|
||||
if (user == _session->user() && !_session->validateSelf(d.vuser)) {
|
||||
constexpr auto kRequestUserAgainTimeout = TimeMs(10000);
|
||||
constexpr auto kRequestUserAgainTimeout = crl::time(10000);
|
||||
App::CallDelayed(kRequestUserAgainTimeout, _session, [=] {
|
||||
requestFullPeer(user);
|
||||
});
|
||||
|
@ -2963,7 +2963,7 @@ void ApiWrap::stickersSaveOrder() {
|
|||
}
|
||||
|
||||
void ApiWrap::updateStickers() {
|
||||
auto now = getms(true);
|
||||
auto now = crl::now();
|
||||
requestStickers(now);
|
||||
requestRecentStickers(now);
|
||||
requestFavedStickers(now);
|
||||
|
@ -2991,7 +2991,7 @@ std::vector<not_null<DocumentData*>> *ApiWrap::stickersByEmoji(
|
|||
return true;
|
||||
}
|
||||
const auto received = it->second.received;
|
||||
const auto now = getms(true);
|
||||
const auto now = crl::now();
|
||||
return (received > 0)
|
||||
&& (received + kStickersByEmojiInvalidateTimeout) <= now;
|
||||
}();
|
||||
|
@ -3019,7 +3019,7 @@ std::vector<not_null<DocumentData*>> *ApiWrap::stickersByEmoji(
|
|||
}
|
||||
}
|
||||
entry.hash = data.vhash.v;
|
||||
entry.received = getms(true);
|
||||
entry.received = crl::now();
|
||||
_session->data().notifyStickersUpdated();
|
||||
}).send();
|
||||
}
|
||||
|
@ -3111,7 +3111,7 @@ void ApiWrap::requestStickers(TimeId now) {
|
|||
return;
|
||||
}
|
||||
auto onDone = [this](const MTPmessages_AllStickers &result) {
|
||||
_session->data().setLastStickersUpdate(getms(true));
|
||||
_session->data().setLastStickersUpdate(crl::now());
|
||||
_stickersUpdateRequest = 0;
|
||||
|
||||
switch (result.type()) {
|
||||
|
@ -3146,7 +3146,7 @@ void ApiWrap::requestRecentStickersWithHash(int32 hash) {
|
|||
MTP_flags(0),
|
||||
MTP_int(hash)
|
||||
)).done([=](const MTPmessages_RecentStickers &result) {
|
||||
_session->data().setLastRecentStickersUpdate(getms(true));
|
||||
_session->data().setLastRecentStickersUpdate(crl::now());
|
||||
_recentStickersUpdateRequest = 0;
|
||||
|
||||
switch (result.type()) {
|
||||
|
@ -3164,7 +3164,7 @@ void ApiWrap::requestRecentStickersWithHash(int32 hash) {
|
|||
default: Unexpected("Type in ApiWrap::recentStickersDone()");
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
_session->data().setLastRecentStickersUpdate(getms(true));
|
||||
_session->data().setLastRecentStickersUpdate(crl::now());
|
||||
_recentStickersUpdateRequest = 0;
|
||||
|
||||
LOG(("App Fail: Failed to get recent stickers!"));
|
||||
|
@ -3179,7 +3179,7 @@ void ApiWrap::requestFavedStickers(TimeId now) {
|
|||
_favedStickersUpdateRequest = request(MTPmessages_GetFavedStickers(
|
||||
MTP_int(Local::countFavedStickersHash())
|
||||
)).done([=](const MTPmessages_FavedStickers &result) {
|
||||
_session->data().setLastFavedStickersUpdate(getms(true));
|
||||
_session->data().setLastFavedStickersUpdate(crl::now());
|
||||
_favedStickersUpdateRequest = 0;
|
||||
|
||||
switch (result.type()) {
|
||||
|
@ -3196,7 +3196,7 @@ void ApiWrap::requestFavedStickers(TimeId now) {
|
|||
default: Unexpected("Type in ApiWrap::favedStickersDone()");
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
_session->data().setLastFavedStickersUpdate(getms(true));
|
||||
_session->data().setLastFavedStickersUpdate(crl::now());
|
||||
_favedStickersUpdateRequest = 0;
|
||||
|
||||
LOG(("App Fail: Failed to get faved stickers!"));
|
||||
|
@ -3211,7 +3211,7 @@ void ApiWrap::requestFeaturedStickers(TimeId now) {
|
|||
_featuredStickersUpdateRequest = request(MTPmessages_GetFeaturedStickers(
|
||||
MTP_int(Local::countFeaturedStickersHash())
|
||||
)).done([=](const MTPmessages_FeaturedStickers &result) {
|
||||
_session->data().setLastFeaturedStickersUpdate(getms(true));
|
||||
_session->data().setLastFeaturedStickersUpdate(crl::now());
|
||||
_featuredStickersUpdateRequest = 0;
|
||||
|
||||
switch (result.type()) {
|
||||
|
@ -3223,7 +3223,7 @@ void ApiWrap::requestFeaturedStickers(TimeId now) {
|
|||
default: Unexpected("Type in ApiWrap::featuredStickersDone()");
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
_session->data().setLastFeaturedStickersUpdate(getms(true));
|
||||
_session->data().setLastFeaturedStickersUpdate(crl::now());
|
||||
_featuredStickersUpdateRequest = 0;
|
||||
|
||||
LOG(("App Fail: Failed to get featured stickers!"));
|
||||
|
@ -3238,7 +3238,7 @@ void ApiWrap::requestSavedGifs(TimeId now) {
|
|||
_savedGifsUpdateRequest = request(MTPmessages_GetSavedGifs(
|
||||
MTP_int(Local::countSavedGifsHash())
|
||||
)).done([=](const MTPmessages_SavedGifs &result) {
|
||||
_session->data().setLastSavedGifsUpdate(getms(true));
|
||||
_session->data().setLastSavedGifsUpdate(crl::now());
|
||||
_savedGifsUpdateRequest = 0;
|
||||
|
||||
switch (result.type()) {
|
||||
|
@ -3250,7 +3250,7 @@ void ApiWrap::requestSavedGifs(TimeId now) {
|
|||
default: Unexpected("Type in ApiWrap::savedGifsDone()");
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
_session->data().setLastSavedGifsUpdate(getms(true));
|
||||
_session->data().setLastSavedGifsUpdate(crl::now());
|
||||
_savedGifsUpdateRequest = 0;
|
||||
|
||||
LOG(("App Fail: Failed to get saved gifs!"));
|
||||
|
@ -3722,7 +3722,7 @@ void ApiWrap::addChatParticipants(
|
|||
applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
ShowAddParticipantsError(error.type(), peer, { 1, user });
|
||||
}).afterDelay(TimeMs(5)).send();
|
||||
}).afterDelay(crl::time(5)).send();
|
||||
}
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
const auto bot = ranges::find_if(users, [](not_null<UserData*> user) {
|
||||
|
@ -3743,7 +3743,7 @@ void ApiWrap::addChatParticipants(
|
|||
requestParticipantsCountDelayed(channel);
|
||||
}).fail([=](const RPCError &error) {
|
||||
ShowAddParticipantsError(error.type(), peer, users);
|
||||
}).afterDelay(TimeMs(5)).send();
|
||||
}).afterDelay(crl::time(5)).send();
|
||||
};
|
||||
for (const auto user : users) {
|
||||
list.push_back(user->inputUser);
|
||||
|
@ -5612,13 +5612,13 @@ void ApiWrap::readFeed(
|
|||
if (_feedReadsDelayed.empty()) {
|
||||
_feedReadTimer.callOnce(kFeedReadTimeout);
|
||||
}
|
||||
_feedReadsDelayed.emplace(feed, getms(true) + kFeedReadTimeout);
|
||||
_feedReadsDelayed.emplace(feed, crl::now() + kFeedReadTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::readFeeds() {
|
||||
auto delay = kFeedReadTimeout;
|
||||
const auto now = getms(true);
|
||||
const auto now = crl::now();
|
||||
//for (auto i = begin(_feedReadsDelayed); i != end(_feedReadsDelayed);) { // #feed
|
||||
// const auto feed = i->first;
|
||||
// const auto time = i->second;
|
||||
|
|
|
@ -422,7 +422,7 @@ private:
|
|||
struct StickersByEmoji {
|
||||
std::vector<not_null<DocumentData*>> list;
|
||||
int32 hash = 0;
|
||||
TimeMs received = 0;
|
||||
crl::time received = 0;
|
||||
};
|
||||
|
||||
void updatesReceived(const MTPUpdates &updates);
|
||||
|
@ -728,7 +728,7 @@ private:
|
|||
|
||||
rpl::event_stream<uint64> _stickerSetInstalled;
|
||||
|
||||
base::flat_map<not_null<Data::Feed*>, TimeMs> _feedReadsDelayed;
|
||||
base::flat_map<not_null<Data::Feed*>, crl::time> _feedReadsDelayed;
|
||||
base::flat_map<not_null<Data::Feed*>, mtpRequestId> _feedReadRequests;
|
||||
base::Timer _feedReadTimer;
|
||||
|
||||
|
@ -746,7 +746,7 @@ private:
|
|||
|
||||
mtpRequestId _deepLinkInfoRequestId = 0;
|
||||
|
||||
TimeMs _termsUpdateSendAt = 0;
|
||||
crl::time _termsUpdateSendAt = 0;
|
||||
mtpRequestId _termsUpdateRequestId = 0;
|
||||
|
||||
mtpRequestId _checkInviteRequestId = 0;
|
||||
|
|
|
@ -32,7 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr auto kAutoLockTimeoutLateMs = TimeMs(3000);
|
||||
constexpr auto kAutoLockTimeoutLateMs = crl::time(3000);
|
||||
constexpr auto kLegacyCallsPeerToPeerNobody = 4;
|
||||
|
||||
} // namespace
|
||||
|
@ -470,7 +470,7 @@ void AuthSession::moveSettingsFrom(AuthSessionSettings &&other) {
|
|||
}
|
||||
}
|
||||
|
||||
void AuthSession::saveSettingsDelayed(TimeMs delay) {
|
||||
void AuthSession::saveSettingsDelayed(crl::time delay) {
|
||||
Expects(this == &Auth());
|
||||
|
||||
_saveDataTimer.callOnce(delay);
|
||||
|
@ -483,7 +483,7 @@ void AuthSession::checkAutoLock() {
|
|||
}
|
||||
|
||||
Core::App().checkLocalTime();
|
||||
auto now = getms(true);
|
||||
auto now = crl::now();
|
||||
auto shouldLockInMs = Global::AutoLock() * 1000LL;
|
||||
auto idleForMs = psIdleTime();
|
||||
auto notPlayingVideoForMs = now - settings().lastTimeVideoPlayedAt();
|
||||
|
@ -496,7 +496,7 @@ void AuthSession::checkAutoLock() {
|
|||
}
|
||||
}
|
||||
|
||||
void AuthSession::checkAutoLockIn(TimeMs time) {
|
||||
void AuthSession::checkAutoLockIn(crl::time time) {
|
||||
if (_autoLockTimer.isActive()) {
|
||||
auto remain = _autoLockTimer.remainingTime();
|
||||
if (remain > 0 && remain <= time) return;
|
||||
|
|
|
@ -139,10 +139,10 @@ public:
|
|||
bool smallDialogsList() const {
|
||||
return _variables.smallDialogsList;
|
||||
}
|
||||
void setLastTimeVideoPlayedAt(TimeMs time) {
|
||||
void setLastTimeVideoPlayedAt(crl::time time) {
|
||||
_lastTimeVideoPlayedAt = time;
|
||||
}
|
||||
TimeMs lastTimeVideoPlayedAt() const {
|
||||
crl::time lastTimeVideoPlayedAt() const {
|
||||
return _lastTimeVideoPlayedAt;
|
||||
}
|
||||
void setSoundOverride(const QString &key, const QString &path) {
|
||||
|
@ -263,7 +263,7 @@ private:
|
|||
rpl::event_stream<bool> _tabbedReplacedWithInfoValue;
|
||||
|
||||
Variables _variables;
|
||||
TimeMs _lastTimeVideoPlayedAt = 0;
|
||||
crl::time _lastTimeVideoPlayedAt = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -311,7 +311,7 @@ public:
|
|||
return _settings;
|
||||
}
|
||||
void moveSettingsFrom(AuthSessionSettings &&other);
|
||||
void saveSettingsDelayed(TimeMs delay = kDefaultSaveDelay);
|
||||
void saveSettingsDelayed(crl::time delay = kDefaultSaveDelay);
|
||||
|
||||
ApiWrap &api() {
|
||||
return *_api;
|
||||
|
@ -322,7 +322,7 @@ public:
|
|||
}
|
||||
|
||||
void checkAutoLock();
|
||||
void checkAutoLockIn(TimeMs time);
|
||||
void checkAutoLockIn(crl::time time);
|
||||
|
||||
rpl::lifetime &lifetime() {
|
||||
return _lifetime;
|
||||
|
@ -338,12 +338,12 @@ public:
|
|||
~AuthSession();
|
||||
|
||||
private:
|
||||
static constexpr auto kDefaultSaveDelay = TimeMs(1000);
|
||||
static constexpr auto kDefaultSaveDelay = crl::time(1000);
|
||||
|
||||
AuthSessionSettings _settings;
|
||||
base::Timer _saveDataTimer;
|
||||
|
||||
TimeMs _shouldLockAt = 0;
|
||||
crl::time _shouldLockAt = 0;
|
||||
base::Timer _autoLockTimer;
|
||||
|
||||
const std::unique_ptr<ApiWrap> _api;
|
||||
|
|
|
@ -46,7 +46,6 @@ using uint64 = quint64;
|
|||
using float32 = float;
|
||||
using float64 = double;
|
||||
|
||||
using TimeMs = int64;
|
||||
using TimeId = int32;
|
||||
|
||||
// Define specializations for QByteArray for Qt 5.3.2, because
|
||||
|
|
|
@ -26,16 +26,16 @@ QMutex EnvironmentMutex;
|
|||
class CallDelayedEvent : public QEvent {
|
||||
public:
|
||||
CallDelayedEvent(
|
||||
crl::time_type timeout,
|
||||
crl::time timeout,
|
||||
Qt::TimerType type,
|
||||
FnMut<void()> method);
|
||||
|
||||
crl::time_type timeout() const;
|
||||
crl::time timeout() const;
|
||||
Qt::TimerType type() const;
|
||||
FnMut<void()> takeMethod();
|
||||
|
||||
private:
|
||||
crl::time_type _timeout = 0;
|
||||
crl::time _timeout = 0;
|
||||
Qt::TimerType _type = Qt::PreciseTimer;
|
||||
FnMut<void()> _method;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public:
|
|||
};
|
||||
|
||||
CallDelayedEvent::CallDelayedEvent(
|
||||
crl::time_type timeout,
|
||||
crl::time timeout,
|
||||
Qt::TimerType type,
|
||||
FnMut<void()> method)
|
||||
: QEvent(kCallDelayedEvent)
|
||||
|
@ -58,7 +58,7 @@ CallDelayedEvent::CallDelayedEvent(
|
|||
Expects(_timeout >= 0 && _timeout < std::numeric_limits<int>::max());
|
||||
}
|
||||
|
||||
crl::time_type CallDelayedEvent::timeout() const {
|
||||
crl::time CallDelayedEvent::timeout() const {
|
||||
return _timeout;
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ TimerObjectWrap::~TimerObjectWrap() {
|
|||
}
|
||||
|
||||
void TimerObjectWrap::call(
|
||||
crl::time_type timeout,
|
||||
crl::time timeout,
|
||||
Qt::TimerType type,
|
||||
FnMut<void()> method) {
|
||||
sendEvent(std::make_unique<CallDelayedEvent>(
|
||||
|
@ -281,7 +281,7 @@ Fn<void()> ConcurrentTimer::createAdjuster() {
|
|||
}
|
||||
|
||||
void ConcurrentTimer::start(
|
||||
TimeMs timeout,
|
||||
crl::time timeout,
|
||||
Qt::TimerType type,
|
||||
Repeat repeat) {
|
||||
_type = type;
|
||||
|
@ -290,7 +290,7 @@ void ConcurrentTimer::start(
|
|||
setTimeout(timeout);
|
||||
|
||||
cancelAndSchedule(_timeout);
|
||||
_next = crl::time() + _timeout;
|
||||
_next = crl::now() + _timeout;
|
||||
}
|
||||
|
||||
void ConcurrentTimer::cancelAndSchedule(int timeout) {
|
||||
|
@ -319,7 +319,7 @@ void ConcurrentTimer::timerEvent() {
|
|||
if (_adjusted) {
|
||||
start(_timeout, _type, repeat());
|
||||
} else {
|
||||
_next = crl::time() + _timeout;
|
||||
_next = crl::now() + _timeout;
|
||||
}
|
||||
} else {
|
||||
cancel();
|
||||
|
@ -338,12 +338,12 @@ void ConcurrentTimer::cancel() {
|
|||
}
|
||||
}
|
||||
|
||||
TimeMs ConcurrentTimer::remainingTime() const {
|
||||
crl::time ConcurrentTimer::remainingTime() const {
|
||||
if (!isActive()) {
|
||||
return -1;
|
||||
}
|
||||
const auto now = crl::time();
|
||||
return (_next > now) ? (_next - now) : TimeMs(0);
|
||||
const auto now = crl::now();
|
||||
return (_next > now) ? (_next - now) : crl::time(0);
|
||||
}
|
||||
|
||||
void ConcurrentTimer::adjust() {
|
||||
|
@ -354,7 +354,7 @@ void ConcurrentTimer::adjust() {
|
|||
}
|
||||
}
|
||||
|
||||
void ConcurrentTimer::setTimeout(TimeMs timeout) {
|
||||
void ConcurrentTimer::setTimeout(crl::time timeout) {
|
||||
Expects(timeout >= 0 && timeout <= std::numeric_limits<int>::max());
|
||||
|
||||
_timeout = static_cast<unsigned int>(timeout);
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
~TimerObjectWrap();
|
||||
|
||||
void call(
|
||||
crl::time_type timeout,
|
||||
crl::time timeout,
|
||||
Qt::TimerType type,
|
||||
FnMut<void()> method);
|
||||
void cancel();
|
||||
|
@ -67,8 +67,8 @@ public:
|
|||
crl::weak_on_queue<Object> weak,
|
||||
Fn<void()> callback = nullptr);
|
||||
|
||||
static Qt::TimerType DefaultType(TimeMs timeout) {
|
||||
constexpr auto kThreshold = TimeMs(1000);
|
||||
static Qt::TimerType DefaultType(crl::time timeout) {
|
||||
constexpr auto kThreshold = crl::time(1000);
|
||||
return (timeout > kThreshold) ? Qt::CoarseTimer : Qt::PreciseTimer;
|
||||
}
|
||||
|
||||
|
@ -76,19 +76,19 @@ public:
|
|||
_callback = std::move(callback);
|
||||
}
|
||||
|
||||
void callOnce(TimeMs timeout) {
|
||||
void callOnce(crl::time timeout) {
|
||||
callOnce(timeout, DefaultType(timeout));
|
||||
}
|
||||
|
||||
void callEach(TimeMs timeout) {
|
||||
void callEach(crl::time timeout) {
|
||||
callEach(timeout, DefaultType(timeout));
|
||||
}
|
||||
|
||||
void callOnce(TimeMs timeout, Qt::TimerType type) {
|
||||
void callOnce(crl::time timeout, Qt::TimerType type) {
|
||||
start(timeout, type, Repeat::SingleShot);
|
||||
}
|
||||
|
||||
void callEach(TimeMs timeout, Qt::TimerType type) {
|
||||
void callEach(crl::time timeout, Qt::TimerType type) {
|
||||
start(timeout, type, Repeat::Interval);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
}
|
||||
|
||||
void cancel();
|
||||
TimeMs remainingTime() const;
|
||||
crl::time remainingTime() const;
|
||||
|
||||
private:
|
||||
enum class Repeat : unsigned {
|
||||
|
@ -105,12 +105,12 @@ private:
|
|||
SingleShot = 1,
|
||||
};
|
||||
Fn<void()> createAdjuster();
|
||||
void start(TimeMs timeout, Qt::TimerType type, Repeat repeat);
|
||||
void start(crl::time timeout, Qt::TimerType type, Repeat repeat);
|
||||
void adjust();
|
||||
|
||||
void cancelAndSchedule(int timeout);
|
||||
|
||||
void setTimeout(TimeMs timeout);
|
||||
void setTimeout(crl::time timeout);
|
||||
int timeout() const;
|
||||
|
||||
void timerEvent();
|
||||
|
@ -127,7 +127,7 @@ private:
|
|||
details::TimerObjectWrap _object;
|
||||
Fn<void()> _callback;
|
||||
base::binary_guard _running;
|
||||
TimeMs _next = 0;
|
||||
crl::time _next = 0;
|
||||
int _timeout = 0;
|
||||
|
||||
Qt::TimerType _type : 2;
|
||||
|
|
|
@ -40,7 +40,7 @@ Timer::Timer(Fn<void()> callback)
|
|||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void Timer::start(TimeMs timeout, Qt::TimerType type, Repeat repeat) {
|
||||
void Timer::start(crl::time timeout, Qt::TimerType type, Repeat repeat) {
|
||||
cancel();
|
||||
|
||||
_type = type;
|
||||
|
@ -49,7 +49,7 @@ void Timer::start(TimeMs timeout, Qt::TimerType type, Repeat repeat) {
|
|||
setTimeout(timeout);
|
||||
_timerId = startTimer(_timeout, _type);
|
||||
if (_timerId) {
|
||||
_next = crl::time() + _timeout;
|
||||
_next = crl::now() + _timeout;
|
||||
} else {
|
||||
_next = 0;
|
||||
}
|
||||
|
@ -61,12 +61,12 @@ void Timer::cancel() {
|
|||
}
|
||||
}
|
||||
|
||||
TimeMs Timer::remainingTime() const {
|
||||
crl::time Timer::remainingTime() const {
|
||||
if (!isActive()) {
|
||||
return -1;
|
||||
}
|
||||
auto now = crl::time();
|
||||
return (_next > now) ? (_next - now) : TimeMs(0);
|
||||
const auto now = crl::now();
|
||||
return (_next > now) ? (_next - now) : crl::time(0);
|
||||
}
|
||||
|
||||
void Timer::Adjust() {
|
||||
|
@ -87,7 +87,7 @@ void Timer::adjust() {
|
|||
}
|
||||
}
|
||||
|
||||
void Timer::setTimeout(TimeMs timeout) {
|
||||
void Timer::setTimeout(crl::time timeout) {
|
||||
Expects(timeout >= 0 && timeout <= std::numeric_limits<int>::max());
|
||||
|
||||
_timeout = static_cast<unsigned int>(timeout);
|
||||
|
@ -102,7 +102,7 @@ void Timer::timerEvent(QTimerEvent *e) {
|
|||
if (_adjusted) {
|
||||
start(_timeout, _type, repeat());
|
||||
} else {
|
||||
_next = crl::time() + _timeout;
|
||||
_next = crl::now() + _timeout;
|
||||
}
|
||||
} else {
|
||||
cancel();
|
||||
|
@ -114,7 +114,7 @@ void Timer::timerEvent(QTimerEvent *e) {
|
|||
}
|
||||
|
||||
int DelayedCallTimer::call(
|
||||
TimeMs timeout,
|
||||
crl::time timeout,
|
||||
FnMut<void()> callback,
|
||||
Qt::TimerType type) {
|
||||
Expects(timeout >= 0);
|
||||
|
|
|
@ -21,8 +21,8 @@ public:
|
|||
Fn<void()> callback = nullptr);
|
||||
explicit Timer(Fn<void()> callback = nullptr);
|
||||
|
||||
static Qt::TimerType DefaultType(TimeMs timeout) {
|
||||
constexpr auto kThreshold = TimeMs(1000);
|
||||
static Qt::TimerType DefaultType(crl::time timeout) {
|
||||
constexpr auto kThreshold = crl::time(1000);
|
||||
return (timeout > kThreshold) ? Qt::CoarseTimer : Qt::PreciseTimer;
|
||||
}
|
||||
|
||||
|
@ -30,19 +30,19 @@ public:
|
|||
_callback = std::move(callback);
|
||||
}
|
||||
|
||||
void callOnce(TimeMs timeout) {
|
||||
void callOnce(crl::time timeout) {
|
||||
callOnce(timeout, DefaultType(timeout));
|
||||
}
|
||||
|
||||
void callEach(TimeMs timeout) {
|
||||
void callEach(crl::time timeout) {
|
||||
callEach(timeout, DefaultType(timeout));
|
||||
}
|
||||
|
||||
void callOnce(TimeMs timeout, Qt::TimerType type) {
|
||||
void callOnce(crl::time timeout, Qt::TimerType type) {
|
||||
start(timeout, type, Repeat::SingleShot);
|
||||
}
|
||||
|
||||
void callEach(TimeMs timeout, Qt::TimerType type) {
|
||||
void callEach(crl::time timeout, Qt::TimerType type) {
|
||||
start(timeout, type, Repeat::Interval);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
}
|
||||
|
||||
void cancel();
|
||||
TimeMs remainingTime() const;
|
||||
crl::time remainingTime() const;
|
||||
|
||||
static void Adjust();
|
||||
|
||||
|
@ -63,10 +63,10 @@ private:
|
|||
Interval = 0,
|
||||
SingleShot = 1,
|
||||
};
|
||||
void start(TimeMs timeout, Qt::TimerType type, Repeat repeat);
|
||||
void start(crl::time timeout, Qt::TimerType type, Repeat repeat);
|
||||
void adjust();
|
||||
|
||||
void setTimeout(TimeMs timeout);
|
||||
void setTimeout(crl::time timeout);
|
||||
int timeout() const;
|
||||
|
||||
void setRepeat(Repeat repeat) {
|
||||
|
@ -77,7 +77,7 @@ private:
|
|||
}
|
||||
|
||||
Fn<void()> _callback;
|
||||
TimeMs _next = 0;
|
||||
crl::time _next = 0;
|
||||
int _timeout = 0;
|
||||
int _timerId = 0;
|
||||
|
||||
|
@ -89,7 +89,7 @@ private:
|
|||
|
||||
class DelayedCallTimer final : private QObject {
|
||||
public:
|
||||
int call(TimeMs timeout, FnMut<void()> callback) {
|
||||
int call(crl::time timeout, FnMut<void()> callback) {
|
||||
return call(
|
||||
timeout,
|
||||
std::move(callback),
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
}
|
||||
|
||||
int call(
|
||||
TimeMs timeout,
|
||||
crl::time timeout,
|
||||
FnMut<void()> callback,
|
||||
Qt::TimerType type);
|
||||
void cancel(int callId);
|
||||
|
|
|
@ -315,7 +315,7 @@ void BackgroundBox::Inner::paintPaper(
|
|||
if (paper.data.id() == Window::Theme::Background()->id()) {
|
||||
const auto checkLeft = x + st::backgroundSize.width() - st::overviewCheckSkip - st::overviewCheck.size;
|
||||
const auto checkTop = y + st::backgroundSize.height() - st::overviewCheckSkip - st::overviewCheck.size;
|
||||
_check->paint(p, getms(), checkLeft, checkTop, width());
|
||||
_check->paint(p, crl::now(), checkLeft, checkTop, width());
|
||||
} else if (Data::IsCloudWallPaper(paper.data)
|
||||
&& !Data::IsDefaultWallPaper(paper.data)
|
||||
&& over.has_value()
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
int left,
|
||||
int top,
|
||||
int outerWidth,
|
||||
TimeMs ms) override;
|
||||
crl::time ms) override;
|
||||
QImage prepareRippleMask() const override;
|
||||
bool checkRippleStartPosition(QPoint position) const override;
|
||||
|
||||
|
@ -242,7 +242,7 @@ void ServiceCheck::paint(
|
|||
int left,
|
||||
int top,
|
||||
int outerWidth,
|
||||
TimeMs ms) {
|
||||
crl::time ms) {
|
||||
Frames().paintFrame(
|
||||
p,
|
||||
left + _st.margin.left(),
|
||||
|
@ -496,7 +496,7 @@ void BackgroundPreviewBox::share() {
|
|||
void BackgroundPreviewBox::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
const auto ms = getms();
|
||||
const auto ms = crl::now();
|
||||
const auto color = _paper.backgroundColor();
|
||||
if (color) {
|
||||
p.fillRect(e->rect(), *color);
|
||||
|
@ -516,7 +516,7 @@ void BackgroundPreviewBox::paintEvent(QPaintEvent *e) {
|
|||
paintTexts(p, ms);
|
||||
}
|
||||
|
||||
void BackgroundPreviewBox::paintImage(Painter &p, TimeMs ms) {
|
||||
void BackgroundPreviewBox::paintImage(Painter &p, crl::time ms) {
|
||||
Expects(!_scaled.isNull());
|
||||
|
||||
const auto master = _paper.isPattern()
|
||||
|
@ -544,7 +544,7 @@ void BackgroundPreviewBox::paintImage(Painter &p, TimeMs ms) {
|
|||
checkBlurAnimationStart();
|
||||
}
|
||||
|
||||
void BackgroundPreviewBox::paintRadial(Painter &p, TimeMs ms) {
|
||||
void BackgroundPreviewBox::paintRadial(Painter &p, crl::time ms) {
|
||||
bool radial = false;
|
||||
float64 radialOpacity = 0;
|
||||
if (_radial.animating()) {
|
||||
|
@ -588,7 +588,7 @@ QRect BackgroundPreviewBox::radialRect() const {
|
|||
st::radialSize);
|
||||
}
|
||||
|
||||
void BackgroundPreviewBox::paintTexts(Painter &p, TimeMs ms) {
|
||||
void BackgroundPreviewBox::paintTexts(Painter &p, crl::time ms) {
|
||||
const auto height1 = _text1->height();
|
||||
const auto height2 = _text2->height();
|
||||
p.translate(0, textsTop());
|
||||
|
@ -619,7 +619,7 @@ void BackgroundPreviewBox::paintDate(Painter &p) {
|
|||
p.drawText(bubbleLeft + st::msgServicePadding.left(), bubbleTop + st::msgServicePadding.top() + st::msgServiceFont->ascent, text);
|
||||
}
|
||||
|
||||
void BackgroundPreviewBox::step_radial(TimeMs ms, bool timer) {
|
||||
void BackgroundPreviewBox::step_radial(crl::time ms, bool timer) {
|
||||
Expects(_paper.document() != nullptr);
|
||||
|
||||
const auto document = _paper.document();
|
||||
|
@ -716,7 +716,7 @@ void BackgroundPreviewBox::checkLoadedDocument() {
|
|||
guard = std::move(right)
|
||||
]() mutable {
|
||||
auto scaled = PrepareScaledFromFull(image, patternBackground);
|
||||
const auto ms = getms();
|
||||
const auto ms = crl::now();
|
||||
auto blurred = patternBackground
|
||||
? QImage()
|
||||
: PrepareScaledNonPattern(
|
||||
|
@ -782,9 +782,9 @@ void BackgroundPreviewBox::elementAnimationAutoplayAsync(
|
|||
not_null<const Element*> element) {
|
||||
}
|
||||
|
||||
TimeMs BackgroundPreviewBox::elementHighlightTime(
|
||||
crl::time BackgroundPreviewBox::elementHighlightTime(
|
||||
not_null<const Element*> element) {
|
||||
return TimeMs();
|
||||
return crl::time();
|
||||
}
|
||||
|
||||
bool BackgroundPreviewBox::elementInSelectionMode() {
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
bool elementUnderCursor(not_null<const Element*> view) override;
|
||||
void elementAnimationAutoplayAsync(
|
||||
not_null<const Element*> element) override;
|
||||
TimeMs elementHighlightTime(
|
||||
crl::time elementHighlightTime(
|
||||
not_null<const Element*> element) override;
|
||||
bool elementInSelectionMode() override;
|
||||
|
||||
|
@ -49,7 +49,7 @@ protected:
|
|||
private:
|
||||
void apply();
|
||||
void share();
|
||||
void step_radial(TimeMs ms, bool timer);
|
||||
void step_radial(crl::time ms, bool timer);
|
||||
QRect radialRect() const;
|
||||
|
||||
void checkLoadedDocument();
|
||||
|
@ -57,9 +57,9 @@ private:
|
|||
void setScaledFromImage(QImage &&image, QImage &&blurred);
|
||||
void updateServiceBg(std::optional<QColor> background);
|
||||
std::optional<QColor> patternBackgroundColor() const;
|
||||
void paintImage(Painter &p, TimeMs ms);
|
||||
void paintRadial(Painter &p, TimeMs ms);
|
||||
void paintTexts(Painter &p, TimeMs ms);
|
||||
void paintImage(Painter &p, crl::time ms);
|
||||
void paintRadial(Painter &p, crl::time ms);
|
||||
void paintTexts(Painter &p, crl::time ms);
|
||||
void paintDate(Painter &p);
|
||||
void createBlurCheckbox();
|
||||
int textsTop() const;
|
||||
|
|
|
@ -286,7 +286,7 @@ int CalendarBox::Inner::rowsTop() const {
|
|||
|
||||
void CalendarBox::Inner::paintRows(Painter &p, QRect clip) {
|
||||
p.setFont(st::calendarDaysFont);
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
auto y = rowsTop();
|
||||
auto index = -_context->daysShift();
|
||||
auto highlightedIndex = _context->highlightedIndex();
|
||||
|
|
|
@ -28,7 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr auto kSaveSettingsDelayedTimeout = TimeMs(1000);
|
||||
constexpr auto kSaveSettingsDelayedTimeout = crl::time(1000);
|
||||
|
||||
class ProxyRow : public Ui::RippleButton {
|
||||
public:
|
||||
|
@ -52,8 +52,8 @@ protected:
|
|||
private:
|
||||
void setupControls(View &&view);
|
||||
int countAvailableWidth() const;
|
||||
void step_radial(TimeMs ms, bool timer);
|
||||
void paintCheck(Painter &p, TimeMs ms);
|
||||
void step_radial(crl::time ms, bool timer);
|
||||
void paintCheck(Painter &p, crl::time ms);
|
||||
void showMenu();
|
||||
|
||||
View _view;
|
||||
|
@ -241,7 +241,7 @@ void ProxyRow::updateFields(View &&view) {
|
|||
update();
|
||||
}
|
||||
|
||||
void ProxyRow::step_radial(TimeMs ms, bool timer) {
|
||||
void ProxyRow::step_radial(crl::time ms, bool timer) {
|
||||
if (timer && !anim::Disabled()) {
|
||||
update();
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ int ProxyRow::resizeGetHeight(int newWidth) {
|
|||
void ProxyRow::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
const auto ms = getms();
|
||||
const auto ms = crl::now();
|
||||
if (!_view.deleted) {
|
||||
paintRipple(p, 0, 0, ms);
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ void ProxyRow::paintEvent(QPaintEvent *e) {
|
|||
top += st::normalFont->height + st::proxyRowPadding.bottom();
|
||||
}
|
||||
|
||||
void ProxyRow::paintCheck(Painter &p, TimeMs ms) {
|
||||
void ProxyRow::paintCheck(Painter &p, crl::time ms) {
|
||||
if (_progress) {
|
||||
_progress->step(ms);
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
|
|||
if (_gifPreview && _gifPreview->started()) {
|
||||
auto s = QSize(_thumbw, _thumbh);
|
||||
auto paused = _controller->isGifPausedAtLeastFor(Window::GifPauseReason::Layer);
|
||||
auto frame = _gifPreview->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, RectPart::None, paused ? 0 : getms());
|
||||
auto frame = _gifPreview->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, RectPart::None, paused ? 0 : crl::now());
|
||||
p.drawPixmap(_thumbx, st::boxPhotoPadding.top(), frame);
|
||||
} else {
|
||||
p.drawPixmap(_thumbx, st::boxPhotoPadding.top(), _thumb);
|
||||
|
|
|
@ -442,7 +442,7 @@ public:
|
|||
|
||||
protected:
|
||||
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
|
||||
void paintAdditionalPlaceholder(Painter &p, TimeMs ms) override;
|
||||
void paintAdditionalPlaceholder(Painter &p, crl::time ms) override;
|
||||
|
||||
void wheelEvent(QWheelEvent *e) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
@ -501,7 +501,7 @@ void EditColorBox::Field::correctValue(const QString &was, int wasCursor, QStrin
|
|||
}
|
||||
}
|
||||
|
||||
void EditColorBox::Field::paintAdditionalPlaceholder(Painter &p, TimeMs ms) {
|
||||
void EditColorBox::Field::paintAdditionalPlaceholder(Painter &p, crl::time ms) {
|
||||
p.setFont(_st.font);
|
||||
p.setPen(_st.placeholderFg);
|
||||
auto inner = QRect(_st.textMargins.right(), _st.textMargins.top(), width() - 2 * _st.textMargins.right(), height() - _st.textMargins.top() - _st.textMargins.bottom());
|
||||
|
@ -565,7 +565,7 @@ public:
|
|||
|
||||
protected:
|
||||
void correctValue(const QString &was, int wasCursor, QString &now, int &nowCursor) override;
|
||||
void paintAdditionalPlaceholder(Painter &p, TimeMs ms) override;
|
||||
void paintAdditionalPlaceholder(Painter &p, crl::time ms) override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -606,7 +606,7 @@ void EditColorBox::ResultField::correctValue(const QString &was, int wasCursor,
|
|||
}
|
||||
}
|
||||
|
||||
void EditColorBox::ResultField::paintAdditionalPlaceholder(Painter &p, TimeMs ms) {
|
||||
void EditColorBox::ResultField::paintAdditionalPlaceholder(Painter &p, crl::time ms) {
|
||||
p.setFont(_st.font);
|
||||
p.setPen(_st.placeholderFg);
|
||||
p.drawText(QRect(_st.textMargins.right(), _st.textMargins.top(), width(), height() - _st.textMargins.top() - _st.textMargins.bottom()), "#", style::al_topleft);
|
||||
|
|
|
@ -772,7 +772,7 @@ int Rows::countAvailableWidth() const {
|
|||
void Rows::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
const auto ms = getms();
|
||||
const auto ms = crl::now();
|
||||
const auto clip = e->rect();
|
||||
|
||||
const auto checkLeft = st::passportRowPadding.left();
|
||||
|
|
|
@ -124,7 +124,7 @@ protected:
|
|||
private:
|
||||
QString titleText(const Database::TaggedSummary &data) const;
|
||||
QString sizeText(const Database::TaggedSummary &data) const;
|
||||
void step_radial(TimeMs ms, bool timer);
|
||||
void step_radial(crl::time ms, bool timer);
|
||||
|
||||
Fn<QString(size_type)> _titleFactory;
|
||||
object_ptr<Ui::FlatLabel> _title;
|
||||
|
@ -186,7 +186,7 @@ void LocalStorageBox::Row::toggleProgress(bool shown) {
|
|||
}
|
||||
}
|
||||
|
||||
void LocalStorageBox::Row::step_radial(TimeMs ms, bool timer) {
|
||||
void LocalStorageBox::Row::step_radial(crl::time ms, bool timer) {
|
||||
if (timer && !anim::Disabled()) {
|
||||
RpWidget::update();
|
||||
}
|
||||
|
@ -229,11 +229,10 @@ void LocalStorageBox::Row::paintEvent(QPaintEvent *e) {
|
|||
return;
|
||||
}
|
||||
Painter p(this);
|
||||
|
||||
const auto padding = st::localStorageRowPadding;
|
||||
const auto height = st::localStorageRowHeight;
|
||||
const auto bottom = height - padding.bottom() - _description->height();
|
||||
_progress->step(crl::time());
|
||||
_progress->step(crl::now());
|
||||
_progress->draw(
|
||||
p,
|
||||
{
|
||||
|
|
|
@ -372,7 +372,7 @@ void PasscodeBox::validateEmail(
|
|||
}
|
||||
|
||||
void PasscodeBox::handleSrpIdInvalid() {
|
||||
const auto now = getms(true);
|
||||
const auto now = crl::now();
|
||||
if (_lastSrpIdInvalidTime > 0
|
||||
&& now - _lastSrpIdInvalidTime < Core::kHandleSrpIdInvalidTimeout) {
|
||||
_curRequest.id = 0;
|
||||
|
@ -403,7 +403,7 @@ void PasscodeBox::save(bool force) {
|
|||
if (_turningOff) pwd = conf = QString();
|
||||
} else {
|
||||
cSetPasscodeBadTries(cPasscodeBadTries() + 1);
|
||||
cSetPasscodeLastTry(getms(true));
|
||||
cSetPasscodeLastTry(crl::now());
|
||||
badOldPasscode();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ private:
|
|||
mtpRequestId _setRequest = 0;
|
||||
|
||||
Core::CloudPasswordCheckRequest _curRequest;
|
||||
TimeMs _lastSrpIdInvalidTime = 0;
|
||||
crl::time _lastSrpIdInvalidTime = 0;
|
||||
Core::CloudPasswordAlgo _newAlgo;
|
||||
Core::SecureSecretAlgo _newSecureSecretAlgo;
|
||||
bool _hasRecovery = false;
|
||||
|
|
|
@ -375,7 +375,7 @@ void PeerListRow::refreshStatus() {
|
|||
if (Data::OnlineTextActive(user, time)) {
|
||||
_statusType = StatusType::Online;
|
||||
}
|
||||
_statusValidTill = getms()
|
||||
_statusValidTill = crl::now()
|
||||
+ Data::OnlineChangeTimeout(user, time);
|
||||
}
|
||||
} else if (auto chat = peer()->asChat()) {
|
||||
|
@ -393,7 +393,7 @@ void PeerListRow::refreshStatus() {
|
|||
}
|
||||
}
|
||||
|
||||
TimeMs PeerListRow::refreshStatusTime() const {
|
||||
crl::time PeerListRow::refreshStatusTime() const {
|
||||
return _statusValidTill;
|
||||
}
|
||||
|
||||
|
@ -457,7 +457,7 @@ void PeerListRow::stopLastRipple() {
|
|||
}
|
||||
}
|
||||
|
||||
void PeerListRow::paintRipple(Painter &p, TimeMs ms, int x, int y, int outerWidth) {
|
||||
void PeerListRow::paintRipple(Painter &p, crl::time ms, int x, int y, int outerWidth) {
|
||||
if (_ripple) {
|
||||
_ripple->paint(p, x, y, outerWidth, ms);
|
||||
if (_ripple->empty()) {
|
||||
|
@ -469,7 +469,7 @@ void PeerListRow::paintRipple(Painter &p, TimeMs ms, int x, int y, int outerWidt
|
|||
void PeerListRow::paintUserpic(
|
||||
Painter &p,
|
||||
const style::PeerListItem &st,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth) {
|
||||
|
@ -901,7 +901,7 @@ void PeerListContent::paintEvent(QPaintEvent *e) {
|
|||
auto repaintAfterMin = repaintByStatusAfter;
|
||||
|
||||
auto rowsTopCached = rowsTop();
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
auto yFrom = clip.y() - rowsTopCached;
|
||||
auto yTo = clip.y() + clip.height() - rowsTopCached;
|
||||
p.translate(0, rowsTopCached);
|
||||
|
@ -1073,7 +1073,7 @@ void PeerListContent::setPressed(Selected pressed) {
|
|||
_pressed = pressed;
|
||||
}
|
||||
|
||||
TimeMs PeerListContent::paintRow(Painter &p, TimeMs ms, RowIndex index) {
|
||||
crl::time PeerListContent::paintRow(Painter &p, crl::time ms, RowIndex index) {
|
||||
auto row = getRow(index);
|
||||
Assert(row != nullptr);
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
}
|
||||
virtual void paintAction(
|
||||
Painter &p,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
Custom,
|
||||
};
|
||||
void refreshStatus();
|
||||
TimeMs refreshStatusTime() const;
|
||||
crl::time refreshStatusTime() const;
|
||||
|
||||
void setAbsoluteIndex(int index) {
|
||||
_absoluteIndex = index;
|
||||
|
@ -158,11 +158,11 @@ public:
|
|||
QPoint point,
|
||||
UpdateCallback updateCallback);
|
||||
void stopLastRipple();
|
||||
void paintRipple(Painter &p, TimeMs ms, int x, int y, int outerWidth);
|
||||
void paintRipple(Painter &p, crl::time ms, int x, int y, int outerWidth);
|
||||
void paintUserpic(
|
||||
Painter &p,
|
||||
const style::PeerListItem &st,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth);
|
||||
|
@ -208,7 +208,7 @@ private:
|
|||
Text _name;
|
||||
Text _status;
|
||||
StatusType _statusType = StatusType::Online;
|
||||
TimeMs _statusValidTill = 0;
|
||||
crl::time _statusValidTill = 0;
|
||||
base::flat_set<QChar> _nameFirstLetters;
|
||||
int _absoluteIndex = -1;
|
||||
State _disabledState = State::Active;
|
||||
|
@ -561,7 +561,7 @@ private:
|
|||
RowIndex findRowIndex(not_null<PeerListRow*> row, RowIndex hint = RowIndex());
|
||||
QRect getActionRect(not_null<PeerListRow*> row, RowIndex index) const;
|
||||
|
||||
TimeMs paintRow(Painter &p, TimeMs ms, RowIndex index);
|
||||
crl::time paintRow(Painter &p, crl::time ms, RowIndex index);
|
||||
|
||||
void addRowEntry(not_null<PeerListRow*> row);
|
||||
void addToSearchIndex(not_null<PeerListRow*> row);
|
||||
|
|
|
@ -76,7 +76,7 @@ void AddBotToGroup(not_null<UserData*> bot, not_null<PeerData*> chat) {
|
|||
//void MembersAddButton::paintEvent(QPaintEvent *e) {
|
||||
// Painter p(this);
|
||||
//
|
||||
// auto ms = getms();
|
||||
// auto ms = crl::now();
|
||||
// auto over = isOver();
|
||||
// auto down = isDown();
|
||||
//
|
||||
|
@ -122,7 +122,7 @@ QMargins PeerListRowWithLink::actionMargins() const {
|
|||
|
||||
void PeerListRowWithLink::paintAction(
|
||||
Painter &p,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
|
|
|
@ -42,7 +42,7 @@ private:
|
|||
QMargins actionMargins() const override;
|
||||
void paintAction(
|
||||
Painter &p,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
|
|
|
@ -35,7 +35,7 @@ constexpr auto kForwardMessagesOnAdd = 100;
|
|||
|
||||
constexpr auto kParticipantsFirstPageCount = 16;
|
||||
constexpr auto kParticipantsPerPage = 200;
|
||||
constexpr auto kSortByOnlineDelay = TimeMs(1000);
|
||||
constexpr auto kSortByOnlineDelay = crl::time(1000);
|
||||
|
||||
void RemoveAdmin(
|
||||
not_null<ChannelData*> channel,
|
||||
|
|
|
@ -40,7 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr auto kUsernameCheckTimeout = TimeMs(200);
|
||||
constexpr auto kUsernameCheckTimeout = crl::time(200);
|
||||
constexpr auto kMinUsernameLength = 5;
|
||||
constexpr auto kMaxGroupChannelTitle = 255; // See also add_contact_box.
|
||||
constexpr auto kMaxChannelDescription = 255; // See also add_contact_box.
|
||||
|
|
|
@ -37,8 +37,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace {
|
||||
|
||||
constexpr auto kMinPreviewWidth = 20;
|
||||
constexpr auto kShrinkDuration = TimeMs(150);
|
||||
constexpr auto kDragDuration = TimeMs(200);
|
||||
constexpr auto kShrinkDuration = crl::time(150);
|
||||
constexpr auto kDragDuration = crl::time(200);
|
||||
|
||||
class SingleMediaPreview : public Ui::RpWidget {
|
||||
public:
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
int top,
|
||||
float64 shrinkProgress,
|
||||
float64 moveProgress,
|
||||
TimeMs ms);
|
||||
crl::time ms);
|
||||
void paintPhoto(Painter &p, int left, int top, int outerWidth);
|
||||
void paintFile(Painter &p, int left, int top, int outerWidth);
|
||||
|
||||
|
@ -291,7 +291,7 @@ void AlbumThumb::paintInAlbum(
|
|||
int top,
|
||||
float64 shrinkProgress,
|
||||
float64 moveProgress,
|
||||
TimeMs ms) {
|
||||
crl::time ms) {
|
||||
const auto shrink = anim::interpolate(0, _shrinkSize, shrinkProgress);
|
||||
_suggestedMoveAnimation.step(ms);
|
||||
_lastShrinkValue = shrink;
|
||||
|
@ -723,7 +723,7 @@ void SingleMediaPreview::paintEvent(QPaintEvent *e) {
|
|||
if (_gifPreview && _gifPreview->started()) {
|
||||
auto s = QSize(_previewWidth, _previewHeight);
|
||||
auto paused = _controller->isGifPausedAtLeastFor(Window::GifPauseReason::Layer);
|
||||
auto frame = _gifPreview->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, RectPart::None, paused ? 0 : getms());
|
||||
auto frame = _gifPreview->current(s.width(), s.height(), s.width(), s.height(), ImageRoundRadius::None, RectPart::None, paused ? 0 : crl::now());
|
||||
p.drawPixmap(_previewLeft, st::boxPhotoPadding.top(), frame);
|
||||
} else {
|
||||
p.drawPixmap(_previewLeft, st::boxPhotoPadding.top(), _preview);
|
||||
|
@ -1187,7 +1187,7 @@ void SendFilesBox::AlbumPreview::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
void SendFilesBox::AlbumPreview::paintAlbum(Painter &p) const {
|
||||
const auto ms = getms();
|
||||
const auto ms = crl::now();
|
||||
const auto shrink = _shrinkAnimation.current(
|
||||
ms,
|
||||
_draggedThumb ? 1. : 0.);
|
||||
|
|
|
@ -28,7 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr auto kSessionsShortPollTimeout = 60 * TimeMs(1000);
|
||||
constexpr auto kSessionsShortPollTimeout = 60 * crl::time(1000);
|
||||
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ private:
|
|||
|
||||
int displayedChatsCount() const;
|
||||
|
||||
void paintChat(Painter &p, TimeMs ms, not_null<Chat*> chat, int index);
|
||||
void paintChat(Painter &p, crl::time ms, not_null<Chat*> chat, int index);
|
||||
void updateChat(not_null<PeerData*> peer);
|
||||
void updateChatName(not_null<Chat*> chat, not_null<PeerData*> peer);
|
||||
void repaintChat(not_null<PeerData*> peer);
|
||||
|
@ -732,7 +732,7 @@ void ShareBox::Inner::setActive(int active) {
|
|||
|
||||
void ShareBox::Inner::paintChat(
|
||||
Painter &p,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
not_null<Chat*> chat,
|
||||
int index) {
|
||||
auto x = _rowsLeft + qFloor((index % _columnCount) * _rowWidthReal);
|
||||
|
@ -761,7 +761,7 @@ ShareBox::Inner::Chat::Chat(PeerData *peer, Fn<void()> updateCallback)
|
|||
void ShareBox::Inner::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
auto r = e->rect();
|
||||
p.setClipRect(r);
|
||||
p.fillRect(r, st::boxBg);
|
||||
|
|
|
@ -451,7 +451,7 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
|
||||
if (_pack.isEmpty()) return;
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
int32 rows = _pack.size() / kStickersPanelPerRow + ((_pack.size() % kStickersPanelPerRow) ? 1 : 0);
|
||||
int32 from = qFloor(e->rect().top() / st::stickersSize.height()), to = qFloor(e->rect().bottom() / st::stickersSize.height()) + 1;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace {
|
|||
|
||||
constexpr auto kArchivedLimitFirstRequest = 10;
|
||||
constexpr auto kArchivedLimitPerPage = 30;
|
||||
constexpr auto kHandleMegagroupSetAddressChangeTimeout = TimeMs(1000);
|
||||
constexpr auto kHandleMegagroupSetAddressChangeTimeout = crl::time(1000);
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -341,7 +341,7 @@ void StickersBox::paintEvent(QPaintEvent *e) {
|
|||
Painter p(this);
|
||||
|
||||
if (_slideAnimation) {
|
||||
_slideAnimation->paintFrame(p, 0, getTopSkip(), width(), getms());
|
||||
_slideAnimation->paintFrame(p, 0, getTopSkip(), width(), crl::now());
|
||||
if (!_slideAnimation->animating()) {
|
||||
_slideAnimation.reset();
|
||||
setInnerVisible(true);
|
||||
|
@ -666,7 +666,7 @@ void StickersBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
auto clip = e->rect();
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
p.fillRect(clip, st::boxBg);
|
||||
p.setClipRect(clip);
|
||||
|
||||
|
@ -741,7 +741,7 @@ QRect StickersBox::Inner::relativeButtonRect(bool removeButton) const {
|
|||
return QRect(buttonx, buttony, buttonw, buttonh);
|
||||
}
|
||||
|
||||
void StickersBox::Inner::paintRow(Painter &p, Row *set, int index, TimeMs ms) {
|
||||
void StickersBox::Inner::paintRow(Painter &p, Row *set, int index, crl::time ms) {
|
||||
auto xadd = 0, yadd = qRound(set->yadd.current());
|
||||
if (xadd || yadd) p.translate(xadd, yadd);
|
||||
|
||||
|
@ -841,7 +841,7 @@ void StickersBox::Inner::paintRow(Painter &p, Row *set, int index, TimeMs ms) {
|
|||
if (xadd || yadd) p.translate(-xadd, -yadd);
|
||||
}
|
||||
|
||||
void StickersBox::Inner::paintFakeButton(Painter &p, Row *set, int index, TimeMs ms) {
|
||||
void StickersBox::Inner::paintFakeButton(Painter &p, Row *set, int index, crl::time ms) {
|
||||
auto removeButton = (_section == Section::Installed && !set->removed);
|
||||
auto rect = relativeButtonRect(removeButton);
|
||||
if (_section != Section::Installed && set->installed && !set->archived && !set->removed) {
|
||||
|
@ -1019,7 +1019,7 @@ void StickersBox::Inner::onUpdateSelected() {
|
|||
auto local = mapFromGlobal(_mouse);
|
||||
if (_dragging >= 0) {
|
||||
auto shift = 0;
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
int firstSetIndex = 0;
|
||||
if (_rows.at(firstSetIndex)->isRecentSet()) {
|
||||
++firstSetIndex;
|
||||
|
@ -1129,7 +1129,7 @@ void StickersBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
|||
} else if (_dragging >= 0) {
|
||||
QPoint local(mapFromGlobal(_mouse));
|
||||
_rows[_dragging]->yadd.start(0.);
|
||||
_aboveShadowFadeStart = _animStartTimes[_dragging] = getms();
|
||||
_aboveShadowFadeStart = _animStartTimes[_dragging] = crl::now();
|
||||
_aboveShadowFadeOpacity = anim::value(aboveShadowOpacity(), 0);
|
||||
if (!_a_shifting.animating()) {
|
||||
_a_shifting.start();
|
||||
|
@ -1209,7 +1209,7 @@ void StickersBox::Inner::leaveToChildEvent(QEvent *e, QWidget *child) {
|
|||
onUpdateSelected();
|
||||
}
|
||||
|
||||
void StickersBox::Inner::step_shifting(TimeMs ms, bool timer) {
|
||||
void StickersBox::Inner::step_shifting(crl::time ms, bool timer) {
|
||||
if (anim::Disabled()) {
|
||||
ms += st::stickersRowDuration;
|
||||
}
|
||||
|
|
|
@ -262,9 +262,9 @@ private:
|
|||
QRect relativeButtonRect(bool removeButton) const;
|
||||
void ensureRipple(const style::RippleAnimation &st, QImage mask, bool removeButton);
|
||||
|
||||
void step_shifting(TimeMs ms, bool timer);
|
||||
void paintRow(Painter &p, Row *set, int index, TimeMs ms);
|
||||
void paintFakeButton(Painter &p, Row *set, int index, TimeMs ms);
|
||||
void step_shifting(crl::time ms, bool timer);
|
||||
void paintRow(Painter &p, Row *set, int index, crl::time ms);
|
||||
void paintFakeButton(Painter &p, Row *set, int index, crl::time ms);
|
||||
void clear();
|
||||
void setActionSel(int32 actionSel);
|
||||
float64 aboveShadowOpacity() const;
|
||||
|
@ -289,8 +289,8 @@ private:
|
|||
int32 _rowHeight;
|
||||
|
||||
std::vector<std::unique_ptr<Row>> _rows;
|
||||
QList<TimeMs> _animStartTimes;
|
||||
TimeMs _aboveShadowFadeStart = 0;
|
||||
QList<crl::time> _animStartTimes;
|
||||
crl::time _aboveShadowFadeStart = 0;
|
||||
anim::value _aboveShadowFadeOpacity;
|
||||
BasicAnimation _a_shifting;
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
}
|
||||
void paintAction(
|
||||
Painter &p,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
|
@ -143,7 +143,7 @@ void BoxController::Row::paintStatusText(Painter &p, const style::PeerListItem &
|
|||
|
||||
void BoxController::Row::paintAction(
|
||||
Painter &p,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
|
|
|
@ -295,8 +295,8 @@ void Call::setMute(bool mute) {
|
|||
_muteChanged.notify(_mute);
|
||||
}
|
||||
|
||||
TimeMs Call::getDurationMs() const {
|
||||
return _startTime ? (getms(true) - _startTime) : 0;
|
||||
crl::time Call::getDurationMs() const {
|
||||
return _startTime ? (crl::now() - _startTime) : 0;
|
||||
}
|
||||
|
||||
void Call::hangup() {
|
||||
|
@ -341,7 +341,7 @@ void Call::startWaitingTrack() {
|
|||
|
||||
float64 Call::getWaitingSoundPeakValue() const {
|
||||
if (_waitingTrack) {
|
||||
auto when = getms() + kSoundSampleMs / 4;
|
||||
auto when = crl::now() + kSoundSampleMs / 4;
|
||||
return _waitingTrack->getPeakValue(when);
|
||||
}
|
||||
return 0.;
|
||||
|
@ -740,7 +740,7 @@ void Call::setState(State state) {
|
|||
}
|
||||
switch (_state) {
|
||||
case State::Established:
|
||||
_startTime = getms(true);
|
||||
_startTime = crl::now();
|
||||
break;
|
||||
case State::ExchangingKeys:
|
||||
_delegate->playSound(Delegate::Sound::Connecting);
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
return _muteChanged;
|
||||
}
|
||||
|
||||
TimeMs getDurationMs() const;
|
||||
crl::time getDurationMs() const;
|
||||
float64 getWaitingSoundPeakValue() const;
|
||||
|
||||
void answer();
|
||||
|
@ -190,7 +190,7 @@ private:
|
|||
base::Observable<State> _stateChanged;
|
||||
int _signalBarCount = kSignalBarStarting;
|
||||
base::Observable<int> _signalBarCountChanged;
|
||||
TimeMs _startTime = 0;
|
||||
crl::time _startTime = 0;
|
||||
base::DelayedCallTimer _finishByTimeoutTimer;
|
||||
base::Timer _discardByTimeoutTimer;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Calls {
|
||||
namespace {
|
||||
|
||||
constexpr auto kServerConfigUpdateTimeoutMs = 24 * 3600 * TimeMs(1000);
|
||||
constexpr auto kServerConfigUpdateTimeoutMs = 24 * 3600 * crl::time(1000);
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -184,12 +184,12 @@ void Instance::refreshServerConfig() {
|
|||
if (_serverConfigRequestId) {
|
||||
return;
|
||||
}
|
||||
if (_lastServerConfigUpdateTime && (getms(true) - _lastServerConfigUpdateTime) < kServerConfigUpdateTimeoutMs) {
|
||||
if (_lastServerConfigUpdateTime && (crl::now() - _lastServerConfigUpdateTime) < kServerConfigUpdateTimeoutMs) {
|
||||
return;
|
||||
}
|
||||
_serverConfigRequestId = request(MTPphone_GetCallConfig()).done([this](const MTPDataJSON &result) {
|
||||
_serverConfigRequestId = 0;
|
||||
_lastServerConfigUpdateTime = getms(true);
|
||||
_lastServerConfigUpdateTime = crl::now();
|
||||
|
||||
const auto &json = result.c_dataJSON().vdata.v;
|
||||
UpdateConfig(std::string(json.data(), json.size()));
|
||||
|
|
|
@ -66,7 +66,7 @@ private:
|
|||
|
||||
DhConfig _dhConfig;
|
||||
|
||||
TimeMs _lastServerConfigUpdateTime = 0;
|
||||
crl::time _lastServerConfigUpdateTime = 0;
|
||||
mtpRequestId _serverConfigRequestId = 0;
|
||||
|
||||
std::unique_ptr<Call> _currentCall;
|
||||
|
|
|
@ -186,7 +186,7 @@ void Panel::Button::setProgress(float64 progress) {
|
|||
void Panel::Button::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
auto bgPosition = myrtlpoint(_stFrom->button.rippleAreaPosition);
|
||||
auto paintFrom = (_progress == 0.) || !_stTo;
|
||||
auto paintTo = !paintFrom && (_progress == 1.);
|
||||
|
@ -695,7 +695,7 @@ void Panel::updateStatusGeometry() {
|
|||
void Panel::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
if (!_animationCache.isNull()) {
|
||||
auto opacity = _opacityAnimation.current(getms(), _call ? 1. : 0.);
|
||||
auto opacity = _opacityAnimation.current(crl::now(), _call ? 1. : 0.);
|
||||
if (!_opacityAnimation.animating()) {
|
||||
finishAnimating();
|
||||
if (!_call || isHidden()) return;
|
||||
|
@ -921,7 +921,7 @@ void Panel::updateStatusText(State state) {
|
|||
updateStatusGeometry();
|
||||
}
|
||||
|
||||
void Panel::startDurationUpdateTimer(TimeMs currentDuration) {
|
||||
void Panel::startDurationUpdateTimer(crl::time currentDuration) {
|
||||
auto msTillNextSecond = 1000 - (currentDuration % 1000);
|
||||
_updateDurationTimer.callOnce(msTillNextSecond + 5);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ private:
|
|||
void stateChanged(State state);
|
||||
void showControls();
|
||||
void updateStatusText(State state);
|
||||
void startDurationUpdateTimer(TimeMs currentDuration);
|
||||
void startDurationUpdateTimer(crl::time currentDuration);
|
||||
void fillFingerprint();
|
||||
void toggleOpacityAnimation(bool visible);
|
||||
void finishAnimating();
|
||||
|
|
|
@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Calls {
|
||||
namespace {
|
||||
|
||||
constexpr auto kUpdateDebugTimeoutMs = TimeMs(500);
|
||||
constexpr auto kUpdateDebugTimeoutMs = crl::time(500);
|
||||
|
||||
class DebugInfoBox : public BoxContent {
|
||||
public:
|
||||
|
@ -162,7 +162,7 @@ void TopBar::updateDurationText() {
|
|||
}
|
||||
}
|
||||
|
||||
void TopBar::startDurationUpdateTimer(TimeMs currentDuration) {
|
||||
void TopBar::startDurationUpdateTimer(crl::time currentDuration) {
|
||||
auto msTillNextSecond = 1000 - (currentDuration % 1000);
|
||||
_updateDurationTimer.callOnce(msTillNextSecond + 5);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
void setInfoLabels();
|
||||
void updateDurationText();
|
||||
void updateControlsGeometry();
|
||||
void startDurationUpdateTimer(TimeMs currentDuration);
|
||||
void startDurationUpdateTimer(crl::time currentDuration);
|
||||
void setMuted(bool mute);
|
||||
|
||||
base::weak_ptr<Call> _call;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_session.h"
|
||||
#include "data/data_user.h"
|
||||
#include "base/timer.h"
|
||||
#include "base/concurrent_timer.h"
|
||||
#include "core/update_checker.h"
|
||||
#include "core/shortcuts.h"
|
||||
#include "core/sandbox.h"
|
||||
|
@ -630,8 +631,13 @@ void Application::forceLogOut(const TextWithEntities &explanation) {
|
|||
}
|
||||
|
||||
void Application::checkLocalTime() {
|
||||
const auto updated = checkms();
|
||||
if (App::main()) App::main()->checkLastUpdate(updated);
|
||||
if (crl::adjust_time()) {
|
||||
base::Timer::Adjust();
|
||||
base::ConcurrentTimerEnvironment::Adjust();
|
||||
if (App::main()) App::main()->checkLastUpdate(true);
|
||||
} else {
|
||||
if (App::main()) App::main()->checkLastUpdate(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Application::stateChanged(Qt::ApplicationState state) {
|
||||
|
|
|
@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace Core {
|
||||
|
||||
constexpr auto kHandleSrpIdInvalidTimeout = 60 * TimeMs(1000);
|
||||
constexpr auto kHandleSrpIdInvalidTimeout = 60 * crl::time(1000);
|
||||
|
||||
struct CloudPasswordAlgoModPow {
|
||||
static constexpr auto kIterations = 100000;
|
||||
|
|
|
@ -36,7 +36,7 @@ extern "C" {
|
|||
namespace Core {
|
||||
namespace {
|
||||
|
||||
constexpr auto kUpdaterTimeout = 10 * TimeMs(1000);
|
||||
constexpr auto kUpdaterTimeout = 10 * crl::time(1000);
|
||||
constexpr auto kMaxResponseSize = 1024 * 1024;
|
||||
|
||||
#ifdef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
@ -1227,7 +1227,7 @@ void Updater::start(bool forceWait) {
|
|||
|
||||
_checking.fire({});
|
||||
} else {
|
||||
_timer.callOnce((updateInSecs + 5) * TimeMs(1000));
|
||||
_timer.callOnce((updateInSecs + 5) * crl::time(1000));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/utils.h"
|
||||
|
||||
#include "base/qthelp_url.h"
|
||||
#include "base/timer.h"
|
||||
#include "base/concurrent_timer.h"
|
||||
#include "platform/platform_specific.h"
|
||||
|
||||
extern "C" {
|
||||
|
@ -226,7 +224,7 @@ namespace {
|
|||
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
const auto seed = 1000LL * static_cast<TimeMs>(ts.tv_sec) + (static_cast<TimeMs>(ts.tv_nsec) / 1000000LL);
|
||||
const auto seed = 1000LL * static_cast<crl::time>(ts.tv_sec) + (static_cast<crl::time>(ts.tv_nsec) / 1000000LL);
|
||||
#endif
|
||||
srand((uint32)(seed & 0xFFFFFFFFL));
|
||||
}
|
||||
|
@ -431,19 +429,6 @@ namespace ThirdParty {
|
|||
}
|
||||
}
|
||||
|
||||
bool checkms() {
|
||||
if (crl::adjust_time()) {
|
||||
base::Timer::Adjust();
|
||||
base::ConcurrentTimerEnvironment::Adjust();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
TimeMs getms(bool checked) {
|
||||
return crl::time();
|
||||
}
|
||||
|
||||
uint64 msgid() {
|
||||
#ifdef Q_OS_WIN
|
||||
LARGE_INTEGER li;
|
||||
|
|
|
@ -161,10 +161,7 @@ namespace ThirdParty {
|
|||
void start();
|
||||
void finish();
|
||||
|
||||
}
|
||||
|
||||
bool checkms(); // returns true if time has changed
|
||||
TimeMs getms(bool checked = false);
|
||||
} // namespace ThirdParty
|
||||
|
||||
const static uint32 _md5_block_size = 64;
|
||||
class HashMd5 {
|
||||
|
@ -324,7 +321,7 @@ struct ProxyData {
|
|||
QString user, password;
|
||||
|
||||
std::vector<QString> resolvedIPs;
|
||||
TimeMs resolvedExpireAt = 0;
|
||||
crl::time resolvedExpireAt = 0;
|
||||
|
||||
bool valid() const;
|
||||
bool supportsCalls() const;
|
||||
|
|
|
@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr auto kUpdateFullPeerTimeout = TimeMs(5000); // Not more than once in 5 seconds.
|
||||
constexpr auto kUpdateFullPeerTimeout = crl::time(5000); // Not more than once in 5 seconds.
|
||||
constexpr auto kUserpicSize = 160;
|
||||
|
||||
using UpdateFlag = Notify::PeerUpdate::Flag;
|
||||
|
@ -431,7 +431,7 @@ PeerData::~PeerData() = default;
|
|||
|
||||
void PeerData::updateFull() {
|
||||
if (!_lastFullUpdate
|
||||
|| getms(true) > _lastFullUpdate + kUpdateFullPeerTimeout) {
|
||||
|| crl::now() > _lastFullUpdate + kUpdateFullPeerTimeout) {
|
||||
updateFullForced();
|
||||
}
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ void PeerData::updateFullForced() {
|
|||
}
|
||||
|
||||
void PeerData::fullUpdated() {
|
||||
_lastFullUpdate = getms(true);
|
||||
_lastFullUpdate = crl::now();
|
||||
}
|
||||
|
||||
UserData *PeerData::asUser() {
|
||||
|
|
|
@ -317,7 +317,7 @@ private:
|
|||
base::flat_set<QString> _nameWords; // for filtering
|
||||
base::flat_set<QChar> _nameFirstLetters;
|
||||
|
||||
TimeMs _lastFullUpdate = 0;
|
||||
crl::time _lastFullUpdate = 0;
|
||||
MsgId _pinnedMessageId = 0;
|
||||
|
||||
QString _about;
|
||||
|
|
|
@ -15,8 +15,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Data {
|
||||
namespace {
|
||||
|
||||
constexpr auto kMinOnlineChangeTimeout = TimeMs(1000);
|
||||
constexpr auto kMaxOnlineChangeTimeout = 86400 * TimeMs(1000);
|
||||
constexpr auto kMinOnlineChangeTimeout = crl::time(1000);
|
||||
constexpr auto kMaxOnlineChangeTimeout = 86400 * crl::time(1000);
|
||||
constexpr auto kSecondsInDay = 86400;
|
||||
|
||||
int OnlinePhraseChangeInSeconds(TimeId online, TimeId now) {
|
||||
|
@ -273,16 +273,16 @@ TimeId SortByOnlineValue(not_null<UserData*> user, TimeId now) {
|
|||
return online;
|
||||
}
|
||||
|
||||
TimeMs OnlineChangeTimeout(TimeId online, TimeId now) {
|
||||
crl::time OnlineChangeTimeout(TimeId online, TimeId now) {
|
||||
const auto result = OnlinePhraseChangeInSeconds(online, now);
|
||||
Assert(result >= 0);
|
||||
return snap(
|
||||
result * TimeMs(1000),
|
||||
result * crl::time(1000),
|
||||
kMinOnlineChangeTimeout,
|
||||
kMaxOnlineChangeTimeout);
|
||||
}
|
||||
|
||||
TimeMs OnlineChangeTimeout(not_null<UserData*> user, TimeId now) {
|
||||
crl::time OnlineChangeTimeout(not_null<UserData*> user, TimeId now) {
|
||||
if (isServiceUser(user->id) || user->botInfo) {
|
||||
return kMaxOnlineChangeTimeout;
|
||||
}
|
||||
|
|
|
@ -111,8 +111,8 @@ rpl::producer<bool> CanWriteValue(ChannelData *channel);
|
|||
rpl::producer<bool> CanWriteValue(not_null<PeerData*> peer);
|
||||
|
||||
TimeId SortByOnlineValue(not_null<UserData*> user, TimeId now);
|
||||
TimeMs OnlineChangeTimeout(TimeId online, TimeId now);
|
||||
TimeMs OnlineChangeTimeout(not_null<UserData*> user, TimeId now);
|
||||
crl::time OnlineChangeTimeout(TimeId online, TimeId now);
|
||||
crl::time OnlineChangeTimeout(not_null<UserData*> user, TimeId now);
|
||||
QString OnlineText(TimeId online, TimeId now);
|
||||
QString OnlineText(not_null<UserData*> user, TimeId now);
|
||||
QString OnlineTextFull(not_null<UserData*> user, TimeId now);
|
||||
|
|
|
@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace {
|
||||
|
||||
constexpr auto kShortPollTimeout = 30 * TimeMs(1000);
|
||||
constexpr auto kShortPollTimeout = 30 * crl::time(1000);
|
||||
|
||||
const PollAnswer *AnswerByOption(
|
||||
const std::vector<PollAnswer> &list,
|
||||
|
@ -80,7 +80,7 @@ bool PollData::applyChanges(const MTPDpoll &poll) {
|
|||
|
||||
bool PollData::applyResults(const MTPPollResults &results) {
|
||||
return results.match([&](const MTPDpollResults &results) {
|
||||
lastResultsUpdate = getms();
|
||||
lastResultsUpdate = crl::now();
|
||||
|
||||
const auto newTotalVoters = results.has_total_voters()
|
||||
? results.vtotal_voters.v
|
||||
|
@ -102,7 +102,7 @@ bool PollData::applyResults(const MTPPollResults &results) {
|
|||
});
|
||||
}
|
||||
|
||||
void PollData::checkResultsReload(not_null<HistoryItem*> item, TimeMs now) {
|
||||
void PollData::checkResultsReload(not_null<HistoryItem*> item, crl::time now) {
|
||||
if (lastResultsUpdate && lastResultsUpdate + kShortPollTimeout > now) {
|
||||
return;
|
||||
} else if (closed) {
|
||||
|
|
|
@ -28,7 +28,7 @@ struct PollData {
|
|||
|
||||
bool applyChanges(const MTPDpoll &poll);
|
||||
bool applyResults(const MTPPollResults &results);
|
||||
void checkResultsReload(not_null<HistoryItem*> item, TimeMs now);
|
||||
void checkResultsReload(not_null<HistoryItem*> item, crl::time now);
|
||||
|
||||
PollAnswer *answerByOption(const QByteArray &option);
|
||||
const PollAnswer *answerByOption(const QByteArray &option) const;
|
||||
|
@ -41,7 +41,7 @@ struct PollData {
|
|||
int totalVoters = 0;
|
||||
bool closed = false;
|
||||
QByteArray sendingVote;
|
||||
TimeMs lastResultsUpdate = 0;
|
||||
crl::time lastResultsUpdate = 0;
|
||||
|
||||
int version = 0;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Api {
|
|||
namespace {
|
||||
|
||||
constexpr auto kSharedMediaLimit = 100;
|
||||
constexpr auto kDefaultSearchTimeoutMs = TimeMs(200);
|
||||
constexpr auto kDefaultSearchTimeoutMs = crl::time(200);
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -379,7 +379,7 @@ void DelayedSearchController::setQuery(const Query &query) {
|
|||
|
||||
void DelayedSearchController::setQuery(
|
||||
const Query &query,
|
||||
TimeMs delay) {
|
||||
crl::time delay) {
|
||||
if (currentQuery() == query) {
|
||||
_timer.cancel();
|
||||
return;
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
using SavedState = SearchController::SavedState;
|
||||
|
||||
void setQuery(const Query &query);
|
||||
void setQuery(const Query &query, TimeMs delay);
|
||||
void setQuery(const Query &query, crl::time delay);
|
||||
void setQueryFast(const Query &query);
|
||||
|
||||
Query currentQuery() const {
|
||||
|
|
|
@ -44,7 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Data {
|
||||
namespace {
|
||||
|
||||
constexpr auto kMaxNotifyCheckDelay = 24 * 3600 * TimeMs(1000);
|
||||
constexpr auto kMaxNotifyCheckDelay = 24 * 3600 * crl::time(1000);
|
||||
constexpr auto kMaxWallpaperSize = 10 * 1024 * 1024;
|
||||
|
||||
using ViewElement = HistoryView::Element;
|
||||
|
@ -722,13 +722,13 @@ void Session::registerSendAction(
|
|||
|
||||
const auto i = _sendActions.find(history);
|
||||
if (!_sendActions.contains(history)) {
|
||||
_sendActions.emplace(history, getms());
|
||||
_sendActions.emplace(history, crl::now());
|
||||
_a_sendActions.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Session::step_typings(TimeMs ms, bool timer) {
|
||||
void Session::step_typings(crl::time ms, bool timer) {
|
||||
for (auto i = begin(_sendActions); i != end(_sendActions);) {
|
||||
if (i->first->updateSendActionNeedsAnimating(ms)) {
|
||||
++i;
|
||||
|
@ -790,7 +790,7 @@ void Session::suggestStartExport() {
|
|||
: (_exportAvailableAt - now);
|
||||
if (left) {
|
||||
App::CallDelayed(
|
||||
std::min(left + 5, 3600) * TimeMs(1000),
|
||||
std::min(left + 5, 3600) * crl::time(1000),
|
||||
_session,
|
||||
[=] { suggestStartExport(); });
|
||||
} else if (_export) {
|
||||
|
@ -840,7 +840,7 @@ const Passport::SavedCredentials *Session::passportCredentials() const {
|
|||
|
||||
void Session::rememberPassportCredentials(
|
||||
Passport::SavedCredentials data,
|
||||
TimeMs rememberFor) {
|
||||
crl::time rememberFor) {
|
||||
Expects(rememberFor > 0);
|
||||
|
||||
static auto generation = 0;
|
||||
|
@ -1359,7 +1359,7 @@ const NotifySettings &Session::defaultNotifySettings(
|
|||
|
||||
void Session::updateNotifySettingsLocal(not_null<PeerData*> peer) {
|
||||
const auto history = historyLoaded(peer->id);
|
||||
auto changesIn = TimeMs(0);
|
||||
auto changesIn = crl::time(0);
|
||||
const auto muted = notifyIsMuted(peer, &changesIn);
|
||||
if (history && history->changeMute(muted)) {
|
||||
// Notification already sent.
|
||||
|
@ -1380,7 +1380,7 @@ void Session::updateNotifySettingsLocal(not_null<PeerData*> peer) {
|
|||
}
|
||||
}
|
||||
|
||||
void Session::unmuteByFinishedDelayed(TimeMs delay) {
|
||||
void Session::unmuteByFinishedDelayed(crl::time delay) {
|
||||
accumulate_min(delay, kMaxNotifyCheckDelay);
|
||||
if (!_unmuteByFinishedTimer.isActive()
|
||||
|| _unmuteByFinishedTimer.remainingTime() > delay) {
|
||||
|
@ -1389,10 +1389,10 @@ void Session::unmuteByFinishedDelayed(TimeMs delay) {
|
|||
}
|
||||
|
||||
void Session::unmuteByFinished() {
|
||||
auto changesInMin = TimeMs(0);
|
||||
auto changesInMin = crl::time(0);
|
||||
for (auto i = begin(_mutedPeers); i != end(_mutedPeers);) {
|
||||
const auto history = historyLoaded((*i)->id);
|
||||
auto changesIn = TimeMs(0);
|
||||
auto changesIn = crl::time(0);
|
||||
const auto muted = notifyIsMuted(*i, &changesIn);
|
||||
if (muted) {
|
||||
if (history) {
|
||||
|
@ -1571,7 +1571,7 @@ void Session::unreadEntriesChanged(
|
|||
}
|
||||
}
|
||||
|
||||
void Session::selfDestructIn(not_null<HistoryItem*> item, TimeMs delay) {
|
||||
void Session::selfDestructIn(not_null<HistoryItem*> item, crl::time delay) {
|
||||
_selfDestructItems.push_back(item->fullId());
|
||||
if (!_selfDestructTimer.isActive()
|
||||
|| _selfDestructTimer.remainingTime() > delay) {
|
||||
|
@ -1580,8 +1580,8 @@ void Session::selfDestructIn(not_null<HistoryItem*> item, TimeMs delay) {
|
|||
}
|
||||
|
||||
void Session::checkSelfDestructItems() {
|
||||
auto now = getms(true);
|
||||
auto nextDestructIn = TimeMs(0);
|
||||
auto now = crl::now();
|
||||
auto nextDestructIn = crl::time(0);
|
||||
for (auto i = _selfDestructItems.begin(); i != _selfDestructItems.cend();) {
|
||||
if (auto item = App::histItemById(*i)) {
|
||||
if (auto destructIn = item->getSelfDestructIn(now)) {
|
||||
|
@ -2863,13 +2863,13 @@ void Session::updateNotifySettings(
|
|||
|
||||
bool Session::notifyIsMuted(
|
||||
not_null<const PeerData*> peer,
|
||||
TimeMs *changesIn) const {
|
||||
crl::time *changesIn) const {
|
||||
const auto resultFromUntil = [&](TimeId until) {
|
||||
const auto now = unixtime();
|
||||
const auto result = (until > now) ? (until - now) : 0;
|
||||
if (changesIn) {
|
||||
*changesIn = (result > 0)
|
||||
? std::min(result * TimeMs(1000), kMaxNotifyCheckDelay)
|
||||
? std::min(result * crl::time(1000), kMaxNotifyCheckDelay)
|
||||
: kMaxNotifyCheckDelay;
|
||||
}
|
||||
return (result > 0);
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
const Passport::SavedCredentials *passportCredentials() const;
|
||||
void rememberPassportCredentials(
|
||||
Passport::SavedCredentials data,
|
||||
TimeMs rememberFor);
|
||||
crl::time rememberFor);
|
||||
void forgetPassportCredentials();
|
||||
|
||||
Storage::Cache::Database &cache();
|
||||
|
@ -205,34 +205,34 @@ public:
|
|||
void notifySavedGifsUpdated();
|
||||
[[nodiscard]] rpl::producer<> savedGifsUpdated() const;
|
||||
|
||||
bool stickersUpdateNeeded(TimeMs now) const {
|
||||
bool stickersUpdateNeeded(crl::time now) const {
|
||||
return stickersUpdateNeeded(_lastStickersUpdate, now);
|
||||
}
|
||||
void setLastStickersUpdate(TimeMs update) {
|
||||
void setLastStickersUpdate(crl::time update) {
|
||||
_lastStickersUpdate = update;
|
||||
}
|
||||
bool recentStickersUpdateNeeded(TimeMs now) const {
|
||||
bool recentStickersUpdateNeeded(crl::time now) const {
|
||||
return stickersUpdateNeeded(_lastRecentStickersUpdate, now);
|
||||
}
|
||||
void setLastRecentStickersUpdate(TimeMs update) {
|
||||
void setLastRecentStickersUpdate(crl::time update) {
|
||||
_lastRecentStickersUpdate = update;
|
||||
}
|
||||
bool favedStickersUpdateNeeded(TimeMs now) const {
|
||||
bool favedStickersUpdateNeeded(crl::time now) const {
|
||||
return stickersUpdateNeeded(_lastFavedStickersUpdate, now);
|
||||
}
|
||||
void setLastFavedStickersUpdate(TimeMs update) {
|
||||
void setLastFavedStickersUpdate(crl::time update) {
|
||||
_lastFavedStickersUpdate = update;
|
||||
}
|
||||
bool featuredStickersUpdateNeeded(TimeMs now) const {
|
||||
bool featuredStickersUpdateNeeded(crl::time now) const {
|
||||
return stickersUpdateNeeded(_lastFeaturedStickersUpdate, now);
|
||||
}
|
||||
void setLastFeaturedStickersUpdate(TimeMs update) {
|
||||
void setLastFeaturedStickersUpdate(crl::time update) {
|
||||
_lastFeaturedStickersUpdate = update;
|
||||
}
|
||||
bool savedGifsUpdateNeeded(TimeMs now) const {
|
||||
bool savedGifsUpdateNeeded(crl::time now) const {
|
||||
return stickersUpdateNeeded(_lastSavedGifsUpdate, now);
|
||||
}
|
||||
void setLastSavedGifsUpdate(TimeMs update) {
|
||||
void setLastSavedGifsUpdate(crl::time update) {
|
||||
_lastSavedGifsUpdate = update;
|
||||
}
|
||||
int featuredStickerSetsUnreadCount() const {
|
||||
|
@ -329,7 +329,7 @@ public:
|
|||
int withUnreadDelta,
|
||||
int mutedWithUnreadDelta);
|
||||
|
||||
void selfDestructIn(not_null<HistoryItem*> item, TimeMs delay);
|
||||
void selfDestructIn(not_null<HistoryItem*> item, crl::time delay);
|
||||
|
||||
[[nodiscard]] not_null<PhotoData*> photo(PhotoId id);
|
||||
not_null<PhotoData*> processPhoto(const MTPPhoto &data);
|
||||
|
@ -508,7 +508,7 @@ public:
|
|||
std::optional<bool> silentPosts = std::nullopt);
|
||||
bool notifyIsMuted(
|
||||
not_null<const PeerData*> peer,
|
||||
TimeMs *changesIn = nullptr) const;
|
||||
crl::time *changesIn = nullptr) const;
|
||||
bool notifySilentPosts(not_null<const PeerData*> peer) const;
|
||||
bool notifyMuteUnknown(not_null<const PeerData*> peer) const;
|
||||
bool notifySilentPostsUnknown(not_null<const PeerData*> peer) const;
|
||||
|
@ -634,8 +634,8 @@ private:
|
|||
PhotoData *photo,
|
||||
DocumentData *document);
|
||||
|
||||
bool stickersUpdateNeeded(TimeMs lastUpdate, TimeMs now) const {
|
||||
constexpr auto kStickersUpdateTimeout = TimeMs(3600'000);
|
||||
bool stickersUpdateNeeded(crl::time lastUpdate, crl::time now) const {
|
||||
constexpr auto kStickersUpdateTimeout = crl::time(3600'000);
|
||||
return (lastUpdate == 0)
|
||||
|| (now >= lastUpdate + kStickersUpdateTimeout);
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ private:
|
|||
const NotifySettings &defaultNotifySettings(
|
||||
not_null<const PeerData*> peer) const;
|
||||
void unmuteByFinished();
|
||||
void unmuteByFinishedDelayed(TimeMs delay);
|
||||
void unmuteByFinishedDelayed(crl::time delay);
|
||||
void updateNotifySettingsLocal(not_null<PeerData*> peer);
|
||||
|
||||
template <typename Method>
|
||||
|
@ -661,7 +661,7 @@ private:
|
|||
const MTPMessageMedia &media,
|
||||
TimeId date);
|
||||
|
||||
void step_typings(TimeMs ms, bool timer);
|
||||
void step_typings(crl::time ms, bool timer);
|
||||
|
||||
void setWallpapers(const QVector<MTPWallPaper> &data, int32 hash);
|
||||
|
||||
|
@ -701,11 +701,11 @@ private:
|
|||
|
||||
rpl::event_stream<> _stickersUpdated;
|
||||
rpl::event_stream<> _savedGifsUpdated;
|
||||
TimeMs _lastStickersUpdate = 0;
|
||||
TimeMs _lastRecentStickersUpdate = 0;
|
||||
TimeMs _lastFavedStickersUpdate = 0;
|
||||
TimeMs _lastFeaturedStickersUpdate = 0;
|
||||
TimeMs _lastSavedGifsUpdate = 0;
|
||||
crl::time _lastStickersUpdate = 0;
|
||||
crl::time _lastRecentStickersUpdate = 0;
|
||||
crl::time _lastFavedStickersUpdate = 0;
|
||||
crl::time _lastFeaturedStickersUpdate = 0;
|
||||
crl::time _lastSavedGifsUpdate = 0;
|
||||
rpl::variable<int> _featuredStickerSetsUnreadCount = 0;
|
||||
Stickers::Sets _stickerSets;
|
||||
Stickers::Order _stickerSetsOrder;
|
||||
|
@ -722,7 +722,7 @@ private:
|
|||
std::vector<FullMsgId> _selfDestructItems;
|
||||
|
||||
// When typing in this history started.
|
||||
base::flat_map<not_null<History*>, TimeMs> _sendActions;
|
||||
base::flat_map<not_null<History*>, crl::time> _sendActions;
|
||||
BasicAnimation _a_sendActions;
|
||||
|
||||
std::unordered_map<
|
||||
|
|
|
@ -471,14 +471,14 @@ struct SendAction {
|
|||
};
|
||||
SendAction(
|
||||
Type type,
|
||||
TimeMs until,
|
||||
crl::time until,
|
||||
int progress = 0)
|
||||
: type(type)
|
||||
, until(until)
|
||||
, progress(progress) {
|
||||
}
|
||||
Type type = Type::Typing;
|
||||
TimeMs until = 0;
|
||||
crl::time until = 0;
|
||||
int progress = 0;
|
||||
|
||||
};
|
||||
|
|
|
@ -253,7 +253,7 @@ void DialogsInner::paintRegion(Painter &p, const QRegion ®ion, bool paintingO
|
|||
}
|
||||
const auto activeEntry = _controller->activeChatEntryCurrent();
|
||||
auto fullWidth = getFullWidth();
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
if (_state == State::Default) {
|
||||
if (_a_pinnedShifting.animating()) {
|
||||
_a_pinnedShifting.step(ms, false);
|
||||
|
@ -552,7 +552,7 @@ void DialogsInner::paintPeerSearchResult(
|
|||
bool active,
|
||||
bool selected,
|
||||
bool onlyBackground,
|
||||
TimeMs ms) const {
|
||||
crl::time ms) const {
|
||||
QRect fullRect(0, 0, fullWidth, st::dialogsRowHeight);
|
||||
p.fillRect(fullRect, active ? st::dialogsBgActive : (selected ? st::dialogsBgOver : st::dialogsBg));
|
||||
if (!active) {
|
||||
|
@ -608,7 +608,7 @@ void DialogsInner::paintSearchInChat(
|
|||
Painter &p,
|
||||
int fullWidth,
|
||||
bool onlyBackground,
|
||||
TimeMs ms) const {
|
||||
crl::time ms) const {
|
||||
auto height = searchInChatSkip();
|
||||
|
||||
auto top = st::searchedBarHeight;
|
||||
|
@ -900,7 +900,7 @@ void DialogsInner::checkReorderPinnedStart(QPoint localPosition) {
|
|||
} else {
|
||||
_pinnedOrder = Auth().data().pinnedDialogsOrder();
|
||||
_pinnedRows[_draggingIndex].yadd = anim::value(0, localPosition.y() - _dragStart.y());
|
||||
_pinnedRows[_draggingIndex].animStartTime = getms();
|
||||
_pinnedRows[_draggingIndex].animStartTime = crl::now();
|
||||
_a_pinnedShifting.start();
|
||||
}
|
||||
}
|
||||
|
@ -1007,7 +1007,7 @@ bool DialogsInner::updateReorderPinned(QPoint localPosition) {
|
|||
|
||||
auto yaddWas = _pinnedRows[_draggingIndex].yadd.current();
|
||||
auto shift = 0;
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
auto rowHeight = st::dialogsRowHeight;
|
||||
if (_dragStart.y() > localPosition.y() && _draggingIndex > 0) {
|
||||
shift = -floorclamp(_dragStart.y() - localPosition.y() + (rowHeight / 2), rowHeight, 0, _draggingIndex);
|
||||
|
@ -1054,7 +1054,7 @@ bool DialogsInner::updateReorderPinned(QPoint localPosition) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void DialogsInner::step_pinnedShifting(TimeMs ms, bool timer) {
|
||||
void DialogsInner::step_pinnedShifting(crl::time ms, bool timer) {
|
||||
if (anim::Disabled()) {
|
||||
ms += st::stickersRowDuration;
|
||||
}
|
||||
|
@ -1119,7 +1119,7 @@ void DialogsInner::mousePressReleased(
|
|||
updateReorderIndexGetCount();
|
||||
if (_draggingIndex >= 0) {
|
||||
_pinnedRows[_draggingIndex].yadd.start(0.);
|
||||
_pinnedRows[_draggingIndex].animStartTime = getms();
|
||||
_pinnedRows[_draggingIndex].animStartTime = crl::now();
|
||||
if (!_a_pinnedShifting.animating()) {
|
||||
_a_pinnedShifting.start();
|
||||
}
|
||||
|
|
|
@ -236,12 +236,12 @@ private:
|
|||
bool active,
|
||||
bool selected,
|
||||
bool onlyBackground,
|
||||
TimeMs ms) const;
|
||||
crl::time ms) const;
|
||||
void paintSearchInChat(
|
||||
Painter &p,
|
||||
int fullWidth,
|
||||
bool onlyBackground,
|
||||
TimeMs ms) const;
|
||||
crl::time ms) const;
|
||||
void paintSearchInPeer(
|
||||
Painter &p,
|
||||
not_null<PeerData*> peer,
|
||||
|
@ -283,7 +283,7 @@ private:
|
|||
void stopReorderPinned();
|
||||
int countPinnedIndex(Dialogs::Row *ofRow);
|
||||
void savePinnedOrder();
|
||||
void step_pinnedShifting(TimeMs ms, bool timer);
|
||||
void step_pinnedShifting(crl::time ms, bool timer);
|
||||
void handleChatMigration(not_null<ChatData*> chat);
|
||||
|
||||
not_null<Window::Controller*> _controller;
|
||||
|
@ -310,7 +310,7 @@ private:
|
|||
QPoint _dragStart;
|
||||
struct PinnedRow {
|
||||
anim::value yadd;
|
||||
TimeMs animStartTime = 0;
|
||||
crl::time animStartTime = 0;
|
||||
};
|
||||
std::vector<PinnedRow> _pinnedRows;
|
||||
BasicAnimation _a_pinnedShifting;
|
||||
|
|
|
@ -174,7 +174,7 @@ void paintRow(
|
|||
QDateTime date,
|
||||
int fullWidth,
|
||||
base::flags<Flag> flags,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
PaintItemCallback &&paintItemCallback,
|
||||
PaintCounterCallback &&paintCounterCallback) {
|
||||
const auto supportMode = Auth().supportMode();
|
||||
|
@ -530,7 +530,7 @@ void RowPainter::paint(
|
|||
bool active,
|
||||
bool selected,
|
||||
bool onlyBackground,
|
||||
TimeMs ms) {
|
||||
crl::time ms) {
|
||||
const auto entry = row->entry();
|
||||
const auto history = row->history();
|
||||
const auto peer = history ? history->peer.get() : nullptr;
|
||||
|
@ -669,7 +669,7 @@ void RowPainter::paint(
|
|||
bool active,
|
||||
bool selected,
|
||||
bool onlyBackground,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
bool displayUnreadInfo) {
|
||||
auto item = row->item();
|
||||
auto history = item->history();
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
bool active,
|
||||
bool selected,
|
||||
bool onlyBackground,
|
||||
TimeMs ms);
|
||||
crl::time ms);
|
||||
static void paint(
|
||||
Painter &p,
|
||||
not_null<const FakeRow*> row,
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
bool active,
|
||||
bool selected,
|
||||
bool onlyBackground,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
bool displayUnreadInfo);
|
||||
static QRect sendActionAnimationRect(
|
||||
int animationWidth,
|
||||
|
|
|
@ -31,7 +31,7 @@ void RippleRow::stopLastRipple() {
|
|||
}
|
||||
}
|
||||
|
||||
void RippleRow::paintRipple(Painter &p, int x, int y, int outerWidth, TimeMs ms, const QColor *colorOverride) const {
|
||||
void RippleRow::paintRipple(Painter &p, int x, int y, int outerWidth, crl::time ms, const QColor *colorOverride) const {
|
||||
if (_ripple) {
|
||||
_ripple->paint(p, x, y, outerWidth, ms, colorOverride);
|
||||
if (_ripple->empty()) {
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
void addRipple(QPoint origin, QSize size, Fn<void()> updateCallback);
|
||||
void stopLastRipple();
|
||||
|
||||
void paintRipple(Painter &p, int x, int y, int outerWidth, TimeMs ms, const QColor *colorOverride = nullptr) const;
|
||||
void paintRipple(Painter &p, int x, int y, int outerWidth, crl::time ms, const QColor *colorOverride = nullptr) const;
|
||||
|
||||
private:
|
||||
mutable std::unique_ptr<Ui::RippleAnimation> _ripple;
|
||||
|
|
|
@ -66,7 +66,7 @@ protected:
|
|||
void onStateChanged(State was, StateChangeSource source) override;
|
||||
|
||||
private:
|
||||
void step_radial(TimeMs ms, bool timer);
|
||||
void step_radial(crl::time ms, bool timer);
|
||||
|
||||
QString _text;
|
||||
const style::FlatButton &_st;
|
||||
|
@ -95,7 +95,7 @@ void DialogsWidget::BottomButton::setText(const QString &text) {
|
|||
update();
|
||||
}
|
||||
|
||||
void DialogsWidget::BottomButton::step_radial(TimeMs ms, bool timer) {
|
||||
void DialogsWidget::BottomButton::step_radial(crl::time ms, bool timer) {
|
||||
if (timer && !anim::Disabled() && width() < st::columnMinimalWidthLeft) {
|
||||
update();
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void DialogsWidget::BottomButton::paintEvent(QPaintEvent *e) {
|
|||
p.fillRect(r, over ? _st.overBgColor : _st.bgColor);
|
||||
|
||||
if (!isDisabled()) {
|
||||
paintRipple(p, 0, 0, getms());
|
||||
paintRipple(p, 0, 0, crl::now());
|
||||
}
|
||||
|
||||
p.setFont(over ? _st.overFont : _st.font);
|
||||
|
@ -1430,7 +1430,7 @@ void DialogsWidget::paintEvent(QPaintEvent *e) {
|
|||
if (r != rect()) {
|
||||
p.setClipRect(r);
|
||||
}
|
||||
auto progress = _a_show.current(getms(), 1.);
|
||||
auto progress = _a_show.current(crl::now(), 1.);
|
||||
if (_a_show.animating()) {
|
||||
auto retina = cIntRetinaFactor();
|
||||
auto fromLeft = (_showDirection == Window::SlideDirection::FromLeft);
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace {
|
|||
constexpr auto kUserpicsSliceLimit = 100;
|
||||
constexpr auto kFileChunkSize = 128 * 1024;
|
||||
constexpr auto kFileRequestsCount = 2;
|
||||
constexpr auto kFileNextRequestDelay = TimeMs(20);
|
||||
constexpr auto kFileNextRequestDelay = crl::time(20);
|
||||
constexpr auto kChatsSliceLimit = 100;
|
||||
constexpr auto kMessagesSliceLimit = 100;
|
||||
constexpr auto kTopPeerSliceLimit = 100;
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Export {
|
|||
namespace View {
|
||||
namespace {
|
||||
|
||||
constexpr auto kSaveSettingsTimeout = TimeMs(1000);
|
||||
constexpr auto kSaveSettingsTimeout = crl::time(1000);
|
||||
|
||||
class SuggestBox : public BoxContent {
|
||||
public:
|
||||
|
|
|
@ -246,7 +246,7 @@ void showPeerProfile(not_null<const History*> history) {
|
|||
void showPeerHistory(
|
||||
const PeerId &peer,
|
||||
MsgId msgId) {
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
if (auto m = App::main()) {
|
||||
m->ui_showPeerHistory(
|
||||
peer,
|
||||
|
@ -410,13 +410,13 @@ struct Data {
|
|||
|
||||
Stickers::Sets StickerSets;
|
||||
Stickers::Order StickerSetsOrder;
|
||||
TimeMs LastStickersUpdate = 0;
|
||||
TimeMs LastRecentStickersUpdate = 0;
|
||||
TimeMs LastFavedStickersUpdate = 0;
|
||||
crl::time LastStickersUpdate = 0;
|
||||
crl::time LastRecentStickersUpdate = 0;
|
||||
crl::time LastFavedStickersUpdate = 0;
|
||||
Stickers::Order FeaturedStickerSetsOrder;
|
||||
int FeaturedStickerSetsUnreadCount = 0;
|
||||
base::Observable<void> FeaturedStickerSetsUnreadCountChanged;
|
||||
TimeMs LastFeaturedStickersUpdate = 0;
|
||||
crl::time LastFeaturedStickersUpdate = 0;
|
||||
Stickers::Order ArchivedStickerSetsOrder;
|
||||
|
||||
CircleMasksMap CircleMasks;
|
||||
|
@ -544,13 +544,13 @@ DefineVar(Global, HiddenPinnedMessagesMap, HiddenPinnedMessages);
|
|||
|
||||
DefineVar(Global, Stickers::Sets, StickerSets);
|
||||
DefineVar(Global, Stickers::Order, StickerSetsOrder);
|
||||
DefineVar(Global, TimeMs, LastStickersUpdate);
|
||||
DefineVar(Global, TimeMs, LastRecentStickersUpdate);
|
||||
DefineVar(Global, TimeMs, LastFavedStickersUpdate);
|
||||
DefineVar(Global, crl::time, LastStickersUpdate);
|
||||
DefineVar(Global, crl::time, LastRecentStickersUpdate);
|
||||
DefineVar(Global, crl::time, LastFavedStickersUpdate);
|
||||
DefineVar(Global, Stickers::Order, FeaturedStickerSetsOrder);
|
||||
DefineVar(Global, int, FeaturedStickerSetsUnreadCount);
|
||||
DefineRefVar(Global, base::Observable<void>, FeaturedStickerSetsUnreadCountChanged);
|
||||
DefineVar(Global, TimeMs, LastFeaturedStickersUpdate);
|
||||
DefineVar(Global, crl::time, LastFeaturedStickersUpdate);
|
||||
DefineVar(Global, Stickers::Order, ArchivedStickerSetsOrder);
|
||||
|
||||
DefineRefVar(Global, CircleMasksMap, CircleMasks);
|
||||
|
|
|
@ -99,7 +99,7 @@ void UserCheckbox::setChecked(bool checked, NotifyAboutChange notify) {
|
|||
void UserCheckbox::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
auto active = _check->currentAnimationValue(ms);
|
||||
auto color = anim::color(_st.rippleBg, _st.rippleBgActive, active);
|
||||
paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y() + (_checkRect.y() - st::defaultBoxCheckbox.margin.top()), ms, &color);
|
||||
|
|
|
@ -516,9 +516,9 @@ void InnerWidget::elementAnimationAutoplayAsync(
|
|||
});
|
||||
}
|
||||
|
||||
TimeMs InnerWidget::elementHighlightTime(
|
||||
crl::time InnerWidget::elementHighlightTime(
|
||||
not_null<const HistoryView::Element*> element) {
|
||||
return TimeMs(0);
|
||||
return crl::time(0);
|
||||
}
|
||||
|
||||
bool InnerWidget::elementInSelectionMode() {
|
||||
|
@ -755,7 +755,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
|||
|
||||
Painter p(this);
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
auto clip = e->rect();
|
||||
|
||||
if (_items.empty() && _upLoaded && _downLoaded) {
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
not_null<const HistoryView::Element*> view) override;
|
||||
void elementAnimationAutoplayAsync(
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
TimeMs elementHighlightTime(
|
||||
crl::time elementHighlightTime(
|
||||
not_null<const HistoryView::Element*> element) override;
|
||||
bool elementInSelectionMode() override;
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ void Widget::paintEvent(QPaintEvent *e) {
|
|||
// updateListSize();
|
||||
//}
|
||||
|
||||
//auto ms = getms();
|
||||
//auto ms = crl::now();
|
||||
//_historyDownShown.step(ms);
|
||||
|
||||
SectionWidget::PaintBackground(this, e);
|
||||
|
|
|
@ -536,7 +536,7 @@ void Widget::paintEvent(QPaintEvent *e) {
|
|||
// updateListSize();
|
||||
//}
|
||||
|
||||
const auto ms = getms();
|
||||
const auto ms = crl::now();
|
||||
_scrollDownShown.step(ms);
|
||||
|
||||
SectionWidget::PaintBackground(this, e);
|
||||
|
@ -554,7 +554,7 @@ void Widget::paintEvent(QPaintEvent *e) {
|
|||
p,
|
||||
clip.translated(-left, -top),
|
||||
TextSelection(),
|
||||
getms());
|
||||
crl::now());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ bool History::updateSendActionNeedsAnimating(
|
|||
return false;
|
||||
}
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
switch (action.type()) {
|
||||
case mtpc_sendMessageTypingAction: _typing.insert(user, ms + kStatusShowClientsideTyping); break;
|
||||
case mtpc_sendMessageRecordVideoAction: _sendActions.insert(user, { Type::RecordVideo, ms + kStatusShowClientsideRecordVideo }); break;
|
||||
|
@ -362,7 +362,7 @@ bool History::updateSendActionNeedsAnimating(
|
|||
}
|
||||
|
||||
bool History::mySendActionUpdated(SendAction::Type type, bool doing) {
|
||||
auto ms = getms(true);
|
||||
auto ms = crl::now();
|
||||
auto i = _mySendActions.find(type);
|
||||
if (doing) {
|
||||
if (i == _mySendActions.cend()) {
|
||||
|
@ -391,7 +391,7 @@ bool History::paintSendAction(
|
|||
int availableWidth,
|
||||
int outerWidth,
|
||||
style::color color,
|
||||
TimeMs ms) {
|
||||
crl::time ms) {
|
||||
if (_sendActionAnimation) {
|
||||
_sendActionAnimation.paint(
|
||||
p,
|
||||
|
@ -410,7 +410,7 @@ bool History::paintSendAction(
|
|||
return false;
|
||||
}
|
||||
|
||||
bool History::updateSendActionNeedsAnimating(TimeMs ms, bool force) {
|
||||
bool History::updateSendActionNeedsAnimating(crl::time ms, bool force) {
|
||||
auto changed = force;
|
||||
for (auto i = _typing.begin(), e = _typing.end(); i != e;) {
|
||||
if (ms >= i.value()) {
|
||||
|
@ -1111,15 +1111,15 @@ void History::applyServiceChanges(
|
|||
}
|
||||
|
||||
void History::clearSendAction(not_null<UserData*> from) {
|
||||
auto updateAtMs = TimeMs(0);
|
||||
auto updateAtMs = crl::time(0);
|
||||
auto i = _typing.find(from);
|
||||
if (i != _typing.cend()) {
|
||||
updateAtMs = getms();
|
||||
updateAtMs = crl::now();
|
||||
i.value() = updateAtMs;
|
||||
}
|
||||
auto j = _sendActions.find(from);
|
||||
if (j != _sendActions.cend()) {
|
||||
if (!updateAtMs) updateAtMs = getms();
|
||||
if (!updateAtMs) updateAtMs = crl::now();
|
||||
j.value().until = updateAtMs;
|
||||
}
|
||||
if (updateAtMs) {
|
||||
|
|
|
@ -216,10 +216,10 @@ public:
|
|||
void setHasPendingResizedItems();
|
||||
|
||||
bool mySendActionUpdated(SendAction::Type type, bool doing);
|
||||
bool paintSendAction(Painter &p, int x, int y, int availableWidth, int outerWidth, style::color color, TimeMs ms);
|
||||
bool paintSendAction(Painter &p, int x, int y, int availableWidth, int outerWidth, style::color color, crl::time ms);
|
||||
|
||||
// Interface for Histories
|
||||
bool updateSendActionNeedsAnimating(TimeMs ms, bool force = false);
|
||||
bool updateSendActionNeedsAnimating(crl::time ms, bool force = false);
|
||||
bool updateSendActionNeedsAnimating(
|
||||
not_null<UserData*> user,
|
||||
const MTPSendMessageAction &action);
|
||||
|
@ -488,14 +488,14 @@ private:
|
|||
TimeId _lastSentDraftTime = 0;
|
||||
MessageIdsList _forwardDraft;
|
||||
|
||||
using TypingUsers = QMap<UserData*, TimeMs>;
|
||||
using TypingUsers = QMap<UserData*, crl::time>;
|
||||
TypingUsers _typing;
|
||||
using SendActionUsers = QMap<UserData*, SendAction>;
|
||||
SendActionUsers _sendActions;
|
||||
QString _sendActionString;
|
||||
Text _sendActionText;
|
||||
Ui::SendActionAnimation _sendActionAnimation;
|
||||
QMap<SendAction::Type, TimeMs> _mySendActions;
|
||||
QMap<SendAction::Type, crl::time> _mySendActions;
|
||||
|
||||
std::weak_ptr<AdminLog::LocalIdManager> _adminLogIdManager;
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ void DragArea::setText(const QString &text, const QString &subtext) {
|
|||
void DragArea::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
auto opacity = _a_opacity.current(ms, _hiding ? 0. : 1.);
|
||||
if (!_a_opacity.animating() && _hiding) {
|
||||
return;
|
||||
|
|
|
@ -541,7 +541,7 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
|||
|
||||
Painter p(this);
|
||||
auto clip = e->rect();
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
|
||||
const auto historyDisplayedEmpty = _history->isDisplayedEmpty()
|
||||
&& (!_migrated || _migrated->isDisplayedEmpty());
|
||||
|
@ -766,7 +766,7 @@ bool HistoryInner::eventHook(QEvent *e) {
|
|||
}
|
||||
|
||||
void HistoryInner::onTouchScrollTimer() {
|
||||
auto nowTime = getms();
|
||||
auto nowTime = crl::now();
|
||||
if (_touchScrollState == Ui::TouchScrollState::Acceleration && _touchWaitingAcceleration && (nowTime - _touchAccelerationTime) > 40) {
|
||||
_touchScrollState = Ui::TouchScrollState::Manual;
|
||||
touchResetSpeed();
|
||||
|
@ -787,7 +787,7 @@ void HistoryInner::onTouchScrollTimer() {
|
|||
}
|
||||
|
||||
void HistoryInner::touchUpdateSpeed() {
|
||||
const auto nowTime = getms();
|
||||
const auto nowTime = crl::now();
|
||||
if (_touchPrevPosValid) {
|
||||
const int elapsed = nowTime - _touchSpeedTime;
|
||||
if (elapsed) {
|
||||
|
@ -867,7 +867,7 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
|
|||
if (_touchScrollState == Ui::TouchScrollState::Auto) {
|
||||
_touchScrollState = Ui::TouchScrollState::Acceleration;
|
||||
_touchWaitingAcceleration = true;
|
||||
_touchAccelerationTime = getms();
|
||||
_touchAccelerationTime = crl::now();
|
||||
touchUpdateSpeed();
|
||||
_touchStart = _touchPos;
|
||||
} else {
|
||||
|
@ -892,7 +892,7 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
|
|||
touchScrollUpdated(_touchPos);
|
||||
} else if (_touchScrollState == Ui::TouchScrollState::Acceleration) {
|
||||
touchUpdateSpeed();
|
||||
_touchAccelerationTime = getms();
|
||||
_touchAccelerationTime = crl::now();
|
||||
if (_touchSpeed.isNull()) {
|
||||
_touchScrollState = Ui::TouchScrollState::Manual;
|
||||
}
|
||||
|
@ -914,7 +914,7 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
|
|||
_touchScrollState = Ui::TouchScrollState::Auto;
|
||||
_touchPrevPosValid = false;
|
||||
_touchScrollTimer.start(15);
|
||||
_touchTime = getms();
|
||||
_touchTime = crl::now();
|
||||
} else if (_touchScrollState == Ui::TouchScrollState::Auto) {
|
||||
_touchScrollState = Ui::TouchScrollState::Manual;
|
||||
_touchScroll = false;
|
||||
|
@ -3122,17 +3122,17 @@ not_null<HistoryView::ElementDelegate*> HistoryInner::ElementDelegate() {
|
|||
}
|
||||
});
|
||||
}
|
||||
TimeMs elementHighlightTime(
|
||||
crl::time elementHighlightTime(
|
||||
not_null<const HistoryView::Element*> view) override {
|
||||
const auto fullAnimMs = App::main()->highlightStartTime(
|
||||
view->data());
|
||||
if (fullAnimMs > 0) {
|
||||
const auto now = getms();
|
||||
const auto now = crl::now();
|
||||
if (fullAnimMs < now) {
|
||||
return now - fullAnimMs;
|
||||
}
|
||||
}
|
||||
return TimeMs(0);
|
||||
return crl::time(0);
|
||||
}
|
||||
bool elementInSelectionMode() override {
|
||||
return App::main()->historyInSelectionMode();
|
||||
|
|
|
@ -348,9 +348,9 @@ private:
|
|||
bool _touchPrevPosValid = false;
|
||||
bool _touchWaitingAcceleration = false;
|
||||
QPoint _touchSpeed;
|
||||
TimeMs _touchSpeedTime = 0;
|
||||
TimeMs _touchAccelerationTime = 0;
|
||||
TimeMs _touchTime = 0;
|
||||
crl::time _touchSpeedTime = 0;
|
||||
crl::time _touchAccelerationTime = 0;
|
||||
crl::time _touchTime = 0;
|
||||
QTimer _touchScrollTimer;
|
||||
|
||||
base::unique_qptr<Ui::PopupMenu> _menu;
|
||||
|
|
|
@ -121,7 +121,7 @@ public:
|
|||
void markMediaRead();
|
||||
|
||||
// Zero result means this message is not self-destructing right now.
|
||||
virtual TimeMs getSelfDestructIn(TimeMs now) {
|
||||
virtual crl::time getSelfDestructIn(crl::time now) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -511,7 +511,7 @@ int ReplyKeyboard::naturalHeight() const {
|
|||
return (_rows.size() - 1) * _st->buttonSkip() + _rows.size() * _st->buttonHeight();
|
||||
}
|
||||
|
||||
void ReplyKeyboard::paint(Painter &p, int outerWidth, const QRect &clip, TimeMs ms) const {
|
||||
void ReplyKeyboard::paint(Painter &p, int outerWidth, const QRect &clip, crl::time ms) const {
|
||||
Assert(_st != nullptr);
|
||||
Assert(_width > 0);
|
||||
|
||||
|
@ -609,7 +609,7 @@ void ReplyKeyboard::startAnimation(int i, int j, int direction) {
|
|||
|
||||
_animations.remove(-indexForAnimation);
|
||||
if (!_animations.contains(indexForAnimation)) {
|
||||
_animations.emplace(indexForAnimation, getms());
|
||||
_animations.emplace(indexForAnimation, crl::now());
|
||||
}
|
||||
|
||||
if (notStarted && !_a_selected.animating()) {
|
||||
|
@ -617,7 +617,7 @@ void ReplyKeyboard::startAnimation(int i, int j, int direction) {
|
|||
}
|
||||
}
|
||||
|
||||
void ReplyKeyboard::step_selected(TimeMs ms, bool timer) {
|
||||
void ReplyKeyboard::step_selected(crl::time ms, bool timer) {
|
||||
if (anim::Disabled()) {
|
||||
ms += st::botKbDuration;
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ void ReplyKeyboard::Style::paintButton(
|
|||
Painter &p,
|
||||
int outerWidth,
|
||||
const ReplyKeyboard::Button &button,
|
||||
TimeMs ms) const {
|
||||
crl::time ms) const {
|
||||
const QRect &rect = button.rect;
|
||||
paintButtonBg(p, rect, button.howMuchOver);
|
||||
if (button.ripple) {
|
||||
|
|
|
@ -256,7 +256,7 @@ public:
|
|||
private:
|
||||
const style::BotKeyboardButton *_st;
|
||||
|
||||
void paintButton(Painter &p, int outerWidth, const ReplyKeyboard::Button &button, TimeMs ms) const;
|
||||
void paintButton(Painter &p, int outerWidth, const ReplyKeyboard::Button &button, crl::time ms) const;
|
||||
friend class ReplyKeyboard;
|
||||
|
||||
};
|
||||
|
@ -275,7 +275,7 @@ public:
|
|||
int naturalWidth() const;
|
||||
int naturalHeight() const;
|
||||
|
||||
void paint(Painter &p, int outerWidth, const QRect &clip, TimeMs ms) const;
|
||||
void paint(Painter &p, int outerWidth, const QRect &clip, crl::time ms) const;
|
||||
ClickHandlerPtr getLink(QPoint point) const;
|
||||
|
||||
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active);
|
||||
|
@ -308,14 +308,14 @@ private:
|
|||
|
||||
ButtonCoords findButtonCoordsByClickHandler(const ClickHandlerPtr &p);
|
||||
|
||||
void step_selected(TimeMs ms, bool timer);
|
||||
void step_selected(crl::time ms, bool timer);
|
||||
|
||||
const not_null<const HistoryItem*> _item;
|
||||
int _width = 0;
|
||||
|
||||
std::vector<std::vector<Button>> _rows;
|
||||
|
||||
base::flat_map<int, TimeMs> _animations;
|
||||
base::flat_map<int, crl::time> _animations;
|
||||
BasicAnimation _a_selected;
|
||||
std::unique_ptr<Style> _st;
|
||||
|
||||
|
|
|
@ -580,13 +580,13 @@ void HistoryService::setServiceText(const PreparedText &prepared) {
|
|||
void HistoryService::markMediaAsReadHook() {
|
||||
if (const auto selfdestruct = Get<HistoryServiceSelfDestruct>()) {
|
||||
if (!selfdestruct->destructAt) {
|
||||
selfdestruct->destructAt = getms(true) + selfdestruct->timeToLive;
|
||||
selfdestruct->destructAt = crl::now() + selfdestruct->timeToLive;
|
||||
history()->owner().selfDestructIn(this, selfdestruct->timeToLive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TimeMs HistoryService::getSelfDestructIn(TimeMs now) {
|
||||
crl::time HistoryService::getSelfDestructIn(crl::time now) {
|
||||
if (auto selfdestruct = Get<HistoryServiceSelfDestruct>()) {
|
||||
if (selfdestruct->destructAt > 0) {
|
||||
if (selfdestruct->destructAt <= now) {
|
||||
|
|
|
@ -43,8 +43,8 @@ struct HistoryServiceSelfDestruct
|
|||
Video,
|
||||
};
|
||||
Type type = Type::Photo;
|
||||
TimeMs timeToLive = 0;
|
||||
TimeMs destructAt = 0;
|
||||
crl::time timeToLive = 0;
|
||||
crl::time destructAt = 0;
|
||||
};
|
||||
|
||||
namespace HistoryView {
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
}
|
||||
|
||||
void applyEdition(const MTPDmessageService &message) override;
|
||||
TimeMs getSelfDestructIn(TimeMs now) override;
|
||||
crl::time getSelfDestructIn(crl::time now) override;
|
||||
|
||||
Storage::SharedMediaTypesMask sharedMediaTypes() const override;
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ constexpr auto kSkipRepaintWhileScrollMs = 100;
|
|||
constexpr auto kShowMembersDropdownTimeoutMs = 300;
|
||||
constexpr auto kDisplayEditTimeWarningMs = 300 * 1000;
|
||||
constexpr auto kFullDayInMs = 86400 * 1000;
|
||||
constexpr auto kCancelTypingActionTimeout = TimeMs(5000);
|
||||
constexpr auto kCancelTypingActionTimeout = crl::time(5000);
|
||||
constexpr auto kSaveDraftTimeout = 1000;
|
||||
constexpr auto kSaveDraftAnywayTimeout = 5000;
|
||||
constexpr auto kSaveCloudDraftIdleTimeout = 14000;
|
||||
|
@ -603,7 +603,7 @@ void HistoryWidget::supportShareContact(Support::Contact contact) {
|
|||
}
|
||||
|
||||
void HistoryWidget::scrollToCurrentVoiceMessage(FullMsgId fromId, FullMsgId toId) {
|
||||
if (getms() <= _lastUserScrolled + kScrollToVoiceAfterScrolledMs) {
|
||||
if (crl::now() <= _lastUserScrolled + kScrollToVoiceAfterScrolledMs) {
|
||||
return;
|
||||
}
|
||||
if (!_list) {
|
||||
|
@ -727,7 +727,7 @@ void HistoryWidget::enqueueMessageHighlight(
|
|||
}
|
||||
|
||||
void HistoryWidget::highlightMessage(MsgId universalMessageId) {
|
||||
_highlightStart = getms();
|
||||
_highlightStart = crl::now();
|
||||
_highlightedMessageId = universalMessageId;
|
||||
_highlightTimer.callEach(AnimationTimerDelta);
|
||||
}
|
||||
|
@ -760,14 +760,14 @@ void HistoryWidget::updateHighlightedMessage() {
|
|||
return stopMessageHighlight();
|
||||
}
|
||||
auto duration = st::activeFadeInDuration + st::activeFadeOutDuration;
|
||||
if (getms() - _highlightStart > duration) {
|
||||
if (crl::now() - _highlightStart > duration) {
|
||||
return stopMessageHighlight();
|
||||
}
|
||||
|
||||
Auth().data().requestViewRepaint(view);
|
||||
}
|
||||
|
||||
TimeMs HistoryWidget::highlightStartTime(not_null<const HistoryItem*> item) const {
|
||||
crl::time HistoryWidget::highlightStartTime(not_null<const HistoryItem*> item) const {
|
||||
auto isHighlighted = [this](not_null<const HistoryItem*> item) {
|
||||
if (item->id == _highlightedMessageId) {
|
||||
return (item->history() == _history);
|
||||
|
@ -1027,7 +1027,7 @@ void HistoryWidget::onDraftSaveDelayed() {
|
|||
void HistoryWidget::onDraftSave(bool delayed) {
|
||||
if (!_peer) return;
|
||||
if (delayed) {
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
if (!_saveDraftStart) {
|
||||
_saveDraftStart = ms;
|
||||
return _saveDraftTimer.start(kSaveDraftTimeout);
|
||||
|
@ -2564,7 +2564,7 @@ void HistoryWidget::onScroll() {
|
|||
preloadHistoryIfNeeded();
|
||||
visibleAreaUpdated();
|
||||
if (!_synteticScrollEvent) {
|
||||
_lastUserScrolled = getms();
|
||||
_lastUserScrolled = crl::now();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2616,7 +2616,7 @@ void HistoryWidget::preloadHistoryIfNeeded() {
|
|||
|
||||
auto scrollTop = _scroll->scrollTop();
|
||||
if (scrollTop != _lastScrollTop) {
|
||||
_lastScrolled = getms();
|
||||
_lastScrolled = crl::now();
|
||||
_lastScrollTop = scrollTop;
|
||||
}
|
||||
}
|
||||
|
@ -2827,7 +2827,7 @@ void HistoryWidget::send(Qt::KeyboardModifiers modifiers) {
|
|||
|
||||
clearFieldText();
|
||||
_saveDraftText = true;
|
||||
_saveDraftStart = getms();
|
||||
_saveDraftStart = crl::now();
|
||||
onDraftSave();
|
||||
|
||||
hideSelectorControlsAnimated();
|
||||
|
@ -4525,7 +4525,7 @@ QPixmap HistoryWidget::grabForShowAnimation(
|
|||
}
|
||||
|
||||
bool HistoryWidget::skipItemRepaint() {
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
if (_lastScrolled + kSkipRepaintWhileScrollMs <= ms) {
|
||||
return false;
|
||||
}
|
||||
|
@ -4537,7 +4537,7 @@ bool HistoryWidget::skipItemRepaint() {
|
|||
void HistoryWidget::onUpdateHistoryItems() {
|
||||
if (!_list) return;
|
||||
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
if (_lastScrolled + kSkipRepaintWhileScrollMs <= ms) {
|
||||
_list->update();
|
||||
} else {
|
||||
|
@ -5244,7 +5244,7 @@ void HistoryWidget::sendInlineResult(
|
|||
|
||||
clearFieldText();
|
||||
_saveDraftText = true;
|
||||
_saveDraftStart = getms();
|
||||
_saveDraftStart = crl::now();
|
||||
onDraftSave();
|
||||
|
||||
auto &bots = cRefRecentInlineBots();
|
||||
|
@ -5392,7 +5392,7 @@ bool HistoryWidget::sendExistingDocument(
|
|||
if (_fieldAutocomplete->stickersShown()) {
|
||||
clearFieldText();
|
||||
//_saveDraftText = true;
|
||||
//_saveDraftStart = getms();
|
||||
//_saveDraftStart = crl::now();
|
||||
//onDraftSave();
|
||||
onCloudDraftSave(); // won't be needed if SendInlineBotResult will clear the cloud draft
|
||||
}
|
||||
|
@ -5568,7 +5568,7 @@ void HistoryWidget::replyToMessage(not_null<HistoryItem*> item) {
|
|||
}
|
||||
|
||||
_saveDraftText = true;
|
||||
_saveDraftStart = getms();
|
||||
_saveDraftStart = crl::now();
|
||||
onDraftSave();
|
||||
|
||||
_field->setFocus();
|
||||
|
@ -5638,7 +5638,7 @@ void HistoryWidget::editMessage(not_null<HistoryItem*> item) {
|
|||
updateField();
|
||||
|
||||
_saveDraftText = true;
|
||||
_saveDraftStart = getms();
|
||||
_saveDraftStart = crl::now();
|
||||
onDraftSave();
|
||||
|
||||
_field->setFocus();
|
||||
|
@ -5750,7 +5750,7 @@ bool HistoryWidget::cancelReply(bool lastKeyboardUsed) {
|
|||
}
|
||||
if (wasReply) {
|
||||
_saveDraftText = true;
|
||||
_saveDraftStart = getms();
|
||||
_saveDraftStart = crl::now();
|
||||
onDraftSave();
|
||||
}
|
||||
if (!_editMsgId
|
||||
|
@ -5791,7 +5791,7 @@ void HistoryWidget::cancelEdit() {
|
|||
}
|
||||
|
||||
_saveDraftText = true;
|
||||
_saveDraftStart = getms();
|
||||
_saveDraftStart = crl::now();
|
||||
onDraftSave();
|
||||
|
||||
mouseMoveEvent(nullptr);
|
||||
|
@ -5823,7 +5823,7 @@ void HistoryWidget::onFieldBarCancel() {
|
|||
previewCancel();
|
||||
|
||||
_saveDraftText = true;
|
||||
_saveDraftStart = getms();
|
||||
_saveDraftStart = crl::now();
|
||||
onDraftSave();
|
||||
} else if (_editMsgId) {
|
||||
cancelEdit();
|
||||
|
@ -5940,7 +5940,7 @@ void HistoryWidget::updatePreview() {
|
|||
Ui::DialogTextOptions());
|
||||
|
||||
const auto timeout = (_previewData->pendingTill - unixtime());
|
||||
_previewTimer.callOnce(std::max(timeout, 0) * TimeMs(1000));
|
||||
_previewTimer.callOnce(std::max(timeout, 0) * crl::time(1000));
|
||||
} else {
|
||||
QString title, desc;
|
||||
if (_previewData->siteName.isEmpty()) {
|
||||
|
@ -6497,7 +6497,7 @@ void HistoryWidget::drawPinnedBar(Painter &p) {
|
|||
}
|
||||
}
|
||||
|
||||
bool HistoryWidget::paintShowAnimationFrame(TimeMs ms) {
|
||||
bool HistoryWidget::paintShowAnimationFrame(crl::time ms) {
|
||||
auto progress = _a_show.current(ms, 1.);
|
||||
if (!_a_show.animating()) {
|
||||
return false;
|
||||
|
@ -6523,7 +6523,7 @@ bool HistoryWidget::paintShowAnimationFrame(TimeMs ms) {
|
|||
}
|
||||
|
||||
void HistoryWidget::paintEvent(QPaintEvent *e) {
|
||||
auto ms = getms();
|
||||
auto ms = crl::now();
|
||||
_historyDownShown.step(ms);
|
||||
_unreadMentionsShown.step(ms);
|
||||
if (paintShowAnimationFrame(ms)) {
|
||||
|
|
|
@ -185,7 +185,7 @@ public:
|
|||
bool touchScroll(const QPoint &delta);
|
||||
|
||||
void enqueueMessageHighlight(not_null<HistoryView::Element*> view);
|
||||
TimeMs highlightStartTime(not_null<const HistoryItem*> item) const;
|
||||
crl::time highlightStartTime(not_null<const HistoryItem*> item) const;
|
||||
bool inSelectionMode() const;
|
||||
|
||||
MessageIdsList getSelectedItems() const;
|
||||
|
@ -549,7 +549,7 @@ private:
|
|||
void drawRecording(Painter &p, float64 recordActive);
|
||||
void drawPinnedBar(Painter &p);
|
||||
void drawRestrictedWrite(Painter &p, const QString &error);
|
||||
bool paintShowAnimationFrame(TimeMs ms);
|
||||
bool paintShowAnimationFrame(crl::time ms);
|
||||
|
||||
void updateMouseTracking();
|
||||
|
||||
|
@ -701,10 +701,10 @@ private:
|
|||
int _addToScroll = 0;
|
||||
|
||||
int _lastScrollTop = 0; // gifs optimization
|
||||
TimeMs _lastScrolled = 0;
|
||||
crl::time _lastScrolled = 0;
|
||||
QTimer _updateHistoryItems;
|
||||
|
||||
TimeMs _lastUserScrolled = 0;
|
||||
crl::time _lastUserScrolled = 0;
|
||||
bool _synteticScrollEvent = false;
|
||||
Animation _scrollToAnimation;
|
||||
|
||||
|
@ -806,12 +806,12 @@ private:
|
|||
MsgId _highlightedMessageId = 0;
|
||||
std::deque<MsgId> _highlightQueue;
|
||||
base::Timer _highlightTimer;
|
||||
TimeMs _highlightStart = 0;
|
||||
crl::time _highlightStart = 0;
|
||||
|
||||
QMap<QPair<not_null<History*>, SendAction::Type>, mtpRequestId> _sendActionRequests;
|
||||
base::Timer _sendActionStopTimer;
|
||||
|
||||
TimeMs _saveDraftStart = 0;
|
||||
crl::time _saveDraftStart = 0;
|
||||
bool _saveDraftText = false;
|
||||
QTimer _saveDraftTimer, _saveCloudDraftTimer;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
Painter &p,
|
||||
const QRect &r,
|
||||
TextSelection selection,
|
||||
TimeMs ms) const = 0;
|
||||
crl::time ms) const = 0;
|
||||
[[nodiscard]] virtual PointState pointState(QPoint point) const;
|
||||
[[nodiscard]] virtual TextState textState(
|
||||
QPoint point,
|
||||
|
@ -141,7 +141,7 @@ public:
|
|||
Painter &p,
|
||||
const QRect &clip,
|
||||
TextSelection selection,
|
||||
TimeMs ms,
|
||||
crl::time ms,
|
||||
const QRect &geometry,
|
||||
RectParts corners,
|
||||
not_null<uint64*> cacheKey,
|
||||
|
|
|
@ -63,7 +63,7 @@ QSize HistoryCall::countOptimalSize() {
|
|||
return { maxWidth, minHeight };
|
||||
}
|
||||
|
||||
void HistoryCall::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
|
||||
void HistoryCall::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms) const {
|
||||
if (width() < st::msgPadding.left() + st::msgPadding.right() + 1) return;
|
||||
auto paintx = 0, painty = 0, paintw = width(), painth = height();
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue