From bc4e3599890482972452ab7639275a3c387c056a Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Sun, 22 Apr 2018 20:12:58 +0300 Subject: [PATCH] Rearrange facades includes --- Telegram/SourceFiles/facades.cpp | 34 ++++++++++++++++++++++ Telegram/SourceFiles/facades.h | 49 ++++++++++---------------------- 2 files changed, 49 insertions(+), 34 deletions(-) diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index aa91deacb..405e2d5ee 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -259,16 +259,42 @@ void showPeerProfile(const PeerId &peer) { } } +void showPeerProfile(const PeerData *peer) { + showPeerProfile(peer->id); +} + +void showPeerProfile(const History *history) { + showPeerProfile(history->peer->id); +} + void showPeerOverview(const PeerId &peer, MediaOverviewType type) { if (auto m = App::main()) { m->showMediaOverview(App::peer(peer), type); } } +void showPeerOverview(const PeerData *peer, MediaOverviewType type) { + showPeerOverview(peer->id, type); +} + +void showPeerOverview(const History *history, MediaOverviewType type) { + showPeerOverview(history->peer->id, type); +} + void showPeerHistory(const PeerId &peer, MsgId msgId, ShowWay way) { if (MainWidget *m = App::main()) m->ui_showPeerHistory(peer, msgId, way); } +void showPeerHistory(const PeerData *peer, MsgId msgId, ShowWay way = ShowWay::ClearStack) { + showPeerHistory(peer->id, msgId, way); +} +void showPeerHistory(const History *history, MsgId msgId, ShowWay way = ShowWay::ClearStack) { + showPeerHistory(history->peer->id, msgId, way); +} +void showPeerHistoryAtItem(const HistoryItem *item, ShowWay way = ShowWay::ClearStack) { + showPeerHistory(item->history()->peer->id, item->id, way); +} + void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way) { if (MainWidget *m = App::main()) { qRegisterMetaType(); @@ -276,6 +302,14 @@ void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way) { } } +void showChatsList() { + showPeerHistory(PeerId(0), 0, ShowWay::ClearStack); +} +void showChatsListAsync() { + showPeerHistoryAsync(PeerId(0), 0, ShowWay::ClearStack); +} + + PeerData *getPeerForMouseAction() { return Messenger::Instance().ui_getPeerForMouseAction(); } diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h index a9af1d734..b44d78ab7 100644 --- a/Telegram/SourceFiles/facades.h +++ b/Telegram/SourceFiles/facades.h @@ -20,17 +20,16 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #pragma once -#include "base/type_traits.h" -#include "base/observer.h" #include "base/lambda_guard.h" -#include "core/click_handler.h" -#include "scheme.h" -#include "app.h" -#include "ui/twidget.h" -#include "history/history_item.h" +#include "structs.h" +#include "history/history.h" // For MediaOverviewType ffs.. +class PeerData; class LayerWidget; class BoxContent; +class UserData; +class History; +class HistoryItem; namespace InlineBots { namespace Layout { @@ -114,20 +113,12 @@ void repaintHistoryItem(not_null item); void autoplayMediaInlineAsync(const FullMsgId &msgId); void showPeerProfile(const PeerId &peer); -inline void showPeerProfile(const PeerData *peer) { - showPeerProfile(peer->id); -} -inline void showPeerProfile(const History *history) { - showPeerProfile(history->peer->id); -} +void showPeerProfile(const PeerData *peer); +void showPeerProfile(const History *history); void showPeerOverview(const PeerId &peer, MediaOverviewType type); -inline void showPeerOverview(const PeerData *peer, MediaOverviewType type) { - showPeerOverview(peer->id, type); -} -inline void showPeerOverview(const History *history, MediaOverviewType type) { - showPeerOverview(history->peer->id, type); -} +void showPeerOverview(const PeerData *peer, MediaOverviewType type); +void showPeerOverview(const History *history, MediaOverviewType type); enum class ShowWay { ClearStack, @@ -135,22 +126,12 @@ enum class ShowWay { Backward, }; void showPeerHistory(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack); -inline void showPeerHistory(const PeerData *peer, MsgId msgId, ShowWay way = ShowWay::ClearStack) { - showPeerHistory(peer->id, msgId, way); -} -inline void showPeerHistory(const History *history, MsgId msgId, ShowWay way = ShowWay::ClearStack) { - showPeerHistory(history->peer->id, msgId, way); -} -inline void showPeerHistoryAtItem(const HistoryItem *item, ShowWay way = ShowWay::ClearStack) { - showPeerHistory(item->history()->peer->id, item->id, way); -} +void showPeerHistory(const PeerData *peer, MsgId msgId, ShowWay way = ShowWay::ClearStack); +void showPeerHistory(const History *history, MsgId msgId, ShowWay way = ShowWay::ClearStack); +void showPeerHistoryAtItem(const HistoryItem *item, ShowWay way = ShowWay::ClearStack); void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack); -inline void showChatsList() { - showPeerHistory(PeerId(0), 0, ShowWay::ClearStack); -} -inline void showChatsListAsync() { - showPeerHistoryAsync(PeerId(0), 0, ShowWay::ClearStack); -} +void showChatsList(); +void showChatsListAsync(); PeerData *getPeerForMouseAction(); bool skipPaintEvent(QWidget *widget, QPaintEvent *event);