20#ifndef ORES_QT_CLIENT_CATALOG_MODEL_HPP
21#define ORES_QT_CLIENT_CATALOG_MODEL_HPP
24#include <QAbstractTableModel>
26#include "ores.dq.api/domain/catalog.hpp"
27#include "ores.qt/AbstractClientModel.hpp"
28#include "ores.qt/ClientManager.hpp"
29#include "ores.qt/ColumnMetadata.hpp"
30#include "ores.qt/RecencyPulseManager.hpp"
31#include "ores.qt/RecencyTracker.hpp"
32#include "ores.logging/make_logger.hpp"
47 inline static std::string_view logger_name =
"ores.qt.client_catalog_model";
49 [[nodiscard]]
static auto& lg() {
51 static auto instance = make_logger(logger_name);
71 static constexpr std::size_t
kColumnCount = std::size_t(ColumnCount);
72 static constexpr std::array<ColumnMetadata, kColumnCount> kColumns = {{
75 .header = std::string_view(
"Name"),
77 .hidden_by_default =
false,
81 .column = Description,
82 .header = std::string_view(
"Description"),
84 .hidden_by_default =
false,
89 .header = std::string_view(
"Owner"),
91 .hidden_by_default =
false,
96 .header = std::string_view(
"Version"),
98 .hidden_by_default =
false,
102 .column = ModifiedBy,
103 .header = std::string_view(
"Modified By"),
105 .hidden_by_default =
false,
109 .column = RecordedAt,
110 .header = std::string_view(
"Recorded At"),
112 .hidden_by_default =
false,
130 static std::vector<column_style>
const kStylesVector = []() {
131 std::vector<column_style> result;
134 result.push_back(kColumns[i].style);
137 return kStylesVector;
144 static QVector<int>
const result =
145 ::ores::qt::defaultHiddenColumns<kColumnCount>(kColumns);
150 QObject* parent =
nullptr);
152 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
153 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
154 QVariant data(
const QModelIndex& index,
155 int role = Qt::DisplayRole)
const override;
156 QVariant headerData(
int section, Qt::Orientation orientation,
157 int role = Qt::DisplayRole)
const override;
165 void errorOccurred(
const QString& message,
const QString& details = {});
168 void onPulseStateChanged(
bool isOn);
169 void onPulsingComplete();
172 QVariant foregroundColor(
const std::string& name)
const;
174 ClientManager* clientManager_;
175 std::vector<dq::domain::catalog> catalogs_;
179 RecencyTracker<dq::domain::catalog, CatalogKeyExtractor> recencyTracker_;
180 RecencyPulseManager* pulseManager_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
constexpr int kColumnWidthAuto
Sentinel value for column default width meaning "auto-size to contents".
Definition ColumnMetadata.hpp:38
@ mono_center
Monospace, centered.
@ text_left
Proportional font, left-aligned (default).
@ mono_left
Monospace, left-aligned.
Represents a logical grouping of related datasets.
Definition catalog.hpp:39
Base class for all client-side entity models.
Definition AbstractClientModel.hpp:37
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:123
Table model for displaying catalogs in a QTableView.
Definition ClientCatalogModel.hpp:43
static constexpr std::string_view kSettingsGroup
Settings group name for persisting window and column state.
Definition ClientCatalogModel.hpp:125
static constexpr std::size_t kColumnCount
Column metadata: header text, style, visibility, and width.
Definition ClientCatalogModel.hpp:71
static const QSize kDefaultWindowSize
Default window size for the catalog list window.
Definition ClientCatalogModel.hpp:120
static std::vector< column_style > const & columnStyles()
Returns a static vector of column styles (built once per process).
Definition ClientCatalogModel.hpp:129
static QVector< int > defaultHiddenColumns()
Returns a static QVector of hidden column indices (built once per process).
Definition ClientCatalogModel.hpp:143