mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix minimal width of message bubble with comments.
This commit is contained in:
parent
3a51303fb0
commit
e9dffe78e3
2 changed files with 35 additions and 5 deletions
|
@ -751,7 +751,14 @@ bool PeerData::isBroadcast() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PeerData::isRepliesChat() const {
|
bool PeerData::isRepliesChat() const {
|
||||||
return (id == peerFromUser(708513));
|
constexpr auto kProductionId = peerFromUser(1271266957);
|
||||||
|
constexpr auto kTestId = peerFromUser(708513);
|
||||||
|
if (id != kTestId && id != kProductionId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return ((session().mtp().environment() == MTP::Environment::Production)
|
||||||
|
? kProductionId
|
||||||
|
: kTestId) == id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PeerData::canWrite() const {
|
bool PeerData::canWrite() const {
|
||||||
|
|
|
@ -255,10 +255,11 @@ QSize Message::performCountOptimalSize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawBubble()) {
|
if (drawBubble()) {
|
||||||
auto forwarded = item->Get<HistoryMessageForwarded>();
|
const auto forwarded = item->Get<HistoryMessageForwarded>();
|
||||||
auto reply = displayedReply();
|
const auto reply = displayedReply();
|
||||||
auto via = item->Get<HistoryMessageVia>();
|
const auto via = item->Get<HistoryMessageVia>();
|
||||||
auto entry = logEntryOriginal();
|
const auto entry = logEntryOriginal();
|
||||||
|
const auto views = item->Get<HistoryMessageViews>();
|
||||||
if (forwarded) {
|
if (forwarded) {
|
||||||
forwarded->create(via);
|
forwarded->create(via);
|
||||||
}
|
}
|
||||||
|
@ -362,6 +363,28 @@ QSize Message::performCountOptimalSize() {
|
||||||
minHeight += entry->minHeight();
|
minHeight += entry->minHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (item->repliesAreComments() && !views->replies.text.isEmpty()) {
|
||||||
|
const auto limit = HistoryMessageViews::kMaxRecentRepliers;
|
||||||
|
const auto single = st::historyCommentsUserpicSize;
|
||||||
|
const auto shift = st::historyCommentsUserpicOverlap;
|
||||||
|
const auto added = single
|
||||||
|
+ (limit - 1) * (single - shift)
|
||||||
|
+ st::historyCommentsSkipLeft
|
||||||
|
+ st::historyCommentsSkipRight
|
||||||
|
+ st::historyCommentsSkipText
|
||||||
|
+ st::historyCommentsOpenOutSelected.width()
|
||||||
|
+ st::historyCommentsSkipRight;
|
||||||
|
accumulate_max(maxWidth, added + views->replies.textWidth);
|
||||||
|
} else if (item->externalReply()) {
|
||||||
|
const auto added = st::historyCommentsIn.width()
|
||||||
|
+ st::historyCommentsSkipLeft
|
||||||
|
+ st::historyCommentsSkipRight
|
||||||
|
+ st::historyCommentsSkipText
|
||||||
|
+ st::historyCommentsOpenOutSelected.width()
|
||||||
|
+ st::historyCommentsSkipRight;
|
||||||
|
accumulate_max(maxWidth, added + st::semiboldFont->width(
|
||||||
|
tr::lng_replies_view_original(tr::now)));
|
||||||
|
}
|
||||||
} else if (media) {
|
} else if (media) {
|
||||||
media->initDimensions();
|
media->initDimensions();
|
||||||
maxWidth = media->maxWidth();
|
maxWidth = media->maxWidth();
|
||||||
|
|
Loading…
Add table
Reference in a new issue