55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
/**
|
|
* @file StatsDialog.h
|
|
* @brief Per-source statistics table + cycle-time histograms.
|
|
*
|
|
* Mirrors the ImGui StatsPanel: a metrics table (rate, lost, frags/bytes per
|
|
* cycle, cycle ms avg/std/min/max) and a 20-bin cycle-time histogram per
|
|
* source, drawn with a small QPainter bar widget.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "Protocol.h"
|
|
|
|
#include <QDialog>
|
|
|
|
class QTableWidget;
|
|
class QVBoxLayout;
|
|
|
|
namespace shq {
|
|
|
|
class Hub;
|
|
|
|
/** Small bar-chart widget for a 20-bin cycle-time histogram. */
|
|
class HistogramWidget : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit HistogramWidget(QWidget* parent = nullptr);
|
|
void setData(const StreamHubClient::SourceStats& st);
|
|
QSize sizeHint() const override { return QSize(400, 120); }
|
|
protected:
|
|
void paintEvent(QPaintEvent*) override;
|
|
private:
|
|
double bins_[20] = {};
|
|
double min_ = 0.0, max_ = 0.0;
|
|
bool valid_ = false;
|
|
};
|
|
|
|
class StatsDialog : public QDialog {
|
|
Q_OBJECT
|
|
public:
|
|
explicit StatsDialog(Hub* hub, QWidget* parent = nullptr);
|
|
|
|
public Q_SLOTS:
|
|
void refresh();
|
|
|
|
private:
|
|
Hub* hub_;
|
|
QTableWidget* table_ = nullptr;
|
|
QVBoxLayout* histLay_ = nullptr;
|
|
std::vector<HistogramWidget*> hists_;
|
|
std::vector<QWidget*> histBlocks_;
|
|
};
|
|
|
|
} /* namespace shq */
|