From e5c82fad215d449485787d9a98344ba75370c42a Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 23 Nov 2015 19:05:30 +0300 Subject: [PATCH] icon in search in supergroup fixed, edit button for supergroup admins added, crash fix in cached image loading --- Telegram/SourceFiles/dialogswidget.cpp | 2 +- Telegram/SourceFiles/localimageloader.cpp | 19 ++++++++++++++----- Telegram/SourceFiles/mainwidget.cpp | 2 +- Telegram/SourceFiles/profilewidget.cpp | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index c61ae5eecc..e45797acc0 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -302,7 +302,7 @@ void DialogsInner::searchInPeerPaint(Painter &p, int32 w, bool onlyBackground) c QRect rectForName(nameleft, st::dlgPaddingVer + st::dlgNameTop, namewidth, st::msgNameFont->height); // draw chat icon - if (_searchInPeer->isChat()) { + if (_searchInPeer->isChat() || _searchInPeer->isMegagroup()) { p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgPos.x(), rectForName.top() + st::dlgChatImgPos.y()), App::sprite(), st::dlgChatImg); rectForName.setLeft(rectForName.left() + st::dlgImgSkip); } else if (_searchInPeer->isChannel()) { diff --git a/Telegram/SourceFiles/localimageloader.cpp b/Telegram/SourceFiles/localimageloader.cpp index f82fdb396f..3f9c782472 100644 --- a/Telegram/SourceFiles/localimageloader.cpp +++ b/Telegram/SourceFiles/localimageloader.cpp @@ -75,11 +75,20 @@ void TaskQueue::wakeThread() { } void TaskQueue::cancelTask(TaskId id) { - QMutexLocker lock(&_tasksToProcessMutex); - for (int32 i = 0, l = _tasksToProcess.size(); i < l; ++i) { - if (_tasksToProcess.at(i)->id() == id) { - _tasksToProcess.removeAt(i); - break; + { + QMutexLocker lock(&_tasksToProcessMutex); + for (int32 i = 0, l = _tasksToProcess.size(); i != l; ++i) { + if (_tasksToProcess.at(i)->id() == id) { + _tasksToProcess.removeAt(i); + return; + } + } + } + QMutexLocker lock(&_tasksToFinishMutex); + for (int32 i = 0, l = _tasksToFinish.size(); i != l; ++i) { + if (_tasksToFinish.at(i)->id() == id) { + _tasksToFinish.removeAt(i); + return; } } } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index fe06de6fe8..4c4722231a 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -318,7 +318,7 @@ void TopBarWidget::showAll() { _forward.hide(); _mediaType.hide(); } else { - if (p && p->isChannel() && p->asChannel()->amCreator()) { + if (p && p->isChannel() && (p->asChannel()->amCreator() || (p->isMegagroup() && p->asChannel()->amEditor()))) { _edit.show(); } else { _edit.hide(); diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index 0f1223a31e..1c5f314fda 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -1265,7 +1265,7 @@ void ProfileInner::resizeEvent(QResizeEvent *e) { _members.move(_left + st::profilePhotoSize + st::profileStatusLeft, top + addbyname + st::profileStatusTop); addbyname += st::profileStatusTop + st::linkFont->ascent - (st::profileNameTop + st::profileNameFont->ascent); _admins.move(_left + st::profilePhotoSize + st::profileStatusLeft, top + addbyname + st::profileStatusTop); - if (_amCreator) { + if ((_peerChat && _amCreator && _peerChat->canEdit()) || (_peerChannel && (_amCreator || _peerChannel->amEditor() || _peerChannel->amModerator()))) { _cancelPhoto.move(_left + _width - _cancelPhoto.width(), top + st::profilePhotoSize - st::linkFont->height); } else { _cancelPhoto.move(_left + _width - _cancelPhoto.width(), top + st::profilePhoneTop);