chatgui: баббл видео — размер + время m:ss (напр. 1.5MB · 0:45)
This commit is contained in:
1 parent
d09a6af52a
commit
f2b34459c3
2 files changed
+9
-5
No files matched your search
@@ -395,7 +395,7 @@ MessageDelegate::Layout MessageDelegate::calcLayout(
|
||||
if (dlState == 1) { L.progressBarRect = QRect(bx, thH - 3, thW, 3); }
|
||||
|
||||
L.videoPlayBtnRect = QRect(bx + thW / 2 - 24, thH / 2 - 24, 48, 48);
|
||||
L.videoDurBadgeRect = QRect(bx + thW - 56, thH - 26, 48, 18);
|
||||
L.videoDurBadgeRect = QRect(bx + thW - 116, thH - 26, 108, 18);
|
||||
|
||||
if (!L.narrow) {
|
||||
int avatarY = L.bubbleRect.bottom() - kAvatar;
|
||||
@@ -1010,9 +1010,12 @@ void MessageDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
painter->drawPath(tri);
|
||||
}
|
||||
|
||||
/* duration-бейдж */
|
||||
/* бейдж: размер · длительность (m:ss) */
|
||||
qint64 fsz = index.data(MsgFileSizeRole).toLongLong();
|
||||
QString sizeStr = formatFileSize(fsz);
|
||||
QString durStr = index.data(MsgVoiceDurationRole).toString();
|
||||
if (!durStr.isEmpty()) {
|
||||
QString badge = durStr.isEmpty() ? sizeStr : sizeStr + " \xC2\xB7 " + durStr;
|
||||
if (!badge.isEmpty()) {
|
||||
QFont durFont = option.font;
|
||||
durFont.setPointSize(durFont.pointSize() - 1);
|
||||
painter->setFont(durFont);
|
||||
@@ -1020,7 +1023,7 @@ void MessageDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
||||
painter->setBrush(QColor(0, 0, 0, 160));
|
||||
painter->drawRoundedRect(L.videoDurBadgeRect, 5, 5);
|
||||
painter->setPen(Qt::white);
|
||||
painter->drawText(L.videoDurBadgeRect, Qt::AlignCenter, durStr);
|
||||
painter->drawText(L.videoDurBadgeRect, Qt::AlignCenter, badge);
|
||||
}
|
||||
painter->restore();
|
||||
|
||||
|
||||
Reference in new issue
Block a user