mirror of
https://github.com/vale981/tdesktop
synced 2025-03-10 21:16:40 -04:00
merged
This commit is contained in:
commit
c4a04a620f
5 changed files with 112 additions and 91 deletions
|
@ -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 {
|
||||||
|
|
|
@ -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()) {
|
||||||
|
|
|
@ -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:
|
||||||
|
@ -71,6 +49,16 @@ public:
|
||||||
#define qsl(s) QStringLiteral(s)
|
#define qsl(s) QStringLiteral(s)
|
||||||
#define qstr(s) QLatin1String(s, sizeof(s) - 1)
|
#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;
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue