ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
FxAccumulatorInstrumentForm Class Referencefinal

IInstrumentForm for FX Accumulator trades. More...

#include <FxAccumulatorInstrumentForm.hpp>

Inheritance diagram for FxAccumulatorInstrumentForm:
Inheritance graph
Collaboration diagram for FxAccumulatorInstrumentForm:
Collaboration graph

Public Member Functions

 FxAccumulatorInstrumentForm (QWidget *parent=nullptr)
 
void setClientManager (ClientManager *cm) override
 Inject the NATS client used for load and save round-trips.
 
void setUsername (const std::string &username) override
 Inject the username stamped on every saved instrument.
 
void setImageCache (ImageCache *cache) override
 Inject the image cache for flag icons on currency combo boxes.
 
void setInstrument (const trading::domain::trade_instrument &instrument) override
 Populate the form with the already-resolved instrument.
 
void clear () override
 Reset the form to a blank state ready for create mode.
 
void setTradeType (const QString &code, bool has_options, bool has_extension) override
 Inform the form which trade type is currently selected.
 
void setReadOnly (bool readOnly) override
 Toggle read-only on every editable widget.
 
bool isDirty () const override
 Has the user edited any field since the last load or save?
 
bool isLoaded () const override
 True after the asynchronous load has populated the form.
 
void setChangeReason (const std::string &code, const std::string &commentary) override
 Stamp the change reason on the in-flight instrument before the dialog calls saveInstrument.
 
void writeUiToInstrument () override
 Pull the current UI values into the in-flight domain object.
 
void saveInstrument (std::function< void(const std::string &id)> on_success, std::function< void(const QString &error)> on_failure) override
 Save the in-flight instrument via the family's NATS request.
 

Additional Inherited Members

- Signals inherited from IInstrumentForm
void changed ()
 Emitted when any field changes (after the initial load).
 
void instrumentLoaded ()
 Emitted once the asynchronous load has populated the form.
 
void loadFailed (const QString &error)
 Emitted on a load failure with the server's error message.
 
void provenanceChanged (const InstrumentProvenance &provenance)
 Emitted with the latest audit metadata after load and save.
 

Detailed Description

IInstrumentForm for FX Accumulator trades.

Handles: FxAccumulator.

Member Function Documentation

◆ setClientManager()

void setClientManager ( ClientManager cm)
overridevirtual

Inject the NATS client used for load and save round-trips.

Implements IInstrumentForm.

◆ setUsername()

void setUsername ( const std::string &  username)
overridevirtual

Inject the username stamped on every saved instrument.

Implements IInstrumentForm.

◆ setImageCache()

void setImageCache ( ImageCache )
overridevirtual

Inject the image cache for flag icons on currency combo boxes.

Reimplemented from IInstrumentForm.

◆ setInstrument()

void setInstrument ( const trading::domain::trade_instrument &  instrument)
overridevirtual

Populate the form with the already-resolved instrument.

The dialog holds the full trade bundle and pushes the instrument here. The form pattern-matches its family from the variant, stores the per-type domain object, and updates the UI synchronously. On success it emits instrumentLoaded and provenanceChanged. If the variant does not hold this family's alternative the form emits loadFailed with a descriptive message.

Implements IInstrumentForm.

◆ clear()

void clear ( )
overridevirtual

Reset the form to a blank state ready for create mode.

Implements IInstrumentForm.

◆ setTradeType()

void setTradeType ( const QString &  code,
bool  has_options,
bool  has_extension 
)
overridevirtual

Inform the form which trade type is currently selected.

Parameters
codeThe trade type code (e.g. "FxOption").
has_optionsReveal the family's options sub-section.
has_extensionReveal the family's extension sub-section.

The form decides how to lay out its sub-sections based on these flags — typically by toggling the visibility of internal tabs.

Implements IInstrumentForm.

◆ setReadOnly()

void setReadOnly ( bool  readOnly)
overridevirtual

Toggle read-only on every editable widget.

Implements IInstrumentForm.

◆ isDirty()

bool isDirty ( ) const
overridevirtual

Has the user edited any field since the last load or save?

Implements IInstrumentForm.

◆ isLoaded()

bool isLoaded ( ) const
overridevirtual

True after the asynchronous load has populated the form.

Implements IInstrumentForm.

◆ setChangeReason()

void setChangeReason ( const std::string &  code,
const std::string &  commentary 
)
overridevirtual

Stamp the change reason on the in-flight instrument before the dialog calls saveInstrument.

The dialog gathers a single change reason once per save and applies it identically to both the trade and the instrument so that the two audit trails stay aligned.

Implements IInstrumentForm.

◆ writeUiToInstrument()

void writeUiToInstrument ( )
overridevirtual

Pull the current UI values into the in-flight domain object.

Implements IInstrumentForm.

◆ saveInstrument()

void saveInstrument ( std::function< void(const std::string &id)>  on_success,
std::function< void(const QString &error)>  on_failure 
)
overridevirtual

Save the in-flight instrument via the family's NATS request.

Parameters
on_successInvoked on the Qt thread with the saved instrument id (so the dialog can populate trade.instrument_id in create mode and continue to the trade save).
on_failureInvoked on the Qt thread with a human-readable error message; the dialog should abort the trade save and surface the error to the user.

Implements IInstrumentForm.