/**
 * @file HistoryBar.h
 * @brief History-browsing toolbar: Live, range readout, pan, jump presets, All.
 *
 * Operates on the PlotGrid (sets all plots non-live and seeds their stored X
 * range). Mirrors the ImGui App::renderHistoryBar. Visible only when the hub
 * reports history is enabled and populated.
 */

#pragma once

#include <QWidget>

class QLabel;

namespace shq {

class Hub;
class PlotGrid;

class HistoryBar : public QWidget {
    Q_OBJECT
public:
    HistoryBar(Hub* hub, PlotGrid* grid, QWidget* parent = nullptr);

public Q_SLOTS:
    /** Update the range readout (called by the 60 Hz tick). */
    void updateReadout();
    /** Jump all plots to the full available history range. */
    void showAll();

Q_SIGNALS:
    /** User pressed Live → MainWindow hides this bar. */
    void liveRequested();

private:
    Hub*      hub_;
    PlotGrid* grid_;
    QLabel*   rangeLbl_ = nullptr;
};

} /* namespace shq */
