From 25cea8ca4c855fbaf0132bb35402c0138075afdb Mon Sep 17 00:00:00 2001 From: evgeny Date: Wed, 28 Oct 2026 17:58:40 +0100 Subject: [PATCH] Draw storage avatars as clear cylinders with curved bands --- tools/chatgui/src/flagpainter.cpp | 30 +++++++++++++++++------------- tools/chatgui/src/flagpainter.h | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/tools/chatgui/src/flagpainter.cpp b/tools/chatgui/src/flagpainter.cpp index 2292e7000..83a6f5862 100644 --- a/tools/chatgui/src/flagpainter.cpp +++ b/tools/chatgui/src/flagpainter.cpp @@ -82,22 +82,26 @@ void FlagPainter::drawShield(QPainter* p, int x, int y, int sz) { p->restore(); } +// Цилиндр хранилища: верхний эллипс и дуги обручей целиком помещаются внутри значка. void FlagPainter::drawStorage(QPainter* p, int x, int y, int sz) { p->save(); p->setRenderHint(QPainter::Antialiasing); - qreal cx = x + sz / 2.0, t = y + 1.0, b = y + sz - 1.0; - qreal w = sz * 0.36, gap = sz * 0.20; - QPainterPath path; - path.moveTo(cx - w, t); - path.lineTo(cx + w, t); - path.lineTo(cx + w, b); - path.lineTo(cx - w, b); - path.closeSubpath(); - p->setPen(QPen(QColor("#37474F"), 0.8)); + p->translate(x, y); + p->scale(sz / 24.0, sz / 24.0); + QPainterPath body; + body.moveTo(3, 5); body.lineTo(3, 19); + body.cubicTo(3, 23, 21, 23, 21, 19); + body.lineTo(21, 5); body.closeSubpath(); + p->setPen(QPen(QColor("#37474F"), 1.2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); p->setBrush(QColor("#78909C")); - p->drawPath(path); - p->setBrush(QColor("#ECEFF1")); - p->drawEllipse(QPointF(cx, t), w, gap); - p->drawEllipse(QPointF(cx, b), w, gap); + p->drawPath(body); + p->setBrush(Qt::NoBrush); + for (int level : {10, 15}) { + QPainterPath hoop; + hoop.moveTo(3, level); hoop.cubicTo(3, level + 4, 21, level + 4, 21, level); + p->drawPath(hoop); + } + p->setBrush(QColor("#CFD8DC")); + p->drawEllipse(QRectF(3, 2, 18, 6)); p->restore(); } diff --git a/tools/chatgui/src/flagpainter.h b/tools/chatgui/src/flagpainter.h index 4e381caab..3e35169d8 100644 --- a/tools/chatgui/src/flagpainter.h +++ b/tools/chatgui/src/flagpainter.h @@ -22,7 +22,7 @@ public: // Общая ширина при n>0: n*sz+(n-1)*2; flags без этих битов не рисует ничего. static void draw(QPainter* p, uint8_t flags, int x, int y, int sz); static void drawServer(QPainter* p, int x, int y, int sz); // серверная стойка в квадрате sz×sz - static void drawStorage(QPainter* p, int x, int y, int sz); // серый значок диска в квадрате sz×sz + static void drawStorage(QPainter* p, int x, int y, int sz); // цилиндр с обручами, целиком внутри квадрата sz×sz static void drawRadio(QPainter* p, int x, int y, int sz, const QColor& color); // контур рации заданного цвета, без заливки private: