20#ifndef ORES_QT_CLIENT_PARTY_MODEL_HPP
21#define ORES_QT_CLIENT_PARTY_MODEL_HPP
24#include <unordered_map>
25#include <QFutureWatcher>
26#include <QAbstractTableModel>
27#include "ores.qt/AbstractClientModel.hpp"
28#include "ores.qt/ClientManager.hpp"
29#include "ores.qt/ImageCache.hpp"
30#include "ores.qt/RecencyPulseManager.hpp"
31#include "ores.qt/RecencyTracker.hpp"
32#include "ores.logging/make_logger.hpp"
33#include "ores.refdata.api/domain/party.hpp"
47 inline static std::string_view logger_name =
48 "ores.qt.client_party_model";
50 [[nodiscard]]
static auto& lg() {
52 static auto instance = make_logger(logger_name);
77 QObject* parent =
nullptr);
81 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
82 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
83 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
84 QVariant headerData(
int section, Qt::Orientation orientation,
85 int role = Qt::DisplayRole)
const override;
92 void refresh(
bool replace =
true);
100 void load_page(std::uint32_t offset, std::uint32_t limit);
137 void onPartysLoaded();
138 void onPulseStateChanged(
bool isOn);
139 void onPulsingComplete();
142 QVariant recency_foreground_color(
const std::string& code)
const;
146 std::vector<refdata::domain::party> parties;
147 std::uint32_t total_available_count;
148 QString error_message;
149 QString error_details;
152 void fetch_parties(std::uint32_t offset, std::uint32_t limit);
153 void fetch_business_centres();
155 ClientManager* clientManager_;
156 ImageCache* imageCache_;
157 std::vector<refdata::domain::party> parties_;
158 QFutureWatcher<FetchResult>* watcher_;
159 std::uint32_t page_size_{100};
160 std::uint32_t total_available_count_{0};
161 bool is_fetching_{
false};
164 RecencyTracker<refdata::domain::party, PartyKeyExtractor> recencyTracker_;
165 RecencyPulseManager* pulseManager_;
167 std::unordered_map<std::string, std::string> bc_code_to_image_id_;
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
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Model for displaying parties fetched from the server.
Definition ClientPartyModel.hpp:43
const refdata::domain::party * getParty(int row) const
Get party at the specified row.
Definition ClientPartyModel.cpp:316
void set_page_size(std::uint32_t size)
Set the page size for pagination.
Definition ClientPartyModel.cpp:269
std::uint32_t total_available_count() const
Get the total number of records available on the server.
Definition ClientPartyModel.hpp:125
void refresh(bool replace=true)
Refresh party data from server asynchronously.
Definition ClientPartyModel.cpp:174
void load_page(std::uint32_t offset, std::uint32_t limit)
Load a specific page of party data.
Definition ClientPartyModel.cpp:200
std::uint32_t page_size() const
Get the page size used for pagination.
Definition ClientPartyModel.hpp:113
Column
Enumeration of table columns for type-safe column access.
Definition ClientPartyModel.hpp:60
Cache for dynamically loaded images (flags, icons) from the server.
Definition ImageCache.hpp:53
An internal legal entity participating in financial transactions.
Definition party.hpp:37