mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Added userpic views to headers of forwarded messages.
This commit is contained in:
parent
470b3a2cbd
commit
8a6b1677f4
6 changed files with 36 additions and 16 deletions
|
@ -183,8 +183,11 @@ bool HiddenSenderInfo::paintCustomUserpic(
|
|||
return valid;
|
||||
}
|
||||
|
||||
void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
|
||||
void HistoryMessageForwarded::create(
|
||||
const HistoryMessageVia *via,
|
||||
not_null<const HistoryItem*> item) const {
|
||||
auto phrase = TextWithEntities();
|
||||
auto context = Core::MarkedTextContext{};
|
||||
const auto fromChannel = originalSender
|
||||
&& originalSender->isChannel()
|
||||
&& !originalSender->isMegagroup();
|
||||
|
@ -193,16 +196,27 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
|
|||
? originalSender->name()
|
||||
: originalHiddenSenderInfo->name)
|
||||
};
|
||||
if (originalSender) {
|
||||
context.session = &originalSender->owner().session();
|
||||
context.customEmojiRepaint = [=] {
|
||||
originalSender->owner().requestItemRepaint(item);
|
||||
};
|
||||
phrase = Ui::Text::SingleCustomEmoji(
|
||||
context.session->data().customEmojiManager().peerUserpicEmojiData(
|
||||
originalSender,
|
||||
st::fwdTextUserpicPadding));
|
||||
}
|
||||
if (!originalPostAuthor.isEmpty()) {
|
||||
phrase = tr::lng_forwarded_signed(
|
||||
tr::now,
|
||||
lt_channel,
|
||||
name,
|
||||
lt_user,
|
||||
{ .text = originalPostAuthor },
|
||||
Ui::Text::WithEntities);
|
||||
phrase.append(
|
||||
tr::lng_forwarded_signed(
|
||||
tr::now,
|
||||
lt_channel,
|
||||
name,
|
||||
lt_user,
|
||||
{ .text = originalPostAuthor },
|
||||
Ui::Text::WithEntities));
|
||||
} else {
|
||||
phrase = name;
|
||||
phrase.append(name);
|
||||
}
|
||||
if (story) {
|
||||
phrase = tr::lng_forwarded_story(
|
||||
|
@ -248,18 +262,21 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
|
|||
: tr::lng_forwarded_psa_default)(
|
||||
tr::now,
|
||||
lt_channel,
|
||||
Ui::Text::Link(phrase.text, QString()), // Link 1.
|
||||
Ui::Text::Wrapped(
|
||||
phrase,
|
||||
EntityType::CustomUrl,
|
||||
QString()), // Link 1.
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
} else {
|
||||
phrase = tr::lng_forwarded(
|
||||
tr::now,
|
||||
lt_user,
|
||||
Ui::Text::Link(phrase.text, QString()), // Link 1.
|
||||
Ui::Text::Wrapped(phrase, EntityType::CustomUrl, QString()), // Link 1.
|
||||
Ui::Text::WithEntities);
|
||||
}
|
||||
}
|
||||
text.setMarkedText(st::fwdTextStyle, phrase);
|
||||
text.setMarkedText(st::fwdTextStyle, phrase, kMarkupTextOptions, context);
|
||||
|
||||
text.setLink(1, fromChannel
|
||||
? JumpToMessageClickHandler(originalSender, originalId)
|
||||
|
|
|
@ -125,7 +125,9 @@ private:
|
|||
};
|
||||
|
||||
struct HistoryMessageForwarded : public RuntimeComponent<HistoryMessageForwarded, HistoryItem> {
|
||||
void create(const HistoryMessageVia *via) const;
|
||||
void create(
|
||||
const HistoryMessageVia *via,
|
||||
not_null<const HistoryItem*> item) const;
|
||||
|
||||
[[nodiscard]] bool forwardOfForward() const {
|
||||
return savedFromSender || savedFromHiddenSenderInfo;
|
||||
|
|
|
@ -714,7 +714,7 @@ QSize Message::performCountOptimalSize() {
|
|||
const auto via = item->Get<HistoryMessageVia>();
|
||||
const auto entry = logEntryOriginal();
|
||||
if (forwarded) {
|
||||
forwarded->create(via);
|
||||
forwarded->create(via, item);
|
||||
}
|
||||
|
||||
auto mediaDisplayed = false;
|
||||
|
|
|
@ -293,7 +293,7 @@ QSize Gif::countOptimalSize() {
|
|||
auto reply = _parent->Get<Reply>();
|
||||
auto forwarded = item->Get<HistoryMessageForwarded>();
|
||||
if (forwarded) {
|
||||
forwarded->create(via);
|
||||
forwarded->create(via, item);
|
||||
}
|
||||
maxWidth += additionalWidth(reply, via, forwarded);
|
||||
accumulate_max(maxWidth, _parent->reactionsOptimalWidth());
|
||||
|
|
|
@ -59,7 +59,7 @@ QSize UnwrappedMedia::countOptimalSize() {
|
|||
const auto topic = _parent->displayedTopicButton();
|
||||
const auto forwarded = getDisplayedForwardedInfo();
|
||||
if (forwarded) {
|
||||
forwarded->create(via);
|
||||
forwarded->create(via, item);
|
||||
}
|
||||
maxWidth += additionalWidth(topic, reply, via, forwarded);
|
||||
accumulate_max(maxWidth, _parent->reactionsOptimalWidth());
|
||||
|
|
|
@ -125,6 +125,7 @@ outTextPaletteSelected: TextPalette(outTextPalette) {
|
|||
monoFg: msgOutMonoFgSelected;
|
||||
spoilerFg: msgOutDateFgSelected;
|
||||
}
|
||||
fwdTextUserpicPadding: margins(0px, 1px, 3px, 0px);
|
||||
fwdTextStyle: TextStyle(semiboldTextStyle) {
|
||||
linkUnderline: kLinkUnderlineNever;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue