Replace supernode lightning with a server icon renderer

This commit is contained in:
evgeny committed 2026-10-28 17:48:54 +01:00
1 parent 2b05140e74
commit c96a63091c
2 files changed
+15 -17

No files matched your search

+12 -14
View File
@@ -21,26 +21,24 @@ void FlagPainter::drawRadio(QPainter* p, int x, int y, int sz, const QColor& col
void FlagPainter::draw(QPainter* p, uint8_t flags, int x, int y, int sz) {
if (!flags) return;
int cx = x;
if (flags & MEMBER_FLAG_SUPERNODE) { drawLightning(p, cx, y, sz); cx += sz + 2; }
if (flags & MEMBER_FLAG_ADMIN) { drawStar(p, cx, y, sz); cx += sz + 2; }
if (flags & MEMBER_FLAG_MODER) { drawShield(p, cx, y, sz); cx += sz + 2; }
}
void FlagPainter::drawLightning(QPainter* p, int x, int y, int sz) {
// Три блока серверной стойки; масштабируется вместе с аватаром.
void FlagPainter::drawServer(QPainter* p, int x, int y, int sz) {
p->save();
p->setRenderHint(QPainter::Antialiasing);
QPainterPath path;
qreal cx = x + sz / 2.0, t = y + 1.0, b = y + sz - 1.0;
path.moveTo(cx, t);
path.lineTo(cx - sz * 0.3, t + sz * 0.55);
path.lineTo(cx - sz * 0.05, t + sz * 0.5);
path.lineTo(cx + sz * 0.15, b);
path.lineTo(cx + sz * 0.1, t + sz * 0.55);
path.lineTo(cx + sz * 0.35, t + sz * 0.4);
path.closeSubpath();
p->setPen(Qt::NoPen);
p->setBrush(QColor("#FFC107"));
p->drawPath(path);
p->translate(x, y);
p->scale(sz / 24.0, sz / 24.0);
for (int top : {2, 9, 16}) {
p->setPen(QPen(QColor("#37474F"), 0.8)); p->setBrush(QColor("#607D8B"));
p->drawRoundedRect(QRectF(2, top, 20, 5.5), 1, 1);
p->setPen(QPen(QColor("#ECEFF1"), 1.2, Qt::SolidLine, Qt::RoundCap));
p->drawLine(QPointF(5, top + 2.75), QPointF(11, top + 2.75));
p->setPen(Qt::NoPen); p->setBrush(QColor("#B0BEC5"));
p->drawEllipse(QPointF(18, top + 2.75), 1, 1);
}
p->restore();
}