mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-24 09:16:57 +00:00
Hide root reply info in replies thread.
This commit is contained in:
parent
00cdae0369
commit
50a0429786
@ -591,6 +591,10 @@ bool InnerWidget::elementIsGifPaused() {
|
||||
return _controller->isGifPausedAtLeastFor(Window::GifPauseReason::Any);
|
||||
}
|
||||
|
||||
bool InnerWidget::elementHideReply(not_null<const Element*> view) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void InnerWidget::saveState(not_null<SectionMemento*> memento) {
|
||||
memento->setFilter(std::move(_filter));
|
||||
memento->setAdmins(std::move(_admins));
|
||||
|
@ -112,6 +112,8 @@ public:
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback) override;
|
||||
bool elementIsGifPaused() override;
|
||||
bool elementHideReply(
|
||||
not_null<const HistoryView::Element*> view) override;
|
||||
|
||||
~InnerWidget();
|
||||
|
||||
|
@ -3368,7 +3368,9 @@ not_null<HistoryView::ElementDelegate*> HistoryInner::ElementDelegate() {
|
||||
bool elementIsGifPaused() override {
|
||||
return Instance ? Instance->elementIsGifPaused() : false;
|
||||
}
|
||||
|
||||
bool elementHideReply(not_null<const Element*> view) override {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
static Result result;
|
||||
|
@ -112,6 +112,10 @@ bool SimpleElementDelegate::elementIsGifPaused() {
|
||||
return _controller->isGifPausedAtLeastFor(Window::GifPauseReason::Any);
|
||||
}
|
||||
|
||||
bool SimpleElementDelegate::elementHideReply(not_null<const Element*> view) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TextSelection UnshiftItemSelection(
|
||||
TextSelection selection,
|
||||
uint16 byLength) {
|
||||
@ -605,6 +609,10 @@ TimeId Element::displayedEditDate() const {
|
||||
return TimeId(0);
|
||||
}
|
||||
|
||||
HistoryMessageReply *Element::displayedReply() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Element::hasVisibleText() const {
|
||||
return false;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ class HistoryBlock;
|
||||
class HistoryItem;
|
||||
class HistoryMessage;
|
||||
class HistoryService;
|
||||
struct HistoryMessageReply;
|
||||
|
||||
namespace Window {
|
||||
class SessionController;
|
||||
@ -62,6 +63,7 @@ public:
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback) = 0;
|
||||
virtual bool elementIsGifPaused() = 0;
|
||||
virtual bool elementHideReply(not_null<const Element*> view) = 0;
|
||||
|
||||
};
|
||||
|
||||
@ -92,6 +94,7 @@ public:
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback) override;
|
||||
bool elementIsGifPaused() override;
|
||||
bool elementHideReply(not_null<const Element*> view) override;
|
||||
|
||||
private:
|
||||
const not_null<Window::SessionController*> _controller;
|
||||
@ -267,6 +270,7 @@ public:
|
||||
virtual bool displayEditedBadge() const;
|
||||
virtual TimeId displayedEditDate() const;
|
||||
virtual bool hasVisibleText() const;
|
||||
virtual HistoryMessageReply *displayedReply() const;
|
||||
|
||||
struct VerticalRepaintRange {
|
||||
int top = 0;
|
||||
|
@ -1175,6 +1175,10 @@ bool ListWidget::elementIsGifPaused() {
|
||||
return _controller->isGifPausedAtLeastFor(Window::GifPauseReason::Any);
|
||||
}
|
||||
|
||||
bool ListWidget::elementHideReply(not_null<const Element*> view) {
|
||||
return _delegate->listElementHideReply(view);
|
||||
}
|
||||
|
||||
void ListWidget::saveState(not_null<ListMemento*> memento) {
|
||||
memento->setAroundPosition(_aroundPosition);
|
||||
auto state = countScrollState();
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
const std::vector<not_null<Element*>> &elements) = 0;
|
||||
virtual void listContentRefreshed() = 0;
|
||||
virtual ClickHandlerPtr listDateLink(not_null<Element*> view) = 0;
|
||||
virtual bool listElementHideReply(not_null<const Element*> view) = 0;
|
||||
|
||||
};
|
||||
|
||||
@ -208,6 +209,7 @@ public:
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback) override;
|
||||
bool elementIsGifPaused() override;
|
||||
bool elementHideReply(not_null<const Element*> view) override;
|
||||
|
||||
~ListWidget();
|
||||
|
||||
|
@ -235,7 +235,7 @@ QSize Message::performCountOptimalSize() {
|
||||
|
||||
if (drawBubble()) {
|
||||
auto forwarded = item->Get<HistoryMessageForwarded>();
|
||||
auto reply = item->Get<HistoryMessageReply>();
|
||||
auto reply = displayedReply();
|
||||
auto via = item->Get<HistoryMessageVia>();
|
||||
auto entry = logEntryOriginal();
|
||||
if (forwarded) {
|
||||
@ -533,9 +533,10 @@ void Message::draw(
|
||||
p.restore();
|
||||
}
|
||||
|
||||
const auto reply = item->Get<HistoryMessageReply>();
|
||||
if (reply && reply->isNameUpdated()) {
|
||||
const_cast<Message*>(this)->setPendingResize();
|
||||
if (const auto reply = displayedReply()) {
|
||||
if (reply->isNameUpdated()) {
|
||||
const_cast<Message*>(this)->setPendingResize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -692,7 +693,7 @@ void Message::paintForwardedInfo(Painter &p, QRect &trect, bool selected) const
|
||||
|
||||
void Message::paintReplyInfo(Painter &p, QRect &trect, bool selected) const {
|
||||
const auto item = message();
|
||||
if (auto reply = item->Get<HistoryMessageReply>()) {
|
||||
if (auto reply = displayedReply()) {
|
||||
int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
|
||||
auto flags = HistoryMessageReply::PaintFlag::InBubble | 0;
|
||||
@ -1108,7 +1109,7 @@ bool Message::getStateReplyInfo(
|
||||
QRect &trect,
|
||||
not_null<TextState*> outResult) const {
|
||||
const auto item = message();
|
||||
if (auto reply = item->Get<HistoryMessageReply>()) {
|
||||
if (auto reply = displayedReply()) {
|
||||
int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom();
|
||||
if (point.y() >= trect.top() && point.y() < trect.top() + h) {
|
||||
if (reply->replyToMsg && QRect(trect.x(), trect.y() + st::msgReplyPadding.top(), trect.width(), st::msgReplyBarSize.height()).contains(point)) {
|
||||
@ -1509,6 +1510,13 @@ WebPage *Message::logEntryOriginal() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HistoryMessageReply *Message::displayedReply() const {
|
||||
if (const auto reply = data()->Get<HistoryMessageReply>()) {
|
||||
return delegate()->elementHideReply(this) ? nullptr : reply;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Message::hasFromName() const {
|
||||
switch (context()) {
|
||||
case Context::AdminLog:
|
||||
@ -1871,7 +1879,7 @@ int Message::resizeContentGetHeight(int newWidth) {
|
||||
}
|
||||
|
||||
if (bubble) {
|
||||
auto reply = item->Get<HistoryMessageReply>();
|
||||
auto reply = displayedReply();
|
||||
auto via = item->Get<HistoryMessageVia>();
|
||||
auto entry = logEntryOriginal();
|
||||
|
||||
|
@ -94,6 +94,7 @@ public:
|
||||
ClickHandlerPtr rightActionLink() const override;
|
||||
bool displayEditedBadge() const override;
|
||||
TimeId displayedEditDate() const override;
|
||||
HistoryMessageReply *displayedReply() const override;
|
||||
int infoWidth() const override;
|
||||
|
||||
VerticalRepaintRange verticalRepaintRange() const override;
|
||||
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/view/history_view_schedule_box.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_drag_area.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/history_item.h"
|
||||
#include "chat_helpers/send_context_menu.h" // SendMenu::Type.
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
@ -1165,6 +1166,10 @@ ClickHandlerPtr RepliesWidget::listDateLink(not_null<Element*> view) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool RepliesWidget::listElementHideReply(not_null<const Element*> view) {
|
||||
return (view->data()->replyToId() == _rootId);
|
||||
}
|
||||
|
||||
void RepliesWidget::confirmSendNowSelected() {
|
||||
auto items = _inner->getSelectedItems();
|
||||
if (items.empty()) {
|
||||
|
@ -115,6 +115,7 @@ public:
|
||||
const std::vector<not_null<Element*>> &elements) override;
|
||||
void listContentRefreshed() override;
|
||||
ClickHandlerPtr listDateLink(not_null<Element*> view) override;
|
||||
bool listElementHideReply(not_null<const Element*> view) override;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
@ -1146,6 +1146,10 @@ ClickHandlerPtr ScheduledWidget::listDateLink(not_null<Element*> view) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ScheduledWidget::listElementHideReply(not_null<const Element*> view) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void ScheduledWidget::confirmSendNowSelected() {
|
||||
auto items = _inner->getSelectedItems();
|
||||
if (items.empty()) {
|
||||
|
@ -110,6 +110,7 @@ public:
|
||||
const std::vector<not_null<Element*>> &elements) override;
|
||||
void listContentRefreshed() override;
|
||||
ClickHandlerPtr listDateLink(not_null<Element*> view) override;
|
||||
bool listElementHideReply(not_null<const Element*> view) override;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
@ -169,7 +169,7 @@ QSize Gif::countOptimalSize() {
|
||||
} else if (isSeparateRoundVideo()) {
|
||||
const auto item = _parent->data();
|
||||
auto via = item->Get<HistoryMessageVia>();
|
||||
auto reply = item->Get<HistoryMessageReply>();
|
||||
auto reply = _parent->displayedReply();
|
||||
auto forwarded = item->Get<HistoryMessageForwarded>();
|
||||
if (forwarded) {
|
||||
forwarded->create(via);
|
||||
@ -226,7 +226,7 @@ QSize Gif::countCurrentSize(int newWidth) {
|
||||
} else if (isSeparateRoundVideo()) {
|
||||
const auto item = _parent->data();
|
||||
auto via = item->Get<HistoryMessageVia>();
|
||||
auto reply = item->Get<HistoryMessageReply>();
|
||||
auto reply = _parent->displayedReply();
|
||||
auto forwarded = item->Get<HistoryMessageForwarded>();
|
||||
if (via || reply || forwarded) {
|
||||
auto additional = additionalWidth(via, reply, forwarded);
|
||||
@ -348,7 +348,7 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms
|
||||
auto usex = 0, usew = paintw;
|
||||
auto separateRoundVideo = isSeparateRoundVideo();
|
||||
auto via = separateRoundVideo ? item->Get<HistoryMessageVia>() : nullptr;
|
||||
auto reply = separateRoundVideo ? item->Get<HistoryMessageReply>() : nullptr;
|
||||
auto reply = separateRoundVideo ? _parent->displayedReply() : nullptr;
|
||||
auto forwarded = separateRoundVideo ? item->Get<HistoryMessageForwarded>() : nullptr;
|
||||
if (via || reply || forwarded) {
|
||||
usew = maxWidth() - additionalWidth(via, reply, forwarded);
|
||||
@ -752,7 +752,7 @@ TextState Gif::textState(QPoint point, StateRequest request) const {
|
||||
auto separateRoundVideo = isSeparateRoundVideo();
|
||||
const auto item = _parent->data();
|
||||
auto via = separateRoundVideo ? item->Get<HistoryMessageVia>() : nullptr;
|
||||
auto reply = separateRoundVideo ? item->Get<HistoryMessageReply>() : nullptr;
|
||||
auto reply = separateRoundVideo ? _parent->displayedReply() : nullptr;
|
||||
auto forwarded = separateRoundVideo ? item->Get<HistoryMessageForwarded>() : nullptr;
|
||||
if (via || reply || forwarded) {
|
||||
usew = maxWidth() - additionalWidth(via, reply, forwarded);
|
||||
|
@ -51,7 +51,7 @@ QSize UnwrappedMedia::countOptimalSize() {
|
||||
if (_parent->media() == this) {
|
||||
const auto item = _parent->data();
|
||||
const auto via = item->Get<HistoryMessageVia>();
|
||||
const auto reply = item->Get<HistoryMessageReply>();
|
||||
const auto reply = _parent->displayedReply();
|
||||
const auto forwarded = getDisplayedForwardedInfo();
|
||||
if (forwarded) {
|
||||
forwarded->create(via);
|
||||
@ -76,7 +76,7 @@ QSize UnwrappedMedia::countCurrentSize(int newWidth) {
|
||||
if (_parent->media() == this) {
|
||||
const auto infoWidth = _parent->infoWidth() + 2 * st::msgDateImgPadding.x();
|
||||
const auto via = item->Get<HistoryMessageVia>();
|
||||
const auto reply = item->Get<HistoryMessageReply>();
|
||||
const auto reply = _parent->displayedReply();
|
||||
const auto forwarded = getDisplayedForwardedInfo();
|
||||
if (via || reply || forwarded) {
|
||||
int usew = maxWidth() - additionalWidth(via, reply, forwarded);
|
||||
@ -116,7 +116,7 @@ void UnwrappedMedia::draw(
|
||||
const auto inWebPage = (_parent->media() != this);
|
||||
const auto item = _parent->data();
|
||||
const auto via = inWebPage ? nullptr : item->Get<HistoryMessageVia>();
|
||||
const auto reply = inWebPage ? nullptr : item->Get<HistoryMessageReply>();
|
||||
const auto reply = inWebPage ? nullptr : _parent->displayedReply();
|
||||
const auto forwarded = inWebPage ? nullptr : getDisplayedForwardedInfo();
|
||||
auto usex = 0;
|
||||
auto usew = maxWidth();
|
||||
@ -243,7 +243,7 @@ PointState UnwrappedMedia::pointState(QPoint point) const {
|
||||
const auto inWebPage = (_parent->media() != this);
|
||||
const auto item = _parent->data();
|
||||
const auto via = inWebPage ? nullptr : item->Get<HistoryMessageVia>();
|
||||
const auto reply = inWebPage ? nullptr : item->Get<HistoryMessageReply>();
|
||||
const auto reply = inWebPage ? nullptr : _parent->displayedReply();
|
||||
const auto forwarded = inWebPage ? nullptr : getDisplayedForwardedInfo();
|
||||
auto usex = 0;
|
||||
auto usew = maxWidth();
|
||||
@ -283,7 +283,7 @@ TextState UnwrappedMedia::textState(QPoint point, StateRequest request) const {
|
||||
const auto inWebPage = (_parent->media() != this);
|
||||
const auto item = _parent->data();
|
||||
const auto via = inWebPage ? nullptr : item->Get<HistoryMessageVia>();
|
||||
const auto reply = inWebPage ? nullptr : item->Get<HistoryMessageReply>();
|
||||
const auto reply = inWebPage ? nullptr : _parent->displayedReply();
|
||||
const auto forwarded = inWebPage ? nullptr : getDisplayedForwardedInfo();
|
||||
auto usex = 0;
|
||||
auto usew = maxWidth();
|
||||
|
Loading…
Reference in New Issue
Block a user