20#ifndef ORES_QT_TRADE_DETAIL_DIALOG_HPP
21#define ORES_QT_TRADE_DETAIL_DIALOG_HPP
27#include "ores.qt/ClientManager.hpp"
28#include "ores.qt/ImageCache.hpp"
29#include "ores.qt/DetailDialogBase.hpp"
30#include "ores.qt/ProvenanceWidget.hpp"
31#include "ores.qt/IInstrumentForm.hpp"
32#include "ores.qt/InstrumentFormRegistry.hpp"
33#include "ores.logging/make_logger.hpp"
34#include "ores.trading.api/domain/trade.hpp"
35#include "ores.trading.api/domain/trade_type.hpp"
36#include "ores.trading.api/messaging/trade_protocol.hpp"
37#include "ores.refdata.api/domain/book.hpp"
38#include "ores.refdata.api/domain/counterparty.hpp"
41class TradeDetailDialog;
63 inline static std::string_view logger_name =
64 "ores.qt.trade_detail_dialog";
66 [[nodiscard]]
static auto& lg() {
68 static auto instance = make_logger(logger_name);
77 void setUsername(
const std::string& username);
90 void setCreateMode(
bool createMode);
91 void setReadOnly(
bool readOnly);
98 return hasChanges_ || instrumentHasChanges_;
100 void showEvent(QShowEvent* event)
override;
103 void tradeSaved(
const QString& code);
104 void tradeDeleted(
const QString& code);
107 void onSaveClicked();
108 void onDeleteClicked();
109 void onCodeChanged(
const QString& text);
110 void onFieldChanged();
111 void onInstrumentFieldChanged();
112 void onCreateTradeTypeChanged(
const QString& text);
116 void setupConnections();
118 void selectCurrentBook();
119 void loadCounterparties();
120 void selectCurrentCounterparty();
121 void loadTradeTypes();
122 void updateUiFromTrade();
123 void updateTradeFromUi();
124 void updateSaveButtonState();
125 bool validateInput();
127 void activateForm(
IInstrumentForm* form,
const std::string& tradeTypeCode);
129 const std::string& trade_type_code);
130 void applyCreateTradeType();
134 Ui::TradeDetailDialog* ui_;
137 std::string username_;
139 std::vector<refdata::domain::book> books_;
140 std::vector<refdata::domain::counterparty> counterparties_;
141 bool createMode_{
true};
142 bool readOnly_{
false};
143 bool hasChanges_{
false};
149 InstrumentFormRegistry instrumentFormRegistry_;
150 std::map<trading::domain::product_type, IInstrumentForm*> formMap_;
151 std::map<std::string, IInstrumentForm*> typeFormMap_;
152 IInstrumentForm* activeForm_ =
nullptr;
155 std::map<std::string, trading::domain::trade_type> tradeTypeCache_;
158 QTimer* createTypeTimer_ =
nullptr;
160 bool instrumentLoaded_{
false};
161 bool instrumentHasChanges_{
false};
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:123
Base class for all detail dialogs.
Definition DetailDialogBase.hpp:75
Cache for dynamically loaded images (flags, icons) from the server.
Definition ImageCache.hpp:54
Widget displaying the 6 standard record provenance fields.
Definition ProvenanceWidget.hpp:40
Pure-virtual interface implemented by every per-family instrument form widget hosted in TradeDetailDi...
Definition IInstrumentForm.hpp:73
Detail dialog for viewing and editing a trade and its linked instrument.
Definition TradeDetailDialog.hpp:59
ProvenanceWidget * provenanceWidget() const override
Returns the promoted ProvenanceWidget (named "provenanceWidget" in .ui).
Definition TradeDetailDialog.cpp:119
bool hasUnsavedChanges() const override
Definition TradeDetailDialog.hpp:97
QTabWidget * tabWidget() const override
Returns the dialog's QTabWidget (named "tabWidget" in .ui).
Definition TradeDetailDialog.cpp:117
void setTradeBundle(const trading::messaging::trade_export_item &bundle)
Populate the dialog with a trade bundle (trade + instrument).
Definition TradeDetailDialog.cpp:410
QWidget * provenanceTab() const override
Returns the Provenance tab widget (named "provenanceTab" in .ui).
Definition TradeDetailDialog.cpp:118
Trade capturing FpML Trade Header properties.
Definition trade.hpp:39
One trade plus its resolved instrument data.
Definition trade_protocol.hpp:48