mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 07:07:08 +02:00
Added ability to count inner geometry in HistoryView::Element.
This commit is contained in:
parent
7cd14b8c4e
commit
298c5026be
5 changed files with 23 additions and 0 deletions
Telegram/SourceFiles/history/view
|
@ -415,6 +415,8 @@ public:
|
|||
void previousInBlocksChanged();
|
||||
void nextInBlocksRemoved();
|
||||
|
||||
virtual QRect innerGeometry() const = 0;
|
||||
|
||||
[[nodiscard]] ClickHandlerPtr fromPhotoLink() const {
|
||||
return fromLink();
|
||||
}
|
||||
|
|
|
@ -2748,6 +2748,19 @@ TextSelection Message::unskipTextSelection(TextSelection selection) const {
|
|||
return HistoryView::ShiftItemSelection(selection, message()->_text);
|
||||
}
|
||||
|
||||
QRect Message::innerGeometry() const {
|
||||
auto result = countGeometry();
|
||||
if (!hasOutLayout()) {
|
||||
const auto w = std::max(
|
||||
(media() ? media()->resolveCustomInfoRightBottom().x() : 0),
|
||||
result.width());
|
||||
result.setWidth(std::min(
|
||||
w + rightActionSize().value_or(QSize(0, 0)).width() * 2,
|
||||
width()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QRect Message::countGeometry() const {
|
||||
const auto commentsRoot = (context() == Context::Replies)
|
||||
&& data()->isDiscussionPost();
|
||||
|
|
|
@ -139,6 +139,8 @@ public:
|
|||
auto takeReactionAnimations()
|
||||
-> base::flat_map<QString, std::unique_ptr<Reactions::Animation>> override;
|
||||
|
||||
QRect innerGeometry() const override;
|
||||
|
||||
protected:
|
||||
void refreshDataIdHook() override;
|
||||
|
||||
|
|
|
@ -393,6 +393,10 @@ not_null<HistoryService*> Service::message() const {
|
|||
return static_cast<HistoryService*>(data().get());
|
||||
}
|
||||
|
||||
QRect Service::innerGeometry() const {
|
||||
return countGeometry();
|
||||
}
|
||||
|
||||
QRect Service::countGeometry() const {
|
||||
auto result = QRect(0, 0, width(), height());
|
||||
if (delegate()->elementIsChatWide()) {
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
TextSelection selection,
|
||||
TextSelectType type) const override;
|
||||
|
||||
QRect innerGeometry() const override;
|
||||
|
||||
private:
|
||||
not_null<HistoryService*> message() const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue