20#ifndef ORES_QT_CLIENT_CHANGE_REASON_MODEL_HPP
21#define ORES_QT_CLIENT_CHANGE_REASON_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/change_reason.hpp"
44 inline static std::string_view logger_name =
45 "ores.qt.client_change_reason_model";
47 [[nodiscard]]
static auto& lg() {
49 static auto instance = make_logger(logger_name);
71 QObject* parent =
nullptr);
75 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
76 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
77 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
78 QVariant headerData(
int section, Qt::Orientation orientation,
79 int role = Qt::DisplayRole)
const override;
103 void loadError(
const QString& error_message,
const QString& details = {});
106 void onReasonsLoaded();
107 void onPulseStateChanged(
bool isOn);
108 void onPulsingComplete();
111 QVariant recency_foreground_color(
const std::string& code)
const;
115 std::vector<dq::domain::change_reason> reasons;
116 QString error_message;
117 QString error_details;
120 ClientManager* clientManager_;
121 std::vector<dq::domain::change_reason> reasons_;
122 QFutureWatcher<FetchResult>* watcher_;
123 bool is_fetching_{
false};
127 RecencyTracker<dq::domain::change_reason, ChangeReasonKeyExtractor> recencyTracker_;
128 RecencyPulseManager* pulseManager_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:35
Defines a specific reason for record changes.
Definition change_reason.hpp:47
Model for displaying change reasons fetched from the server.
Definition ClientChangeReasonModel.hpp:40
const dq::domain::change_reason * getReason(int row) const
Get reason at the specified row.
Definition ClientChangeReasonModel.cpp:248
void refresh()
Refresh reason data from server asynchronously.
Definition ClientChangeReasonModel.cpp:143
void dataLoaded()
Emitted when data has been successfully loaded.
void loadError(const QString &error_message, const QString &details={})
Emitted when an error occurs during data loading.
Column
Enumeration of table columns for type-safe column access.
Definition ClientChangeReasonModel.hpp:57
Manages the lifecycle of the network client and IO context.
Definition ClientManager.hpp:90