Added panel impact size based severity circles with impact value
This commit is contained in:
@@ -57,6 +57,14 @@ void PanelsPanel::reset()
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a circle radius multiplier (0.0-1.0) based on 3 power tiers
|
||||||
|
static double bubbleScale(int power)
|
||||||
|
{
|
||||||
|
if (power < 50) return 0.18; // small
|
||||||
|
if (power < 100) return 0.30; // medium
|
||||||
|
return 0.85; // large
|
||||||
|
}
|
||||||
|
|
||||||
void PanelsPanel::paintEvent(QPaintEvent *)
|
void PanelsPanel::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
if (m_count <= 0) return;
|
if (m_count <= 0) return;
|
||||||
@@ -78,6 +86,10 @@ void PanelsPanel::paintEvent(QPaintEvent *)
|
|||||||
const double gapDeg = (m_count > 1) ? 3.0 : 0.0;
|
const double gapDeg = (m_count > 1) ? 3.0 : 0.0;
|
||||||
const double segSpan = (360.0 - m_count * gapDeg) / m_count;
|
const double segSpan = (360.0 - m_count * gapDeg) / m_count;
|
||||||
|
|
||||||
|
// Max bubble radius constrained to fit inside the segment band
|
||||||
|
const double maxCircR = qMin((outerR - innerR) * 0.48,
|
||||||
|
(outerR + innerR) / 2.0 * qSin(qDegreesToRadians(segSpan / 2.0)) * 0.88);
|
||||||
|
|
||||||
static const QColor kDefault(100, 140, 180);
|
static const QColor kDefault(100, 140, 180);
|
||||||
static const QColor kHit(220, 40, 40);
|
static const QColor kHit(220, 40, 40);
|
||||||
|
|
||||||
@@ -93,8 +105,7 @@ void PanelsPanel::paintEvent(QPaintEvent *)
|
|||||||
path.arcTo(innerRect, startAngle + sweep, -sweep);
|
path.arcTo(innerRect, startAngle + sweep, -sweep);
|
||||||
path.closeSubpath();
|
path.closeSubpath();
|
||||||
|
|
||||||
QColor segColor = isHit ? kHit : m_colors.value(i, kDefault);
|
p.setBrush(isHit ? kHit : m_colors.value(i, kDefault));
|
||||||
p.setBrush(segColor);
|
|
||||||
p.setPen(QPen(Qt::white, isHit ? 3 : 2));
|
p.setPen(QPen(Qt::white, isHit ? 3 : 2));
|
||||||
p.drawPath(path);
|
p.drawPath(path);
|
||||||
|
|
||||||
@@ -106,39 +117,40 @@ void PanelsPanel::paintEvent(QPaintEvent *)
|
|||||||
cy - midR * qSin(midAngleRad));
|
cy - midR * qSin(midAngleRad));
|
||||||
|
|
||||||
if (isHit) {
|
if (isHit) {
|
||||||
// ---- Red glow halo ring around segment ----
|
const int power = m_hits[i];
|
||||||
QPen haloPen(QColor(255, 80, 80, 120), 6);
|
const double circR = maxCircR * bubbleScale(power);
|
||||||
|
|
||||||
|
// Tier label for legend (small/medium/large)
|
||||||
|
// Glow halo
|
||||||
p.setBrush(Qt::NoBrush);
|
p.setBrush(Qt::NoBrush);
|
||||||
p.setPen(haloPen);
|
p.setPen(QPen(QColor(255, 80, 80, 110), 5));
|
||||||
p.drawPath(path);
|
p.drawPath(path);
|
||||||
|
|
||||||
// ---- Red filled circle centred on segment ----
|
// Drop shadow
|
||||||
const double circR = qMin(outerR - innerR, midR * 0.38) * 0.9;
|
|
||||||
const QRectF circRect(mid.x() - circR, mid.y() - circR, circR * 2, circR * 2);
|
const QRectF circRect(mid.x() - circR, mid.y() - circR, circR * 2, circR * 2);
|
||||||
|
p.setBrush(QColor(0, 0, 0, 55));
|
||||||
// drop shadow
|
|
||||||
p.setBrush(QColor(0, 0, 0, 60));
|
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
p.drawEllipse(circRect.adjusted(2, 3, 2, 3));
|
p.drawEllipse(circRect.adjusted(2, 3, 2, 3));
|
||||||
|
|
||||||
// circle fill: radial gradient (bright centre → dark red)
|
// Radial gradient fill
|
||||||
QRadialGradient grad(mid, circR, QPointF(mid.x() - circR*0.3, mid.y() - circR*0.3));
|
QRadialGradient grad(mid, circR,
|
||||||
|
QPointF(mid.x() - circR * 0.3, mid.y() - circR * 0.3));
|
||||||
grad.setColorAt(0.0, QColor(255, 100, 100));
|
grad.setColorAt(0.0, QColor(255, 100, 100));
|
||||||
grad.setColorAt(1.0, QColor(160, 10, 10));
|
grad.setColorAt(1.0, QColor(160, 10, 10));
|
||||||
p.setBrush(grad);
|
p.setBrush(grad);
|
||||||
p.setPen(QPen(QColor(255, 200, 200), 1.5));
|
p.setPen(QPen(QColor(255, 200, 200), 1.5));
|
||||||
p.drawEllipse(circRect);
|
p.drawEllipse(circRect);
|
||||||
|
|
||||||
// power value text
|
// Power value text — scale font to circle size
|
||||||
QFont pf = p.font();
|
QFont pf = p.font();
|
||||||
pf.setBold(true);
|
pf.setBold(true);
|
||||||
pf.setPointSize(qMax(6, qMin(11, static_cast<int>(circR * 0.72))));
|
pf.setPointSize(qMax(6, qMin(12, static_cast<int>(circR * 0.68))));
|
||||||
p.setFont(pf);
|
p.setFont(pf);
|
||||||
p.setPen(Qt::white);
|
p.setPen(Qt::white);
|
||||||
p.drawText(circRect, Qt::AlignCenter, QString::number(m_hits[i]));
|
p.drawText(circRect, Qt::AlignCenter, QString::number(power));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// ---- Normal index label ----
|
// Normal index label
|
||||||
QFont font = p.font();
|
QFont font = p.font();
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
font.setPointSize(qMax(7, qMin(12, static_cast<int>(outerR / (m_count * 0.55 + 2)))));
|
font.setPointSize(qMax(7, qMin(12, static_cast<int>(outerR / (m_count * 0.55 + 2)))));
|
||||||
|
|||||||
2
main.cpp
2
main.cpp
@@ -374,7 +374,7 @@ int main(int argc, char *argv[])
|
|||||||
tabs->addTab(makeSettingsTab(ctrl, &window), "Settings");
|
tabs->addTab(makeSettingsTab(ctrl, &window), "Settings");
|
||||||
tabs->addTab(makePowerTab (ctrl, &window), "Power");
|
tabs->addTab(makePowerTab (ctrl, &window), "Power");
|
||||||
tabs->addTab(makeLogsTab (ctrl, &window), "Logs");
|
tabs->addTab(makeLogsTab (ctrl, &window), "Logs");
|
||||||
tabs->addTab(makePanelsTab (ctrl, &window), "Panels");
|
tabs->addTab(makePanelsTab (ctrl, &window), "Panels Impacts");
|
||||||
mainLayout->addWidget(tabs, 1);
|
mainLayout->addWidget(tabs, 1);
|
||||||
|
|
||||||
// --- Shutdown inline confirm ---
|
// --- Shutdown inline confirm ---
|
||||||
|
|||||||
Reference in New Issue
Block a user