From f6fec9a6192a5c55d0f32b0b6e61c97fb19e8a1c Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 13 Dec 2015 14:36:08 +0300 Subject: [PATCH] showPeerHistory moved to Ui namespace --- Telegram/SourceFiles/boxes/contactsbox.cpp | 8 ++-- Telegram/SourceFiles/dialogswidget.cpp | 6 +-- Telegram/SourceFiles/facades.cpp | 2 +- Telegram/SourceFiles/facades.h | 12 ++++++ Telegram/SourceFiles/historywidget.cpp | 30 +++++++------- Telegram/SourceFiles/mainwidget.cpp | 48 ++++++++++------------ Telegram/SourceFiles/mainwidget.h | 4 +- Telegram/SourceFiles/mediaview.cpp | 4 +- Telegram/SourceFiles/overviewwidget.cpp | 2 +- Telegram/SourceFiles/profilewidget.cpp | 16 ++++---- Telegram/SourceFiles/pspecific_mac.cpp | 2 +- Telegram/SourceFiles/pspecific_wnd.cpp | 2 +- Telegram/SourceFiles/settingswidget.cpp | 2 +- Telegram/SourceFiles/structs.cpp | 6 +-- Telegram/SourceFiles/window.cpp | 2 +- 15 files changed, 75 insertions(+), 71 deletions(-) diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 8a7c16c53..4ac079ff9 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -229,7 +229,7 @@ void ContactsInner::onAddBot() { App::main()->addParticipants(_addToPeer, QVector(1, _bot)); } Ui::hideLayer(); - App::main()->showPeerHistory(_addToPeer->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(_addToPeer, ShowAtUnreadMsgId); } void ContactsInner::onAddAdmin() { @@ -1558,7 +1558,7 @@ void ContactsBox::resizeEvent(QResizeEvent *e) { void ContactsBox::closePressed() { if (_inner.channel() && !_inner.hasAlreadyMembersInChannel()) { - App::main()->showPeerHistory(_inner.channel()->id, ShowAtTheEndMsgId); + Ui::showPeerHistory(_inner.channel(), ShowAtTheEndMsgId); } } @@ -1591,7 +1591,7 @@ void ContactsBox::onInvite() { App::main()->addParticipants(_inner.chat() ? (PeerData*)_inner.chat() : _inner.channel(), users); if (_inner.chat()) { Ui::hideLayer(); - App::main()->showPeerHistory(_inner.chat()->id, ShowAtTheEndMsgId); + Ui::showPeerHistory(_inner.chat(), ShowAtTheEndMsgId); } else { onClose(); } @@ -1730,7 +1730,7 @@ void ContactsBox::creationDone(const MTPUpdates &updates) { if (!_creationPhoto.isNull()) { App::app()->uploadProfilePhoto(_creationPhoto, peer->id); } - App::main()->showPeerHistory(peer->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(peer, ShowAtUnreadMsgId); } } else { LOG(("API Error: chat not found in updates (ContactsBox::creationDone)")); diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index b84d3e90d..d2883a0e8 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -687,7 +687,7 @@ void DialogsInner::onContextDeleteAndLeaveSure() { if (!_menuActionPeer) return; Ui::hideLayer(); - App::main()->showDialogs(); + Ui::showChatsList(); if (_menuActionPeer->isUser()) { App::main()->deleteConversation(_menuActionPeer); } else if (_menuActionPeer->isChat()) { @@ -2553,7 +2553,7 @@ bool DialogsWidget::onCancelSearch() { } if (_searchInPeer && !clearing) { if (!cWideMode()) { - App::main()->showPeerHistory(_searchInPeer->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(_searchInPeer, ShowAtUnreadMsgId); } _searchInPeer = _searchInMigrated = 0; _inner.searchInPeer(0); @@ -2573,7 +2573,7 @@ void DialogsWidget::onCancelSearchInPeer() { } if (_searchInPeer) { if (!cWideMode() && !App::main()->selectingPeer()) { - App::main()->showPeerHistory(_searchInPeer->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(_searchInPeer, ShowAtUnreadMsgId); } _searchInPeer = _searchInMigrated = 0; _inner.searchInPeer(0); diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index 621984dd5..df7d14eb5 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -96,7 +96,7 @@ namespace Ui { } void showPeerHistory(const PeerId &peer, MsgId msgId, bool back) { - if (MainWidget *m = App::main()) m->showPeerHistory(peer, msgId, back); + if (MainWidget *m = App::main()) m->ui_showPeerHistory(peer, msgId, back); } void showPeerHistoryAsync(const PeerId &peer, MsgId msgId) { diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h index 3ba786d65..97ebf9cd7 100644 --- a/Telegram/SourceFiles/facades.h +++ b/Telegram/SourceFiles/facades.h @@ -49,7 +49,19 @@ namespace Ui { // openssl doesn't allow me to use UI :( void redrawHistoryItem(const HistoryItem *item); void showPeerHistory(const PeerId &peer, MsgId msgId, bool back = false); + inline void showPeerHistory(const PeerData *peer, MsgId msgId, bool back = false) { + showPeerHistory(peer->id, msgId, back); + } + inline void showPeerHistory(const History *history, MsgId msgId, bool back = false) { + showPeerHistory(history->peer->id, msgId, back); + } + inline void showPeerHistoryAtItem(const HistoryItem *item) { + showPeerHistory(item->history()->peer->id, item->id); + } void showPeerHistoryAsync(const PeerId &peer, MsgId msgId); + inline void showChatsList() { + showPeerHistory(PeerId(0), 0); + } }; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 1a094fbf6..b95941913 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -3789,7 +3789,7 @@ bool HistoryWidget::messagesFailed(const RPCError &error, mtpRequestId requestId if (error.type() == qstr("CHANNEL_PRIVATE")) { PeerData *was = _peer; - App::main()->showDialogs(); + Ui::showChatsList(); Ui::showLayer(new InformBox(lang((was && was->isMegagroup()) ? lng_group_not_accessible : lng_channel_not_accessible))); return true; } @@ -3801,7 +3801,7 @@ bool HistoryWidget::messagesFailed(const RPCError &error, mtpRequestId requestId _preloadDownRequest = 0; } else if (_firstLoadRequest == requestId) { _firstLoadRequest = 0; - App::main()->showDialogs(); + Ui::showChatsList(); } else if (_delayedShowAtRequest == requestId) { _delayedShowAtRequest = 0; } @@ -4324,7 +4324,7 @@ void HistoryWidget::onBroadcastChange() { void HistoryWidget::onShareContact(const PeerId &peer, UserData *contact) { if (!contact || contact->phone.isEmpty()) return; - App::main()->showPeerHistory(peer, ShowAtTheEndMsgId); + Ui::showPeerHistory(peer, ShowAtTheEndMsgId); if (!_history) return; shareContact(peer, contact->phone, contact->firstName, contact->lastName, replyToId(), peerToUser(contact->id)); @@ -4367,7 +4367,7 @@ void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const } void HistoryWidget::onSendPaths(const PeerId &peer) { - App::main()->showPeerHistory(peer, ShowAtTheEndMsgId); + Ui::showPeerHistory(peer, ShowAtTheEndMsgId); if (!_history) return; if (cSendPaths().size() == 1) { @@ -5062,7 +5062,7 @@ void HistoryWidget::topBarClick() { if (cWideMode()) { if (_history) App::main()->showPeerProfile(_peer); } else { - App::main()->showDialogs(); + Ui::showChatsList(); } } @@ -5571,10 +5571,10 @@ void HistoryWidget::onReportSpamClear() { if (_clearPeer->isUser()) { App::main()->deleteConversation(_clearPeer); } else if (_clearPeer->isChat()) { - App::main()->showDialogs(); + Ui::showChatsList(); MTP::send(MTPmessages_DeleteChatUser(_clearPeer->asChat()->inputChat, App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, _clearPeer), App::main()->rpcFail(&MainWidget::leaveChatFailed, _clearPeer)); } else if (_clearPeer->isChannel()) { - App::main()->showDialogs(); + Ui::showChatsList(); if (_clearPeer->migrateFrom()) { App::main()->deleteConversation(_clearPeer->migrateFrom()); } @@ -6033,7 +6033,7 @@ void HistoryWidget::mousePressEvent(QMouseEvent *e) { a_recordOver.restart(); _a_record.start(); } else if (_inReply) { - App::main()->showPeerHistory(_peer->id, replyToId()); + Ui::showPeerHistory(_peer, replyToId()); } } @@ -6050,7 +6050,7 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) { PeerData *after = 0; MsgId afterMsgId = 0; App::main()->peerAfter(_peer, msgid, after, afterMsgId); - if (after) App::main()->showPeerHistory(after->id, afterMsgId); + if (after) Ui::showPeerHistory(after, afterMsgId); } else { _scroll.keyPressEvent(e); } @@ -6059,7 +6059,7 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) { PeerData *before = 0; MsgId beforeMsgId = 0; App::main()->peerBefore(_peer, msgid, before, beforeMsgId); - if (before) App::main()->showPeerHistory(before->id, beforeMsgId); + if (before) Ui::showPeerHistory(before, beforeMsgId); } else { _scroll.keyPressEvent(e); } @@ -6068,7 +6068,7 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) { PeerData *after = 0; MsgId afterMsgId = 0; App::main()->peerAfter(_peer, msgid, after, afterMsgId); - if (after) App::main()->showPeerHistory(after->id, afterMsgId); + if (after) Ui::showPeerHistory(after, afterMsgId); } else if (!(e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier))) { _scroll.keyPressEvent(e); } @@ -6077,7 +6077,7 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) { PeerData *before = 0; MsgId beforeMsgId = 0; App::main()->peerBefore(_peer, msgid, before, beforeMsgId); - if (before) App::main()->showPeerHistory(before->id, beforeMsgId); + if (before) Ui::showPeerHistory(before, beforeMsgId); } else if (!(e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier))) { _scroll.keyPressEvent(e); } @@ -6089,7 +6089,7 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) { } else { App::main()->peerAfter(_peer, msgid, p, m); } - if (p) App::main()->showPeerHistory(p->id, m); + if (p) Ui::showPeerHistory(p, m); } else if (_history && (e->key() == Qt::Key_Search || e == QKeySequence::Find)) { App::main()->searchInPeer(_peer); } else { @@ -6380,7 +6380,7 @@ void HistoryWidget::updatePreview() { } void HistoryWidget::onCancel() { - if (App::main()) App::main()->showDialogs(); + Ui::showChatsList(); emit cancelled(); } @@ -6421,7 +6421,7 @@ void HistoryWidget::onFullPeerUpdated(PeerData *data) { void HistoryWidget::peerUpdated(PeerData *data) { if (data && data == _peer) { if (data->migrateTo()) { - App::main()->showPeerHistory(data->migrateTo()->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(data->migrateTo(), ShowAtUnreadMsgId); QTimer::singleShot(ReloadChannelMembersTimeout, App::api(), SLOT(delayedRequestParticipantsCount())); return; } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index e626a8623..97a9ad020 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -120,7 +120,7 @@ void TopBarWidget::onDeleteContactSure() { PeerData *p = App::main() ? App::main()->profilePeer() : 0; UserData *u = p ? p->asUser() : 0; if (u) { - App::main()->showDialogs(); + Ui::showChatsList(); Ui::hideLayer(); MTP::send(MTPcontacts_DeleteContact(u->inputUser), App::main()->rpcDone(&MainWidget::deletedContact, u)); } @@ -140,7 +140,7 @@ void TopBarWidget::onDeleteAndExitSure() { PeerData *p = App::main() ? App::main()->profilePeer() : 0; ChatData *c = p ? p->asChat() : 0; if (c) { - App::main()->showDialogs(); + Ui::showChatsList(); Ui::hideLayer(); MTP::send(MTPmessages_DeleteChatUser(c->inputChat, App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, p), App::main()->rpcFail(&MainWidget::leaveChatFailed, p)); } @@ -504,7 +504,7 @@ bool MainWidget::onForward(const PeerId &peer, ForwardWhatMessages what) { } } updateForwardingTexts(); - showPeerHistory(peer, ShowAtUnreadMsgId); + Ui::showPeerHistory(peer, ShowAtUnreadMsgId); history.onClearSelected(); history.updateForwarding(); return true; @@ -525,7 +525,7 @@ bool MainWidget::onShareUrl(const PeerId &peer, const QString &url, const QStrin if (opened) { history.applyDraft(); } else { - showPeerHistory(peer, ShowAtUnreadMsgId); + Ui::showPeerHistory(peer, ShowAtUnreadMsgId); } return true; } @@ -703,7 +703,7 @@ void MainWidget::onFilesOrForwardDrop(const PeerId &peer, const QMimeData *data) } else if (data->hasFormat(qsl("application/x-td-forward-pressed"))) { onForward(peer, ForwardPressedMessage); } else { - showPeerHistory(peer, ShowAtTheEndMsgId); + Ui::showPeerHistory(peer, ShowAtTheEndMsgId); history.onFilesDrop(data); } } @@ -967,7 +967,7 @@ void MainWidget::removeDialog(History *history) { void MainWidget::deleteConversation(PeerData *peer, bool deleteHistory) { if (activePeer() == peer) { - showDialogs(); + Ui::showChatsList(); } if (History *h = App::historyLoaded(peer->id)) { removeDialog(h); @@ -1003,7 +1003,7 @@ void MainWidget::clearHistory(PeerData *peer) { h->clear(); h->newLoaded = h->oldLoaded = true; } - showPeerHistory(peer->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(peer->id, ShowAtUnreadMsgId); MTP::send(MTPmessages_DeleteHistory(peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, peer)); } @@ -1061,7 +1061,7 @@ bool MainWidget::addParticipantsFail(ChannelData *channel, const RPCError &error void MainWidget::kickParticipant(ChatData *chat, UserData *user) { MTP::send(MTPmessages_DeleteChatUser(chat->inputChat, user->inputUser), rpcDone(&MainWidget::sentUpdatesReceived), rpcFail(&MainWidget::kickParticipantFail, chat)); Ui::hideLayer(); - showPeerHistory(chat->id, ShowAtTheEndMsgId); + Ui::showPeerHistory(chat->id, ShowAtTheEndMsgId); } bool MainWidget::kickParticipantFail(ChatData *chat, const RPCError &error) { @@ -1352,7 +1352,7 @@ void MainWidget::searchMessages(const QString &query, PeerData *inPeer) { App::wnd()->hideMediaview(); dialogs.searchMessages(query, inPeer); if (!cWideMode()) { - showDialogs(); + Ui::showChatsList(); } else { dialogs.activate(); } @@ -2278,7 +2278,7 @@ void MainWidget::choosePeer(PeerId peerId, MsgId showAtMsgId) { if (selectingPeer()) { offerPeer(peerId); } else { - showPeerHistory(peerId, showAtMsgId); + Ui::showPeerHistory(peerId, showAtMsgId); } } @@ -2304,7 +2304,7 @@ void MainWidget::ctrlEnterSubmitUpdated() { history.ctrlEnterSubmitUpdated(); } -void MainWidget::showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool back) { +void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool back) { if (PeerData *peer = App::peerLoaded(peerId)) { if (peer->migrateTo()) { peerId = peer->migrateTo()->id; @@ -2579,7 +2579,7 @@ void MainWidget::showPeerProfile(PeerData *peer, bool back, int32 lastScrollTop) void MainWidget::showBackFromStack() { if (selectingPeer()) return; if (_stack.isEmpty()) { - showDialogs(); + Ui::showChatsList(); if (App::wnd()) QTimer::singleShot(0, App::wnd(), SLOT(setInnerFocus())); return; } @@ -2598,7 +2598,7 @@ void MainWidget::showBackFromStack() { } } StackItemHistory *histItem = static_cast(item); - showPeerHistory(histItem->peer->id, App::main()->activeMsgId(), true); + Ui::showPeerHistory(histItem->peer->id, App::main()->activeMsgId(), true); history.setReplyReturns(histItem->peer->id, histItem->replyReturns); } else if (item->type() == ProfileStackItem) { StackItemProfile *profItem = static_cast(item); @@ -2889,10 +2889,6 @@ bool MainWidget::needBackButton() { return overview || profile || (history.peer() && history.peer()->id); } -void MainWidget::showDialogs() { - showPeerHistory(0, 0); -} - void MainWidget::paintTopBar(QPainter &p, float64 over, int32 decreaseWidth) { if (profile) { profile->paintTopBar(p, over, decreaseWidth); @@ -2971,7 +2967,7 @@ void MainWidget::searchInPeer(PeerData *peer) { dialogs.activate(); } else { dialogsToUp(); - showDialogs(); + Ui::showChatsList(); } } @@ -3561,12 +3557,10 @@ void MainWidget::openPeerByName(const QString &username, bool toProfile, const Q PeerData *peer = App::peerByName(username); if (peer) { - if (toProfile) { + if (toProfile && !peer->isChannel()) { if (peer->isUser() && peer->asUser()->botInfo && !peer->asUser()->botInfo->cantJoinGroups && !startToken.isEmpty()) { peer->asUser()->botInfo->startGroupToken = startToken; Ui::showLayer(new ContactsBox(peer->asUser())); - } else if (peer->isChannel()) { - showPeerHistory(peer->id, ShowAtUnreadMsgId); } else { showPeerProfile(peer); } @@ -3578,7 +3572,7 @@ void MainWidget::openPeerByName(const QString &username, bool toProfile, const Q history.resizeEvent(0); } } - emit showPeerAsync(peer->id, 0); + Ui::showPeerHistoryAsync(peer->id, ShowAtUnreadMsgId); } } else { MTP::send(MTPcontacts_ResolveUsername(MTP_string(username)), rpcDone(&MainWidget::usernameResolveDone, qMakePair(toProfile, startToken)), rpcFail(&MainWidget::usernameResolveFail, username)); @@ -3643,7 +3637,7 @@ void MainWidget::usernameResolveDone(QPair toProfileStartToken, c peer->asUser()->botInfo->startGroupToken = toProfileStartToken.second; Ui::showLayer(new ContactsBox(peer->asUser())); } else if (peer->isChannel()) { - showPeerHistory(peer->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(peer->id, ShowAtUnreadMsgId); } else { showPeerProfile(peer); } @@ -3655,7 +3649,7 @@ void MainWidget::usernameResolveDone(QPair toProfileStartToken, c history.resizeEvent(0); } } - showPeerHistory(peer->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(peer->id, ShowAtUnreadMsgId); } } @@ -3682,7 +3676,7 @@ void MainWidget::inviteCheckDone(QString hash, const MTPChatInvite &invite) { const MTPDchatInviteAlready &d(invite.c_chatInviteAlready()); PeerData *chat = App::feedChats(MTP_vector(1, d.vchat)); if (chat) { - showPeerHistory(chat->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(chat->id, ShowAtUnreadMsgId); } } break; } @@ -3714,9 +3708,9 @@ void MainWidget::inviteImportDone(const MTPUpdates &updates) { } if (v && !v->isEmpty()) { if (v->front().type() == mtpc_chat) { - App::main()->showPeerHistory(peerFromChat(v->front().c_chat().vid.v), ShowAtTheEndMsgId); + Ui::showPeerHistory(peerFromChat(v->front().c_chat().vid.v), ShowAtTheEndMsgId); } else if (v->front().type() == mtpc_channel) { - App::main()->showPeerHistory(peerFromChannel(v->front().c_channel().vid.v), ShowAtTheEndMsgId); + Ui::showPeerHistory(peerFromChannel(v->front().c_channel().vid.v), ShowAtTheEndMsgId); } } } diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 8bd409321..215f7711b 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -194,7 +194,6 @@ public: void updateWideMode(); bool needBackButton(); - void showDialogs(); void paintTopBar(QPainter &p, float64 over, int32 decreaseWidth); TopBarWidget *topBar(); @@ -411,6 +410,7 @@ public: void ui_showStickerPreview(DocumentData *sticker); void ui_hideStickerPreview(); void ui_redrawHistoryItem(const HistoryItem *item); + void ui_showPeerHistory(quint64 peer, qint32 msgId, bool back); void notify_botCommandsChanged(UserData *bot); void notify_userIsBotChanged(UserData *bot); @@ -427,7 +427,6 @@ signals: void peerPhotoChanged(PeerData *peer); void dialogRowReplaced(DialogRow *oldRow, DialogRow *newRow); void dialogsUpdated(); - void showPeerAsync(quint64 peerId, qint32 showAtMsgId); void stickersUpdated(); public slots: @@ -459,7 +458,6 @@ public slots: void checkIdleFinish(); void updateOnlineDisplay(); - void showPeerHistory(quint64 peer, qint32 msgId, bool back = false); void onTopBarClick(); void onHistoryShown(History *history, MsgId atMsgId); diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 7a88a1740..380899f13 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -526,7 +526,7 @@ void MediaView::onToMessage() { if (HistoryItem *item = _msgid ? App::histItemById(_msgmigrated ? 0 : _channel, _msgid) : 0) { if (App::wnd()) { close(); - if (App::main()) App::main()->showPeerHistory(item->history()->peer->id, _msgid); + Ui::showPeerHistoryAtItem(item); } } } @@ -1808,7 +1808,7 @@ void MediaView::mouseReleaseEvent(QMouseEvent *e) { } else { if (reBotCommand().match(lnk->encoded()).hasMatch() && _history) { App::wnd()->hideMediaview(); - App::main()->showPeerHistory(_history->peer->id, ShowAtTheEndMsgId); + Ui::showPeerHistory(_history, ShowAtTheEndMsgId); } lnk->onClick(e->button()); } diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index d3c40cd09..b2b454d7a 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -2044,7 +2044,7 @@ void OverviewInner::goToMessage() { HistoryItem *item = App::contextItem(); if (!item) return; - App::main()->showPeerHistory(item->history()->peer->id, item->id); + Ui::showPeerHistoryAtItem(item); } void OverviewInner::forwardMessage() { diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index c8bc70cb3..47424ee92 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -237,7 +237,7 @@ void ProfileInner::onInviteToGroup() { } void ProfileInner::onSendMessage() { - App::main()->showPeerHistory(_peer->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(_peer, ShowAtUnreadMsgId); } void ProfileInner::onSearchInPeer() { @@ -329,10 +329,10 @@ void ProfileInner::onDeleteConversationSure() { if (_peerUser) { App::main()->deleteConversation(_peer); } else if (_peerChat) { - App::main()->showDialogs(); + Ui::showChatsList(); MTP::send(MTPmessages_DeleteChatUser(_peerChat->inputChat, App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, _peer), App::main()->rpcFail(&MainWidget::leaveChatFailed, _peer)); } else if (_peerChannel) { - App::main()->showDialogs(); + Ui::showChatsList(); if (_peerChannel->migrateFrom()) { App::main()->deleteConversation(_peerChannel->migrateFrom()); } @@ -350,7 +350,7 @@ void ProfileInner::onDeleteChannel() { void ProfileInner::onDeleteChannelSure() { if (_peerChannel) { Ui::hideLayer(); - App::main()->showDialogs(); + Ui::showChatsList(); if (_peerChannel->migrateFrom()) { App::main()->deleteConversation(_peerChannel->migrateFrom()); } @@ -562,7 +562,7 @@ void ProfileInner::onBotSettings() { for (int32 i = 0, l = _peerUser->botInfo->commands.size(); i != l; ++i) { QString cmd = _peerUser->botInfo->commands.at(i).command; if (!cmd.compare(qsl("settings"), Qt::CaseInsensitive)) { - App::main()->showPeerHistory(_peer->id, ShowAtTheEndMsgId); + Ui::showPeerHistory(_peer, ShowAtTheEndMsgId); App::main()->sendBotCommand('/' + cmd, 0); return; } @@ -576,7 +576,7 @@ void ProfileInner::onBotHelp() { for (int32 i = 0, l = _peerUser->botInfo->commands.size(); i != l; ++i) { QString cmd = _peerUser->botInfo->commands.at(i).command; if (!cmd.compare(qsl("help"), Qt::CaseInsensitive)) { - App::main()->showPeerHistory(_peer->id, ShowAtTheEndMsgId); + Ui::showPeerHistory(_peer, ShowAtTheEndMsgId); App::main()->sendBotCommand('/' + cmd, 0); return; } @@ -1085,7 +1085,7 @@ void ProfileInner::mouseReleaseEvent(QMouseEvent *e) { App::searchByHashtag(lnk->encoded(), _peerChannel); } else { if (reBotCommand().match(lnk->encoded()).hasMatch()) { - App::main()->showPeerHistory(_peer->id, ShowAtTheEndMsgId); + Ui::showPeerHistory(_peer, ShowAtTheEndMsgId); } lnk->onClick(e->button()); } @@ -1250,7 +1250,7 @@ void ProfileInner::migrateDone(const MTPUpdates &updates) { for (int32 i = 0, l = v->size(); i < l; ++i) { if (v->at(i).type() == mtpc_channel) { peer = App::channel(v->at(i).c_channel().vid.v); - App::main()->showPeerHistory(peer->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(peer, ShowAtUnreadMsgId); QTimer::singleShot(ReloadChannelMembersTimeout, App::api(), SLOT(delayedRequestParticipantsCount())); } } diff --git a/Telegram/SourceFiles/pspecific_mac.cpp b/Telegram/SourceFiles/pspecific_mac.cpp index 61cc6d1db..420ff8ad9 100644 --- a/Telegram/SourceFiles/pspecific_mac.cpp +++ b/Telegram/SourceFiles/pspecific_mac.cpp @@ -76,7 +76,7 @@ void MacPrivate::notifyClicked(unsigned long long peer, int msgid) { tomsg = false; } } - App::main()->showPeerHistory(history->peer->id, tomsg ? msgid : ShowAtUnreadMsgId); + Ui::showPeerHistory(history, tomsg ? msgid : ShowAtUnreadMsgId); App::wnd()->notifyClear(history); } } diff --git a/Telegram/SourceFiles/pspecific_wnd.cpp b/Telegram/SourceFiles/pspecific_wnd.cpp index 8bfef9751..6f5c0794f 100644 --- a/Telegram/SourceFiles/pspecific_wnd.cpp +++ b/Telegram/SourceFiles/pspecific_wnd.cpp @@ -2620,7 +2620,7 @@ public: tomsg = false; } } - App::main()->showPeerHistory(history->peer->id, tomsg ? _msgId : ShowAtUnreadMsgId); + Ui::showPeerHistory(history, tomsg ? _msgId : ShowAtUnreadMsgId); App::wnd()->notifyClear(history); } SetForegroundWindow(App::wnd()->psHwnd()); diff --git a/Telegram/SourceFiles/settingswidget.cpp b/Telegram/SourceFiles/settingswidget.cpp index 41c2be4ea..b5ef77c74 100644 --- a/Telegram/SourceFiles/settingswidget.cpp +++ b/Telegram/SourceFiles/settingswidget.cpp @@ -1139,7 +1139,7 @@ void SettingsInner::supportGot(const MTPhelp_Support &support) { if (support.type() == mtpc_help_support) { const MTPDhelp_support &d(support.c_help_support()); UserData *u = App::feedUsers(MTP_vector(1, d.vuser)); - App::main()->showPeerHistory(u->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(u, ShowAtUnreadMsgId); App::wnd()->hideSettings(); } } diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index e90d5f1fd..ecad9645f 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -1110,7 +1110,7 @@ void PeerLink::onClick(Qt::MouseButton button) const { if (!peer()->asChannel()->isPublic() && !peer()->asChannel()->amIn()) { Ui::showLayer(new InformBox(lang((peer()->isMegagroup()) ? lng_group_not_accessible : lng_channel_not_accessible))); } else { - App::main()->showPeerHistory(peer()->id, ShowAtUnreadMsgId); + Ui::showPeerHistory(peer(), ShowAtUnreadMsgId); } } else { App::main()->showPeerProfile(peer()); @@ -1124,13 +1124,13 @@ void MessageLink::onClick(Qt::MouseButton button) const { if (current && current->history()->peer->id == peer()) { App::main()->pushReplyReturn(current); } - App::main()->showPeerHistory(peer(), msgid()); + Ui::showPeerHistory(peer(), msgid()); } } void CommentsLink::onClick(Qt::MouseButton button) const { if (button == Qt::LeftButton && App::main() && _item->history()->isChannel()) { - App::main()->showPeerHistory(_item->history()->peer->id, _item->id); + Ui::showPeerHistoryAtItem(_item); } } diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index f072cc85a..3f067221e 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -296,7 +296,7 @@ void NotifyWindow::mousePressEvent(QMouseEvent *e) { App::wnd()->notifyClear(); } else { App::wnd()->hideSettings(); - App::main()->showPeerHistory(peer, (!history->peer->isUser() && item && item->mentionsMe() && item->id > 0) ? item->id : ShowAtUnreadMsgId); + Ui::showPeerHistory(peer, (!history->peer->isUser() && item && item->mentionsMe() && item->id > 0) ? item->id : ShowAtUnreadMsgId); } e->ignore(); }