[Client] Graph connection latency history in the status bar

Add LatencyGraphWidget, a size-agnostic bar sparkline over the rolling
sample window: heights scale to the window's own range while colors map
onto an absolute quality ramp, so a steady good ping stays green. Embed
it in the new LatencyStatusWidget together with the textual ping
readout and feed both through ConnectionController's forwarded signals;
the whole area hides while disconnected or without samples.

Took 9 minutes

Took 14 seconds
This commit is contained in:
Lukas Brübach 2026-08-22 17:43:11 +02:00
parent be92a7fd67
commit b11fb3d7ca
7 changed files with 195 additions and 24 deletions

View file

@ -0,0 +1,38 @@
/**
* @file latency_status_widget.h
* @ingroup Client
*/
#ifndef LATENCY_STATUS_WIDGET_H
#define LATENCY_STATUS_WIDGET_H
#include <QList>
#include <QWidget>
class QLabel;
class LatencyGraphWidget;
/**
* @brief Status bar presentation of server round-trip health.
*
* Combines the textual "Ping" readout with a small LatencyGraphWidget
* sparkline of the rolling sample window. Stays hidden while disconnected or
* before any samples exist. Owns all latency display state so MainWindow only
* needs to forward two signals here.
*/
class LatencyStatusWidget : public QWidget
{
Q_OBJECT
public:
explicit LatencyStatusWidget(QWidget *parent = nullptr);
public slots:
void updateStats(int lastMs, int medianMs, int p95Ms, int maxMs, int sampleCount);
void updateSamples(const QList<int> &samplesMs);
private:
QLabel *pingLabel = nullptr;
LatencyGraphWidget *latencyGraph = nullptr;
};
#endif