mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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);
|
refreshRepliesText(views);
|
||||||
|
history()->owner().notifyItemDataChange(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryMessage::setUnreadRepliesCount(
|
void HistoryMessage::setUnreadRepliesCount(
|
||||||
|
|
|
@ -23,11 +23,11 @@ BottomInfo::BottomInfo(Data &&data) : _data(std::move(data)) {
|
||||||
layout();
|
layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BottomInfo::update(Data &&data) {
|
void BottomInfo::update(Data &&data, int availableWidth) {
|
||||||
_data = std::move(data);
|
_data = std::move(data);
|
||||||
layout();
|
layout();
|
||||||
if (!_size.isEmpty()) {
|
if (!_size.isEmpty()) {
|
||||||
resizeToWidth(_size.width());
|
resizeToWidth(std::min(optimalSize().width(), availableWidth));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +165,7 @@ int BottomInfo::resizeToWidth(int newWidth) {
|
||||||
void BottomInfo::layout() {
|
void BottomInfo::layout() {
|
||||||
layoutDateText();
|
layoutDateText();
|
||||||
layoutViewsText();
|
layoutViewsText();
|
||||||
|
layoutRepliesText();
|
||||||
layoutReactionsText();
|
layoutReactionsText();
|
||||||
countOptimalSize();
|
countOptimalSize();
|
||||||
}
|
}
|
||||||
|
@ -252,6 +253,11 @@ void BottomInfo::countOptimalSize() {
|
||||||
+ _views.maxWidth()
|
+ _views.maxWidth()
|
||||||
+ st::historyViewsWidth;
|
+ st::historyViewsWidth;
|
||||||
}
|
}
|
||||||
|
if (!_replies.isEmpty()) {
|
||||||
|
width += st::historyViewsSpace
|
||||||
|
+ _replies.maxWidth()
|
||||||
|
+ st::historyViewsWidth;
|
||||||
|
}
|
||||||
if (!_reactions.isEmpty()) {
|
if (!_reactions.isEmpty()) {
|
||||||
width += st::historyReactionsSkip + _reactions.maxWidth();
|
width += st::historyReactionsSkip + _reactions.maxWidth();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
};
|
};
|
||||||
explicit BottomInfo(Data &&data);
|
explicit BottomInfo(Data &&data);
|
||||||
|
|
||||||
void update(Data &&data);
|
void update(Data &&data, int availableWidth);
|
||||||
|
|
||||||
[[nodiscard]] QSize optimalSize() const;
|
[[nodiscard]] QSize optimalSize() const;
|
||||||
[[nodiscard]] QSize size() const;
|
[[nodiscard]] QSize size() const;
|
||||||
|
|
|
@ -1808,7 +1808,7 @@ bool Message::isSignedAuthorElided() const {
|
||||||
|
|
||||||
void Message::itemDataChanged() {
|
void Message::itemDataChanged() {
|
||||||
const auto was = _bottomInfo.size();
|
const auto was = _bottomInfo.size();
|
||||||
_bottomInfo.update(BottomInfoDataFromMessage(this));
|
_bottomInfo.update(BottomInfoDataFromMessage(this), width());
|
||||||
if (was != _bottomInfo.size()) {
|
if (was != _bottomInfo.size()) {
|
||||||
history()->owner().requestViewResize(this);
|
history()->owner().requestViewResize(this);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue