mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Remove history_item and layout from pch.
Also move some code to separate modules. Also create history item views by Window::Controller.
This commit is contained in:
@@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "styles/style_window.h"
|
||||
#include "storage/file_download.h"
|
||||
#include "auth_session.h"
|
||||
#include "history/history_item.h"
|
||||
#include "platform/platform_specific.h"
|
||||
|
||||
namespace Window {
|
||||
@@ -63,6 +64,16 @@ Manager::Manager(System *system) : Notifications::Manager(system) {
|
||||
_inputCheckTimer.setTimeoutHandler([this] { checkLastInput(); });
|
||||
}
|
||||
|
||||
Manager::QueuedNotification::QueuedNotification(
|
||||
not_null<HistoryItem*> item
|
||||
, int forwardedCount)
|
||||
: history(item->history())
|
||||
, peer(history->peer)
|
||||
, author((!peer->isUser() && !item->isPost()) ? item->author() : nullptr)
|
||||
, item((forwardedCount < 2) ? item.get() : nullptr)
|
||||
, forwardedCount(forwardedCount) {
|
||||
}
|
||||
|
||||
QPixmap Manager::hiddenUserpicPlaceholder() const {
|
||||
if (_hiddenUserpicPlaceholder.isNull()) {
|
||||
_hiddenUserpicPlaceholder = App::pixmapFromImageInPlace(Messenger::Instance().logoNoMargin().scaled(st::notifyPhotoSize, st::notifyPhotoSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
|
@@ -82,16 +82,10 @@ private:
|
||||
SingleTimer _inputCheckTimer;
|
||||
|
||||
struct QueuedNotification {
|
||||
QueuedNotification(HistoryItem *item, int forwardedCount)
|
||||
: history(item->history())
|
||||
, peer(history->peer)
|
||||
, author((!peer->isUser() && !item->isPost()) ? item->author() : nullptr)
|
||||
, item((forwardedCount > 1) ? nullptr : item)
|
||||
, forwardedCount(forwardedCount) {
|
||||
}
|
||||
QueuedNotification(not_null<HistoryItem*> item, int forwardedCount);
|
||||
|
||||
History *history;
|
||||
PeerData *peer;
|
||||
not_null<History*> history;
|
||||
not_null<PeerData*> peer;
|
||||
PeerData *author;
|
||||
HistoryItem *item;
|
||||
int forwardedCount;
|
||||
|
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "window/themes/window_theme.h"
|
||||
#include "window/themes/window_theme_editor_block.h"
|
||||
#include "mainwindow.h"
|
||||
#include "layout.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "styles/style_window.h"
|
||||
|
@@ -9,7 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "window/main_window.h"
|
||||
#include "info/info_memento.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "history/view/history_view_message.h"
|
||||
#include "history/view/history_view_service_message.h"
|
||||
#include "history/history_item.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "styles/style_window.h"
|
||||
@@ -403,4 +406,16 @@ not_null<MainWidget*> Controller::chats() const {
|
||||
return App::wnd()->chatsWidget();
|
||||
}
|
||||
|
||||
std::unique_ptr<HistoryView::Element> Controller::createMessageView(
|
||||
not_null<HistoryMessage*> message,
|
||||
HistoryView::Context context) {
|
||||
return std::make_unique<HistoryView::Message>(message, context);
|
||||
}
|
||||
|
||||
std::unique_ptr<HistoryView::Element> Controller::createMessageView(
|
||||
not_null<HistoryService*> message,
|
||||
HistoryView::Context context) {
|
||||
return std::make_unique<HistoryView::Service>(message, context);
|
||||
}
|
||||
|
||||
} // namespace Window
|
||||
|
@@ -11,6 +11,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "base/flags.h"
|
||||
|
||||
class MainWidget;
|
||||
class HistoryMessage;
|
||||
class HistoryService;
|
||||
|
||||
namespace HistoryView {
|
||||
enum class Context : char;
|
||||
} // namespace HistoryView
|
||||
|
||||
namespace Window {
|
||||
|
||||
@@ -195,6 +201,13 @@ public:
|
||||
return this;
|
||||
}
|
||||
|
||||
std::unique_ptr<HistoryView::Element> createMessageView(
|
||||
not_null<HistoryMessage*> message,
|
||||
HistoryView::Context context);
|
||||
std::unique_ptr<HistoryView::Element> createMessageView(
|
||||
not_null<HistoryService*> message,
|
||||
HistoryView::Context context);
|
||||
|
||||
private:
|
||||
int minimalThreeColumnWidth() const;
|
||||
not_null<MainWidget*> chats() const;
|
||||
|
Reference in New Issue
Block a user