Commit a8d78f91 authored by Anthony Léonard's avatar Anthony Léonard Committed by Olivier SOLDANO

presence: add indicators in smartlist

Presence indicators are now displayed in the smartlist. It is placed
at the bottom left of an avatar and is refreshed automatically when
presence status is modified.

Change-Id: I4acf8a0df0d8a0f03ac013388bf5fc5d417afcb5
Reviewed-by: default avatarOlivier Soldano <olivier.soldano@savoirfairelinux.com>
parent dd9fb6a4
......@@ -28,5 +28,6 @@ static const QColor grey_ {192, 192, 192};
static const QColor red_ {251, 72, 71};
static const QColor lightRed_ {252, 91, 90};
static const QColor darkRed_ {219, 55, 54};
static const QColor green_ {127, 255, 0};
}
......@@ -98,6 +98,16 @@ SmartListDelegate::paint(QPainter* painter
painter->drawText(pastilleRect, Qt::AlignCenter, messageCountText);
}
// Presence indicator
QPainterPath outerCircle, innerCircle;
QPointF center(rectAvatar.left() + sizeImage_/6, (rectAvatar.bottom() - sizeImage_/6) + 1);
qreal outerCRadius = sizeImage_ / 6, innerCRadius = outerCRadius * 0.75;
outerCircle.addEllipse(center, outerCRadius, outerCRadius);
innerCircle.addEllipse(center, innerCRadius, innerCRadius);
if (index.data(static_cast<int>(Ring::Role::IsPresent)).value<bool>()) {
painter->fillPath(outerCircle, Qt::white);
painter->fillPath(innerCircle, RingTheme::green_);
}
font.setPointSize(fontSize_);
QPen pen(painter->pen());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment