mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fix refreshing bottom info.
This commit is contained in:
parent
1af2cfe143
commit
2b0cd2a611
4 changed files with 11 additions and 4 deletions
|
@ -1900,6 +1900,7 @@ void HistoryMessage::changeRepliesCount(
|
|||
}
|
||||
}
|
||||
refreshRepliesText(views);
|
||||
history()->owner().notifyItemDataChange(this);
|
||||
}
|
||||
|
||||
void HistoryMessage::setUnreadRepliesCount(
|
||||
|
|
|
@ -23,11 +23,11 @@ BottomInfo::BottomInfo(Data &&data) : _data(std::move(data)) {
|
|||
layout();
|
||||
}
|
||||
|
||||
void BottomInfo::update(Data &&data) {
|
||||
void BottomInfo::update(Data &&data, int availableWidth) {
|
||||
_data = std::move(data);
|
||||
layout();
|
||||
if (!_size.isEmpty()) {
|
||||
resizeToWidth(_size.width());
|
||||
resizeToWidth(std::min(optimalSize().width(), availableWidth));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,6 +165,7 @@ int BottomInfo::resizeToWidth(int newWidth) {
|
|||
void BottomInfo::layout() {
|
||||
layoutDateText();
|
||||
layoutViewsText();
|
||||
layoutRepliesText();
|
||||
layoutReactionsText();
|
||||
countOptimalSize();
|
||||
}
|
||||
|
@ -252,6 +253,11 @@ void BottomInfo::countOptimalSize() {
|
|||
+ _views.maxWidth()
|
||||
+ st::historyViewsWidth;
|
||||
}
|
||||
if (!_replies.isEmpty()) {
|
||||
width += st::historyViewsSpace
|
||||
+ _replies.maxWidth()
|
||||
+ st::historyViewsWidth;
|
||||
}
|
||||
if (!_reactions.isEmpty()) {
|
||||
width += st::historyReactionsSkip + _reactions.maxWidth();
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
};
|
||||
explicit BottomInfo(Data &&data);
|
||||
|
||||
void update(Data &&data);
|
||||
void update(Data &&data, int availableWidth);
|
||||
|
||||
[[nodiscard]] QSize optimalSize() const;
|
||||
[[nodiscard]] QSize size() const;
|
||||
|
|
|
@ -1808,7 +1808,7 @@ bool Message::isSignedAuthorElided() const {
|
|||
|
||||
void Message::itemDataChanged() {
|
||||
const auto was = _bottomInfo.size();
|
||||
_bottomInfo.update(BottomInfoDataFromMessage(this));
|
||||
_bottomInfo.update(BottomInfoDataFromMessage(this), width());
|
||||
if (was != _bottomInfo.size()) {
|
||||
history()->owner().requestViewResize(this);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue