mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-07-03 14:15:08 +02:00
Added ability to count inner geometry in HistoryView::Element.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user