mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Moved media above text in service messages.
This commit is contained in:
parent
89a3462824
commit
ef72c9f7ee
1 changed files with 24 additions and 11 deletions
|
@ -480,11 +480,10 @@ void Service::draw(Painter &p, const PaintContext &context) const {
|
|||
if (g.width() < 1) {
|
||||
return;
|
||||
}
|
||||
const auto &margin = st::msgServiceMargin;
|
||||
|
||||
const auto st = context.st;
|
||||
auto height = this->height()
|
||||
- st::msgServiceMargin.top()
|
||||
- st::msgServiceMargin.bottom();
|
||||
auto height = this->height() - margin.top() - margin.bottom();
|
||||
auto dateh = 0;
|
||||
auto unreadbarh = 0;
|
||||
auto clip = context.clip;
|
||||
|
@ -520,15 +519,13 @@ void Service::draw(Painter &p, const PaintContext &context) const {
|
|||
|
||||
p.setTextPalette(st->serviceTextPalette());
|
||||
|
||||
if (auto media = this->media()) {
|
||||
height -= st::msgServiceMargin.top() + media->height();
|
||||
auto left = st::msgServiceMargin.left() + (g.width() - media->maxWidth()) / 2, top = st::msgServiceMargin.top() + height + st::msgServiceMargin.top();
|
||||
p.translate(left, top);
|
||||
media->draw(p, context.translated(-left, -top).withSelection({}));
|
||||
p.translate(-left, -top);
|
||||
const auto media = this->media();
|
||||
if (media) {
|
||||
height -= margin.top() + media->height();
|
||||
}
|
||||
|
||||
auto trect = QRect(g.left(), st::msgServiceMargin.top(), g.width(), height).marginsAdded(-st::msgServicePadding);
|
||||
const auto trect = QRect(g.left(), margin.top(), g.width(), height)
|
||||
- st::msgServicePadding;
|
||||
|
||||
ServiceMessagePainter::PaintComplexBubble(
|
||||
p,
|
||||
|
@ -542,10 +539,26 @@ void Service::draw(Painter &p, const PaintContext &context) const {
|
|||
p.setPen(st->msgServiceFg());
|
||||
p.setFont(st::msgServiceFont);
|
||||
prepareCustomEmojiPaint(p, item->_text);
|
||||
item->_text.draw(p, trect.x(), trect.y(), trect.width(), Qt::AlignCenter, 0, -1, context.selection, false);
|
||||
item->_text.draw(
|
||||
p,
|
||||
trect.x(),
|
||||
trect.y(),
|
||||
trect.width(),
|
||||
Qt::AlignCenter,
|
||||
0,
|
||||
-1,
|
||||
context.selection, false);
|
||||
|
||||
p.restoreTextPalette();
|
||||
|
||||
if (media) {
|
||||
const auto left = margin.left() + (g.width() - media->maxWidth()) / 2;
|
||||
const auto top = margin.top() + height + margin.top();
|
||||
p.translate(left, top);
|
||||
media->draw(p, context.translated(-left, -top).withSelection({}));
|
||||
p.translate(-left, -top);
|
||||
}
|
||||
|
||||
if (auto skiph = dateh + unreadbarh) {
|
||||
p.translate(0, -skiph);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue