63 inline static std::string_view logger_name =
64 "ores.qt.org_explorer_mdi_window";
66 [[nodiscard]]
static auto& lg() {
68 static auto instance = make_logger(logger_name);
73 static constexpr const char* book_event =
"ores.refdata.book_changed";
74 static constexpr const char* business_unit_event =
75 "ores.refdata.business_unit_changed";
76 static constexpr const char* trade_event =
"ores.trading.trade_changed";
84 const QString& username,
85 QWidget* parent =
nullptr);
88 QSize sizeHint()
const override {
return QSize(1200, 700); }
99 void statusChanged(
const QString& msg);
103 return tr(
"Refresh organisational tree");
107 void onTreeSelectionChanged(
const QItemSelection& selected,
108 const QItemSelection& deselected);
109 void onNotificationReceived(
const QString& eventType,
110 const QDateTime& timestamp,
111 const QStringList& entityIds,
112 const QString& tenantId);
113 void onUnitsLoaded();
114 void onBooksLoaded();
115 void onCounterpartiesLoaded();
116 void onEditSelected();
117 void onHistorySelected();
118 void onTradeDoubleClicked(
const QModelIndex& index);
119 void updateActionStates();
125 void setupTradePanel();
126 void setupConnections();
127 void setupEventSubscriptions();
130 void collectBookUuids(
const QModelIndex& parent,
131 QList<boost::uuids::uuid>& uuids);
134 struct UnitFetchResult {
136 std::vector<refdata::domain::business_unit> units;
137 QString error_message;
138 QString error_details;
141 struct BookFetchResult {
143 std::vector<refdata::domain::book> books;
144 QString error_message;
145 QString error_details;
148 struct CounterpartyFetchResult {
150 std::unordered_map<std::string, CounterpartyInfo> cpty_map;
151 QString error_message;
152 QString error_details;
156 boost::uuids::uuid book_id;
157 std::uint32_t count{0};
159 QString error_message;
160 QString error_details;
163 ClientManager* clientManager_;
167 BusinessUnitController* businessUnitController_{
nullptr};
168 BookController* bookController_{
nullptr};
169 TradeController* tradeController_{
nullptr};
172 QToolBar* toolbar_{
nullptr};
173 QAction* reloadAction_{
nullptr};
174 QAction* editAction_{
nullptr};
175 QAction* historyAction_{
nullptr};
177 QSplitter* splitter_{
nullptr};
180 QTreeView* treeView_{
nullptr};
181 OrgExplorerTreeModel* treeModel_{
nullptr};
184 QWidget* breadcrumbBar_{
nullptr};
185 QTableView* tradeTableView_{
nullptr};
186 OrgExplorerTradeModel* tradeModel_{
nullptr};
187 QSortFilterProxyModel* tradeProxyModel_{
nullptr};
188 PaginationWidget* paginationWidget_{
nullptr};
191 QFutureWatcher<UnitFetchResult>* unitWatcher_{
nullptr};
192 QFutureWatcher<BookFetchResult>* bookWatcher_{
nullptr};
193 QFutureWatcher<CounterpartyFetchResult>* counterpartyWatcher_{
nullptr};
194 QList<QFutureWatcher<CountResult>*> countWatchers_;
197 std::vector<refdata::domain::business_unit> units_;
198 std::vector<refdata::domain::book> books_;
199 bool units_loaded_{
false};
200 bool books_loaded_{
false};