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