From 771841a2aa0fbdcb91683e5aeac6af02a8bdba0a Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 12 Aug 2014 00:15:31 +0400 Subject: [PATCH] fixed photos overview update on new messages --- Telegram/SourceFiles/history.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 8909dbf250..0eeb69afe5 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -1087,8 +1087,9 @@ HistoryItem *History::doAddToBack(HistoryBlock *to, bool newBlock, HistoryItem * HistoryMedia *media = adding->getMedia(true); if (media && media->type() == MediaTypePhoto) { if (_photosOverviewIds.constFind(adding->id) == _photosOverviewIds.cend()) { - _photosOverview.push_front(adding->id); + _photosOverview.push_back(adding->id); _photosOverviewIds.insert(adding->id); + if (_photosOverviewCount > 0) ++_photosOverviewCount; if (App::wnd()) App::wnd()->mediaOverviewUpdated(peer); } } @@ -1727,6 +1728,12 @@ void HistoryItem::destroy() { for (History::MediaOverview::iterator i = history()->_photosOverview.begin(), e = history()->_photosOverview.end(); i != e; ++i) { if ((*i) == id) { history()->_photosOverview.erase(i); + if (history()->_photosOverviewCount > 0) { + --history()->_photosOverviewCount; + if (!history()->_photosOverviewCount) { + history()->_photosOverviewCount = -1; + } + } break; } } @@ -1848,7 +1855,7 @@ HistoryMedia *HistoryPhoto::clone() const { void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, const QString &time, int32 timeWidth, bool selected) const { data->full->load(false, false); bool out = parent->out(); - if (parent != App::contextItem()/* || App::wnd()->photoShown() != data*/) { + if (parent != App::contextItem() || /*App::wnd()->photoShown() != data*/ true) { if (data->full->loaded()) { p.drawPixmap(0, 0, data->full->pix(_maxw, _height)); } else {