mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-28 00:13:04 +02:00
Rename RepliesWidget/Memento to ChatWidget/Memento.
This commit is contained in:
parent
abcf7e3a47
commit
40053e3388
8 changed files with 453 additions and 399 deletions
|
@ -836,6 +836,8 @@ PRIVATE
|
|||
history/view/history_view_bottom_info.h
|
||||
history/view/history_view_chat_preview.cpp
|
||||
history/view/history_view_chat_preview.h
|
||||
history/view/history_view_chat_section.cpp
|
||||
history/view/history_view_chat_section.h
|
||||
history/view/history_view_contact_status.cpp
|
||||
history/view/history_view_contact_status.h
|
||||
history/view/history_view_context_menu.cpp
|
||||
|
@ -870,8 +872,6 @@ PRIVATE
|
|||
history/view/history_view_pinned_tracker.h
|
||||
history/view/history_view_quick_action.cpp
|
||||
history/view/history_view_quick_action.h
|
||||
history/view/history_view_replies_section.cpp
|
||||
history/view/history_view_replies_section.h
|
||||
history/view/history_view_reply.cpp
|
||||
history/view/history_view_reply.h
|
||||
history/view/history_view_requests_bar.cpp
|
||||
|
|
|
@ -27,7 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/premium_preview_box.h"
|
||||
#include "main/main_session.h"
|
||||
#include "history/history.h"
|
||||
#include "history/view/history_view_replies_section.h"
|
||||
#include "history/view/history_view_chat_section.h"
|
||||
#include "history/view/history_view_sticker_toast.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "info/profile/info_profile_emoji_status_panel.h"
|
||||
|
@ -518,13 +518,15 @@ void EditForumTopicBox(
|
|||
title->showError();
|
||||
return;
|
||||
}
|
||||
using namespace HistoryView;
|
||||
controller->showSection(
|
||||
std::make_shared<HistoryView::RepliesMemento>(
|
||||
forum,
|
||||
channel->forum()->reserveCreatingId(
|
||||
std::make_shared<ChatMemento>(ChatViewId{
|
||||
.history = forum,
|
||||
.repliesRootId = channel->forum()->reserveCreatingId(
|
||||
title->getLastText().trimmed(),
|
||||
state->defaultIcon.current().colorId,
|
||||
state->iconId.current())),
|
||||
state->iconId.current()),
|
||||
}),
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
};
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_item.h"
|
||||
#include "history/history_unread_things.h"
|
||||
#include "history/view/history_view_item_preview.h"
|
||||
#include "history/view/history_view_replies_section.h"
|
||||
#include "history/view/history_view_chat_section.h"
|
||||
#include "main/main_session.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "ui/painter.h"
|
||||
|
|
|
@ -5311,7 +5311,7 @@ void HistoryWidget::updateSendButtonType() {
|
|||
using Type = Ui::SendButton::Type;
|
||||
|
||||
const auto type = computeSendButtonType();
|
||||
// This logic is duplicated in RepliesWidget.
|
||||
// This logic is duplicated in ChatWidget.
|
||||
const auto disabledBySlowmode = _peer
|
||||
&& _peer->slowmodeApplied()
|
||||
&& (_history->latestSendingMessage() != nullptr);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -64,7 +64,7 @@ struct VoiceToSend;
|
|||
|
||||
class Element;
|
||||
class TopBarWidget;
|
||||
class RepliesMemento;
|
||||
class ChatMemento;
|
||||
class ComposeControls;
|
||||
class ComposeSearch;
|
||||
class SendActionPainter;
|
||||
|
@ -74,17 +74,24 @@ class EmptyPainter;
|
|||
class PinnedTracker;
|
||||
class TranslateBar;
|
||||
|
||||
class RepliesWidget final
|
||||
struct ChatViewId {
|
||||
not_null<History*> history;
|
||||
MsgId repliesRootId;
|
||||
Data::SavedSublist *sublist = nullptr;
|
||||
|
||||
friend inline bool operator==(ChatViewId, ChatViewId) = default;
|
||||
};
|
||||
|
||||
class ChatWidget final
|
||||
: public Window::SectionWidget
|
||||
, private WindowListDelegate
|
||||
, private CornerButtonsDelegate {
|
||||
public:
|
||||
RepliesWidget(
|
||||
ChatWidget(
|
||||
QWidget *parent,
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<History*> history,
|
||||
MsgId rootId);
|
||||
~RepliesWidget();
|
||||
ChatViewId id);
|
||||
~ChatWidget();
|
||||
|
||||
[[nodiscard]] not_null<History*> history() const;
|
||||
Dialogs::RowDescriptor activeChat() const override;
|
||||
|
@ -114,7 +121,7 @@ public:
|
|||
|
||||
void setInternalState(
|
||||
const QRect &geometry,
|
||||
not_null<RepliesMemento*> memento);
|
||||
not_null<ChatMemento*> memento);
|
||||
|
||||
// Tabbed selector management.
|
||||
bool pushTabbedSelectorToThirdSection(
|
||||
|
@ -218,8 +225,8 @@ private:
|
|||
void updateInnerVisibleArea();
|
||||
void updateControlsGeometry();
|
||||
void updateAdaptiveLayout();
|
||||
void saveState(not_null<RepliesMemento*> memento);
|
||||
void restoreState(not_null<RepliesMemento*> memento);
|
||||
void saveState(not_null<ChatMemento*> memento);
|
||||
void restoreState(not_null<ChatMemento*> memento);
|
||||
void setReplies(std::shared_ptr<Data::RepliesList> replies);
|
||||
void refreshReplies();
|
||||
void showAtStart();
|
||||
|
@ -267,7 +274,7 @@ private:
|
|||
void chooseAttach(std::optional<bool> overrideSendImagesAsPhotos);
|
||||
[[nodiscard]] SendMenu::Details sendMenuDetails() const;
|
||||
[[nodiscard]] FullReplyTo replyTo() const;
|
||||
[[nodiscard]] HistoryItem *lookupRoot() const;
|
||||
[[nodiscard]] HistoryItem *lookupRepliesRoot() const;
|
||||
[[nodiscard]] Data::ForumTopic *lookupTopic();
|
||||
[[nodiscard]] bool computeAreComments() const;
|
||||
void orderWidgets();
|
||||
|
@ -347,16 +354,21 @@ private:
|
|||
[[nodiscard]] bool showSlowmodeError();
|
||||
|
||||
const not_null<History*> _history;
|
||||
MsgId _rootId = 0;
|
||||
std::shared_ptr<Ui::ChatTheme> _theme;
|
||||
HistoryItem *_root = nullptr;
|
||||
const not_null<PeerData*> _peer;
|
||||
ChatViewId _id;
|
||||
|
||||
MsgId _repliesRootId = 0;
|
||||
HistoryItem *_repliesRoot = nullptr;
|
||||
Data::ForumTopic *_topic = nullptr;
|
||||
mutable bool _newTopicDiscarded = false;
|
||||
|
||||
std::shared_ptr<Data::RepliesList> _replies;
|
||||
rpl::lifetime _repliesLifetime;
|
||||
rpl::variable<bool> _areComments = false;
|
||||
|
||||
Data::SavedSublist *_sublist = nullptr;
|
||||
|
||||
std::shared_ptr<SendActionPainter> _sendAction;
|
||||
std::shared_ptr<Ui::ChatTheme> _theme;
|
||||
QPointer<ListWidget> _inner;
|
||||
object_ptr<TopBarWidget> _topBar;
|
||||
object_ptr<Ui::PlainShadow> _topBarShadow;
|
||||
|
@ -380,11 +392,11 @@ private:
|
|||
std::optional<FullMsgId> _minPinnedId;
|
||||
HistoryItem *_shownPinnedItem = nullptr;
|
||||
|
||||
std::unique_ptr<Ui::PinnedBar> _rootView;
|
||||
int _rootViewHeight = 0;
|
||||
bool _rootViewInited = false;
|
||||
bool _rootViewInitScheduled = false;
|
||||
rpl::variable<bool> _rootVisible = false;
|
||||
std::unique_ptr<Ui::PinnedBar> _repliesRootView;
|
||||
int _repliesRootViewHeight = 0;
|
||||
bool _repliesRootViewInited = false;
|
||||
bool _repliesRootViewInitScheduled = false;
|
||||
rpl::variable<bool> _repliesRootVisible = false;
|
||||
|
||||
std::unique_ptr<Ui::ScrollArea> _scroll;
|
||||
std::unique_ptr<HistoryView::StickerToast> _stickerToast;
|
||||
|
@ -408,15 +420,18 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class RepliesMemento final : public Window::SectionMemento {
|
||||
class ChatMemento final : public Window::SectionMemento {
|
||||
public:
|
||||
RepliesMemento(
|
||||
not_null<History*> history,
|
||||
MsgId rootId,
|
||||
explicit ChatMemento(
|
||||
ChatViewId id,
|
||||
MsgId highlightId = 0,
|
||||
const TextWithEntities &highlightPart = {},
|
||||
int highlightPartOffsetHint = 0);
|
||||
explicit RepliesMemento(
|
||||
|
||||
struct Comments {
|
||||
};
|
||||
explicit ChatMemento(
|
||||
Comments,
|
||||
not_null<HistoryItem*> commentsItem,
|
||||
MsgId commentId = 0);
|
||||
|
||||
|
@ -431,11 +446,8 @@ public:
|
|||
Window::Column column,
|
||||
const QRect &geometry) override;
|
||||
|
||||
[[nodiscard]] not_null<History*> getHistory() const {
|
||||
return _history;
|
||||
}
|
||||
[[nodiscard]] MsgId getRootId() const {
|
||||
return _rootId;
|
||||
[[nodiscard]] ChatViewId id() const {
|
||||
return _id;
|
||||
}
|
||||
|
||||
void setReplies(std::shared_ptr<Data::RepliesList> replies) {
|
||||
|
@ -472,8 +484,7 @@ public:
|
|||
private:
|
||||
void setupTopicViewer();
|
||||
|
||||
const not_null<History*> _history;
|
||||
MsgId _rootId = 0;
|
||||
ChatViewId _id;
|
||||
const TextWithEntities _highlightPart;
|
||||
const int _highlightPartOffsetHint = 0;
|
||||
const MsgId _highlightId = 0;
|
|
@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mtproto/mtproto_config.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/view/history_view_replies_section.h"
|
||||
#include "history/view/history_view_chat_section.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "data/notify/data_notify_settings.h"
|
||||
#include "data/stickers/data_custom_emoji.h"
|
||||
|
@ -1221,11 +1221,12 @@ Window::SessionController *Manager::openNotificationMessage(
|
|||
if (window) {
|
||||
window->widget()->showFromTray();
|
||||
if (topic) {
|
||||
using namespace HistoryView;
|
||||
window->showSection(
|
||||
std::make_shared<HistoryView::RepliesMemento>(
|
||||
history,
|
||||
topic->rootId(),
|
||||
itemId),
|
||||
std::make_shared<ChatMemento>(ChatViewId{
|
||||
.history = history,
|
||||
.repliesRootId = topic->rootId(),
|
||||
}, itemId),
|
||||
SectionShow::Way::Forward);
|
||||
} else {
|
||||
window->showPeerHistory(
|
||||
|
|
|
@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_item.h"
|
||||
#include "history/view/reactions/history_view_reactions.h"
|
||||
//#include "history/view/reactions/history_view_reactions_button.h"
|
||||
#include "history/view/history_view_replies_section.h"
|
||||
#include "history/view/history_view_chat_section.h"
|
||||
#include "history/view/history_view_scheduled_section.h"
|
||||
#include "history/view/history_view_sublist_section.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
|
@ -1140,9 +1140,12 @@ void SessionNavigation::showRepliesForMessage(
|
|||
if (const auto topic = history->peer->forumTopicFor(rootId)) {
|
||||
auto replies = topic->replies();
|
||||
if (replies->unreadCountKnown()) {
|
||||
auto memento = std::make_shared<HistoryView::RepliesMemento>(
|
||||
history,
|
||||
rootId,
|
||||
using namespace HistoryView;
|
||||
auto memento = std::make_shared<ChatMemento>(
|
||||
ChatViewId{
|
||||
.history = history,
|
||||
.repliesRootId = rootId,
|
||||
},
|
||||
commentId,
|
||||
params.highlightPart,
|
||||
params.highlightPartOffsetHint);
|
||||
|
@ -1156,7 +1159,7 @@ void SessionNavigation::showRepliesForMessage(
|
|||
&& _showingRepliesRootId == rootId) {
|
||||
return;
|
||||
} else if (!history->peer->asChannel()) {
|
||||
// HistoryView::RepliesWidget right now handles only channels.
|
||||
// HistoryView::ChatWidget replies right now handles only channels.
|
||||
return;
|
||||
}
|
||||
_api.request(base::take(_showingRepliesRequestId)).cancel();
|
||||
|
@ -1211,14 +1214,16 @@ void SessionNavigation::showRepliesForMessage(
|
|||
}
|
||||
}
|
||||
if (deleted || item) {
|
||||
using namespace HistoryView;
|
||||
auto memento = item
|
||||
? std::make_shared<HistoryView::RepliesMemento>(
|
||||
? std::make_shared<ChatMemento>(
|
||||
ChatMemento::Comments(),
|
||||
item,
|
||||
commentId)
|
||||
: std::make_shared<HistoryView::RepliesMemento>(
|
||||
history,
|
||||
rootId,
|
||||
commentId);
|
||||
: std::make_shared<ChatMemento>(ChatViewId{
|
||||
.history = history,
|
||||
.repliesRootId = rootId,
|
||||
}, commentId);
|
||||
memento->setReadInformation(
|
||||
data.vread_inbox_max_id().value_or_empty(),
|
||||
data.vunread_count().v,
|
||||
|
|
Loading…
Add table
Reference in a new issue