mirror of https://github.com/procxx/kepka.git
Replace non-standard types with Qt equivalents
This commit is contained in:
parent
941b306f7a
commit
e9184f9ab5
|
@ -121,7 +121,7 @@ void ApiWrap::addLocalChangelogs(int oldAppVersion) {
|
|||
}
|
||||
}
|
||||
|
||||
void ApiWrap::applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId) {
|
||||
void ApiWrap::applyUpdates(const MTPUpdates &updates, quint64 sentMessageRandomId) {
|
||||
App::main()->feedUpdates(updates, sentMessageRandomId);
|
||||
}
|
||||
|
||||
|
@ -796,7 +796,7 @@ void ApiWrap::unblockParticipant(PeerData *peer, UserData *user) {
|
|||
}
|
||||
}
|
||||
|
||||
void ApiWrap::scheduleStickerSetRequest(uint64 setId, uint64 access) {
|
||||
void ApiWrap::scheduleStickerSetRequest(quint64 setId, quint64 access) {
|
||||
if (!_stickerSetRequests.contains(setId)) {
|
||||
_stickerSetRequests.insert(setId, qMakePair(access, 0));
|
||||
}
|
||||
|
@ -1274,7 +1274,7 @@ PeerData *ApiWrap::notifySettingReceived(MTPInputNotifyPeer notifyPeer, const MT
|
|||
return requestedPeer;
|
||||
}
|
||||
|
||||
void ApiWrap::gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result) {
|
||||
void ApiWrap::gotStickerSet(quint64 setId, const MTPmessages_StickerSet &result) {
|
||||
_stickerSetRequests.remove(setId);
|
||||
Stickers::FeedSetFull(result);
|
||||
}
|
||||
|
@ -1302,13 +1302,13 @@ void ApiWrap::clearWebPageRequests() {
|
|||
|
||||
void ApiWrap::resolveWebPages() {
|
||||
auto ids = QVector<MTPint>(); // temp_req_id = -1
|
||||
using IndexAndMessageIds = QPair<int32, QVector<MTPint>>;
|
||||
using IndexAndMessageIds = QPair<qint32, QVector<MTPint>>;
|
||||
using MessageIdsByChannel = QMap<ChannelData*, IndexAndMessageIds>;
|
||||
MessageIdsByChannel idsByChannel; // temp_req_id = -index - 2
|
||||
|
||||
auto &items = App::webPageItems();
|
||||
ids.reserve(_webPagesPending.size());
|
||||
int32 t = unixtime(), m = INT_MAX;
|
||||
qint32 t = unixtime(), m = INT_MAX;
|
||||
for (auto i = _webPagesPending.begin(); i != _webPagesPending.cend(); ++i) {
|
||||
if (i.value() > 0) continue;
|
||||
if (i.key()->pendingTill <= t) {
|
||||
|
@ -1405,13 +1405,13 @@ void ApiWrap::gotWebPages(ChannelData *channel, const MTPmessages_Messages &msgs
|
|||
}
|
||||
|
||||
if (!v) return;
|
||||
QMap<uint64, int32> msgsIds; // copied from feedMsgs
|
||||
for (int32 i = 0, l = v->size(); i < l; ++i) {
|
||||
QMap<quint64, qint32> msgsIds; // copied from feedMsgs
|
||||
for (qint32 i = 0, l = v->size(); i < l; ++i) {
|
||||
const auto &msg(v->at(i));
|
||||
switch (msg.type()) {
|
||||
case mtpc_message: msgsIds.insert((uint64(uint32(msg.c_message().vid.v)) << 32) | uint64(i), i); break;
|
||||
case mtpc_messageEmpty: msgsIds.insert((uint64(uint32(msg.c_messageEmpty().vid.v)) << 32) | uint64(i), i); break;
|
||||
case mtpc_messageService: msgsIds.insert((uint64(uint32(msg.c_messageService().vid.v)) << 32) | uint64(i), i); break;
|
||||
case mtpc_message: msgsIds.insert((quint64(quint32(msg.c_message().vid.v)) << 32) | quint64(i), i); break;
|
||||
case mtpc_messageEmpty: msgsIds.insert((quint64(quint32(msg.c_messageEmpty().vid.v)) << 32) | quint64(i), i); break;
|
||||
case mtpc_messageService: msgsIds.insert((quint64(quint32(msg.c_messageService().vid.v)) << 32) | quint64(i), i); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
ApiWrap(not_null<AuthSession*> session);
|
||||
|
||||
void start();
|
||||
void applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId = 0);
|
||||
void applyUpdates(const MTPUpdates &updates, quint64 sentMessageRandomId = 0);
|
||||
|
||||
using RequestMessageDataCallback = base::lambda<void(ChannelData*, MsgId)>;
|
||||
void requestMessageData(ChannelData *channel, MsgId msgId, RequestMessageDataCallback callback);
|
||||
|
@ -71,7 +71,7 @@ public:
|
|||
void clearWebPageRequest(WebPageData *page);
|
||||
void clearWebPageRequests();
|
||||
|
||||
void scheduleStickerSetRequest(uint64 setId, uint64 access);
|
||||
void scheduleStickerSetRequest(quint64 setId, quint64 access);
|
||||
void requestStickerSets();
|
||||
void saveStickerSets(const Stickers::Order &localOrder, const Stickers::Order &localRemoved);
|
||||
void updateStickers();
|
||||
|
@ -139,7 +139,7 @@ private:
|
|||
void lastParticipantsDone(ChannelData *peer, const MTPchannels_ChannelParticipants &result, mtpRequestId req);
|
||||
void resolveWebPages();
|
||||
void gotWebPages(ChannelData *channel, const MTPmessages_Messages &result, mtpRequestId req);
|
||||
void gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result);
|
||||
void gotStickerSet(quint64 setId, const MTPmessages_StickerSet &result);
|
||||
|
||||
PeerData *notifySettingReceived(MTPInputNotifyPeer peer, const MTPPeerNotifySettings &settings);
|
||||
|
||||
|
@ -180,7 +180,7 @@ private:
|
|||
QMap<WebPageData*, mtpRequestId> _webPagesPending;
|
||||
base::Timer _webPagesTimer;
|
||||
|
||||
QMap<uint64, QPair<uint64, mtpRequestId> > _stickerSetRequests;
|
||||
QMap<quint64, QPair<quint64, mtpRequestId> > _stickerSetRequests;
|
||||
|
||||
QMap<ChannelData*, mtpRequestId> _channelAmInRequests;
|
||||
QMap<UserData*, mtpRequestId> _blockRequests;
|
||||
|
|
|
@ -91,10 +91,10 @@ namespace {
|
|||
using ChannelMsgsData = QMap<ChannelId, MsgsData>;
|
||||
ChannelMsgsData channelMsgsData;
|
||||
|
||||
using RandomData = QMap<uint64, FullMsgId>;
|
||||
using RandomData = QMap<quint64, FullMsgId>;
|
||||
RandomData randomData;
|
||||
|
||||
using SentData = QMap<uint64, QPair<PeerId, QString>>;
|
||||
using SentData = QMap<quint64, QPair<PeerId, QString>>;
|
||||
SentData sentData;
|
||||
|
||||
HistoryItem *hoveredItem = nullptr,
|
||||
|
@ -111,7 +111,7 @@ namespace {
|
|||
QPixmap p[4];
|
||||
};
|
||||
QVector<CornersPixmaps> corners;
|
||||
using CornersMap = QMap<uint32, CornersPixmaps>;
|
||||
using CornersMap = QMap<quint32, CornersPixmaps>;
|
||||
CornersMap cornersMap;
|
||||
QImage cornersMaskLarge[4], cornersMaskSmall[4];
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace {
|
|||
EmojiImagesMap MainEmojiMap;
|
||||
QMap<int, EmojiImagesMap> OtherEmojiMap;
|
||||
|
||||
int32 serviceImageCacheSize = 0;
|
||||
qint32 serviceImageCacheSize = 0;
|
||||
|
||||
using LastPhotosList = QLinkedList<PhotoData*>;
|
||||
LastPhotosList lastPhotos;
|
||||
|
@ -145,8 +145,8 @@ namespace App {
|
|||
QString result;
|
||||
result.reserve(number.size() + groups.size() + 1);
|
||||
result.append('+');
|
||||
int32 sum = 0;
|
||||
for (int32 i = 0, l = groups.size(); i < l; ++i) {
|
||||
qint32 sum = 0;
|
||||
for (qint32 i = 0, l = groups.size(); i < l; ++i) {
|
||||
result.append(number.midRef(sum, groups.at(i)));
|
||||
sum += groups.at(i);
|
||||
if (sum < number.size()) result.append(' ');
|
||||
|
@ -227,17 +227,17 @@ namespace {
|
|||
|
||||
case -2: {
|
||||
QDate yesterday(date(now).date());
|
||||
return int32(QDateTime(yesterday.addDays(-3)).toTime_t()) + (unixtime() - myunixtime());
|
||||
return qint32(QDateTime(yesterday.addDays(-3)).toTime_t()) + (unixtime() - myunixtime());
|
||||
} break;
|
||||
|
||||
case -3: {
|
||||
QDate weekago(date(now).date());
|
||||
return int32(QDateTime(weekago.addDays(-7)).toTime_t()) + (unixtime() - myunixtime());
|
||||
return qint32(QDateTime(weekago.addDays(-7)).toTime_t()) + (unixtime() - myunixtime());
|
||||
} break;
|
||||
|
||||
case -4: {
|
||||
QDate monthago(date(now).date());
|
||||
return int32(QDateTime(monthago.addDays(-30)).toTime_t()) + (unixtime() - myunixtime());
|
||||
return qint32(QDateTime(monthago.addDays(-30)).toTime_t()) + (unixtime() - myunixtime());
|
||||
} break;
|
||||
}
|
||||
return -online;
|
||||
|
@ -245,14 +245,14 @@ namespace {
|
|||
return online;
|
||||
}
|
||||
|
||||
int32 onlineWillChangeIn(UserData *user, TimeId now) {
|
||||
qint32 onlineWillChangeIn(UserData *user, TimeId now) {
|
||||
if (isServiceUser(user->id) || user->botInfo) {
|
||||
return 86400;
|
||||
}
|
||||
return onlineWillChangeIn(user->onlineTill, now);
|
||||
}
|
||||
|
||||
int32 onlineWillChangeIn(TimeId online, TimeId now) {
|
||||
qint32 onlineWillChangeIn(TimeId online, TimeId now) {
|
||||
if (online <= 0) {
|
||||
if (-online > now) return -online - now;
|
||||
return 86400;
|
||||
|
@ -260,11 +260,11 @@ namespace {
|
|||
if (online > now) {
|
||||
return online - now;
|
||||
}
|
||||
int32 minutes = (now - online) / 60;
|
||||
qint32 minutes = (now - online) / 60;
|
||||
if (minutes < 60) {
|
||||
return (minutes + 1) * 60 - (now - online);
|
||||
}
|
||||
int32 hours = (now - online) / 3600;
|
||||
qint32 hours = (now - online) / 3600;
|
||||
if (hours < 12) {
|
||||
return (hours + 1) * 3600 - (now - online);
|
||||
}
|
||||
|
@ -307,13 +307,13 @@ namespace {
|
|||
}
|
||||
return lng_status_lastseen_date_time(lt_date, dOnline.date().toString(qsl("dd.MM.yy")), lt_time, dOnline.time().toString(cTimeFormat()));
|
||||
}
|
||||
int32 minutes = (now - online) / 60;
|
||||
qint32 minutes = (now - online) / 60;
|
||||
if (!minutes) {
|
||||
return lang(lng_status_lastseen_now);
|
||||
} else if (minutes < 60) {
|
||||
return lng_status_lastseen_minutes(lt_count, minutes);
|
||||
}
|
||||
int32 hours = (now - online) / 3600;
|
||||
qint32 hours = (now - online) / 3600;
|
||||
if (hours < 12) {
|
||||
return lng_status_lastseen_hours(lt_count, hours);
|
||||
}
|
||||
|
@ -790,12 +790,12 @@ namespace {
|
|||
chat->version = d.vversion.v;
|
||||
auto &v = d.vparticipants.v;
|
||||
chat->count = v.size();
|
||||
int32 pversion = chat->participants.isEmpty() ? 1 : (chat->participants.begin().value() + 1);
|
||||
qint32 pversion = chat->participants.isEmpty() ? 1 : (chat->participants.begin().value() + 1);
|
||||
chat->invitedByMe.clear();
|
||||
chat->admins.clear();
|
||||
chat->flags &= ~MTPDchat::Flag::f_admin;
|
||||
for (auto i = v.cbegin(), e = v.cend(); i != e; ++i) {
|
||||
int32 uid = 0, inviter = 0;
|
||||
qint32 uid = 0, inviter = 0;
|
||||
switch (i->type()) {
|
||||
case mtpc_chatParticipantCreator: {
|
||||
const auto &p(i->c_chatParticipantCreator());
|
||||
|
@ -835,7 +835,7 @@ namespace {
|
|||
if (!chat->participants.isEmpty()) {
|
||||
History *h = App::historyLoaded(chat->id);
|
||||
bool found = !h || !h->lastKeyboardFrom;
|
||||
int32 botStatus = -1;
|
||||
qint32 botStatus = -1;
|
||||
for (auto i = chat->participants.begin(), e = chat->participants.end(); i != e;) {
|
||||
if (i.value() < pversion) {
|
||||
i = chat->participants.erase(i);
|
||||
|
@ -934,7 +934,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
if (chat->botStatus > 0 && user->botInfo) {
|
||||
int32 botStatus = -1;
|
||||
qint32 botStatus = -1;
|
||||
for (auto j = chat->participants.cbegin(), e = chat->participants.cend(); j != e; ++j) {
|
||||
if (j.key()->botInfo) {
|
||||
if (true || botStatus > 0/* || !j.key()->botInfo->readsAllHistory*/) {
|
||||
|
@ -1060,7 +1060,7 @@ namespace {
|
|||
|
||||
void addSavedGif(DocumentData *doc) {
|
||||
SavedGifs &saved(cRefSavedGifs());
|
||||
int32 index = saved.indexOf(doc);
|
||||
qint32 index = saved.indexOf(doc);
|
||||
if (index) {
|
||||
if (index > 0) saved.remove(index);
|
||||
saved.push_front(doc);
|
||||
|
@ -1086,8 +1086,8 @@ namespace {
|
|||
}
|
||||
|
||||
void feedMsgs(const QVector<MTPMessage> &msgs, NewMessageType type) {
|
||||
QMap<uint64, int32> msgsIds;
|
||||
for (int32 i = 0, l = msgs.size(); i < l; ++i) {
|
||||
QMap<quint64, qint32> msgsIds;
|
||||
for (qint32 i = 0, l = msgs.size(); i < l; ++i) {
|
||||
const auto &msg(msgs.at(i));
|
||||
switch (msg.type()) {
|
||||
case mtpc_message: {
|
||||
|
@ -1100,14 +1100,14 @@ namespace {
|
|||
}
|
||||
}
|
||||
if (needToAdd) {
|
||||
msgsIds.insert((uint64(uint32(d.vid.v)) << 32) | uint64(i), i);
|
||||
msgsIds.insert((quint64(quint32(d.vid.v)) << 32) | quint64(i), i);
|
||||
}
|
||||
} break;
|
||||
case mtpc_messageEmpty: msgsIds.insert((uint64(uint32(msg.c_messageEmpty().vid.v)) << 32) | uint64(i), i); break;
|
||||
case mtpc_messageService: msgsIds.insert((uint64(uint32(msg.c_messageService().vid.v)) << 32) | uint64(i), i); break;
|
||||
case mtpc_messageEmpty: msgsIds.insert((quint64(quint32(msg.c_messageEmpty().vid.v)) << 32) | quint64(i), i); break;
|
||||
case mtpc_messageService: msgsIds.insert((quint64(quint32(msg.c_messageService().vid.v)) << 32) | quint64(i), i); break;
|
||||
}
|
||||
}
|
||||
for (QMap<uint64, int32>::const_iterator i = msgsIds.cbegin(), e = msgsIds.cend(); i != e; ++i) {
|
||||
for (QMap<quint64, qint32>::const_iterator i = msgsIds.cbegin(), e = msgsIds.cend(); i != e; ++i) {
|
||||
histories().addNewMessage(msgs.at(i.value()), type);
|
||||
}
|
||||
}
|
||||
|
@ -1140,7 +1140,7 @@ namespace {
|
|||
return ImagePtr();
|
||||
}
|
||||
|
||||
StorageImageLocation imageLocation(int32 w, int32 h, const MTPFileLocation &loc) {
|
||||
StorageImageLocation imageLocation(qint32 w, qint32 h, const MTPFileLocation &loc) {
|
||||
if (loc.type() == mtpc_fileLocation) {
|
||||
const auto &l(loc.c_fileLocation());
|
||||
return StorageImageLocation(w, h, l.vdc_id.v, l.vvolume_id.v, l.vlocal_id.v, l.vsecret.v);
|
||||
|
@ -1279,9 +1279,9 @@ namespace {
|
|||
|
||||
PhotoData *feedPhoto(const MTPPhoto &photo, const PreparedPhotoThumbs &thumbs) {
|
||||
const QPixmap *thumb = 0, *medium = 0, *full = 0;
|
||||
int32 thumbLevel = -1, mediumLevel = -1, fullLevel = -1;
|
||||
qint32 thumbLevel = -1, mediumLevel = -1, fullLevel = -1;
|
||||
for (PreparedPhotoThumbs::const_iterator i = thumbs.cbegin(), e = thumbs.cend(); i != e; ++i) {
|
||||
int32 newThumbLevel = -1, newMediumLevel = -1, newFullLevel = -1;
|
||||
qint32 newThumbLevel = -1, newMediumLevel = -1, newFullLevel = -1;
|
||||
switch (i.key()) {
|
||||
case 's': newThumbLevel = 0; newMediumLevel = 5; newFullLevel = 4; break; // box 100x100
|
||||
case 'm': newThumbLevel = 2; newMediumLevel = 0; newFullLevel = 3; break; // box 320x320
|
||||
|
@ -1325,7 +1325,7 @@ namespace {
|
|||
PhotoData *feedPhoto(const MTPDphoto &photo, PhotoData *convert) {
|
||||
auto &sizes = photo.vsizes.v;
|
||||
const MTPPhotoSize *thumb = 0, *medium = 0, *full = 0;
|
||||
int32 thumbLevel = -1, mediumLevel = -1, fullLevel = -1;
|
||||
qint32 thumbLevel = -1, mediumLevel = -1, fullLevel = -1;
|
||||
for (QVector<MTPPhotoSize>::const_iterator i = sizes.cbegin(), e = sizes.cend(); i != e; ++i) {
|
||||
char size = 0;
|
||||
switch (i->type()) {
|
||||
|
@ -1341,7 +1341,7 @@ namespace {
|
|||
}
|
||||
if (!size) continue;
|
||||
|
||||
int32 newThumbLevel = -1, newMediumLevel = -1, newFullLevel = -1;
|
||||
qint32 newThumbLevel = -1, newMediumLevel = -1, newFullLevel = -1;
|
||||
switch (size) {
|
||||
case 's': newThumbLevel = 0; newMediumLevel = 5; newFullLevel = 4; break; // box 100x100
|
||||
case 'm': newThumbLevel = 2; newMediumLevel = 0; newFullLevel = 3; break; // box 320x320
|
||||
|
@ -1515,7 +1515,7 @@ namespace {
|
|||
return i.value();
|
||||
}
|
||||
|
||||
PhotoData *photoSet(const PhotoId &photo, PhotoData *convert, const uint64 &access, int32 date, const ImagePtr &thumb, const ImagePtr &medium, const ImagePtr &full) {
|
||||
PhotoData *photoSet(const PhotoId &photo, PhotoData *convert, const quint64 &access, qint32 date, const ImagePtr &thumb, const ImagePtr &medium, const ImagePtr &full) {
|
||||
if (convert) {
|
||||
if (convert->id != photo) {
|
||||
PhotosData::iterator i = ::photosData.find(convert->id);
|
||||
|
@ -1576,7 +1576,7 @@ namespace {
|
|||
return i.value();
|
||||
}
|
||||
|
||||
DocumentData *documentSet(const DocumentId &document, DocumentData *convert, const uint64 &access, int32 version, int32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size, const StorageImageLocation &thumbLocation) {
|
||||
DocumentData *documentSet(const DocumentId &document, DocumentData *convert, const quint64 &access, qint32 version, qint32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, qint32 dc, qint32 size, const StorageImageLocation &thumbLocation) {
|
||||
bool versionChanged = false;
|
||||
bool sentSticker = false;
|
||||
if (convert) {
|
||||
|
@ -1698,7 +1698,7 @@ namespace {
|
|||
return i.value();
|
||||
}
|
||||
|
||||
WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const TextWithEntities &description, PhotoData *photo, DocumentData *document, int32 duration, const QString &author, int32 pendingTill) {
|
||||
WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const TextWithEntities &description, PhotoData *photo, DocumentData *document, qint32 duration, const QString &author, qint32 pendingTill) {
|
||||
if (convert) {
|
||||
if (convert->id != webPage) {
|
||||
auto i = webPagesData.find(convert->id);
|
||||
|
@ -1770,7 +1770,7 @@ namespace {
|
|||
return i.value();
|
||||
}
|
||||
|
||||
GameData *gameSet(const GameId &game, GameData *convert, const uint64 &accessHash, const QString &shortName, const QString &title, const QString &description, PhotoData *photo, DocumentData *document) {
|
||||
GameData *gameSet(const GameId &game, GameData *convert, const quint64 &accessHash, const QString &shortName, const QString &title, const QString &description, PhotoData *photo, DocumentData *document) {
|
||||
if (convert) {
|
||||
if (convert->id != game) {
|
||||
auto i = gamesData.find(convert->id);
|
||||
|
@ -1863,7 +1863,7 @@ namespace {
|
|||
return ::histories.findOrInsert(peer);
|
||||
}
|
||||
|
||||
History *historyFromDialog(const PeerId &peer, int32 unreadCnt, int32 maxInboxRead, int32 maxOutboxRead) {
|
||||
History *historyFromDialog(const PeerId &peer, qint32 unreadCnt, qint32 maxInboxRead, qint32 maxOutboxRead) {
|
||||
return ::histories.findOrInsert(peer, unreadCnt, maxInboxRead, maxOutboxRead);
|
||||
}
|
||||
|
||||
|
@ -2057,15 +2057,15 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
void historyRegRandom(uint64 randomId, const FullMsgId &itemId) {
|
||||
void historyRegRandom(quint64 randomId, const FullMsgId &itemId) {
|
||||
randomData.insert(randomId, itemId);
|
||||
}
|
||||
|
||||
void historyUnregRandom(uint64 randomId) {
|
||||
void historyUnregRandom(quint64 randomId) {
|
||||
randomData.remove(randomId);
|
||||
}
|
||||
|
||||
FullMsgId histItemByRandom(uint64 randomId) {
|
||||
FullMsgId histItemByRandom(quint64 randomId) {
|
||||
RandomData::const_iterator i = randomData.constFind(randomId);
|
||||
if (i != randomData.cend()) {
|
||||
return i.value();
|
||||
|
@ -2073,23 +2073,23 @@ namespace {
|
|||
return FullMsgId();
|
||||
}
|
||||
|
||||
void historyRegSentData(uint64 randomId, const PeerId &peerId, const QString &text) {
|
||||
void historyRegSentData(quint64 randomId, const PeerId &peerId, const QString &text) {
|
||||
sentData.insert(randomId, qMakePair(peerId, text));
|
||||
}
|
||||
|
||||
void historyUnregSentData(uint64 randomId) {
|
||||
void historyUnregSentData(quint64 randomId) {
|
||||
sentData.remove(randomId);
|
||||
}
|
||||
|
||||
void histSentDataByItem(uint64 randomId, PeerId &peerId, QString &text) {
|
||||
void histSentDataByItem(quint64 randomId, PeerId &peerId, QString &text) {
|
||||
QPair<PeerId, QString> d = sentData.value(randomId);
|
||||
peerId = d.first;
|
||||
text = d.second;
|
||||
}
|
||||
|
||||
void prepareCorners(RoundCorners index, int32 radius, const QBrush &brush, const style::color *shadow = nullptr, QImage *cors = nullptr) {
|
||||
void prepareCorners(RoundCorners index, qint32 radius, const QBrush &brush, const style::color *shadow = nullptr, QImage *cors = nullptr) {
|
||||
Expects(::corners.size() > index);
|
||||
int32 r = radius * cIntRetinaFactor(), s = st::msgShadow * cIntRetinaFactor();
|
||||
qint32 r = radius * cIntRetinaFactor(), s = st::msgShadow * cIntRetinaFactor();
|
||||
QImage rect(r * 3, r * 3 + (shadow ? s : 0), QImage::Format_ARGB32_Premultiplied), localCors[4];
|
||||
{
|
||||
Painter p(&rect);
|
||||
|
@ -2336,7 +2336,7 @@ namespace {
|
|||
return *::emojiLarge;
|
||||
}
|
||||
|
||||
const QPixmap &emojiSingle(EmojiPtr emoji, int32 fontHeight) {
|
||||
const QPixmap &emojiSingle(EmojiPtr emoji, qint32 fontHeight) {
|
||||
auto &map = (fontHeight == st::msgFont->height) ? MainEmojiMap : OtherEmojiMap[fontHeight];
|
||||
auto i = map.constFind(emoji->index());
|
||||
if (i == map.cend()) {
|
||||
|
@ -2353,7 +2353,7 @@ namespace {
|
|||
}
|
||||
|
||||
void checkImageCacheSize() {
|
||||
int64 nowImageCacheSize = imageCacheSize();
|
||||
qint64 nowImageCacheSize = imageCacheSize();
|
||||
if (nowImageCacheSize > serviceImageCacheSize + MemoryForImageCache) {
|
||||
App::forgetMedia();
|
||||
serviceImageCacheSize = imageCacheSize();
|
||||
|
@ -2533,7 +2533,7 @@ namespace {
|
|||
return ::gameItems;
|
||||
}
|
||||
|
||||
void regSharedContactItem(int32 userId, HistoryItem *item) {
|
||||
void regSharedContactItem(qint32 userId, HistoryItem *item) {
|
||||
auto user = App::userLoaded(userId);
|
||||
auto canShareThisContact = user ? user->canShareThisContact() : false;
|
||||
::sharedContactItems[userId].insert(item);
|
||||
|
@ -2542,7 +2542,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
void unregSharedContactItem(int32 userId, HistoryItem *item) {
|
||||
void unregSharedContactItem(qint32 userId, HistoryItem *item) {
|
||||
auto user = App::userLoaded(userId);
|
||||
auto canShareThisContact = user ? user->canShareThisContact() : false;
|
||||
::sharedContactItems[userId].remove(item);
|
||||
|
@ -2576,7 +2576,7 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
QString phoneFromSharedContact(int32 userId) {
|
||||
QString phoneFromSharedContact(qint32 userId) {
|
||||
auto i = ::sharedContactItems.constFind(userId);
|
||||
if (i != ::sharedContactItems.cend() && !i->isEmpty()) {
|
||||
if (auto media = (*i->cbegin())->getMedia()) {
|
||||
|
@ -2588,7 +2588,7 @@ namespace {
|
|||
return QString();
|
||||
}
|
||||
|
||||
void regMuted(PeerData *peer, int32 changeIn) {
|
||||
void regMuted(PeerData *peer, qint32 changeIn) {
|
||||
::mutedPeers.insert(peer, true);
|
||||
if (App::main()) App::main()->updateMutedIn(changeIn);
|
||||
}
|
||||
|
@ -2598,9 +2598,9 @@ namespace {
|
|||
}
|
||||
|
||||
void updateMuted() {
|
||||
int32 changeInMin = 0;
|
||||
qint32 changeInMin = 0;
|
||||
for (MutedPeers::iterator i = ::mutedPeers.begin(); i != ::mutedPeers.end();) {
|
||||
int32 changeIn = 0;
|
||||
qint32 changeIn = 0;
|
||||
History *h = App::history(i.key()->id);
|
||||
if (isNotifyMuted(i.key()->notify, &changeIn)) {
|
||||
h->setMute(true);
|
||||
|
@ -2695,7 +2695,7 @@ namespace {
|
|||
return ::cornersMaskSmall;
|
||||
}
|
||||
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, const CornersPixmaps &corner, const style::color *shadow, RectParts parts) {
|
||||
void roundRect(Painter &p, qint32 x, qint32 y, qint32 w, qint32 h, style::color bg, const CornersPixmaps &corner, const style::color *shadow, RectParts parts) {
|
||||
auto cornerWidth = corner.p[0].width() / cIntRetinaFactor();
|
||||
auto cornerHeight = corner.p[0].height() / cIntRetinaFactor();
|
||||
if (w < 2 * cornerWidth || h < 2 * cornerHeight) return;
|
||||
|
@ -2739,11 +2739,11 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, RoundCorners index, const style::color *shadow, RectParts parts) {
|
||||
void roundRect(Painter &p, qint32 x, qint32 y, qint32 w, qint32 h, style::color bg, RoundCorners index, const style::color *shadow, RectParts parts) {
|
||||
roundRect(p, x, y, w, h, bg, ::corners[index], shadow, parts);
|
||||
}
|
||||
|
||||
void roundShadow(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color shadow, RoundCorners index, RectParts parts) {
|
||||
void roundShadow(Painter &p, qint32 x, qint32 y, qint32 w, qint32 h, style::color shadow, RoundCorners index, RectParts parts) {
|
||||
auto &corner = ::corners[index];
|
||||
auto cornerWidth = corner.p[0].width() / cIntRetinaFactor();
|
||||
auto cornerHeight = corner.p[0].height() / cIntRetinaFactor();
|
||||
|
@ -2760,8 +2760,8 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, ImageRoundRadius radius, RectParts parts) {
|
||||
auto colorKey = ((uint32(bg->c.alpha()) & 0xFF) << 24) | ((uint32(bg->c.red()) & 0xFF) << 16) | ((uint32(bg->c.green()) & 0xFF) << 8) | ((uint32(bg->c.blue()) & 0xFF) << 24);
|
||||
void roundRect(Painter &p, qint32 x, qint32 y, qint32 w, qint32 h, style::color bg, ImageRoundRadius radius, RectParts parts) {
|
||||
auto colorKey = ((quint32(bg->c.alpha()) & 0xFF) << 24) | ((quint32(bg->c.red()) & 0xFF) << 16) | ((quint32(bg->c.green()) & 0xFF) << 8) | ((quint32(bg->c.blue()) & 0xFF) << 24);
|
||||
auto i = cornersMap.find(colorKey);
|
||||
if (i == cornersMap.cend()) {
|
||||
QImage images[4];
|
||||
|
|
|
@ -34,7 +34,7 @@ using PhotoItems = QHash<PhotoData*, HistoryItemsMap>;
|
|||
using DocumentItems = QHash<DocumentData*, HistoryItemsMap>;
|
||||
using WebPageItems = QHash<WebPageData*, HistoryItemsMap>;
|
||||
using GameItems = QHash<GameData*, HistoryItemsMap>;
|
||||
using SharedContactItems = QHash<int32, HistoryItemsMap>;
|
||||
using SharedContactItems = QHash<qint32, HistoryItemsMap>;
|
||||
using GifItems = QHash<Media::Clip::Reader*, HistoryItem*>;
|
||||
|
||||
using PhotosData = QHash<PhotoId, PhotoData*>;
|
||||
|
@ -53,8 +53,8 @@ namespace App {
|
|||
QString formatPhone(QString phone);
|
||||
|
||||
TimeId onlineForSort(UserData *user, TimeId now);
|
||||
int32 onlineWillChangeIn(UserData *user, TimeId now);
|
||||
int32 onlineWillChangeIn(TimeId online, TimeId now);
|
||||
qint32 onlineWillChangeIn(UserData *user, TimeId now);
|
||||
qint32 onlineWillChangeIn(TimeId online, TimeId now);
|
||||
QString onlineText(UserData *user, TimeId now, bool precise = false);
|
||||
QString onlineText(TimeId online, TimeId now, bool precise = false);
|
||||
bool onlineColorUse(UserData *user, TimeId now);
|
||||
|
@ -82,7 +82,7 @@ namespace App {
|
|||
void feedUserLink(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink);
|
||||
|
||||
ImagePtr image(const MTPPhotoSize &size);
|
||||
StorageImageLocation imageLocation(int32 w, int32 h, const MTPFileLocation &loc);
|
||||
StorageImageLocation imageLocation(qint32 w, qint32 h, const MTPFileLocation &loc);
|
||||
StorageImageLocation imageLocation(const MTPPhotoSize &size);
|
||||
|
||||
PhotoData *feedPhoto(const MTPPhoto &photo, const PreparedPhotoThumbs &thumbs);
|
||||
|
@ -143,13 +143,13 @@ namespace App {
|
|||
PeerData *peerByName(const QString &username);
|
||||
QString peerName(const PeerData *peer, bool forDialogs = false);
|
||||
PhotoData *photo(const PhotoId &photo);
|
||||
PhotoData *photoSet(const PhotoId &photo, PhotoData *convert, const uint64 &access, int32 date, const ImagePtr &thumb, const ImagePtr &medium, const ImagePtr &full);
|
||||
PhotoData *photoSet(const PhotoId &photo, PhotoData *convert, const quint64 &access, qint32 date, const ImagePtr &thumb, const ImagePtr &medium, const ImagePtr &full);
|
||||
DocumentData *document(const DocumentId &document);
|
||||
DocumentData *documentSet(const DocumentId &document, DocumentData *convert, const uint64 &access, int32 version, int32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size, const StorageImageLocation &thumbLocation);
|
||||
DocumentData *documentSet(const DocumentId &document, DocumentData *convert, const quint64 &access, qint32 version, qint32 date, const QVector<MTPDocumentAttribute> &attributes, const QString &mime, const ImagePtr &thumb, qint32 dc, qint32 size, const StorageImageLocation &thumbLocation);
|
||||
WebPageData *webPage(const WebPageId &webPage);
|
||||
WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const TextWithEntities &description, PhotoData *photo, DocumentData *doc, int32 duration, const QString &author, int32 pendingTill);
|
||||
WebPageData *webPageSet(const WebPageId &webPage, WebPageData *convert, const QString &type, const QString &url, const QString &displayUrl, const QString &siteName, const QString &title, const TextWithEntities &description, PhotoData *photo, DocumentData *doc, qint32 duration, const QString &author, qint32 pendingTill);
|
||||
GameData *game(const GameId &game);
|
||||
GameData *gameSet(const GameId &game, GameData *convert, const uint64 &accessHash, const QString &shortName, const QString &title, const QString &description, PhotoData *photo, DocumentData *doc);
|
||||
GameData *gameSet(const GameId &game, GameData *convert, const quint64 &accessHash, const QString &shortName, const QString &title, const QString &description, PhotoData *photo, DocumentData *doc);
|
||||
LocationData *location(const LocationCoords &coords);
|
||||
void forgetMedia();
|
||||
|
||||
|
@ -157,7 +157,7 @@ namespace App {
|
|||
|
||||
Histories &histories();
|
||||
not_null<History*> history(const PeerId &peer);
|
||||
History *historyFromDialog(const PeerId &peer, int32 unreadCnt, int32 maxInboxRead, int32 maxOutboxRead);
|
||||
History *historyFromDialog(const PeerId &peer, qint32 unreadCnt, qint32 maxInboxRead, qint32 maxOutboxRead);
|
||||
History *historyLoaded(const PeerId &peer);
|
||||
HistoryItem *histItemById(ChannelId channelId, MsgId itemId);
|
||||
inline not_null<History*> history(const PeerData *peer) {
|
||||
|
@ -182,12 +182,12 @@ namespace App {
|
|||
void historyRegDependency(HistoryItem *dependent, HistoryItem *dependency);
|
||||
void historyUnregDependency(HistoryItem *dependent, HistoryItem *dependency);
|
||||
|
||||
void historyRegRandom(uint64 randomId, const FullMsgId &itemId);
|
||||
void historyUnregRandom(uint64 randomId);
|
||||
FullMsgId histItemByRandom(uint64 randomId);
|
||||
void historyRegSentData(uint64 randomId, const PeerId &peerId, const QString &text);
|
||||
void historyUnregSentData(uint64 randomId);
|
||||
void histSentDataByItem(uint64 randomId, PeerId &peerId, QString &text);
|
||||
void historyRegRandom(quint64 randomId, const FullMsgId &itemId);
|
||||
void historyUnregRandom(quint64 randomId);
|
||||
FullMsgId histItemByRandom(quint64 randomId);
|
||||
void historyRegSentData(quint64 randomId, const PeerId &peerId, const QString &text);
|
||||
void historyUnregSentData(quint64 randomId);
|
||||
void histSentDataByItem(quint64 randomId, PeerId &peerId, QString &text);
|
||||
|
||||
void hoveredItem(HistoryItem *item);
|
||||
HistoryItem *hoveredItem();
|
||||
|
@ -206,7 +206,7 @@ namespace App {
|
|||
const style::font &monofont();
|
||||
const QPixmap &emoji();
|
||||
const QPixmap &emojiLarge();
|
||||
const QPixmap &emojiSingle(EmojiPtr emoji, int32 fontHeight);
|
||||
const QPixmap &emojiSingle(EmojiPtr emoji, qint32 fontHeight);
|
||||
|
||||
void clearHistories();
|
||||
|
||||
|
@ -252,17 +252,17 @@ namespace App {
|
|||
void unregGameItem(GameData *data, HistoryItem *item);
|
||||
const GameItems &gameItems();
|
||||
|
||||
void regSharedContactItem(int32 userId, HistoryItem *item);
|
||||
void unregSharedContactItem(int32 userId, HistoryItem *item);
|
||||
void regSharedContactItem(qint32 userId, HistoryItem *item);
|
||||
void unregSharedContactItem(qint32 userId, HistoryItem *item);
|
||||
const SharedContactItems &sharedContactItems();
|
||||
QString phoneFromSharedContact(int32 userId);
|
||||
QString phoneFromSharedContact(qint32 userId);
|
||||
|
||||
void regGifItem(Media::Clip::Reader *reader, HistoryItem *item);
|
||||
void unregGifItem(Media::Clip::Reader *reader);
|
||||
void stopRoundVideoPlayback();
|
||||
void stopGifItems();
|
||||
|
||||
void regMuted(PeerData *peer, int32 changeIn);
|
||||
void regMuted(PeerData *peer, qint32 changeIn);
|
||||
void unregMuted(PeerData *peer);
|
||||
void updateMuted();
|
||||
|
||||
|
@ -276,23 +276,23 @@ namespace App {
|
|||
void complexLocationRect(Painter &p, QRect rect, ImageRoundRadius radius, ImageRoundCorners corners);
|
||||
|
||||
QImage *cornersMask(ImageRoundRadius radius);
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, RoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full);
|
||||
void roundRect(Painter &p, qint32 x, qint32 y, qint32 w, qint32 h, style::color bg, RoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full);
|
||||
inline void roundRect(Painter &p, const QRect &rect, style::color bg, RoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full) {
|
||||
return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, index, shadow, parts);
|
||||
}
|
||||
void roundShadow(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color shadow, RoundCorners index, RectParts parts = RectPart::Full);
|
||||
void roundShadow(Painter &p, qint32 x, qint32 y, qint32 w, qint32 h, style::color shadow, RoundCorners index, RectParts parts = RectPart::Full);
|
||||
inline void roundShadow(Painter &p, const QRect &rect, style::color shadow, RoundCorners index, RectParts parts = RectPart::Full) {
|
||||
return roundShadow(p, rect.x(), rect.y(), rect.width(), rect.height(), shadow, index, parts);
|
||||
}
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, ImageRoundRadius radius, RectParts parts = RectPart::Full);
|
||||
void roundRect(Painter &p, qint32 x, qint32 y, qint32 w, qint32 h, style::color bg, ImageRoundRadius radius, RectParts parts = RectPart::Full);
|
||||
inline void roundRect(Painter &p, const QRect &rect, style::color bg, ImageRoundRadius radius, RectParts parts = RectPart::Full) {
|
||||
return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, radius, parts);
|
||||
}
|
||||
|
||||
struct WallPaper {
|
||||
WallPaper(int32 id, ImagePtr thumb, ImagePtr full) : id(id), thumb(thumb), full(full) {
|
||||
WallPaper(qint32 id, ImagePtr thumb, ImagePtr full) : id(id), thumb(thumb), full(full) {
|
||||
}
|
||||
int32 id;
|
||||
qint32 id;
|
||||
ImagePtr thumb;
|
||||
ImagePtr full;
|
||||
};
|
||||
|
|
|
@ -153,7 +153,7 @@ void Application::socketReading() {
|
|||
}
|
||||
_localSocketReadData.append(_localSocket.readAll());
|
||||
if (QRegularExpression("RES:(\\d+);").match(_localSocketReadData).hasMatch()) {
|
||||
uint64 pid = _localSocketReadData.mid(4, _localSocketReadData.length() - 5).toULongLong();
|
||||
quint64 pid = _localSocketReadData.mid(4, _localSocketReadData.length() - 5).toULongLong();
|
||||
psActivateProcess(pid);
|
||||
LOG(("Show command response received, pid = %1, activating and quitting...").arg(pid));
|
||||
return App::quit();
|
||||
|
@ -249,8 +249,8 @@ void Application::readClients() {
|
|||
i->second.append(i->first->readAll());
|
||||
if (i->second.size()) {
|
||||
QString cmds(QString::fromLatin1(i->second));
|
||||
int32 from = 0, l = cmds.length();
|
||||
for (int32 to = cmds.indexOf(QChar(';'), from); to >= from; to = (from < l) ? cmds.indexOf(QChar(';'), from) : -1) {
|
||||
qint32 from = 0, l = cmds.length();
|
||||
for (qint32 to = cmds.indexOf(QChar(';'), from); to >= from; to = (from < l) ? cmds.indexOf(QChar(';'), from) : -1) {
|
||||
QStringRef cmd(&cmds, from, to - from);
|
||||
if (cmd.startsWith(qsl("CMD:"))) {
|
||||
Sandbox::execExternal(cmds.mid(from + 4, to - from - 4));
|
||||
|
@ -356,14 +356,14 @@ void Application::updateGotCurrent() {
|
|||
cSetLastUpdateCheck(unixtime());
|
||||
QRegularExpressionMatch m = QRegularExpression(qsl("^\\s*(\\d+)\\s*:\\s*([\\x21-\\x7f]+)\\s*$")).match(QString::fromLatin1(_updateReply->readAll()));
|
||||
if (m.hasMatch()) {
|
||||
uint64 currentVersion = m.captured(1).toULongLong();
|
||||
quint64 currentVersion = m.captured(1).toULongLong();
|
||||
QString url = m.captured(2);
|
||||
bool betaVersion = false;
|
||||
if (url.startsWith(qstr("beta_"))) {
|
||||
betaVersion = true;
|
||||
url = url.mid(5) + '_' + countBetaVersionSignature(currentVersion);
|
||||
}
|
||||
if ((!betaVersion || cBetaVersion()) && currentVersion > (betaVersion ? cBetaVersion() : uint64(AppVersion))) {
|
||||
if ((!betaVersion || cBetaVersion()) && currentVersion > (betaVersion ? cBetaVersion() : quint64(AppVersion))) {
|
||||
_updateThread = new QThread();
|
||||
connect(_updateThread, SIGNAL(finished()), _updateThread, SLOT(deleteLater()));
|
||||
_updateChecker = new UpdateChecker(_updateThread, url);
|
||||
|
@ -426,12 +426,12 @@ Application::UpdatingState Application::updatingState() {
|
|||
return Application::UpdatingDownload;
|
||||
}
|
||||
|
||||
int32 Application::updatingSize() {
|
||||
qint32 Application::updatingSize() {
|
||||
if (!_updateChecker) return 0;
|
||||
return _updateChecker->size();
|
||||
}
|
||||
|
||||
int32 Application::updatingReady() {
|
||||
qint32 Application::updatingReady() {
|
||||
if (!_updateChecker) return 0;
|
||||
return _updateChecker->ready();
|
||||
}
|
||||
|
@ -456,8 +456,8 @@ void Application::startUpdateCheck(bool forceWait) {
|
|||
_updateCheckTimer->stop();
|
||||
if (_updateThread || _updateReply || !cAutoUpdate() || cExeName().isEmpty()) return;
|
||||
|
||||
int32 constDelay = cBetaVersion() ? 600 : UpdateDelayConstPart, randDelay = cBetaVersion() ? 300 : UpdateDelayRandPart;
|
||||
int32 updateInSecs = cLastUpdateCheck() + constDelay + int32(rand() % randDelay) - unixtime();
|
||||
qint32 constDelay = cBetaVersion() ? 600 : UpdateDelayConstPart, randDelay = cBetaVersion() ? 300 : UpdateDelayRandPart;
|
||||
qint32 updateInSecs = cLastUpdateCheck() + constDelay + qint32(rand() % randDelay) - unixtime();
|
||||
bool sendRequest = (updateInSecs <= 0 || updateInSecs > (constDelay + randDelay));
|
||||
if (!sendRequest && !forceWait) {
|
||||
QDir updates(cWorkingDir() + "tupdates");
|
||||
|
@ -569,14 +569,14 @@ Application::UpdatingState updatingState() {
|
|||
return Application::UpdatingNone;
|
||||
}
|
||||
|
||||
int32 updatingSize() {
|
||||
qint32 updatingSize() {
|
||||
if (auto a = application()) {
|
||||
return a->updatingSize();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 updatingReady() {
|
||||
qint32 updatingReady() {
|
||||
if (auto a = application()) {
|
||||
return a->updatingReady();
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ void connect(const char *signal, QObject *object, const char *method) {
|
|||
void launch() {
|
||||
Assert(application() != 0);
|
||||
|
||||
float64 dpi = Application::primaryScreen()->logicalDotsPerInch();
|
||||
double dpi = Application::primaryScreen()->logicalDotsPerInch();
|
||||
if (dpi <= 108) { // 0-96-108
|
||||
cSetScreenScale(dbisOne);
|
||||
} else if (dpi <= 132) { // 108-120-132
|
||||
|
@ -646,7 +646,7 @@ void launch() {
|
|||
}
|
||||
cSetRetina(true);
|
||||
cSetRetinaFactor(devicePixelRatio);
|
||||
cSetIntRetinaFactor(int32(cRetinaFactor()));
|
||||
cSetIntRetinaFactor(qint32(cRetinaFactor()));
|
||||
cSetConfigScale(dbisOne);
|
||||
cSetRealScale(dbisOne);
|
||||
}
|
||||
|
|
|
@ -81,8 +81,8 @@ public:
|
|||
UpdatingReady,
|
||||
};
|
||||
UpdatingState updatingState();
|
||||
int32 updatingSize();
|
||||
int32 updatingReady();
|
||||
qint32 updatingSize();
|
||||
qint32 updatingReady();
|
||||
|
||||
signals:
|
||||
void updateChecking();
|
||||
|
@ -127,8 +127,8 @@ void startUpdateCheck();
|
|||
void stopUpdate();
|
||||
|
||||
Application::UpdatingState updatingState();
|
||||
int32 updatingSize();
|
||||
int32 updatingReady();
|
||||
qint32 updatingSize();
|
||||
qint32 updatingReady();
|
||||
|
||||
void updateChecking();
|
||||
void updateLatest();
|
||||
|
|
|
@ -34,8 +34,8 @@ public:
|
|||
|
||||
void unpackUpdate();
|
||||
|
||||
int32 ready();
|
||||
int32 size();
|
||||
qint32 ready();
|
||||
qint32 size();
|
||||
|
||||
static void clearAll();
|
||||
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
QString updateUrl;
|
||||
QNetworkAccessManager manager;
|
||||
QNetworkReply *reply;
|
||||
int32 already, full;
|
||||
qint32 already, full;
|
||||
QFile outputFile;
|
||||
|
||||
QMutex mutex;
|
||||
|
@ -73,4 +73,4 @@ class UpdateChecker : public QObject {
|
|||
|
||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||
|
||||
QString countBetaVersionSignature(uint64 version);
|
||||
QString countBetaVersionSignature(quint64 version);
|
||||
|
|
|
@ -21,7 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
#include "base/runtime_composer.h"
|
||||
|
||||
struct RuntimeComposerMetadatasMap {
|
||||
QMap<uint64, RuntimeComposerMetadata*> data;
|
||||
QMap<quint64, RuntimeComposerMetadata*> data;
|
||||
~RuntimeComposerMetadatasMap() {
|
||||
for_const (const RuntimeComposerMetadata *p, data) {
|
||||
delete p;
|
||||
|
@ -29,7 +29,7 @@ struct RuntimeComposerMetadatasMap {
|
|||
}
|
||||
};
|
||||
|
||||
const RuntimeComposerMetadata *GetRuntimeComposerMetadata(uint64 mask) {
|
||||
const RuntimeComposerMetadata *GetRuntimeComposerMetadata(quint64 mask) {
|
||||
static RuntimeComposerMetadatasMap RuntimeComposerMetadatas;
|
||||
static QMutex RuntimeComposerMetadatasMutex;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ struct RuntimeComponent {
|
|||
}
|
||||
return MyIndex.loadAcquire() - 1;
|
||||
}
|
||||
static uint64 Bit() {
|
||||
static quint64 Bit() {
|
||||
return (1ULL << Index());
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ protected:
|
|||
|
||||
class RuntimeComposerMetadata {
|
||||
public:
|
||||
RuntimeComposerMetadata(uint64 mask) : _mask(mask) {
|
||||
RuntimeComposerMetadata(quint64 mask) : _mask(mask) {
|
||||
for (int i = 0; i != 64; ++i) {
|
||||
auto componentBit = (1ULL << i);
|
||||
if (_mask & componentBit) {
|
||||
|
@ -130,26 +130,26 @@ public:
|
|||
std::size_t offsets[64] = { 0 };
|
||||
int last = 64;
|
||||
|
||||
bool equals(uint64 mask) const {
|
||||
bool equals(quint64 mask) const {
|
||||
return _mask == mask;
|
||||
}
|
||||
uint64 maskadd(uint64 mask) const {
|
||||
quint64 maskadd(quint64 mask) const {
|
||||
return _mask | mask;
|
||||
}
|
||||
uint64 maskremove(uint64 mask) const {
|
||||
quint64 maskremove(quint64 mask) const {
|
||||
return _mask & (~mask);
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 _mask;
|
||||
quint64 _mask;
|
||||
|
||||
};
|
||||
|
||||
const RuntimeComposerMetadata *GetRuntimeComposerMetadata(uint64 mask);
|
||||
const RuntimeComposerMetadata *GetRuntimeComposerMetadata(quint64 mask);
|
||||
|
||||
class RuntimeComposer {
|
||||
public:
|
||||
RuntimeComposer(uint64 mask = 0) : _data(zerodata()) {
|
||||
RuntimeComposer(quint64 mask = 0) : _data(zerodata()) {
|
||||
if (mask) {
|
||||
auto meta = GetRuntimeComposerMetadata(mask);
|
||||
|
||||
|
@ -212,7 +212,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
void UpdateComponents(uint64 mask = 0) {
|
||||
void UpdateComponents(quint64 mask = 0) {
|
||||
if (!_meta()->equals(mask)) {
|
||||
RuntimeComposer tmp(mask);
|
||||
tmp.swap(*this);
|
||||
|
@ -228,10 +228,10 @@ protected:
|
|||
}
|
||||
}
|
||||
}
|
||||
void AddComponents(uint64 mask = 0) {
|
||||
void AddComponents(quint64 mask = 0) {
|
||||
UpdateComponents(_meta()->maskadd(mask));
|
||||
}
|
||||
void RemoveComponents(uint64 mask = 0) {
|
||||
void RemoveComponents(quint64 mask = 0) {
|
||||
UpdateComponents(_meta()->maskremove(mask));
|
||||
}
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ public:
|
|||
}
|
||||
|
||||
auto size = fileInfo.uncompressed_size;
|
||||
if (size > static_cast<uint32>(fileSizeLimit)) {
|
||||
if (size > static_cast<quint32>(fileSizeLimit)) {
|
||||
if (_error == UNZ_OK) _error = -1;
|
||||
LOG(("Error: current file is too large (should be less than %1, got %2) in a zip file.").arg(fileSizeLimit).arg(size));
|
||||
return QByteArray();
|
||||
|
|
|
@ -104,7 +104,7 @@ void BoxContent::onDraggingScrollDelta(int delta) {
|
|||
}
|
||||
|
||||
void BoxContent::onDraggingScrollTimer() {
|
||||
auto delta = (_draggingScrollDelta > 0) ? qMin(_draggingScrollDelta * 3 / 20 + 1, int32(MaxScrollSpeed)) : qMax(_draggingScrollDelta * 3 / 20 - 1, -int32(MaxScrollSpeed));
|
||||
auto delta = (_draggingScrollDelta > 0) ? qMin(_draggingScrollDelta * 3 / 20 + 1, qint32(MaxScrollSpeed)) : qMax(_draggingScrollDelta * 3 / 20 - 1, -qint32(MaxScrollSpeed));
|
||||
_scroll->scrollToY(_scroll->scrollTop() + delta);
|
||||
}
|
||||
|
||||
|
|
|
@ -221,11 +221,11 @@ void AddContactBox::onSave() {
|
|||
}
|
||||
_sentName = firstName;
|
||||
if (_user) {
|
||||
_contactId = rand_value<uint64>();
|
||||
_contactId = rand_value<quint64>();
|
||||
QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_user->phone()), MTP_string(firstName), MTP_string(lastName)));
|
||||
_addRequest = MTP::send(MTPcontacts_ImportContacts(MTP_vector<MTPInputContact>(v)), rpcDone(&AddContactBox::onSaveUserDone), rpcFail(&AddContactBox::onSaveUserFail));
|
||||
} else {
|
||||
_contactId = rand_value<uint64>();
|
||||
_contactId = rand_value<quint64>();
|
||||
QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(phone), MTP_string(firstName), MTP_string(lastName)));
|
||||
_addRequest = MTP::send(MTPcontacts_ImportContacts(MTP_vector<MTPInputContact>(v)), rpcDone(&AddContactBox::onImportDone));
|
||||
}
|
||||
|
@ -745,8 +745,8 @@ void SetupChannelBox::onChange() {
|
|||
}
|
||||
_checkTimer.stop();
|
||||
} else {
|
||||
int32 len = name.size();
|
||||
for (int32 i = 0; i < len; ++i) {
|
||||
qint32 len = name.size();
|
||||
for (qint32 i = 0; i < len; ++i) {
|
||||
QChar ch = name.at(i);
|
||||
if ((ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && (ch < '0' || ch > '9') && ch != '_') {
|
||||
if (_errorText != lang(lng_create_channel_link_bad_symbols)) {
|
||||
|
@ -1498,8 +1498,8 @@ void RevokePublicLinkBox::Inner::paintChat(Painter &p, const ChatRow &row, bool
|
|||
|
||||
p.setPen(st::contactsNameFg);
|
||||
|
||||
int32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left();
|
||||
int32 namew = width() - namex - st::contactsPadding.right() - (_revokeWidth + st::contactsCheckPosition.x() * 2);
|
||||
qint32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left();
|
||||
qint32 namew = width() - namex - st::contactsPadding.right() - (_revokeWidth + st::contactsCheckPosition.x() * 2);
|
||||
if (peer->isVerified()) {
|
||||
auto icon = &st::dialogsVerifiedIcon;
|
||||
namew -= icon->width();
|
||||
|
|
|
@ -84,7 +84,7 @@ private:
|
|||
bool _retrying = false;
|
||||
bool _invertOrder = false;
|
||||
|
||||
uint64 _contactId = 0;
|
||||
quint64 _contactId = 0;
|
||||
|
||||
mtpRequestId _addRequest = 0;
|
||||
QString _sentName;
|
||||
|
@ -185,7 +185,7 @@ private:
|
|||
std::shared_ptr<Ui::RadioenumGroup<Privacy>> _privacyGroup;
|
||||
object_ptr<Ui::Radioenum<Privacy>> _public;
|
||||
object_ptr<Ui::Radioenum<Privacy>> _private;
|
||||
int32 _aboutPublicWidth, _aboutPublicHeight;
|
||||
qint32 _aboutPublicWidth, _aboutPublicHeight;
|
||||
Text _aboutPublic, _aboutPrivate;
|
||||
|
||||
object_ptr<Ui::UsernameInput> _link;
|
||||
|
|
|
@ -115,10 +115,10 @@ void BackgroundBox::Inner::gotWallpapers(const MTPVector<MTPWallPaper> &result)
|
|||
auto &d = w.c_wallPaper();
|
||||
auto &sizes = d.vsizes.v;
|
||||
const MTPPhotoSize *thumb = 0, *full = 0;
|
||||
int32 thumbLevel = -1, fullLevel = -1;
|
||||
qint32 thumbLevel = -1, fullLevel = -1;
|
||||
for (QVector<MTPPhotoSize>::const_iterator j = sizes.cbegin(), e = sizes.cend(); j != e; ++j) {
|
||||
char size = 0;
|
||||
int32 w = 0, h = 0;
|
||||
qint32 w = 0, h = 0;
|
||||
switch (j->type()) {
|
||||
case mtpc_photoSize: {
|
||||
auto &s = j->c_photoSize().vtype.v;
|
||||
|
@ -136,7 +136,7 @@ void BackgroundBox::Inner::gotWallpapers(const MTPVector<MTPWallPaper> &result)
|
|||
}
|
||||
if (!size || !w || !h) continue;
|
||||
|
||||
int32 newThumbLevel = qAbs((st::backgroundSize.width() * cIntRetinaFactor()) - w), newFullLevel = qAbs(2560 - w);
|
||||
qint32 newThumbLevel = qAbs((st::backgroundSize.width() * cIntRetinaFactor()) - w), newFullLevel = qAbs(2560 - w);
|
||||
if (thumbLevel < 0 || newThumbLevel < thumbLevel) {
|
||||
thumbLevel = newThumbLevel;
|
||||
thumb = &(*j);
|
||||
|
|
|
@ -115,7 +115,7 @@ private:
|
|||
not_null<ChannelData*> _channel;
|
||||
|
||||
Text _text;
|
||||
int32 _textWidth, _textHeight;
|
||||
qint32 _textWidth, _textHeight;
|
||||
|
||||
QRect _invitationLink;
|
||||
bool _linkOver = false;
|
||||
|
@ -141,7 +141,7 @@ private:
|
|||
|
||||
ChatData *_chat;
|
||||
Text _text, _note;
|
||||
int32 _textWidth, _textHeight;
|
||||
qint32 _textWidth, _textHeight;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ void AutoDownloadBox::resizeEvent(QResizeEvent *e) {
|
|||
|
||||
void AutoDownloadBox::onSave() {
|
||||
bool changed = false;
|
||||
int32 autoDownloadPhoto = (_photoPrivate->checked() ? 0 : dbiadNoPrivate) | (_photoGroups->checked() ? 0 : dbiadNoGroups);
|
||||
qint32 autoDownloadPhoto = (_photoPrivate->checked() ? 0 : dbiadNoPrivate) | (_photoGroups->checked() ? 0 : dbiadNoGroups);
|
||||
if (cAutoDownloadPhoto() != autoDownloadPhoto) {
|
||||
bool enabledPrivate = ((cAutoDownloadPhoto() & dbiadNoPrivate) && !(autoDownloadPhoto & dbiadNoPrivate));
|
||||
bool enabledGroups = ((cAutoDownloadPhoto() & dbiadNoGroups) && !(autoDownloadPhoto & dbiadNoGroups));
|
||||
|
@ -316,7 +316,7 @@ void AutoDownloadBox::onSave() {
|
|||
}
|
||||
changed = true;
|
||||
}
|
||||
int32 autoDownloadAudio = (_audioPrivate->checked() ? 0 : dbiadNoPrivate) | (_audioGroups->checked() ? 0 : dbiadNoGroups);
|
||||
qint32 autoDownloadAudio = (_audioPrivate->checked() ? 0 : dbiadNoPrivate) | (_audioGroups->checked() ? 0 : dbiadNoGroups);
|
||||
if (cAutoDownloadAudio() != autoDownloadAudio) {
|
||||
bool enabledPrivate = ((cAutoDownloadAudio() & dbiadNoPrivate) && !(autoDownloadAudio & dbiadNoPrivate));
|
||||
bool enabledGroups = ((cAutoDownloadAudio() & dbiadNoGroups) && !(autoDownloadAudio & dbiadNoGroups));
|
||||
|
@ -330,7 +330,7 @@ void AutoDownloadBox::onSave() {
|
|||
}
|
||||
changed = true;
|
||||
}
|
||||
int32 autoDownloadGif = (_gifPrivate->checked() ? 0 : dbiadNoPrivate) | (_gifGroups->checked() ? 0 : dbiadNoGroups);
|
||||
qint32 autoDownloadGif = (_gifPrivate->checked() ? 0 : dbiadNoPrivate) | (_gifGroups->checked() ? 0 : dbiadNoGroups);
|
||||
if (cAutoDownloadGif() != autoDownloadGif) {
|
||||
bool enabledPrivate = ((cAutoDownloadGif() & dbiadNoPrivate) && !(autoDownloadGif & dbiadNoPrivate));
|
||||
bool enabledGroups = ((cAutoDownloadGif() & dbiadNoGroups) && !(autoDownloadGif & dbiadNoGroups));
|
||||
|
|
|
@ -30,10 +30,10 @@ class EditColorBox::Picker : public TWidget {
|
|||
public:
|
||||
Picker(QWidget *parent, QColor color);
|
||||
|
||||
float64 valueX() const {
|
||||
double valueX() const {
|
||||
return _x;
|
||||
}
|
||||
float64 valueY() const {
|
||||
double valueY() const {
|
||||
return _y;
|
||||
}
|
||||
|
||||
|
@ -64,8 +64,8 @@ private:
|
|||
|
||||
QImage _palette;
|
||||
bool _paletteInvalidated = false;
|
||||
float64 _x = 0.;
|
||||
float64 _y = 0.;
|
||||
double _x = 0.;
|
||||
double _y = 0.;
|
||||
|
||||
bool _choosing = false;
|
||||
base::Observable<void> _changed;
|
||||
|
@ -150,8 +150,8 @@ void EditColorBox::Picker::preparePalette() {
|
|||
_paletteInvalidated = false;
|
||||
|
||||
auto size = _palette.width();
|
||||
auto ints = reinterpret_cast<uint32*>(_palette.bits());
|
||||
auto intsAddPerLine = (_palette.bytesPerLine() - size * sizeof(uint32)) / sizeof(uint32);
|
||||
auto ints = reinterpret_cast<quint32*>(_palette.bits());
|
||||
auto intsAddPerLine = (_palette.bytesPerLine() - size * sizeof(quint32)) / sizeof(quint32);
|
||||
|
||||
constexpr auto Large = 1024 * 1024;
|
||||
constexpr auto LargeBit = 20; // n / Large == (n >> LargeBit)
|
||||
|
@ -190,8 +190,8 @@ void EditColorBox::Picker::preparePalette() {
|
|||
}
|
||||
|
||||
void EditColorBox::Picker::updateCurrentPoint(QPoint localPosition) {
|
||||
auto x = snap(localPosition.x(), 0, width()) / float64(width());
|
||||
auto y = snap(localPosition.y(), 0, height()) / float64(height());
|
||||
auto x = snap(localPosition.x(), 0, width()) / double(width());
|
||||
auto y = snap(localPosition.y(), 0, height()) / double(height());
|
||||
if (_x != x || _y != y) {
|
||||
_x = x;
|
||||
_y = y;
|
||||
|
@ -236,10 +236,10 @@ public:
|
|||
base::Observable<void> &changed() {
|
||||
return _changed;
|
||||
}
|
||||
float64 value() const {
|
||||
double value() const {
|
||||
return _value;
|
||||
}
|
||||
void setValue(float64 value) {
|
||||
void setValue(double value) {
|
||||
_value = snap(value, 0., 1.);
|
||||
update();
|
||||
}
|
||||
|
@ -256,8 +256,8 @@ protected:
|
|||
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||
|
||||
private:
|
||||
float64 valueFromColor(QColor color) const;
|
||||
float64 valueFromHue(int hue) const;
|
||||
double valueFromColor(QColor color) const;
|
||||
double valueFromHue(int hue) const;
|
||||
bool isHorizontal() const {
|
||||
return (_direction == Direction::Horizontal);
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ private:
|
|||
Type _type = Type::Hue;
|
||||
|
||||
QColor _color;
|
||||
float64 _value = 0;
|
||||
double _value = 0;
|
||||
|
||||
QImage _mask;
|
||||
QPixmap _pixmap;
|
||||
|
@ -339,8 +339,8 @@ void EditColorBox::Slider::generatePixmap() {
|
|||
auto size = (isHorizontal() ? width() : height()) * cIntRetinaFactor();
|
||||
auto image = QImage(size, cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
|
||||
image.setDevicePixelRatio(cRetinaFactor());
|
||||
auto ints = reinterpret_cast<uint32*>(image.bits());
|
||||
auto intsPerLine = image.bytesPerLine() / sizeof(uint32);
|
||||
auto ints = reinterpret_cast<quint32*>(image.bits());
|
||||
auto intsPerLine = image.bytesPerLine() / sizeof(quint32);
|
||||
auto intsPerLineAdded = intsPerLine - size;
|
||||
|
||||
constexpr auto Large = 1024 * 1024;
|
||||
|
@ -408,11 +408,11 @@ void EditColorBox::Slider::colorUpdated() {
|
|||
update();
|
||||
}
|
||||
|
||||
float64 EditColorBox::Slider::valueFromColor(QColor color) const {
|
||||
double EditColorBox::Slider::valueFromColor(QColor color) const {
|
||||
return (_type == Type::Hue) ? valueFromHue(color.hsvHue()) : color.alphaF();
|
||||
}
|
||||
|
||||
float64 EditColorBox::Slider::valueFromHue(int hue) const {
|
||||
double EditColorBox::Slider::valueFromHue(int hue) const {
|
||||
return (1. - snap(hue, 0, 360) / 360.);
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ void EditColorBox::Slider::updatePixmapFromMask() {
|
|||
void EditColorBox::Slider::updateCurrentPoint(QPoint localPosition) {
|
||||
auto coord = (isHorizontal() ? localPosition.x() : localPosition.y()) - st::colorSliderSkip;
|
||||
auto maximum = (isHorizontal() ? width() : height()) - 2 * st::colorSliderSkip;
|
||||
auto value = snap(coord, 0, maximum) / float64(maximum);
|
||||
auto value = snap(coord, 0, maximum) / double(maximum);
|
||||
if (_value != value) {
|
||||
_value = value;
|
||||
update();
|
||||
|
@ -909,4 +909,4 @@ void EditColorBox::setRGB(int red, int green, int blue, int alpha) {
|
|||
updateControlsFromColor();
|
||||
updateHSVFields();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,8 +141,8 @@ void PasscodeBox::paintEvent(QPaintEvent *e) {
|
|||
|
||||
Painter p(this);
|
||||
|
||||
int32 w = st::boxWidth - st::boxPadding.left() * 1.5;
|
||||
int32 abouty = (_passwordHint->isHidden() ? ((_reenterPasscode->isHidden() ? (_oldPasscode->y() + (_hasRecovery && !_hintText.isEmpty() ? st::passcodeTextLine : 0)) : _reenterPasscode->y()) + st::passcodeSkip) : _passwordHint->y()) + _oldPasscode->height() + st::passcodeLittleSkip + st::passcodeAboutSkip;
|
||||
qint32 w = st::boxWidth - st::boxPadding.left() * 1.5;
|
||||
qint32 abouty = (_passwordHint->isHidden() ? ((_reenterPasscode->isHidden() ? (_oldPasscode->y() + (_hasRecovery && !_hintText.isEmpty() ? st::passcodeTextLine : 0)) : _reenterPasscode->y()) + st::passcodeSkip) : _passwordHint->y()) + _oldPasscode->height() + st::passcodeLittleSkip + st::passcodeAboutSkip;
|
||||
p.setPen(st::boxTextFg);
|
||||
_about.drawLeft(p, st::boxPadding.left(), abouty, w, width());
|
||||
|
||||
|
@ -170,7 +170,7 @@ void PasscodeBox::resizeEvent(QResizeEvent *e) {
|
|||
BoxContent::resizeEvent(e);
|
||||
|
||||
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : Global::LocalPasscode();
|
||||
int32 w = st::boxWidth - st::boxPadding.left() - st::boxPadding.right();
|
||||
qint32 w = st::boxWidth - st::boxPadding.left() - st::boxPadding.right();
|
||||
_oldPasscode->resize(w, _oldPasscode->height());
|
||||
_oldPasscode->moveToLeft(st::boxPadding.left(), st::passcodePadding.top());
|
||||
_newPasscode->resize(w, _newPasscode->height());
|
||||
|
@ -443,7 +443,7 @@ void RecoverBox::paintEvent(QPaintEvent *e) {
|
|||
|
||||
p.setFont(st::normalFont);
|
||||
p.setPen(st::boxTextFg);
|
||||
int32 w = st::boxWidth - st::boxPadding.left() * 1.5;
|
||||
qint32 w = st::boxWidth - st::boxPadding.left() * 1.5;
|
||||
p.drawText(QRect(st::boxPadding.left(), _recoverCode->y() - st::passcodeTextLine - st::passcodePadding.top(), w, st::passcodePadding.top() + st::passcodeTextLine), _pattern, style::al_left);
|
||||
|
||||
if (!_error.isEmpty()) {
|
||||
|
|
|
@ -52,7 +52,7 @@ void PeerListBox::createMultiSelect() {
|
|||
_select.create(this, std::move(entity), margins, std::move(callback));
|
||||
_select->entity()->setSubmittedCallback([this](bool chtrlShiftEnter) { _inner->submitted(); });
|
||||
_select->entity()->setQueryChangedCallback([this](const QString &query) { searchQueryChanged(query); });
|
||||
_select->entity()->setItemRemovedCallback([this](uint64 itemId) {
|
||||
_select->entity()->setItemRemovedCallback([this](quint64 itemId) {
|
||||
if (auto peer = App::peerLoaded(itemId)) {
|
||||
if (auto row = peerListFindRow(peer->id)) {
|
||||
_inner->changeCheckState(row, false, PeerListRow::SetStyle::Animated);
|
||||
|
@ -344,7 +344,7 @@ int PeerListBox::peerListSelectedRowsCount() {
|
|||
|
||||
std::vector<not_null<PeerData*>> PeerListBox::peerListCollectSelectedRows() {
|
||||
auto result = std::vector<not_null<PeerData*>> {};
|
||||
auto items = _select ? _select->entity()->getItems() : QVector<uint64> {};
|
||||
auto items = _select ? _select->entity()->getItems() : QVector<quint64> {};
|
||||
if (!items.empty()) {
|
||||
result.reserve(items.size());
|
||||
for_const (auto itemId, items) {
|
||||
|
@ -499,7 +499,7 @@ void PeerListRow::setStatusText(const QString &text) {
|
|||
_status.setText(st::defaultTextStyle, text, _textNameOptions);
|
||||
}
|
||||
|
||||
float64 PeerListRow::checkedRatio() {
|
||||
double PeerListRow::checkedRatio() {
|
||||
return _checkbox ? _checkbox->checkedAnimationRatio() : 0.;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ inline auto PaintUserpicCallback(PeerData *peer) {
|
|||
};
|
||||
}
|
||||
|
||||
using PeerListRowId = uint64;
|
||||
using PeerListRowId = quint64;
|
||||
class PeerListRow {
|
||||
public:
|
||||
PeerListRow(not_null<PeerData*> peer);
|
||||
|
@ -139,7 +139,7 @@ public:
|
|||
void stopLastRipple();
|
||||
void paintRipple(Painter &p, TimeMs ms, int x, int y, int outerWidth);
|
||||
void paintUserpic(Painter &p, TimeMs ms, int x, int y, int outerWidth);
|
||||
float64 checkedRatio();
|
||||
double checkedRatio();
|
||||
|
||||
void setNameFirstChars(const OrderedSet<QChar> &nameFirstChars) {
|
||||
_nameFirstChars = nameFirstChars;
|
||||
|
|
|
@ -717,7 +717,7 @@ void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
|
|||
}
|
||||
auto history = App::historyLoaded(chat);
|
||||
auto afterRequestId = history ? history->sendRequestId : 0;
|
||||
auto randomId = rand_value<uint64>();
|
||||
auto randomId = rand_value<quint64>();
|
||||
auto gameShortName = bot->botInfo->shareGameShortName;
|
||||
auto inputGame = MTP_inputGameShortName(
|
||||
bot->inputUser,
|
||||
|
@ -764,7 +764,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
|
|||
auto request = MTPmessages_StartBot(
|
||||
bot->inputUser,
|
||||
chat->input,
|
||||
MTP_long(rand_value<uint64>()),
|
||||
MTP_long(rand_value<quint64>()),
|
||||
MTP_string(info->startGroupToken));
|
||||
auto done = App::main()->rpcDone(
|
||||
&MainWidget::sentUpdatesReceived);
|
||||
|
|
|
@ -56,7 +56,7 @@ void PhotoCropBox::prepare() {
|
|||
connect(this, SIGNAL(ready(const QImage&)), this, SLOT(onReady(const QImage&)));
|
||||
}
|
||||
|
||||
int32 s = st::boxWideWidth - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
|
||||
qint32 s = st::boxWideWidth - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
|
||||
_thumb = App::pixmapFromImageInPlace(_img.scaled(s * cIntRetinaFactor(), s * cIntRetinaFactor(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
_thumb.setDevicePixelRatio(cRetinaFactor());
|
||||
_mask = QImage(_thumb.size(), QImage::Format_ARGB32_Premultiplied);
|
||||
|
@ -94,7 +94,7 @@ void PhotoCropBox::mousePressEvent(QMouseEvent *e) {
|
|||
|
||||
int PhotoCropBox::mouseState(QPoint p) {
|
||||
p -= QPoint(_thumbx, _thumby);
|
||||
int32 delta = st::cropPointSize, mdelta(-delta / 2);
|
||||
qint32 delta = st::cropPointSize, mdelta(-delta / 2);
|
||||
if (QRect(_cropx + mdelta, _cropy + mdelta, delta, delta).contains(p)) {
|
||||
return 1;
|
||||
} else if (QRect(_cropx + _cropw + mdelta, _cropy + mdelta, delta, delta).contains(p)) {
|
||||
|
@ -122,7 +122,7 @@ void PhotoCropBox::mouseMoveEvent(QMouseEvent *e) {
|
|||
}
|
||||
if (_downState) {
|
||||
if (_downState == 1) {
|
||||
int32 dx = e->pos().x() - _fromposx, dy = e->pos().y() - _fromposy, d = (dx < dy) ? dx : dy;
|
||||
qint32 dx = e->pos().x() - _fromposx, dy = e->pos().y() - _fromposy, d = (dx < dy) ? dx : dy;
|
||||
if (_fromcropx + d < 0) {
|
||||
d = -_fromcropx;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ void PhotoCropBox::mouseMoveEvent(QMouseEvent *e) {
|
|||
update();
|
||||
}
|
||||
} else if (_downState == 2) {
|
||||
int32 dx = _fromposx - e->pos().x(), dy = e->pos().y() - _fromposy, d = (dx < dy) ? dx : dy;
|
||||
qint32 dx = _fromposx - e->pos().x(), dy = e->pos().y() - _fromposy, d = (dx < dy) ? dx : dy;
|
||||
if (_fromcropx + _fromcropw - d > _thumbw) {
|
||||
d = _fromcropx + _fromcropw - _thumbw;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void PhotoCropBox::mouseMoveEvent(QMouseEvent *e) {
|
|||
update();
|
||||
}
|
||||
} else if (_downState == 3) {
|
||||
int32 dx = _fromposx - e->pos().x(), dy = _fromposy - e->pos().y(), d = (dx < dy) ? dx : dy;
|
||||
qint32 dx = _fromposx - e->pos().x(), dy = _fromposy - e->pos().y(), d = (dx < dy) ? dx : dy;
|
||||
if (_fromcropx + _fromcropw - d > _thumbw) {
|
||||
d = _fromcropx + _fromcropw - _thumbw;
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void PhotoCropBox::mouseMoveEvent(QMouseEvent *e) {
|
|||
update();
|
||||
}
|
||||
} else if (_downState == 4) {
|
||||
int32 dx = e->pos().x() - _fromposx, dy = _fromposy - e->pos().y(), d = (dx < dy) ? dx : dy;
|
||||
qint32 dx = e->pos().x() - _fromposx, dy = _fromposy - e->pos().y(), d = (dx < dy) ? dx : dy;
|
||||
if (_fromcropx + d < 0) {
|
||||
d = -_fromcropx;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ void PhotoCropBox::mouseMoveEvent(QMouseEvent *e) {
|
|||
update();
|
||||
}
|
||||
} else if (_downState == 5) {
|
||||
int32 dx = e->pos().x() - _fromposx, dy = e->pos().y() - _fromposy;
|
||||
qint32 dx = e->pos().x() - _fromposx, dy = e->pos().y() - _fromposy;
|
||||
if (_fromcropx + dx < 0) {
|
||||
dx = -_fromcropx;
|
||||
} else if (_fromcropx + _fromcropw + dx > _thumbw) {
|
||||
|
@ -204,7 +204,7 @@ void PhotoCropBox::mouseMoveEvent(QMouseEvent *e) {
|
|||
}
|
||||
}
|
||||
}
|
||||
int32 cursorState = _downState ? _downState : mouseState(e->pos());
|
||||
qint32 cursorState = _downState ? _downState : mouseState(e->pos());
|
||||
QCursor cur(style::cur_default);
|
||||
if (cursorState == 1 || cursorState == 3) {
|
||||
cur = style::cur_sizefdiag;
|
||||
|
@ -260,8 +260,8 @@ void PhotoCropBox::sendPhoto() {
|
|||
if (_img.width() < _thumb.width()) {
|
||||
from = _thumb.toImage();
|
||||
}
|
||||
float64 x = float64(_cropx) / _thumbw, y = float64(_cropy) / _thumbh, w = float64(_cropw) / _thumbw;
|
||||
int32 ix = int32(x * from.width()), iy = int32(y * from.height()), iw = int32(w * from.width());
|
||||
double x = double(_cropx) / _thumbw, y = double(_cropy) / _thumbh, w = double(_cropw) / _thumbw;
|
||||
qint32 ix = qint32(x * from.width()), iy = qint32(y * from.height()), iw = qint32(w * from.width());
|
||||
if (ix < 0) {
|
||||
ix = 0;
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ void PhotoCropBox::sendPhoto() {
|
|||
if (iy + iw > from.height()) {
|
||||
iw = from.height() - iy;
|
||||
}
|
||||
int32 offset = ix * from.depth() / 8 + iy * from.bytesPerLine();
|
||||
qint32 offset = ix * from.depth() / 8 + iy * from.bytesPerLine();
|
||||
QImage cropped(from.constBits() + offset, iw, iw, from.bytesPerLine(), from.format()), tosend;
|
||||
if (from.format() == QImage::Format_Indexed8) {
|
||||
cropped.setColorCount(from.colorCount());
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
PhotoCropBox(QWidget*, const QImage &img, const PeerId &peer);
|
||||
PhotoCropBox(QWidget*, const QImage &img, PeerData *peer);
|
||||
|
||||
int32 mouseState(QPoint p);
|
||||
qint32 mouseState(QPoint p);
|
||||
|
||||
signals:
|
||||
void ready(const QImage &tosend);
|
||||
|
@ -51,10 +51,10 @@ private:
|
|||
void sendPhoto();
|
||||
|
||||
QString _title;
|
||||
int32 _downState = 0;
|
||||
int32 _thumbx, _thumby, _thumbw, _thumbh;
|
||||
int32 _cropx, _cropy, _cropw;
|
||||
int32 _fromposx, _fromposy, _fromcropx, _fromcropy, _fromcropw;
|
||||
qint32 _downState = 0;
|
||||
qint32 _thumbx, _thumby, _thumbw, _thumbh;
|
||||
qint32 _cropx, _cropy, _cropw;
|
||||
qint32 _fromposx, _fromposy, _fromcropx, _fromcropy, _fromcropw;
|
||||
QImage _img;
|
||||
QPixmap _thumb;
|
||||
QImage _mask, _fade;
|
||||
|
|
|
@ -36,7 +36,7 @@ constexpr auto kMaxRating = 5;
|
|||
|
||||
} // namespace
|
||||
|
||||
RateCallBox::RateCallBox(QWidget*, uint64 callId, uint64 callAccessHash)
|
||||
RateCallBox::RateCallBox(QWidget*, quint64 callId, quint64 callAccessHash)
|
||||
: _callId(callId)
|
||||
, _callAccessHash(callAccessHash) {
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class RateCallBox : public BoxContent, private MTP::Sender {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RateCallBox(QWidget*, uint64 callId, uint64 callAccessHash);
|
||||
RateCallBox(QWidget*, quint64 callId, quint64 callAccessHash);
|
||||
|
||||
private slots:
|
||||
void onSend();
|
||||
|
@ -52,8 +52,8 @@ private:
|
|||
void updateMaxHeight();
|
||||
void ratingChanged(int value);
|
||||
|
||||
uint64 _callId = 0;
|
||||
uint64 _callAccessHash = 0;
|
||||
quint64 _callId = 0;
|
||||
quint64 _callAccessHash = 0;
|
||||
int _rating = 0;
|
||||
|
||||
std::vector<object_ptr<Ui::IconButton>> _stars;
|
||||
|
|
|
@ -112,9 +112,9 @@ void SendFilesBox::prepareSingleFileLayout() {
|
|||
_previewWidth = qMax(image.width(), kMinPreviewWidth);
|
||||
}
|
||||
auto maxthumbh = qMin(qRound(1.5 * _previewWidth), st::confirmMaxHeight);
|
||||
_previewHeight = qRound(originalHeight * float64(_previewWidth) / originalWidth);
|
||||
_previewHeight = qRound(originalHeight * double(_previewWidth) / originalWidth);
|
||||
if (_previewHeight > maxthumbh) {
|
||||
_previewWidth = qRound(_previewWidth * float64(maxthumbh) / _previewHeight);
|
||||
_previewWidth = qRound(_previewWidth * double(maxthumbh) / _previewHeight);
|
||||
accumulate_max(_previewWidth, kMinPreviewWidth);
|
||||
_previewHeight = maxthumbh;
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ void SendFilesBox::paintEvent(QPaintEvent *e) {
|
|||
linktop = st::msgFileThumbLinkTop;
|
||||
}
|
||||
auto namewidth = w - nameleft - (_fileThumb.isNull() ? st::msgFilePadding.left() : st::msgFileThumbPadding.left());
|
||||
int32 x = (width() - w) / 2, y = st::boxPhotoPadding.top();
|
||||
qint32 x = (width() - w) / 2, y = st::boxPhotoPadding.top();
|
||||
|
||||
App::roundRect(p, x, y, w, h, st::msgOutBg, MessageOutCorners, &st::msgOutShadow);
|
||||
|
||||
|
@ -493,7 +493,7 @@ EditCaptionBox::EditCaptionBox(QWidget*, HistoryMedia *media, FullMsgId msgId) :
|
|||
if (image->isNull()) {
|
||||
_thumbw = 0;
|
||||
} else {
|
||||
int32 tw = image->width(), th = image->height();
|
||||
qint32 tw = image->width(), th = image->height();
|
||||
if (tw > th) {
|
||||
_thumbw = (tw * st::msgFileThumbSize) / th;
|
||||
} else {
|
||||
|
@ -515,10 +515,10 @@ EditCaptionBox::EditCaptionBox(QWidget*, HistoryMedia *media, FullMsgId msgId) :
|
|||
_isAudio = (doc->voice() || doc->song());
|
||||
}
|
||||
} else {
|
||||
int32 maxW = 0, maxH = 0;
|
||||
qint32 maxW = 0, maxH = 0;
|
||||
if (_animated) {
|
||||
int32 limitW = st::boxWideWidth - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
|
||||
int32 limitH = st::confirmMaxHeight;
|
||||
qint32 limitW = st::boxWideWidth - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
|
||||
qint32 limitH = st::confirmMaxHeight;
|
||||
maxW = qMax(dimensions.width(), 1);
|
||||
maxH = qMax(dimensions.height(), 1);
|
||||
if (maxW * limitH > maxH * limitW) {
|
||||
|
@ -539,7 +539,7 @@ EditCaptionBox::EditCaptionBox(QWidget*, HistoryMedia *media, FullMsgId msgId) :
|
|||
maxH = dimensions.height();
|
||||
_thumb = image->pixNoCache(maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), Images::Option::Smooth, maxW, maxH);
|
||||
}
|
||||
int32 tw = _thumb.width(), th = _thumb.height();
|
||||
qint32 tw = _thumb.width(), th = _thumb.height();
|
||||
if (!tw || !th) {
|
||||
tw = th = 1;
|
||||
}
|
||||
|
@ -547,10 +547,10 @@ EditCaptionBox::EditCaptionBox(QWidget*, HistoryMedia *media, FullMsgId msgId) :
|
|||
if (_thumb.width() < _thumbw) {
|
||||
_thumbw = (_thumb.width() > 20) ? _thumb.width() : 20;
|
||||
}
|
||||
int32 maxthumbh = qMin(qRound(1.5 * _thumbw), int(st::confirmMaxHeight));
|
||||
_thumbh = qRound(th * float64(_thumbw) / tw);
|
||||
qint32 maxthumbh = qMin(qRound(1.5 * _thumbw), int(st::confirmMaxHeight));
|
||||
_thumbh = qRound(th * double(_thumbw) / tw);
|
||||
if (_thumbh > maxthumbh) {
|
||||
_thumbw = qRound(_thumbw * float64(maxthumbh) / _thumbh);
|
||||
_thumbw = qRound(_thumbw * double(maxthumbh) / _thumbh);
|
||||
_thumbh = maxthumbh;
|
||||
if (_thumbw < 10) {
|
||||
_thumbw = 10;
|
||||
|
@ -677,9 +677,9 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
|
|||
icon->paintInCenter(p, inner);
|
||||
}
|
||||
} else if (_doc) {
|
||||
int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
|
||||
int32 h = _thumbw ? (0 + st::msgFileThumbSize + 0) : (0 + st::msgFileSize + 0);
|
||||
int32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0;
|
||||
qint32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
|
||||
qint32 h = _thumbw ? (0 + st::msgFileThumbSize + 0) : (0 + st::msgFileSize + 0);
|
||||
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0;
|
||||
if (_thumbw) {
|
||||
nameleft = 0 + st::msgFileThumbSize + st::msgFileThumbPadding.right();
|
||||
nametop = st::msgFileThumbNameTop - st::msgFileThumbPadding.top();
|
||||
|
@ -691,12 +691,12 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
|
|||
nameright = 0;
|
||||
statustop = st::msgFileStatusTop - st::msgFilePadding.top();
|
||||
}
|
||||
int32 namewidth = w - nameleft - 0;
|
||||
qint32 namewidth = w - nameleft - 0;
|
||||
if (namewidth > _statusw) {
|
||||
//w -= (namewidth - _statusw);
|
||||
//namewidth = _statusw;
|
||||
}
|
||||
int32 x = (width() - w) / 2, y = st::boxPhotoPadding.top();
|
||||
qint32 x = (width() - w) / 2, y = st::boxPhotoPadding.top();
|
||||
|
||||
// App::roundRect(p, x, y, w, h, st::msgInBg, MessageInCorners, &st::msgInShadow);
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
|
|||
// deviceModel = qsl("Linux");
|
||||
// }
|
||||
if (appVer == QString::number(appVer.toInt())) {
|
||||
int32 ver = appVer.toInt();
|
||||
qint32 ver = appVer.toInt();
|
||||
appVer = QString("%1.%2").arg(ver / 1000000).arg((ver % 1000000) / 1000) + ((ver % 1000) ? ('.' + QString::number(ver % 1000)) : QString());
|
||||
//} else {
|
||||
// appVer = QString();
|
||||
|
@ -140,7 +140,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
|
|||
if (!data.hash || (d.vflags.v & 1)) {
|
||||
data.active = lang(lng_sessions_header);
|
||||
data.activeWidth = st::sessionWhenFont->width(lang(lng_sessions_header));
|
||||
int32 availForName = availCurrent - st::sessionPadding.right() - data.activeWidth;
|
||||
qint32 availForName = availCurrent - st::sessionPadding.right() - data.activeWidth;
|
||||
if (data.nameWidth > availForName) {
|
||||
data.name = st::sessionNameFont->elided(data.name, availForName);
|
||||
data.nameWidth = st::sessionNameFont->width(data.name);
|
||||
|
@ -168,7 +168,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
|
|||
data.active = lastDate.toString(qsl("d.MM.yy"));
|
||||
}
|
||||
data.activeWidth = st::sessionWhenFont->width(data.active);
|
||||
int32 availForName = availOther - st::sessionPadding.right() - data.activeWidth;
|
||||
qint32 availForName = availOther - st::sessionPadding.right() - data.activeWidth;
|
||||
if (data.nameWidth > availForName) {
|
||||
data.name = st::sessionNameFont->elided(data.name, availForName);
|
||||
data.nameWidth = st::sessionNameFont->width(data.name);
|
||||
|
@ -185,7 +185,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
|
|||
}
|
||||
|
||||
_list.push_back(data);
|
||||
for (int32 i = _list.size(); i > 1;) {
|
||||
for (qint32 i = _list.size(); i > 1;) {
|
||||
--i;
|
||||
if (_list.at(i).activeTime > _list.at(i - 1).activeTime) {
|
||||
qSwap(_list[i], _list[i - 1]);
|
||||
|
@ -242,8 +242,8 @@ void SessionsBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
Painter p(this);
|
||||
|
||||
p.fillRect(r, st::boxBg);
|
||||
int32 x = st::sessionPadding.left(), xact = st::sessionTerminateSkip + st::sessionTerminate.iconPosition.x();// st::sessionTerminateSkip + st::sessionTerminate.width + st::sessionTerminateSkip;
|
||||
int32 w = width();
|
||||
qint32 x = st::sessionPadding.left(), xact = st::sessionTerminateSkip + st::sessionTerminate.iconPosition.x();// st::sessionTerminateSkip + st::sessionTerminate.width + st::sessionTerminateSkip;
|
||||
qint32 w = width();
|
||||
|
||||
if (_current->active.isEmpty() && _list->isEmpty()) {
|
||||
p.setFont(st::noContactsFont->f);
|
||||
|
@ -277,11 +277,11 @@ void SessionsBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
p.setFont(st::linkFont->f);
|
||||
int32 count = _list->size();
|
||||
int32 from = floorclamp(r.y() - st::sessionCurrentHeight, st::sessionHeight, 0, count);
|
||||
int32 to = ceilclamp(r.y() + r.height() - st::sessionCurrentHeight, st::sessionHeight, 0, count);
|
||||
qint32 count = _list->size();
|
||||
qint32 from = floorclamp(r.y() - st::sessionCurrentHeight, st::sessionHeight, 0, count);
|
||||
qint32 to = ceilclamp(r.y() + r.height() - st::sessionCurrentHeight, st::sessionHeight, 0, count);
|
||||
p.translate(0, from * st::sessionHeight);
|
||||
for (int32 i = from; i < to; ++i) {
|
||||
for (qint32 i = from; i < to; ++i) {
|
||||
const SessionsBox::Data &auth(_list->at(i));
|
||||
|
||||
p.setFont(st::sessionNameFont);
|
||||
|
@ -334,8 +334,8 @@ void SessionsBox::Inner::onTerminateAll() {
|
|||
})), KeepOtherLayers);
|
||||
}
|
||||
|
||||
void SessionsBox::Inner::terminateDone(uint64 hash, const MTPBool &result) {
|
||||
for (int32 i = 0, l = _list->size(); i < l; ++i) {
|
||||
void SessionsBox::Inner::terminateDone(quint64 hash, const MTPBool &result) {
|
||||
for (qint32 i = 0, l = _list->size(); i < l; ++i) {
|
||||
if (_list->at(i).hash == hash) {
|
||||
_list->removeAt(i);
|
||||
break;
|
||||
|
@ -345,7 +345,7 @@ void SessionsBox::Inner::terminateDone(uint64 hash, const MTPBool &result) {
|
|||
emit oneTerminated();
|
||||
}
|
||||
|
||||
bool SessionsBox::Inner::terminateFail(uint64 hash, const RPCError &error) {
|
||||
bool SessionsBox::Inner::terminateFail(quint64 hash, const RPCError &error) {
|
||||
if (MTP::isDefaultHandledError(error)) return false;
|
||||
|
||||
TerminateButtons::iterator i = _terminateButtons.find(hash);
|
||||
|
@ -379,7 +379,7 @@ void SessionsBox::Inner::listUpdated() {
|
|||
for (TerminateButtons::iterator i = _terminateButtons.begin(), e = _terminateButtons.end(); i != e; ++i) {
|
||||
i.value()->move(0, -1);
|
||||
}
|
||||
for (int32 i = 0, l = _list->size(); i < l; ++i) {
|
||||
for (qint32 i = 0, l = _list->size(); i < l; ++i) {
|
||||
TerminateButtons::iterator j = _terminateButtons.find(_list->at(i).hash);
|
||||
if (j == _terminateButtons.cend()) {
|
||||
j = _terminateButtons.insert(_list->at(i).hash, new Ui::IconButton(this, st::sessionTerminate));
|
||||
|
|
|
@ -52,10 +52,10 @@ private slots:
|
|||
private:
|
||||
void setLoading(bool loading);
|
||||
struct Data {
|
||||
uint64 hash;
|
||||
quint64 hash;
|
||||
|
||||
int32 activeTime;
|
||||
int32 nameWidth, activeWidth, infoWidth, ipWidth;
|
||||
qint32 activeTime;
|
||||
qint32 nameWidth, activeWidth, infoWidth, ipWidth;
|
||||
QString name, active, info, ip;
|
||||
};
|
||||
using List = QList<Data>;
|
||||
|
@ -98,8 +98,8 @@ public slots:
|
|||
void onTerminateAll();
|
||||
|
||||
private:
|
||||
void terminateDone(uint64 hash, const MTPBool &result);
|
||||
bool terminateFail(uint64 hash, const RPCError &error);
|
||||
void terminateDone(quint64 hash, const MTPBool &result);
|
||||
bool terminateFail(quint64 hash, const RPCError &error);
|
||||
|
||||
void terminateAllDone(const MTPBool &res);
|
||||
bool terminateAllFail(const RPCError &error);
|
||||
|
@ -107,7 +107,7 @@ private:
|
|||
SessionsBox::List *_list;
|
||||
SessionsBox::Data *_current;
|
||||
|
||||
typedef QMap<uint64, Ui::IconButton*> TerminateButtons;
|
||||
typedef QMap<quint64, Ui::IconButton*> TerminateButtons;
|
||||
TerminateButtons _terminateButtons;
|
||||
|
||||
object_ptr<Ui::LinkButton> _terminateAll;
|
||||
|
|
|
@ -64,7 +64,7 @@ void ShareBox::prepare() {
|
|||
setDimensions(st::boxWideWidth, st::boxMaxListHeight);
|
||||
|
||||
_select->setQueryChangedCallback([this](const QString &query) { onFilterUpdate(query); });
|
||||
_select->setItemRemovedCallback([this](uint64 itemId) {
|
||||
_select->setItemRemovedCallback([this](quint64 itemId) {
|
||||
if (auto peer = App::peerLoaded(itemId)) {
|
||||
_inner->peerUnselected(peer);
|
||||
onSelectedChanged();
|
||||
|
@ -481,7 +481,7 @@ ShareBox::Inner::Chat *ShareBox::Inner::getChat(Dialogs::Row *row) {
|
|||
|
||||
void ShareBox::Inner::setActive(int active) {
|
||||
if (active != _active) {
|
||||
auto changeNameFg = [this](int index, float64 from, float64 to) {
|
||||
auto changeNameFg = [this](int index, double from, double to) {
|
||||
if (auto chat = getChatAtIndex(index)) {
|
||||
chat->nameActive.start([this, peer = chat->peer] {
|
||||
repaintChat(peer);
|
||||
|
@ -620,7 +620,7 @@ void ShareBox::Inner::onSelectActive() {
|
|||
}
|
||||
|
||||
void ShareBox::Inner::resizeEvent(QResizeEvent *e) {
|
||||
_columnSkip = (width() - _columnCount * st::sharePhotoCheckbox.imageRadius * 2) / float64(_columnCount + 1);
|
||||
_columnSkip = (width() - _columnCount * st::sharePhotoCheckbox.imageRadius * 2) / double(_columnCount + 1);
|
||||
_rowWidthReal = st::sharePhotoCheckbox.imageRadius * 2 + _columnSkip;
|
||||
_rowsLeft = qFloor(_columnSkip / 2);
|
||||
_rowWidth = qFloor(_rowWidthReal);
|
||||
|
@ -743,7 +743,7 @@ void ShareBox::Inner::updateFilter(QString filter) {
|
|||
void ShareBox::Inner::peopleReceived(const QString &query, const QVector<MTPPeer> &people) {
|
||||
_lastQuery = query.toLower().trimmed();
|
||||
if (_lastQuery.at(0) == '@') _lastQuery = _lastQuery.mid(1);
|
||||
int32 already = _byUsernameFiltered.size();
|
||||
qint32 already = _byUsernameFiltered.size();
|
||||
_byUsernameFiltered.reserve(already + people.size());
|
||||
d_byUsernameFiltered.reserve(already + people.size());
|
||||
for_const (auto &mtpPeer, people) {
|
||||
|
@ -800,10 +800,10 @@ QVector<PeerData*> ShareBox::Inner::selected() const {
|
|||
|
||||
QString AppendShareGameScoreUrl(const QString &url, const FullMsgId &fullId) {
|
||||
auto shareHashData = QByteArray(0x10, Qt::Uninitialized);
|
||||
auto shareHashDataInts = reinterpret_cast<int32*>(shareHashData.data());
|
||||
auto shareHashDataInts = reinterpret_cast<qint32*>(shareHashData.data());
|
||||
auto channel = fullId.channel ? App::channelLoaded(fullId.channel) : static_cast<ChannelData*>(nullptr);
|
||||
auto channelAccessHash = channel ? channel->access : 0ULL;
|
||||
auto channelAccessHashInts = reinterpret_cast<int32*>(&channelAccessHash);
|
||||
auto channelAccessHashInts = reinterpret_cast<qint32*>(&channelAccessHash);
|
||||
shareHashDataInts[0] = Auth().userId();
|
||||
shareHashDataInts[1] = fullId.channel;
|
||||
shareHashDataInts[2] = fullId.msg;
|
||||
|
@ -815,7 +815,7 @@ QString AppendShareGameScoreUrl(const QString &url, const FullMsgId &fullId) {
|
|||
hashSha1(shareHashData.constData(), shareHashData.size(), shareHashEncrypted.data());
|
||||
|
||||
// Mix in channel access hash to the first 64 bits of SHA1 of data.
|
||||
*reinterpret_cast<uint64*>(shareHashEncrypted.data()) ^= *reinterpret_cast<uint64*>(channelAccessHashInts);
|
||||
*reinterpret_cast<quint64*>(shareHashEncrypted.data()) ^= *reinterpret_cast<quint64*>(channelAccessHashInts);
|
||||
|
||||
// Encrypt data.
|
||||
if (!Local::encrypt(shareHashData.constData(), shareHashEncrypted.data() + key128Size, shareHashData.size(), shareHashEncrypted.constData())) {
|
||||
|
@ -861,7 +861,7 @@ void ShareGameScoreByHash(const QString &hash) {
|
|||
hashSha1(hashData.constData(), hashData.size(), dataSha1);
|
||||
|
||||
// Mix out channel access hash from the first 64 bits of SHA1 of data.
|
||||
auto channelAccessHash = *reinterpret_cast<uint64*>(hashEncrypted.data()) ^ *reinterpret_cast<uint64*>(dataSha1);
|
||||
auto channelAccessHash = *reinterpret_cast<quint64*>(hashEncrypted.data()) ^ *reinterpret_cast<quint64*>(dataSha1);
|
||||
|
||||
// Check next 64 bits of SHA1() of data.
|
||||
auto skipSha1Part = sizeof(channelAccessHash);
|
||||
|
@ -870,14 +870,14 @@ void ShareGameScoreByHash(const QString &hash) {
|
|||
return;
|
||||
}
|
||||
|
||||
auto hashDataInts = reinterpret_cast<int32*>(hashData.data());
|
||||
auto hashDataInts = reinterpret_cast<qint32*>(hashData.data());
|
||||
if (!AuthSession::Exists() || hashDataInts[0] != Auth().userId()) {
|
||||
Ui::show(Box<InformBox>(lang(lng_share_wrong_user)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check first 32 bits of channel access hash.
|
||||
auto channelAccessHashInts = reinterpret_cast<int32*>(&channelAccessHash);
|
||||
auto channelAccessHashInts = reinterpret_cast<qint32*>(&channelAccessHash);
|
||||
if (channelAccessHashInts[0] != hashDataInts[3]) {
|
||||
Ui::show(Box<InformBox>(lang(lng_share_wrong_user)));
|
||||
return;
|
||||
|
|
|
@ -182,8 +182,8 @@ private:
|
|||
|
||||
void refresh();
|
||||
|
||||
float64 _columnSkip = 0.;
|
||||
float64 _rowWidthReal = 0.;
|
||||
double _columnSkip = 0.;
|
||||
double _rowWidthReal = 0.;
|
||||
int _rowsLeft = 0;
|
||||
int _rowsTop = 0;
|
||||
int _rowWidth = 0;
|
||||
|
|
|
@ -56,10 +56,10 @@ void StickerSetBox::prepare() {
|
|||
onUpdateButtons();
|
||||
|
||||
connect(_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons()));
|
||||
connect(_inner, SIGNAL(installed(uint64)), this, SLOT(onInstalled(uint64)));
|
||||
connect(_inner, SIGNAL(installed(quint64)), this, SLOT(onInstalled(quint64)));
|
||||
}
|
||||
|
||||
void StickerSetBox::onInstalled(uint64 setId) {
|
||||
void StickerSetBox::onInstalled(quint64 setId) {
|
||||
emit installed(setId);
|
||||
closeBox();
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void StickerSetBox::Inner::gotSet(const MTPmessages_StickerSet &set) {
|
|||
if (_pack.isEmpty()) {
|
||||
Ui::show(Box<InformBox>(lang(lng_stickers_not_found)));
|
||||
} else {
|
||||
int32 rows = _pack.size() / kStickersPanelPerRow + ((_pack.size() % kStickersPanelPerRow) ? 1 : 0);
|
||||
qint32 rows = _pack.size() / kStickersPanelPerRow + ((_pack.size() % kStickersPanelPerRow) ? 1 : 0);
|
||||
resize(st::stickersPadding.left() + kStickersPanelPerRow * st::stickersSize.width(), st::stickersPadding.top() + rows * st::stickersSize.height() + st::stickersPadding.bottom());
|
||||
}
|
||||
_loaded = true;
|
||||
|
@ -315,7 +315,7 @@ void StickerSetBox::Inner::setSelected(int selected) {
|
|||
}
|
||||
}
|
||||
|
||||
void StickerSetBox::Inner::startOverAnimation(int index, float64 from, float64 to) {
|
||||
void StickerSetBox::Inner::startOverAnimation(int index, double from, double to) {
|
||||
if (index >= 0 && index < _packOvers.size()) {
|
||||
_packOvers[index].start([this, index] {
|
||||
int row = index / kStickersPanelPerRow;
|
||||
|
@ -335,13 +335,13 @@ void StickerSetBox::Inner::onPreview() {
|
|||
}
|
||||
}
|
||||
|
||||
int32 StickerSetBox::Inner::stickerFromGlobalPos(const QPoint &p) const {
|
||||
qint32 StickerSetBox::Inner::stickerFromGlobalPos(const QPoint &p) const {
|
||||
QPoint l(mapFromGlobal(p));
|
||||
if (rtl()) l.setX(width() - l.x());
|
||||
int32 row = (l.y() >= st::stickersPadding.top()) ? qFloor((l.y() - st::stickersPadding.top()) / st::stickersSize.height()) : -1;
|
||||
int32 col = (l.x() >= st::stickersPadding.left()) ? qFloor((l.x() - st::stickersPadding.left()) / st::stickersSize.width()) : -1;
|
||||
qint32 row = (l.y() >= st::stickersPadding.top()) ? qFloor((l.y() - st::stickersPadding.top()) / st::stickersSize.height()) : -1;
|
||||
qint32 col = (l.x() >= st::stickersPadding.left()) ? qFloor((l.x() - st::stickersPadding.left()) / st::stickersSize.width()) : -1;
|
||||
if (row >= 0 && col >= 0 && col < kStickersPanelPerRow) {
|
||||
int32 result = row * kStickersPanelPerRow + col;
|
||||
qint32 result = row * kStickersPanelPerRow + col;
|
||||
return (result < _pack.size()) ? result : -1;
|
||||
}
|
||||
return -1;
|
||||
|
@ -354,12 +354,12 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
if (_pack.isEmpty()) return;
|
||||
|
||||
auto ms = getms();
|
||||
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;
|
||||
qint32 rows = _pack.size() / kStickersPanelPerRow + ((_pack.size() % kStickersPanelPerRow) ? 1 : 0);
|
||||
qint32 from = qFloor(e->rect().top() / st::stickersSize.height()), to = qFloor(e->rect().bottom() / st::stickersSize.height()) + 1;
|
||||
|
||||
for (int32 i = from; i < to; ++i) {
|
||||
for (int32 j = 0; j < kStickersPanelPerRow; ++j) {
|
||||
int32 index = i * kStickersPanelPerRow + j;
|
||||
for (qint32 i = from; i < to; ++i) {
|
||||
for (qint32 j = 0; j < kStickersPanelPerRow; ++j) {
|
||||
qint32 index = i * kStickersPanelPerRow + j;
|
||||
if (index >= _pack.size()) break;
|
||||
Assert(index < _packOvers.size());
|
||||
|
||||
|
@ -386,9 +386,9 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
}
|
||||
|
||||
float64 coef = qMin((st::stickersSize.width() - st::buttonRadius * 2) / float64(doc->dimensions.width()), (st::stickersSize.height() - st::buttonRadius * 2) / float64(doc->dimensions.height()));
|
||||
double coef = qMin((st::stickersSize.width() - st::buttonRadius * 2) / double(doc->dimensions.width()), (st::stickersSize.height() - st::buttonRadius * 2) / double(doc->dimensions.height()));
|
||||
if (coef > 1) coef = 1;
|
||||
int32 w = qRound(coef * doc->dimensions.width()), h = qRound(coef * doc->dimensions.height());
|
||||
qint32 w = qRound(coef * doc->dimensions.width()), h = qRound(coef * doc->dimensions.height());
|
||||
if (w < 1) w = 1;
|
||||
if (h < 1) h = 1;
|
||||
QPoint ppos = pos + QPoint((st::stickersSize.width() - w) / 2, (st::stickersSize.height() - h) / 2);
|
||||
|
@ -410,7 +410,7 @@ bool StickerSetBox::Inner::loaded() const {
|
|||
return _loaded && !_pack.isEmpty();
|
||||
}
|
||||
|
||||
int32 StickerSetBox::Inner::notInstalled() const {
|
||||
qint32 StickerSetBox::Inner::notInstalled() const {
|
||||
if (!_loaded) return 0;
|
||||
auto it = Global::StickerSets().constFind(_setId);
|
||||
if (it == Global::StickerSets().cend() || !(it->flags & MTPDstickerSet::Flag::f_installed) || (it->flags & MTPDstickerSet::Flag::f_archived)) return _pack.size();
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
StickerSetBox(QWidget*, const MTPInputStickerSet &set);
|
||||
|
||||
signals:
|
||||
void installed(uint64 id);
|
||||
void installed(quint64 id);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
@ -48,7 +48,7 @@ private slots:
|
|||
void onShareStickers();
|
||||
void onUpdateButtons();
|
||||
|
||||
void onInstalled(uint64 id);
|
||||
void onInstalled(quint64 id);
|
||||
|
||||
private:
|
||||
void updateButtons();
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
Inner(QWidget *parent, const MTPInputStickerSet &set);
|
||||
|
||||
bool loaded() const;
|
||||
int32 notInstalled() const;
|
||||
qint32 notInstalled() const;
|
||||
bool official() const;
|
||||
base::lambda<TextWithEntities()> title() const;
|
||||
QString shortName() const;
|
||||
|
@ -90,12 +90,12 @@ private slots:
|
|||
|
||||
signals:
|
||||
void updateButtons();
|
||||
void installed(uint64 id);
|
||||
void installed(quint64 id);
|
||||
|
||||
private:
|
||||
void updateSelected();
|
||||
void setSelected(int selected);
|
||||
void startOverAnimation(int index, float64 from, float64 to);
|
||||
void startOverAnimation(int index, double from, double to);
|
||||
int stickerFromGlobalPos(const QPoint &p) const;
|
||||
|
||||
void gotSet(const MTPmessages_StickerSet &set);
|
||||
|
@ -112,11 +112,11 @@ private:
|
|||
StickerPack _pack;
|
||||
StickersByEmojiMap _emoji;
|
||||
bool _loaded = false;
|
||||
uint64 _setId = 0;
|
||||
uint64 _setAccess = 0;
|
||||
quint64 _setId = 0;
|
||||
quint64 _setAccess = 0;
|
||||
QString _setTitle, _setShortName;
|
||||
int32 _setCount = 0;
|
||||
int32 _setHash = 0;
|
||||
qint32 _setCount = 0;
|
||||
qint32 _setHash = 0;
|
||||
MTPDstickerSet::Flags _setFlags = 0;
|
||||
|
||||
int _visibleTop = 0;
|
||||
|
|
|
@ -156,7 +156,7 @@ StickersBox::StickersBox(QWidget*, not_null<ChannelData*> megagroup)
|
|||
subscribe(_installed.widget()->scrollToY, [this](int y) { onScrollToY(y); });
|
||||
}
|
||||
|
||||
void StickersBox::getArchivedDone(uint64 offsetId, const MTPmessages_ArchivedStickers &result) {
|
||||
void StickersBox::getArchivedDone(quint64 offsetId, const MTPmessages_ArchivedStickers &result) {
|
||||
_archivedRequestId = 0;
|
||||
_archivedLoaded = true;
|
||||
if (result.type() != mtpc_messages_archivedStickers) {
|
||||
|
@ -253,10 +253,10 @@ void StickersBox::prepare() {
|
|||
if (_archived.widget() && _section != Section::Archived) _archived.widget()->hide();
|
||||
|
||||
if (_featured.widget()) {
|
||||
_featured.widget()->setInstallSetCallback([this](uint64 setId) { installSet(setId); });
|
||||
_featured.widget()->setInstallSetCallback([this](quint64 setId) { installSet(setId); });
|
||||
}
|
||||
if (_archived.widget()) {
|
||||
_archived.widget()->setInstallSetCallback([this](uint64 setId) { installSet(setId); });
|
||||
_archived.widget()->setInstallSetCallback([this](quint64 setId) { installSet(setId); });
|
||||
_archived.widget()->setLoadMoreCallback([this] { loadMoreArchived(); });
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ void StickersBox::loadMoreArchived() {
|
|||
return;
|
||||
}
|
||||
|
||||
uint64 lastId = 0;
|
||||
quint64 lastId = 0;
|
||||
for (auto setIt = Global::ArchivedStickerSetsOrder().cend(), e = Global::ArchivedStickerSetsOrder().cbegin(); setIt != e;) {
|
||||
--setIt;
|
||||
auto it = Global::StickerSets().constFind(*setIt);
|
||||
|
@ -441,7 +441,7 @@ QPixmap StickersBox::grabContentCache() {
|
|||
return result;
|
||||
}
|
||||
|
||||
void StickersBox::installSet(uint64 setId) {
|
||||
void StickersBox::installSet(quint64 setId) {
|
||||
auto &sets = Global::RefStickerSets();
|
||||
auto it = sets.find(setId);
|
||||
if (it == sets.cend()) {
|
||||
|
@ -468,7 +468,7 @@ void StickersBox::installDone(const MTPmessages_StickerSetInstallResult &result)
|
|||
}
|
||||
}
|
||||
|
||||
bool StickersBox::installFail(uint64 setId, const RPCError &error) {
|
||||
bool StickersBox::installFail(quint64 setId, const RPCError &error) {
|
||||
if (MTP::isDefaultHandledError(error)) return false;
|
||||
|
||||
auto &sets = Global::RefStickerSets();
|
||||
|
@ -568,7 +568,7 @@ void StickersBox::setInnerFocus() {
|
|||
|
||||
StickersBox::~StickersBox() = default;
|
||||
|
||||
StickersBox::Inner::Row::Row(uint64 id, DocumentData *sticker, int32 count, const QString &title, int titleWidth, bool installed, bool official, bool unread, bool archived, bool removed, int32 pixw, int32 pixh) : id(id)
|
||||
StickersBox::Inner::Row::Row(quint64 id, DocumentData *sticker, qint32 count, const QString &title, int titleWidth, bool installed, bool official, bool unread, bool archived, bool removed, qint32 pixw, qint32 pixh) : id(id)
|
||||
, sticker(sticker)
|
||||
, count(count)
|
||||
, title(title)
|
||||
|
@ -654,11 +654,11 @@ void StickersBox::Inner::paintEvent(QPaintEvent *e) {
|
|||
} else {
|
||||
p.translate(0, _itemsTop);
|
||||
|
||||
int32 yFrom = clip.y() - _itemsTop, yTo = clip.y() + clip.height() - _itemsTop;
|
||||
int32 from = floorclamp(yFrom - _rowHeight, _rowHeight, 0, _rows.size());
|
||||
int32 to = ceilclamp(yTo + _rowHeight, _rowHeight, 0, _rows.size());
|
||||
qint32 yFrom = clip.y() - _itemsTop, yTo = clip.y() + clip.height() - _itemsTop;
|
||||
qint32 from = floorclamp(yFrom - _rowHeight, _rowHeight, 0, _rows.size());
|
||||
qint32 to = ceilclamp(yTo + _rowHeight, _rowHeight, 0, _rows.size());
|
||||
p.translate(0, from * _rowHeight);
|
||||
for (int32 i = from; i < to; ++i) {
|
||||
for (qint32 i = from; i < to; ++i) {
|
||||
if (i != _above) {
|
||||
paintRow(p, _rows[i].get(), i, ms);
|
||||
}
|
||||
|
@ -957,14 +957,14 @@ void StickersBox::Inner::onUpdateSelected() {
|
|||
}
|
||||
if (_dragStart.y() > local.y() && _dragging > 0) {
|
||||
shift = -floorclamp(_dragStart.y() - local.y() + (_rowHeight / 2), _rowHeight, 0, _dragging - firstSetIndex);
|
||||
for (int32 from = _dragging, to = _dragging + shift; from > to; --from) {
|
||||
for (qint32 from = _dragging, to = _dragging + shift; from > to; --from) {
|
||||
qSwap(_rows[from], _rows[from - 1]);
|
||||
_rows[from]->yadd = anim::value(_rows[from]->yadd.current() - _rowHeight, 0);
|
||||
_animStartTimes[from] = ms;
|
||||
}
|
||||
} else if (_dragStart.y() < local.y() && _dragging + 1 < _rows.size()) {
|
||||
shift = floorclamp(local.y() - _dragStart.y() + (_rowHeight / 2), _rowHeight, 0, _rows.size() - _dragging - 1);
|
||||
for (int32 from = _dragging, to = _dragging + shift; from < to; ++from) {
|
||||
for (qint32 from = _dragging, to = _dragging + shift; from < to; ++from) {
|
||||
qSwap(_rows[from], _rows[from + 1]);
|
||||
_rows[from]->yadd = anim::value(_rows[from]->yadd.current() + _rowHeight, 0);
|
||||
_animStartTimes[from] = ms;
|
||||
|
@ -1033,7 +1033,7 @@ void StickersBox::Inner::onUpdateSelected() {
|
|||
}
|
||||
}
|
||||
|
||||
float64 StickersBox::Inner::aboveShadowOpacity() const {
|
||||
double StickersBox::Inner::aboveShadowOpacity() const {
|
||||
if (_above < 0) return 0;
|
||||
|
||||
auto dx = 0;
|
||||
|
@ -1126,7 +1126,7 @@ void StickersBox::Inner::step_shifting(TimeMs ms, bool timer) {
|
|||
if (updateMin < 0) updateMin = i;
|
||||
updateMax = i;
|
||||
if (start + st::stickersRowDuration > ms && ms >= start) {
|
||||
_rows[i]->yadd.update(float64(ms - start) / st::stickersRowDuration, anim::sineInOut);
|
||||
_rows[i]->yadd.update(double(ms - start) / st::stickersRowDuration, anim::sineInOut);
|
||||
animating = true;
|
||||
} else {
|
||||
_rows[i]->yadd.finish();
|
||||
|
@ -1138,7 +1138,7 @@ void StickersBox::Inner::step_shifting(TimeMs ms, bool timer) {
|
|||
if (updateMin < 0 || updateMin > _above) updateMin = _above;
|
||||
if (updateMax < _above) updateMin = _above;
|
||||
if (_aboveShadowFadeStart + st::stickersRowDuration > ms && ms > _aboveShadowFadeStart) {
|
||||
_aboveShadowFadeOpacity.update(float64(ms - _aboveShadowFadeStart) / st::stickersRowDuration, anim::sineInOut);
|
||||
_aboveShadowFadeOpacity.update(double(ms - _aboveShadowFadeStart) / st::stickersRowDuration, anim::sineInOut);
|
||||
animating = true;
|
||||
} else {
|
||||
_aboveShadowFadeOpacity.finish();
|
||||
|
@ -1179,7 +1179,7 @@ void StickersBox::Inner::clear() {
|
|||
update();
|
||||
}
|
||||
|
||||
void StickersBox::Inner::setActionSel(int32 actionSel) {
|
||||
void StickersBox::Inner::setActionSel(qint32 actionSel) {
|
||||
if (actionSel != _actionSel) {
|
||||
if (_actionSel >= 0) update(0, _itemsTop + _actionSel * _rowHeight, width(), _rowHeight);
|
||||
_actionSel = actionSel;
|
||||
|
@ -1502,7 +1502,7 @@ Stickers::Order StickersBox::Inner::getRemovedSets() const {
|
|||
});
|
||||
}
|
||||
|
||||
int StickersBox::Inner::getRowIndex(uint64 setId) const {
|
||||
int StickersBox::Inner::getRowIndex(quint64 setId) const {
|
||||
for (auto i = 0, count = int(_rows.size()); i != count; ++i) {
|
||||
auto &row = _rows[i];
|
||||
if (row->id == setId) {
|
||||
|
|
|
@ -96,19 +96,19 @@ private:
|
|||
void rebuildList(Tab *tab = nullptr);
|
||||
void updateTabsGeometry();
|
||||
void switchTab();
|
||||
void installSet(uint64 setId);
|
||||
void installSet(quint64 setId);
|
||||
int getTopSkip() const;
|
||||
void saveChanges();
|
||||
|
||||
QPixmap grabContentCache();
|
||||
|
||||
void installDone(const MTPmessages_StickerSetInstallResult &result);
|
||||
bool installFail(uint64 setId, const RPCError &error);
|
||||
bool installFail(quint64 setId, const RPCError &error);
|
||||
|
||||
void preloadArchivedSets();
|
||||
void requestArchivedSets();
|
||||
void loadMoreArchived();
|
||||
void getArchivedDone(uint64 offsetId, const MTPmessages_ArchivedStickers &result);
|
||||
void getArchivedDone(quint64 offsetId, const MTPmessages_ArchivedStickers &result);
|
||||
|
||||
object_ptr<Ui::SettingsSlider> _tabs = { nullptr };
|
||||
QList<Section> _tabIndices;
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
void setFullOrder(const Stickers::Order &order);
|
||||
void setRemovedSets(const Stickers::Order &removed);
|
||||
|
||||
void setInstallSetCallback(base::lambda<void(uint64 setId)> callback) {
|
||||
void setInstallSetCallback(base::lambda<void(quint64 setId)> callback) {
|
||||
_installSetCallback = std::move(callback);
|
||||
}
|
||||
void setLoadMoreCallback(base::lambda<void()> callback) {
|
||||
|
@ -199,15 +199,15 @@ public slots:
|
|||
|
||||
private:
|
||||
struct Row {
|
||||
Row(uint64 id, DocumentData *sticker, int32 count, const QString &title, int titleWidth, bool installed, bool official, bool unread, bool archived, bool removed, int32 pixw, int32 pixh);
|
||||
Row(quint64 id, DocumentData *sticker, qint32 count, const QString &title, int titleWidth, bool installed, bool official, bool unread, bool archived, bool removed, qint32 pixw, qint32 pixh);
|
||||
bool isRecentSet() const {
|
||||
return (id == Stickers::CloudRecentSetId);
|
||||
}
|
||||
~Row();
|
||||
|
||||
uint64 id = 0;
|
||||
quint64 id = 0;
|
||||
DocumentData *sticker = nullptr;
|
||||
int32 count = 0;
|
||||
qint32 count = 0;
|
||||
QString title;
|
||||
int titleWidth = 0;
|
||||
bool installed = false;
|
||||
|
@ -215,8 +215,8 @@ private:
|
|||
bool unread = false;
|
||||
bool archived = false;
|
||||
bool removed = false;
|
||||
int32 pixw = 0;
|
||||
int32 pixh = 0;
|
||||
qint32 pixw = 0;
|
||||
qint32 pixh = 0;
|
||||
anim::value yadd;
|
||||
std::unique_ptr<Ui::RippleAnimation> ripple;
|
||||
};
|
||||
|
@ -226,7 +226,7 @@ private:
|
|||
|
||||
void checkLoadMore();
|
||||
void updateScrollbarWidth();
|
||||
int getRowIndex(uint64 setId) const;
|
||||
int getRowIndex(quint64 setId) const;
|
||||
void setRowRemoved(int index, bool removed);
|
||||
|
||||
void setSelected(int selected);
|
||||
|
@ -240,8 +240,8 @@ private:
|
|||
void paintRow(Painter &p, Row *set, int index, TimeMs ms);
|
||||
void paintFakeButton(Painter &p, Row *set, int index, TimeMs ms);
|
||||
void clear();
|
||||
void setActionSel(int32 actionSel);
|
||||
float64 aboveShadowOpacity() const;
|
||||
void setActionSel(qint32 actionSel);
|
||||
double aboveShadowOpacity() const;
|
||||
|
||||
void readVisibleSets();
|
||||
|
||||
|
@ -259,7 +259,7 @@ private:
|
|||
|
||||
Section _section;
|
||||
|
||||
int32 _rowHeight;
|
||||
qint32 _rowHeight;
|
||||
|
||||
std::vector<std::unique_ptr<Row>> _rows;
|
||||
QList<TimeMs> _animStartTimes;
|
||||
|
@ -267,7 +267,7 @@ private:
|
|||
anim::value _aboveShadowFadeOpacity;
|
||||
BasicAnimation _a_shifting;
|
||||
|
||||
base::lambda<void(uint64 setId)> _installSetCallback;
|
||||
base::lambda<void(quint64 setId)> _installSetCallback;
|
||||
base::lambda<void()> _loadMoreCallback;
|
||||
|
||||
int _visibleTop = 0;
|
||||
|
|
|
@ -79,10 +79,10 @@ void UsernameBox::paintEvent(QPaintEvent *e) {
|
|||
p.drawTextLeft(st::usernamePadding.left(), _username->y() + _username->height() + ((st::usernameSkip - st::boxTextFont->height) / 2), width(), lang(lng_username_choose));
|
||||
}
|
||||
p.setPen(st::boxTextFg);
|
||||
int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw);
|
||||
qint32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw);
|
||||
_about.drawLeft(p, st::usernamePadding.left(), _username->y() + _username->height() + st::usernameSkip, availw, width());
|
||||
|
||||
int32 linky = _username->y() + _username->height() + st::usernameSkip + h + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2);
|
||||
qint32 linky = _username->y() + _username->height() + st::usernameSkip + h + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2);
|
||||
if (_link->isHidden()) {
|
||||
p.drawTextLeft(st::usernamePadding.left(), linky, width(), lang(lng_username_link_willbe));
|
||||
p.setPen(st::usernameDefaultFg);
|
||||
|
@ -98,8 +98,8 @@ void UsernameBox::resizeEvent(QResizeEvent *e) {
|
|||
_username->resize(width() - st::usernamePadding.left() - st::usernamePadding.right(), _username->height());
|
||||
_username->moveToLeft(st::usernamePadding.left(), st::usernamePadding.top());
|
||||
|
||||
int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw);
|
||||
int32 linky = _username->y() + _username->height() + st::usernameSkip + h + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2);
|
||||
qint32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw);
|
||||
qint32 linky = _username->y() + _username->height() + st::usernameSkip + h + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2);
|
||||
_link->moveToLeft(st::usernamePadding.left(), linky + st::usernameTextStyle.lineHeight + ((st::usernameTextStyle.lineHeight - st::boxTextFont->height) / 2));
|
||||
}
|
||||
|
||||
|
@ -131,8 +131,8 @@ void UsernameBox::onChanged() {
|
|||
}
|
||||
_checkTimer->stop();
|
||||
} else {
|
||||
int32 len = name.size();
|
||||
for (int32 i = 0; i < len; ++i) {
|
||||
qint32 len = name.size();
|
||||
for (qint32 i = 0; i < len; ++i) {
|
||||
QChar ch = name.at(i);
|
||||
if ((ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && (ch < '0' || ch > '9') && ch != '_' && (ch != '@' || i > 0)) {
|
||||
if (_errorText != lang(lng_username_bad_symbols)) {
|
||||
|
@ -243,4 +243,4 @@ void UsernameBox::updateLinkText() {
|
|||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,16 +63,16 @@ void ConvertEndpoint(std::vector<tgvoip::Endpoint> &ep, const MTPDphoneConnectio
|
|||
}
|
||||
|
||||
constexpr auto kFingerprintDataSize = 256;
|
||||
uint64 ComputeFingerprint(const std::array<gsl::byte, kFingerprintDataSize> &authKey) {
|
||||
quint64 ComputeFingerprint(const std::array<gsl::byte, kFingerprintDataSize> &authKey) {
|
||||
auto hash = openssl::Sha1(authKey);
|
||||
return (gsl::to_integer<uint64>(hash[19]) << 56)
|
||||
| (gsl::to_integer<uint64>(hash[18]) << 48)
|
||||
| (gsl::to_integer<uint64>(hash[17]) << 40)
|
||||
| (gsl::to_integer<uint64>(hash[16]) << 32)
|
||||
| (gsl::to_integer<uint64>(hash[15]) << 24)
|
||||
| (gsl::to_integer<uint64>(hash[14]) << 16)
|
||||
| (gsl::to_integer<uint64>(hash[13]) << 8)
|
||||
| (gsl::to_integer<uint64>(hash[12]));
|
||||
return (gsl::to_integer<quint64>(hash[19]) << 56)
|
||||
| (gsl::to_integer<quint64>(hash[18]) << 48)
|
||||
| (gsl::to_integer<quint64>(hash[17]) << 40)
|
||||
| (gsl::to_integer<quint64>(hash[16]) << 32)
|
||||
| (gsl::to_integer<quint64>(hash[15]) << 24)
|
||||
| (gsl::to_integer<quint64>(hash[14]) << 16)
|
||||
| (gsl::to_integer<quint64>(hash[13]) << 8)
|
||||
| (gsl::to_integer<quint64>(hash[12]));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -137,7 +137,7 @@ void Call::startOutgoing() {
|
|||
Expects(_type == Type::Outgoing);
|
||||
Expects(_state == State::Requesting);
|
||||
|
||||
request(MTPphone_RequestCall(_user->inputUser, MTP_int(rand_value<int32>()), MTP_bytes(_gaHash), MTP_phoneCallProtocol(MTP_flags(MTPDphoneCallProtocol::Flag::f_udp_p2p | MTPDphoneCallProtocol::Flag::f_udp_reflector), MTP_int(kMinLayer), MTP_int(kMaxLayer)))).done([this](const MTPphone_PhoneCall &result) {
|
||||
request(MTPphone_RequestCall(_user->inputUser, MTP_int(rand_value<qint32>()), MTP_bytes(_gaHash), MTP_phoneCallProtocol(MTP_flags(MTPDphoneCallProtocol::Flag::f_udp_p2p | MTPDphoneCallProtocol::Flag::f_udp_reflector), MTP_int(kMinLayer), MTP_int(kMaxLayer)))).done([this](const MTPphone_PhoneCall &result) {
|
||||
Expects(result.type() == mtpc_phone_phoneCall);
|
||||
|
||||
setState(State::Waiting);
|
||||
|
@ -267,7 +267,7 @@ void Call::startWaitingTrack() {
|
|||
_waitingTrack->playInLoop();
|
||||
}
|
||||
|
||||
float64 Call::getWaitingSoundPeakValue() const {
|
||||
double Call::getWaitingSoundPeakValue() const {
|
||||
if (_waitingTrack) {
|
||||
auto when = getms() + kSoundSampleMs / 4;
|
||||
return _waitingTrack->getPeakValue(when);
|
||||
|
|
|
@ -38,8 +38,8 @@ class VoIPController;
|
|||
namespace Calls {
|
||||
|
||||
struct DhConfig {
|
||||
int32 version = 0;
|
||||
int32 g = 0;
|
||||
qint32 version = 0;
|
||||
qint32 g = 0;
|
||||
std::vector<gsl::byte> p;
|
||||
};
|
||||
|
||||
|
@ -115,7 +115,7 @@ public:
|
|||
}
|
||||
|
||||
TimeMs getDurationMs() const;
|
||||
float64 getWaitingSoundPeakValue() const;
|
||||
double getWaitingSoundPeakValue() const;
|
||||
|
||||
void answer();
|
||||
void hangup();
|
||||
|
@ -179,9 +179,9 @@ private:
|
|||
MTP::AuthKey::Data _authKey;
|
||||
MTPPhoneCallProtocol _protocol;
|
||||
|
||||
uint64 _id = 0;
|
||||
uint64 _accessHash = 0;
|
||||
uint64 _keyFingerprint = 0;
|
||||
quint64 _id = 0;
|
||||
quint64 _accessHash = 0;
|
||||
quint64 _keyFingerprint = 0;
|
||||
|
||||
std::unique_ptr<tgvoip::VoIPController> _controller;
|
||||
|
||||
|
|
|
@ -112,16 +112,16 @@ ushort Offsets[] = {
|
|||
620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 640, 641,
|
||||
642, 643, 644, 646, 648, 650, 652, 654, 656, 658 };
|
||||
|
||||
uint64 ComputeEmojiIndex(base::const_byte_span bytes) {
|
||||
quint64 ComputeEmojiIndex(base::const_byte_span bytes) {
|
||||
Expects(bytes.size() == 8);
|
||||
return ((gsl::to_integer<uint64>(bytes[0]) & 0x7F) << 56)
|
||||
| (gsl::to_integer<uint64>(bytes[1]) << 48)
|
||||
| (gsl::to_integer<uint64>(bytes[2]) << 40)
|
||||
| (gsl::to_integer<uint64>(bytes[3]) << 32)
|
||||
| (gsl::to_integer<uint64>(bytes[4]) << 24)
|
||||
| (gsl::to_integer<uint64>(bytes[5]) << 16)
|
||||
| (gsl::to_integer<uint64>(bytes[6]) << 8)
|
||||
| (gsl::to_integer<uint64>(bytes[7]));
|
||||
return ((gsl::to_integer<quint64>(bytes[0]) & 0x7F) << 56)
|
||||
| (gsl::to_integer<quint64>(bytes[1]) << 48)
|
||||
| (gsl::to_integer<quint64>(bytes[2]) << 40)
|
||||
| (gsl::to_integer<quint64>(bytes[3]) << 32)
|
||||
| (gsl::to_integer<quint64>(bytes[4]) << 24)
|
||||
| (gsl::to_integer<quint64>(bytes[5]) << 16)
|
||||
| (gsl::to_integer<quint64>(bytes[6]) << 8)
|
||||
| (gsl::to_integer<quint64>(bytes[7]));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -49,8 +49,8 @@ class Panel::Button : public Ui::RippleButton {
|
|||
public:
|
||||
Button(QWidget *parent, const style::CallButton &stFrom, const style::CallButton *stTo = nullptr);
|
||||
|
||||
void setProgress(float64 progress);
|
||||
void setOuterValue(float64 value);
|
||||
void setProgress(double progress);
|
||||
void setOuterValue(double value);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
@ -66,13 +66,13 @@ private:
|
|||
|
||||
not_null<const style::CallButton*> _stFrom;
|
||||
const style::CallButton *_stTo = nullptr;
|
||||
float64 _progress = 0.;
|
||||
double _progress = 0.;
|
||||
|
||||
QImage _bgMask, _bg;
|
||||
QPixmap _bgFrom, _bgTo;
|
||||
QImage _iconMixedMask, _iconFrom, _iconTo, _iconMixed;
|
||||
|
||||
float64 _outerValue = 0.;
|
||||
double _outerValue = 0.;
|
||||
Animation _outerAnimation;
|
||||
|
||||
};
|
||||
|
@ -114,7 +114,7 @@ Panel::Button::Button(QWidget *parent, const style::CallButton &stFrom, const st
|
|||
}
|
||||
}
|
||||
|
||||
void Panel::Button::setOuterValue(float64 value) {
|
||||
void Panel::Button::setOuterValue(double value) {
|
||||
if (_outerValue != value) {
|
||||
_outerAnimation.start([this] {
|
||||
if (_progress == 0. || _progress == 1.) {
|
||||
|
@ -125,7 +125,7 @@ void Panel::Button::setOuterValue(float64 value) {
|
|||
}
|
||||
}
|
||||
|
||||
void Panel::Button::setProgress(float64 progress) {
|
||||
void Panel::Button::setProgress(double progress) {
|
||||
_progress = progress;
|
||||
update();
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ void Panel::Button::mixIconMasks() {
|
|||
|
||||
Painter p(&_iconMixedMask);
|
||||
PainterHighQualityEnabler hq(p);
|
||||
auto paintIconMask = [this, &p](const QImage &mask, float64 angle) {
|
||||
auto paintIconMask = [this, &p](const QImage &mask, double angle) {
|
||||
auto skipFrom = _stFrom->button.rippleAreaSize / 2;
|
||||
p.translate(skipFrom, skipFrom);
|
||||
p.rotate(angle);
|
||||
|
|
|
@ -60,7 +60,7 @@ int BotKeyboard::Style::buttonRadius() const {
|
|||
return st::buttonRadius;
|
||||
}
|
||||
|
||||
void BotKeyboard::Style::paintButtonBg(Painter &p, const QRect &rect, float64 howMuchOver) const {
|
||||
void BotKeyboard::Style::paintButtonBg(Painter &p, const QRect &rect, double howMuchOver) const {
|
||||
App::roundRect(p, rect, st::botKbBg, BotKeyboardCorners);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ private:
|
|||
void repaint(not_null<const HistoryItem*> item) const override;
|
||||
|
||||
protected:
|
||||
void paintButtonBg(Painter &p, const QRect &rect, float64 howMuchOver) const override;
|
||||
void paintButtonBg(Painter &p, const QRect &rect, double howMuchOver) const override;
|
||||
void paintButtonIcon(Painter &p, const QRect &rect, int outerWidth, HistoryMessageReplyMarkup::Button::Type type) const override;
|
||||
void paintButtonLoading(Painter &p, const QRect &rect) const override;
|
||||
int minButtonWidth(HistoryMessageReplyMarkup::Button::Type type) const override;
|
||||
|
|
|
@ -186,7 +186,7 @@ void EmojiColorPicker::mouseReleaseEvent(QMouseEvent *e) {
|
|||
|
||||
void EmojiColorPicker::handleMouseRelease(QPoint globalPos) {
|
||||
_lastMousePos = globalPos;
|
||||
int32 pressed = _pressedSel;
|
||||
qint32 pressed = _pressedSel;
|
||||
_pressedSel = -1;
|
||||
|
||||
updateSelected();
|
||||
|
@ -492,7 +492,7 @@ void EmojiListWidget::mousePressEvent(QMouseEvent *e) {
|
|||
}
|
||||
|
||||
void EmojiListWidget::mouseReleaseEvent(QMouseEvent *e) {
|
||||
int32 pressed = _pressedSel;
|
||||
qint32 pressed = _pressedSel;
|
||||
_pressedSel = -1;
|
||||
|
||||
_lastMousePos = e->globalPos();
|
||||
|
@ -553,7 +553,7 @@ void EmojiListWidget::onShowPicker() {
|
|||
y += _picker->height() - st::buttonRadius + st::emojiPanSize.height() - st::buttonRadius;
|
||||
}
|
||||
auto xmax = width() - _picker->width();
|
||||
auto coef = float64(sel % kEmojiPanelPerRow) / float64(kEmojiPanelPerRow - 1);
|
||||
auto coef = double(sel % kEmojiPanelPerRow) / double(kEmojiPanelPerRow - 1);
|
||||
if (rtl()) coef = 1. - coef;
|
||||
_picker->move(qRound(xmax * coef), y);
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ private:
|
|||
int _counts[kEmojiSectionCount];
|
||||
QVector<EmojiPtr> _emoji[kEmojiSectionCount];
|
||||
|
||||
int32 _esize;
|
||||
qint32 _esize;
|
||||
|
||||
int _selected = -1;
|
||||
int _pressedSel = -1;
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Ui {
|
|||
namespace Emoji {
|
||||
|
||||
inline utf16string QStringToUTF16(const QString &string) {
|
||||
return utf16string(reinterpret_cast<const utf16char*>(string.constData()), string.size());
|
||||
return utf16string(reinterpret_cast<const char16_t*>(string.constData()), string.size());
|
||||
}
|
||||
|
||||
inline QString QStringFromUTF16(utf16string string) {
|
||||
|
|
|
@ -142,7 +142,7 @@ inline int indexOfInFirstN(const T &v, const U &elem, int last) {
|
|||
}
|
||||
|
||||
void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
||||
int32 now = unixtime(), recentInlineBots = 0;
|
||||
qint32 now = unixtime(), recentInlineBots = 0;
|
||||
internal::MentionRows mrows;
|
||||
internal::HashtagRows hrows;
|
||||
internal::BotCommandRows brows;
|
||||
|
@ -190,7 +190,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
}
|
||||
}
|
||||
if (_chat) {
|
||||
QMultiMap<int32, UserData*> ordered;
|
||||
QMultiMap<qint32, UserData*> ordered;
|
||||
mrows.reserve(mrows.size() + (_chat->participants.isEmpty() ? _chat->lastAuthors.size() : _chat->participants.size()));
|
||||
if (_chat->noParticipantInfo()) {
|
||||
Auth().api().requestFullPeer(_chat);
|
||||
|
@ -219,7 +219,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
}
|
||||
}
|
||||
} else if (_channel && _channel->isMegagroup()) {
|
||||
QMultiMap<int32, UserData*> ordered;
|
||||
QMultiMap<qint32, UserData*> ordered;
|
||||
if (_channel->mgInfo->lastParticipants.isEmpty() || _channel->lastParticipantsCountOutdated()) {
|
||||
Auth().api().requestLastParticipants(_channel);
|
||||
} else {
|
||||
|
@ -246,7 +246,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
bool listAllSuggestions = _filter.isEmpty();
|
||||
bool hasUsername = _filter.indexOf('@') > 0;
|
||||
QMap<UserData*, bool> bots;
|
||||
int32 cnt = 0;
|
||||
qint32 cnt = 0;
|
||||
if (_chat) {
|
||||
if (_chat->noParticipantInfo()) {
|
||||
Auth().api().requestFullPeer(_chat);
|
||||
|
@ -287,7 +287,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
}
|
||||
if (cnt) {
|
||||
brows.reserve(cnt);
|
||||
int32 botStatus = _chat ? _chat->botStatus : ((_channel && _channel->isMegagroup()) ? _channel->mgInfo->botStatus : -1);
|
||||
qint32 botStatus = _chat ? _chat->botStatus : ((_channel && _channel->isMegagroup()) ? _channel->mgInfo->botStatus : -1);
|
||||
if (_chat) {
|
||||
for (auto i = _chat->lastAuthors.cbegin(), e = _chat->lastAuthors.cend(); i != e; ++i) {
|
||||
auto user = *i;
|
||||
|
@ -314,7 +314,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
|
|||
if (!bots.isEmpty()) {
|
||||
for (QMap<UserData*, bool>::const_iterator i = bots.cbegin(), e = bots.cend(); i != e; ++i) {
|
||||
UserData *user = i.key();
|
||||
for (int32 j = 0, l = user->botInfo->commands.size(); j < l; ++j) {
|
||||
for (qint32 j = 0, l = user->botInfo->commands.size(); j < l; ++j) {
|
||||
if (!listAllSuggestions) {
|
||||
QString toFilter = (hasUsername || botStatus == 0 || botStatus == 2) ? user->botInfo->commands.at(j).command + '@' + user->username : user->botInfo->commands.at(j).command;
|
||||
if (!toFilter.startsWith(_filter, Qt::CaseInsensitive)/* || toFilter.size() == _filter.size()*/) continue;
|
||||
|
@ -364,10 +364,10 @@ void FieldAutocomplete::setBoundings(QRect boundings) {
|
|||
}
|
||||
|
||||
void FieldAutocomplete::recount(bool resetScroll) {
|
||||
int32 h = 0, oldst = _scroll->scrollTop(), st = oldst, maxh = 4.5 * st::mentionHeight;
|
||||
qint32 h = 0, oldst = _scroll->scrollTop(), st = oldst, maxh = 4.5 * st::mentionHeight;
|
||||
if (!_srows.isEmpty()) {
|
||||
int32 stickersPerRow = qMax(1, int32(_boundings.width() - 2 * st::stickerPanPadding) / int32(st::stickerPanSize.width()));
|
||||
int32 rows = rowscount(_srows.size(), stickersPerRow);
|
||||
qint32 stickersPerRow = qMax(1, qint32(_boundings.width() - 2 * st::stickerPanPadding) / qint32(st::stickerPanSize.width()));
|
||||
qint32 rows = rowscount(_srows.size(), stickersPerRow);
|
||||
h = st::stickerPanPadding + rows * st::stickerPanSize.height();
|
||||
} else if (!_mrows.isEmpty()) {
|
||||
h = _mrows.size() * st::mentionHeight;
|
||||
|
@ -465,11 +465,11 @@ UserData *FieldAutocomplete::user() const {
|
|||
return _user;
|
||||
}
|
||||
|
||||
int32 FieldAutocomplete::innerTop() {
|
||||
qint32 FieldAutocomplete::innerTop() {
|
||||
return _scroll->scrollTop();
|
||||
}
|
||||
|
||||
int32 FieldAutocomplete::innerBottom() {
|
||||
qint32 FieldAutocomplete::innerBottom() {
|
||||
return _scroll->scrollTop() + _scroll->height();
|
||||
}
|
||||
|
||||
|
@ -531,20 +531,20 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
|
|||
QRect r(e->rect());
|
||||
if (r != rect()) p.setClipRect(r);
|
||||
|
||||
int32 atwidth = st::mentionFont->width('@'), hashwidth = st::mentionFont->width('#');
|
||||
int32 mentionleft = 2 * st::mentionPadding.left() + st::mentionPhotoSize;
|
||||
int32 mentionwidth = width() - mentionleft - 2 * st::mentionPadding.right();
|
||||
int32 htagleft = st::historyAttach.width + st::historyComposeField.textMrg.left() - st::lineWidth, htagwidth = width() - st::mentionPadding.right() - htagleft - st::mentionScroll.width;
|
||||
qint32 atwidth = st::mentionFont->width('@'), hashwidth = st::mentionFont->width('#');
|
||||
qint32 mentionleft = 2 * st::mentionPadding.left() + st::mentionPhotoSize;
|
||||
qint32 mentionwidth = width() - mentionleft - 2 * st::mentionPadding.right();
|
||||
qint32 htagleft = st::historyAttach.width + st::historyComposeField.textMrg.left() - st::lineWidth, htagwidth = width() - st::mentionPadding.right() - htagleft - st::mentionScroll.width;
|
||||
|
||||
if (!_srows->isEmpty()) {
|
||||
int32 rows = rowscount(_srows->size(), _stickersPerRow);
|
||||
int32 fromrow = floorclamp(r.y() - st::stickerPanPadding, st::stickerPanSize.height(), 0, rows);
|
||||
int32 torow = ceilclamp(r.y() + r.height() - st::stickerPanPadding, st::stickerPanSize.height(), 0, rows);
|
||||
int32 fromcol = floorclamp(r.x() - st::stickerPanPadding, st::stickerPanSize.width(), 0, _stickersPerRow);
|
||||
int32 tocol = ceilclamp(r.x() + r.width() - st::stickerPanPadding, st::stickerPanSize.width(), 0, _stickersPerRow);
|
||||
for (int32 row = fromrow; row < torow; ++row) {
|
||||
for (int32 col = fromcol; col < tocol; ++col) {
|
||||
int32 index = row * _stickersPerRow + col;
|
||||
qint32 rows = rowscount(_srows->size(), _stickersPerRow);
|
||||
qint32 fromrow = floorclamp(r.y() - st::stickerPanPadding, st::stickerPanSize.height(), 0, rows);
|
||||
qint32 torow = ceilclamp(r.y() + r.height() - st::stickerPanPadding, st::stickerPanSize.height(), 0, rows);
|
||||
qint32 fromcol = floorclamp(r.x() - st::stickerPanPadding, st::stickerPanSize.width(), 0, _stickersPerRow);
|
||||
qint32 tocol = ceilclamp(r.x() + r.width() - st::stickerPanPadding, st::stickerPanSize.width(), 0, _stickersPerRow);
|
||||
for (qint32 row = fromrow; row < torow; ++row) {
|
||||
for (qint32 col = fromcol; col < tocol; ++col) {
|
||||
qint32 index = row * _stickersPerRow + col;
|
||||
if (index >= _srows->size()) break;
|
||||
|
||||
DocumentData *sticker = _srows->at(index);
|
||||
|
@ -564,9 +564,9 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
|
|||
sticker->checkSticker();
|
||||
}
|
||||
|
||||
float64 coef = qMin((st::stickerPanSize.width() - st::buttonRadius * 2) / float64(sticker->dimensions.width()), (st::stickerPanSize.height() - st::buttonRadius * 2) / float64(sticker->dimensions.height()));
|
||||
double coef = qMin((st::stickerPanSize.width() - st::buttonRadius * 2) / double(sticker->dimensions.width()), (st::stickerPanSize.height() - st::buttonRadius * 2) / double(sticker->dimensions.height()));
|
||||
if (coef > 1) coef = 1;
|
||||
int32 w = qRound(coef * sticker->dimensions.width()), h = qRound(coef * sticker->dimensions.height());
|
||||
qint32 w = qRound(coef * sticker->dimensions.width()), h = qRound(coef * sticker->dimensions.height());
|
||||
if (w < 1) w = 1;
|
||||
if (h < 1) h = 1;
|
||||
QPoint ppos = pos + QPoint((st::stickerPanSize.width() - w) / 2, (st::stickerPanSize.height() - h) / 2);
|
||||
|
@ -578,13 +578,13 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
int32 from = qFloor(e->rect().top() / st::mentionHeight), to = qFloor(e->rect().bottom() / st::mentionHeight) + 1;
|
||||
int32 last = _mrows->isEmpty() ? (_hrows->isEmpty() ? _brows->size() : _hrows->size()) : _mrows->size();
|
||||
qint32 from = qFloor(e->rect().top() / st::mentionHeight), to = qFloor(e->rect().bottom() / st::mentionHeight) + 1;
|
||||
qint32 last = _mrows->isEmpty() ? (_hrows->isEmpty() ? _brows->size() : _hrows->size()) : _mrows->size();
|
||||
auto filter = _parent->filter();
|
||||
bool hasUsername = filter.indexOf('@') > 0;
|
||||
int filterSize = filter.size();
|
||||
bool filterIsEmpty = filter.isEmpty();
|
||||
for (int32 i = from; i < to; ++i) {
|
||||
for (qint32 i = from; i < to; ++i) {
|
||||
if (i >= last) break;
|
||||
|
||||
bool selected = (i == _sel);
|
||||
|
@ -599,7 +599,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
|
|||
UserData *user = _mrows->at(i);
|
||||
QString first = (!filterIsEmpty && user->username.startsWith(filter, Qt::CaseInsensitive)) ? ('@' + user->username.mid(0, filterSize)) : QString();
|
||||
QString second = first.isEmpty() ? (user->username.isEmpty() ? QString() : ('@' + user->username)) : user->username.mid(filterSize);
|
||||
int32 firstwidth = st::mentionFont->width(first), secondwidth = st::mentionFont->width(second), unamewidth = firstwidth + secondwidth, namewidth = user->nameText.maxWidth();
|
||||
qint32 firstwidth = st::mentionFont->width(first), secondwidth = st::mentionFont->width(second), unamewidth = firstwidth + secondwidth, namewidth = user->nameText.maxWidth();
|
||||
if (mentionwidth < unamewidth + namewidth) {
|
||||
namewidth = (mentionwidth * namewidth) / (namewidth + unamewidth);
|
||||
unamewidth = mentionwidth - namewidth;
|
||||
|
@ -631,7 +631,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
|
|||
QString hrow = _hrows->at(i);
|
||||
QString first = filterIsEmpty ? QString() : ('#' + hrow.mid(0, filterSize));
|
||||
QString second = filterIsEmpty ? ('#' + hrow) : hrow.mid(filterSize);
|
||||
int32 firstwidth = st::mentionFont->width(first), secondwidth = st::mentionFont->width(second);
|
||||
qint32 firstwidth = st::mentionFont->width(first), secondwidth = st::mentionFont->width(second);
|
||||
if (htagwidth < firstwidth + secondwidth) {
|
||||
if (htagwidth < firstwidth + st::mentionFont->elidew) {
|
||||
first = st::mentionFont->elided(first + second, htagwidth);
|
||||
|
@ -655,7 +655,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
|
|||
|
||||
const BotCommand *command = _brows->at(i).second;
|
||||
QString toHighlight = command->command;
|
||||
int32 botStatus = _parent->chat() ? _parent->chat()->botStatus : ((_parent->channel() && _parent->channel()->isMegagroup()) ? _parent->channel()->mgInfo->botStatus : -1);
|
||||
qint32 botStatus = _parent->chat() ? _parent->chat()->botStatus : ((_parent->channel() && _parent->channel()->isMegagroup()) ? _parent->channel()->mgInfo->botStatus : -1);
|
||||
if (hasUsername || botStatus == 0 || botStatus == 2) {
|
||||
toHighlight += '@' + user->username;
|
||||
}
|
||||
|
@ -684,7 +684,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
void FieldAutocompleteInner::resizeEvent(QResizeEvent *e) {
|
||||
_stickersPerRow = qMax(1, int32(width() - 2 * st::stickerPanPadding) / int32(st::stickerPanSize.width()));
|
||||
_stickersPerRow = qMax(1, qint32(width() - 2 * st::stickerPanPadding) / qint32(st::stickerPanSize.width()));
|
||||
}
|
||||
|
||||
void FieldAutocompleteInner::mouseMoveEvent(QMouseEvent *e) {
|
||||
|
@ -704,8 +704,8 @@ void FieldAutocompleteInner::clearSel(bool hidden) {
|
|||
|
||||
bool FieldAutocompleteInner::moveSel(int key) {
|
||||
_mouseSel = false;
|
||||
int32 maxSel = (_mrows->isEmpty() ? (_hrows->isEmpty() ? (_brows->isEmpty() ? _srows->size() : _brows->size()) : _hrows->size()) : _mrows->size());
|
||||
int32 direction = (key == Qt::Key_Up) ? -1 : (key == Qt::Key_Down ? 1 : 0);
|
||||
qint32 maxSel = (_mrows->isEmpty() ? (_hrows->isEmpty() ? (_brows->isEmpty() ? _srows->size() : _brows->size()) : _hrows->size()) : _mrows->size());
|
||||
qint32 direction = (key == Qt::Key_Up) ? -1 : (key == Qt::Key_Down ? 1 : 0);
|
||||
if (!_srows->isEmpty()) {
|
||||
if (key == Qt::Key_Left) {
|
||||
direction = -1;
|
||||
|
@ -749,7 +749,7 @@ bool FieldAutocompleteInner::chooseSelected(FieldAutocomplete::ChooseMethod meth
|
|||
if (_sel >= 0 && _sel < _brows->size()) {
|
||||
UserData *user = _brows->at(_sel).first;
|
||||
const BotCommand *command(_brows->at(_sel).second);
|
||||
int32 botStatus = _parent->chat() ? _parent->chat()->botStatus : ((_parent->channel() && _parent->channel()->isMegagroup()) ? _parent->channel()->mgInfo->botStatus : -1);
|
||||
qint32 botStatus = _parent->chat() ? _parent->chat()->botStatus : ((_parent->channel() && _parent->channel()->isMegagroup()) ? _parent->channel()->mgInfo->botStatus : -1);
|
||||
if (botStatus == 0 || botStatus == 2 || _parent->filter().indexOf('@') > 0) {
|
||||
emit botCommandChosen('/' + command->command + '@' + user->username, method);
|
||||
} else {
|
||||
|
@ -761,7 +761,7 @@ bool FieldAutocompleteInner::chooseSelected(FieldAutocomplete::ChooseMethod meth
|
|||
return false;
|
||||
}
|
||||
|
||||
void FieldAutocompleteInner::setRecentInlineBotsInRows(int32 bots) {
|
||||
void FieldAutocompleteInner::setRecentInlineBotsInRows(qint32 bots) {
|
||||
_recentInlineBotsInRows = bots;
|
||||
}
|
||||
|
||||
|
@ -787,7 +787,7 @@ void FieldAutocompleteInner::mousePressEvent(QMouseEvent *e) {
|
|||
} else {
|
||||
UserData *toRemove = _mrows->at(_sel);
|
||||
RecentInlineBots &recent(cRefRecentInlineBots());
|
||||
int32 index = recent.indexOf(toRemove);
|
||||
qint32 index = recent.indexOf(toRemove);
|
||||
if (index >= 0) {
|
||||
recent.remove(index);
|
||||
removed = true;
|
||||
|
@ -812,7 +812,7 @@ void FieldAutocompleteInner::mousePressEvent(QMouseEvent *e) {
|
|||
void FieldAutocompleteInner::mouseReleaseEvent(QMouseEvent *e) {
|
||||
_previewTimer.stop();
|
||||
|
||||
int32 pressed = _down;
|
||||
qint32 pressed = _down;
|
||||
_down = -1;
|
||||
|
||||
_mousePos = mapToGlobal(e->pos());
|
||||
|
@ -847,7 +847,7 @@ void FieldAutocompleteInner::updateSelectedRow() {
|
|||
if (_srows->isEmpty()) {
|
||||
update(0, _sel * st::mentionHeight, width(), st::mentionHeight);
|
||||
} else {
|
||||
int32 row = _sel / _stickersPerRow, col = _sel % _stickersPerRow;
|
||||
qint32 row = _sel / _stickersPerRow, col = _sel % _stickersPerRow;
|
||||
update(st::stickerPanPadding + col * st::stickerPanSize.width(), st::stickerPanPadding + row * st::stickerPanSize.height(), st::stickerPanSize.width(), st::stickerPanSize.height());
|
||||
}
|
||||
}
|
||||
|
@ -862,7 +862,7 @@ void FieldAutocompleteInner::setSel(int sel, bool scroll) {
|
|||
if (_srows->isEmpty()) {
|
||||
emit mustScrollTo(_sel * st::mentionHeight, (_sel + 1) * st::mentionHeight);
|
||||
} else {
|
||||
int32 row = _sel / _stickersPerRow;
|
||||
qint32 row = _sel / _stickersPerRow;
|
||||
emit mustScrollTo(st::stickerPanPadding + row * st::stickerPanSize.height(), st::stickerPanPadding + (row + 1) * st::stickerPanSize.height());
|
||||
}
|
||||
}
|
||||
|
@ -874,18 +874,18 @@ void FieldAutocompleteInner::onUpdateSelected(bool force) {
|
|||
|
||||
if (_down >= 0 && !_previewShown) return;
|
||||
|
||||
int32 sel = -1, maxSel = 0;
|
||||
qint32 sel = -1, maxSel = 0;
|
||||
if (!_srows->isEmpty()) {
|
||||
int32 rows = rowscount(_srows->size(), _stickersPerRow);
|
||||
int32 row = (mouse.y() >= st::stickerPanPadding) ? ((mouse.y() - st::stickerPanPadding) / st::stickerPanSize.height()) : -1;
|
||||
int32 col = (mouse.x() >= st::stickerPanPadding) ? ((mouse.x() - st::stickerPanPadding) / st::stickerPanSize.width()) : -1;
|
||||
qint32 rows = rowscount(_srows->size(), _stickersPerRow);
|
||||
qint32 row = (mouse.y() >= st::stickerPanPadding) ? ((mouse.y() - st::stickerPanPadding) / st::stickerPanSize.height()) : -1;
|
||||
qint32 col = (mouse.x() >= st::stickerPanPadding) ? ((mouse.x() - st::stickerPanPadding) / st::stickerPanSize.width()) : -1;
|
||||
if (row >= 0 && col >= 0) {
|
||||
sel = row * _stickersPerRow + col;
|
||||
}
|
||||
maxSel = _srows->size();
|
||||
_overDelete = false;
|
||||
} else {
|
||||
sel = mouse.y() / int32(st::mentionHeight);
|
||||
sel = mouse.y() / qint32(st::mentionHeight);
|
||||
maxSel = _mrows->isEmpty() ? (_hrows->isEmpty() ? _brows->size() : _hrows->size()) : _mrows->size();
|
||||
_overDelete = (!_hrows->isEmpty() || (!_mrows->isEmpty() && sel < _recentInlineBotsInRows)) ? (mouse.x() >= width() - st::mentionHeight) : false;
|
||||
}
|
||||
|
|
|
@ -52,8 +52,8 @@ public:
|
|||
ChannelData *channel() const;
|
||||
UserData *user() const;
|
||||
|
||||
int32 innerTop();
|
||||
int32 innerBottom();
|
||||
qint32 innerTop();
|
||||
qint32 innerBottom();
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *e) override;
|
||||
|
||||
|
@ -126,7 +126,7 @@ private:
|
|||
QRect _boundings;
|
||||
bool _addInlineBots;
|
||||
|
||||
int32 _width, _height;
|
||||
qint32 _width, _height;
|
||||
bool _hiding = false;
|
||||
|
||||
Animation _a_opacity;
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
bool moveSel(int key);
|
||||
bool chooseSelected(FieldAutocomplete::ChooseMethod method) const;
|
||||
|
||||
void setRecentInlineBotsInRows(int32 bots);
|
||||
void setRecentInlineBotsInRows(qint32 bots);
|
||||
|
||||
signals:
|
||||
void mentionChosen(UserData *user, FieldAutocomplete::ChooseMethod method) const;
|
||||
|
@ -180,8 +180,8 @@ private:
|
|||
HashtagRows *_hrows;
|
||||
BotCommandRows *_brows;
|
||||
StickerPack *_srows;
|
||||
int32 _stickersPerRow, _recentInlineBotsInRows;
|
||||
int32 _sel, _down;
|
||||
qint32 _stickersPerRow, _recentInlineBotsInRows;
|
||||
qint32 _sel, _down;
|
||||
bool _mouseSel;
|
||||
QPoint _mousePos;
|
||||
|
||||
|
|
|
@ -418,7 +418,7 @@ void GifsListWidget::processPanelHideFinished() {
|
|||
}
|
||||
}
|
||||
|
||||
bool GifsListWidget::inlineRowsAddItem(DocumentData *savedGif, InlineResult *result, Row &row, int32 &sumWidth) {
|
||||
bool GifsListWidget::inlineRowsAddItem(DocumentData *savedGif, InlineResult *result, Row &row, qint32 &sumWidth) {
|
||||
LayoutItem *layout = nullptr;
|
||||
if (savedGif) {
|
||||
layout = layoutPrepareSavedGif(savedGif, (_rows.size() * MatrixRowShift) + row.items.size());
|
||||
|
@ -441,7 +441,7 @@ bool GifsListWidget::inlineRowsAddItem(DocumentData *savedGif, InlineResult *res
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GifsListWidget::inlineRowFinalize(Row &row, int32 &sumWidth, bool force) {
|
||||
bool GifsListWidget::inlineRowFinalize(Row &row, qint32 &sumWidth, bool force) {
|
||||
if (row.items.isEmpty()) return false;
|
||||
|
||||
auto full = (row.items.size() >= kInlineItemsMaxPerRow);
|
||||
|
@ -502,7 +502,7 @@ void GifsListWidget::clearInlineRows(bool resultsDeleted) {
|
|||
_rows.clear();
|
||||
}
|
||||
|
||||
GifsListWidget::LayoutItem *GifsListWidget::layoutPrepareSavedGif(DocumentData *doc, int32 position) {
|
||||
GifsListWidget::LayoutItem *GifsListWidget::layoutPrepareSavedGif(DocumentData *doc, qint32 position) {
|
||||
auto it = _gifLayouts.find(doc);
|
||||
if (it == _gifLayouts.cend()) {
|
||||
if (auto layout = LayoutItem::createLayoutGif(this, doc)) {
|
||||
|
@ -518,7 +518,7 @@ GifsListWidget::LayoutItem *GifsListWidget::layoutPrepareSavedGif(DocumentData *
|
|||
return it->second.get();
|
||||
}
|
||||
|
||||
GifsListWidget::LayoutItem *GifsListWidget::layoutPrepareInlineResult(InlineResult *result, int32 position) {
|
||||
GifsListWidget::LayoutItem *GifsListWidget::layoutPrepareInlineResult(InlineResult *result, qint32 position) {
|
||||
auto it = _inlineLayouts.find(result);
|
||||
if (it == _inlineLayouts.cend()) {
|
||||
if (auto layout = LayoutItem::createLayout(this, result, _inlineWithThumb)) {
|
||||
|
@ -562,7 +562,7 @@ void GifsListWidget::deleteUnusedInlineLayouts() {
|
|||
}
|
||||
}
|
||||
|
||||
GifsListWidget::Row &GifsListWidget::layoutInlineRow(Row &row, int32 sumWidth) {
|
||||
GifsListWidget::Row &GifsListWidget::layoutInlineRow(Row &row, qint32 sumWidth) {
|
||||
auto count = int(row.items.size());
|
||||
Assert(count <= kInlineItemsMaxPerRow);
|
||||
|
||||
|
@ -640,7 +640,7 @@ int GifsListWidget::refreshInlineRows(const InlineCacheEntry *entry, bool result
|
|||
inlineRowFinalize(row, sumWidth, true);
|
||||
}
|
||||
|
||||
int32 h = countHeight();
|
||||
qint32 h = countHeight();
|
||||
if (h != height()) resize(width(), h);
|
||||
update();
|
||||
|
||||
|
@ -763,7 +763,7 @@ void GifsListWidget::beforeHiding() {
|
|||
}
|
||||
}
|
||||
|
||||
bool GifsListWidget::refreshInlineRows(int32 *added) {
|
||||
bool GifsListWidget::refreshInlineRows(qint32 *added) {
|
||||
auto it = _inlineCache.find(_inlineQuery);
|
||||
const InlineCacheEntry *entry = nullptr;
|
||||
if (it != _inlineCache.cend()) {
|
||||
|
@ -775,7 +775,7 @@ bool GifsListWidget::refreshInlineRows(int32 *added) {
|
|||
return (entry != nullptr);
|
||||
}
|
||||
|
||||
int32 GifsListWidget::showInlineRows(bool newResults) {
|
||||
qint32 GifsListWidget::showInlineRows(bool newResults) {
|
||||
auto added = 0;
|
||||
auto clear = !refreshInlineRows(&added);
|
||||
if (newResults) {
|
||||
|
|
|
@ -117,8 +117,8 @@ private:
|
|||
int refreshInlineRows(const InlineCacheEntry *results, bool resultsDeleted);
|
||||
void checkLoadMore();
|
||||
|
||||
int32 showInlineRows(bool newResults);
|
||||
bool refreshInlineRows(int32 *added = 0);
|
||||
qint32 showInlineRows(bool newResults);
|
||||
bool refreshInlineRows(qint32 *added = 0);
|
||||
void inlineResultsDone(const MTPmessages_BotResults &result);
|
||||
|
||||
void updateSelected();
|
||||
|
@ -137,15 +137,15 @@ private:
|
|||
void clearInlineRows(bool resultsDeleted);
|
||||
|
||||
std::map<DocumentData*, std::unique_ptr<LayoutItem>> _gifLayouts;
|
||||
LayoutItem *layoutPrepareSavedGif(DocumentData *doc, int32 position);
|
||||
LayoutItem *layoutPrepareSavedGif(DocumentData *doc, qint32 position);
|
||||
|
||||
std::map<InlineResult*, std::unique_ptr<LayoutItem>> _inlineLayouts;
|
||||
LayoutItem *layoutPrepareInlineResult(InlineResult *result, int32 position);
|
||||
LayoutItem *layoutPrepareInlineResult(InlineResult *result, qint32 position);
|
||||
|
||||
bool inlineRowsAddItem(DocumentData *savedGif, InlineResult *result, Row &row, int32 &sumWidth);
|
||||
bool inlineRowFinalize(Row &row, int32 &sumWidth, bool force = false);
|
||||
bool inlineRowsAddItem(DocumentData *savedGif, InlineResult *result, Row &row, qint32 &sumWidth);
|
||||
bool inlineRowFinalize(Row &row, qint32 &sumWidth, bool force = false);
|
||||
|
||||
Row &layoutInlineRow(Row &row, int32 sumWidth = 0);
|
||||
Row &layoutInlineRow(Row &row, qint32 sumWidth = 0);
|
||||
void deleteUnusedGifLayouts();
|
||||
|
||||
void deleteUnusedInlineLayouts();
|
||||
|
|
|
@ -144,8 +144,8 @@ void MessageField::dropEvent(QDropEvent *e) {
|
|||
|
||||
bool MessageField::canInsertFromMimeData(const QMimeData *source) const {
|
||||
if (source->hasUrls()) {
|
||||
int32 files = 0;
|
||||
for (int32 i = 0; i < source->urls().size(); ++i) {
|
||||
qint32 files = 0;
|
||||
for (qint32 i = 0; i < source->urls().size(); ++i) {
|
||||
if (source->urls().at(i).isLocalFile()) {
|
||||
++files;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void ApplyArchivedResult(const MTPDmessages_stickerSetInstallResultArchive &d) {
|
|||
auto &order = Global::RefStickerSetsOrder();
|
||||
Order archived;
|
||||
archived.reserve(v.size());
|
||||
QMap<uint64, uint64> setsToRequest;
|
||||
QMap<quint64, quint64> setsToRequest;
|
||||
for_const (auto &stickerSet, v) {
|
||||
const MTPDstickerSet *setData = nullptr;
|
||||
switch (stickerSet.type()) {
|
||||
|
@ -96,7 +96,7 @@ bool ApplyArchivedResultFake() {
|
|||
auto sets = QVector<MTPStickerSetCovered>();
|
||||
for (auto &set : Global::RefStickerSets()) {
|
||||
if ((set.flags & MTPDstickerSet::Flag::f_installed) && !(set.flags & MTPDstickerSet_ClientFlag::f_special)) {
|
||||
if (rand_value<uint32>() % 128 < 64) {
|
||||
if (rand_value<quint32>() % 128 < 64) {
|
||||
auto data = MTP_stickerSet(MTP_flags(set.flags | MTPDstickerSet::Flag::f_archived), MTP_long(set.id), MTP_long(set.access), MTP_string(set.title), MTP_string(set.shortName), MTP_int(set.count), MTP_int(set.hash));
|
||||
sets.push_back(MTP_stickerSetCovered(data, MTP_documentEmpty(MTP_long(0))));
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ bool ApplyArchivedResultFake() {
|
|||
return true;
|
||||
}
|
||||
|
||||
void InstallLocally(uint64 setId) {
|
||||
void InstallLocally(quint64 setId) {
|
||||
auto &sets = Global::RefStickerSets();
|
||||
auto it = sets.find(setId);
|
||||
if (it == sets.end()) {
|
||||
|
@ -151,7 +151,7 @@ void InstallLocally(uint64 setId) {
|
|||
Auth().data().stickersUpdated().notify(true);
|
||||
}
|
||||
|
||||
void UndoInstallLocally(uint64 setId) {
|
||||
void UndoInstallLocally(quint64 setId) {
|
||||
auto &sets = Global::RefStickerSets();
|
||||
auto it = sets.find(setId);
|
||||
if (it == sets.end()) {
|
||||
|
@ -172,7 +172,7 @@ void UndoInstallLocally(uint64 setId) {
|
|||
Ui::show(Box<InformBox>(lang(lng_stickers_not_found)), KeepOtherLayers);
|
||||
}
|
||||
|
||||
void MarkFeaturedAsRead(uint64 setId) {
|
||||
void MarkFeaturedAsRead(quint64 setId) {
|
||||
if (!FeaturedReaderInstance) {
|
||||
if (auto main = App::main()) {
|
||||
FeaturedReaderInstance = object_ptr<internal::FeaturedReader>(main);
|
||||
|
@ -338,12 +338,12 @@ void SetFaved(not_null<DocumentData*> document, bool faved) {
|
|||
}
|
||||
}
|
||||
|
||||
void SetsReceived(const QVector<MTPStickerSet> &data, int32 hash) {
|
||||
void SetsReceived(const QVector<MTPStickerSet> &data, qint32 hash) {
|
||||
auto &setsOrder = Global::RefStickerSetsOrder();
|
||||
setsOrder.clear();
|
||||
|
||||
auto &sets = Global::RefStickerSets();
|
||||
QMap<uint64, uint64> setsToRequest;
|
||||
QMap<quint64, quint64> setsToRequest;
|
||||
for (auto &set : sets) {
|
||||
if (!(set.flags & MTPDstickerSet::Flag::f_archived)) {
|
||||
set.flags &= ~MTPDstickerSet::Flag::f_installed; // mark for removing
|
||||
|
@ -425,7 +425,7 @@ void SetPackAndEmoji(Set &set, StickerPack &&pack, const QVector<MTPStickerPack>
|
|||
}
|
||||
}
|
||||
|
||||
void SpecialSetReceived(uint64 setId, const QString &setTitle, const QVector<MTPDocument> &items, int32 hash, const QVector<MTPStickerPack> &packs) {
|
||||
void SpecialSetReceived(quint64 setId, const QString &setTitle, const QVector<MTPDocument> &items, qint32 hash, const QVector<MTPStickerPack> &packs) {
|
||||
auto &sets = Global::RefStickerSets();
|
||||
auto it = sets.find(setId);
|
||||
|
||||
|
@ -503,8 +503,8 @@ void SpecialSetReceived(uint64 setId, const QString &setTitle, const QVector<MTP
|
|||
Auth().data().stickersUpdated().notify(true);
|
||||
}
|
||||
|
||||
void FeaturedSetsReceived(const QVector<MTPStickerSetCovered> &data, const QVector<MTPlong> &unread, int32 hash) {
|
||||
OrderedSet<uint64> unreadMap;
|
||||
void FeaturedSetsReceived(const QVector<MTPStickerSetCovered> &data, const QVector<MTPlong> &unread, qint32 hash) {
|
||||
OrderedSet<quint64> unreadMap;
|
||||
for_const (auto &unreadSetId, unread) {
|
||||
unreadMap.insert(unreadSetId.v);
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ void FeaturedSetsReceived(const QVector<MTPStickerSetCovered> &data, const QVect
|
|||
setsOrder.clear();
|
||||
|
||||
auto &sets = Global::RefStickerSets();
|
||||
QMap<uint64, uint64> setsToRequest;
|
||||
QMap<quint64, quint64> setsToRequest;
|
||||
for (auto &set : sets) {
|
||||
set.flags &= ~MTPDstickerSet_ClientFlag::f_featured; // mark for removing
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ void FeaturedSetsReceived(const QVector<MTPStickerSetCovered> &data, const QVect
|
|||
Auth().data().stickersUpdated().notify(true);
|
||||
}
|
||||
|
||||
void GifsReceived(const QVector<MTPDocument> &items, int32 hash) {
|
||||
void GifsReceived(const QVector<MTPDocument> &items, qint32 hash) {
|
||||
auto &saved = cRefSavedGifs();
|
||||
saved.clear();
|
||||
|
||||
|
@ -632,7 +632,7 @@ void GifsReceived(const QVector<MTPDocument> &items, int32 hash) {
|
|||
StickerPack GetListByEmoji(not_null<EmojiPtr> emoji) {
|
||||
auto original = emoji->original();
|
||||
auto result = StickerPack();
|
||||
auto setsToRequest = QMap<uint64, uint64>();
|
||||
auto setsToRequest = QMap<quint64, quint64>();
|
||||
auto &sets = Global::RefStickerSets();
|
||||
|
||||
auto faved = StickerPack();
|
||||
|
@ -840,7 +840,7 @@ FeaturedReader::FeaturedReader(QObject *parent) : QObject(parent)
|
|||
_timer->setTimeoutHandler([this] { readSets(); });
|
||||
}
|
||||
|
||||
void FeaturedReader::scheduleRead(uint64 setId) {
|
||||
void FeaturedReader::scheduleRead(quint64 setId) {
|
||||
if (!_setIds.contains(setId)) {
|
||||
_setIds.insert(setId);
|
||||
_timer->start(kReadFeaturedSetsTimeoutMs);
|
||||
|
|
|
@ -28,16 +28,16 @@ constexpr auto kPanelPerRow = 5;
|
|||
|
||||
void ApplyArchivedResult(const MTPDmessages_stickerSetInstallResultArchive &d);
|
||||
bool ApplyArchivedResultFake(); // For testing.
|
||||
void InstallLocally(uint64 setId);
|
||||
void UndoInstallLocally(uint64 setId);
|
||||
void MarkFeaturedAsRead(uint64 setId);
|
||||
void InstallLocally(quint64 setId);
|
||||
void UndoInstallLocally(quint64 setId);
|
||||
void MarkFeaturedAsRead(quint64 setId);
|
||||
bool IsFaved(not_null<DocumentData*> document);
|
||||
void SetFaved(not_null<DocumentData*> document, bool faved);
|
||||
|
||||
void SetsReceived(const QVector<MTPStickerSet> &data, int32 hash);
|
||||
void SpecialSetReceived(uint64 setId, const QString &setTitle, const QVector<MTPDocument> &items, int32 hash, const QVector<MTPStickerPack> &packs = QVector<MTPStickerPack>());
|
||||
void FeaturedSetsReceived(const QVector<MTPStickerSetCovered> &data, const QVector<MTPlong> &unread, int32 hash);
|
||||
void GifsReceived(const QVector<MTPDocument> &items, int32 hash);
|
||||
void SetsReceived(const QVector<MTPStickerSet> &data, qint32 hash);
|
||||
void SpecialSetReceived(quint64 setId, const QString &setTitle, const QVector<MTPDocument> &items, qint32 hash, const QVector<MTPStickerPack> &packs = QVector<MTPStickerPack>());
|
||||
void FeaturedSetsReceived(const QVector<MTPStickerSetCovered> &data, const QVector<MTPlong> &unread, qint32 hash);
|
||||
void GifsReceived(const QVector<MTPDocument> &items, qint32 hash);
|
||||
|
||||
StickerPack GetListByEmoji(not_null<EmojiPtr> emoji);
|
||||
base::optional<std::vector<not_null<EmojiPtr>>> GetEmojiListFromSet(
|
||||
|
@ -53,13 +53,13 @@ namespace internal {
|
|||
class FeaturedReader : public QObject, private MTP::Sender {
|
||||
public:
|
||||
FeaturedReader(QObject *parent);
|
||||
void scheduleRead(uint64 setId);
|
||||
void scheduleRead(quint64 setId);
|
||||
|
||||
private:
|
||||
void readSets();
|
||||
|
||||
object_ptr<SingleTimer> _timer;
|
||||
OrderedSet<uint64> _setIds;
|
||||
OrderedSet<quint64> _setIds;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -46,11 +46,11 @@ constexpr auto kInlineItemsMaxPerRow = 5;
|
|||
} // namespace
|
||||
|
||||
struct StickerIcon {
|
||||
StickerIcon(uint64 setId) : setId(setId) {
|
||||
StickerIcon(quint64 setId) : setId(setId) {
|
||||
}
|
||||
StickerIcon(uint64 setId, DocumentData *sticker, int32 pixw, int32 pixh) : setId(setId), sticker(sticker), pixw(pixw), pixh(pixh) {
|
||||
StickerIcon(quint64 setId, DocumentData *sticker, qint32 pixw, qint32 pixh) : setId(setId), sticker(sticker), pixw(pixw), pixh(pixh) {
|
||||
}
|
||||
uint64 setId = 0;
|
||||
quint64 setId = 0;
|
||||
DocumentData *sticker = nullptr;
|
||||
ChannelData *megagroup = nullptr;
|
||||
int pixw = 0;
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
Footer(not_null<StickersListWidget*> parent);
|
||||
|
||||
void preloadImages();
|
||||
void validateSelectedIcon(uint64 setId, ValidateIconAnimations animations);
|
||||
void validateSelectedIcon(quint64 setId, ValidateIconAnimations animations);
|
||||
void refreshIcons(ValidateIconAnimations animations);
|
||||
bool hasOnlyFeaturedSets() const;
|
||||
|
||||
|
@ -143,7 +143,7 @@ void StickersListWidget::Footer::preloadImages() {
|
|||
});
|
||||
}
|
||||
|
||||
void StickersListWidget::Footer::validateSelectedIcon(uint64 setId, ValidateIconAnimations animations) {
|
||||
void StickersListWidget::Footer::validateSelectedIcon(quint64 setId, ValidateIconAnimations animations) {
|
||||
auto newSel = 0;
|
||||
for (auto i = 0, l = _icons.size(); i != l; ++i) {
|
||||
if (_icons[i].setId == setId) {
|
||||
|
@ -214,7 +214,7 @@ void StickersListWidget::Footer::paintEvent(QPaintEvent *e) {
|
|||
} else if (icon.megagroup) {
|
||||
icon.megagroup->paintUserpicLeft(p, x + (st::emojiCategory.width - st::stickerGroupCategorySize) / 2, _iconsTop + (st::emojiCategory.height - st::stickerGroupCategorySize) / 2, width(), st::stickerGroupCategorySize);
|
||||
} else {
|
||||
auto getSpecialSetIcon = [](uint64 setId) {
|
||||
auto getSpecialSetIcon = [](quint64 setId) {
|
||||
if (setId == Stickers::FeaturedSetId) {
|
||||
return &st::stickersTrending;
|
||||
} else if (setId == Stickers::FavedSetId) {
|
||||
|
@ -344,7 +344,7 @@ void StickersListWidget::Footer::updateSelected() {
|
|||
}
|
||||
|
||||
auto p = mapFromGlobal(_iconsMousePos);
|
||||
int32 x = p.x(), y = p.y(), newOver = -1;
|
||||
qint32 x = p.x(), y = p.y(), newOver = -1;
|
||||
if (rtl()) x = width() - x;
|
||||
x -= _iconsLeft;
|
||||
if (x >= st::emojiCategory.width * (kVisibleIconsCount - 1) && x < st::emojiCategory.width * kVisibleIconsCount && y >= _iconsTop && y < _iconsTop + st::emojiCategory.height) {
|
||||
|
@ -416,7 +416,7 @@ void StickersListWidget::validateSelectedIcon(ValidateIconAnimations animations)
|
|||
|
||||
void StickersListWidget::Footer::step_icons(TimeMs ms, bool timer) {
|
||||
if (_iconsStartAnim) {
|
||||
auto dt = (ms - _iconsStartAnim) / float64(st::stickerIconMove);
|
||||
auto dt = (ms - _iconsStartAnim) / double(st::stickerIconMove);
|
||||
if (dt >= 1) {
|
||||
_iconsStartAnim = 0;
|
||||
_iconsX.finish();
|
||||
|
@ -575,11 +575,11 @@ int StickersListWidget::countHeight() {
|
|||
return qMax(minimalLastHeight, countResult()) + st::stickerPanPadding;
|
||||
}
|
||||
|
||||
void StickersListWidget::installedLocally(uint64 setId) {
|
||||
void StickersListWidget::installedLocally(quint64 setId) {
|
||||
_installedLocallySets.insert(setId);
|
||||
}
|
||||
|
||||
void StickersListWidget::notInstalledLocally(uint64 setId) {
|
||||
void StickersListWidget::notInstalledLocally(quint64 setId) {
|
||||
_installedLocallySets.remove(setId);
|
||||
}
|
||||
|
||||
|
@ -827,7 +827,7 @@ void StickersListWidget::paintSticker(Painter &p, Set &set, int y, int index, bo
|
|||
sticker->checkSticker();
|
||||
}
|
||||
|
||||
auto coef = qMin((st::stickerPanSize.width() - st::buttonRadius * 2) / float64(sticker->dimensions.width()), (st::stickerPanSize.height() - st::buttonRadius * 2) / float64(sticker->dimensions.height()));
|
||||
auto coef = qMin((st::stickerPanSize.width() - st::buttonRadius * 2) / double(sticker->dimensions.width()), (st::stickerPanSize.height() - st::buttonRadius * 2) / double(sticker->dimensions.height()));
|
||||
if (coef > 1) coef = 1;
|
||||
auto w = qMax(qRound(coef * sticker->dimensions.width()), 1);
|
||||
auto h = qMax(qRound(coef * sticker->dimensions.height()), 1);
|
||||
|
@ -1041,7 +1041,7 @@ void StickersListWidget::removeRecentSticker(int section, int index) {
|
|||
bool refresh = false;
|
||||
auto sticker = _mySets[section].pack[index];
|
||||
auto &recent = cGetRecentStickers();
|
||||
for (int32 i = 0, l = recent.size(); i < l; ++i) {
|
||||
for (qint32 i = 0, l = recent.size(); i < l; ++i) {
|
||||
if (recent.at(i).first == sticker) {
|
||||
recent.removeAt(i);
|
||||
Local::writeUserSettings();
|
||||
|
@ -1198,14 +1198,14 @@ void StickersListWidget::preloadImages() {
|
|||
}
|
||||
}
|
||||
|
||||
uint64 StickersListWidget::currentSet(int yOffset) const {
|
||||
quint64 StickersListWidget::currentSet(int yOffset) const {
|
||||
if (_section == Section::Featured) {
|
||||
return Stickers::FeaturedSetId;
|
||||
}
|
||||
return _mySets.isEmpty() ? Stickers::RecentSetId : _mySets[sectionInfoByOffset(yOffset).section].id;
|
||||
}
|
||||
|
||||
void StickersListWidget::appendSet(Sets &to, uint64 setId, AppendSkip skip) {
|
||||
void StickersListWidget::appendSet(Sets &to, quint64 setId, AppendSkip skip) {
|
||||
auto &sets = Global::StickerSets();
|
||||
auto it = sets.constFind(setId);
|
||||
if (it == sets.cend() || it->stickers.isEmpty()) return;
|
||||
|
@ -1281,7 +1281,7 @@ void StickersListWidget::refreshRecentStickers(bool performResize) {
|
|||
}
|
||||
|
||||
if (performResize && (_section == Section::Stickers || _section == Section::Featured)) {
|
||||
int32 h = countHeight();
|
||||
qint32 h = countHeight();
|
||||
if (h != height()) {
|
||||
resize(width(), h);
|
||||
update();
|
||||
|
@ -1545,7 +1545,7 @@ void StickersListWidget::onPreview() {
|
|||
}
|
||||
}
|
||||
|
||||
void StickersListWidget::showStickerSet(uint64 setId) {
|
||||
void StickersListWidget::showStickerSet(quint64 setId) {
|
||||
clearSelection();
|
||||
|
||||
if (setId == Stickers::FeaturedSetId) {
|
||||
|
@ -1615,7 +1615,7 @@ void StickersListWidget::showMegagroupSet(ChannelData *megagroup) {
|
|||
}
|
||||
}
|
||||
|
||||
void StickersListWidget::displaySet(uint64 setId) {
|
||||
void StickersListWidget::displaySet(quint64 setId) {
|
||||
if (setId == Stickers::MegagroupSetId) {
|
||||
if (_megagroupSet->canEditStickers()) {
|
||||
_displayingSetId = setId;
|
||||
|
@ -1643,7 +1643,7 @@ void StickersListWidget::displaySet(uint64 setId) {
|
|||
}
|
||||
}
|
||||
|
||||
void StickersListWidget::installSet(uint64 setId) {
|
||||
void StickersListWidget::installSet(quint64 setId) {
|
||||
auto &sets = Global::StickerSets();
|
||||
auto it = sets.constFind(setId);
|
||||
if (it != sets.cend()) {
|
||||
|
@ -1683,7 +1683,7 @@ void StickersListWidget::removeMegagroupSet(bool locally) {
|
|||
})));
|
||||
}
|
||||
|
||||
void StickersListWidget::removeSet(uint64 setId) {
|
||||
void StickersListWidget::removeSet(quint64 setId) {
|
||||
auto &sets = Global::StickerSets();
|
||||
auto it = sets.constFind(setId);
|
||||
if (it != sets.cend()) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
void clearSelection() override;
|
||||
object_ptr<TabbedSelector::InnerFooter> createFooter() override;
|
||||
|
||||
void showStickerSet(uint64 setId);
|
||||
void showStickerSet(quint64 setId);
|
||||
void showMegagroupSet(ChannelData *megagroup);
|
||||
|
||||
void refreshStickers();
|
||||
|
@ -56,10 +56,10 @@ public:
|
|||
|
||||
void setVisibleTopBottom(int visibleTop, int visibleBottom) override;
|
||||
|
||||
uint64 currentSet(int yOffset) const;
|
||||
quint64 currentSet(int yOffset) const;
|
||||
|
||||
void installedLocally(uint64 setId);
|
||||
void notInstalledLocally(uint64 setId);
|
||||
void installedLocally(quint64 setId);
|
||||
void notInstalledLocally(quint64 setId);
|
||||
void clearInstalledLocally();
|
||||
|
||||
~StickersListWidget();
|
||||
|
@ -133,9 +133,9 @@ private:
|
|||
};
|
||||
|
||||
struct Set {
|
||||
Set(uint64 id, MTPDstickerSet::Flags flags, const QString &title, int32 hoversSize, const StickerPack &pack = StickerPack()) : id(id), flags(flags), title(title), pack(pack) {
|
||||
Set(quint64 id, MTPDstickerSet::Flags flags, const QString &title, qint32 hoversSize, const StickerPack &pack = StickerPack()) : id(id), flags(flags), title(title), pack(pack) {
|
||||
}
|
||||
uint64 id;
|
||||
quint64 id;
|
||||
MTPDstickerSet::Flags flags;
|
||||
QString title;
|
||||
StickerPack pack;
|
||||
|
@ -148,10 +148,10 @@ private:
|
|||
SectionInfo sectionInfo(int section) const;
|
||||
SectionInfo sectionInfoByOffset(int yOffset) const;
|
||||
|
||||
void displaySet(uint64 setId);
|
||||
void installSet(uint64 setId);
|
||||
void displaySet(quint64 setId);
|
||||
void installSet(quint64 setId);
|
||||
void removeMegagroupSet(bool locally);
|
||||
void removeSet(uint64 setId);
|
||||
void removeSet(quint64 setId);
|
||||
|
||||
bool setHasTitle(const Set &set) const;
|
||||
bool stickerHasDeleteButton(const Set &set, int index) const;
|
||||
|
@ -204,7 +204,7 @@ private:
|
|||
Archived,
|
||||
Installed,
|
||||
};
|
||||
void appendSet(Sets &to, uint64 setId, AppendSkip skip = AppendSkip::None);
|
||||
void appendSet(Sets &to, quint64 setId, AppendSkip skip = AppendSkip::None);
|
||||
|
||||
void selectEmoji(EmojiPtr emoji);
|
||||
int stickersLeft() const;
|
||||
|
@ -216,14 +216,14 @@ private:
|
|||
ChannelData *_megagroupSet = nullptr;
|
||||
Sets _mySets;
|
||||
Sets _featuredSets;
|
||||
OrderedSet<uint64> _installedLocallySets;
|
||||
OrderedSet<quint64> _installedLocallySets;
|
||||
QList<bool> _custom;
|
||||
base::flat_set<not_null<DocumentData*>> _favedStickersMap;
|
||||
|
||||
Section _section = Section::Stickers;
|
||||
|
||||
uint64 _displayingSetId = 0;
|
||||
uint64 _removingSetId = 0;
|
||||
quint64 _displayingSetId = 0;
|
||||
quint64 _removingSetId = 0;
|
||||
|
||||
Footer *_footer = nullptr;
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ bool TabbedPanel::eventFilter(QObject *obj, QEvent *e) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void TabbedPanel::stickersInstalled(uint64 setId) {
|
||||
void TabbedPanel::stickersInstalled(quint64 setId) {
|
||||
if (isDestroying()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
return _hiding || _hideTimer.isActive();
|
||||
}
|
||||
|
||||
void stickersInstalled(uint64 setId);
|
||||
void stickersInstalled(quint64 setId);
|
||||
|
||||
bool overlaps(const QRect &globalRect) const;
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ QPointer<TabbedSelector> TabbedSection::getSelector() const {
|
|||
return _selector.data();
|
||||
}
|
||||
|
||||
void TabbedSection::stickersInstalled(uint64 setId) {
|
||||
void TabbedSection::stickersInstalled(quint64 setId) {
|
||||
_selector->stickersInstalled(setId);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
object_ptr<TabbedSelector> takeSelector();
|
||||
QPointer<TabbedSelector> getSelector() const;
|
||||
|
||||
void stickersInstalled(uint64 setId);
|
||||
void stickersInstalled(quint64 setId);
|
||||
|
||||
// Float player interface.
|
||||
bool wheelEventFromFloatPlayer(QEvent *e, Window::Column myColumn, Window::Column playerColumn) override;
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
void setFinalImages(Direction direction, QImage &&left, QImage &&right, QRect inner, bool wasSectionIcons);
|
||||
|
||||
void start();
|
||||
void paintFrame(QPainter &p, float64 dt, float64 opacity);
|
||||
void paintFrame(QPainter &p, double dt, double opacity);
|
||||
|
||||
private:
|
||||
Direction _direction = Direction::LeftToRight;
|
||||
|
@ -133,7 +133,7 @@ void TabbedSelector::SlideAnimation::start() {
|
|||
_frameIntsPerLineAdd = (_width - _innerWidth) + _frameIntsPerLineAdded;
|
||||
}
|
||||
|
||||
void TabbedSelector::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64 opacity) {
|
||||
void TabbedSelector::SlideAnimation::paintFrame(QPainter &p, double dt, double opacity) {
|
||||
Expects(started());
|
||||
Expects(dt >= 0.);
|
||||
|
||||
|
@ -219,15 +219,15 @@ void TabbedSelector::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64
|
|||
if (opacity == 1.) {
|
||||
// Fill above the frame top with transparent.
|
||||
auto fillTopInts = (_frameInts + outerTop * _frameIntsPerLine + outerLeft);
|
||||
auto fillWidth = (outerRight - outerLeft) * sizeof(uint32);
|
||||
auto fillWidth = (outerRight - outerLeft) * sizeof(quint32);
|
||||
for (auto fillTop = _innerTop - outerTop; fillTop != 0; --fillTop) {
|
||||
memset(fillTopInts, 0, fillWidth);
|
||||
fillTopInts += _frameIntsPerLine;
|
||||
}
|
||||
|
||||
// Fill to the left and to the right of the frame with transparent.
|
||||
auto fillLeft = (_innerLeft - outerLeft) * sizeof(uint32);
|
||||
auto fillRight = (outerRight - _innerRight) * sizeof(uint32);
|
||||
auto fillLeft = (_innerLeft - outerLeft) * sizeof(quint32);
|
||||
auto fillRight = (outerRight - _innerRight) * sizeof(quint32);
|
||||
if (fillLeft || fillRight) {
|
||||
auto fillInts = _frameInts + _innerTop * _frameIntsPerLine;
|
||||
for (auto y = _innerTop; y != _innerBottom; ++y) {
|
||||
|
@ -250,7 +250,7 @@ void TabbedSelector::SlideAnimation::paintFrame(QPainter &p, float64 dt, float64
|
|||
|
||||
// Debug
|
||||
//frameInts = _frameInts;
|
||||
//auto pattern = anim::shifted((static_cast<uint32>(0xFF) << 24) | (static_cast<uint32>(0xFF) << 16) | (static_cast<uint32>(0xFF) << 8) | static_cast<uint32>(0xFF));
|
||||
//auto pattern = anim::shifted((static_cast<quint32>(0xFF) << 24) | (static_cast<quint32>(0xFF) << 16) | (static_cast<quint32>(0xFF) << 8) | static_cast<quint32>(0xFF));
|
||||
//for (auto y = 0; y != _finalHeight; ++y) {
|
||||
// for (auto x = 0; x != _finalWidth; ++x) {
|
||||
// auto source = *frameInts;
|
||||
|
@ -514,7 +514,7 @@ void TabbedSelector::afterShown() {
|
|||
}
|
||||
}
|
||||
|
||||
void TabbedSelector::stickersInstalled(uint64 setId) {
|
||||
void TabbedSelector::stickersInstalled(quint64 setId) {
|
||||
_tabsSlider->setActiveSection(static_cast<int>(SelectorTab::Stickers));
|
||||
stickers()->showStickerSet(setId);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
void setRoundRadius(int radius);
|
||||
void refreshStickers();
|
||||
void stickersInstalled(uint64 setId);
|
||||
void stickersInstalled(quint64 setId);
|
||||
void showMegagroupSet(ChannelData *megagroup);
|
||||
void setCurrentPeer(PeerData *peer);
|
||||
|
||||
|
|
|
@ -24,10 +24,6 @@ namespace codegen {
|
|||
namespace emoji {
|
||||
namespace {
|
||||
|
||||
using uint16 = quint16;
|
||||
using uint32 = quint32;
|
||||
using uint64 = quint64;
|
||||
|
||||
using std::vector;
|
||||
using std::map;
|
||||
using std::find;
|
||||
|
@ -36,7 +32,7 @@ using std::move;
|
|||
using std::begin;
|
||||
using std::end;
|
||||
|
||||
using InputId = vector<uint32>;
|
||||
using InputId = vector<quint32>;
|
||||
using InputCategory = vector<InputId>;
|
||||
|
||||
// copied from emoji_box.cpp
|
||||
|
@ -83,7 +79,7 @@ Replace Replaces[] = {
|
|||
{ { 0xD83DDE08U }, "}:)" },
|
||||
};
|
||||
|
||||
using ColorId = uint32;
|
||||
using ColorId = quint32;
|
||||
ColorId Colors[] = {
|
||||
0xD83CDFFBU,
|
||||
0xD83CDFFCU,
|
||||
|
@ -1703,11 +1699,11 @@ InputCategory Category7 = {
|
|||
|
||||
constexpr auto kErrorBadData = 401;
|
||||
|
||||
void append(Id &id, uint32 code) {
|
||||
if (auto first = static_cast<uint16>((code >> 16) & 0xFFFFU)) {
|
||||
void append(Id &id, quint32 code) {
|
||||
if (auto first = static_cast<quint16>((code >> 16) & 0xFFFFU)) {
|
||||
id.append(QChar(first));
|
||||
}
|
||||
id.append(QChar(static_cast<uint16>(code & 0xFFFFU)));
|
||||
id.append(QChar(static_cast<quint16>(code & 0xFFFFU)));
|
||||
}
|
||||
|
||||
using VariatedIds = map<Id, bool>;
|
||||
|
|
|
@ -123,11 +123,11 @@ QRect computeSourceRect(const QImage &image) {
|
|||
return result;
|
||||
}
|
||||
|
||||
uint32 Crc32Table[256];
|
||||
quint32 Crc32Table[256];
|
||||
class Crc32Initializer {
|
||||
public:
|
||||
Crc32Initializer() {
|
||||
uint32 poly = 0x04C11DB7U;
|
||||
quint32 poly = 0x04C11DB7U;
|
||||
for (auto i = 0; i != 256; ++i) {
|
||||
Crc32Table[i] = reflect(i, 8) << 24;
|
||||
for (auto j = 0; j != 8; ++j) {
|
||||
|
@ -138,8 +138,8 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
uint32 reflect(uint32 val, char ch) {
|
||||
uint32 result = 0;
|
||||
quint32 reflect(quint32 val, char ch) {
|
||||
quint32 result = 0;
|
||||
for (int i = 1; i < (ch + 1); ++i) {
|
||||
if (val & 1) {
|
||||
result |= 1 << (ch - i);
|
||||
|
@ -151,11 +151,11 @@ private:
|
|||
|
||||
};
|
||||
|
||||
uint32 countCrc32(const void *data, std::size_t size) {
|
||||
quint32 countCrc32(const void *data, std::size_t size) {
|
||||
static Crc32Initializer InitTable;
|
||||
|
||||
auto buffer = static_cast<const unsigned char*>(data);
|
||||
auto result = uint32(0xFFFFFFFFU);
|
||||
auto result = quint32(0xFFFFFFFFU);
|
||||
for (auto i = std::size_t(0); i != size; ++i) {
|
||||
result = (result >> 8) ^ Crc32Table[(result & 0xFFU) ^ buffer[i]];
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ bool Generator::writeImages() {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (needResave) {
|
||||
if (needResave) {
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
logDataError() << "Could not open 'emoji" << postfix << ".png'.";
|
||||
|
@ -363,7 +363,7 @@ void Init() {\n\
|
|||
\n\
|
||||
Items.reserve(base::array_size(Data));\n\
|
||||
for (auto &data : Data) {\n\
|
||||
Items.emplace_back(takeString(data.idSize), uint16(data.column), uint16(data.row), bool(data.postfixed), bool(data.variated), data.original ? &Items[data.original - 1] : nullptr, One::CreationTag());\n\
|
||||
Items.emplace_back(takeString(data.idSize), quint16(data.column), quint16(data.row), bool(data.postfixed), bool(data.variated), data.original ? &Items[data.original - 1] : nullptr, One::CreationTag());\n\
|
||||
}\n\
|
||||
InitReplacements();\n\
|
||||
}\n\
|
||||
|
@ -796,7 +796,7 @@ struct Replacement {\n\
|
|||
constexpr auto kReplacementMaxLength = " << maxLength << ";\n\
|
||||
\n\
|
||||
void InitReplacements();\n\
|
||||
const std::vector<const Replacement*> *GetReplacements(utf16char first);\n\
|
||||
const std::vector<const Replacement*> *GetReplacements(char16_t first);\n\
|
||||
utf16string GetReplacementEmoji(utf16string replacement);\n\
|
||||
\n";
|
||||
return header->finalize();
|
||||
|
@ -806,12 +806,12 @@ bool Generator::writeReplacements() {
|
|||
QMap<QChar, QVector<int>> byCharIndices;
|
||||
suggestionsSource_->stream() << "\
|
||||
struct ReplacementStruct {\n\
|
||||
small emojiSize;\n\
|
||||
small replacementSize;\n\
|
||||
small wordsCount;\n\
|
||||
uint8_t emojiSize;\n\
|
||||
uint8_t replacementSize;\n\
|
||||
uint8_t wordsCount;\n\
|
||||
};\n\
|
||||
\n\
|
||||
const utf16char ReplacementData[] = {";
|
||||
const char16_t ReplacementData[] = {";
|
||||
startBinary();
|
||||
for (auto i = 0, size = replaces_.list.size(); i != size; ++i) {
|
||||
auto &replace = replaces_.list[i];
|
||||
|
@ -833,7 +833,7 @@ const utf16char ReplacementData[] = {";
|
|||
}
|
||||
suggestionsSource_->stream() << " };\n\
|
||||
\n\
|
||||
const small ReplacementWordLengths[] = {";
|
||||
const uint8_t ReplacementWordLengths[] = {";
|
||||
startBinary();
|
||||
for (auto &replace : replaces_.list) {
|
||||
auto wordLengths = QStringList();
|
||||
|
@ -846,11 +846,11 @@ const small ReplacementWordLengths[] = {";
|
|||
const ReplacementStruct ReplacementInitData[] = {\n";
|
||||
for (auto &replace : replaces_.list) {
|
||||
suggestionsSource_->stream() << "\
|
||||
{ small(" << replace.id.size() << "), small(" << replace.replacement.size() << "), small(" << replace.words.size() << ") },\n";
|
||||
{ uint8_t(" << replace.id.size() << "), uint8_t(" << replace.replacement.size() << "), uint8_t(" << replace.words.size() << ") },\n";
|
||||
}
|
||||
suggestionsSource_->stream() << "};\n\
|
||||
\n\
|
||||
const medium ReplacementIndices[] = {";
|
||||
const uint16_t ReplacementIndices[] = {";
|
||||
startBinary();
|
||||
for (auto &byCharIndex : byCharIndices) {
|
||||
for (auto index : byCharIndex) {
|
||||
|
@ -860,8 +860,8 @@ const medium ReplacementIndices[] = {";
|
|||
suggestionsSource_->stream() << " };\n\
|
||||
\n\
|
||||
struct ReplacementIndexStruct {\n\
|
||||
utf16char ch;\n\
|
||||
medium count;\n\
|
||||
char16_t ch;\n\
|
||||
uint16_t count;\n\
|
||||
};\n\
|
||||
\n\
|
||||
const internal::checksum ReplacementChecksums[] = {\n";
|
||||
|
@ -875,12 +875,12 @@ const ReplacementIndexStruct ReplacementIndexData[] = {\n";
|
|||
startBinary();
|
||||
for (auto i = byCharIndices.cbegin(), e = byCharIndices.cend(); i != e; ++i) {
|
||||
suggestionsSource_->stream() << "\
|
||||
{ utf16char(" << i.key().unicode() << "), medium(" << i.value().size() << ") },\n";
|
||||
{ char16_t(" << i.key().unicode() << "), uint16_t(" << i.value().size() << ") },\n";
|
||||
}
|
||||
suggestionsSource_->stream() << "};\n\
|
||||
\n\
|
||||
std::vector<Replacement> Replacements;\n\
|
||||
std::map<utf16char, std::vector<const Replacement*>> ReplacementsMap;\n\
|
||||
std::map<char16_t, std::vector<const Replacement*>> ReplacementsMap;\n\
|
||||
std::map<internal::checksum, const Replacement*> ReplacementsHash;\n\
|
||||
\n";
|
||||
return true;
|
||||
|
@ -928,7 +928,7 @@ void InitReplacements() {\n\
|
|||
}\n\
|
||||
}\n\
|
||||
\n\
|
||||
const std::vector<const Replacement*> *GetReplacements(utf16char first) {\n\
|
||||
const std::vector<const Replacement*> *GetReplacements(char16_t first) {\n\
|
||||
if (ReplacementsMap.empty()) {\n\
|
||||
InitReplacements();\n\
|
||||
}\n\
|
||||
|
@ -937,7 +937,7 @@ const std::vector<const Replacement*> *GetReplacements(utf16char first) {\n\
|
|||
}\n\
|
||||
\n\
|
||||
utf16string GetReplacementEmoji(utf16string replacement) {\n\
|
||||
auto code = internal::countChecksum(replacement.data(), replacement.size() * sizeof(utf16char));\n\
|
||||
auto code = internal::countChecksum(replacement.data(), replacement.size() * sizeof(char16_t));\n\
|
||||
auto it = ReplacementsHash.find(code);\n\
|
||||
return (it == ReplacementsHash.cend()) ? utf16string() : it->second->emoji;\n\
|
||||
}\n\
|
||||
|
@ -984,7 +984,7 @@ void Generator::writeIntBinary(common::CppFile *source, int data) {
|
|||
++_binaryFullLength;
|
||||
}
|
||||
|
||||
void Generator::writeUintBinary(common::CppFile *source, uint32 data) {
|
||||
void Generator::writeUintBinary(common::CppFile *source, quint32 data) {
|
||||
if (_binaryFullLength > 0) source->stream() << ",";
|
||||
if (!_binaryCount++) {
|
||||
source->stream() << "\n";
|
||||
|
|
|
@ -31,8 +31,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
namespace codegen {
|
||||
namespace emoji {
|
||||
|
||||
using uint32 = unsigned int;
|
||||
|
||||
class Generator {
|
||||
public:
|
||||
Generator(const Options &options);
|
||||
|
@ -66,7 +64,7 @@ private:
|
|||
void startBinary();
|
||||
bool writeStringBinary(common::CppFile *source, const QString &string);
|
||||
void writeIntBinary(common::CppFile *source, int data);
|
||||
void writeUintBinary(common::CppFile *source, uint32 data);
|
||||
void writeUintBinary(common::CppFile *source, quint32 data);
|
||||
|
||||
const common::ProjectInfo &project_;
|
||||
int colorsCount_ = 0;
|
||||
|
|
|
@ -150,8 +150,8 @@ QString lang(LangKey key);\n\
|
|||
for (auto &tagData : entry.tags) {
|
||||
auto &tag = tagData.tag;
|
||||
auto isPluralTag = isPlural && (tag == kPluralTag);
|
||||
genericParams.push_back("lngtag_" + tag + ", " + (isPluralTag ? "float64 " : "const ResultString &") + tag + "__val");
|
||||
params.push_back("lngtag_" + tag + ", " + (isPluralTag ? "float64 " : "const QString &") + tag + "__val");
|
||||
genericParams.push_back("lngtag_" + tag + ", " + (isPluralTag ? "double " : "const ResultString &") + tag + "__val");
|
||||
params.push_back("lngtag_" + tag + ", " + (isPluralTag ? "double " : "const QString &") + tag + "__val");
|
||||
if (isPluralTag) {
|
||||
plural = "\tauto plural = Lang::Plural(" + key + ", " + kPluralTag + "__val);\n";
|
||||
applyTags.push_back("\tresult = Lang::ReplaceTag<ResultString>::Call(std::move(result), lt_" + tag + ", Lang::StartReplacements<ResultString>::Call(std::move(plural.replacement)));\n");
|
||||
|
|
|
@ -51,7 +51,7 @@ bool Generator::writeSource() {
|
|||
QVector<int> phoneNumberParse(const QString &number) {\n\
|
||||
QVector<int> result;\n\
|
||||
\n\
|
||||
int32 len = number.size();\n\
|
||||
qint32 len = number.size();\n\
|
||||
if (len > 0) switch (number.at(0).unicode()) {\n";
|
||||
|
||||
QString already;
|
||||
|
|
|
@ -311,7 +311,7 @@ with open(input_file) as f:
|
|||
prmsInit = [];
|
||||
prmsNames = [];
|
||||
if (hasFlags != ''):
|
||||
funcsText += '\tenum class Flag : int32 {\n';
|
||||
funcsText += '\tenum class Flag : qint32 {\n';
|
||||
maxbit = 0;
|
||||
parentFlagsCheck['MTP' + name] = {};
|
||||
for paramName in conditionsList:
|
||||
|
@ -356,12 +356,12 @@ with open(input_file) as f:
|
|||
funcsText += '\tMTP' + name + '(' + ', '.join(prmsStr) + ') : ' + ', '.join(prmsInit) + ' {\n\t}\n';
|
||||
|
||||
funcsText += '\n';
|
||||
funcsText += '\tuint32 innerLength() const;\n'; # count size
|
||||
funcsText += '\tquint32 innerLength() const;\n'; # count size
|
||||
if (isTemplate != ''):
|
||||
methodBodies += 'template <typename TQueryType>\n'
|
||||
methodBodies += 'uint32 MTP' + name + '<TQueryType>::innerLength() const {\n';
|
||||
methodBodies += 'quint32 MTP' + name + '<TQueryType>::innerLength() const {\n';
|
||||
else:
|
||||
methodBodies += 'uint32 MTP' + name + '::innerLength() const {\n';
|
||||
methodBodies += 'quint32 MTP' + name + '::innerLength() const {\n';
|
||||
size = [];
|
||||
for k in prmsList:
|
||||
v = prms[k];
|
||||
|
@ -453,7 +453,7 @@ def addTextSerialize(lst, dct, dataLetter):
|
|||
conditions = data[6];
|
||||
trivialConditions = data[7];
|
||||
|
||||
result += 'void Serialize_' + name + '(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {\n';
|
||||
result += 'void Serialize_' + name + '(MTPStringLogger &to, qint32 stage, qint32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, qint32 iflag) {\n';
|
||||
if (len(conditions)):
|
||||
result += '\tMTP' + dataLetter + name + '::Flags flag(iflag);\n\n';
|
||||
if (len(prms)):
|
||||
|
@ -592,7 +592,7 @@ for restype in typesList:
|
|||
writeText = '';
|
||||
|
||||
if (hasFlags != ''):
|
||||
dataText += '\tenum class Flag : int32 {\n';
|
||||
dataText += '\tenum class Flag : qint32 {\n';
|
||||
maxbit = 0;
|
||||
parentFlagsCheck['MTPD' + name] = {};
|
||||
for paramName in conditionsList:
|
||||
|
@ -752,8 +752,8 @@ for restype in typesList:
|
|||
if (withData):
|
||||
typesText += getters;
|
||||
|
||||
typesText += '\n\tuint32 innerLength() const;\n'; # size method
|
||||
methods += '\nuint32 MTP' + restype + '::innerLength() const {\n';
|
||||
typesText += '\n\tquint32 innerLength() const;\n'; # size method
|
||||
methods += '\nquint32 MTP' + restype + '::innerLength() const {\n';
|
||||
if (withType and sizeCases):
|
||||
methods += '\tswitch (_type) {\n';
|
||||
methods += sizeCases;
|
||||
|
@ -853,7 +853,7 @@ for childName in parentFlagsList:
|
|||
|
||||
# manual types added here
|
||||
textSerializeMethods += '\
|
||||
void _serialize_rpc_result(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {\n\
|
||||
void _serialize_rpc_result(MTPStringLogger &to, qint32 stage, qint32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, qint32 iflag) {\n\
|
||||
if (stage) {\n\
|
||||
to.add(",\\n").addSpaces(lev);\n\
|
||||
} else {\n\
|
||||
|
@ -867,7 +867,7 @@ void _serialize_rpc_result(MTPStringLogger &to, int32 stage, int32 lev, Types &t
|
|||
}\n\
|
||||
}\n\
|
||||
\n\
|
||||
void _serialize_msg_container(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {\n\
|
||||
void _serialize_msg_container(MTPStringLogger &to, qint32 stage, qint32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, qint32 iflag) {\n\
|
||||
if (stage) {\n\
|
||||
to.add(",\\n").addSpaces(lev);\n\
|
||||
} else {\n\
|
||||
|
@ -880,7 +880,7 @@ void _serialize_msg_container(MTPStringLogger &to, int32 stage, int32 lev, Types
|
|||
}\n\
|
||||
}\n\
|
||||
\n\
|
||||
void _serialize_core_message(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {\n\
|
||||
void _serialize_core_message(MTPStringLogger &to, qint32 stage, qint32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, qint32 iflag) {\n\
|
||||
if (stage) {\n\
|
||||
to.add(",\\n").addSpaces(lev);\n\
|
||||
} else {\n\
|
||||
|
@ -966,7 +966,7 @@ enum {\n\
|
|||
// Factory methods declaration\n\
|
||||
' + factories + '\n\
|
||||
// Human-readable text serialization\n\
|
||||
void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpPrime *end, mtpPrime cons, uint32 level, mtpPrime vcons);\n'
|
||||
void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpPrime *end, mtpPrime cons, quint32 level, mtpPrime vcons);\n'
|
||||
|
||||
source = '\
|
||||
/*\n\
|
||||
|
@ -1007,12 +1007,12 @@ public:\n\
|
|||
' + methods + '\n\
|
||||
\n\
|
||||
using Types = QVector<mtpTypeId>;\n\
|
||||
using StagesFlags = QVector<int32>;\n\
|
||||
using StagesFlags = QVector<qint32>;\n\
|
||||
\n\
|
||||
' + textSerializeMethods + '\n\
|
||||
namespace {\n\
|
||||
\n\
|
||||
using TextSerializer = void (*)(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag);\n\
|
||||
using TextSerializer = void (*)(MTPStringLogger &to, qint32 stage, qint32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, qint32 iflag);\n\
|
||||
using TextSerializers = QMap<mtpTypeId, TextSerializer>;\n\
|
||||
\n\
|
||||
QMap<mtpTypeId, TextSerializer> createTextSerializers() {\n\
|
||||
|
@ -1025,17 +1025,17 @@ QMap<mtpTypeId, TextSerializer> createTextSerializers() {\n\
|
|||
\n\
|
||||
} // namespace\n\
|
||||
\n\
|
||||
void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpPrime *end, mtpPrime cons, uint32 level, mtpPrime vcons) {\n\
|
||||
void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpPrime *end, mtpPrime cons, quint32 level, mtpPrime vcons) {\n\
|
||||
static auto serializers = createTextSerializers();\n\
|
||||
\n\
|
||||
QVector<mtpTypeId> types, vtypes;\n\
|
||||
QVector<int32> stages, flags;\n\
|
||||
QVector<qint32> stages, flags;\n\
|
||||
types.reserve(20); vtypes.reserve(20); stages.reserve(20); flags.reserve(20);\n\
|
||||
types.push_back(mtpTypeId(cons)); vtypes.push_back(mtpTypeId(vcons)); stages.push_back(0); flags.push_back(0);\n\
|
||||
\n\
|
||||
const mtpPrime *start = from;\n\
|
||||
mtpTypeId type = cons, vtype = vcons;\n\
|
||||
int32 stage = 0, flag = 0;\n\
|
||||
qint32 stage = 0, flag = 0;\n\
|
||||
\n\
|
||||
while (!types.isEmpty()) {\n\
|
||||
type = types.back();\n\
|
||||
|
@ -1052,7 +1052,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP
|
|||
start = ++from;\n\
|
||||
}\n\
|
||||
\n\
|
||||
int32 lev = level + types.size() - 1;\n\
|
||||
qint32 lev = level + types.size() - 1;\n\
|
||||
auto it = serializers.constFind(type);\n\
|
||||
if (it != serializers.cend()) {\n\
|
||||
(*it.value())(to, stage, lev, types, vtypes, stages, flags, start, end, flag);\n\
|
||||
|
|
|
@ -504,7 +504,7 @@ public:\n\
|
|||
return *this;\n\
|
||||
}\n\
|
||||
\n\
|
||||
static int32 Checksum();\n\
|
||||
static qint32 Checksum();\n\
|
||||
\n\
|
||||
~palette() {\n\
|
||||
clear();\n\
|
||||
|
@ -809,7 +809,7 @@ void palette::finalize() {\n\
|
|||
source_->stream() << "\
|
||||
}\n\
|
||||
\n\
|
||||
int32 palette::Checksum() {\n\
|
||||
qint32 palette::Checksum() {\n\
|
||||
return " << checksum << ";\n\
|
||||
}\n";
|
||||
|
||||
|
|
|
@ -134,11 +134,11 @@ enum {
|
|||
ChoosePeerByDragTimeout = 1000, // 1 second mouse not moved to choose dialog when dragging a file
|
||||
};
|
||||
|
||||
inline bool isNotificationsUser(uint64 id) {
|
||||
inline bool isNotificationsUser(quint64 id) {
|
||||
return (id == 333000) || (id == ServiceUserId);
|
||||
}
|
||||
|
||||
inline bool isServiceUser(uint64 id) {
|
||||
inline bool isServiceUser(quint64 id) {
|
||||
return !(id % 1000);// (id == 333000) || (id == ServiceUserId);
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ w/CVnbwQOw0g5GBwwFV3r0uTTvy44xx8XXxk+Qknu4eBCsmrAFNnAgMBAAE=\n\
|
|||
#ifdef CUSTOM_API_ID
|
||||
#include "../../../TelegramPrivate/custom_api_id.h" // Custom API id and API hash
|
||||
#else
|
||||
static const int32 ApiId = 17349;
|
||||
static const qint32 ApiId = 17349;
|
||||
static const char *ApiHash = "344583e45741c457fe1862106095a5eb";
|
||||
#endif
|
||||
|
||||
|
|
|
@ -51,15 +51,7 @@ void as_const(const T&&) = delete;
|
|||
|
||||
#include "base/ordered_set.h"
|
||||
|
||||
//using uchar = unsigned char; // Qt has uchar
|
||||
using int16 = qint16;
|
||||
using uint16 = quint16;
|
||||
using int32 = qint32;
|
||||
using uint32 = quint32;
|
||||
using int64 = qint64;
|
||||
using uint64 = quint64;
|
||||
using float32 = float;
|
||||
using float64 = double;
|
||||
#include <cstdint>
|
||||
|
||||
#define qsl(s) QStringLiteral(s)
|
||||
#define qstr(s) QLatin1String(s, sizeof(s) - 1)
|
||||
|
|
|
@ -157,7 +157,7 @@ private:
|
|||
|
||||
class MentionNameClickHandler : public ClickHandler {
|
||||
public:
|
||||
MentionNameClickHandler(QString text, UserId userId, uint64 accessHash)
|
||||
MentionNameClickHandler(QString text, UserId userId, quint64 accessHash)
|
||||
: _text(text)
|
||||
, _userId(userId)
|
||||
, _accessHash(accessHash) {
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
private:
|
||||
QString _text;
|
||||
UserId _userId;
|
||||
uint64 _accessHash;
|
||||
quint64 _accessHash;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ QString filedialogDefaultName(const QString &prefix, const QString &extension, c
|
|||
|
||||
QString filedialogNextFilename(const QString &name, const QString &cur, const QString &path) {
|
||||
QDir dir(path.isEmpty() ? cDialogLastPath() : path);
|
||||
int32 extIndex = name.lastIndexOf('.');
|
||||
qint32 extIndex = name.lastIndexOf('.');
|
||||
QString prefix = name, extension;
|
||||
if (extIndex >= 0) {
|
||||
extension = name.mid(extIndex);
|
||||
|
|
|
@ -36,7 +36,7 @@ extern "C" {
|
|||
#include "application.h"
|
||||
#include "platform/platform_specific.h"
|
||||
|
||||
uint64 _SharedMemoryLocation[4] = { 0x00, 0x01, 0x02, 0x03 };
|
||||
quint64 _SharedMemoryLocation[4] = { 0x00, 0x01, 0x02, 0x03 };
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#elif defined Q_OS_MAC
|
||||
|
@ -50,14 +50,14 @@ uint64 _SharedMemoryLocation[4] = { 0x00, 0x01, 0x02, 0x03 };
|
|||
// Base types compile-time check
|
||||
static_assert(sizeof(char) == 1, "Basic types size check failed");
|
||||
static_assert(sizeof(uchar) == 1, "Basic types size check failed");
|
||||
static_assert(sizeof(int16) == 2, "Basic types size check failed");
|
||||
static_assert(sizeof(uint16) == 2, "Basic types size check failed");
|
||||
static_assert(sizeof(int32) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(uint32) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(int64) == 8, "Basic types size check failed");
|
||||
static_assert(sizeof(uint64) == 8, "Basic types size check failed");
|
||||
static_assert(sizeof(float32) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(float64) == 8, "Basic types size check failed");
|
||||
static_assert(sizeof(qint16) == 2, "Basic types size check failed");
|
||||
static_assert(sizeof(quint16) == 2, "Basic types size check failed");
|
||||
static_assert(sizeof(qint32) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(quint32) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(qint64) == 8, "Basic types size check failed");
|
||||
static_assert(sizeof(quint64) == 8, "Basic types size check failed");
|
||||
static_assert(sizeof(float) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(double) == 8, "Basic types size check failed");
|
||||
static_assert(sizeof(mtpPrime) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(MTPint) == 4, "Basic types size check failed");
|
||||
static_assert(sizeof(MTPlong) == 8, "Basic types size check failed");
|
||||
|
@ -69,10 +69,10 @@ static_assert(sizeof(MTPdouble) == 8, "Basic types size check failed");
|
|||
|
||||
namespace {
|
||||
QReadWriteLock unixtimeLock;
|
||||
volatile int32 unixtimeDelta = 0;
|
||||
volatile qint32 unixtimeDelta = 0;
|
||||
volatile bool unixtimeWasSet = false;
|
||||
volatile uint64 _msgIdStart, _msgIdLocal = 0, _msgIdMsStart;
|
||||
int32 _reqId = 0;
|
||||
volatile quint64 _msgIdStart, _msgIdLocal = 0, _msgIdMsStart;
|
||||
qint32 _reqId = 0;
|
||||
|
||||
void _initMsgIdConstants() {
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -84,12 +84,12 @@ namespace {
|
|||
#else
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
_msgIdMsStart = 1000000000 * uint64(ts.tv_sec) + uint64(ts.tv_nsec);
|
||||
_msgIdMsStart = 1000000000 * quint64(ts.tv_sec) + quint64(ts.tv_nsec);
|
||||
#endif
|
||||
|
||||
uint32 msgIdRand;
|
||||
memset_rand(&msgIdRand, sizeof(uint32));
|
||||
_msgIdStart = (((uint64)((uint32)unixtime()) << 32) | (uint64)msgIdRand);
|
||||
quint32 msgIdRand;
|
||||
memset_rand(&msgIdRand, sizeof(quint32));
|
||||
_msgIdStart = (((quint64)((quint32)unixtime()) << 32) | (quint64)msgIdRand);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ void unixtimeInit() {
|
|||
_initMsgIdConstants();
|
||||
}
|
||||
|
||||
void unixtimeSet(int32 serverTime, bool force) {
|
||||
void unixtimeSet(qint32 serverTime, bool force) {
|
||||
{
|
||||
QWriteLocker locker(&unixtimeLock);
|
||||
if (force) {
|
||||
|
@ -204,10 +204,10 @@ namespace {
|
|||
return 0;
|
||||
}
|
||||
|
||||
float64 _msFreq;
|
||||
float64 _msgIdCoef;
|
||||
double _msFreq;
|
||||
double _msgIdCoef;
|
||||
TimeMs _msStart = 0, _msAddToMsStart = 0, _msAddToUnixtime = 0;
|
||||
int32 _timeStart = 0;
|
||||
qint32 _timeStart = 0;
|
||||
|
||||
class _MsInitializer {
|
||||
public:
|
||||
|
@ -215,30 +215,30 @@ namespace {
|
|||
#ifdef Q_OS_WIN
|
||||
LARGE_INTEGER li;
|
||||
QueryPerformanceFrequency(&li);
|
||||
_msFreq = 1000. / float64(li.QuadPart);
|
||||
_msFreq = 1000. / double(li.QuadPart);
|
||||
|
||||
// 0xFFFF0000L istead of 0x100000000L to make msgId grow slightly slower, than unixtime and we had time to reconfigure
|
||||
_msgIdCoef = float64(0xFFFF0000L) / float64(li.QuadPart);
|
||||
_msgIdCoef = double(0xFFFF0000L) / double(li.QuadPart);
|
||||
|
||||
QueryPerformanceCounter(&li);
|
||||
_msStart = li.QuadPart;
|
||||
#elif defined Q_OS_MAC
|
||||
mach_timebase_info_data_t tb = { 0, 0 };
|
||||
mach_timebase_info(&tb);
|
||||
_msFreq = (float64(tb.numer) / tb.denom) / 1000000.;
|
||||
_msFreq = (double(tb.numer) / tb.denom) / 1000000.;
|
||||
|
||||
_msgIdCoef = _msFreq * (float64(0xFFFF0000L) / 1000.);
|
||||
_msgIdCoef = _msFreq * (double(0xFFFF0000L) / 1000.);
|
||||
|
||||
_msStart = mach_absolute_time();
|
||||
#else
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
//_msFreq = 1 / 1000000.;
|
||||
_msgIdCoef = float64(0xFFFF0000L) / 1000000000.;
|
||||
_msgIdCoef = double(0xFFFF0000L) / 1000000000.;
|
||||
_msStart = 1000LL * static_cast<TimeMs>(ts.tv_sec) + (static_cast<TimeMs>(ts.tv_nsec) / 1000000LL);
|
||||
#endif
|
||||
_timeStart = myunixtime();
|
||||
srand((uint32)(_msStart & 0xFFFFFFFFL));
|
||||
srand((quint32)(_msStart & 0xFFFFFFFFL));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -356,19 +356,19 @@ TimeMs getms(bool checked) {
|
|||
#endif
|
||||
}
|
||||
|
||||
uint64 msgid() {
|
||||
quint64 msgid() {
|
||||
#ifdef Q_OS_WIN
|
||||
LARGE_INTEGER li;
|
||||
QueryPerformanceCounter(&li);
|
||||
uint64 result = _msgIdStart + (uint64)floor((li.QuadPart - _msgIdMsStart) * _msgIdCoef);
|
||||
quint64 result = _msgIdStart + (quint64)floor((li.QuadPart - _msgIdMsStart) * _msgIdCoef);
|
||||
#elif defined Q_OS_MAC
|
||||
uint64 msCount = mach_absolute_time();
|
||||
uint64 result = _msgIdStart + (uint64)floor((msCount - _msgIdMsStart) * _msgIdCoef);
|
||||
quint64 msCount = mach_absolute_time();
|
||||
quint64 result = _msgIdStart + (quint64)floor((msCount - _msgIdMsStart) * _msgIdCoef);
|
||||
#else
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
uint64 msCount = 1000000000 * uint64(ts.tv_sec) + uint64(ts.tv_nsec);
|
||||
uint64 result = _msgIdStart + (uint64)floor((msCount - _msgIdMsStart) * _msgIdCoef);
|
||||
quint64 msCount = 1000000000 * quint64(ts.tv_sec) + quint64(ts.tv_nsec);
|
||||
quint64 result = _msgIdStart + (quint64)floor((msCount - _msgIdMsStart) * _msgIdCoef);
|
||||
#endif
|
||||
|
||||
result &= ~0x03L;
|
||||
|
@ -376,7 +376,7 @@ uint64 msgid() {
|
|||
return result + (_msgIdLocal += 4);
|
||||
}
|
||||
|
||||
int32 reqid() {
|
||||
qint32 reqid() {
|
||||
QWriteLocker locker(&unixtimeLock);
|
||||
if (_reqId == INT_MAX) {
|
||||
_reqId = 0;
|
||||
|
@ -387,14 +387,14 @@ int32 reqid() {
|
|||
// crc32 hash, taken somewhere from the internet
|
||||
|
||||
namespace {
|
||||
uint32 _crc32Table[256];
|
||||
quint32 _crc32Table[256];
|
||||
class _Crc32Initializer {
|
||||
public:
|
||||
_Crc32Initializer() {
|
||||
uint32 poly = 0x04c11db7;
|
||||
for (uint32 i = 0; i < 256; ++i) {
|
||||
quint32 poly = 0x04c11db7;
|
||||
for (quint32 i = 0; i < 256; ++i) {
|
||||
_crc32Table[i] = reflect(i, 8) << 24;
|
||||
for (uint32 j = 0; j < 8; ++j) {
|
||||
for (quint32 j = 0; j < 8; ++j) {
|
||||
_crc32Table[i] = (_crc32Table[i] << 1) ^ (_crc32Table[i] & (1 << 31) ? poly : 0);
|
||||
}
|
||||
_crc32Table[i] = reflect(_crc32Table[i], 32);
|
||||
|
@ -402,8 +402,8 @@ namespace {
|
|||
}
|
||||
|
||||
private:
|
||||
uint32 reflect(uint32 val, char ch) {
|
||||
uint32 result = 0;
|
||||
quint32 reflect(quint32 val, char ch) {
|
||||
quint32 result = 0;
|
||||
for (int i = 1; i < (ch + 1); ++i) {
|
||||
if (val & 1) {
|
||||
result |= 1 << (ch - i);
|
||||
|
@ -415,39 +415,39 @@ namespace {
|
|||
};
|
||||
}
|
||||
|
||||
int32 hashCrc32(const void *data, uint32 len) {
|
||||
qint32 hashCrc32(const void *data, quint32 len) {
|
||||
static _Crc32Initializer _crc32Initializer;
|
||||
|
||||
const uchar *buf = (const uchar *)data;
|
||||
|
||||
uint32 crc(0xffffffff);
|
||||
for (uint32 i = 0; i < len; ++i) {
|
||||
quint32 crc(0xffffffff);
|
||||
for (quint32 i = 0; i < len; ++i) {
|
||||
crc = (crc >> 8) ^ _crc32Table[(crc & 0xFF) ^ buf[i]];
|
||||
}
|
||||
|
||||
return crc ^ 0xffffffff;
|
||||
}
|
||||
|
||||
int32 *hashSha1(const void *data, uint32 len, void *dest) {
|
||||
return (int32*)SHA1((const uchar*)data, (size_t)len, (uchar*)dest);
|
||||
qint32 *hashSha1(const void *data, quint32 len, void *dest) {
|
||||
return (qint32*)SHA1((const uchar*)data, (size_t)len, (uchar*)dest);
|
||||
}
|
||||
|
||||
int32 *hashSha256(const void *data, uint32 len, void *dest) {
|
||||
return (int32*)SHA256((const uchar*)data, (size_t)len, (uchar*)dest);
|
||||
qint32 *hashSha256(const void *data, quint32 len, void *dest) {
|
||||
return (qint32*)SHA256((const uchar*)data, (size_t)len, (uchar*)dest);
|
||||
}
|
||||
|
||||
// md5 hash, taken somewhere from the internet
|
||||
|
||||
namespace {
|
||||
|
||||
inline void _md5_decode(uint32 *output, const uchar *input, uint32 len) {
|
||||
for (uint32 i = 0, j = 0; j < len; i++, j += 4) {
|
||||
output[i] = ((uint32)input[j]) | (((uint32)input[j + 1]) << 8) | (((uint32)input[j + 2]) << 16) | (((uint32)input[j + 3]) << 24);
|
||||
inline void _md5_decode(quint32 *output, const uchar *input, quint32 len) {
|
||||
for (quint32 i = 0, j = 0; j < len; i++, j += 4) {
|
||||
output[i] = ((quint32)input[j]) | (((quint32)input[j + 1]) << 8) | (((quint32)input[j + 2]) << 16) | (((quint32)input[j + 3]) << 24);
|
||||
}
|
||||
}
|
||||
|
||||
inline void _md5_encode(uchar *output, const uint32 *input, uint32 len) {
|
||||
for (uint32 i = 0, j = 0; j < len; i++, j += 4) {
|
||||
inline void _md5_encode(uchar *output, const quint32 *input, quint32 len) {
|
||||
for (quint32 i = 0, j = 0; j < len; i++, j += 4) {
|
||||
output[j + 0] = (input[i]) & 0xFF;
|
||||
output[j + 1] = (input[i] >> 8) & 0xFF;
|
||||
output[j + 2] = (input[i] >> 16) & 0xFF;
|
||||
|
@ -455,39 +455,39 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
inline uint32 _md5_rotate_left(uint32 x, int n) {
|
||||
inline quint32 _md5_rotate_left(quint32 x, int n) {
|
||||
return (x << n) | (x >> (32 - n));
|
||||
}
|
||||
|
||||
inline uint32 _md5_F(uint32 x, uint32 y, uint32 z) {
|
||||
inline quint32 _md5_F(quint32 x, quint32 y, quint32 z) {
|
||||
return (x & y) | (~x & z);
|
||||
}
|
||||
|
||||
inline uint32 _md5_G(uint32 x, uint32 y, uint32 z) {
|
||||
inline quint32 _md5_G(quint32 x, quint32 y, quint32 z) {
|
||||
return (x & z) | (y & ~z);
|
||||
}
|
||||
|
||||
inline uint32 _md5_H(uint32 x, uint32 y, uint32 z) {
|
||||
inline quint32 _md5_H(quint32 x, quint32 y, quint32 z) {
|
||||
return x ^ y ^ z;
|
||||
}
|
||||
|
||||
inline uint32 _md5_I(uint32 x, uint32 y, uint32 z) {
|
||||
inline quint32 _md5_I(quint32 x, quint32 y, quint32 z) {
|
||||
return y ^ (x | ~z);
|
||||
}
|
||||
|
||||
inline void _md5_FF(uint32 &a, uint32 b, uint32 c, uint32 d, uint32 x, uint32 s, uint32 ac) {
|
||||
inline void _md5_FF(quint32 &a, quint32 b, quint32 c, quint32 d, quint32 x, quint32 s, quint32 ac) {
|
||||
a = _md5_rotate_left(a + _md5_F(b, c, d) + x + ac, s) + b;
|
||||
}
|
||||
|
||||
inline void _md5_GG(uint32 &a, uint32 b, uint32 c, uint32 d, uint32 x, uint32 s, uint32 ac) {
|
||||
inline void _md5_GG(quint32 &a, quint32 b, quint32 c, quint32 d, quint32 x, quint32 s, quint32 ac) {
|
||||
a = _md5_rotate_left(a + _md5_G(b, c, d) + x + ac, s) + b;
|
||||
}
|
||||
|
||||
inline void _md5_HH(uint32 &a, uint32 b, uint32 c, uint32 d, uint32 x, uint32 s, uint32 ac) {
|
||||
inline void _md5_HH(quint32 &a, quint32 b, quint32 c, quint32 d, quint32 x, quint32 s, quint32 ac) {
|
||||
a = _md5_rotate_left(a + _md5_H(b, c, d) + x + ac, s) + b;
|
||||
}
|
||||
|
||||
inline void _md5_II(uint32 &a, uint32 b, uint32 c, uint32 d, uint32 x, uint32 s, uint32 ac) {
|
||||
inline void _md5_II(quint32 &a, quint32 b, quint32 c, quint32 d, quint32 x, quint32 s, quint32 ac) {
|
||||
a = _md5_rotate_left(a + _md5_I(b, c, d) + x + ac, s) + b;
|
||||
}
|
||||
|
||||
|
@ -498,13 +498,13 @@ namespace {
|
|||
};
|
||||
}
|
||||
|
||||
HashMd5::HashMd5(const void *input, uint32 length) : _finalized(false) {
|
||||
HashMd5::HashMd5(const void *input, quint32 length) : _finalized(false) {
|
||||
init();
|
||||
if (input && length > 0) feed(input, length);
|
||||
}
|
||||
|
||||
void HashMd5::feed(const void *input, uint32 length) {
|
||||
uint32 index = _count[0] / 8 % _md5_block_size;
|
||||
void HashMd5::feed(const void *input, quint32 length) {
|
||||
quint32 index = _count[0] / 8 % _md5_block_size;
|
||||
|
||||
const uchar *buf = (const uchar *)input;
|
||||
|
||||
|
@ -513,9 +513,9 @@ void HashMd5::feed(const void *input, uint32 length) {
|
|||
}
|
||||
_count[1] += (length >> 29);
|
||||
|
||||
uint32 firstpart = 64 - index;
|
||||
quint32 firstpart = 64 - index;
|
||||
|
||||
uint32 i;
|
||||
quint32 i;
|
||||
|
||||
if (length >= firstpart) {
|
||||
memcpy(&_buffer[index], buf, firstpart);
|
||||
|
@ -533,9 +533,9 @@ void HashMd5::feed(const void *input, uint32 length) {
|
|||
memcpy(&_buffer[index], &buf[i], length - i);
|
||||
}
|
||||
|
||||
int32 *HashMd5::result() {
|
||||
qint32 *HashMd5::result() {
|
||||
if (!_finalized) finalize();
|
||||
return (int32*)_digest;
|
||||
return (qint32*)_digest;
|
||||
}
|
||||
|
||||
void HashMd5::init() {
|
||||
|
@ -553,7 +553,7 @@ void HashMd5::finalize() {
|
|||
uchar bits[8];
|
||||
_md5_encode(bits, _count, 8);
|
||||
|
||||
uint32 index = _count[0] / 8 % 64, paddingLen = (index < 56) ? (56 - index) : (120 - index);
|
||||
quint32 index = _count[0] / 8 % 64, paddingLen = (index < 56) ? (56 - index) : (120 - index);
|
||||
feed(_md5_padding, paddingLen);
|
||||
feed(bits, 8);
|
||||
|
||||
|
@ -564,7 +564,7 @@ void HashMd5::finalize() {
|
|||
}
|
||||
|
||||
void HashMd5::transform(const uchar *block) {
|
||||
uint32 a = _state[0], b = _state[1], c = _state[2], d = _state[3], x[16];
|
||||
quint32 a = _state[0], b = _state[1], c = _state[2], d = _state[3], x[16];
|
||||
_md5_decode(x, block, _md5_block_size);
|
||||
|
||||
_md5_FF(a, b, c, d, x[0] , 7 , 0xd76aa478);
|
||||
|
@ -641,14 +641,14 @@ void HashMd5::transform(const uchar *block) {
|
|||
_state[3] += d;
|
||||
}
|
||||
|
||||
int32 *hashMd5(const void *data, uint32 len, void *dest) {
|
||||
qint32 *hashMd5(const void *data, quint32 len, void *dest) {
|
||||
HashMd5 md5(data, len);
|
||||
memcpy(dest, md5.result(), 16);
|
||||
|
||||
return (int32*)dest;
|
||||
return (qint32*)dest;
|
||||
}
|
||||
|
||||
char *hashMd5Hex(const int32 *hashmd5, void *dest) {
|
||||
char *hashMd5Hex(const qint32 *hashmd5, void *dest) {
|
||||
char *md5To = (char*)dest;
|
||||
const uchar *res = (const uchar*)hashmd5;
|
||||
|
||||
|
@ -661,7 +661,7 @@ char *hashMd5Hex(const int32 *hashmd5, void *dest) {
|
|||
return md5To;
|
||||
}
|
||||
|
||||
void memset_rand(void *data, uint32 len) {
|
||||
void memset_rand(void *data, quint32 len) {
|
||||
Assert(_sslInited);
|
||||
RAND_bytes((uchar*)data, len);
|
||||
}
|
||||
|
@ -669,11 +669,11 @@ void memset_rand(void *data, uint32 len) {
|
|||
namespace {
|
||||
QMap<QString, QString> fastRusEng;
|
||||
QHash<QChar, QString> fastLetterRusEng;
|
||||
QMap<uint32, QString> fastDoubleLetterRusEng;
|
||||
QMap<quint32, QString> fastDoubleLetterRusEng;
|
||||
QHash<QChar, QChar> fastRusKeyboardSwitch;
|
||||
}
|
||||
|
||||
QString translitLetterRusEng(QChar letter, QChar next, int32 &toSkip) {
|
||||
QString translitLetterRusEng(QChar letter, QChar next, qint32 &toSkip) {
|
||||
if (fastDoubleLetterRusEng.isEmpty()) {
|
||||
fastDoubleLetterRusEng.insert((QString::fromUtf8("Ы").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), qsl("Y"));
|
||||
fastDoubleLetterRusEng.insert((QString::fromUtf8("и").at(0).unicode() << 16) | QString::fromUtf8("я").at(0).unicode(), qsl("ia"));
|
||||
|
@ -682,7 +682,7 @@ QString translitLetterRusEng(QChar letter, QChar next, int32 &toSkip) {
|
|||
fastDoubleLetterRusEng.insert((QString::fromUtf8("ы").at(0).unicode() << 16) | QString::fromUtf8("й").at(0).unicode(), qsl("y"));
|
||||
fastDoubleLetterRusEng.insert((QString::fromUtf8("ь").at(0).unicode() << 16) | QString::fromUtf8("е").at(0).unicode(), qsl("ye"));
|
||||
}
|
||||
QMap<uint32, QString>::const_iterator i = fastDoubleLetterRusEng.constFind((letter.unicode() << 16) | next.unicode());
|
||||
QMap<quint32, QString>::const_iterator i = fastDoubleLetterRusEng.constFind((letter.unicode() << 16) | next.unicode());
|
||||
if (i != fastDoubleLetterRusEng.cend()) {
|
||||
toSkip = 2;
|
||||
return i.value();
|
||||
|
@ -795,7 +795,7 @@ QString translitRusEng(const QString &rus) {
|
|||
QString result;
|
||||
result.reserve(rus.size() * 2);
|
||||
|
||||
int32 toSkip = 0;
|
||||
qint32 toSkip = 0;
|
||||
for (QString::const_iterator i = rus.cbegin(), e = rus.cend(); i != e; i += toSkip) {
|
||||
result += translitLetterRusEng(*i, (i + 1 == e) ? ' ' : *(i + 1), toSkip);
|
||||
}
|
||||
|
|
|
@ -185,9 +185,9 @@ inline void InvokeQueued(QObject *context, Lambda &&lambda) {
|
|||
QObject::connect(&proxy, &QObject::destroyed, context, std::forward<Lambda>(lambda), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
static const int32 ScrollMax = INT_MAX;
|
||||
static const qint32 ScrollMax = INT_MAX;
|
||||
|
||||
extern uint64 _SharedMemoryLocation[];
|
||||
extern quint64 _SharedMemoryLocation[];
|
||||
template <typename T, unsigned int N>
|
||||
T *SharedMemoryLocation() {
|
||||
static_assert(N < 4, "Only 4 shared memory locations!");
|
||||
|
@ -253,17 +253,17 @@ private:
|
|||
};
|
||||
|
||||
class MTPint;
|
||||
using TimeId = int32;
|
||||
using TimeId = qint32;
|
||||
TimeId myunixtime();
|
||||
void unixtimeInit();
|
||||
void unixtimeSet(TimeId servertime, bool force = false);
|
||||
TimeId unixtime();
|
||||
TimeId fromServerTime(const MTPint &serverTime);
|
||||
void toServerTime(const TimeId &clientTime, MTPint &outServerTime);
|
||||
uint64 msgid();
|
||||
int32 reqid();
|
||||
quint64 msgid();
|
||||
qint32 reqid();
|
||||
|
||||
inline QDateTime date(int32 time = -1) {
|
||||
inline QDateTime date(qint32 time = -1) {
|
||||
QDateTime result;
|
||||
if (time >= 0) result.setTime_t(time);
|
||||
return result;
|
||||
|
@ -294,17 +294,17 @@ void finish();
|
|||
|
||||
}
|
||||
|
||||
using TimeMs = int64;
|
||||
using TimeMs = qint64;
|
||||
bool checkms(); // returns true if time has changed
|
||||
TimeMs getms(bool checked = false);
|
||||
|
||||
const static uint32 _md5_block_size = 64;
|
||||
const static quint32 _md5_block_size = 64;
|
||||
class HashMd5 {
|
||||
public:
|
||||
|
||||
HashMd5(const void *input = 0, uint32 length = 0);
|
||||
void feed(const void *input, uint32 length);
|
||||
int32 *result();
|
||||
HashMd5(const void *input = 0, quint32 length = 0);
|
||||
void feed(const void *input, quint32 length);
|
||||
qint32 *result();
|
||||
|
||||
private:
|
||||
|
||||
|
@ -314,37 +314,37 @@ private:
|
|||
|
||||
bool _finalized;
|
||||
uchar _buffer[_md5_block_size];
|
||||
uint32 _count[2];
|
||||
uint32 _state[4];
|
||||
quint32 _count[2];
|
||||
quint32 _state[4];
|
||||
uchar _digest[16];
|
||||
|
||||
};
|
||||
|
||||
int32 hashCrc32(const void *data, uint32 len);
|
||||
qint32 hashCrc32(const void *data, quint32 len);
|
||||
|
||||
int32 *hashSha1(const void *data, uint32 len, void *dest); // dest - ptr to 20 bytes, returns (int32*)dest
|
||||
qint32 *hashSha1(const void *data, quint32 len, void *dest); // dest - ptr to 20 bytes, returns (qint32*)dest
|
||||
inline std::array<char, 20> hashSha1(const void *data, int size) {
|
||||
auto result = std::array<char, 20>();
|
||||
hashSha1(data, size, result.data());
|
||||
return result;
|
||||
}
|
||||
|
||||
int32 *hashSha256(const void *data, uint32 len, void *dest); // dest - ptr to 32 bytes, returns (int32*)dest
|
||||
qint32 *hashSha256(const void *data, quint32 len, void *dest); // dest - ptr to 32 bytes, returns (qint32*)dest
|
||||
inline std::array<char, 32> hashSha256(const void *data, int size) {
|
||||
auto result = std::array<char, 32>();
|
||||
hashSha256(data, size, result.data());
|
||||
return result;
|
||||
}
|
||||
|
||||
int32 *hashMd5(const void *data, uint32 len, void *dest); // dest = ptr to 16 bytes, returns (int32*)dest
|
||||
qint32 *hashMd5(const void *data, quint32 len, void *dest); // dest = ptr to 16 bytes, returns (qint32*)dest
|
||||
inline std::array<char, 16> hashMd5(const void *data, int size) {
|
||||
auto result = std::array<char, 16>();
|
||||
hashMd5(data, size, result.data());
|
||||
return result;
|
||||
}
|
||||
|
||||
char *hashMd5Hex(const int32 *hashmd5, void *dest); // dest = ptr to 32 bytes, returns (char*)dest
|
||||
inline char *hashMd5Hex(const void *data, uint32 len, void *dest) { // dest = ptr to 32 bytes, returns (char*)dest
|
||||
char *hashMd5Hex(const qint32 *hashmd5, void *dest); // dest = ptr to 32 bytes, returns (char*)dest
|
||||
inline char *hashMd5Hex(const void *data, quint32 len, void *dest) { // dest = ptr to 32 bytes, returns (char*)dest
|
||||
return hashMd5Hex(HashMd5(data, len).result(), dest);
|
||||
}
|
||||
inline std::array<char, 32> hashMd5Hex(const void *data, int size) {
|
||||
|
@ -354,7 +354,7 @@ inline std::array<char, 32> hashMd5Hex(const void *data, int size) {
|
|||
}
|
||||
|
||||
// good random (using openssl implementation)
|
||||
void memset_rand(void *data, uint32 len);
|
||||
void memset_rand(void *data, quint32 len);
|
||||
template <typename T>
|
||||
T rand_value() {
|
||||
T result;
|
||||
|
@ -362,7 +362,7 @@ T rand_value() {
|
|||
return result;
|
||||
}
|
||||
|
||||
inline void memset_rand_bad(void *data, uint32 len) {
|
||||
inline void memset_rand_bad(void *data, quint32 len) {
|
||||
for (uchar *i = reinterpret_cast<uchar*>(data), *e = i + len; i != e; ++i) {
|
||||
*i = uchar(rand() & 0xFF);
|
||||
}
|
||||
|
@ -402,9 +402,9 @@ private:
|
|||
|
||||
};
|
||||
|
||||
inline QString fromUtf8Safe(const char *str, int32 size = -1) {
|
||||
inline QString fromUtf8Safe(const char *str, qint32 size = -1) {
|
||||
if (!str || !size) return QString();
|
||||
if (size < 0) size = int32(strlen(str));
|
||||
if (size < 0) size = qint32(strlen(str));
|
||||
QString result(QString::fromUtf8(str, size));
|
||||
QByteArray back = result.toUtf8();
|
||||
if (back.size() != size || memcmp(back.constData(), str, size)) return QString::fromLocal8Bit(str, size);
|
||||
|
@ -474,7 +474,7 @@ enum DBIConnectionType {
|
|||
|
||||
struct ProxyData {
|
||||
QString host;
|
||||
uint32 port = 0;
|
||||
quint32 port = 0;
|
||||
QString user, password;
|
||||
};
|
||||
|
||||
|
@ -508,10 +508,10 @@ enum DBIPeerReportSpamStatus {
|
|||
};
|
||||
|
||||
template <int Size>
|
||||
inline QString strMakeFromLetters(const uint32 (&letters)[Size]) {
|
||||
inline QString strMakeFromLetters(const quint32 (&letters)[Size]) {
|
||||
QString result;
|
||||
result.reserve(Size);
|
||||
for (int32 i = 0; i < Size; ++i) {
|
||||
for (qint32 i = 0; i < Size; ++i) {
|
||||
result.push_back(QChar((((letters[i] >> 16) & 0xFF) << 8) | (letters[i] & 0xFF)));
|
||||
}
|
||||
return result;
|
||||
|
@ -552,13 +552,13 @@ inline int rowscount(int fullCount, int countPerRow) {
|
|||
inline int floorclamp(int value, int step, int lowest, int highest) {
|
||||
return qMin(qMax(value / step, lowest), highest);
|
||||
}
|
||||
inline int floorclamp(float64 value, int step, int lowest, int highest) {
|
||||
inline int floorclamp(double value, int step, int lowest, int highest) {
|
||||
return qMin(qMax(static_cast<int>(std::floor(value / step)), lowest), highest);
|
||||
}
|
||||
inline int ceilclamp(int value, int step, int lowest, int highest) {
|
||||
return qMax(qMin((value + step - 1) / step, highest), lowest);
|
||||
}
|
||||
inline int ceilclamp(float64 value, int32 step, int32 lowest, int32 highest) {
|
||||
inline int ceilclamp(double value, qint32 step, qint32 lowest, qint32 highest) {
|
||||
return qMax(qMin(static_cast<int>(std::ceil(value / step)), highest), lowest);
|
||||
}
|
||||
|
||||
|
@ -580,10 +580,10 @@ enum ShowLayerOption {
|
|||
using ShowLayerOptions = base::flags<ShowLayerOption>;
|
||||
inline constexpr auto is_flag_type(ShowLayerOption) { return true; };
|
||||
|
||||
static int32 FullArcLength = 360 * 16;
|
||||
static int32 QuarterArcLength = (FullArcLength / 4);
|
||||
static int32 MinArcLength = (FullArcLength / 360);
|
||||
static int32 AlmostFullArcLength = (FullArcLength - MinArcLength);
|
||||
static qint32 FullArcLength = 360 * 16;
|
||||
static qint32 QuarterArcLength = (FullArcLength / 4);
|
||||
static qint32 MinArcLength = (FullArcLength / 360);
|
||||
static qint32 AlmostFullArcLength = (FullArcLength - MinArcLength);
|
||||
|
||||
template <typename T, typename... Args>
|
||||
inline QSharedPointer<T> MakeShared(Args&&... args) {
|
||||
|
|
|
@ -28,4 +28,4 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
|||
constexpr int AppVersion = 1001023;
|
||||
constexpr str_const AppVersionStr = "1.1.23-procxx";
|
||||
constexpr bool AppAlphaVersion = false;
|
||||
constexpr uint64_t AppBetaVersion = BETA_VERSION_MACRO;
|
||||
constexpr quint64 AppBetaVersion = BETA_VERSION_MACRO;
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
bool isEmpty() const { return all().isEmpty(); }
|
||||
bool contains(PeerId peerId) const { return all().contains(peerId); }
|
||||
Row *getRow(PeerId peerId) const { return all().getRow(peerId); }
|
||||
Row *rowAtY(int32 y, int32 h) const { return all().rowAtY(y, h); }
|
||||
Row *rowAtY(qint32 y, qint32 h) const { return all().rowAtY(y, h); }
|
||||
|
||||
using iterator = List::iterator;
|
||||
using const_iterator = List::const_iterator;
|
||||
|
|
|
@ -812,7 +812,7 @@ void DialogsInner::step_pinnedShifting(TimeMs ms, bool timer) {
|
|||
if (updateMin < 0) updateMin = i;
|
||||
updateMax = i;
|
||||
if (start + st::stickersRowDuration > ms && ms >= start) {
|
||||
_pinnedRows[i].yadd.update(float64(ms - start) / st::stickersRowDuration, anim::sineInOut);
|
||||
_pinnedRows[i].yadd.update(double(ms - start) / st::stickersRowDuration, anim::sineInOut);
|
||||
animating = true;
|
||||
} else {
|
||||
_pinnedRows[i].yadd.finish();
|
||||
|
@ -1074,7 +1074,7 @@ void DialogsInner::dlgUpdated(Dialogs::Mode list, Dialogs::Row *row) {
|
|||
}
|
||||
} else if (_state == FilteredState || _state == SearchedState) {
|
||||
if (list == Dialogs::Mode::All) {
|
||||
for (int32 i = 0, l = _filterResults.size(); i < l; ++i) {
|
||||
for (qint32 i = 0, l = _filterResults.size(); i < l; ++i) {
|
||||
if (_filterResults.at(i)->history() == row->history()) {
|
||||
update(0, filteredOffset() + i * st::dialogsRowHeight, getFullWidth(), st::dialogsRowHeight);
|
||||
break;
|
||||
|
@ -1163,7 +1163,7 @@ void DialogsInner::updateSelectedRow(PeerData *peer) {
|
|||
}
|
||||
} else if (_state == FilteredState || _state == SearchedState) {
|
||||
if (peer) {
|
||||
for (int32 i = 0, l = _filterResults.size(); i != l; ++i) {
|
||||
for (qint32 i = 0, l = _filterResults.size(); i != l; ++i) {
|
||||
if (_filterResults.at(i)->history()->peer == peer) {
|
||||
update(0, filteredOffset() + i * st::dialogsRowHeight, getFullWidth(), st::dialogsRowHeight);
|
||||
break;
|
||||
|
@ -1515,7 +1515,7 @@ void DialogsInner::addAllSavedPeers() {
|
|||
addSavedPeersAfter(QDateTime());
|
||||
}
|
||||
|
||||
bool DialogsInner::searchReceived(const QVector<MTPMessage> &messages, DialogsSearchRequestType type, int32 fullCount) {
|
||||
bool DialogsInner::searchReceived(const QVector<MTPMessage> &messages, DialogsSearchRequestType type, qint32 fullCount) {
|
||||
if (type == DialogsSearchFromStart || type == DialogsSearchPeerFromStart) {
|
||||
clearSearchResults(false);
|
||||
}
|
||||
|
@ -1669,7 +1669,7 @@ void DialogsInner::notify_historyMuteUpdated(History *history) {
|
|||
}
|
||||
|
||||
void DialogsInner::refresh(bool toTop) {
|
||||
int32 h = 0;
|
||||
qint32 h = 0;
|
||||
if (_state == DefaultState) {
|
||||
if (shownDialogs()->isEmpty()) {
|
||||
h = st::noContactsHeight;
|
||||
|
@ -1773,7 +1773,7 @@ void DialogsInner::clearFilter() {
|
|||
}
|
||||
}
|
||||
|
||||
void DialogsInner::selectSkip(int32 direction) {
|
||||
void DialogsInner::selectSkip(qint32 direction) {
|
||||
if (_state == DefaultState) {
|
||||
if (_importantSwitchSelected) {
|
||||
if (!shownDialogs()->isEmpty() && direction > 0) {
|
||||
|
@ -1824,7 +1824,7 @@ void DialogsInner::selectSkip(int32 direction) {
|
|||
_hashtagSelected = 0;
|
||||
}
|
||||
} else {
|
||||
int32 cur = (_hashtagSelected >= 0 && _hashtagSelected < _hashtagResults.size()) ? _hashtagSelected : ((_filteredSelected >= 0 && _filteredSelected < _filterResults.size()) ? (_hashtagResults.size() + _filteredSelected) : ((_peerSearchSelected >= 0 && _peerSearchSelected < _peerSearchResults.size()) ? (_peerSearchSelected + _filterResults.size() + _hashtagResults.size()) : (_searchedSelected + _peerSearchResults.size() + _filterResults.size() + _hashtagResults.size())));
|
||||
qint32 cur = (_hashtagSelected >= 0 && _hashtagSelected < _hashtagResults.size()) ? _hashtagSelected : ((_filteredSelected >= 0 && _filteredSelected < _filterResults.size()) ? (_hashtagResults.size() + _filteredSelected) : ((_peerSearchSelected >= 0 && _peerSearchSelected < _peerSearchResults.size()) ? (_peerSearchSelected + _filterResults.size() + _hashtagResults.size()) : (_searchedSelected + _peerSearchResults.size() + _filterResults.size() + _hashtagResults.size())));
|
||||
cur = snap(cur + direction, 0, static_cast<int>(_hashtagResults.size() + _filterResults.size() + _peerSearchResults.size() + _searchResults.size()) - 1);
|
||||
if (cur < _hashtagResults.size()) {
|
||||
_hashtagSelected = cur;
|
||||
|
@ -1854,14 +1854,14 @@ void DialogsInner::selectSkip(int32 direction) {
|
|||
}
|
||||
|
||||
void DialogsInner::scrollToPeer(const PeerId &peer, MsgId msgId) {
|
||||
int32 fromY = -1;
|
||||
qint32 fromY = -1;
|
||||
if (_state == DefaultState) {
|
||||
if (auto row = shownDialogs()->getRow(peer)) {
|
||||
fromY = dialogsOffset() + row->pos() * st::dialogsRowHeight;
|
||||
}
|
||||
} else if (_state == FilteredState || _state == SearchedState) {
|
||||
if (msgId) {
|
||||
for (int32 i = 0, c = _searchResults.size(); i < c; ++i) {
|
||||
for (qint32 i = 0, c = _searchResults.size(); i < c; ++i) {
|
||||
if (_searchResults[i]->item()->history()->peer->id == peer && _searchResults[i]->item()->id == msgId) {
|
||||
fromY = searchedOffset() + i * st::dialogsRowHeight;
|
||||
break;
|
||||
|
@ -1869,7 +1869,7 @@ void DialogsInner::scrollToPeer(const PeerId &peer, MsgId msgId) {
|
|||
}
|
||||
}
|
||||
if (fromY < 0) {
|
||||
for (int32 i = 0, c = _filterResults.size(); i < c; ++i) {
|
||||
for (qint32 i = 0, c = _filterResults.size(); i < c; ++i) {
|
||||
if (_filterResults[i]->history()->peer->id == peer) {
|
||||
fromY = filteredOffset() + (i * st::dialogsRowHeight);
|
||||
break;
|
||||
|
@ -1882,7 +1882,7 @@ void DialogsInner::scrollToPeer(const PeerId &peer, MsgId msgId) {
|
|||
}
|
||||
}
|
||||
|
||||
void DialogsInner::selectSkipPage(int32 pixels, int32 direction) {
|
||||
void DialogsInner::selectSkipPage(qint32 pixels, qint32 direction) {
|
||||
int toSkip = pixels / int(st::dialogsRowHeight);
|
||||
if (_state == DefaultState) {
|
||||
if (!_selected) {
|
||||
|
@ -1937,10 +1937,10 @@ void DialogsInner::loadPeerPhotos() {
|
|||
}
|
||||
yTo -= otherStart;
|
||||
} else if (_state == FilteredState || _state == SearchedState) {
|
||||
int32 from = (yFrom - filteredOffset()) / st::dialogsRowHeight;
|
||||
qint32 from = (yFrom - filteredOffset()) / st::dialogsRowHeight;
|
||||
if (from < 0) from = 0;
|
||||
if (from < _filterResults.size()) {
|
||||
int32 to = (yTo / int32(st::dialogsRowHeight)) + 1, w = width();
|
||||
qint32 to = (yTo / qint32(st::dialogsRowHeight)) + 1, w = width();
|
||||
if (to > _filterResults.size()) to = _filterResults.size();
|
||||
|
||||
for (; from < to; ++from) {
|
||||
|
@ -1948,20 +1948,20 @@ void DialogsInner::loadPeerPhotos() {
|
|||
}
|
||||
}
|
||||
|
||||
from = (yFrom > filteredOffset() + st::searchedBarHeight ? ((yFrom - filteredOffset() - st::searchedBarHeight) / int32(st::dialogsRowHeight)) : 0) - _filterResults.size();
|
||||
from = (yFrom > filteredOffset() + st::searchedBarHeight ? ((yFrom - filteredOffset() - st::searchedBarHeight) / qint32(st::dialogsRowHeight)) : 0) - _filterResults.size();
|
||||
if (from < 0) from = 0;
|
||||
if (from < _peerSearchResults.size()) {
|
||||
int32 to = (yTo > filteredOffset() + st::searchedBarHeight ? ((yTo - filteredOffset() - st::searchedBarHeight) / int32(st::dialogsRowHeight)) : 0) - _filterResults.size() + 1, w = width();
|
||||
qint32 to = (yTo > filteredOffset() + st::searchedBarHeight ? ((yTo - filteredOffset() - st::searchedBarHeight) / qint32(st::dialogsRowHeight)) : 0) - _filterResults.size() + 1, w = width();
|
||||
if (to > _peerSearchResults.size()) to = _peerSearchResults.size();
|
||||
|
||||
for (; from < to; ++from) {
|
||||
_peerSearchResults[from]->peer->loadUserpic();
|
||||
}
|
||||
}
|
||||
from = (yFrom > filteredOffset() + ((_peerSearchResults.empty() ? 0 : st::searchedBarHeight) + st::searchedBarHeight) ? ((yFrom - filteredOffset() - (_peerSearchResults.empty() ? 0 : st::searchedBarHeight) - st::searchedBarHeight) / int32(st::dialogsRowHeight)) : 0) - _filterResults.size() - _peerSearchResults.size();
|
||||
from = (yFrom > filteredOffset() + ((_peerSearchResults.empty() ? 0 : st::searchedBarHeight) + st::searchedBarHeight) ? ((yFrom - filteredOffset() - (_peerSearchResults.empty() ? 0 : st::searchedBarHeight) - st::searchedBarHeight) / qint32(st::dialogsRowHeight)) : 0) - _filterResults.size() - _peerSearchResults.size();
|
||||
if (from < 0) from = 0;
|
||||
if (from < _searchResults.size()) {
|
||||
int32 to = (yTo > filteredOffset() + (_peerSearchResults.empty() ? 0 : st::searchedBarHeight) + st::searchedBarHeight ? ((yTo - filteredOffset() - (_peerSearchResults.empty() ? 0 : st::searchedBarHeight) - st::searchedBarHeight) / int32(st::dialogsRowHeight)) : 0) - _filterResults.size() - _peerSearchResults.size() + 1, w = width();
|
||||
qint32 to = (yTo > filteredOffset() + (_peerSearchResults.empty() ? 0 : st::searchedBarHeight) + st::searchedBarHeight ? ((yTo - filteredOffset() - (_peerSearchResults.empty() ? 0 : st::searchedBarHeight) - st::searchedBarHeight) / qint32(st::dialogsRowHeight)) : 0) - _filterResults.size() - _peerSearchResults.size() + 1, w = width();
|
||||
if (to > _searchResults.size()) to = _searchResults.size();
|
||||
|
||||
for (; from < to; ++from) {
|
||||
|
@ -2043,7 +2043,7 @@ void DialogsInner::saveRecentHashtags(const QString &text) {
|
|||
auto found = false;
|
||||
QRegularExpressionMatch m;
|
||||
auto recent = cRecentSearchHashtags();
|
||||
for (int32 i = 0, next = 0; (m = TextUtilities::RegExpHashtag().match(text, i)).hasMatch(); i = next) {
|
||||
for (qint32 i = 0, next = 0; (m = TextUtilities::RegExpHashtag().match(text, i)).hasMatch(); i = next) {
|
||||
i = m.capturedStart();
|
||||
next = m.capturedEnd();
|
||||
if (m.hasMatch()) {
|
||||
|
@ -2233,7 +2233,7 @@ Dialogs::IndexedList *DialogsInner::contactsNoDialogsList() {
|
|||
return _contactsNoDialogs.get();
|
||||
}
|
||||
|
||||
int32 DialogsInner::lastSearchDate() const {
|
||||
qint32 DialogsInner::lastSearchDate() const {
|
||||
return _lastSearchDate;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,16 +48,16 @@ public:
|
|||
void dialogsReceived(const QVector<MTPDialog> &dialogs);
|
||||
void addSavedPeersAfter(const QDateTime &date);
|
||||
void addAllSavedPeers();
|
||||
bool searchReceived(const QVector<MTPMessage> &result, DialogsSearchRequestType type, int32 fullCount);
|
||||
bool searchReceived(const QVector<MTPMessage> &result, DialogsSearchRequestType type, qint32 fullCount);
|
||||
void peerSearchReceived(const QString &query, const QVector<MTPPeer> &result);
|
||||
void showMore(int32 pixels);
|
||||
void showMore(qint32 pixels);
|
||||
|
||||
void activate();
|
||||
|
||||
void contactsReceived(const QVector<MTPContact> &result);
|
||||
|
||||
void selectSkip(int32 direction);
|
||||
void selectSkipPage(int32 pixels, int32 direction);
|
||||
void selectSkip(qint32 direction);
|
||||
void selectSkipPage(qint32 pixels, qint32 direction);
|
||||
|
||||
void createDialog(History *history);
|
||||
void dlgUpdated(Dialogs::Mode list, Dialogs::Row *row);
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
Dialogs::IndexedList *contactsList();
|
||||
Dialogs::IndexedList *dialogsList();
|
||||
Dialogs::IndexedList *contactsNoDialogsList();
|
||||
int32 lastSearchDate() const;
|
||||
qint32 lastSearchDate() const;
|
||||
PeerData *lastSearchPeer() const;
|
||||
MsgId lastSearchId() const;
|
||||
MsgId lastSearchMigratedId() const;
|
||||
|
|
|
@ -50,7 +50,7 @@ void paintRowDate(Painter &p, const QDateTime &date, QRect &rectForName, bool ac
|
|||
} else {
|
||||
dt = lastDate.toString(qsl("d.MM.yy"));
|
||||
}
|
||||
int32 dtWidth = st::dialogsDateFont->width(dt);
|
||||
qint32 dtWidth = st::dialogsDateFont->width(dt);
|
||||
rectForName.setWidth(rectForName.width() - dtWidth - st::dialogsDateSkip);
|
||||
p.setFont(st::dialogsDateFont);
|
||||
p.setPen(active ? st::dialogsDateFgActive : (selected ? st::dialogsDateFgOver : st::dialogsDateFg));
|
||||
|
@ -419,7 +419,7 @@ void paintImportantSwitch(Painter &p, Mode current, int fullWidth, bool selected
|
|||
p.drawText(st::dialogsPadding.x(), textBaseline, text);
|
||||
|
||||
if (mutedHidden) {
|
||||
if (int32 unread = App::histories().unreadMutedCount()) {
|
||||
if (qint32 unread = App::histories().unreadMutedCount()) {
|
||||
int unreadRight = fullWidth - st::dialogsPadding.x();
|
||||
UnreadBadgeStyle st;
|
||||
st.muted = true;
|
||||
|
|
|
@ -34,10 +34,10 @@ List::List(SortMode sortMode)
|
|||
, _current(_last.get()) {
|
||||
}
|
||||
|
||||
void List::adjustCurrent(int32 y, int32 h) const {
|
||||
void List::adjustCurrent(qint32 y, qint32 h) const {
|
||||
if (isEmpty()) return;
|
||||
|
||||
int32 pos = (y > 0) ? (y / h) : 0;
|
||||
qint32 pos = (y > 0) ? (y / h) : 0;
|
||||
while (_current->_pos > pos && _current != _begin) {
|
||||
_current = _current->_prev;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
Row *getRow(PeerId peerId) const {
|
||||
return _rowByPeer.value(peerId);
|
||||
}
|
||||
Row *rowAtY(int32 y, int32 h) const {
|
||||
Row *rowAtY(qint32 y, qint32 h) const {
|
||||
auto i = cfind(y, h);
|
||||
if (i == cend() || (*i)->pos() != ((y > 0) ? (y / h) : 0)) {
|
||||
return nullptr;
|
||||
|
|
|
@ -76,7 +76,7 @@ void ChatSearchFromController::rebuildRows() {
|
|||
auto wasEmpty = !delegate()->peerListFullRowsCount();
|
||||
|
||||
auto now = unixtime();
|
||||
QMultiMap<int32, UserData*> ordered;
|
||||
QMultiMap<qint32, UserData*> ordered;
|
||||
if (_chat->noParticipantInfo()) {
|
||||
Auth().api().requestFullPeer(_chat);
|
||||
} else if (!_chat->participants.isEmpty()) {
|
||||
|
|
|
@ -462,7 +462,7 @@ void DialogsWidget::onDraggingScrollDelta(int delta) {
|
|||
}
|
||||
|
||||
void DialogsWidget::onDraggingScrollTimer() {
|
||||
auto delta = (_draggingScrollDelta > 0) ? qMin(_draggingScrollDelta * 3 / 20 + 1, int32(MaxScrollSpeed)) : qMax(_draggingScrollDelta * 3 / 20 - 1, -int32(MaxScrollSpeed));
|
||||
auto delta = (_draggingScrollDelta > 0) ? qMin(_draggingScrollDelta * 3 / 20 + 1, qint32(MaxScrollSpeed)) : qMax(_draggingScrollDelta * 3 / 20 - 1, -qint32(MaxScrollSpeed));
|
||||
_scroll->scrollToY(_scroll->scrollTop() + delta);
|
||||
}
|
||||
|
||||
|
@ -966,7 +966,7 @@ void DialogsWidget::updateControlsGeometry() {
|
|||
filterAreaTop += st::dialogsForwardHeight;
|
||||
}
|
||||
auto smallLayoutWidth = (st::dialogsPadding.x() + st::dialogsPhotoSize + st::dialogsPadding.x());
|
||||
auto smallLayoutRatio = (width() < st::dialogsWidthMin) ? (st::dialogsWidthMin - width()) / float64(st::dialogsWidthMin - smallLayoutWidth) : 0.;
|
||||
auto smallLayoutRatio = (width() < st::dialogsWidthMin) ? (st::dialogsWidthMin - width()) / double(st::dialogsWidthMin - smallLayoutWidth) : 0.;
|
||||
auto filterLeft = st::dialogsFilterPadding.x() + _mainMenuToggle->width() + st::dialogsFilterPadding.x();
|
||||
auto filterRight = (Global::LocalPasscode() ? (st::dialogsFilterPadding.x() + _lockUnlock->width()) : st::dialogsFilterSkip) + st::dialogsFilterPadding.x();
|
||||
auto filterWidth = qMax(width(), st::dialogsWidthMin) - filterLeft - filterRight;
|
||||
|
@ -1174,7 +1174,7 @@ void DialogsWidget::onCancelSearchInPeer() {
|
|||
}
|
||||
|
||||
void DialogsWidget::onDialogMoved(int movedFrom, int movedTo) {
|
||||
int32 st = _scroll->scrollTop();
|
||||
qint32 st = _scroll->scrollTop();
|
||||
if (st > movedTo && st < movedFrom) {
|
||||
_scroll->scrollToY(st + st::dialogsRowHeight);
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ private:
|
|||
QTimer _chooseByDragTimer;
|
||||
|
||||
bool _dialogsFull = false;
|
||||
int32 _dialogsOffsetDate = 0;
|
||||
qint32 _dialogsOffsetDate = 0;
|
||||
MsgId _dialogsOffsetId = 0;
|
||||
PeerData *_dialogsOffsetPeer = nullptr;
|
||||
mtpRequestId _dialogsRequestId = 0;
|
||||
|
|
|
@ -398,7 +398,7 @@ struct Data {
|
|||
} // namespace Sandbox
|
||||
|
||||
std::unique_ptr<Sandbox::internal::Data> SandboxData;
|
||||
uint64 SandboxUserTag = 0;
|
||||
quint64 SandboxUserTag = 0;
|
||||
|
||||
namespace Sandbox {
|
||||
|
||||
|
@ -461,12 +461,12 @@ void WorkingDirReady() {
|
|||
}
|
||||
}
|
||||
|
||||
srand((int32)time(NULL));
|
||||
srand((qint32)time(NULL));
|
||||
|
||||
SandboxUserTag = 0;
|
||||
QFile usertag(cWorkingDir() + qsl("tdata/usertag"));
|
||||
if (usertag.open(QIODevice::ReadOnly)) {
|
||||
if (usertag.read(reinterpret_cast<char*>(&SandboxUserTag), sizeof(uint64)) != sizeof(uint64)) {
|
||||
if (usertag.read(reinterpret_cast<char*>(&SandboxUserTag), sizeof(quint64)) != sizeof(quint64)) {
|
||||
SandboxUserTag = 0;
|
||||
}
|
||||
usertag.close();
|
||||
|
@ -477,7 +477,7 @@ void WorkingDirReady() {
|
|||
} while (!SandboxUserTag);
|
||||
|
||||
if (usertag.open(QIODevice::WriteOnly)) {
|
||||
usertag.write(reinterpret_cast<char*>(&SandboxUserTag), sizeof(uint64));
|
||||
usertag.write(reinterpret_cast<char*>(&SandboxUserTag), sizeof(quint64));
|
||||
usertag.close();
|
||||
}
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ void finish() {
|
|||
MainThreadTaskHandler.destroy();
|
||||
}
|
||||
|
||||
uint64 UserTag() {
|
||||
quint64 UserTag() {
|
||||
return SandboxUserTag;
|
||||
}
|
||||
|
||||
|
@ -538,38 +538,38 @@ struct Data {
|
|||
|
||||
bool ScreenIsLocked = false;
|
||||
|
||||
int32 DebugLoggingFlags = 0;
|
||||
qint32 DebugLoggingFlags = 0;
|
||||
|
||||
float64 RememberedSongVolume = kDefaultVolume;
|
||||
float64 SongVolume = kDefaultVolume;
|
||||
double RememberedSongVolume = kDefaultVolume;
|
||||
double SongVolume = kDefaultVolume;
|
||||
base::Observable<void> SongVolumeChanged;
|
||||
float64 VideoVolume = kDefaultVolume;
|
||||
double VideoVolume = kDefaultVolume;
|
||||
base::Observable<void> VideoVolumeChanged;
|
||||
|
||||
// config
|
||||
int32 ChatSizeMax = 200;
|
||||
int32 MegagroupSizeMax = 10000;
|
||||
int32 ForwardedCountMax = 100;
|
||||
int32 OnlineUpdatePeriod = 120000;
|
||||
int32 OfflineBlurTimeout = 5000;
|
||||
int32 OfflineIdleTimeout = 30000;
|
||||
int32 OnlineFocusTimeout = 1000;
|
||||
int32 OnlineCloudTimeout = 300000;
|
||||
int32 NotifyCloudDelay = 30000;
|
||||
int32 NotifyDefaultDelay = 1500;
|
||||
int32 ChatBigSize = 10;
|
||||
int32 PushChatPeriod = 60000;
|
||||
int32 PushChatLimit = 2;
|
||||
int32 SavedGifsLimit = 200;
|
||||
int32 EditTimeLimit = 172800;
|
||||
int32 StickersRecentLimit = 30;
|
||||
int32 StickersFavedLimit = 5;
|
||||
int32 PinnedDialogsCountMax = 5;
|
||||
qint32 ChatSizeMax = 200;
|
||||
qint32 MegagroupSizeMax = 10000;
|
||||
qint32 ForwardedCountMax = 100;
|
||||
qint32 OnlineUpdatePeriod = 120000;
|
||||
qint32 OfflineBlurTimeout = 5000;
|
||||
qint32 OfflineIdleTimeout = 30000;
|
||||
qint32 OnlineFocusTimeout = 1000;
|
||||
qint32 OnlineCloudTimeout = 300000;
|
||||
qint32 NotifyCloudDelay = 30000;
|
||||
qint32 NotifyDefaultDelay = 1500;
|
||||
qint32 ChatBigSize = 10;
|
||||
qint32 PushChatPeriod = 60000;
|
||||
qint32 PushChatLimit = 2;
|
||||
qint32 SavedGifsLimit = 200;
|
||||
qint32 EditTimeLimit = 172800;
|
||||
qint32 StickersRecentLimit = 30;
|
||||
qint32 StickersFavedLimit = 5;
|
||||
qint32 PinnedDialogsCountMax = 5;
|
||||
QString InternalLinksDomain = qsl("https://t.me/");
|
||||
int32 CallReceiveTimeoutMs = 20000;
|
||||
int32 CallRingTimeoutMs = 90000;
|
||||
int32 CallConnectTimeoutMs = 30000;
|
||||
int32 CallPacketTimeoutMs = 10000;
|
||||
qint32 CallReceiveTimeoutMs = 20000;
|
||||
qint32 CallRingTimeoutMs = 90000;
|
||||
qint32 CallConnectTimeoutMs = 30000;
|
||||
qint32 CallPacketTimeoutMs = 10000;
|
||||
bool PhoneCallsEnabled = true;
|
||||
base::Observable<void> PhoneCallsEnabledChanged;
|
||||
|
||||
|
@ -661,38 +661,38 @@ DefineVar(Global, bool, ModerateModeEnabled);
|
|||
|
||||
DefineVar(Global, bool, ScreenIsLocked);
|
||||
|
||||
DefineVar(Global, int32, DebugLoggingFlags);
|
||||
DefineVar(Global, qint32, DebugLoggingFlags);
|
||||
|
||||
DefineVar(Global, float64, RememberedSongVolume);
|
||||
DefineVar(Global, float64, SongVolume);
|
||||
DefineVar(Global, double, RememberedSongVolume);
|
||||
DefineVar(Global, double, SongVolume);
|
||||
DefineRefVar(Global, base::Observable<void>, SongVolumeChanged);
|
||||
DefineVar(Global, float64, VideoVolume);
|
||||
DefineVar(Global, double, VideoVolume);
|
||||
DefineRefVar(Global, base::Observable<void>, VideoVolumeChanged);
|
||||
|
||||
// config
|
||||
DefineVar(Global, int32, ChatSizeMax);
|
||||
DefineVar(Global, int32, MegagroupSizeMax);
|
||||
DefineVar(Global, int32, ForwardedCountMax);
|
||||
DefineVar(Global, int32, OnlineUpdatePeriod);
|
||||
DefineVar(Global, int32, OfflineBlurTimeout);
|
||||
DefineVar(Global, int32, OfflineIdleTimeout);
|
||||
DefineVar(Global, int32, OnlineFocusTimeout);
|
||||
DefineVar(Global, int32, OnlineCloudTimeout);
|
||||
DefineVar(Global, int32, NotifyCloudDelay);
|
||||
DefineVar(Global, int32, NotifyDefaultDelay);
|
||||
DefineVar(Global, int32, ChatBigSize);
|
||||
DefineVar(Global, int32, PushChatPeriod);
|
||||
DefineVar(Global, int32, PushChatLimit);
|
||||
DefineVar(Global, int32, SavedGifsLimit);
|
||||
DefineVar(Global, int32, EditTimeLimit);
|
||||
DefineVar(Global, int32, StickersRecentLimit);
|
||||
DefineVar(Global, int32, StickersFavedLimit);
|
||||
DefineVar(Global, int32, PinnedDialogsCountMax);
|
||||
DefineVar(Global, qint32, ChatSizeMax);
|
||||
DefineVar(Global, qint32, MegagroupSizeMax);
|
||||
DefineVar(Global, qint32, ForwardedCountMax);
|
||||
DefineVar(Global, qint32, OnlineUpdatePeriod);
|
||||
DefineVar(Global, qint32, OfflineBlurTimeout);
|
||||
DefineVar(Global, qint32, OfflineIdleTimeout);
|
||||
DefineVar(Global, qint32, OnlineFocusTimeout);
|
||||
DefineVar(Global, qint32, OnlineCloudTimeout);
|
||||
DefineVar(Global, qint32, NotifyCloudDelay);
|
||||
DefineVar(Global, qint32, NotifyDefaultDelay);
|
||||
DefineVar(Global, qint32, ChatBigSize);
|
||||
DefineVar(Global, qint32, PushChatPeriod);
|
||||
DefineVar(Global, qint32, PushChatLimit);
|
||||
DefineVar(Global, qint32, SavedGifsLimit);
|
||||
DefineVar(Global, qint32, EditTimeLimit);
|
||||
DefineVar(Global, qint32, StickersRecentLimit);
|
||||
DefineVar(Global, qint32, StickersFavedLimit);
|
||||
DefineVar(Global, qint32, PinnedDialogsCountMax);
|
||||
DefineVar(Global, QString, InternalLinksDomain);
|
||||
DefineVar(Global, int32, CallReceiveTimeoutMs);
|
||||
DefineVar(Global, int32, CallRingTimeoutMs);
|
||||
DefineVar(Global, int32, CallConnectTimeoutMs);
|
||||
DefineVar(Global, int32, CallPacketTimeoutMs);
|
||||
DefineVar(Global, qint32, CallReceiveTimeoutMs);
|
||||
DefineVar(Global, qint32, CallRingTimeoutMs);
|
||||
DefineVar(Global, qint32, CallConnectTimeoutMs);
|
||||
DefineVar(Global, qint32, CallPacketTimeoutMs);
|
||||
DefineVar(Global, bool, PhoneCallsEnabled);
|
||||
DefineRefVar(Global, base::Observable<void>, PhoneCallsEnabledChanged);
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ void start();
|
|||
bool started();
|
||||
void finish();
|
||||
|
||||
uint64 UserTag();
|
||||
quint64 UserTag();
|
||||
|
||||
DeclareVar(QByteArray, LastCrashDump);
|
||||
DeclareVar(ProxyData, PreLaunchProxy);
|
||||
|
@ -250,7 +250,7 @@ constexpr auto FeaturedSetId = 0xFFFFFFFFFFFFFFFBULL; // for emoji/stickers pane
|
|||
constexpr auto FavedSetId = 0xFFFFFFFFFFFFFFFAULL; // for cloud-stored faved stickers
|
||||
constexpr auto MegagroupSetId = 0xFFFFFFFFFFFFFFEFULL; // for setting up megagroup sticker set
|
||||
struct Set {
|
||||
Set(uint64 id, uint64 access, const QString &title, const QString &shortName, int32 count, int32 hash, MTPDstickerSet::Flags flags)
|
||||
Set(quint64 id, quint64 access, const QString &title, const QString &shortName, qint32 count, qint32 hash, MTPDstickerSet::Flags flags)
|
||||
: id(id)
|
||||
, access(access)
|
||||
, title(title)
|
||||
|
@ -259,15 +259,15 @@ struct Set {
|
|||
, hash(hash)
|
||||
, flags(flags) {
|
||||
}
|
||||
uint64 id, access;
|
||||
quint64 id, access;
|
||||
QString title, shortName;
|
||||
int32 count, hash;
|
||||
qint32 count, hash;
|
||||
MTPDstickerSet::Flags flags;
|
||||
StickerPack stickers;
|
||||
StickersByEmojiMap emoji;
|
||||
};
|
||||
using Sets = QMap<uint64, Set>;
|
||||
using Order = QList<uint64>;
|
||||
using Sets = QMap<quint64, Set>;
|
||||
using Order = QList<quint64>;
|
||||
|
||||
inline MTPInputStickerSet inputSetId(const Set &set) {
|
||||
if (set.id && set.access) {
|
||||
|
@ -300,40 +300,40 @@ DeclareVar(bool, ModerateModeEnabled);
|
|||
|
||||
DeclareVar(bool, ScreenIsLocked);
|
||||
|
||||
DeclareVar(int32, DebugLoggingFlags);
|
||||
DeclareVar(qint32, DebugLoggingFlags);
|
||||
|
||||
constexpr float64 kDefaultVolume = 0.9;
|
||||
constexpr double kDefaultVolume = 0.9;
|
||||
|
||||
DeclareVar(float64, RememberedSongVolume);
|
||||
DeclareVar(float64, SongVolume);
|
||||
DeclareVar(double, RememberedSongVolume);
|
||||
DeclareVar(double, SongVolume);
|
||||
DeclareRefVar(base::Observable<void>, SongVolumeChanged);
|
||||
DeclareVar(float64, VideoVolume);
|
||||
DeclareVar(double, VideoVolume);
|
||||
DeclareRefVar(base::Observable<void>, VideoVolumeChanged);
|
||||
|
||||
// config
|
||||
DeclareVar(int32, ChatSizeMax);
|
||||
DeclareVar(int32, MegagroupSizeMax);
|
||||
DeclareVar(int32, ForwardedCountMax);
|
||||
DeclareVar(int32, OnlineUpdatePeriod);
|
||||
DeclareVar(int32, OfflineBlurTimeout);
|
||||
DeclareVar(int32, OfflineIdleTimeout);
|
||||
DeclareVar(int32, OnlineFocusTimeout); // not from config
|
||||
DeclareVar(int32, OnlineCloudTimeout);
|
||||
DeclareVar(int32, NotifyCloudDelay);
|
||||
DeclareVar(int32, NotifyDefaultDelay);
|
||||
DeclareVar(int32, ChatBigSize);
|
||||
DeclareVar(int32, PushChatPeriod);
|
||||
DeclareVar(int32, PushChatLimit);
|
||||
DeclareVar(int32, SavedGifsLimit);
|
||||
DeclareVar(int32, EditTimeLimit);
|
||||
DeclareVar(int32, StickersRecentLimit);
|
||||
DeclareVar(int32, StickersFavedLimit);
|
||||
DeclareVar(int32, PinnedDialogsCountMax);
|
||||
DeclareVar(qint32, ChatSizeMax);
|
||||
DeclareVar(qint32, MegagroupSizeMax);
|
||||
DeclareVar(qint32, ForwardedCountMax);
|
||||
DeclareVar(qint32, OnlineUpdatePeriod);
|
||||
DeclareVar(qint32, OfflineBlurTimeout);
|
||||
DeclareVar(qint32, OfflineIdleTimeout);
|
||||
DeclareVar(qint32, OnlineFocusTimeout); // not from config
|
||||
DeclareVar(qint32, OnlineCloudTimeout);
|
||||
DeclareVar(qint32, NotifyCloudDelay);
|
||||
DeclareVar(qint32, NotifyDefaultDelay);
|
||||
DeclareVar(qint32, ChatBigSize);
|
||||
DeclareVar(qint32, PushChatPeriod);
|
||||
DeclareVar(qint32, PushChatLimit);
|
||||
DeclareVar(qint32, SavedGifsLimit);
|
||||
DeclareVar(qint32, EditTimeLimit);
|
||||
DeclareVar(qint32, StickersRecentLimit);
|
||||
DeclareVar(qint32, StickersFavedLimit);
|
||||
DeclareVar(qint32, PinnedDialogsCountMax);
|
||||
DeclareVar(QString, InternalLinksDomain);
|
||||
DeclareVar(int32, CallReceiveTimeoutMs);
|
||||
DeclareVar(int32, CallRingTimeoutMs);
|
||||
DeclareVar(int32, CallConnectTimeoutMs);
|
||||
DeclareVar(int32, CallPacketTimeoutMs);
|
||||
DeclareVar(qint32, CallReceiveTimeoutMs);
|
||||
DeclareVar(qint32, CallRingTimeoutMs);
|
||||
DeclareVar(qint32, CallConnectTimeoutMs);
|
||||
DeclareVar(qint32, CallPacketTimeoutMs);
|
||||
DeclareVar(bool, PhoneCallsEnabled);
|
||||
DeclareRefVar(base::Observable<void>, PhoneCallsEnabledChanged);
|
||||
|
||||
|
@ -354,7 +354,7 @@ DeclareRefVar(base::Observable<void>, FeaturedStickerSetsUnreadCountChanged);
|
|||
DeclareVar(TimeMs, LastFeaturedStickersUpdate);
|
||||
DeclareVar(Stickers::Order, ArchivedStickerSetsOrder);
|
||||
|
||||
typedef QMap<uint64, QPixmap> CircleMasksMap;
|
||||
typedef QMap<quint64, QPixmap> CircleMasksMap;
|
||||
DeclareRefVar(CircleMasksMap, CircleMasks);
|
||||
|
||||
DeclareRefVar(base::Observable<void>, SelfChanged);
|
||||
|
|
|
@ -56,7 +56,7 @@ constexpr auto kNewBlockEachMessage = 50;
|
|||
|
||||
auto GlobalPinnedIndex = 0;
|
||||
|
||||
HistoryItem *createUnsupportedMessage(History *history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, QDateTime date, int32 from) {
|
||||
HistoryItem *createUnsupportedMessage(History *history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, qint32 viaBotId, QDateTime date, qint32 from) {
|
||||
auto text = TextWithEntities { lng_message_unsupported(lt_link, qsl("https://desktop.telegram.org")) };
|
||||
TextUtilities::ParseEntities(text, _historyTextNoMonoOptions.flags);
|
||||
text.entities.push_front(EntityInText(EntityInTextItalic, 0, text.text.size()));
|
||||
|
@ -421,7 +421,7 @@ void ChannelHistory::getRangeDifference() {
|
|||
}
|
||||
}
|
||||
|
||||
void ChannelHistory::getRangeDifferenceNext(int32 pts) {
|
||||
void ChannelHistory::getRangeDifferenceNext(qint32 pts) {
|
||||
if (!App::main() || _rangeDifferenceToId < _rangeDifferenceFromId) return;
|
||||
|
||||
int limit = _rangeDifferenceToId + 1 - _rangeDifferenceFromId;
|
||||
|
@ -598,7 +598,7 @@ not_null<History*> Histories::findOrInsert(const PeerId &peerId) {
|
|||
return i.value();
|
||||
}
|
||||
|
||||
not_null<History*> Histories::findOrInsert(const PeerId &peerId, int32 unreadCount, int32 maxInboxRead, int32 maxOutboxRead) {
|
||||
not_null<History*> Histories::findOrInsert(const PeerId &peerId, qint32 unreadCount, qint32 maxInboxRead, qint32 maxOutboxRead) {
|
||||
auto i = map.constFind(peerId);
|
||||
if (i == map.cend()) {
|
||||
auto history = peerIsChannel(peerId) ? static_cast<History*>(new ChannelHistory(peerId)) : (new History(peerId));
|
||||
|
@ -1443,7 +1443,7 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice) {
|
|||
oldLoaded = true;
|
||||
} else if (loadedAtBottom()) { // add photos to overview and authors to lastAuthors
|
||||
bool channel = isChannel();
|
||||
int32 mask = 0;
|
||||
qint32 mask = 0;
|
||||
QList<not_null<UserData*>> *lastAuthors = nullptr;
|
||||
OrderedSet<not_null<PeerData*>> *markupSenders = nullptr;
|
||||
if (peer->isChat()) {
|
||||
|
@ -1585,7 +1585,7 @@ void History::checkAddAllToOverview() {
|
|||
return;
|
||||
}
|
||||
|
||||
int32 mask = 0;
|
||||
qint32 mask = 0;
|
||||
for_const (auto block, blocks) {
|
||||
for_const (auto item, block->items) {
|
||||
mask |= item->addToOverview(AddToOverviewBack);
|
||||
|
@ -1660,7 +1660,7 @@ MsgId History::inboxRead(HistoryItem *wasRead) {
|
|||
return inboxRead(wasRead ? wasRead->id : 0);
|
||||
}
|
||||
|
||||
MsgId History::outboxRead(int32 upTo) {
|
||||
MsgId History::outboxRead(qint32 upTo) {
|
||||
if (upTo < 0) return upTo;
|
||||
if (!upTo) upTo = msgIdForRead();
|
||||
accumulate_max(outboxReadBefore, upTo + 1);
|
||||
|
@ -1698,7 +1698,7 @@ void History::setUnreadCount(int newUnreadCount) {
|
|||
main->unreadCountChanged(this);
|
||||
}
|
||||
if (unreadBar) {
|
||||
int32 count = _unreadCount;
|
||||
qint32 count = _unreadCount;
|
||||
if (peer->migrateTo()) {
|
||||
if (History *h = App::historyLoaded(peer->migrateTo()->id)) {
|
||||
count += h->unreadCount();
|
||||
|
@ -1812,7 +1812,7 @@ void History::countScrollTopItem(int top) {
|
|||
}
|
||||
}
|
||||
|
||||
void History::getNextScrollTopItem(HistoryBlock *block, int32 i) {
|
||||
void History::getNextScrollTopItem(HistoryBlock *block, qint32 i) {
|
||||
++i;
|
||||
if (i > 0 && i < block->items.size()) {
|
||||
scrollTopItem = block->items[i];
|
||||
|
@ -1829,7 +1829,7 @@ void History::getNextScrollTopItem(HistoryBlock *block, int32 i) {
|
|||
void History::addUnreadBar() {
|
||||
if (unreadBar || !showFrom || showFrom->detached() || !unreadCount()) return;
|
||||
|
||||
int32 count = unreadCount();
|
||||
qint32 count = unreadCount();
|
||||
if (peer->migrateTo()) {
|
||||
if (History *h = App::historyLoaded(peer->migrateTo()->id)) {
|
||||
count += h->unreadCount();
|
||||
|
@ -1845,7 +1845,7 @@ void History::destroyUnreadBar() {
|
|||
}
|
||||
}
|
||||
|
||||
HistoryItem *History::addNewInTheMiddle(HistoryItem *newItem, int32 blockIndex, int32 itemIndex) {
|
||||
HistoryItem *History::addNewInTheMiddle(HistoryItem *newItem, qint32 blockIndex, qint32 itemIndex) {
|
||||
Expects(blockIndex >= 0);
|
||||
Expects(blockIndex < blocks.size());
|
||||
Expects(itemIndex >= 0);
|
||||
|
@ -1972,15 +1972,15 @@ void History::setNotLoadedAtBottom() {
|
|||
}
|
||||
|
||||
namespace {
|
||||
uint32 _dialogsPosToTopShift = 0x80000000UL;
|
||||
quint32 _dialogsPosToTopShift = 0x80000000UL;
|
||||
}
|
||||
|
||||
inline uint64 dialogPosFromDate(const QDateTime &date) {
|
||||
inline quint64 dialogPosFromDate(const QDateTime &date) {
|
||||
if (date.isNull()) return 0;
|
||||
return (uint64(date.toTime_t()) << 32) | (++_dialogsPosToTopShift);
|
||||
return (quint64(date.toTime_t()) << 32) | (++_dialogsPosToTopShift);
|
||||
}
|
||||
|
||||
inline uint64 pinnedDialogPos(int pinnedIndex) {
|
||||
inline quint64 pinnedDialogPos(int pinnedIndex) {
|
||||
return 0xFFFFFFFF00000000ULL + pinnedIndex;
|
||||
}
|
||||
|
||||
|
@ -2201,9 +2201,9 @@ void History::clearOnDestroy() {
|
|||
History::PositionInChatListChange History::adjustByPosInChatList(Dialogs::Mode list, Dialogs::IndexedList *indexed) {
|
||||
Assert(indexed != nullptr);
|
||||
Dialogs::Row *lnk = mainChatListLink(list);
|
||||
int32 movedFrom = lnk->pos();
|
||||
qint32 movedFrom = lnk->pos();
|
||||
indexed->adjustByPos(chatListLinks(list));
|
||||
int32 movedTo = lnk->pos();
|
||||
qint32 movedTo = lnk->pos();
|
||||
return { movedFrom, movedTo };
|
||||
}
|
||||
|
||||
|
@ -2277,7 +2277,7 @@ void History::setPinnedIndex(int pinnedIndex) {
|
|||
}
|
||||
}
|
||||
|
||||
void History::overviewSliceDone(int32 overviewIndex, const MTPmessages_Messages &result, bool onlyCounts) {
|
||||
void History::overviewSliceDone(qint32 overviewIndex, const MTPmessages_Messages &result, bool onlyCounts) {
|
||||
const QVector<MTPMessage> *v = 0;
|
||||
switch (result.type()) {
|
||||
case mtpc_messages_messages: {
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
|
||||
History *find(const PeerId &peerId);
|
||||
not_null<History*> findOrInsert(const PeerId &peerId);
|
||||
not_null<History*> findOrInsert(const PeerId &peerId, int32 unreadCount, int32 maxInboxRead, int32 maxOutboxRead);
|
||||
not_null<History*> findOrInsert(const PeerId &peerId, qint32 unreadCount, qint32 maxInboxRead, qint32 maxOutboxRead);
|
||||
|
||||
void clear();
|
||||
void remove(const PeerId &peer);
|
||||
|
@ -71,13 +71,13 @@ public:
|
|||
return _unreadMuted;
|
||||
}
|
||||
bool unreadOnlyMuted() const;
|
||||
void unreadIncrement(int32 count, bool muted) {
|
||||
void unreadIncrement(qint32 count, bool muted) {
|
||||
_unreadFull += count;
|
||||
if (muted) {
|
||||
_unreadMuted += count;
|
||||
}
|
||||
}
|
||||
void unreadMuteChanged(int32 count, bool muted) {
|
||||
void unreadMuteChanged(qint32 count, bool muted) {
|
||||
if (muted) {
|
||||
_unreadMuted += count;
|
||||
} else {
|
||||
|
@ -275,7 +275,7 @@ public:
|
|||
bool needUpdateInChatList() const;
|
||||
void updateChatListSortPosition();
|
||||
void setChatsListDate(const QDateTime &date);
|
||||
uint64 sortKeyInChatList() const {
|
||||
quint64 sortKeyInChatList() const {
|
||||
return _sortKeyInChatList;
|
||||
}
|
||||
struct PositionInChatListChange {
|
||||
|
@ -342,7 +342,7 @@ public:
|
|||
setHasPendingResizedItems();
|
||||
}
|
||||
|
||||
void paintDialog(Painter &p, int32 w, bool sel) const;
|
||||
void paintDialog(Painter &p, qint32 w, bool sel) const;
|
||||
bool updateSendActionNeedsAnimating(TimeMs ms, bool force = false);
|
||||
void unregSendAction(UserData *from);
|
||||
bool updateSendActionNeedsAnimating(UserData *user, const MTPSendMessageAction &action);
|
||||
|
@ -380,7 +380,7 @@ public:
|
|||
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int32 msgCount = 0;
|
||||
qint32 msgCount = 0;
|
||||
MsgId inboxReadBefore = 1;
|
||||
MsgId outboxReadBefore = 1;
|
||||
HistoryItem *showFrom = nullptr;
|
||||
|
@ -450,7 +450,7 @@ protected:
|
|||
// and scrollTopOffset remains the same
|
||||
// if we are at the bottom of the window scrollTopItem == nullptr and
|
||||
// scrollTopOffset is undefined
|
||||
void getNextScrollTopItem(HistoryBlock *block, int32 i);
|
||||
void getNextScrollTopItem(HistoryBlock *block, qint32 i);
|
||||
|
||||
// helper method for countScrollState(int top)
|
||||
void countScrollTopItem(int top);
|
||||
|
@ -467,13 +467,13 @@ public:
|
|||
mutable const HistoryItem *textCachedFor = nullptr; // cache
|
||||
mutable Text lastItemTextCache;
|
||||
|
||||
bool overviewCountLoaded(int32 overviewIndex) const {
|
||||
bool overviewCountLoaded(qint32 overviewIndex) const {
|
||||
return _overviewCountData[overviewIndex] >= 0;
|
||||
}
|
||||
bool overviewLoaded(int32 overviewIndex) const {
|
||||
bool overviewLoaded(qint32 overviewIndex) const {
|
||||
return overviewCount(overviewIndex) == _overview[overviewIndex].size();
|
||||
}
|
||||
int overviewCount(int32 overviewIndex, int32 defaultValue = -1) const {
|
||||
int overviewCount(qint32 overviewIndex, qint32 defaultValue = -1) const {
|
||||
auto result = _overviewCountData[overviewIndex];
|
||||
auto loaded = _overview[overviewIndex].size();
|
||||
if (result < 0) return defaultValue;
|
||||
|
@ -485,14 +485,14 @@ public:
|
|||
}
|
||||
return result;
|
||||
}
|
||||
const OrderedSet<MsgId> &overview(int32 overviewIndex) const {
|
||||
const OrderedSet<MsgId> &overview(qint32 overviewIndex) const {
|
||||
return _overview[overviewIndex];
|
||||
}
|
||||
MsgId overviewMinId(int32 overviewIndex) const {
|
||||
MsgId overviewMinId(qint32 overviewIndex) const {
|
||||
return _overview[overviewIndex].empty() ? 0 : *_overview[overviewIndex].begin();
|
||||
}
|
||||
void overviewSliceDone(int32 overviewIndex, const MTPmessages_Messages &result, bool onlyCounts = false);
|
||||
bool overviewHasMsgId(int32 overviewIndex, MsgId msgId) const {
|
||||
void overviewSliceDone(qint32 overviewIndex, const MTPmessages_Messages &result, bool onlyCounts = false);
|
||||
bool overviewHasMsgId(qint32 overviewIndex, MsgId msgId) const {
|
||||
return _overview[overviewIndex].contains(msgId);
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ protected:
|
|||
HistoryItem *createItemGame(MsgId id, MTPDmessage::Flags flags, UserId viaBotId, MsgId replyTo, QDateTime date, UserId from, const QString &postAuthor, GameData *game, const MTPReplyMarkup &markup);
|
||||
|
||||
HistoryItem *addNewItem(HistoryItem *adding, bool newMsg);
|
||||
HistoryItem *addNewInTheMiddle(HistoryItem *newItem, int32 blockIndex, int32 itemIndex);
|
||||
HistoryItem *addNewInTheMiddle(HistoryItem *newItem, qint32 blockIndex, qint32 itemIndex);
|
||||
|
||||
// All this methods add a new item to the first or last block
|
||||
// depending on if we are in isBuildingFronBlock() state.
|
||||
|
@ -571,10 +571,10 @@ private:
|
|||
Assert(it != chatListLinks(list).cend());
|
||||
return it.value();
|
||||
}
|
||||
uint64 _sortKeyInChatList = 0; // like ((unixtime) << 32) | (incremented counter)
|
||||
quint64 _sortKeyInChatList = 0; // like ((unixtime) << 32) | (incremented counter)
|
||||
|
||||
OrderedSet<MsgId> _overview[OverviewCount];
|
||||
int32 _overviewCountData[OverviewCount]; // -1 - not loaded, 0 - all loaded, > 0 - count, but not all loaded
|
||||
qint32 _overviewCountData[OverviewCount]; // -1 - not loaded, 0 - all loaded, > 0 - count, but not all loaded
|
||||
|
||||
// A pointer to the block that is currently being built.
|
||||
// We hold this pointer so we can destroy it while building
|
||||
|
@ -614,7 +614,7 @@ public:
|
|||
void messageDetached(HistoryItem *msg);
|
||||
|
||||
void getRangeDifference();
|
||||
void getRangeDifferenceNext(int32 pts);
|
||||
void getRangeDifferenceNext(qint32 pts);
|
||||
|
||||
HistoryJoined *insertJoinedMessage(bool unread);
|
||||
void checkJoinedMessage(bool createUnread = false);
|
||||
|
@ -636,7 +636,7 @@ private:
|
|||
HistoryJoined *_joinedMessage = nullptr;
|
||||
|
||||
MsgId _rangeDifferenceFromId, _rangeDifferenceToId;
|
||||
int32 _rangeDifferencePts;
|
||||
qint32 _rangeDifferencePts;
|
||||
mtpRequestId _rangeDifferenceRequestId;
|
||||
|
||||
};
|
||||
|
|
|
@ -1396,7 +1396,7 @@ void InnerWidget::performDrag() {
|
|||
// ) {
|
||||
// uponSelected = false;
|
||||
// } else {
|
||||
// uint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
// quint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
// if (dragState.symbol < selFrom || dragState.symbol >= selTo) {
|
||||
// uponSelected = false;
|
||||
// }
|
||||
|
|
|
@ -181,7 +181,7 @@ private:
|
|||
not_null<ChannelData*> _channel;
|
||||
not_null<History*> _history;
|
||||
std::vector<HistoryItemOwned> _items;
|
||||
std::map<uint64, HistoryItem*> _itemsByIds;
|
||||
std::map<quint64, HistoryItem*> _itemsByIds;
|
||||
int _itemsTop = 0;
|
||||
int _itemsHeight = 0;
|
||||
|
||||
|
@ -200,8 +200,8 @@ private:
|
|||
int _scrollDateLastItemTop = 0;
|
||||
|
||||
// Up - max, Down - min.
|
||||
uint64 _maxId = 0;
|
||||
uint64 _minId = 0;
|
||||
quint64 _maxId = 0;
|
||||
quint64 _minId = 0;
|
||||
mtpRequestId _preloadUpRequestId = 0;
|
||||
mtpRequestId _preloadDownRequestId = 0;
|
||||
|
||||
|
@ -217,7 +217,7 @@ private:
|
|||
QPoint _mousePosition;
|
||||
HistoryItem *_mouseActionItem = nullptr;
|
||||
HistoryCursorState _mouseCursorState = HistoryDefaultCursorState;
|
||||
uint16 _mouseTextSymbol = 0;
|
||||
quint16 _mouseTextSymbol = 0;
|
||||
bool _pressWasInactive = false;
|
||||
|
||||
HistoryItem *_selectedItem = nullptr;
|
||||
|
|
|
@ -43,7 +43,7 @@ TextWithEntities PrepareText(const QString &value, const QString &emptyValue) {
|
|||
return result;
|
||||
}
|
||||
|
||||
MTPMessage PrepareLogMessage(const MTPMessage &message, MsgId newId, int32 newDate) {
|
||||
MTPMessage PrepareLogMessage(const MTPMessage &message, MsgId newId, qint32 newDate) {
|
||||
switch (message.type()) {
|
||||
case mtpc_messageEmpty: return MTP_messageEmpty(MTP_int(newId));
|
||||
case mtpc_messageService: {
|
||||
|
@ -87,10 +87,10 @@ TextWithEntities ExtractEditedText(const MTPMessage &message) {
|
|||
return { text, entities };
|
||||
}
|
||||
|
||||
PhotoData *GenerateChatPhoto(ChannelId channelId, uint64 logEntryId, MTPint date, const MTPDchatPhoto &photo) {
|
||||
PhotoData *GenerateChatPhoto(ChannelId channelId, quint64 logEntryId, MTPint date, const MTPDchatPhoto &photo) {
|
||||
// We try to make a unique photoId that will stay the same for each pair (channelId, logEntryId).
|
||||
static const auto RandomIdPart = rand_value<uint64>();
|
||||
auto mixinIdPart = (static_cast<uint64>(static_cast<uint32>(channelId)) << 32) ^ logEntryId;
|
||||
static const auto RandomIdPart = rand_value<quint64>();
|
||||
auto mixinIdPart = (static_cast<quint64>(static_cast<quint32>(channelId)) << 32) ^ logEntryId;
|
||||
auto photoId = RandomIdPart ^ mixinIdPart;
|
||||
|
||||
auto photoSizes = QVector<MTPPhotoSize>();
|
||||
|
|
|
@ -161,7 +161,7 @@ public:
|
|||
return std::move(_adminsCanEdit);
|
||||
}
|
||||
|
||||
void setItems(std::vector<HistoryItemOwned> &&items, std::map<uint64, HistoryItem*> &&itemsByIds, bool upLoaded, bool downLoaded) {
|
||||
void setItems(std::vector<HistoryItemOwned> &&items, std::map<quint64, HistoryItem*> &&itemsByIds, bool upLoaded, bool downLoaded) {
|
||||
_items = std::move(items);
|
||||
_itemsByIds = std::move(itemsByIds);
|
||||
_upLoaded = upLoaded;
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
std::vector<HistoryItemOwned> takeItems() {
|
||||
return std::move(_items);
|
||||
}
|
||||
std::map<uint64, HistoryItem*> takeItemsByIds() {
|
||||
std::map<quint64, HistoryItem*> takeItemsByIds() {
|
||||
return std::move(_itemsByIds);
|
||||
}
|
||||
LocalIdManager takeIdManager() {
|
||||
|
@ -204,7 +204,7 @@ private:
|
|||
std::vector<not_null<UserData*>> _admins;
|
||||
std::vector<not_null<UserData*>> _adminsCanEdit;
|
||||
std::vector<HistoryItemOwned> _items;
|
||||
std::map<uint64, HistoryItem*> _itemsByIds;
|
||||
std::map<quint64, HistoryItem*> _itemsByIds;
|
||||
bool _upLoaded = false;
|
||||
bool _downLoaded = true;
|
||||
LocalIdManager _idManager;
|
||||
|
|
|
@ -149,7 +149,7 @@ void HistoryInner::messagesReceivedDown(PeerData *peer, const QVector<MTPMessage
|
|||
|
||||
void HistoryInner::repaintItem(const HistoryItem *item) {
|
||||
if (!item || item->detached() || !_history) return;
|
||||
int32 msgy = itemTop(item);
|
||||
qint32 msgy = itemTop(item);
|
||||
if (msgy >= 0) {
|
||||
update(0, msgy, width(), item->height());
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
|||
_widget->enqueueMessageHighlight(item);
|
||||
}
|
||||
|
||||
int32 h = item->height();
|
||||
qint32 h = item->height();
|
||||
p.translate(0, h);
|
||||
y += h;
|
||||
|
||||
|
@ -587,7 +587,7 @@ void HistoryInner::onTouchScrollTimer() {
|
|||
_touchScrollState = Ui::TouchScrollState::Manual;
|
||||
touchResetSpeed();
|
||||
} else if (_touchScrollState == Ui::TouchScrollState::Auto || _touchScrollState == Ui::TouchScrollState::Acceleration) {
|
||||
int32 elapsed = int32(nowTime - _touchTime);
|
||||
qint32 elapsed = qint32(nowTime - _touchTime);
|
||||
QPoint delta = _touchSpeed * elapsed / 1000;
|
||||
bool hasScrolled = _widget->touchScroll(delta);
|
||||
|
||||
|
@ -646,9 +646,9 @@ void HistoryInner::touchResetSpeed() {
|
|||
_touchPrevPosValid = false;
|
||||
}
|
||||
|
||||
void HistoryInner::touchDeaccelerate(int32 elapsed) {
|
||||
int32 x = _touchSpeed.x();
|
||||
int32 y = _touchSpeed.y();
|
||||
void HistoryInner::touchDeaccelerate(qint32 elapsed) {
|
||||
qint32 x = _touchSpeed.x();
|
||||
qint32 y = _touchSpeed.y();
|
||||
_touchSpeed.setX((x == 0) ? x : (x > 0) ? qMax(0, x - elapsed) : qMin(0, x + elapsed));
|
||||
_touchSpeed.setY((y == 0) ? y : (y > 0) ? qMax(0, y - elapsed) : qMin(0, y + elapsed));
|
||||
}
|
||||
|
@ -777,7 +777,7 @@ void HistoryInner::touchScrollUpdated(const QPoint &screenPos) {
|
|||
}
|
||||
|
||||
QPoint HistoryInner::mapPointToItem(QPoint p, HistoryItem *item) {
|
||||
int32 msgy = itemTop(item);
|
||||
qint32 msgy = itemTop(item);
|
||||
if (msgy < 0) return QPoint(0, 0);
|
||||
|
||||
p.setY(p.y() - msgy);
|
||||
|
@ -857,7 +857,7 @@ void HistoryInner::mouseActionStart(const QPoint &screenPos, Qt::MouseButton but
|
|||
) {
|
||||
uponSelected = false;
|
||||
} else {
|
||||
uint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
quint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
if (_mouseTextSymbol < selFrom || _mouseTextSymbol >= selTo) {
|
||||
uponSelected = false;
|
||||
}
|
||||
|
@ -925,7 +925,7 @@ void HistoryInner::performDrag() {
|
|||
) {
|
||||
uponSelected = false;
|
||||
} else {
|
||||
uint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
quint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
if (dragState.symbol < selFrom || dragState.symbol >= selTo) {
|
||||
uponSelected = false;
|
||||
}
|
||||
|
@ -1168,7 +1168,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
isUponSelected = -2;
|
||||
}
|
||||
} else {
|
||||
uint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
quint16 selFrom = _selected.cbegin().value().from, selTo = _selected.cbegin().value().to;
|
||||
hasSelected = (selTo > selFrom) ? 1 : 0;
|
||||
if (App::mousedItem() && App::mousedItem() == App::hoveredItem()) {
|
||||
auto mousePos = mapPointToItem(mapFromGlobal(_mousePosition), App::mousedItem());
|
||||
|
@ -1609,22 +1609,22 @@ void HistoryInner::recountHeight() {
|
|||
|
||||
updateBotInfo(false);
|
||||
if (_botAbout && !_botAbout->info->text.isEmpty()) {
|
||||
int32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right();
|
||||
qint32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right();
|
||||
if (tw > st::msgMaxWidth) tw = st::msgMaxWidth;
|
||||
tw -= st::msgPadding.left() + st::msgPadding.right();
|
||||
int32 mw = qMax(_botAbout->info->text.maxWidth(), st::msgNameFont->width(lang(lng_bot_description)));
|
||||
qint32 mw = qMax(_botAbout->info->text.maxWidth(), st::msgNameFont->width(lang(lng_bot_description)));
|
||||
if (tw > mw) tw = mw;
|
||||
|
||||
_botAbout->width = tw;
|
||||
_botAbout->height = _botAbout->info->text.countHeight(_botAbout->width);
|
||||
|
||||
int32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
|
||||
int32 descMaxWidth = _scroll->width();
|
||||
qint32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
|
||||
qint32 descMaxWidth = _scroll->width();
|
||||
if (Adaptive::ChatWide()) {
|
||||
descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||
descMaxWidth = qMin(descMaxWidth, qint32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||
}
|
||||
int32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
|
||||
int32 descAtY = qMin(_historyPaddingTop - descH, qMax(0, (_scroll->height() - descH) / 2)) + st::msgMargin.top();
|
||||
qint32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
|
||||
qint32 descAtY = qMin(_historyPaddingTop - descH, qMax(0, (_scroll->height() - descH) / 2)) + st::msgMargin.top();
|
||||
|
||||
_botAbout->rect = QRect(descAtX, descAtY, _botAbout->width + st::msgPadding.left() + st::msgPadding.right(), descH - st::msgMargin.top() - st::msgMargin.bottom());
|
||||
} else if (_botAbout) {
|
||||
|
@ -1653,10 +1653,10 @@ void HistoryInner::updateBotInfo(bool recount) {
|
|||
if (_botAbout->info->text.isEmpty()) {
|
||||
_botAbout->info->text.setText(st::messageTextStyle, _botAbout->info->description, _historyBotNoMonoOptions);
|
||||
if (recount) {
|
||||
int32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right();
|
||||
qint32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right();
|
||||
if (tw > st::msgMaxWidth) tw = st::msgMaxWidth;
|
||||
tw -= st::msgPadding.left() + st::msgPadding.right();
|
||||
int32 mw = qMax(_botAbout->info->text.maxWidth(), st::msgNameFont->width(lang(lng_bot_description)));
|
||||
qint32 mw = qMax(_botAbout->info->text.maxWidth(), st::msgNameFont->width(lang(lng_bot_description)));
|
||||
if (tw > mw) tw = mw;
|
||||
|
||||
_botAbout->width = tw;
|
||||
|
@ -1672,9 +1672,9 @@ void HistoryInner::updateBotInfo(bool recount) {
|
|||
updateSize();
|
||||
}
|
||||
if (_botAbout->height > 0) {
|
||||
int32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
|
||||
int32 descAtX = (_scroll->width() - _botAbout->width) / 2 - st::msgPadding.left();
|
||||
int32 descAtY = qMin(_historyPaddingTop - descH, (_scroll->height() - descH) / 2) + st::msgMargin.top();
|
||||
qint32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
|
||||
qint32 descAtX = (_scroll->width() - _botAbout->width) / 2 - st::msgPadding.left();
|
||||
qint32 descAtY = qMin(_historyPaddingTop - descH, (_scroll->height() - descH) / 2) + st::msgMargin.top();
|
||||
|
||||
_botAbout->rect = QRect(descAtX, descAtY, _botAbout->width + st::msgPadding.left() + st::msgPadding.right(), descH - st::msgMargin.top() - st::msgMargin.bottom());
|
||||
} else {
|
||||
|
@ -1802,13 +1802,13 @@ void HistoryInner::updateSize() {
|
|||
}
|
||||
|
||||
if (_botAbout && _botAbout->height > 0) {
|
||||
int32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
|
||||
int32 descMaxWidth = _scroll->width();
|
||||
qint32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
|
||||
qint32 descMaxWidth = _scroll->width();
|
||||
if (Adaptive::ChatWide()) {
|
||||
descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||
descMaxWidth = qMin(descMaxWidth, qint32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||
}
|
||||
int32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
|
||||
int32 descAtY = qMin(newHistoryPaddingTop - descH, qMax(0, (_scroll->height() - descH) / 2)) + st::msgMargin.top();
|
||||
qint32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
|
||||
qint32 descAtY = qMin(newHistoryPaddingTop - descH, qMax(0, (_scroll->height() - descH) / 2)) + st::msgMargin.top();
|
||||
|
||||
_botAbout->rect = QRect(descAtX, descAtY, _botAbout->width + st::msgPadding.left() + st::msgPadding.right(), descH - st::msgMargin.top() - st::msgMargin.bottom());
|
||||
}
|
||||
|
@ -1858,8 +1858,8 @@ bool HistoryInner::focusNextPrevChild(bool next) {
|
|||
}
|
||||
}
|
||||
|
||||
void HistoryInner::adjustCurrent(int32 y) const {
|
||||
int32 htop = historyTop(), hdrawtop = historyDrawTop(), mtop = migratedTop();
|
||||
void HistoryInner::adjustCurrent(qint32 y) const {
|
||||
qint32 htop = historyTop(), hdrawtop = historyDrawTop(), mtop = migratedTop();
|
||||
_curHistory = 0;
|
||||
if (mtop >= 0) {
|
||||
adjustCurrent(y - mtop, _migrated);
|
||||
|
@ -1869,7 +1869,7 @@ void HistoryInner::adjustCurrent(int32 y) const {
|
|||
}
|
||||
}
|
||||
|
||||
void HistoryInner::adjustCurrent(int32 y, History *history) const {
|
||||
void HistoryInner::adjustCurrent(qint32 y, History *history) const {
|
||||
Assert(!history->isEmpty());
|
||||
_curHistory = history;
|
||||
if (_curBlock >= history->blocks.size()) {
|
||||
|
@ -2082,7 +2082,7 @@ void HistoryInner::onUpdateSelected() {
|
|||
auto dateLeft = st::msgServiceMargin.left();
|
||||
auto maxwidth = item->history()->width;
|
||||
if (Adaptive::ChatWide()) {
|
||||
maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||
maxwidth = qMin(maxwidth, qint32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||
}
|
||||
auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();
|
||||
|
||||
|
@ -2155,7 +2155,7 @@ void HistoryInner::onUpdateSelected() {
|
|||
if (_mouseAction == MouseAction::Selecting) {
|
||||
auto canSelectMany = (_history != nullptr);
|
||||
if (selectingText) {
|
||||
uint16 second = dragState.symbol;
|
||||
quint16 second = dragState.symbol;
|
||||
if (dragState.afterSymbol && _mouseSelectType == TextSelectType::Letters) {
|
||||
++second;
|
||||
}
|
||||
|
@ -2246,7 +2246,7 @@ void HistoryInner::updateDragSelection(HistoryItem *dragSelFrom, HistoryItem *dr
|
|||
if (_dragSelFrom != dragSelFrom || _dragSelTo != dragSelTo || _dragSelecting != dragSelecting) {
|
||||
_dragSelFrom = dragSelFrom;
|
||||
_dragSelTo = dragSelTo;
|
||||
int32 fromy = itemTop(_dragSelFrom), toy = itemTop(_dragSelTo);
|
||||
qint32 fromy = itemTop(_dragSelFrom), toy = itemTop(_dragSelTo);
|
||||
if (fromy >= 0 && toy >= 0 && fromy > toy) {
|
||||
qSwap(_dragSelFrom, _dragSelTo);
|
||||
}
|
||||
|
@ -2350,11 +2350,11 @@ void HistoryInner::applyDragSelection() {
|
|||
applyDragSelection(&_selected);
|
||||
}
|
||||
|
||||
void HistoryInner::addSelectionRange(SelectedItems *toItems, int32 fromblock, int32 fromitem, int32 toblock, int32 toitem, History *h) const {
|
||||
void HistoryInner::addSelectionRange(SelectedItems *toItems, qint32 fromblock, qint32 fromitem, qint32 toblock, qint32 toitem, History *h) const {
|
||||
if (fromblock >= 0 && fromitem >= 0 && toblock >= 0 && toitem >= 0) {
|
||||
for (; fromblock <= toblock; ++fromblock) {
|
||||
HistoryBlock *block = h->blocks[fromblock];
|
||||
for (int32 cnt = (fromblock < toblock) ? block->items.size() : (toitem + 1); fromitem < cnt; ++fromitem) {
|
||||
for (qint32 cnt = (fromblock < toblock) ? block->items.size() : (toitem + 1); fromitem < cnt; ++fromitem) {
|
||||
HistoryItem *item = block->items[fromitem];
|
||||
SelectedItems::iterator i = toItems->find(item);
|
||||
if (item->id > 0 && !item->serviceMsg()) {
|
||||
|
@ -2377,7 +2377,7 @@ void HistoryInner::addSelectionRange(SelectedItems *toItems, int32 fromblock, in
|
|||
}
|
||||
|
||||
void HistoryInner::applyDragSelection(SelectedItems *toItems) const {
|
||||
int32 selfromy = itemTop(_dragSelFrom), seltoy = itemTop(_dragSelTo);
|
||||
qint32 selfromy = itemTop(_dragSelFrom), seltoy = itemTop(_dragSelTo);
|
||||
if (selfromy < 0 || seltoy < 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -2387,8 +2387,8 @@ void HistoryInner::applyDragSelection(SelectedItems *toItems) const {
|
|||
toItems->clear();
|
||||
}
|
||||
if (_dragSelecting) {
|
||||
int32 fromblock = _dragSelFrom->block()->indexInHistory(), fromitem = _dragSelFrom->indexInBlock();
|
||||
int32 toblock = _dragSelTo->block()->indexInHistory(), toitem = _dragSelTo->indexInBlock();
|
||||
qint32 fromblock = _dragSelFrom->block()->indexInHistory(), fromitem = _dragSelFrom->indexInBlock();
|
||||
qint32 toblock = _dragSelTo->block()->indexInHistory(), toitem = _dragSelTo->indexInBlock();
|
||||
if (_migrated) {
|
||||
if (_dragSelFrom->history() == _migrated) {
|
||||
if (_dragSelTo->history() == _migrated) {
|
||||
|
@ -2408,7 +2408,7 @@ void HistoryInner::applyDragSelection(SelectedItems *toItems) const {
|
|||
addSelectionRange(toItems, fromblock, fromitem, toblock, toitem, _history);
|
||||
} else {
|
||||
for (SelectedItems::iterator i = toItems->begin(); i != toItems->cend();) {
|
||||
int32 iy = itemTop(i.key());
|
||||
qint32 iy = itemTop(i.key());
|
||||
if (iy < 0) {
|
||||
if (iy < -1) i = toItems->erase(i);
|
||||
continue;
|
||||
|
|
|
@ -150,10 +150,10 @@ private:
|
|||
|
||||
void touchResetSpeed();
|
||||
void touchUpdateSpeed();
|
||||
void touchDeaccelerate(int32 elapsed);
|
||||
void touchDeaccelerate(qint32 elapsed);
|
||||
|
||||
void adjustCurrent(int32 y) const;
|
||||
void adjustCurrent(int32 y, History *history) const;
|
||||
void adjustCurrent(qint32 y) const;
|
||||
void adjustCurrent(qint32 y, History *history) const;
|
||||
HistoryItem *prevItem(HistoryItem *item);
|
||||
HistoryItem *nextItem(HistoryItem *item);
|
||||
void updateDragSelection(HistoryItem *dragSelFrom, HistoryItem *dragSelTo, bool dragSelecting, bool force = false);
|
||||
|
@ -210,7 +210,7 @@ private:
|
|||
SelectedItems _selected;
|
||||
void applyDragSelection();
|
||||
void applyDragSelection(SelectedItems *toItems) const;
|
||||
void addSelectionRange(SelectedItems *toItems, int32 fromblock, int32 fromitem, int32 toblock, int32 toitem, History *h) const;
|
||||
void addSelectionRange(SelectedItems *toItems, qint32 fromblock, qint32 fromitem, qint32 toblock, qint32 toitem, History *h) const;
|
||||
|
||||
// Does any of the shown histories has this flag set.
|
||||
bool hasPendingResizedItems() const {
|
||||
|
@ -223,7 +223,7 @@ private:
|
|||
QPoint _mousePosition;
|
||||
HistoryItem *_mouseActionItem = nullptr;
|
||||
HistoryCursorState _mouseCursorState = HistoryDefaultCursorState;
|
||||
uint16 _mouseTextSymbol = 0;
|
||||
quint16 _mouseTextSymbol = 0;
|
||||
bool _pressWasInactive = false;
|
||||
|
||||
QPoint _trippleClickPoint;
|
||||
|
|
|
@ -137,7 +137,7 @@ void ReplyKeyboard::resize(int width, int height) {
|
|||
_width = width;
|
||||
|
||||
auto markup = _item->Get<HistoryMessageReplyMarkup>();
|
||||
float64 y = 0, buttonHeight = _rows.isEmpty() ? _st->buttonHeight() : (float64(height + _st->buttonSkip()) / _rows.size());
|
||||
double y = 0, buttonHeight = _rows.isEmpty() ? _st->buttonHeight() : (double(height + _st->buttonSkip()) / _rows.size());
|
||||
for (auto &row : _rows) {
|
||||
int s = row.size();
|
||||
|
||||
|
@ -154,20 +154,20 @@ void ReplyKeyboard::resize(int width, int height) {
|
|||
bool exact = (widthForText == widthOfText);
|
||||
bool enough = (widthForButtons - s * maxMinButtonWidth) >= widthOfText;
|
||||
|
||||
float64 x = 0;
|
||||
double x = 0;
|
||||
for (Button &button : row) {
|
||||
int buttonw = qMax(button.text.maxWidth(), 1);
|
||||
float64 textw = buttonw, minw = _st->minButtonWidth(button.type);
|
||||
float64 w = textw;
|
||||
double textw = buttonw, minw = _st->minButtonWidth(button.type);
|
||||
double w = textw;
|
||||
if (exact) {
|
||||
w += minw;
|
||||
} else if (enough) {
|
||||
w = (widthForButtons / float64(s));
|
||||
w = (widthForButtons / double(s));
|
||||
textw = w - minw;
|
||||
} else {
|
||||
textw = (widthForText / float64(s));
|
||||
textw = (widthForText / double(s));
|
||||
w = minw + textw;
|
||||
accumulate_max(w, 2 * float64(_st->buttonPadding()));
|
||||
accumulate_max(w, 2 * double(_st->buttonPadding()));
|
||||
}
|
||||
|
||||
int rectx = static_cast<int>(std::floor(x));
|
||||
|
@ -328,7 +328,7 @@ void ReplyKeyboard::startAnimation(int i, int j, int direction) {
|
|||
void ReplyKeyboard::step_selected(TimeMs ms, bool timer) {
|
||||
for (Animations::iterator i = _animations.begin(); i != _animations.end();) {
|
||||
int index = qAbs(i.key()) - 1, row = (index / MatrixRowShift), col = index % MatrixRowShift;
|
||||
float64 dt = float64(ms - i.value()) / st::botKbDuration;
|
||||
double dt = double(ms - i.value()) / st::botKbDuration;
|
||||
if (dt >= 1) {
|
||||
_rows[row][col].howMuchOver = (i.key() > 0) ? 1 : 0;
|
||||
i = _animations.erase(i);
|
||||
|
@ -525,7 +525,7 @@ void HistoryMessageUnreadBar::paint(Painter &p, int y, int w) const {
|
|||
int left = st::msgServiceMargin.left();
|
||||
int maxwidth = w;
|
||||
if (Adaptive::ChatWide()) {
|
||||
maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||
maxwidth = qMin(maxwidth, qint32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
|
||||
}
|
||||
w = maxwidth;
|
||||
|
||||
|
@ -586,14 +586,14 @@ HistoryMediaPtr::~HistoryMediaPtr() {
|
|||
|
||||
namespace internal {
|
||||
|
||||
TextSelection unshiftSelection(TextSelection selection, uint16 byLength) {
|
||||
TextSelection unshiftSelection(TextSelection selection, quint16 byLength) {
|
||||
if (selection == FullSelection) {
|
||||
return selection;
|
||||
}
|
||||
return ::unshiftSelection(selection, byLength);
|
||||
}
|
||||
|
||||
TextSelection shiftSelection(TextSelection selection, uint16 byLength) {
|
||||
TextSelection shiftSelection(TextSelection selection, quint16 byLength) {
|
||||
if (selection == FullSelection) {
|
||||
return selection;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ struct HistoryTextState {
|
|||
HistoryCursorState cursor = HistoryDefaultCursorState;
|
||||
ClickHandlerPtr link;
|
||||
bool afterSymbol = false;
|
||||
uint16 symbol = 0;
|
||||
quint16 symbol = 0;
|
||||
};
|
||||
|
||||
struct HistoryStateRequest {
|
||||
|
@ -103,8 +103,8 @@ enum InfoDisplayType {
|
|||
};
|
||||
|
||||
struct HistoryMessageVia : public RuntimeComponent<HistoryMessageVia> {
|
||||
void create(int32 userId);
|
||||
void resize(int32 availw) const;
|
||||
void create(qint32 userId);
|
||||
void resize(qint32 availw) const;
|
||||
|
||||
UserData *_bot = nullptr;
|
||||
mutable QString _text;
|
||||
|
@ -309,7 +309,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
virtual void paintButtonBg(Painter &p, const QRect &rect, float64 howMuchOver) const = 0;
|
||||
virtual void paintButtonBg(Painter &p, const QRect &rect, double howMuchOver) const = 0;
|
||||
virtual void paintButtonIcon(Painter &p, const QRect &rect, int outerWidth, HistoryMessageReplyMarkup::Button::Type type) const = 0;
|
||||
virtual void paintButtonLoading(Painter &p, const QRect &rect) const = 0;
|
||||
virtual int minButtonWidth(HistoryMessageReplyMarkup::Button::Type type) const = 0;
|
||||
|
@ -353,7 +353,7 @@ private:
|
|||
Text text = { 1 };
|
||||
QRect rect;
|
||||
int characters = 0;
|
||||
float64 howMuchOver = 0.;
|
||||
double howMuchOver = 0.;
|
||||
HistoryMessageReplyMarkup::Button::Type type;
|
||||
ReplyMarkupClickHandlerPtr link;
|
||||
mutable QSharedPointer<Ui::RippleAnimation> ripple;
|
||||
|
@ -471,8 +471,8 @@ private:
|
|||
|
||||
namespace internal {
|
||||
|
||||
TextSelection unshiftSelection(TextSelection selection, uint16 byLength);
|
||||
TextSelection shiftSelection(TextSelection selection, uint16 byLength);
|
||||
TextSelection unshiftSelection(TextSelection selection, quint16 byLength);
|
||||
TextSelection shiftSelection(TextSelection selection, quint16 byLength);
|
||||
inline TextSelection unshiftSelection(TextSelection selection, const Text &byText) {
|
||||
return ::internal::unshiftSelection(selection, byText.length());
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ public:
|
|||
bool hasOutLayout() const {
|
||||
return out() && !isPost();
|
||||
}
|
||||
virtual int32 viewsCount() const {
|
||||
virtual qint32 viewsCount() const {
|
||||
return hasViews() ? 1 : -1;
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ public:
|
|||
}
|
||||
virtual void updateReplyMarkup(const MTPReplyMarkup *markup) {
|
||||
}
|
||||
virtual int32 addToOverview(AddToOverviewMethod method) {
|
||||
virtual qint32 addToOverview(AddToOverviewMethod method) {
|
||||
return 0;
|
||||
}
|
||||
virtual void eraseFromOverview() {
|
||||
|
@ -705,7 +705,7 @@ public:
|
|||
return { QString(), EntitiesInText() };
|
||||
}
|
||||
|
||||
virtual void drawInfo(Painter &p, int32 right, int32 bottom, int32 width, bool selected, InfoDisplayType type) const {
|
||||
virtual void drawInfo(Painter &p, qint32 right, qint32 bottom, qint32 width, bool selected, InfoDisplayType type) const {
|
||||
}
|
||||
virtual ClickHandlerPtr fastShareLink() const {
|
||||
return ClickHandlerPtr();
|
||||
|
@ -715,7 +715,7 @@ public:
|
|||
}
|
||||
virtual void drawFastShare(Painter &p, int left, int top, int outerWidth) const {
|
||||
}
|
||||
virtual void setViewsCount(int32 count) {
|
||||
virtual void setViewsCount(qint32 count) {
|
||||
}
|
||||
virtual void setId(MsgId newId);
|
||||
|
||||
|
@ -967,7 +967,7 @@ protected:
|
|||
int _indexInBlock = -1;
|
||||
MTPDmessage::Flags _flags = 0;
|
||||
|
||||
mutable int32 _authorNameVersion = 0;
|
||||
mutable qint32 _authorNameVersion = 0;
|
||||
|
||||
HistoryItem *previousItem() const {
|
||||
if (_block && _indexInBlock >= 0) {
|
||||
|
|
|
@ -116,8 +116,8 @@ void LocationManager::getData(LocationData *data) {
|
|||
return failed(data);
|
||||
}
|
||||
|
||||
int32 w = st::locationSize.width(), h = st::locationSize.height();
|
||||
int32 zoom = 13, scale = 1;
|
||||
qint32 w = st::locationSize.width(), h = st::locationSize.height();
|
||||
qint32 zoom = 13, scale = 1;
|
||||
if (cScale() == dbisTwo || cRetina()) {
|
||||
scale = 2;
|
||||
} else {
|
||||
|
|
|
@ -27,7 +27,7 @@ void deinitLocationManager();
|
|||
class LocationCoords {
|
||||
public:
|
||||
LocationCoords() = default;
|
||||
LocationCoords(float64 lat, float64 lon) : _lat(lat), _lon(lon) {
|
||||
LocationCoords(double lat, double lon) : _lat(lat), _lon(lon) {
|
||||
}
|
||||
LocationCoords(const MTPDgeoPoint &point) : _lat(point.vlat.v), _lon(point.vlong.v) {
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
static QString asString(float64 value) {
|
||||
static QString asString(double value) {
|
||||
static constexpr auto kPrecision = 6;
|
||||
return QString::number(value, 'f', kPrecision);
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ private:
|
|||
#endif // OS_MAC_OLD
|
||||
}
|
||||
|
||||
float64 _lat = 0;
|
||||
float64 _lon = 0;
|
||||
double _lat = 0;
|
||||
double _lon = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -136,7 +136,7 @@ private:
|
|||
|
||||
QNetworkAccessManager *manager = nullptr;
|
||||
QMap<QNetworkReply*, LocationData*> dataLoadings, imageLoadings;
|
||||
QMap<LocationData*, int32> serverRedirects;
|
||||
QMap<LocationData*, qint32> serverRedirects;
|
||||
ImagePtr *notLoadedPlaceholder = nullptr;
|
||||
|
||||
};
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
virtual void updatePressed(QPoint point) {
|
||||
}
|
||||
|
||||
virtual int32 addToOverview(AddToOverviewMethod method) {
|
||||
virtual qint32 addToOverview(AddToOverviewMethod method) {
|
||||
return 0;
|
||||
}
|
||||
virtual void eraseFromOverview() {
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
virtual bool consumeMessageText(const TextWithEntities &textWithEntities) WARN_UNUSED_RESULT {
|
||||
return false;
|
||||
}
|
||||
virtual uint16 fullSelectionLength() const WARN_UNUSED_RESULT {
|
||||
virtual quint16 fullSelectionLength() const WARN_UNUSED_RESULT {
|
||||
return 0;
|
||||
}
|
||||
TextSelection skipSelection(TextSelection selection) const WARN_UNUSED_RESULT {
|
||||
|
@ -215,7 +215,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
int32 addToOneOverview(MediaOverviewType type, AddToOverviewMethod method) {
|
||||
qint32 addToOneOverview(MediaOverviewType type, AddToOverviewMethod method) {
|
||||
if (_parent->history()->addToOverview(type, _parent->id, method)) {
|
||||
return (1 << type);
|
||||
}
|
||||
|
|
|
@ -100,8 +100,8 @@ void HistoryInitMedia() {
|
|||
|
||||
namespace {
|
||||
|
||||
int32 documentMaxStatusWidth(DocumentData *document) {
|
||||
int32 result = st::normalFont->width(formatDownloadText(document->size, document->size));
|
||||
qint32 documentMaxStatusWidth(DocumentData *document) {
|
||||
qint32 result = st::normalFont->width(formatDownloadText(document->size, document->size));
|
||||
if (auto song = document->song()) {
|
||||
result = qMax(result, st::normalFont->width(formatPlayedText(song->duration, song->duration)));
|
||||
result = qMax(result, st::normalFont->width(formatDurationAndSizeText(song->duration, document->size)));
|
||||
|
@ -116,8 +116,8 @@ int32 documentMaxStatusWidth(DocumentData *document) {
|
|||
return result;
|
||||
}
|
||||
|
||||
int32 gifMaxStatusWidth(DocumentData *document) {
|
||||
int32 result = st::normalFont->width(formatDownloadText(document->size, document->size));
|
||||
qint32 gifMaxStatusWidth(DocumentData *document) {
|
||||
qint32 result = st::normalFont->width(formatDownloadText(document->size, document->size));
|
||||
result = qMax(result, st::normalFont->width(formatGifAndSizeText(document->size)));
|
||||
return result;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ void HistoryFileMedia::setLinks(ClickHandlerPtr &&openl, ClickHandlerPtr &&savel
|
|||
_cancell = std::move(cancell);
|
||||
}
|
||||
|
||||
void HistoryFileMedia::setStatusSize(int32 newSize, int32 fullSize, int32 duration, qint64 realDuration) const {
|
||||
void HistoryFileMedia::setStatusSize(qint32 newSize, qint32 fullSize, qint32 duration, qint64 realDuration) const {
|
||||
_statusSize = newSize;
|
||||
if (_statusSize == FileStatusSizeReady) {
|
||||
_statusText = (duration >= 0) ? formatDurationAndSizeText(duration, fullSize) : (duration < -1 ? formatGifAndSizeText(fullSize) : formatSizeText(fullSize));
|
||||
|
@ -239,7 +239,7 @@ HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, not_null<PhotoData*> p
|
|||
init();
|
||||
}
|
||||
|
||||
HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, not_null<PeerData*> chat, not_null<PhotoData*> photo, int32 width) : HistoryFileMedia(parent)
|
||||
HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, not_null<PeerData*> chat, not_null<PhotoData*> photo, qint32 width) : HistoryFileMedia(parent)
|
||||
, _data(photo) {
|
||||
setLinks(MakeShared<PhotoOpenClickHandler>(_data, chat), MakeShared<PhotoSaveClickHandler>(_data, chat), MakeShared<PhotoCancelClickHandler>(_data, chat));
|
||||
|
||||
|
@ -247,7 +247,7 @@ HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, not_null<PeerData*> ch
|
|||
init();
|
||||
}
|
||||
|
||||
HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, not_null<PeerData*> chat, const MTPDphoto &photo, int32 width) : HistoryPhoto(parent, chat, App::feedPhoto(photo), width) {
|
||||
HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, not_null<PeerData*> chat, const MTPDphoto &photo, qint32 width) : HistoryPhoto(parent, chat, App::feedPhoto(photo), width) {
|
||||
}
|
||||
|
||||
HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, const HistoryPhoto &other) : HistoryFileMedia(parent)
|
||||
|
@ -269,7 +269,7 @@ void HistoryPhoto::initDimensions() {
|
|||
_caption.setSkipBlock(_parent->skipBlockWidth(), _parent->skipBlockHeight());
|
||||
}
|
||||
|
||||
int32 tw = convertScale(_data->full->width()), th = convertScale(_data->full->height());
|
||||
qint32 tw = convertScale(_data->full->width()), th = convertScale(_data->full->height());
|
||||
if (!tw || !th) {
|
||||
tw = th = 1;
|
||||
}
|
||||
|
@ -285,10 +285,10 @@ void HistoryPhoto::initDimensions() {
|
|||
if (_parent->toHistoryMessage()) {
|
||||
bool bubble = _parent->hasBubble();
|
||||
|
||||
int32 minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
int32 maxActualWidth = qMax(tw, minWidth);
|
||||
qint32 minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
qint32 maxActualWidth = qMax(tw, minWidth);
|
||||
_maxw = qMax(maxActualWidth, th);
|
||||
_minh = qMax(th, int32(st::minPhotoSize));
|
||||
_minh = qMax(th, qint32(st::minPhotoSize));
|
||||
if (bubble) {
|
||||
maxActualWidth += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
_maxw += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
|
@ -337,8 +337,8 @@ int HistoryPhoto::resizeGetHeight(int width) {
|
|||
if (_pixh < 1) _pixh = 1;
|
||||
|
||||
int minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_width = qMax(_pixw, int16(minWidth));
|
||||
_height = qMax(_pixh, int16(st::minPhotoSize));
|
||||
_width = qMax(_pixw, qint16(minWidth));
|
||||
_height = qMax(_pixh, qint16(st::minPhotoSize));
|
||||
if (bubble) {
|
||||
_width += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
_height += st::mediaPadding.top() + st::mediaPadding.bottom();
|
||||
|
@ -416,7 +416,7 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, Tim
|
|||
p.drawPixmap(rthumb.topLeft(), pix);
|
||||
}
|
||||
if (radial || (!loaded && !_data->loading())) {
|
||||
float64 radialOpacity = (radial && loaded && !_data->uploading()) ? _animation->radial.opacity() : 1;
|
||||
double radialOpacity = (radial && loaded && !_data->uploading()) ? _animation->radial.opacity() : 1;
|
||||
QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
|
||||
p.setPen(Qt::NoPen);
|
||||
if (selected) {
|
||||
|
@ -543,9 +543,9 @@ void HistoryPhoto::updateSentMedia(const MTPMessageMedia &media) {
|
|||
|
||||
if (photo.type() == mtpc_photo) {
|
||||
auto &sizes = photo.c_photo().vsizes.v;
|
||||
int32 max = 0;
|
||||
qint32 max = 0;
|
||||
const MTPDfileLocation *maxLocation = 0;
|
||||
for (int32 i = 0, l = sizes.size(); i < l; ++i) {
|
||||
for (qint32 i = 0, l = sizes.size(); i < l; ++i) {
|
||||
char size = 0;
|
||||
const MTPFileLocation *loc = 0;
|
||||
switch (sizes.at(i).type()) {
|
||||
|
@ -635,8 +635,8 @@ bool HistoryPhoto::needsBubble() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
int32 HistoryPhoto::addToOverview(AddToOverviewMethod method) {
|
||||
auto result = int32(0);
|
||||
qint32 HistoryPhoto::addToOverview(AddToOverviewMethod method) {
|
||||
auto result = qint32(0);
|
||||
if (_parent->toHistoryMessage()) {
|
||||
result |= addToOneOverview(OverviewPhotos, method);
|
||||
} else {
|
||||
|
@ -688,23 +688,23 @@ void HistoryVideo::initDimensions() {
|
|||
_caption.setSkipBlock(_parent->skipBlockWidth(), _parent->skipBlockHeight());
|
||||
}
|
||||
|
||||
int32 tw = convertScale(_data->thumb->width()), th = convertScale(_data->thumb->height());
|
||||
qint32 tw = convertScale(_data->thumb->width()), th = convertScale(_data->thumb->height());
|
||||
if (!tw || !th) {
|
||||
tw = th = 1;
|
||||
}
|
||||
if (tw * st::msgVideoSize.height() > th * st::msgVideoSize.width()) {
|
||||
th = qRound((st::msgVideoSize.width() / float64(tw)) * th);
|
||||
th = qRound((st::msgVideoSize.width() / double(tw)) * th);
|
||||
tw = st::msgVideoSize.width();
|
||||
} else {
|
||||
tw = qRound((st::msgVideoSize.height() / float64(th)) * tw);
|
||||
tw = qRound((st::msgVideoSize.height() / double(th)) * tw);
|
||||
th = st::msgVideoSize.height();
|
||||
}
|
||||
|
||||
_thumbw = qMax(tw, 1);
|
||||
int32 minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
minWidth = qMax(minWidth, documentMaxStatusWidth(_data) + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_maxw = qMax(_thumbw, int32(minWidth));
|
||||
_minh = qMax(th, int32(st::minPhotoSize));
|
||||
qint32 minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
minWidth = qMax(minWidth, documentMaxStatusWidth(_data) + 2 * qint32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_maxw = qMax(_thumbw, qint32(minWidth));
|
||||
_minh = qMax(th, qint32(st::minPhotoSize));
|
||||
if (bubble) {
|
||||
_maxw += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
_minh += st::mediaPadding.top() + st::mediaPadding.bottom();
|
||||
|
@ -726,10 +726,10 @@ int HistoryVideo::resizeGetHeight(int width) {
|
|||
tw = th = 1;
|
||||
}
|
||||
if (tw * st::msgVideoSize.height() > th * st::msgVideoSize.width()) {
|
||||
th = qRound((st::msgVideoSize.width() / float64(tw)) * th);
|
||||
th = qRound((st::msgVideoSize.width() / double(tw)) * th);
|
||||
tw = st::msgVideoSize.width();
|
||||
} else {
|
||||
tw = qRound((st::msgVideoSize.height() / float64(th)) * tw);
|
||||
tw = qRound((st::msgVideoSize.height() / double(th)) * tw);
|
||||
th = st::msgVideoSize.height();
|
||||
}
|
||||
|
||||
|
@ -737,7 +737,7 @@ int HistoryVideo::resizeGetHeight(int width) {
|
|||
width -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
}
|
||||
if (width < tw) {
|
||||
th = qRound((width / float64(tw)) * th);
|
||||
th = qRound((width / double(tw)) * th);
|
||||
tw = width;
|
||||
}
|
||||
|
||||
|
@ -878,7 +878,7 @@ HistoryTextState HistoryVideo::getState(QPoint point, HistoryStateRequest reques
|
|||
|
||||
bool loaded = _data->loaded();
|
||||
|
||||
int32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
bool bubble = _parent->hasBubble();
|
||||
|
||||
if (bubble) {
|
||||
|
@ -922,7 +922,7 @@ HistoryTextState HistoryVideo::getState(QPoint point, HistoryStateRequest reques
|
|||
return result;
|
||||
}
|
||||
|
||||
void HistoryVideo::setStatusSize(int32 newSize) const {
|
||||
void HistoryVideo::setStatusSize(qint32 newSize) const {
|
||||
HistoryFileMedia::setStatusSize(newSize, _data->size, _data->duration(), 0);
|
||||
}
|
||||
|
||||
|
@ -951,7 +951,7 @@ bool HistoryVideo::needsBubble() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
int32 HistoryVideo::addToOverview(AddToOverviewMethod method) {
|
||||
qint32 HistoryVideo::addToOverview(AddToOverviewMethod method) {
|
||||
return addToOneOverview(OverviewVideos, method);
|
||||
}
|
||||
|
||||
|
@ -961,7 +961,7 @@ void HistoryVideo::eraseFromOverview() {
|
|||
|
||||
void HistoryVideo::updateStatusText() const {
|
||||
bool showPause = false;
|
||||
int32 statusSize = 0, realDuration = 0;
|
||||
qint32 statusSize = 0, realDuration = 0;
|
||||
if (_data->status == FileDownloadFailed || _data->status == FileUploadFailed) {
|
||||
statusSize = FileStatusSizeFailed;
|
||||
} else if (_data->status == FileUploading) {
|
||||
|
@ -1088,7 +1088,7 @@ HistoryDocument::HistoryDocument(not_null<HistoryItem*> parent, const HistoryDoc
|
|||
}
|
||||
|
||||
void HistoryDocument::createComponents(bool caption) {
|
||||
uint64 mask = 0;
|
||||
quint64 mask = 0;
|
||||
if (_data->voice()) {
|
||||
mask |= HistoryDocumentVoice::Bit();
|
||||
} else {
|
||||
|
@ -1128,7 +1128,7 @@ void HistoryDocument::initDimensions() {
|
|||
auto thumbed = Get<HistoryDocumentThumbed>();
|
||||
if (thumbed) {
|
||||
_data->thumb->load();
|
||||
int32 tw = convertScale(_data->thumb->width()), th = convertScale(_data->thumb->height());
|
||||
qint32 tw = convertScale(_data->thumb->width()), th = convertScale(_data->thumb->height());
|
||||
if (tw > th) {
|
||||
thumbed->_thumbw = (tw * st::msgFileThumbSize) / th;
|
||||
} else {
|
||||
|
@ -1138,7 +1138,7 @@ void HistoryDocument::initDimensions() {
|
|||
|
||||
_maxw = st::msgFileMinWidth;
|
||||
|
||||
int32 tleft = 0, tright = 0;
|
||||
qint32 tleft = 0, tright = 0;
|
||||
if (thumbed) {
|
||||
tleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right();
|
||||
tright = st::msgFileThumbPadding.left();
|
||||
|
@ -1248,7 +1248,7 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
|
|||
}
|
||||
|
||||
if (radial || (!loaded && !_data->loading())) {
|
||||
float64 radialOpacity = (radial && loaded && !_data->uploading()) ? _animation->radial.opacity() : 1;
|
||||
double radialOpacity = (radial && loaded && !_data->uploading()) ? _animation->radial.opacity() : 1;
|
||||
QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
|
||||
p.setPen(Qt::NoPen);
|
||||
if (selected) {
|
||||
|
@ -1459,7 +1459,7 @@ HistoryTextState HistoryDocument::getState(QPoint point, HistoryStateRequest req
|
|||
|
||||
bool showPause = updateStatusText();
|
||||
|
||||
int32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0, bottom = 0;
|
||||
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0, bottom = 0;
|
||||
auto topMinus = isBubbleTop() ? 0 : st::msgFileTopMinus;
|
||||
if (auto thumbed = Get<HistoryDocumentThumbed>()) {
|
||||
nameleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right();
|
||||
|
@ -1501,7 +1501,7 @@ HistoryTextState HistoryDocument::getState(QPoint point, HistoryStateRequest req
|
|||
auto state = Media::Player::mixer()->currentState(AudioMsgId::Type::Voice);
|
||||
if (state.id == AudioMsgId(_data, _parent->fullId()) && !Media::Player::IsStoppedOrStopping(state.state)) {
|
||||
if (!voice->seeking()) {
|
||||
voice->setSeekingStart((point.x() - nameleft) / float64(namewidth));
|
||||
voice->setSeekingStart((point.x() - nameleft) / double(namewidth));
|
||||
}
|
||||
result.link = voice->_seekl;
|
||||
return result;
|
||||
|
@ -1539,7 +1539,7 @@ void HistoryDocument::updatePressed(QPoint point) {
|
|||
nameleft = st::msgFilePadding.left() + st::msgFileSize + st::msgFilePadding.right();
|
||||
nameright = st::msgFilePadding.left();
|
||||
}
|
||||
voice->setSeekingCurrent(snap((point.x() - nameleft) / float64(_width - nameleft - nameright), 0., 1.));
|
||||
voice->setSeekingCurrent(snap((point.x() - nameleft) / double(_width - nameleft - nameright), 0., 1.));
|
||||
Ui::repaintHistoryItem(_parent);
|
||||
}
|
||||
}
|
||||
|
@ -1573,8 +1573,8 @@ TextWithEntities HistoryDocument::selectedText(TextSelection selection) const {
|
|||
return result;
|
||||
}
|
||||
|
||||
int32 HistoryDocument::addToOverview(AddToOverviewMethod method) {
|
||||
auto result = int32(0);
|
||||
qint32 HistoryDocument::addToOverview(AddToOverviewMethod method) {
|
||||
auto result = qint32(0);
|
||||
if (_data->voice()) {
|
||||
result |= addToOneOverview(OverviewVoiceFiles, method);
|
||||
result |= addToOneOverview(OverviewRoundVoiceFiles, method);
|
||||
|
@ -1624,8 +1624,8 @@ void HistoryDocument::buildStringRepresentation(Callback callback) const {
|
|||
return callback(attachType, attachFileName, *caption);
|
||||
}
|
||||
|
||||
void HistoryDocument::setStatusSize(int32 newSize, qint64 realDuration) const {
|
||||
int32 duration = _data->song() ? _data->song()->duration : (_data->voice() ? _data->voice()->duration : -1);
|
||||
void HistoryDocument::setStatusSize(qint32 newSize, qint64 realDuration) const {
|
||||
qint32 duration = _data->song() ? _data->song()->duration : (_data->voice() ? _data->voice()->duration : -1);
|
||||
HistoryFileMedia::setStatusSize(newSize, _data->size, duration, realDuration);
|
||||
if (auto thumbed = Get<HistoryDocumentThumbed>()) {
|
||||
if (_statusSize == FileStatusSizeReady) {
|
||||
|
@ -1645,7 +1645,7 @@ void HistoryDocument::setStatusSize(int32 newSize, qint64 realDuration) const {
|
|||
|
||||
bool HistoryDocument::updateStatusText() const {
|
||||
bool showPause = false;
|
||||
int32 statusSize = 0, realDuration = 0;
|
||||
qint32 statusSize = 0, realDuration = 0;
|
||||
if (_data->status == FileDownloadFailed || _data->status == FileUploadFailed) {
|
||||
statusSize = FileStatusSizeFailed;
|
||||
} else if (_data->status == FileUploading) {
|
||||
|
@ -1662,7 +1662,7 @@ bool HistoryDocument::updateStatusText() const {
|
|||
bool was = (voice->_playback != nullptr);
|
||||
voice->ensurePlayback(this);
|
||||
if (!was || state.position != voice->_playback->_position) {
|
||||
auto prg = state.length ? snap(float64(state.position) / state.length, 0., 1.) : 0.;
|
||||
auto prg = state.length ? snap(double(state.position) / state.length, 0., 1.) : 0.;
|
||||
if (voice->_playback->_position < state.position) {
|
||||
voice->_playback->a_progress.start(prg);
|
||||
} else {
|
||||
|
@ -1710,10 +1710,10 @@ QMargins HistoryDocument::bubbleMargins() const {
|
|||
return Get<HistoryDocumentThumbed>() ? QMargins(st::msgFileThumbPadding.left(), st::msgFileThumbPadding.top(), st::msgFileThumbPadding.left(), st::msgFileThumbPadding.bottom()) : st::msgPadding;
|
||||
}
|
||||
|
||||
void HistoryDocument::step_voiceProgress(float64 ms, bool timer) {
|
||||
void HistoryDocument::step_voiceProgress(double ms, bool timer) {
|
||||
if (auto voice = Get<HistoryDocumentVoice>()) {
|
||||
if (voice->_playback) {
|
||||
float64 dt = ms / (2 * AudioVoiceMsgUpdateView);
|
||||
double dt = ms / (2 * AudioVoiceMsgUpdateView);
|
||||
if (dt >= 1) {
|
||||
voice->_playback->_a_progress.stop();
|
||||
voice->_playback->a_progress.finish();
|
||||
|
@ -1825,7 +1825,7 @@ void HistoryGif::initDimensions() {
|
|||
}
|
||||
|
||||
bool bubble = _parent->hasBubble();
|
||||
int32 tw = 0, th = 0;
|
||||
qint32 tw = 0, th = 0;
|
||||
if (_gif && _gif->state() == Media::Clip::State::Error) {
|
||||
if (!_gif->autoplay()) {
|
||||
Ui::show(Box<InformBox>(lang(lng_gif_error)));
|
||||
|
@ -1856,11 +1856,11 @@ void HistoryGif::initDimensions() {
|
|||
}
|
||||
_thumbw = tw;
|
||||
_thumbh = th;
|
||||
_maxw = qMax(tw, int32(st::minPhotoSize));
|
||||
_minh = qMax(th, int32(st::minPhotoSize));
|
||||
_maxw = qMax(_maxw, _parent->infoWidth() + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_maxw = qMax(tw, qint32(st::minPhotoSize));
|
||||
_minh = qMax(th, qint32(st::minPhotoSize));
|
||||
_maxw = qMax(_maxw, _parent->infoWidth() + 2 * qint32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
if (!_gif || !_gif->ready()) {
|
||||
_maxw = qMax(_maxw, gifMaxStatusWidth(_data) + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_maxw = qMax(_maxw, gifMaxStatusWidth(_data) + 2 * qint32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
}
|
||||
if (bubble) {
|
||||
_maxw += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
|
@ -1913,15 +1913,15 @@ int HistoryGif::resizeGetHeight(int width) {
|
|||
width -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
}
|
||||
if (width < tw) {
|
||||
th = qRound((width / float64(tw)) * th);
|
||||
th = qRound((width / double(tw)) * th);
|
||||
tw = width;
|
||||
}
|
||||
_thumbw = tw;
|
||||
_thumbh = th;
|
||||
|
||||
_width = qMax(tw, int32(st::minPhotoSize));
|
||||
_height = qMax(th, int32(st::minPhotoSize));
|
||||
_width = qMax(_width, _parent->infoWidth() + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_width = qMax(tw, qint32(st::minPhotoSize));
|
||||
_height = qMax(th, qint32(st::minPhotoSize));
|
||||
_width = qMax(_width, _parent->infoWidth() + 2 * qint32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
if (_gif && _gif->ready()) {
|
||||
if (!_gif->started()) {
|
||||
auto isRound = _data->isRoundVideo();
|
||||
|
@ -1932,7 +1932,7 @@ int HistoryGif::resizeGetHeight(int width) {
|
|||
_gif->start(_thumbw, _thumbh, _width, _height, roundRadius, roundCorners);
|
||||
}
|
||||
} else {
|
||||
_width = qMax(_width, gifMaxStatusWidth(_data) + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_width = qMax(_width, gifMaxStatusWidth(_data) + 2 * qint32(st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
}
|
||||
if (bubble) {
|
||||
_width += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
|
@ -1979,7 +1979,7 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, TimeM
|
|||
Ui::autoplayMediaInlineAsync(_parent->fullId());
|
||||
}
|
||||
|
||||
int32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
bool bubble = _parent->hasBubble();
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
auto isChildMedia = (_parent->getMedia() != this);
|
||||
|
@ -2247,7 +2247,7 @@ HistoryTextState HistoryGif::getState(QPoint point, HistoryStateRequest request)
|
|||
HistoryTextState result;
|
||||
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return result;
|
||||
int32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
bool bubble = _parent->hasBubble();
|
||||
|
||||
if (bubble) {
|
||||
|
@ -2415,8 +2415,8 @@ bool HistoryGif::needsBubble() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
int32 HistoryGif::addToOverview(AddToOverviewMethod method) {
|
||||
auto result = int32(0);
|
||||
qint32 HistoryGif::addToOverview(AddToOverviewMethod method) {
|
||||
auto result = qint32(0);
|
||||
if (_data->isRoundVideo()) {
|
||||
result |= addToOneOverview(OverviewRoundVoiceFiles, method);
|
||||
} else if (_data->isGifv()) {
|
||||
|
@ -2445,7 +2445,7 @@ bool HistoryGif::isSeparateRoundVideo() const {
|
|||
return _data->isRoundVideo() && (_parent->getMedia() == this) && !_parent->hasBubble();
|
||||
}
|
||||
|
||||
void HistoryGif::setStatusSize(int32 newSize) const {
|
||||
void HistoryGif::setStatusSize(qint32 newSize) const {
|
||||
if (_data->isRoundVideo()) {
|
||||
_statusSize = newSize;
|
||||
if (newSize < 0) {
|
||||
|
@ -2460,7 +2460,7 @@ void HistoryGif::setStatusSize(int32 newSize) const {
|
|||
|
||||
void HistoryGif::updateStatusText() const {
|
||||
bool showPause = false;
|
||||
int32 statusSize = 0, realDuration = 0;
|
||||
qint32 statusSize = 0, realDuration = 0;
|
||||
if (_data->status == FileDownloadFailed || _data->status == FileUploadFailed) {
|
||||
statusSize = FileStatusSizeFailed;
|
||||
} else if (_data->status == FileUploading) {
|
||||
|
@ -2475,7 +2475,7 @@ void HistoryGif::updateStatusText() const {
|
|||
auto state = Media::Player::mixer()->currentState(AudioMsgId::Type::Voice);
|
||||
if (state.id == _gif->audioMsgId()) {
|
||||
if (state.length) {
|
||||
auto position = int64(0);
|
||||
auto position = qint64(0);
|
||||
if (Media::Player::IsStoppedAtEnd(state.state)) {
|
||||
position = state.length;
|
||||
} else if (!Media::Player::IsStoppedOrStopping(state.state)) {
|
||||
|
@ -2572,7 +2572,7 @@ bool HistoryGif::playInline(bool autoplay) {
|
|||
}, mode));
|
||||
if (mode == Mode::Video) {
|
||||
_roundPlayback = std::make_unique<Media::Clip::Playback>();
|
||||
_roundPlayback->setValueChangedCallback([this](float64 value) {
|
||||
_roundPlayback->setValueChangedCallback([this](double value) {
|
||||
Ui::repaintHistoryItem(_parent);
|
||||
});
|
||||
if (App::main()) {
|
||||
|
@ -2615,7 +2615,7 @@ HistoryGif::~HistoryGif() {
|
|||
clearClipReader();
|
||||
}
|
||||
|
||||
float64 HistoryGif::dataProgress() const {
|
||||
double HistoryGif::dataProgress() const {
|
||||
return (_data->uploading() || !_parent || _parent->id > 0) ? _data->progress() : 0;
|
||||
}
|
||||
|
||||
|
@ -2660,8 +2660,8 @@ void HistorySticker::initDimensions() {
|
|||
}
|
||||
if (_pixw < 1) _pixw = 1;
|
||||
if (_pixh < 1) _pixh = 1;
|
||||
_maxw = qMax(_pixw, int16(st::minPhotoSize));
|
||||
_minh = qMax(_pixh, int16(st::minPhotoSize));
|
||||
_maxw = qMax(_pixw, qint16(st::minPhotoSize));
|
||||
_minh = qMax(_pixh, qint16(st::minPhotoSize));
|
||||
if (_parent->getMedia() == this) {
|
||||
_maxw += additionalWidth();
|
||||
}
|
||||
|
@ -2923,7 +2923,7 @@ ClickHandlerPtr addContactClickHandler(HistoryItem *item) {
|
|||
|
||||
} // namespace
|
||||
|
||||
HistoryContact::HistoryContact(not_null<HistoryItem*> parent, int32 userId, const QString &first, const QString &last, const QString &phone) : HistoryMedia(parent)
|
||||
HistoryContact::HistoryContact(not_null<HistoryItem*> parent, qint32 userId, const QString &first, const QString &last, const QString &phone) : HistoryMedia(parent)
|
||||
, _userId(userId)
|
||||
, _fname(first)
|
||||
, _lname(last)
|
||||
|
@ -2950,7 +2950,7 @@ void HistoryContact::initDimensions() {
|
|||
}
|
||||
_linkw = _link.isEmpty() ? 0 : st::semiboldFont->width(_link);
|
||||
|
||||
int32 tleft = 0, tright = 0;
|
||||
qint32 tleft = 0, tright = 0;
|
||||
if (_userId) {
|
||||
tleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right();
|
||||
tright = st::msgFileThumbPadding.left();
|
||||
|
@ -2980,7 +2980,7 @@ void HistoryContact::initDimensions() {
|
|||
|
||||
void HistoryContact::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
|
||||
int32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
bool selected = (selection == FullSelection);
|
||||
|
@ -2989,7 +2989,7 @@ void HistoryContact::draw(Painter &p, const QRect &r, TextSelection selection, T
|
|||
width = _maxw;
|
||||
}
|
||||
|
||||
int32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0;
|
||||
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0;
|
||||
auto topMinus = isBubbleTop() ? 0 : st::msgFileTopMinus;
|
||||
if (_userId) {
|
||||
nameleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right();
|
||||
|
@ -3023,7 +3023,7 @@ void HistoryContact::draw(Painter &p, const QRect &r, TextSelection selection, T
|
|||
|
||||
_photoEmpty.paint(p, st::msgFilePadding.left(), st::msgFilePadding.top() - topMinus, width, st::msgFileSize);
|
||||
}
|
||||
int32 namewidth = width - nameleft - nameright;
|
||||
qint32 namewidth = width - nameleft - nameright;
|
||||
|
||||
p.setFont(st::semiboldFont);
|
||||
p.setPen(outbg ? (selected ? st::historyFileNameOutFgSelected : st::historyFileNameOutFg) : (selected ? st::historyFileNameInFgSelected : st::historyFileNameInFg));
|
||||
|
@ -3039,7 +3039,7 @@ HistoryTextState HistoryContact::getState(QPoint point, HistoryStateRequest requ
|
|||
HistoryTextState result;
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
|
||||
int32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0;
|
||||
qint32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0;
|
||||
auto topMinus = isBubbleTop() ? 0 : st::msgFileTopMinus;
|
||||
if (_userId) {
|
||||
nameleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right();
|
||||
|
@ -3213,7 +3213,7 @@ QString siteNameFromUrl(const QString &url) {
|
|||
QString pretty = u.isValid() ? u.toDisplayString() : url;
|
||||
QRegularExpressionMatch m = QRegularExpression(qsl("^[a-zA-Z0-9]+://")).match(pretty);
|
||||
if (m.hasMatch()) pretty = pretty.mid(m.capturedLength());
|
||||
int32 slash = pretty.indexOf('/');
|
||||
qint32 slash = pretty.indexOf('/');
|
||||
if (slash > 0) pretty = pretty.mid(0, slash);
|
||||
QStringList components = pretty.split('.', QString::SkipEmptyParts);
|
||||
if (components.size() >= 2) {
|
||||
|
@ -3223,12 +3223,12 @@ QString siteNameFromUrl(const QString &url) {
|
|||
return QString();
|
||||
}
|
||||
|
||||
int32 articleThumbWidth(PhotoData *thumb, int32 height) {
|
||||
int32 w = thumb->medium->width(), h = thumb->medium->height();
|
||||
qint32 articleThumbWidth(PhotoData *thumb, qint32 height) {
|
||||
qint32 w = thumb->medium->width(), h = thumb->medium->height();
|
||||
return qMax(qMin(height * w / h, height), 1);
|
||||
}
|
||||
|
||||
int32 articleThumbHeight(PhotoData *thumb, int32 width) {
|
||||
qint32 articleThumbHeight(PhotoData *thumb, qint32 width) {
|
||||
return qMax(thumb->medium->height() * width / thumb->medium->width(), 1);
|
||||
}
|
||||
|
||||
|
@ -3417,7 +3417,7 @@ int HistoryWebPage::resizeGetHeight(int width) {
|
|||
_pixh = linesMax * lineHeight;
|
||||
do {
|
||||
_pixw = articleThumbWidth(_data->photo, _pixh);
|
||||
int32 wleft = width - st::webPagePhotoDelta - qMax(_pixw, int16(lineHeight));
|
||||
qint32 wleft = width - st::webPagePhotoDelta - qMax(_pixw, int16_t(lineHeight));
|
||||
|
||||
_height = siteNameHeight;
|
||||
|
||||
|
@ -3500,7 +3500,7 @@ int HistoryWebPage::resizeGetHeight(int width) {
|
|||
|
||||
void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
|
||||
int32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
bool selected = (selection == FullSelection);
|
||||
|
@ -3531,11 +3531,11 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, T
|
|||
_data->photo->medium->load(false, false);
|
||||
bool full = _data->photo->medium->loaded();
|
||||
QPixmap pix;
|
||||
int32 pw = qMax(_pixw, int16(lineHeight)), ph = _pixh;
|
||||
int32 pixw = _pixw, pixh = articleThumbHeight(_data->photo, _pixw);
|
||||
int32 maxw = convertScale(_data->photo->medium->width()), maxh = convertScale(_data->photo->medium->height());
|
||||
qint32 pw = qMax(_pixw, int16_t(lineHeight)), ph = _pixh;
|
||||
qint32 pixw = _pixw, pixh = articleThumbHeight(_data->photo, _pixw);
|
||||
qint32 maxw = convertScale(_data->photo->medium->width()), maxh = convertScale(_data->photo->medium->height());
|
||||
if (pixw * ph != pixh * pw) {
|
||||
float64 coef = (pixw * ph > pixh * pw) ? qMin(ph / float64(pixh), maxh / float64(pixh)) : qMin(pw / float64(pixw), maxw / float64(pixw));
|
||||
double coef = (pixw * ph > pixh * pw) ? qMin(ph / double(pixh), maxh / double(pixh)) : qMin(pw / double(pixw), maxw / double(pixw));
|
||||
pixh = qRound(pixh * coef);
|
||||
pixw = qRound(pixw * coef);
|
||||
}
|
||||
|
@ -3558,7 +3558,7 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, T
|
|||
}
|
||||
if (_titleLines) {
|
||||
p.setPen(outbg ? st::webPageTitleOutFg : st::webPageTitleInFg);
|
||||
int32 endskip = 0;
|
||||
qint32 endskip = 0;
|
||||
if (_title.hasSkipBlock()) {
|
||||
endskip = _parent->skipBlockWidth();
|
||||
}
|
||||
|
@ -3567,7 +3567,7 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, T
|
|||
}
|
||||
if (_descriptionLines) {
|
||||
p.setPen(outbg ? st::webPageDescriptionOutFg : st::webPageDescriptionInFg);
|
||||
int32 endskip = 0;
|
||||
qint32 endskip = 0;
|
||||
if (_description.hasSkipBlock()) {
|
||||
endskip = _parent->skipBlockWidth();
|
||||
}
|
||||
|
@ -3591,7 +3591,7 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, T
|
|||
|
||||
auto attachSelection = selected ? FullSelection : TextSelection { 0, 0 };
|
||||
_attach->draw(p, r.translated(-attachLeft, -attachTop), attachSelection, ms);
|
||||
int32 pixwidth = _attach->currentWidth(), pixheight = _attach->height();
|
||||
qint32 pixwidth = _attach->currentWidth(), pixheight = _attach->height();
|
||||
|
||||
if (_data->type == WebPageVideo && _attach->type() == MediaTypePhoto) {
|
||||
if (_attach->isReadyForOpen()) {
|
||||
|
@ -3602,10 +3602,10 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, T
|
|||
}
|
||||
}
|
||||
if (_durationWidth) {
|
||||
int32 dateX = pixwidth - _durationWidth - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
|
||||
int32 dateY = pixheight - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta;
|
||||
int32 dateW = pixwidth - dateX - st::msgDateImgDelta;
|
||||
int32 dateH = pixheight - dateY - st::msgDateImgDelta;
|
||||
qint32 dateX = pixwidth - _durationWidth - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
|
||||
qint32 dateY = pixheight - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta;
|
||||
qint32 dateW = pixwidth - dateX - st::msgDateImgDelta;
|
||||
qint32 dateH = pixheight - dateY - st::msgDateImgDelta;
|
||||
|
||||
App::roundRect(p, dateX, dateY, dateW, dateH, selected ? st::msgDateImgBgSelected : st::msgDateImgBg, selected ? DateSelectedCorners : DateCorners);
|
||||
|
||||
|
@ -3629,7 +3629,7 @@ HistoryTextState HistoryWebPage::getState(QPoint point, HistoryStateRequest requ
|
|||
HistoryTextState result;
|
||||
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return result;
|
||||
int32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
|
||||
QMargins bubble(_attach ? _attach->bubbleMargins() : QMargins());
|
||||
auto padding = inBubblePadding();
|
||||
|
@ -3643,7 +3643,7 @@ HistoryTextState HistoryWebPage::getState(QPoint point, HistoryStateRequest requ
|
|||
auto lineHeight = unitedLineHeight();
|
||||
auto inThumb = false;
|
||||
if (_asArticle) {
|
||||
int32 pw = qMax(_pixw, int16(lineHeight));
|
||||
qint32 pw = qMax(_pixw, int16_t(lineHeight));
|
||||
if (rtlrect(padding.left() + width - pw, 0, pw, _pixh, _width).contains(point)) {
|
||||
inThumb = true;
|
||||
}
|
||||
|
@ -3848,15 +3848,15 @@ void HistoryGame::initDimensions() {
|
|||
}
|
||||
|
||||
// init dimensions
|
||||
int32 l = st::msgPadding.left() + st::webPageLeft, r = st::msgPadding.right();
|
||||
int32 skipBlockWidth = _parent->skipBlockWidth();
|
||||
qint32 l = st::msgPadding.left() + st::webPageLeft, r = st::msgPadding.right();
|
||||
qint32 skipBlockWidth = _parent->skipBlockWidth();
|
||||
_maxw = skipBlockWidth;
|
||||
_minh = 0;
|
||||
|
||||
int32 titleMinHeight = _title.isEmpty() ? 0 : lineHeight;
|
||||
qint32 titleMinHeight = _title.isEmpty() ? 0 : lineHeight;
|
||||
// enable any count of lines in game description / message
|
||||
int descMaxLines = 4096;
|
||||
int32 descriptionMinHeight = _description.isEmpty() ? 0 : qMin(_description.minHeight(), descMaxLines * lineHeight);
|
||||
qint32 descriptionMinHeight = _description.isEmpty() ? 0 : qMin(_description.minHeight(), descMaxLines * lineHeight);
|
||||
|
||||
if (!_title.isEmpty()) {
|
||||
accumulate_max(_maxw, _title.maxWidth());
|
||||
|
@ -3916,7 +3916,7 @@ int HistoryGame::resizeGetHeight(int width) {
|
|||
if (_description.isEmpty()) {
|
||||
_descriptionLines = 0;
|
||||
} else {
|
||||
int32 descriptionHeight = _description.countHeight(width);
|
||||
qint32 descriptionHeight = _description.countHeight(width);
|
||||
if (descriptionHeight < (linesMax - _titleLines) * st::webPageDescriptionFont->height) {
|
||||
_descriptionLines = (descriptionHeight / st::webPageDescriptionFont->height);
|
||||
} else {
|
||||
|
@ -3945,7 +3945,7 @@ int HistoryGame::resizeGetHeight(int width) {
|
|||
|
||||
void HistoryGame::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
|
||||
int32 width = _width, height = _height;
|
||||
qint32 width = _width, height = _height;
|
||||
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
bool selected = (selection == FullSelection);
|
||||
|
@ -3969,7 +3969,7 @@ void HistoryGame::draw(Painter &p, const QRect &r, TextSelection selection, Time
|
|||
auto lineHeight = unitedLineHeight();
|
||||
if (_titleLines) {
|
||||
p.setPen(semibold);
|
||||
int32 endskip = 0;
|
||||
qint32 endskip = 0;
|
||||
if (_title.hasSkipBlock()) {
|
||||
endskip = _parent->skipBlockWidth();
|
||||
}
|
||||
|
@ -3978,7 +3978,7 @@ void HistoryGame::draw(Painter &p, const QRect &r, TextSelection selection, Time
|
|||
}
|
||||
if (_descriptionLines) {
|
||||
p.setPen(outbg ? st::webPageDescriptionOutFg : st::webPageDescriptionInFg);
|
||||
int32 endskip = 0;
|
||||
qint32 endskip = 0;
|
||||
if (_description.hasSkipBlock()) {
|
||||
endskip = _parent->skipBlockWidth();
|
||||
}
|
||||
|
@ -4019,7 +4019,7 @@ HistoryTextState HistoryGame::getState(QPoint point, HistoryStateRequest request
|
|||
HistoryTextState result;
|
||||
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return result;
|
||||
int32 width = _width, height = _height;
|
||||
qint32 width = _width, height = _height;
|
||||
|
||||
QMargins bubble(_attach ? _attach->bubbleMargins() : QMargins());
|
||||
auto padding = inBubblePadding();
|
||||
|
@ -4288,15 +4288,15 @@ void HistoryInvoice::initDimensions() {
|
|||
}
|
||||
|
||||
// init dimensions
|
||||
int32 l = st::msgPadding.left(), r = st::msgPadding.right();
|
||||
int32 skipBlockWidth = _parent->skipBlockWidth();
|
||||
qint32 l = st::msgPadding.left(), r = st::msgPadding.right();
|
||||
qint32 skipBlockWidth = _parent->skipBlockWidth();
|
||||
_maxw = skipBlockWidth;
|
||||
_minh = 0;
|
||||
|
||||
int32 titleMinHeight = _title.isEmpty() ? 0 : lineHeight;
|
||||
qint32 titleMinHeight = _title.isEmpty() ? 0 : lineHeight;
|
||||
// enable any count of lines in game description / message
|
||||
int descMaxLines = 4096;
|
||||
int32 descriptionMinHeight = _description.isEmpty() ? 0 : qMin(_description.minHeight(), descMaxLines * lineHeight);
|
||||
qint32 descriptionMinHeight = _description.isEmpty() ? 0 : qMin(_description.minHeight(), descMaxLines * lineHeight);
|
||||
|
||||
if (!_title.isEmpty()) {
|
||||
accumulate_max(_maxw, _title.maxWidth());
|
||||
|
@ -4374,7 +4374,7 @@ int HistoryInvoice::resizeGetHeight(int width) {
|
|||
|
||||
void HistoryInvoice::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
|
||||
int32 width = _width, height = _height;
|
||||
qint32 width = _width, height = _height;
|
||||
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
bool selected = (selection == FullSelection);
|
||||
|
@ -4397,7 +4397,7 @@ void HistoryInvoice::draw(Painter &p, const QRect &r, TextSelection selection, T
|
|||
p.setPen(semibold);
|
||||
p.setTextPalette(selected ? (outbg ? st::outTextPaletteSelected : st::inTextPaletteSelected) : (outbg ? st::outSemiboldPalette : st::inSemiboldPalette));
|
||||
|
||||
int32 endskip = 0;
|
||||
qint32 endskip = 0;
|
||||
if (_title.hasSkipBlock()) {
|
||||
endskip = _parent->skipBlockWidth();
|
||||
}
|
||||
|
@ -4449,7 +4449,7 @@ HistoryTextState HistoryInvoice::getState(QPoint point, HistoryStateRequest requ
|
|||
HistoryTextState result;
|
||||
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return result;
|
||||
int32 width = _width, height = _height;
|
||||
qint32 width = _width, height = _height;
|
||||
|
||||
QMargins bubble(_attach ? _attach->bubbleMargins() : QMargins());
|
||||
auto padding = inBubblePadding();
|
||||
|
@ -4591,14 +4591,14 @@ HistoryLocation::HistoryLocation(not_null<HistoryItem*> parent, const HistoryLoc
|
|||
void HistoryLocation::initDimensions() {
|
||||
bool bubble = _parent->hasBubble();
|
||||
|
||||
int32 tw = fullWidth(), th = fullHeight();
|
||||
qint32 tw = fullWidth(), th = fullHeight();
|
||||
if (tw > st::maxMediaSize) {
|
||||
th = (st::maxMediaSize * th) / tw;
|
||||
tw = st::maxMediaSize;
|
||||
}
|
||||
int32 minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_maxw = qMax(tw, int32(minWidth));
|
||||
_minh = qMax(th, int32(st::minPhotoSize));
|
||||
qint32 minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_maxw = qMax(tw, qint32(minWidth));
|
||||
_minh = qMax(th, qint32(st::minPhotoSize));
|
||||
|
||||
if (bubble) {
|
||||
_maxw += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
|
@ -4626,7 +4626,7 @@ int HistoryLocation::resizeGetHeight(int width) {
|
|||
_width -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
}
|
||||
|
||||
int32 tw = fullWidth(), th = fullHeight();
|
||||
qint32 tw = fullWidth(), th = fullHeight();
|
||||
if (tw > st::maxMediaSize) {
|
||||
th = (st::maxMediaSize * th) / tw;
|
||||
tw = st::maxMediaSize;
|
||||
|
@ -4637,9 +4637,9 @@ int HistoryLocation::resizeGetHeight(int width) {
|
|||
} else {
|
||||
_width = tw;
|
||||
}
|
||||
int32 minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_width = qMax(_width, int32(minWidth));
|
||||
_height = qMax(_height, int32(st::minPhotoSize));
|
||||
qint32 minWidth = qMax(st::minPhotoSize, _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x()));
|
||||
_width = qMax(_width, qint32(minWidth));
|
||||
_height = qMax(_height, qint32(st::minPhotoSize));
|
||||
if (bubble) {
|
||||
_width += st::mediaPadding.left() + st::mediaPadding.right();
|
||||
_height += st::mediaPadding.top() + st::mediaPadding.bottom();
|
||||
|
@ -4661,7 +4661,7 @@ int HistoryLocation::resizeGetHeight(int width) {
|
|||
|
||||
void HistoryLocation::draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const {
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return;
|
||||
int32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
bool bubble = _parent->hasBubble();
|
||||
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
|
||||
bool selected = (selection == FullSelection);
|
||||
|
@ -4677,7 +4677,7 @@ void HistoryLocation::draw(Painter &p, const QRect &r, TextSelection selection,
|
|||
}
|
||||
|
||||
width -= st::mediaPadding.left() + st::mediaPadding.right();
|
||||
int32 textw = _width - st::msgPadding.left() - st::msgPadding.right();
|
||||
qint32 textw = _width - st::msgPadding.left() - st::msgPadding.right();
|
||||
|
||||
if (!_title.isEmpty()) {
|
||||
p.setPen(outbg ? st::webPageTitleOutFg : st::webPageTitleInFg);
|
||||
|
@ -4703,15 +4703,15 @@ void HistoryLocation::draw(Painter &p, const QRect &r, TextSelection selection,
|
|||
| (isBubbleBottom() ? (ImageRoundCorner::BottomLeft | ImageRoundCorner::BottomRight) : ImageRoundCorner::None);
|
||||
auto rthumb = QRect(skipx, skipy, width, height);
|
||||
if (_data && !_data->thumb->isNull()) {
|
||||
int32 w = _data->thumb->width(), h = _data->thumb->height();
|
||||
qint32 w = _data->thumb->width(), h = _data->thumb->height();
|
||||
QPixmap pix;
|
||||
if (width * h == height * w || (w == fullWidth() && h == fullHeight())) {
|
||||
pix = _data->thumb->pixSingle(width, height, width, height, roundRadius, roundCorners);
|
||||
} else if (width * h > height * w) {
|
||||
int32 nw = height * w / h;
|
||||
qint32 nw = height * w / h;
|
||||
pix = _data->thumb->pixSingle(nw, height, width, height, roundRadius, roundCorners);
|
||||
} else {
|
||||
int32 nh = width * h / w;
|
||||
qint32 nh = width * h / w;
|
||||
pix = _data->thumb->pixSingle(width, nh, width, height, roundRadius, roundCorners);
|
||||
}
|
||||
p.drawPixmap(rthumb.topLeft(), pix);
|
||||
|
@ -4739,7 +4739,7 @@ HistoryTextState HistoryLocation::getState(QPoint point, HistoryStateRequest req
|
|||
auto symbolAdd = 0;
|
||||
|
||||
if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return result;
|
||||
int32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
qint32 skipx = 0, skipy = 0, width = _width, height = _height;
|
||||
bool bubble = _parent->hasBubble();
|
||||
|
||||
if (bubble) {
|
||||
|
@ -4857,10 +4857,10 @@ bool HistoryLocation::needsBubble() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
int32 HistoryLocation::fullWidth() const {
|
||||
qint32 HistoryLocation::fullWidth() const {
|
||||
return st::locationSize.width();
|
||||
}
|
||||
|
||||
int32 HistoryLocation::fullHeight() const {
|
||||
qint32 HistoryLocation::fullHeight() const {
|
||||
return st::locationSize.height();
|
||||
}
|
||||
|
|
|
@ -76,11 +76,11 @@ protected:
|
|||
// 0x7FFFFFF0 will contain status for not yet downloaded file
|
||||
// 0x7FFFFFF1 will contain status for already downloaded file
|
||||
// 0x7FFFFFF2 will contain status for failed to download / upload file
|
||||
mutable int32 _statusSize;
|
||||
mutable qint32 _statusSize;
|
||||
mutable QString _statusText;
|
||||
|
||||
// duration = -1 - no duration, duration = -2 - "GIF" duration
|
||||
void setStatusSize(int32 newSize, int32 fullSize, int32 duration, qint64 realDuration) const;
|
||||
void setStatusSize(qint32 newSize, qint32 fullSize, qint32 duration, qint64 realDuration) const;
|
||||
|
||||
void step_radial(TimeMs ms, bool timer);
|
||||
void thumbAnimationCallback();
|
||||
|
@ -104,7 +104,7 @@ protected:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual float64 dataProgress() const = 0;
|
||||
virtual double dataProgress() const = 0;
|
||||
virtual bool dataFinished() const = 0;
|
||||
virtual bool dataLoaded() const = 0;
|
||||
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override WARN_UNUSED_RESULT {
|
||||
return _caption.adjustSelection(selection, type);
|
||||
}
|
||||
uint16 fullSelectionLength() const override {
|
||||
quint16 fullSelectionLength() const override {
|
||||
return _caption.length();
|
||||
}
|
||||
bool hasTextForCopy() const override {
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
QString inDialogsText() const override;
|
||||
TextWithEntities selectedText(TextSelection selection) const override;
|
||||
|
||||
int32 addToOverview(AddToOverviewMethod method) override;
|
||||
qint32 addToOverview(AddToOverviewMethod method) override;
|
||||
void eraseFromOverview() override;
|
||||
|
||||
PhotoData *photo() const {
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
float64 dataProgress() const override {
|
||||
double dataProgress() const override {
|
||||
return _data->progress();
|
||||
}
|
||||
bool dataFinished() const override {
|
||||
|
@ -202,8 +202,8 @@ protected:
|
|||
|
||||
private:
|
||||
not_null<PhotoData*> _data;
|
||||
int16 _pixw = 1;
|
||||
int16 _pixh = 1;
|
||||
qint16 _pixw = 1;
|
||||
qint16 _pixh = 1;
|
||||
Text _caption;
|
||||
|
||||
};
|
||||
|
@ -228,7 +228,7 @@ public:
|
|||
TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override WARN_UNUSED_RESULT {
|
||||
return _caption.adjustSelection(selection, type);
|
||||
}
|
||||
uint16 fullSelectionLength() const override {
|
||||
quint16 fullSelectionLength() const override {
|
||||
return _caption.length();
|
||||
}
|
||||
bool hasTextForCopy() const override {
|
||||
|
@ -239,7 +239,7 @@ public:
|
|||
QString inDialogsText() const override;
|
||||
TextWithEntities selectedText(TextSelection selection) const override;
|
||||
|
||||
int32 addToOverview(AddToOverviewMethod method) override;
|
||||
qint32 addToOverview(AddToOverviewMethod method) override;
|
||||
void eraseFromOverview() override;
|
||||
|
||||
DocumentData *getDocument() override {
|
||||
|
@ -276,7 +276,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
float64 dataProgress() const override {
|
||||
double dataProgress() const override {
|
||||
return _data->progress();
|
||||
}
|
||||
bool dataFinished() const override {
|
||||
|
@ -288,10 +288,10 @@ protected:
|
|||
|
||||
private:
|
||||
not_null<DocumentData*> _data;
|
||||
int32 _thumbw;
|
||||
qint32 _thumbw;
|
||||
Text _caption;
|
||||
|
||||
void setStatusSize(int32 newSize) const;
|
||||
void setStatusSize(qint32 newSize) const;
|
||||
void updateStatusText() const;
|
||||
|
||||
};
|
||||
|
@ -316,13 +316,13 @@ class HistoryDocument;
|
|||
struct HistoryDocumentVoicePlayback {
|
||||
HistoryDocumentVoicePlayback(const HistoryDocument *that);
|
||||
|
||||
int32 _position = 0;
|
||||
qint32 _position = 0;
|
||||
anim::value a_progress;
|
||||
BasicAnimation _a_progress;
|
||||
};
|
||||
class HistoryDocumentVoice : public RuntimeComponent<HistoryDocumentVoice> {
|
||||
// We don't use float64 because components should align to pointer even on 32bit systems.
|
||||
static constexpr float64 kFloatToIntMultiplier = 65536.;
|
||||
// We don't use double because components should align to pointer even on 32bit systems.
|
||||
static constexpr double kFloatToIntMultiplier = 65536.;
|
||||
|
||||
public:
|
||||
void ensurePlayback(const HistoryDocument *interfaces) const;
|
||||
|
@ -337,16 +337,16 @@ public:
|
|||
}
|
||||
void startSeeking();
|
||||
void stopSeeking();
|
||||
float64 seekingStart() const {
|
||||
double seekingStart() const {
|
||||
return _seekingStart / kFloatToIntMultiplier;
|
||||
}
|
||||
void setSeekingStart(float64 seekingStart) const {
|
||||
void setSeekingStart(double seekingStart) const {
|
||||
_seekingStart = qRound(seekingStart * kFloatToIntMultiplier);
|
||||
}
|
||||
float64 seekingCurrent() const {
|
||||
double seekingCurrent() const {
|
||||
return _seekingCurrent / kFloatToIntMultiplier;
|
||||
}
|
||||
void setSeekingCurrent(float64 seekingCurrent) {
|
||||
void setSeekingCurrent(double seekingCurrent) {
|
||||
_seekingCurrent = qRound(seekingCurrent * kFloatToIntMultiplier);
|
||||
}
|
||||
|
||||
|
@ -382,7 +382,7 @@ public:
|
|||
}
|
||||
return selection;
|
||||
}
|
||||
uint16 fullSelectionLength() const override {
|
||||
quint16 fullSelectionLength() const override {
|
||||
if (auto captioned = Get<HistoryDocumentCaptioned>()) {
|
||||
return captioned->_caption.length();
|
||||
}
|
||||
|
@ -396,7 +396,7 @@ public:
|
|||
QString inDialogsText() const override;
|
||||
TextWithEntities selectedText(TextSelection selection) const override;
|
||||
|
||||
int32 addToOverview(AddToOverviewMethod method) override;
|
||||
qint32 addToOverview(AddToOverviewMethod method) override;
|
||||
void eraseFromOverview() override;
|
||||
|
||||
bool uploading() const override {
|
||||
|
@ -440,12 +440,12 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void step_voiceProgress(float64 ms, bool timer);
|
||||
void step_voiceProgress(double ms, bool timer);
|
||||
|
||||
void clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed) override;
|
||||
|
||||
protected:
|
||||
float64 dataProgress() const override {
|
||||
double dataProgress() const override {
|
||||
return _data->progress();
|
||||
}
|
||||
bool dataFinished() const override {
|
||||
|
@ -459,7 +459,7 @@ private:
|
|||
void createComponents(bool caption);
|
||||
void fillNamedFromData(HistoryDocumentNamed *named);
|
||||
|
||||
void setStatusSize(int32 newSize, qint64 realDuration = 0) const;
|
||||
void setStatusSize(qint32 newSize, qint64 realDuration = 0) const;
|
||||
bool updateStatusText() const; // returns showPause
|
||||
|
||||
// Callback is a void(const QString &, const QString &, const Text &) functor.
|
||||
|
@ -491,7 +491,7 @@ public:
|
|||
TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override WARN_UNUSED_RESULT {
|
||||
return _caption.adjustSelection(selection, type);
|
||||
}
|
||||
uint16 fullSelectionLength() const override {
|
||||
quint16 fullSelectionLength() const override {
|
||||
return _caption.length();
|
||||
}
|
||||
bool hasTextForCopy() const override {
|
||||
|
@ -502,7 +502,7 @@ public:
|
|||
QString inDialogsText() const override;
|
||||
TextWithEntities selectedText(TextSelection selection) const override;
|
||||
|
||||
int32 addToOverview(AddToOverviewMethod method) override;
|
||||
qint32 addToOverview(AddToOverviewMethod method) override;
|
||||
void eraseFromOverview() override;
|
||||
|
||||
bool uploading() const override {
|
||||
|
@ -553,7 +553,7 @@ public:
|
|||
~HistoryGif();
|
||||
|
||||
protected:
|
||||
float64 dataProgress() const override;
|
||||
double dataProgress() const override;
|
||||
bool dataFinished() const override;
|
||||
bool dataLoaded() const override;
|
||||
|
||||
|
@ -572,14 +572,14 @@ private:
|
|||
|
||||
not_null<DocumentData*> _data;
|
||||
ClickHandlerPtr _openInMediaviewLink;
|
||||
int32 _thumbw = 1;
|
||||
int32 _thumbh = 1;
|
||||
qint32 _thumbw = 1;
|
||||
qint32 _thumbh = 1;
|
||||
Text _caption;
|
||||
|
||||
mutable std::unique_ptr<Media::Clip::Playback> _roundPlayback;
|
||||
Media::Clip::ReaderPointer _gif;
|
||||
|
||||
void setStatusSize(int32 newSize) const;
|
||||
void setStatusSize(qint32 newSize) const;
|
||||
void updateStatusText() const;
|
||||
|
||||
};
|
||||
|
@ -645,8 +645,8 @@ private:
|
|||
}
|
||||
QString toString() const;
|
||||
|
||||
int16 _pixw = 1;
|
||||
int16 _pixh = 1;
|
||||
qint16 _pixw = 1;
|
||||
qint16 _pixh = 1;
|
||||
ClickHandlerPtr _packLink;
|
||||
not_null<DocumentData*> _data;
|
||||
QString _emoji;
|
||||
|
@ -655,7 +655,7 @@ private:
|
|||
|
||||
class HistoryContact : public HistoryMedia {
|
||||
public:
|
||||
HistoryContact(not_null<HistoryItem*> parent, int32 userId, const QString &first, const QString &last, const QString &phone);
|
||||
HistoryContact(not_null<HistoryItem*> parent, qint32 userId, const QString &first, const QString &last, const QString &phone);
|
||||
HistoryMediaType type() const override {
|
||||
return MediaTypeContact;
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
int32 _userId = 0;
|
||||
qint32 _userId = 0;
|
||||
UserData *_contact = nullptr;
|
||||
|
||||
int _phonew = 0;
|
||||
|
@ -788,7 +788,7 @@ public:
|
|||
HistoryTextState getState(QPoint point, HistoryStateRequest request) const override;
|
||||
|
||||
TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override WARN_UNUSED_RESULT;
|
||||
uint16 fullSelectionLength() const override {
|
||||
quint16 fullSelectionLength() const override {
|
||||
return _title.length() + _description.length();
|
||||
}
|
||||
bool hasTextForCopy() const override {
|
||||
|
@ -863,16 +863,16 @@ private:
|
|||
std::unique_ptr<HistoryMedia> _attach;
|
||||
|
||||
bool _asArticle = false;
|
||||
int32 _titleLines, _descriptionLines;
|
||||
qint32 _titleLines, _descriptionLines;
|
||||
|
||||
Text _title, _description;
|
||||
int32 _siteNameWidth = 0;
|
||||
qint32 _siteNameWidth = 0;
|
||||
|
||||
QString _duration;
|
||||
int32 _durationWidth = 0;
|
||||
qint32 _durationWidth = 0;
|
||||
|
||||
int16 _pixw = 0;
|
||||
int16 _pixh = 0;
|
||||
qint16 _pixw = 0;
|
||||
qint16 _pixh = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -895,7 +895,7 @@ public:
|
|||
HistoryTextState getState(QPoint point, HistoryStateRequest request) const override;
|
||||
|
||||
TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override WARN_UNUSED_RESULT;
|
||||
uint16 fullSelectionLength() const override {
|
||||
quint16 fullSelectionLength() const override {
|
||||
return _title.length() + _description.length();
|
||||
}
|
||||
bool isAboveMessage() const override {
|
||||
|
@ -975,7 +975,7 @@ private:
|
|||
ClickHandlerPtr _openl;
|
||||
std::unique_ptr<HistoryMedia> _attach;
|
||||
|
||||
int32 _titleLines, _descriptionLines;
|
||||
qint32 _titleLines, _descriptionLines;
|
||||
|
||||
Text _title, _description;
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ public:
|
|||
HistoryTextState getState(QPoint point, HistoryStateRequest request) const override;
|
||||
|
||||
TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override WARN_UNUSED_RESULT;
|
||||
uint16 fullSelectionLength() const override {
|
||||
quint16 fullSelectionLength() const override {
|
||||
return _title.length() + _description.length();
|
||||
}
|
||||
bool hasTextForCopy() const override {
|
||||
|
@ -1089,13 +1089,13 @@ public:
|
|||
}
|
||||
|
||||
void initDimensions() override;
|
||||
int resizeGetHeight(int32 width) override;
|
||||
int resizeGetHeight(qint32 width) override;
|
||||
|
||||
void draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const override;
|
||||
HistoryTextState getState(QPoint point, HistoryStateRequest request) const override;
|
||||
|
||||
TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override WARN_UNUSED_RESULT;
|
||||
uint16 fullSelectionLength() const override {
|
||||
quint16 fullSelectionLength() const override {
|
||||
return _title.length() + _description.length();
|
||||
}
|
||||
bool hasTextForCopy() const override {
|
||||
|
@ -1134,7 +1134,7 @@ private:
|
|||
Text _title, _description;
|
||||
ClickHandlerPtr _link;
|
||||
|
||||
int32 fullWidth() const;
|
||||
int32 fullHeight() const;
|
||||
qint32 fullWidth() const;
|
||||
qint32 fullHeight() const;
|
||||
|
||||
};
|
||||
|
|
|
@ -331,7 +331,7 @@ void HistoryMessageVia::create(UserId userId) {
|
|||
});
|
||||
}
|
||||
|
||||
void HistoryMessageVia::resize(int32 availw) const {
|
||||
void HistoryMessageVia::resize(qint32 availw) const {
|
||||
if (availw < 0) {
|
||||
_text = QString();
|
||||
_width = 0;
|
||||
|
@ -457,13 +457,13 @@ void HistoryMessageReply::updateName() const {
|
|||
replyToName.setText(st::fwdTextStyle, name, _textNameOptions);
|
||||
replyToVersion = replyToMsg->author()->nameVersion;
|
||||
bool hasPreview = replyToMsg->getMedia() ? replyToMsg->getMedia()->hasReplyPreview() : false;
|
||||
int32 previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0;
|
||||
int32 w = replyToName.maxWidth();
|
||||
qint32 previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0;
|
||||
qint32 w = replyToName.maxWidth();
|
||||
if (_replyToVia) {
|
||||
w += st::msgServiceFont->spacew + _replyToVia->_maxWidth;
|
||||
}
|
||||
|
||||
_maxReplyWidth = previewSkip + qMax(w, qMin(replyToText.maxWidth(), int32(st::maxSignatureSize)));
|
||||
_maxReplyWidth = previewSkip + qMax(w, qMin(replyToText.maxWidth(), qint32(st::maxSignatureSize)));
|
||||
} else {
|
||||
_maxReplyWidth = st::msgDateFont->width(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message));
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ int HistoryMessage::KeyboardStyle::buttonRadius() const {
|
|||
return st::dateRadius;
|
||||
}
|
||||
|
||||
void HistoryMessage::KeyboardStyle::paintButtonBg(Painter &p, const QRect &rect, float64 howMuchOver) const {
|
||||
void HistoryMessage::KeyboardStyle::paintButtonBg(Painter &p, const QRect &rect, double howMuchOver) const {
|
||||
App::roundRect(p, rect, st::msgServiceBg, StickerCorners);
|
||||
if (howMuchOver > 0) {
|
||||
auto o = p.opacity();
|
||||
|
@ -823,7 +823,7 @@ bool HistoryMessage::displayFastShare() const {
|
|||
}
|
||||
|
||||
void HistoryMessage::createComponents(const CreateConfig &config) {
|
||||
uint64 mask = 0;
|
||||
quint64 mask = 0;
|
||||
if (config.replyTo) {
|
||||
mask |= HistoryMessageReply::Bit();
|
||||
}
|
||||
|
@ -900,7 +900,7 @@ void HistoryMessage::createComponents(const CreateConfig &config) {
|
|||
initTime();
|
||||
}
|
||||
|
||||
QString formatViewsCount(int32 views) {
|
||||
QString formatViewsCount(qint32 views) {
|
||||
if (views > 999999) {
|
||||
views /= 100000;
|
||||
if (views % 10) {
|
||||
|
@ -1024,7 +1024,7 @@ void HistoryMessage::initMediaFromDocument(DocumentData *doc, const QString &cap
|
|||
}
|
||||
}
|
||||
|
||||
int32 HistoryMessage::plainMaxWidth() const {
|
||||
qint32 HistoryMessage::plainMaxWidth() const {
|
||||
return st::msgPadding.left() + _text.maxWidth() + st::msgPadding.right();
|
||||
}
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ QRect HistoryMessage::countGeometry() const {
|
|||
return QRect(contentLeft, contentTop, contentWidth, _height - contentTop - marginBottom());
|
||||
}
|
||||
|
||||
void HistoryMessage::fromNameUpdated(int32 width) const {
|
||||
void HistoryMessage::fromNameUpdated(qint32 width) const {
|
||||
_authorNameVersion = author()->nameVersion;
|
||||
if (!Has<HistoryMessageForwarded>()) {
|
||||
if (auto via = Get<HistoryMessageVia>()) {
|
||||
|
@ -1265,10 +1265,10 @@ void HistoryMessage::updateMedia(const MTPMessageMedia *media) {
|
|||
setPendingInitDimensions();
|
||||
}
|
||||
|
||||
int32 HistoryMessage::addToOverview(AddToOverviewMethod method) {
|
||||
qint32 HistoryMessage::addToOverview(AddToOverviewMethod method) {
|
||||
if (!indexInOverview()) return 0;
|
||||
|
||||
int32 result = 0;
|
||||
qint32 result = 0;
|
||||
if (auto media = getMedia()) {
|
||||
result |= media->addToOverview(method);
|
||||
}
|
||||
|
@ -1476,12 +1476,12 @@ int HistoryMessage::timeLeft() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width, bool selected, InfoDisplayType type) const {
|
||||
void HistoryMessage::drawInfo(Painter &p, qint32 right, qint32 bottom, qint32 width, bool selected, InfoDisplayType type) const {
|
||||
p.setFont(st::msgDateFont);
|
||||
|
||||
bool outbg = out() && !isPost();
|
||||
bool invertedsprites = (type == InfoDisplayOverImage || type == InfoDisplayOverBackground);
|
||||
int32 infoRight = right, infoBottom = bottom;
|
||||
qint32 infoRight = right, infoBottom = bottom;
|
||||
switch (type) {
|
||||
case InfoDisplayDefault:
|
||||
infoRight -= st::msgPadding.right() - st::msgDateDelta.x();
|
||||
|
@ -1500,16 +1500,16 @@ void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width
|
|||
break;
|
||||
}
|
||||
|
||||
int32 infoW = HistoryMessage::infoWidth();
|
||||
qint32 infoW = HistoryMessage::infoWidth();
|
||||
if (rtl()) infoRight = width - infoRight + infoW;
|
||||
|
||||
int32 dateX = infoRight - infoW;
|
||||
int32 dateY = infoBottom - st::msgDateFont->height;
|
||||
qint32 dateX = infoRight - infoW;
|
||||
qint32 dateY = infoBottom - st::msgDateFont->height;
|
||||
if (type == InfoDisplayOverImage) {
|
||||
int32 dateW = infoW + 2 * st::msgDateImgPadding.x(), dateH = st::msgDateFont->height + 2 * st::msgDateImgPadding.y();
|
||||
qint32 dateW = infoW + 2 * st::msgDateImgPadding.x(), dateH = st::msgDateFont->height + 2 * st::msgDateImgPadding.y();
|
||||
App::roundRect(p, dateX - st::msgDateImgPadding.x(), dateY - st::msgDateImgPadding.y(), dateW, dateH, selected ? st::msgDateImgBgSelected : st::msgDateImgBg, selected ? DateSelectedCorners : DateCorners);
|
||||
} else if (type == InfoDisplayOverBackground) {
|
||||
int32 dateW = infoW + 2 * st::msgDateImgPadding.x(), dateH = st::msgDateFont->height + 2 * st::msgDateImgPadding.y();
|
||||
qint32 dateW = infoW + 2 * st::msgDateImgPadding.x(), dateH = st::msgDateFont->height + 2 * st::msgDateImgPadding.y();
|
||||
App::roundRect(p, dateX - st::msgDateImgPadding.x(), dateY - st::msgDateImgPadding.y(), dateW, dateH, selected ? st::msgServiceBgSelected : st::msgServiceBg, selected ? StickerSelectedCorners : StickerCorners);
|
||||
}
|
||||
dateX += HistoryMessage::timeLeft();
|
||||
|
@ -1557,11 +1557,11 @@ void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width
|
|||
}
|
||||
}
|
||||
|
||||
void HistoryMessage::setViewsCount(int32 count) {
|
||||
void HistoryMessage::setViewsCount(qint32 count) {
|
||||
auto views = Get<HistoryMessageViews>();
|
||||
if (!views || views->_views == count || (count >= 0 && views->_views > count)) return;
|
||||
|
||||
int32 was = views->_viewsWidth;
|
||||
qint32 was = views->_viewsWidth;
|
||||
views->_views = count;
|
||||
views->_viewsText = (views->_views >= 0) ? formatViewsCount(views->_views) : QString();
|
||||
views->_viewsWidth = views->_viewsText.isEmpty() ? 0 : st::msgDateFont->width(views->_viewsText);
|
||||
|
@ -1623,7 +1623,7 @@ void HistoryMessage::draw(Painter &p, QRect clip, TextSelection selection, TimeM
|
|||
auto skiptop = top - fill;
|
||||
auto fillheight = fill + g.height() + fill;
|
||||
|
||||
auto dt = (animms > st::activeFadeInDuration) ? (1. - (animms - st::activeFadeInDuration) / float64(st::activeFadeOutDuration)) : (animms / float64(st::activeFadeInDuration));
|
||||
auto dt = (animms > st::activeFadeInDuration) ? (1. - (animms - st::activeFadeInDuration) / double(st::activeFadeOutDuration)) : (animms / double(st::activeFadeInDuration));
|
||||
auto o = p.opacity();
|
||||
p.setOpacity(o * dt);
|
||||
p.fillRect(0, skiptop, width(), fillheight, st::defaultTextPalette.selectOverlay);
|
||||
|
@ -1781,7 +1781,7 @@ void HistoryMessage::paintForwardedInfo(Painter &p, QRect &trect, bool selected)
|
|||
|
||||
void HistoryMessage::paintReplyInfo(Painter &p, QRect &trect, bool selected) const {
|
||||
if (auto reply = Get<HistoryMessageReply>()) {
|
||||
int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
qint32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
|
||||
auto flags = HistoryMessageReply::PaintFlag::InBubble | 0;
|
||||
if (selected) {
|
||||
|
@ -2173,7 +2173,7 @@ bool HistoryMessage::getStateForwardedInfo(QPoint point, QRect &trect, HistoryTe
|
|||
|
||||
bool HistoryMessage::getStateReplyInfo(QPoint point, QRect &trect, HistoryTextState *outResult) const {
|
||||
if (auto reply = Get<HistoryMessageReply>()) {
|
||||
int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
qint32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
if (point.y() >= trect.top() && point.y() < trect.top() + h) {
|
||||
if (reply->replyToMsg && QRect(trect.x(), trect.y() + st::msgReplyPadding.top(), trect.width(), st::msgReplyBarSize.height()).contains(point)) {
|
||||
outResult->link = reply->replyToLink();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue