ORE Studio 0.0.4
Loading...
Searching...
No Matches
QueueChartWindow.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_QUEUE_CHART_WINDOW_HPP
21#define ORES_QT_QUEUE_CHART_WINDOW_HPP
22
23#include <QWidget>
24#include <QComboBox>
25#include <QToolBar>
26#include <QtCharts/QChartView>
27#include "ores.qt/ClientManager.hpp"
28#include "ores.logging/make_logger.hpp"
29
30namespace ores::qt {
31
38class QueueChartWindow final : public QWidget {
39 Q_OBJECT
40
41private:
42 inline static std::string_view logger_name = "ores.qt.queue_chart_window";
43
44 [[nodiscard]] static auto& lg() {
45 using namespace ores::logging;
46 static auto instance = make_logger(logger_name);
47 return instance;
48 }
49
50 enum class TimeRange {
51 LastHour,
52 Last6Hours,
53 Last24Hours,
54 Last7Days,
55 AllTime
56 };
57
58public:
59 explicit QueueChartWindow(const QString& queueId,
60 const QString& queueName,
61 ClientManager* clientManager,
62 QWidget* parent = nullptr);
63 ~QueueChartWindow() override = default;
64
65 [[nodiscard]] const QString& queueId() const { return queueId_; }
66 [[nodiscard]] const QString& queueName() const { return queueName_; }
67
68 QSize sizeHint() const override { return {900, 500}; }
69
70 void reload();
71
72signals:
73 void statusChanged(const QString& message);
74 void errorOccurred(const QString& error_message);
75
76private slots:
77 void onTimeRangeChanged(int index);
78
79private:
80 void setupUi();
81 void setupToolbar();
82 void setupChart();
83 void clearChart(const QString& message);
84
85 QString queueId_;
86 QString queueName_;
87 ClientManager* clientManager_;
88 TimeRange currentRange_{TimeRange::LastHour};
89
90 QToolBar* toolbar_;
91 QAction* reloadAction_;
92 QComboBox* rangeCombo_;
93 QChartView* chartView_;
94};
95
96}
97
98#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
MDI window showing time-series charts for a single JetStream stream.
Definition QueueChartWindow.hpp:38