Commit 1c1302cb authored by Andreas Traczyk's avatar Andreas Traczyk

fix presence indicator on account items

Change-Id: Ia3f05f8b6b74fc7fa3f9a5e599b545183dff7dab
parent cf00c0af
......@@ -87,15 +87,15 @@ AccountItemDelegate::paint(QPainter* painter,
QPixmap::fromImage(index.data(AccountListModel::Role::Picture).value<QImage>())
.scaled(avatarSize_, avatarSize_, Qt::KeepAspectRatio, Qt::SmoothTransformation));
// Presence indicator
QPainterPath outerCircle, innerCircle;
QPointF center(rectAvatar.right() - avatarSize_ / 6, (rectAvatar.bottom() - avatarSize_ / 6) + 1);
qreal outerCRadius = avatarSize_ / 6, innerCRadius = outerCRadius * 0.85;
outerCircle.addEllipse(center, outerCRadius, outerCRadius);
innerCircle.addEllipse(center, innerCRadius, innerCRadius);
auto status = index.data(static_cast<int>(AccountListModel::Role::Status)).value<int>();
auto isPresent = Utils::toEnum<lrc::api::account::Status>(status) == lrc::api::account::Status::REGISTERED;
// Presence indicator
if (isPresent) {
QPainterPath outerCircle, innerCircle;
QPointF center(rectAvatar.right() - avatarSize_ / 6, (rectAvatar.bottom() - avatarSize_ / 6) + 1);
qreal outerCRadius = avatarSize_ / 6, innerCRadius = outerCRadius * 0.75;
outerCircle.addEllipse(center, outerCRadius, outerCRadius);
innerCircle.addEllipse(center, innerCRadius, innerCRadius);
painter->fillPath(outerCircle, Qt::white);
painter->fillPath(innerCircle, RingTheme::presenceGreen_);
}
......
......@@ -108,7 +108,7 @@ CurrentAccountComboBox::paintEvent(QPaintEvent* e)
QPainterPath outerCircle, innerCircle;
QPointF presenceCenter(40.0 + p.x(), 40.0);
qreal outerCircleRadius = cellHeight_/6.5;
qreal innerCircleRadius = outerCircleRadius - 1;
qreal innerCircleRadius = outerCircleRadius * 0.75;
outerCircle.addEllipse(presenceCenter, outerCircleRadius, outerCircleRadius);
innerCircle.addEllipse(presenceCenter, innerCircleRadius, innerCircleRadius);
painter.fillPath(outerCircle, Qt::white);
......
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