20#ifndef ORES_QT_CLIENT_BOOK_MODEL_HPP
21#define ORES_QT_CLIENT_BOOK_MODEL_HPP
24#include <QFutureWatcher>
25#include <QAbstractTableModel>
26#include "ores.qt/AbstractClientModel.hpp"
27#include "ores.qt/ClientManager.hpp"
28#include "ores.qt/RecencyPulseManager.hpp"
29#include "ores.qt/RecencyTracker.hpp"
30#include "ores.logging/make_logger.hpp"
31#include "ores.refdata.api/domain/book.hpp"
47 inline static std::string_view logger_name =
48 "ores.qt.client_book_model";
50 [[nodiscard]]
static auto& lg() {
52 static auto instance = make_logger(logger_name);
74 QObject* parent =
nullptr);
78 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
79 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
80 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
81 QVariant headerData(
int section, Qt::Orientation orientation,
82 int role = Qt::DisplayRole)
const override;
100 void load_page(std::uint32_t offset, std::uint32_t limit);
127 void onBooksLoaded();
128 void onPulseStateChanged(
bool isOn);
129 void onPulsingComplete();
132 QVariant recency_foreground_color(
const std::string& code)
const;
136 std::vector<refdata::domain::book> books;
137 std::uint32_t total_available_count;
138 QString error_message;
139 QString error_details;
142 void fetch_books(std::uint32_t offset, std::uint32_t limit);
144 ClientManager* clientManager_;
145 ImageCache* imageCache_;
146 std::vector<refdata::domain::book> books_;
147 QFutureWatcher<FetchResult>* watcher_;
148 std::uint32_t page_size_{100};
149 std::uint32_t total_available_count_{0};
150 bool is_fetching_{
false};
153 RecencyTracker<refdata::domain::book, BookKeyExtractor> recencyTracker_;
154 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
Base class for all client-side entity models.
Definition AbstractClientModel.hpp:36
Model for displaying books fetched from the server.
Definition ClientBookModel.hpp:43
void set_page_size(std::uint32_t size)
Set the page size for pagination.
Definition ClientBookModel.cpp:294
void refresh()
Refresh book data from server asynchronously.
Definition ClientBookModel.cpp:161
std::uint32_t total_available_count() const
Get the total number of records available on the server.
Definition ClientBookModel.hpp:115
void load_page(std::uint32_t offset, std::uint32_t limit)
Load a specific page of data.
Definition ClientBookModel.cpp:187
const refdata::domain::book * getBook(int row) const
Get book at the specified row.
Definition ClientBookModel.cpp:306
std::uint32_t page_size() const
Get the page size used for pagination.
Definition ClientBookModel.hpp:105
Column
Enumeration of table columns for type-safe column access.
Definition ClientBookModel.hpp:60
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Cache for dynamically loaded images (flags, icons) from the server.
Definition ImageCache.hpp:53
Operational ledger leaf that holds trades.
Definition book.hpp:37