mirror of https://github.com/procxx/kepka.git
Merge branch 'master' into dev
This commit is contained in:
commit
281f762869
|
@ -20,8 +20,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
static const int32 AppVersion = 9031;
|
static const int32 AppVersion = 9032;
|
||||||
static const wchar_t *AppVersionStr = L"0.9.31";
|
static const wchar_t *AppVersionStr = L"0.9.32";
|
||||||
static const bool DevVersion = false;
|
static const bool DevVersion = false;
|
||||||
//#define BETA_VERSION (9030002ULL) // just comment this line to build public version
|
//#define BETA_VERSION (9030002ULL) // just comment this line to build public version
|
||||||
|
|
||||||
|
|
|
@ -852,16 +852,19 @@ HistoryItem *ChannelHistory::addNewToBlocks(const MTPMessage &msg, NewMessageTyp
|
||||||
clear(true);
|
clear(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryBlock *to = 0;
|
HistoryBlock *to = nullptr;
|
||||||
bool newBlock = blocks.isEmpty();
|
bool newBlock = blocks.isEmpty();
|
||||||
if (newBlock) {
|
if (newBlock) {
|
||||||
to = new HistoryBlock(this);
|
to = new HistoryBlock(this);
|
||||||
} else {
|
} else {
|
||||||
to = blocks.back();
|
to = blocks.back();
|
||||||
|
t_assert(!to->items.isEmpty());
|
||||||
|
t_assert(to->items.back() != nullptr);
|
||||||
}
|
}
|
||||||
HistoryItem *item = createItem((type == NewMessageLast) ? 0 : to, msg, (type == NewMessageUnread));
|
HistoryItem *item = createItem((type == NewMessageLast) ? nullptr : to, msg, (type == NewMessageUnread));
|
||||||
if (type == NewMessageLast) {
|
if (type == NewMessageLast && item) {
|
||||||
if (!item->detached()) {
|
if (!item->detached()) {
|
||||||
|
t_assert(!newBlock);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
item->attach(to);
|
item->attach(to);
|
||||||
|
@ -896,10 +899,8 @@ void ChannelHistory::switchMode() {
|
||||||
OtherList savedList;
|
OtherList savedList;
|
||||||
if (!blocks.isEmpty()) {
|
if (!blocks.isEmpty()) {
|
||||||
savedList.reserve(((blocks.size() - 2) * MessagesPerPage + blocks.back()->items.size()) * (onlyImportant() ? 2 : 1));
|
savedList.reserve(((blocks.size() - 2) * MessagesPerPage + blocks.back()->items.size()) * (onlyImportant() ? 2 : 1));
|
||||||
for (Blocks::const_iterator i = blocks.cbegin(), e = blocks.cend(); i != e; ++i) {
|
for_const (const HistoryBlock *block, blocks) {
|
||||||
HistoryBlock *block = *i;
|
for_const (HistoryItem *item, block->items) {
|
||||||
for (HistoryBlock::Items::const_iterator j = block->items.cbegin(), end = block->items.cend(); j != end; ++j) {
|
|
||||||
HistoryItem *item = *j;
|
|
||||||
HistoryItemType itemType = item->type();
|
HistoryItemType itemType = item->type();
|
||||||
if (itemType == HistoryItemMsg || itemType == HistoryItemGroup) {
|
if (itemType == HistoryItemMsg || itemType == HistoryItemGroup) {
|
||||||
savedList.push_back(item);
|
savedList.push_back(item);
|
||||||
|
@ -994,7 +995,7 @@ HistoryBlock *ChannelHistory::findGroupBlock(MsgId msgId) const { // find block
|
||||||
if (blocks.size() > 1) for (int32 minBlock = 0, maxBlock = blocks.size();;) {
|
if (blocks.size() > 1) for (int32 minBlock = 0, maxBlock = blocks.size();;) {
|
||||||
for (int32 startCheckBlock = (minBlock + maxBlock) / 2, checkBlock = startCheckBlock;;) {
|
for (int32 startCheckBlock = (minBlock + maxBlock) / 2, checkBlock = startCheckBlock;;) {
|
||||||
HistoryBlock *block = blocks.at(checkBlock);
|
HistoryBlock *block = blocks.at(checkBlock);
|
||||||
HistoryBlock::Items::const_iterator i = block->items.cbegin(), e = block->items.cend();
|
auto i = block->items.cbegin(), e = block->items.cend();
|
||||||
for (; i != e; ++i) { // out msgs could be a mess in monotonic ids
|
for (; i != e; ++i) { // out msgs could be a mess in monotonic ids
|
||||||
if (((*i)->id > 0 && !(*i)->out()) || (*i)->type() == HistoryItemGroup) {
|
if (((*i)->id > 0 && !(*i)->out()) || (*i)->type() == HistoryItemGroup) {
|
||||||
MsgId threshold = ((*i)->id > 0) ? (*i)->id : static_cast<HistoryGroup*>(*i)->minId();
|
MsgId threshold = ((*i)->id > 0) ? (*i)->id : static_cast<HistoryGroup*>(*i)->minId();
|
||||||
|
@ -1106,6 +1107,12 @@ void ChannelHistory::messageWithIdDeleted(MsgId msgId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelHistory::~ChannelHistory() {
|
||||||
|
// all items must be destroyed before ChannelHistory is destroyed
|
||||||
|
// or they will call history()->asChannelHistory() -> undefined behaviour
|
||||||
|
clearOnDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
bool DialogsList::del(const PeerId &peerId, DialogRow *replacedBy) {
|
bool DialogsList::del(const PeerId &peerId, DialogRow *replacedBy) {
|
||||||
RowByPeer::iterator i = rowByPeer.find(peerId);
|
RowByPeer::iterator i = rowByPeer.find(peerId);
|
||||||
if (i == rowByPeer.cend()) return false;
|
if (i == rowByPeer.cend()) return false;
|
||||||
|
@ -1299,7 +1306,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPMessage &msg, boo
|
||||||
case mtpc_message: msgId = msg.c_message().vid.v; break;
|
case mtpc_message: msgId = msg.c_message().vid.v; break;
|
||||||
case mtpc_messageService: msgId = msg.c_messageService().vid.v; break;
|
case mtpc_messageService: msgId = msg.c_messageService().vid.v; break;
|
||||||
}
|
}
|
||||||
if (!msgId) return 0;
|
if (!msgId) return nullptr;
|
||||||
|
|
||||||
HistoryItem *result = App::histItemById(channelId(), msgId);
|
HistoryItem *result = App::histItemById(channelId(), msgId);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -1574,6 +1581,8 @@ HistoryItem *History::addNewService(MsgId msgId, QDateTime date, const QString &
|
||||||
to = new HistoryBlock(this);
|
to = new HistoryBlock(this);
|
||||||
} else {
|
} else {
|
||||||
to = blocks.back();
|
to = blocks.back();
|
||||||
|
t_assert(!to->items.isEmpty());
|
||||||
|
t_assert(to->items.back() != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryItem *result = new HistoryServiceMsg(this, to, msgId, date, text, flags, media);
|
HistoryItem *result = new HistoryServiceMsg(this, to, msgId, date, text, flags, media);
|
||||||
|
@ -1595,16 +1604,19 @@ HistoryItem *History::addNewMessage(const MTPMessage &msg, NewMessageType type)
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryBlock *to = 0;
|
HistoryBlock *to = nullptr;
|
||||||
bool newBlock = blocks.isEmpty();
|
bool newBlock = blocks.isEmpty();
|
||||||
if (newBlock) {
|
if (newBlock) {
|
||||||
to = new HistoryBlock(this);
|
to = new HistoryBlock(this);
|
||||||
} else {
|
} else {
|
||||||
to = blocks.back();
|
to = blocks.back();
|
||||||
|
t_assert(!to->items.isEmpty());
|
||||||
|
t_assert(to->items.back() != nullptr);
|
||||||
}
|
}
|
||||||
HistoryItem *item = createItem((type == NewMessageLast) ? 0 : to, msg, (type == NewMessageUnread));
|
HistoryItem *item = createItem((type == NewMessageLast) ? nullptr : to, msg, (type == NewMessageUnread));
|
||||||
if (type == NewMessageLast) {
|
if (type == NewMessageLast && item) {
|
||||||
if (!item->detached()) {
|
if (!item->detached()) {
|
||||||
|
t_assert(!newBlock);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
item->attach(to);
|
item->attach(to);
|
||||||
|
@ -1613,16 +1625,18 @@ HistoryItem *History::addNewMessage(const MTPMessage &msg, NewMessageType type)
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryItem *History::addToHistory(const MTPMessage &msg) {
|
HistoryItem *History::addToHistory(const MTPMessage &msg) {
|
||||||
return createItem(0, msg, false);
|
return createItem(nullptr, msg, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryItem *History::addNewForwarded(MsgId id, int32 flags, QDateTime date, int32 from, HistoryMessage *item) {
|
HistoryItem *History::addNewForwarded(MsgId id, int32 flags, QDateTime date, int32 from, HistoryMessage *item) {
|
||||||
HistoryBlock *to = 0;
|
HistoryBlock *to = nullptr;
|
||||||
bool newBlock = blocks.isEmpty();
|
bool newBlock = blocks.isEmpty();
|
||||||
if (newBlock) {
|
if (newBlock) {
|
||||||
to = new HistoryBlock(this);
|
to = new HistoryBlock(this);
|
||||||
} else {
|
} else {
|
||||||
to = blocks.back();
|
to = blocks.back();
|
||||||
|
t_assert(!to->items.isEmpty());
|
||||||
|
t_assert(to->items.back() != nullptr);
|
||||||
}
|
}
|
||||||
return addNewItem(to, newBlock, createItemForwarded(to, id, flags, date, from, item), true);
|
return addNewItem(to, newBlock, createItemForwarded(to, id, flags, date, from, item), true);
|
||||||
}
|
}
|
||||||
|
@ -1634,6 +1648,8 @@ HistoryItem *History::addNewDocument(MsgId id, int32 flags, int32 viaBotId, MsgI
|
||||||
to = new HistoryBlock(this);
|
to = new HistoryBlock(this);
|
||||||
} else {
|
} else {
|
||||||
to = blocks.back();
|
to = blocks.back();
|
||||||
|
t_assert(!to->items.isEmpty());
|
||||||
|
t_assert(to->items.back() != nullptr);
|
||||||
}
|
}
|
||||||
return addNewItem(to, newBlock, createItemDocument(to, id, flags, viaBotId, replyTo, date, from, doc, caption), true);
|
return addNewItem(to, newBlock, createItemDocument(to, id, flags, viaBotId, replyTo, date, from, doc, caption), true);
|
||||||
}
|
}
|
||||||
|
@ -1645,6 +1661,8 @@ HistoryItem *History::addNewPhoto(MsgId id, int32 flags, int32 viaBotId, MsgId r
|
||||||
to = new HistoryBlock(this);
|
to = new HistoryBlock(this);
|
||||||
} else {
|
} else {
|
||||||
to = blocks.back();
|
to = blocks.back();
|
||||||
|
t_assert(!to->items.isEmpty());
|
||||||
|
t_assert(to->items.back() != nullptr);
|
||||||
}
|
}
|
||||||
return addNewItem(to, newBlock, createItemPhoto(to, id, flags, viaBotId, replyTo, date, from, photo, caption), true);
|
return addNewItem(to, newBlock, createItemPhoto(to, id, flags, viaBotId, replyTo, date, from, photo, caption), true);
|
||||||
}
|
}
|
||||||
|
@ -1913,10 +1931,10 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice, const QVector<MTPM
|
||||||
|
|
||||||
const MTPMessageGroup *groupsBegin = (isChannel() && collapsed) ? collapsed->constData() : 0, *groupsIt = groupsBegin, *groupsEnd = (isChannel() && collapsed) ? (groupsBegin + collapsed->size()) : 0;
|
const MTPMessageGroup *groupsBegin = (isChannel() && collapsed) ? collapsed->constData() : 0, *groupsIt = groupsBegin, *groupsEnd = (isChannel() && collapsed) ? (groupsBegin + collapsed->size()) : 0;
|
||||||
|
|
||||||
HistoryItem *oldFirst = 0, *last = 0;
|
HistoryItem *oldFirst = nullptr, *last = nullptr;
|
||||||
HistoryBlock *block = new HistoryBlock(this);
|
HistoryBlock *block = new HistoryBlock(this);
|
||||||
block->items.reserve(slice.size() + (collapsed ? collapsed->size() : 0));
|
block->items.reserve(slice.size() + (collapsed ? collapsed->size() : 0));
|
||||||
for (QVector<MTPmessage>::const_iterator i = slice.cend(), e = slice.cbegin(); i != e;) {
|
for (auto i = slice.cend(), e = slice.cbegin(); i != e;) {
|
||||||
--i;
|
--i;
|
||||||
HistoryItem *adding = createItem(block, *i, false);
|
HistoryItem *adding = createItem(block, *i, false);
|
||||||
if (!adding) continue;
|
if (!adding) continue;
|
||||||
|
@ -2079,11 +2097,11 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice, const QVector<MTPM
|
||||||
if (!slice.isEmpty() || (isChannel() && collapsed && !collapsed->isEmpty())) {
|
if (!slice.isEmpty() || (isChannel() && collapsed && !collapsed->isEmpty())) {
|
||||||
const MTPMessageGroup *groupsBegin = (isChannel() && collapsed) ? collapsed->constData() : 0, *groupsIt = groupsBegin, *groupsEnd = (isChannel() && collapsed) ? (groupsBegin + collapsed->size()) : 0;
|
const MTPMessageGroup *groupsBegin = (isChannel() && collapsed) ? collapsed->constData() : 0, *groupsIt = groupsBegin, *groupsEnd = (isChannel() && collapsed) ? (groupsBegin + collapsed->size()) : 0;
|
||||||
|
|
||||||
HistoryItem *prev = blocks.isEmpty() ? 0 : blocks.back()->items.back();
|
HistoryItem *prev = blocks.isEmpty() ? nullptr : blocks.back()->items.back();
|
||||||
|
|
||||||
HistoryBlock *block = new HistoryBlock(this);
|
HistoryBlock *block = new HistoryBlock(this);
|
||||||
block->items.reserve(slice.size() + (collapsed ? collapsed->size() : 0));
|
block->items.reserve(slice.size() + (collapsed ? collapsed->size() : 0));
|
||||||
for (QVector<MTPmessage>::const_iterator i = slice.cend(), e = slice.cbegin(); i != e;) {
|
for (auto i = slice.cend(), e = slice.cbegin(); i != e;) {
|
||||||
--i;
|
--i;
|
||||||
HistoryItem *adding = createItem(block, *i, false);
|
HistoryItem *adding = createItem(block, *i, false);
|
||||||
if (!adding) continue;
|
if (!adding) continue;
|
||||||
|
@ -2148,9 +2166,9 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice, const QVector<MTPM
|
||||||
|
|
||||||
int32 History::countUnread(MsgId upTo) {
|
int32 History::countUnread(MsgId upTo) {
|
||||||
int32 result = 0;
|
int32 result = 0;
|
||||||
for (Blocks::const_iterator i = blocks.cend(), e = blocks.cbegin(); i != e;) {
|
for (auto i = blocks.cend(), e = blocks.cbegin(); i != e;) {
|
||||||
--i;
|
--i;
|
||||||
for (HistoryBlock::Items::const_iterator j = (*i)->items.cend(), en = (*i)->items.cbegin(); j != en;) {
|
for (auto j = (*i)->items.cend(), en = (*i)->items.cbegin(); j != en;) {
|
||||||
--j;
|
--j;
|
||||||
if ((*j)->id > 0 && (*j)->id <= upTo) {
|
if ((*j)->id > 0 && (*j)->id <= upTo) {
|
||||||
break;
|
break;
|
||||||
|
@ -2165,9 +2183,9 @@ int32 History::countUnread(MsgId upTo) {
|
||||||
void History::updateShowFrom() {
|
void History::updateShowFrom() {
|
||||||
if (showFrom) return;
|
if (showFrom) return;
|
||||||
|
|
||||||
for (Blocks::const_iterator i = blocks.cend(); i != blocks.cbegin();) {
|
for (auto i = blocks.cend(); i != blocks.cbegin();) {
|
||||||
--i;
|
--i;
|
||||||
for (HistoryBlock::Items::const_iterator j = (*i)->items.cend(); j != (*i)->items.cbegin();) {
|
for (auto j = (*i)->items.cend(); j != (*i)->items.cbegin();) {
|
||||||
--j;
|
--j;
|
||||||
if ((*j)->type() == HistoryItemMsg && (*j)->id > 0 && (!(*j)->out() || !showFrom)) {
|
if ((*j)->type() == HistoryItemMsg && (*j)->id > 0 && (!(*j)->out() || !showFrom)) {
|
||||||
if ((*j)->id >= inboxReadBefore) {
|
if ((*j)->id >= inboxReadBefore) {
|
||||||
|
@ -2463,10 +2481,10 @@ void History::fixLastMessage(bool wasAtBottom) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgId History::minMsgId() const {
|
MsgId History::minMsgId() const {
|
||||||
for (Blocks::const_iterator i = blocks.cbegin(), e = blocks.cend(); i != e; ++i) {
|
for_const (const HistoryBlock *block, blocks) {
|
||||||
for (HistoryBlock::Items::const_iterator j = (*i)->items.cbegin(), en = (*i)->items.cend(); j != en; ++j) {
|
for_const (const HistoryItem *item, block->items) {
|
||||||
if ((*j)->id > 0) {
|
if (item->id > 0) {
|
||||||
return (*j)->id;
|
return item->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2474,9 +2492,9 @@ MsgId History::minMsgId() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgId History::maxMsgId() const {
|
MsgId History::maxMsgId() const {
|
||||||
for (Blocks::const_iterator i = blocks.cend(), e = blocks.cbegin(); i != e;) {
|
for (auto i = blocks.cend(), e = blocks.cbegin(); i != e;) {
|
||||||
--i;
|
--i;
|
||||||
for (HistoryBlock::Items::const_iterator j = (*i)->items.cend(), en = (*i)->items.cbegin(); j != en;) {
|
for (auto j = (*i)->items.cend(), en = (*i)->items.cbegin(); j != en;) {
|
||||||
--j;
|
--j;
|
||||||
if ((*j)->id > 0) {
|
if ((*j)->id > 0) {
|
||||||
return (*j)->id;
|
return (*j)->id;
|
||||||
|
@ -2547,14 +2565,7 @@ void History::clear(bool leaveItems) {
|
||||||
if (App::wnd() && !App::quitting()) App::wnd()->mediaOverviewUpdated(peer, MediaOverviewType(i));
|
if (App::wnd() && !App::quitting()) App::wnd()->mediaOverviewUpdated(peer, MediaOverviewType(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Blocks lst = blocks;
|
clearBlocks(leaveItems);
|
||||||
blocks.clear();
|
|
||||||
for (Blocks::const_iterator i = lst.cbegin(), e = lst.cend(); i != e; ++i) {
|
|
||||||
if (leaveItems) {
|
|
||||||
(*i)->clear(true);
|
|
||||||
}
|
|
||||||
delete *i;
|
|
||||||
}
|
|
||||||
if (leaveItems) {
|
if (leaveItems) {
|
||||||
lastKeyboardInited = false;
|
lastKeyboardInited = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2574,6 +2585,21 @@ void History::clear(bool leaveItems) {
|
||||||
if (leaveItems && App::main()) App::main()->historyCleared(this);
|
if (leaveItems && App::main()) App::main()->historyCleared(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void History::clearBlocks(bool leaveItems) {
|
||||||
|
Blocks lst;
|
||||||
|
std::swap(lst, blocks);
|
||||||
|
for_const (HistoryBlock *block, lst) {
|
||||||
|
if (leaveItems) {
|
||||||
|
block->clear(true);
|
||||||
|
}
|
||||||
|
delete block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void History::clearOnDestroy() {
|
||||||
|
clearBlocks(false);
|
||||||
|
}
|
||||||
|
|
||||||
QPair<int32, int32> History::adjustByPosInChatsList(DialogsIndexed &indexed) {
|
QPair<int32, int32> History::adjustByPosInChatsList(DialogsIndexed &indexed) {
|
||||||
int32 movedFrom = _chatListLinks[0]->pos * st::dlgHeight;
|
int32 movedFrom = _chatListLinks[0]->pos * st::dlgHeight;
|
||||||
indexed.adjustByPos(_chatListLinks);
|
indexed.adjustByPos(_chatListLinks);
|
||||||
|
@ -2716,12 +2742,6 @@ void History::blockResized(HistoryBlock *block, int32 dh) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void History::clearUpto(MsgId msgId) {
|
|
||||||
for (HistoryItem *item = isEmpty() ? 0 : blocks.back()->items.back(); item && (item->id < 0 || item->id >= msgId); item = isEmpty() ? 0 : blocks.back()->items.back()) {
|
|
||||||
item->destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void History::removeBlock(HistoryBlock *block) {
|
void History::removeBlock(HistoryBlock *block) {
|
||||||
int32 i = blocks.indexOf(block), h = block->height;
|
int32 i = blocks.indexOf(block), h = block->height;
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
|
@ -2741,15 +2761,14 @@ void History::removeBlock(HistoryBlock *block) {
|
||||||
}
|
}
|
||||||
|
|
||||||
History::~History() {
|
History::~History() {
|
||||||
clear();
|
clearOnDestroy();
|
||||||
deleteAndMark(msgDraft);
|
deleteAndMark(msgDraft);
|
||||||
deleteAndMark(editDraft);
|
deleteAndMark(editDraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 HistoryBlock::geomResize(int32 newWidth, int32 *ytransform, const HistoryItem *resizedItem) {
|
int32 HistoryBlock::geomResize(int32 newWidth, int32 *ytransform, const HistoryItem *resizedItem) {
|
||||||
int32 y = 0;
|
int32 y = 0;
|
||||||
for (Items::iterator i = items.begin(), e = items.end(); i != e; ++i) {
|
for_const (HistoryItem *item , items) {
|
||||||
HistoryItem *item = *i;
|
|
||||||
bool updTransform = ytransform && (*ytransform >= item->y) && (*ytransform < item->y + item->height());
|
bool updTransform = ytransform && (*ytransform >= item->y) && (*ytransform < item->y + item->height());
|
||||||
if (updTransform) *ytransform -= item->y;
|
if (updTransform) *ytransform -= item->y;
|
||||||
item->y = y;
|
item->y = y;
|
||||||
|
@ -2768,15 +2787,16 @@ int32 HistoryBlock::geomResize(int32 newWidth, int32 *ytransform, const HistoryI
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryBlock::clear(bool leaveItems) {
|
void HistoryBlock::clear(bool leaveItems) {
|
||||||
Items lst = items;
|
Items lst;
|
||||||
items.clear();
|
std::swap(lst, items);
|
||||||
|
|
||||||
if (leaveItems) {
|
if (leaveItems) {
|
||||||
for (Items::const_iterator i = lst.cbegin(), e = lst.cend(); i != e; ++i) {
|
for_const (HistoryItem *item, lst) {
|
||||||
(*i)->detachFast();
|
item->detachFast();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Items::const_iterator i = lst.cbegin(), e = lst.cend(); i != e; ++i) {
|
for_const (HistoryItem *item, lst) {
|
||||||
delete *i;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,6 @@ public:
|
||||||
return blocks.isEmpty();
|
return blocks.isEmpty();
|
||||||
}
|
}
|
||||||
void clear(bool leaveItems = false);
|
void clear(bool leaveItems = false);
|
||||||
void clearUpto(MsgId msgId);
|
|
||||||
void blockResized(HistoryBlock *block, int32 dh);
|
void blockResized(HistoryBlock *block, int32 dh);
|
||||||
void removeBlock(HistoryBlock *block);
|
void removeBlock(HistoryBlock *block);
|
||||||
|
|
||||||
|
@ -315,7 +314,7 @@ public:
|
||||||
|
|
||||||
void removeNotification(HistoryItem *item) {
|
void removeNotification(HistoryItem *item) {
|
||||||
if (!notifies.isEmpty()) {
|
if (!notifies.isEmpty()) {
|
||||||
for (NotifyQueue::iterator i = notifies.begin(), e = notifies.end(); i != e; ++i) {
|
for (auto i = notifies.begin(), e = notifies.end(); i != e; ++i) {
|
||||||
if ((*i) == item) {
|
if ((*i) == item) {
|
||||||
notifies.erase(i);
|
notifies.erase(i);
|
||||||
break;
|
break;
|
||||||
|
@ -429,6 +428,10 @@ public:
|
||||||
|
|
||||||
void changeMsgId(MsgId oldId, MsgId newId);
|
void changeMsgId(MsgId oldId, MsgId newId);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void clearOnDestroy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ChatListLinksMap _chatListLinks;
|
ChatListLinksMap _chatListLinks;
|
||||||
|
@ -438,6 +441,8 @@ private:
|
||||||
MediaOverviewIds overviewIds[OverviewCount];
|
MediaOverviewIds overviewIds[OverviewCount];
|
||||||
int32 overviewCountData[OverviewCount]; // -1 - not loaded, 0 - all loaded, > 0 - count, but not all loaded
|
int32 overviewCountData[OverviewCount]; // -1 - not loaded, 0 - all loaded, > 0 - count, but not all loaded
|
||||||
|
|
||||||
|
void clearBlocks(bool leaveItems);
|
||||||
|
|
||||||
friend class HistoryBlock;
|
friend class HistoryBlock;
|
||||||
friend class ChannelHistory;
|
friend class ChannelHistory;
|
||||||
|
|
||||||
|
@ -448,6 +453,8 @@ private:
|
||||||
HistoryItem *addMessageGroupAfterPrevToBlock(const MTPDmessageGroup &group, HistoryItem *prev, HistoryBlock *block);
|
HistoryItem *addMessageGroupAfterPrevToBlock(const MTPDmessageGroup &group, HistoryItem *prev, HistoryBlock *block);
|
||||||
HistoryItem *addMessageGroupAfterPrev(HistoryItem *newItem, HistoryItem *prev);
|
HistoryItem *addMessageGroupAfterPrev(HistoryItem *newItem, HistoryItem *prev);
|
||||||
|
|
||||||
|
History(const History &) = delete;
|
||||||
|
History &operator=(const History &) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HistoryGroup;
|
class HistoryGroup;
|
||||||
|
@ -490,6 +497,8 @@ public:
|
||||||
void checkJoinedMessage(bool createUnread = false);
|
void checkJoinedMessage(bool createUnread = false);
|
||||||
const QDateTime &maxReadMessageDate();
|
const QDateTime &maxReadMessageDate();
|
||||||
|
|
||||||
|
~ChannelHistory();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
friend class History;
|
friend class History;
|
||||||
|
@ -815,6 +824,9 @@ public:
|
||||||
int32 geomResize(int32 newWidth, int32 *ytransform, const HistoryItem *resizedItem); // return new size
|
int32 geomResize(int32 newWidth, int32 *ytransform, const HistoryItem *resizedItem); // return new size
|
||||||
int32 y, height;
|
int32 y, height;
|
||||||
History *history;
|
History *history;
|
||||||
|
|
||||||
|
HistoryBlock(const HistoryBlock &) = delete;
|
||||||
|
HistoryBlock &operator=(const HistoryBlock &) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HistoryElem {
|
class HistoryElem {
|
||||||
|
@ -1198,9 +1210,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
HistoryItem(const HistoryItem &);
|
|
||||||
HistoryItem &operator=(const HistoryItem &);
|
|
||||||
|
|
||||||
PeerData *_from;
|
PeerData *_from;
|
||||||
History *_history;
|
History *_history;
|
||||||
HistoryBlock *_block;
|
HistoryBlock *_block;
|
||||||
|
@ -1208,6 +1217,8 @@ protected:
|
||||||
|
|
||||||
mutable int32 _authorNameVersion;
|
mutable int32 _authorNameVersion;
|
||||||
|
|
||||||
|
HistoryItem(const HistoryItem &) = delete;
|
||||||
|
HistoryItem &operator=(const HistoryItem &) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageLink : public ITextLink {
|
class MessageLink : public ITextLink {
|
||||||
|
|
|
@ -1465,7 +1465,7 @@ HistoryItem *HistoryInner::prevItem(HistoryItem *item) {
|
||||||
if (blockIndex > 0) {
|
if (blockIndex > 0) {
|
||||||
return item->history()->blocks[blockIndex - 1]->items.back();
|
return item->history()->blocks[blockIndex - 1]->items.back();
|
||||||
}
|
}
|
||||||
if (item->history() == _history && _migrated && _history->loadedAtTop() && _migrated->loadedAtBottom() && !_migrated->isEmpty()) {
|
if (item->history() == _history && _migrated && _history->loadedAtTop() && !_migrated->isEmpty() && _migrated->loadedAtBottom()) {
|
||||||
return _migrated->blocks.back()->items.back();
|
return _migrated->blocks.back()->items.back();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3133,7 +3133,7 @@ void HistoryWidget::sendActionDone(const MTPBool &result, mtpRequestId req) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::activate() {
|
void HistoryWidget::activate() {
|
||||||
if (_history) updateListSize(0, true);
|
if (_history) updateListSize(true);
|
||||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3239,7 +3239,7 @@ void HistoryWidget::notify_clipStopperHidden(ClipStopperType type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::notify_historyItemResized(const HistoryItem *row, bool scrollToIt) {
|
void HistoryWidget::notify_historyItemResized(const HistoryItem *row, bool scrollToIt) {
|
||||||
updateListSize(0, false, false, row, scrollToIt);
|
updateListSize(false, false, { ScrollChangeNone, 0 }, row, scrollToIt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::cmd_search() {
|
void HistoryWidget::cmd_search() {
|
||||||
|
@ -4955,7 +4955,7 @@ void HistoryWidget::doneShow() {
|
||||||
updateReportSpamStatus();
|
updateReportSpamStatus();
|
||||||
updateBotKeyboard();
|
updateBotKeyboard();
|
||||||
updateControlsVisibility();
|
updateControlsVisibility();
|
||||||
updateListSize(0, true);
|
updateListSize(true);
|
||||||
onListScroll();
|
onListScroll();
|
||||||
if (App::wnd()) {
|
if (App::wnd()) {
|
||||||
App::wnd()->checkHistoryActivation();
|
App::wnd()->checkHistoryActivation();
|
||||||
|
@ -6217,7 +6217,7 @@ void HistoryWidget::resizeEvent(QResizeEvent *e) {
|
||||||
_attachPhoto.move(_attachDocument.x(), _attachDocument.y());
|
_attachPhoto.move(_attachDocument.x(), _attachDocument.y());
|
||||||
|
|
||||||
_fieldBarCancel.move(width() - _fieldBarCancel.width(), _field.y() - st::sendPadding - _fieldBarCancel.height());
|
_fieldBarCancel.move(width() - _fieldBarCancel.width(), _field.y() - st::sendPadding - _fieldBarCancel.height());
|
||||||
updateListSize(App::main() ? App::main()->contentScrollAddToY() : 0);
|
updateListSize(false, false, { ScrollChangeAdd, App::main() ? App::main()->contentScrollAddToY() : 0 });
|
||||||
|
|
||||||
bool kbShowShown = _history && !_kbShown && _keyboard.hasMarkup();
|
bool kbShowShown = _history && !_kbShown && _keyboard.hasMarkup();
|
||||||
_field.resize(width() - _send.width() - _attachDocument.width() - _attachEmoji.width() - (kbShowShown ? _kbShow.width() : 0) - (_cmdStartShown ? _cmdStart.width() : 0) - (hasBroadcastToggle() ? _broadcast.width() : 0) - (hasSilentToggle() ? _silent.width() : 0), _field.height());
|
_field.resize(width() - _send.width() - _attachDocument.width() - _attachEmoji.width() - (kbShowShown ? _kbShow.width() : 0) - (_cmdStartShown ? _cmdStart.width() : 0) - (hasBroadcastToggle() ? _broadcast.width() : 0) - (hasSilentToggle() ? _silent.width() : 0), _field.height());
|
||||||
|
@ -6303,7 +6303,7 @@ MsgId HistoryWidget::replyToId() const {
|
||||||
return _replyToId ? _replyToId : (_kbReplyTo ? _kbReplyTo->id : 0);
|
return _replyToId ? _replyToId : (_kbReplyTo ? _kbReplyTo->id : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown, const HistoryItem *resizedItem, bool scrollToIt) {
|
void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollChange &change, const HistoryItem *resizedItem, bool scrollToIt) {
|
||||||
if (!_history || (initial && _histInited) || (!initial && !_histInited)) return;
|
if (!_history || (initial && _histInited) || (!initial && !_histInited)) return;
|
||||||
if (_firstLoadRequest) {
|
if (_firstLoadRequest) {
|
||||||
if (resizedItem) _list->recountHeight(resizedItem);
|
if (resizedItem) _list->recountHeight(resizedItem);
|
||||||
|
@ -6362,6 +6362,12 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!initial && !wasAtBottom) || (loadedDown && (!_history->showFrom || _history->unreadBar || _history->loadedAtBottom()) && (!_migrated || !_migrated->showFrom || _migrated->unreadBar || _history->loadedAtBottom()))) {
|
if ((!initial && !wasAtBottom) || (loadedDown && (!_history->showFrom || _history->unreadBar || _history->loadedAtBottom()) && (!_migrated || !_migrated->showFrom || _migrated->unreadBar || _history->loadedAtBottom()))) {
|
||||||
|
int32 addToY = 0;
|
||||||
|
if (change.type == ScrollChangeAdd) {
|
||||||
|
addToY = change.value;
|
||||||
|
} else if (change.type == ScrollChangeOldHistoryHeight) {
|
||||||
|
addToY = _list->historyHeight() - change.value;
|
||||||
|
}
|
||||||
_scroll.scrollToY(newSt + addToY);
|
_scroll.scrollToY(newSt + addToY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6380,7 +6386,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown,
|
||||||
if (iy < 0) {
|
if (iy < 0) {
|
||||||
setMsgId(0);
|
setMsgId(0);
|
||||||
_histInited = false;
|
_histInited = false;
|
||||||
return updateListSize(addToY, initial);
|
return updateListSize(initial, false, change);
|
||||||
} else {
|
} else {
|
||||||
toY = (_scroll.height() > item->height()) ? qMax(iy - (_scroll.height() - item->height()) / 2, 0) : iy;
|
toY = (_scroll.height() > item->height()) ? qMax(iy - (_scroll.height() - item->height()) / 2, 0) : iy;
|
||||||
_animActiveStart = getms();
|
_animActiveStart = getms();
|
||||||
|
@ -6393,13 +6399,13 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown,
|
||||||
if (iy < 0) {
|
if (iy < 0) {
|
||||||
setMsgId(0);
|
setMsgId(0);
|
||||||
_histInited = false;
|
_histInited = false;
|
||||||
return updateListSize(addToY, initial);
|
return updateListSize(initial, false, change);
|
||||||
} else {
|
} else {
|
||||||
toY = (_scroll.height() > item->height()) ? qMax(iy - (_scroll.height() - item->height()) / 2, 0) : iy;
|
toY = (_scroll.height() > item->height()) ? qMax(iy - (_scroll.height() - item->height()) / 2, 0) : iy;
|
||||||
_animActiveStart = getms();
|
_animActiveStart = getms();
|
||||||
_animActiveTimer.start(AnimationTimerDelta);
|
_animActiveTimer.start(AnimationTimerDelta);
|
||||||
_activeAnimMsgId = _showAtMsgId;
|
_activeAnimMsgId = _showAtMsgId;
|
||||||
if (item->isGroupMigrate() && _migrated && _migrated->loadedAtBottom() && _migrated->blocks.back()->items.back()->isGroupMigrate() && _list->historyTop() != _list->historyDrawTop()) {
|
if (item->isGroupMigrate() && _migrated && !_migrated->isEmpty() && _migrated->loadedAtBottom() && _migrated->blocks.back()->items.back()->isGroupMigrate() && _list->historyTop() != _list->historyDrawTop()) {
|
||||||
_activeAnimMsgId = -_migrated->blocks.back()->items.back()->id;
|
_activeAnimMsgId = -_migrated->blocks.back()->items.back()->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6431,7 +6437,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown,
|
||||||
_fixedInScrollMsgId = 0;
|
_fixedInScrollMsgId = 0;
|
||||||
_fixedInScrollMsgTop = 0;
|
_fixedInScrollMsgTop = 0;
|
||||||
_histInited = false;
|
_histInited = false;
|
||||||
return updateListSize(addToY, initial);
|
return updateListSize(initial, false, change);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toY = qMax(iy + item->height() - _fixedInScrollMsgTop, 0);
|
toY = qMax(iy + item->height() - _fixedInScrollMsgTop, 0);
|
||||||
|
@ -6447,7 +6453,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown,
|
||||||
if (_migrated->unreadBar) {
|
if (_migrated->unreadBar) {
|
||||||
setMsgId(ShowAtUnreadMsgId);
|
setMsgId(ShowAtUnreadMsgId);
|
||||||
_histInited = false;
|
_histInited = false;
|
||||||
updateListSize(0, true);
|
updateListSize(true);
|
||||||
App::wnd()->checkHistoryActivation();
|
App::wnd()->checkHistoryActivation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6459,7 +6465,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown,
|
||||||
if (_history->unreadBar) {
|
if (_history->unreadBar) {
|
||||||
setMsgId(ShowAtUnreadMsgId);
|
setMsgId(ShowAtUnreadMsgId);
|
||||||
_histInited = false;
|
_histInited = false;
|
||||||
updateListSize(0, true);
|
updateListSize(true);
|
||||||
App::wnd()->checkHistoryActivation();
|
App::wnd()->checkHistoryActivation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6470,10 +6476,16 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown,
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::addMessagesToFront(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed) {
|
void HistoryWidget::addMessagesToFront(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed) {
|
||||||
int32 oldH = _list->historyHeight();
|
int oldH = _list->historyHeight();
|
||||||
_list->messagesReceived(peer, messages, collapsed);
|
_list->messagesReceived(peer, messages, collapsed);
|
||||||
if (!_firstLoadRequest) {
|
if (!_firstLoadRequest) {
|
||||||
updateListSize(_list->historyHeight() - oldH);
|
updateListSize(false, false, { ScrollChangeOldHistoryHeight, oldH });
|
||||||
|
if (_animActiveTimer.isActive() && _activeAnimMsgId > 0 && _migrated && !_migrated->isEmpty() && _migrated->loadedAtBottom() && _migrated->blocks.back()->items.back()->isGroupMigrate() && _list->historyTop() != _list->historyDrawTop() && _history) {
|
||||||
|
HistoryItem *animActiveItem = App::histItemById(_history->channelId(), _activeAnimMsgId);
|
||||||
|
if (animActiveItem && animActiveItem->isGroupMigrate()) {
|
||||||
|
_activeAnimMsgId = -_migrated->blocks.back()->items.back()->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
updateBotKeyboard();
|
updateBotKeyboard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6481,7 +6493,7 @@ void HistoryWidget::addMessagesToFront(PeerData *peer, const QVector<MTPMessage>
|
||||||
void HistoryWidget::addMessagesToBack(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed) {
|
void HistoryWidget::addMessagesToBack(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed) {
|
||||||
_list->messagesReceivedDown(peer, messages, collapsed);
|
_list->messagesReceivedDown(peer, messages, collapsed);
|
||||||
if (!_firstLoadRequest) {
|
if (!_firstLoadRequest) {
|
||||||
updateListSize(0, false, true);
|
updateListSize(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -782,10 +782,20 @@ private:
|
||||||
QList<MsgId> _replyReturns;
|
QList<MsgId> _replyReturns;
|
||||||
|
|
||||||
bool messagesFailed(const RPCError &error, mtpRequestId requestId);
|
bool messagesFailed(const RPCError &error, mtpRequestId requestId);
|
||||||
void updateListSize(int32 addToY = 0, bool initial = false, bool loadedDown = false, const HistoryItem *resizedItem = 0, bool scrollToIt = false);
|
|
||||||
void addMessagesToFront(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed);
|
void addMessagesToFront(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed);
|
||||||
void addMessagesToBack(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed);
|
void addMessagesToBack(PeerData *peer, const QVector<MTPMessage> &messages, const QVector<MTPMessageGroup> *collapsed);
|
||||||
|
|
||||||
|
enum ScrollChangeType {
|
||||||
|
ScrollChangeNone,
|
||||||
|
ScrollChangeAdd,
|
||||||
|
ScrollChangeOldHistoryHeight,
|
||||||
|
};
|
||||||
|
struct ScrollChange {
|
||||||
|
ScrollChangeType type;
|
||||||
|
int value;
|
||||||
|
};
|
||||||
|
void updateListSize(bool initial = false, bool loadedDown = false, const ScrollChange &change = { ScrollChangeNone, 0 }, const HistoryItem *resizedItem = 0, bool scrollToIt = false);
|
||||||
|
|
||||||
void saveGifDone(DocumentData *doc, const MTPBool &result);
|
void saveGifDone(DocumentData *doc, const MTPBool &result);
|
||||||
|
|
||||||
void reportSpamDone(PeerData *peer, const MTPBool &result, mtpRequestId request);
|
void reportSpamDone(PeerData *peer, const MTPBool &result, mtpRequestId request);
|
||||||
|
|
|
@ -1021,4 +1021,8 @@ namespace SignalHandlers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAssertionInfo(const QString &info) {
|
||||||
|
ProcessAnnotations["Assertion"] = info.toUtf8().constData();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,5 +108,6 @@ namespace SignalHandlers {
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
void setSelfUsername(const QString &username);
|
void setSelfUsername(const QString &username);
|
||||||
|
void setAssertionInfo(const QString &info);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -714,7 +714,7 @@ void ProfileInner::reorderParticipants() {
|
||||||
loadProfilePhotos(_lastPreload);
|
loadProfilePhotos(_lastPreload);
|
||||||
} else if (_peerChannel && _peerChannel->isMegagroup() && _peerChannel->amIn() && !_peerChannel->mgInfo->lastParticipants.isEmpty()) {
|
} else if (_peerChannel && _peerChannel->isMegagroup() && _peerChannel->amIn() && !_peerChannel->mgInfo->lastParticipants.isEmpty()) {
|
||||||
bool needAdmins = true, adminsOutdated = (_peerChannel->mgInfo->lastParticipantsStatus & MegagroupInfo::LastParticipantsAdminsOutdated);
|
bool needAdmins = true, adminsOutdated = (_peerChannel->mgInfo->lastParticipantsStatus & MegagroupInfo::LastParticipantsAdminsOutdated);
|
||||||
bool orderByOnline = true;// (_peerChannel->count > 0) && (_peerChannel->count <= Global::ChatSizeMax());
|
bool orderByOnline = (_peerChannel->count > 0) && (_peerChannel->count <= Global::ChatSizeMax());
|
||||||
|
|
||||||
_onlineText.clear();
|
_onlineText.clear();
|
||||||
if (_peerChannel->mgInfo->lastParticipants.isEmpty() || (needAdmins && adminsOutdated) || _peerChannel->lastParticipantsCountOutdated()) {
|
if (_peerChannel->mgInfo->lastParticipants.isEmpty() || (needAdmins && adminsOutdated) || _peerChannel->lastParticipantsCountOutdated()) {
|
||||||
|
|
|
@ -851,8 +851,10 @@ namespace {
|
||||||
} else {
|
} else {
|
||||||
_psShadowWindows.setColor(_shInactive);
|
_psShadowWindows.setColor(_shInactive);
|
||||||
}
|
}
|
||||||
QTimer::singleShot(0, App::wnd(), SLOT(updateCounter()));
|
if (Global::started()) {
|
||||||
App::wnd()->update();
|
QMetaObject::invokeMethod(App::wnd(), "updateCounter", Qt::QueuedConnection);
|
||||||
|
App::wnd()->update();
|
||||||
|
}
|
||||||
} return false;
|
} return false;
|
||||||
|
|
||||||
case WM_NCPAINT: if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8) return false; *result = 0; return true;
|
case WM_NCPAINT: if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8) return false; *result = 0; return true;
|
||||||
|
|
|
@ -36,28 +36,6 @@ T *exchange(T *&ptr) {
|
||||||
struct NullType {
|
struct NullType {
|
||||||
};
|
};
|
||||||
|
|
||||||
#if __cplusplus < 199711L
|
|
||||||
#define TDESKTOP_CUSTOM_NULLPTR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TDESKTOP_CUSTOM_NULLPTR
|
|
||||||
class NullPointerClass {
|
|
||||||
public:
|
|
||||||
template <typename T>
|
|
||||||
operator T*() const {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
template <typename C, typename T>
|
|
||||||
operator T C::*() const {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void operator&() const;
|
|
||||||
};
|
|
||||||
extern NullPointerClass nullptr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class OrderedSet : public QMap<T, NullType> {
|
class OrderedSet : public QMap<T, NullType> {
|
||||||
public:
|
public:
|
||||||
|
@ -68,6 +46,19 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define qsl(s) QStringLiteral(s)
|
||||||
|
#define qstr(s) QLatin1String(s, sizeof(s) - 1)
|
||||||
|
|
||||||
|
// using for_const instead of plain range-based for loop to ensure usage of const_iterator
|
||||||
|
// it is important for the copy-on-write Qt containers
|
||||||
|
// if you have "QVector<T*> v" then "for (T * const p : v)" will still call QVector::detach(),
|
||||||
|
// while "for_const(T *p, v)" won't and "for_const(T *&p, v)" won't compile
|
||||||
|
template <typename T>
|
||||||
|
struct ForConstTraits {
|
||||||
|
typedef const T &ExpressionType;
|
||||||
|
};
|
||||||
|
#define for_const(range_declaration, range_expression) for (range_declaration : static_cast<ForConstTraits<decltype(range_expression)>::ExpressionType>(range_expression))
|
||||||
|
|
||||||
//typedef unsigned char uchar; // Qt has uchar
|
//typedef unsigned char uchar; // Qt has uchar
|
||||||
typedef qint16 int16;
|
typedef qint16 int16;
|
||||||
typedef quint16 uint16;
|
typedef quint16 uint16;
|
||||||
|
@ -109,7 +100,9 @@ using std::swap;
|
||||||
static volatile int *t_assert_nullptr = 0;
|
static volatile int *t_assert_nullptr = 0;
|
||||||
inline void t_noop() {}
|
inline void t_noop() {}
|
||||||
inline void t_assert_fail(const char *message, const char *file, int32 line) {
|
inline void t_assert_fail(const char *message, const char *file, int32 line) {
|
||||||
LOG(("Assertion Failed! %1 %2:%3").arg(message).arg(file).arg(line));
|
QString info(qsl("%1 %2:%3").arg(message).arg(file).arg(line));
|
||||||
|
LOG(("Assertion Failed! %1 %2:%3").arg(info));
|
||||||
|
SignalHandlers::setAssertionInfo(info);
|
||||||
*t_assert_nullptr = 0;
|
*t_assert_nullptr = 0;
|
||||||
}
|
}
|
||||||
#define t_assert_full(condition, message, file, line) ((!(condition)) ? t_assert_fail(message, file, line) : t_noop())
|
#define t_assert_full(condition, message, file, line) ((!(condition)) ? t_assert_fail(message, file, line) : t_noop())
|
||||||
|
@ -277,9 +270,6 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define qsl(s) QStringLiteral(s)
|
|
||||||
#define qstr(s) QLatin1String(s, sizeof(s) - 1)
|
|
||||||
|
|
||||||
inline QString fromUtf8Safe(const char *str, int32 size = -1) {
|
inline QString fromUtf8Safe(const char *str, int32 size = -1) {
|
||||||
if (!str || !size) return QString();
|
if (!str || !size) return QString();
|
||||||
if (size < 0) size = int32(strlen(str));
|
if (size < 0) size = int32(strlen(str));
|
||||||
|
|
|
@ -78,7 +78,10 @@ void ConnectingWidget::onReconnect() {
|
||||||
MTP::restart();
|
MTP::restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyWindow::NotifyWindow(HistoryItem *msg, int32 x, int32 y, int32 fwdCount) : history(msg->history()), item(msg), fwdCount(fwdCount)
|
NotifyWindow::NotifyWindow(HistoryItem *msg, int32 x, int32 y, int32 fwdCount) : TWidget(0)
|
||||||
|
, history(msg->history())
|
||||||
|
, item(msg)
|
||||||
|
, fwdCount(fwdCount)
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
, started(GetTickCount())
|
, started(GetTickCount())
|
||||||
#endif
|
#endif
|
||||||
|
@ -694,6 +697,8 @@ void Window::setupMain(bool anim, const MTPUser *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::updateCounter() {
|
void Window::updateCounter() {
|
||||||
|
if (App::quitting()) return;
|
||||||
|
|
||||||
psUpdateCounter();
|
psUpdateCounter();
|
||||||
title->updateCounter();
|
title->updateCounter();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.9.31</string>
|
<string>0.9.32</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleURLTypes</key>
|
<key>CFBundleURLTypes</key>
|
||||||
|
|
|
@ -34,8 +34,8 @@ IDI_ICON1 ICON "SourceFiles\\art\\icon256.ico"
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 0,9,31,0
|
FILEVERSION 0,9,32,0
|
||||||
PRODUCTVERSION 0,9,31,0
|
PRODUCTVERSION 0,9,32,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -51,10 +51,10 @@ BEGIN
|
||||||
BLOCK "040904b0"
|
BLOCK "040904b0"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Telegram Messenger LLP"
|
VALUE "CompanyName", "Telegram Messenger LLP"
|
||||||
VALUE "FileVersion", "0.9.31.0"
|
VALUE "FileVersion", "0.9.32.0"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
|
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
|
||||||
VALUE "ProductName", "Telegram Desktop"
|
VALUE "ProductName", "Telegram Desktop"
|
||||||
VALUE "ProductVersion", "0.9.31.0"
|
VALUE "ProductVersion", "0.9.32.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -1726,7 +1726,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 0.9.31;
|
CURRENT_PROJECT_VERSION = 0.9.32;
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
@ -1745,7 +1745,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
COPY_PHASE_STRIP = YES;
|
COPY_PHASE_STRIP = YES;
|
||||||
CURRENT_PROJECT_VERSION = 0.9.31;
|
CURRENT_PROJECT_VERSION = 0.9.32;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||||
GCC_OPTIMIZATION_LEVEL = fast;
|
GCC_OPTIMIZATION_LEVEL = fast;
|
||||||
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
|
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
|
||||||
|
@ -1774,10 +1774,10 @@
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
CODE_SIGN_IDENTITY = "";
|
CODE_SIGN_IDENTITY = "";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 0.9.31;
|
CURRENT_PROJECT_VERSION = 0.9.32;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
DYLIB_COMPATIBILITY_VERSION = 0.9;
|
DYLIB_COMPATIBILITY_VERSION = 0.9;
|
||||||
DYLIB_CURRENT_VERSION = 0.9.31;
|
DYLIB_CURRENT_VERSION = 0.9.32;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = "";
|
FRAMEWORK_SEARCH_PATHS = "";
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||||
|
@ -1915,10 +1915,10 @@
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
CODE_SIGN_IDENTITY = "";
|
CODE_SIGN_IDENTITY = "";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 0.9.31;
|
CURRENT_PROJECT_VERSION = 0.9.32;
|
||||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
DYLIB_COMPATIBILITY_VERSION = 0.9;
|
DYLIB_COMPATIBILITY_VERSION = 0.9;
|
||||||
DYLIB_CURRENT_VERSION = 0.9.31;
|
DYLIB_CURRENT_VERSION = 0.9.32;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = "";
|
FRAMEWORK_SEARCH_PATHS = "";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
AppVersion 9031
|
AppVersion 9032
|
||||||
AppVersionStrMajor 0.9
|
AppVersionStrMajor 0.9
|
||||||
AppVersionStrSmall 0.9.31
|
AppVersionStrSmall 0.9.32
|
||||||
AppVersionStr 0.9.31
|
AppVersionStr 0.9.32
|
||||||
DevChannel 0
|
DevChannel 0
|
||||||
BetaVersion 0 9030002
|
BetaVersion 0 9030002
|
||||||
|
|
|
@ -11456,7 +11456,7 @@ index 1ec33df..45d436c 100644
|
||||||
}
|
}
|
||||||
return [super performKeyEquivalent:nsevent];
|
return [super performKeyEquivalent:nsevent];
|
||||||
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
|
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
|
||||||
index da0ba27..9fd21d4 100644
|
index da0ba27..3f6388c 100644
|
||||||
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
|
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
|
||||||
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
|
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
|
||||||
@@ -713,6 +713,9 @@ public:
|
@@ -713,6 +713,9 @@ public:
|
||||||
|
@ -11546,7 +11546,7 @@ index da0ba27..9fd21d4 100644
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline IFileOpenDialog *openFileDialog() const
|
inline IFileOpenDialog *openFileDialog() const
|
||||||
@@ -1546,6 +1580,55 @@ QList<QUrl> QWindowsNativeOpenFileDialog::dialogResult() const
|
@@ -1546,6 +1580,57 @@ QList<QUrl> QWindowsNativeOpenFileDialog::dialogResult() const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11587,13 +11587,15 @@ index da0ba27..9fd21d4 100644
|
||||||
+ continue;
|
+ continue;
|
||||||
+
|
+
|
||||||
+ quint64 fullSize = stat.cbSize.QuadPart;
|
+ quint64 fullSize = stat.cbSize.QuadPart;
|
||||||
+ result.resize(fullSize);
|
+ if (fullSize <= 64 * 1024 * 1024) {
|
||||||
+ ULONG read = 0;
|
+ result.resize(fullSize);
|
||||||
+ HRESULT r = stream->Read(result.data(), fullSize, &read);
|
+ ULONG read = 0;
|
||||||
+ if (r == S_FALSE || r == S_OK)
|
+ HRESULT r = stream->Read(result.data(), fullSize, &read);
|
||||||
+ return result;
|
+ if (r == S_FALSE || r == S_OK)
|
||||||
|
+ return result;
|
||||||
+
|
+
|
||||||
+ result.clear();
|
+ result.clear();
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ return result;
|
+ return result;
|
||||||
|
@ -11602,7 +11604,7 @@ index da0ba27..9fd21d4 100644
|
||||||
QList<QUrl> QWindowsNativeOpenFileDialog::selectedFiles() const
|
QList<QUrl> QWindowsNativeOpenFileDialog::selectedFiles() const
|
||||||
{
|
{
|
||||||
QList<QUrl> result;
|
QList<QUrl> result;
|
||||||
@@ -1609,6 +1692,8 @@ public:
|
@@ -1609,6 +1694,8 @@ public:
|
||||||
virtual QUrl directory() const Q_DECL_OVERRIDE;
|
virtual QUrl directory() const Q_DECL_OVERRIDE;
|
||||||
virtual void selectFile(const QUrl &filename) Q_DECL_OVERRIDE;
|
virtual void selectFile(const QUrl &filename) Q_DECL_OVERRIDE;
|
||||||
virtual QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
|
virtual QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
|
||||||
|
@ -11611,7 +11613,7 @@ index da0ba27..9fd21d4 100644
|
||||||
virtual void setFilter() Q_DECL_OVERRIDE;
|
virtual void setFilter() Q_DECL_OVERRIDE;
|
||||||
virtual void selectNameFilter(const QString &filter) Q_DECL_OVERRIDE;
|
virtual void selectNameFilter(const QString &filter) Q_DECL_OVERRIDE;
|
||||||
virtual QString selectedNameFilter() const Q_DECL_OVERRIDE;
|
virtual QString selectedNameFilter() const Q_DECL_OVERRIDE;
|
||||||
@@ -1702,6 +1787,12 @@ QList<QUrl> QWindowsFileDialogHelper::selectedFiles() const
|
@@ -1702,6 +1789,12 @@ QList<QUrl> QWindowsFileDialogHelper::selectedFiles() const
|
||||||
return m_data.selectedFiles();
|
return m_data.selectedFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11624,7 +11626,7 @@ index da0ba27..9fd21d4 100644
|
||||||
void QWindowsFileDialogHelper::setFilter()
|
void QWindowsFileDialogHelper::setFilter()
|
||||||
{
|
{
|
||||||
qCDebug(lcQpaDialogs) << __FUNCTION__;
|
qCDebug(lcQpaDialogs) << __FUNCTION__;
|
||||||
@@ -1992,6 +2083,8 @@ public:
|
@@ -1992,6 +2085,8 @@ public:
|
||||||
virtual QUrl directory() const Q_DECL_OVERRIDE;
|
virtual QUrl directory() const Q_DECL_OVERRIDE;
|
||||||
virtual void selectFile(const QUrl &url) Q_DECL_OVERRIDE;
|
virtual void selectFile(const QUrl &url) Q_DECL_OVERRIDE;
|
||||||
virtual QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
|
virtual QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
|
||||||
|
@ -11633,7 +11635,7 @@ index da0ba27..9fd21d4 100644
|
||||||
virtual void setFilter() Q_DECL_OVERRIDE {}
|
virtual void setFilter() Q_DECL_OVERRIDE {}
|
||||||
virtual void selectNameFilter(const QString &) Q_DECL_OVERRIDE;
|
virtual void selectNameFilter(const QString &) Q_DECL_OVERRIDE;
|
||||||
virtual QString selectedNameFilter() const Q_DECL_OVERRIDE;
|
virtual QString selectedNameFilter() const Q_DECL_OVERRIDE;
|
||||||
@@ -2035,6 +2128,12 @@ QList<QUrl> QWindowsXpFileDialogHelper::selectedFiles() const
|
@@ -2035,6 +2130,12 @@ QList<QUrl> QWindowsXpFileDialogHelper::selectedFiles() const
|
||||||
return m_data.selectedFiles();
|
return m_data.selectedFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
##Build instructions for Xcode 6.4
|
##Build instructions for Xcode 7.2.1
|
||||||
|
|
||||||
###Prepare folder
|
###Prepare folder
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
##Build instructions for Xcode 6.4
|
##Build instructions for Xcode 7.2.1
|
||||||
|
|
||||||
###Prepare folder
|
###Prepare folder
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue