Added mini icon to messages with reply to story.

This commit is contained in:
23rd 2023-08-30 16:45:12 +03:00
parent 70e298cfe4
commit 1493b23574
1 changed files with 28 additions and 7 deletions

View File

@ -43,6 +43,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "api/api_bot.h"
#include "styles/style_widgets.h"
#include "styles/style_chat.h"
#include "styles/style_dialogs.h" // dialogsMiniReplyStoryIcon.
#include <QtGui/QGuiApplication>
@ -460,7 +461,14 @@ void HistoryMessageReply::updateName(
w += st::msgServiceFont->spacew + replyToVia->maxWidth;
}
maxReplyWidth = previewSkip + qMax(w, qMin(replyToText.maxWidth(), int32(st::maxSignatureSize)));
maxReplyWidth = previewSkip
+ std::max(
w,
std::min(replyToText.maxWidth(), st::maxSignatureSize))
+ (storyReply
? (st::dialogsMiniIconSkip
+ st::dialogsMiniReplyStoryIcon.icon.width())
: 0);
} else {
maxReplyWidth = st::msgDateFont->width(statePhrase());
}
@ -596,14 +604,27 @@ void HistoryMessageReply::paint(
? stm->historyTextFg
: st->msgImgReplyBarColor());
holder->prepareCustomEmojiPaint(p, context, replyToText);
auto replyToTextPosition = QPoint(
x + st::msgReplyBarSkip + previewSkip,
y + st::msgReplyPadding.top() + st::msgServiceNameFont->height);
const auto replyToTextPalette = &(inBubble
? stm->replyTextPalette
: st->imgReplyTextPalette());
if (storyReply) {
st::dialogsMiniReplyStoryIcon.icon.paint(
p,
replyToTextPosition,
w - st::msgReplyBarSkip - previewSkip,
replyToTextPalette->linkFg->c);
replyToTextPosition += QPoint(
st::dialogsMiniIconSkip
+ st::dialogsMiniReplyStoryIcon.icon.width(),
0);
}
replyToText.draw(p, {
.position = QPoint(
x + st::msgReplyBarSkip + previewSkip,
y + st::msgReplyPadding.top() + st::msgServiceNameFont->height),
.position = replyToTextPosition,
.availableWidth = w - st::msgReplyBarSkip - previewSkip,
.palette = &(inBubble
? stm->replyTextPalette
: st->imgReplyTextPalette()),
.palette = replyToTextPalette,
.spoiler = Ui::Text::DefaultSpoilerCache(),
.now = context.now,
.pausedEmoji = (context.paused