|
|
|
|
@ -83,7 +83,9 @@ QString MessageDelegate::linkAt(const QStyleOptionViewItem& option, const QModel
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MessageDelegate::MessageDelegate(QObject *parent) |
|
|
|
|
: QStyledItemDelegate(parent) {} |
|
|
|
|
: QStyledItemDelegate(parent) { |
|
|
|
|
GUI_DEBUG("MessageDelegate: avatar size=%dpx", kAvatar); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct VoicePlayState { |
|
|
|
|
uint64_t playbackId = 0; |
|
|
|
|
@ -442,7 +444,7 @@ MessageDelegate::Layout MessageDelegate::calcLayout(
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!L.narrow) { |
|
|
|
|
int avatarY = L.bubbleRect.bottom() - kAvatar; |
|
|
|
|
int avatarY = qMax(0, L.bubbleRect.bottom() + 1 - kAvatar); |
|
|
|
|
if (!L.isOutgoing) |
|
|
|
|
L.avatarRect = QRect(kMarginH, avatarY, kAvatar, kAvatar); |
|
|
|
|
else |
|
|
|
|
@ -484,7 +486,7 @@ MessageDelegate::Layout MessageDelegate::calcLayout(
|
|
|
|
|
L.videoDurBadgeRect = QRect(bx + thW - 66, thH - 26, 58, 18); |
|
|
|
|
|
|
|
|
|
if (!L.narrow) { |
|
|
|
|
int avatarY = L.bubbleRect.bottom() - kAvatar; |
|
|
|
|
int avatarY = qMax(0, L.bubbleRect.bottom() + 1 - kAvatar); |
|
|
|
|
if (!L.isOutgoing) |
|
|
|
|
L.avatarRect = QRect(kMarginH, avatarY, kAvatar, kAvatar); |
|
|
|
|
else |
|
|
|
|
@ -519,7 +521,7 @@ MessageDelegate::Layout MessageDelegate::calcLayout(
|
|
|
|
|
L.imageBadgeRect = QRect(bx + thW - 150, thH - 26, 142, 18); |
|
|
|
|
|
|
|
|
|
if (!L.narrow) { |
|
|
|
|
int avatarY = L.bubbleRect.bottom() - kAvatar; |
|
|
|
|
int avatarY = qMax(0, L.bubbleRect.bottom() + 1 - kAvatar); |
|
|
|
|
if (!L.isOutgoing) |
|
|
|
|
L.avatarRect = QRect(kMarginH, avatarY, kAvatar, kAvatar); |
|
|
|
|
else |
|
|
|
|
@ -557,7 +559,7 @@ MessageDelegate::Layout MessageDelegate::calcLayout(
|
|
|
|
|
L.statusRect = QRect(bx + kPadH + ih + 8 - 48, kPadTop + th + 2, L.bubbleWidth - 2*kPadH - ih - 8 + 48 - 40, th); |
|
|
|
|
|
|
|
|
|
if (!L.narrow) { |
|
|
|
|
int avatarY = L.bubbleRect.bottom() - kAvatar; |
|
|
|
|
int avatarY = qMax(0, L.bubbleRect.bottom() + 1 - kAvatar); |
|
|
|
|
if (!L.isOutgoing) |
|
|
|
|
L.avatarRect = QRect(kMarginH, avatarY, kAvatar, kAvatar); |
|
|
|
|
else |
|
|
|
|
@ -687,7 +689,7 @@ MessageDelegate::Layout MessageDelegate::calcLayout(
|
|
|
|
|
L.statusRect = QRect(txRect, contentTop + textH + 2, textW, kStatusH); |
|
|
|
|
|
|
|
|
|
if (!L.narrow) { |
|
|
|
|
int avatarY = L.bubbleRect.bottom() - kAvatar; |
|
|
|
|
int avatarY = qMax(0, L.bubbleRect.bottom() + 1 - kAvatar); |
|
|
|
|
if (!L.isOutgoing) |
|
|
|
|
L.avatarRect = QRect(kMarginH, avatarY, kAvatar, kAvatar); |
|
|
|
|
else |
|
|
|
|
@ -1617,6 +1619,7 @@ void MessageDelegate::drawAvatar(QPainter *p, const Layout &L,
|
|
|
|
|
p->setRenderHint(QPainter::Antialiasing); |
|
|
|
|
QPainterPath clip; |
|
|
|
|
clip.addEllipse(L.avatarRect); |
|
|
|
|
p->setRenderHint(QPainter::SmoothPixmapTransform); |
|
|
|
|
p->setClipPath(clip); |
|
|
|
|
p->drawPixmap(L.avatarRect, av); |
|
|
|
|
p->restore(); |
|
|
|
|
|