From 6861059d184a7215af9e1488934b04300282d05f Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 27 Sep 2017 21:45:26 +0300 Subject: [PATCH] Fix build for old OS X with Qt 5.3.2 --- Telegram/SourceFiles/history/history.cpp | 24 +++++++++---------- Telegram/SourceFiles/history/history.h | 6 ++--- Telegram/SourceFiles/history/history_item.h | 4 ++-- .../info/info_common_groups_inner_widget.cpp | 8 ------- Telegram/SourceFiles/rpl/consumer.h | 4 ++-- 5 files changed, 19 insertions(+), 27 deletions(-) diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 2382e8382..be6cbc8ff 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -395,9 +395,9 @@ bool History::updateSendActionNeedsAnimating(TimeMs ms, bool force) { void ChannelHistory::getRangeDifference() { auto fromId = MsgId(0); auto toId = MsgId(0); - for (auto blockIndex = 0, blocksCount = blocks.size(); blockIndex < blocksCount; ++blockIndex) { + for (auto blockIndex = 0, blocksCount = int(blocks.size()); blockIndex < blocksCount; ++blockIndex) { auto block = blocks[blockIndex]; - for (auto itemIndex = 0, itemsCount = block->items.size(); itemIndex < itemsCount; ++itemIndex) { + for (auto itemIndex = 0, itemsCount = int(block->items.size()); itemIndex < itemsCount; ++itemIndex) { auto item = block->items[itemIndex]; if (item->id > 0) { fromId = item->id; @@ -518,7 +518,7 @@ void ChannelHistory::checkJoinedMessage(bool createUnread) { QDateTime inviteDate = peer->asChannel()->inviteDate; QDateTime firstDate, lastDate; - if (!blocks.isEmpty()) { + if (!blocks.empty()) { firstDate = blocks.front()->items.front()->date; lastDate = blocks.back()->items.back()->date; } @@ -1418,7 +1418,7 @@ HistoryBlock *History::prepareBlockForAddingItem() { return result; } - auto addNewBlock = blocks.isEmpty() || (blocks.back()->items.size() >= kNewBlockEachMessage); + auto addNewBlock = blocks.empty() || (blocks.back()->items.size() >= kNewBlockEachMessage); if (!addNewBlock) { return blocks.back(); } @@ -1817,7 +1817,7 @@ void History::getNextShowFrom(HistoryBlock *block, int i) { } } - for (auto j = block->indexInHistory() + 1, s = blocks.size(); j < s; ++j) { + for (auto j = block->indexInHistory() + 1, s = int(blocks.size()); j < s; ++j) { block = blocks[j]; for_const (auto item, block->items) { if (item->id > 0) { @@ -1933,7 +1933,7 @@ HistoryItem *History::addNewInTheMiddle(HistoryItem *newItem, int32 blockIndex, auto block = blocks[blockIndex]; newItem->attachToBlock(block, itemIndex); - block->items.insert(itemIndex, newItem); + block->items.insert(block->items.begin() + itemIndex, newItem); newItem->previousItemChanged(); if (itemIndex + 1 < block->items.size()) { for (int i = itemIndex + 1, l = block->items.size(); i < l; ++i) { @@ -2434,14 +2434,14 @@ void History::changeMsgId(MsgId oldId, MsgId newId) { } void History::removeBlock(HistoryBlock *block) { - Expects(block->items.isEmpty()); + Expects(block->items.empty()); if (_buildingFrontBlock && block == _buildingFrontBlock->block) { _buildingFrontBlock->block = nullptr; } int index = block->indexInHistory(); - blocks.removeAt(index); + blocks.erase(blocks.begin() + index); if (index < blocks.size()) { for (int i = index, l = blocks.size(); i < l; ++i) { blocks[i]->setIndexInHistory(i); @@ -2503,11 +2503,11 @@ void HistoryBlock::removeItem(HistoryItem *item) { } item->detachFast(); - items.remove(itemIndex); - for (auto i = itemIndex, l = items.size(); i < l; ++i) { + items.erase(items.begin() + itemIndex); + for (auto i = itemIndex, l = int(items.size()); i < l; ++i) { items[i]->setIndexInBlock(i); } - if (items.isEmpty()) { + if (items.empty()) { _history->removeBlock(this); } else if (itemIndex < items.size()) { items[itemIndex]->previousItemChanged(); @@ -2517,7 +2517,7 @@ void HistoryBlock::removeItem(HistoryItem *item) { _history->blocks.back()->items.back()->nextItemChanged(); } - if (items.isEmpty()) { + if (items.empty()) { delete this; } } diff --git a/Telegram/SourceFiles/history/history.h b/Telegram/SourceFiles/history/history.h index be31a550e..0ce7c63d5 100644 --- a/Telegram/SourceFiles/history/history.h +++ b/Telegram/SourceFiles/history/history.h @@ -216,7 +216,7 @@ public: History *migrateFrom() const; bool isEmpty() const { - return blocks.isEmpty(); + return blocks.empty(); } bool isDisplayedEmpty() const; @@ -376,7 +376,7 @@ public: void eraseFromUnreadMentions(MsgId msgId); void addUnreadMentionsSlice(const MTPmessages_Messages &result); - using Blocks = QList; + using Blocks = std::deque; Blocks blocks; int width = 0; @@ -658,7 +658,7 @@ public: HistoryBlock(const HistoryBlock &) = delete; HistoryBlock &operator=(const HistoryBlock &) = delete; - QVector items; + std::vector items; void clear(bool leaveItems = false); ~HistoryBlock() { diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index 8f3b661e0..ea7a6c76b 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -988,7 +988,7 @@ protected: return _block->items.at(_indexInBlock - 1); } if (auto previous = _block->previousBlock()) { - Assert(!previous->items.isEmpty()); + Assert(!previous->items.empty()); return previous->items.back(); } } @@ -1000,7 +1000,7 @@ protected: return _block->items.at(_indexInBlock + 1); } if (auto next = _block->nextBlock()) { - Assert(!next->items.isEmpty()); + Assert(!next->items.empty()); return next->items.front(); } } diff --git a/Telegram/SourceFiles/info/info_common_groups_inner_widget.cpp b/Telegram/SourceFiles/info/info_common_groups_inner_widget.cpp index 48092280f..d46a69e9d 100644 --- a/Telegram/SourceFiles/info/info_common_groups_inner_widget.cpp +++ b/Telegram/SourceFiles/info/info_common_groups_inner_widget.cpp @@ -30,14 +30,6 @@ namespace CommonGroups { InnerWidget::InnerWidget(QWidget *parent, not_null user) : RpWidget(parent) , _user(user) { - base::lambda launch = [this, &launch](int counter) { - QTimer::singleShot(500, this, [this, launch, counter] { - _rowsHeightFake += 300; - resizeToWidth(width(), _minHeight); - launch(counter - 1); - }); - }; - launch(10); } void InnerWidget::visibleTopBottomUpdated( diff --git a/Telegram/SourceFiles/rpl/consumer.h b/Telegram/SourceFiles/rpl/consumer.h index 7f65f8b2d..e34ef678b 100644 --- a/Telegram/SourceFiles/rpl/consumer.h +++ b/Telegram/SourceFiles/rpl/consumer.h @@ -539,7 +539,7 @@ public: details::is_specific_handlers_v>> consumer &operator=( const details::consumer_base &other) { - _handlers = other._handlers; + this->_handlers = other._handlers; return *this; } @@ -549,7 +549,7 @@ public: details::is_specific_handlers_v>> consumer &operator=( details::consumer_base &&other) { - _handlers = std::move(other._handlers); + this->_handlers = std::move(other._handlers); return *this; }