Rearrange facades includes

This commit is contained in:
Berkus Decker 2018-04-22 20:12:58 +03:00
parent ca593d62bf
commit bc4e359989
2 changed files with 49 additions and 34 deletions

View File

@ -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) { void showPeerOverview(const PeerId &peer, MediaOverviewType type) {
if (auto m = App::main()) { if (auto m = App::main()) {
m->showMediaOverview(App::peer(peer), type); 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) { void showPeerHistory(const PeerId &peer, MsgId msgId, ShowWay way) {
if (MainWidget *m = App::main()) m->ui_showPeerHistory(peer, msgId, 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) { void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way) {
if (MainWidget *m = App::main()) { if (MainWidget *m = App::main()) {
qRegisterMetaType<Ui::ShowWay>(); qRegisterMetaType<Ui::ShowWay>();
@ -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() { PeerData *getPeerForMouseAction() {
return Messenger::Instance().ui_getPeerForMouseAction(); return Messenger::Instance().ui_getPeerForMouseAction();
} }

View File

@ -20,17 +20,16 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include "base/type_traits.h"
#include "base/observer.h"
#include "base/lambda_guard.h" #include "base/lambda_guard.h"
#include "core/click_handler.h" #include "structs.h"
#include "scheme.h" #include "history/history.h" // For MediaOverviewType ffs..
#include "app.h"
#include "ui/twidget.h"
#include "history/history_item.h"
class PeerData;
class LayerWidget; class LayerWidget;
class BoxContent; class BoxContent;
class UserData;
class History;
class HistoryItem;
namespace InlineBots { namespace InlineBots {
namespace Layout { namespace Layout {
@ -114,20 +113,12 @@ void repaintHistoryItem(not_null<const HistoryItem*> item);
void autoplayMediaInlineAsync(const FullMsgId &msgId); void autoplayMediaInlineAsync(const FullMsgId &msgId);
void showPeerProfile(const PeerId &peer); void showPeerProfile(const PeerId &peer);
inline void showPeerProfile(const PeerData *peer) { void showPeerProfile(const PeerData *peer);
showPeerProfile(peer->id); void showPeerProfile(const History *history);
}
inline void showPeerProfile(const History *history) {
showPeerProfile(history->peer->id);
}
void showPeerOverview(const PeerId &peer, MediaOverviewType type); void showPeerOverview(const PeerId &peer, MediaOverviewType type);
inline void showPeerOverview(const PeerData *peer, MediaOverviewType type) { void showPeerOverview(const PeerData *peer, MediaOverviewType type);
showPeerOverview(peer->id, type); void showPeerOverview(const History *history, MediaOverviewType type);
}
inline void showPeerOverview(const History *history, MediaOverviewType type) {
showPeerOverview(history->peer->id, type);
}
enum class ShowWay { enum class ShowWay {
ClearStack, ClearStack,
@ -135,22 +126,12 @@ enum class ShowWay {
Backward, Backward,
}; };
void showPeerHistory(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack); void showPeerHistory(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack);
inline void showPeerHistory(const PeerData *peer, MsgId msgId, ShowWay way = ShowWay::ClearStack) { 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);
} void showPeerHistoryAtItem(const HistoryItem *item, ShowWay way = ShowWay::ClearStack);
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 showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack); void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack);
inline void showChatsList() { void showChatsList();
showPeerHistory(PeerId(0), 0, ShowWay::ClearStack); void showChatsListAsync();
}
inline void showChatsListAsync() {
showPeerHistoryAsync(PeerId(0), 0, ShowWay::ClearStack);
}
PeerData *getPeerForMouseAction(); PeerData *getPeerForMouseAction();
bool skipPaintEvent(QWidget *widget, QPaintEvent *event); bool skipPaintEvent(QWidget *widget, QPaintEvent *event);