20#ifndef ORES_QT_CLIENT_BADGE_SEVERITY_MODEL_HPP
21#define ORES_QT_CLIENT_BADGE_SEVERITY_MODEL_HPP
24#include <QFutureWatcher>
25#include <QAbstractTableModel>
26#include "ores.qt/ClientManager.hpp"
27#include "ores.qt/RecencyPulseManager.hpp"
28#include "ores.qt/RecencyTracker.hpp"
29#include "ores.logging/make_logger.hpp"
30#include "ores.dq/domain/badge_severity.hpp"
44 inline static std::string_view logger_name =
45 "ores.qt.client_badge_severity_model";
47 [[nodiscard]]
static auto& lg() {
49 static auto instance = make_logger(logger_name);
69 QObject* parent =
nullptr);
73 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
74 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
75 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
76 QVariant headerData(
int section, Qt::Orientation orientation,
77 int role = Qt::DisplayRole)
const override;
95 void load_page(std::uint32_t offset, std::uint32_t limit);
121 void loadError(
const QString& error_message,
const QString& details = {});
124 void onSeveritysLoaded();
125 void onPulseStateChanged(
bool isOn);
126 void onPulsingComplete();
129 QVariant recency_foreground_color(
const std::string& code)
const;
133 std::vector<dq::domain::badge_severity> severities;
134 std::uint32_t total_available_count;
135 QString error_message;
136 QString error_details;
139 void fetch_severities(std::uint32_t offset, std::uint32_t limit);
141 ClientManager* clientManager_;
142 std::vector<dq::domain::badge_severity> severities_;
143 QFutureWatcher<FetchResult>* watcher_;
144 std::uint32_t page_size_{100};
145 std::uint32_t total_available_count_{0};
146 bool is_fetching_{
false};
149 RecencyTracker<dq::domain::badge_severity, BadgeSeverityKeyExtractor> recencyTracker_;
150 RecencyPulseManager* pulseManager_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Severity levels for badge visual classification.
Definition badge_severity.hpp:38
Model for displaying badge severities fetched from the server.
Definition ClientBadgeSeverityModel.hpp:40
const dq::domain::badge_severity * getSeverity(int row) const
Get badge severity at the specified row.
Definition ClientBadgeSeverityModel.cpp:275
void set_page_size(std::uint32_t size)
Set the page size for pagination.
Definition ClientBadgeSeverityModel.cpp:263
void refresh()
Refresh badge severity data from server asynchronously.
Definition ClientBadgeSeverityModel.cpp:131
std::uint32_t total_available_count() const
Get the total number of records available on the server.
Definition ClientBadgeSeverityModel.hpp:110
void dataLoaded()
Emitted when data has been successfully loaded.
void load_page(std::uint32_t offset, std::uint32_t limit)
Load a specific page of data.
Definition ClientBadgeSeverityModel.cpp:157
void loadError(const QString &error_message, const QString &details={})
Emitted when an error occurs during data loading.
std::uint32_t page_size() const
Get the page size used for pagination.
Definition ClientBadgeSeverityModel.hpp:100
Column
Enumeration of table columns for type-safe column access.
Definition ClientBadgeSeverityModel.hpp:57
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109