mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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) {
|
if (g.width() < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const auto &margin = st::msgServiceMargin;
|
||||||
|
|
||||||
const auto st = context.st;
|
const auto st = context.st;
|
||||||
auto height = this->height()
|
auto height = this->height() - margin.top() - margin.bottom();
|
||||||
- st::msgServiceMargin.top()
|
|
||||||
- st::msgServiceMargin.bottom();
|
|
||||||
auto dateh = 0;
|
auto dateh = 0;
|
||||||
auto unreadbarh = 0;
|
auto unreadbarh = 0;
|
||||||
auto clip = context.clip;
|
auto clip = context.clip;
|
||||||
|
@ -520,15 +519,13 @@ void Service::draw(Painter &p, const PaintContext &context) const {
|
||||||
|
|
||||||
p.setTextPalette(st->serviceTextPalette());
|
p.setTextPalette(st->serviceTextPalette());
|
||||||
|
|
||||||
if (auto media = this->media()) {
|
const auto media = this->media();
|
||||||
height -= st::msgServiceMargin.top() + media->height();
|
if (media) {
|
||||||
auto left = st::msgServiceMargin.left() + (g.width() - media->maxWidth()) / 2, top = st::msgServiceMargin.top() + height + st::msgServiceMargin.top();
|
height -= margin.top() + media->height();
|
||||||
p.translate(left, top);
|
|
||||||
media->draw(p, context.translated(-left, -top).withSelection({}));
|
|
||||||
p.translate(-left, -top);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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(
|
ServiceMessagePainter::PaintComplexBubble(
|
||||||
p,
|
p,
|
||||||
|
@ -542,10 +539,26 @@ void Service::draw(Painter &p, const PaintContext &context) const {
|
||||||
p.setPen(st->msgServiceFg());
|
p.setPen(st->msgServiceFg());
|
||||||
p.setFont(st::msgServiceFont);
|
p.setFont(st::msgServiceFont);
|
||||||
prepareCustomEmojiPaint(p, item->_text);
|
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();
|
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) {
|
if (auto skiph = dateh + unreadbarh) {
|
||||||
p.translate(0, -skiph);
|
p.translate(0, -skiph);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue