20#ifndef ORES_QT_ORE_IMPORT_WIZARD_HPP
21#define ORES_QT_ORE_IMPORT_WIZARD_HPP
25#include <boost/uuid/uuid.hpp>
31#include <QProgressBar>
33#include <QRadioButton>
39#include "ores.logging/make_logger.hpp"
40#include "ores.qt/ClientManager.hpp"
41#include "ores.ore/scanner/scan_result.hpp"
42#include "ores.ore/planner/import_choices.hpp"
43#include "ores.ore/planner/ore_import_plan.hpp"
63 inline static std::string_view logger_name =
"ores.qt.ore_import_wizard";
65 [[nodiscard]]
static auto& lg() {
67 static auto instance = make_logger(logger_name);
83 std::optional<boost::uuids::uuid> parentPortfolioId = std::nullopt,
84 const std::string& parentPortfolioName =
"",
85 QWidget* parent =
nullptr);
88 ClientManager* clientManager()
const {
return clientManager_; }
98 int savedCurrencies()
const {
return savedCurrencies_; }
99 int savedPortfolios()
const {
return savedPortfolios_; }
100 int savedBooks()
const {
return savedBooks_; }
101 int savedTrades()
const {
return savedTrades_; }
102 bool importSuccess()
const {
return importSuccess_; }
103 QString importError()
const {
return importError_; }
105 void setImportResults(
int currencies,
int portfolios,
int books,
int trades) {
106 savedCurrencies_ = currencies;
107 savedPortfolios_ = portfolios;
109 savedTrades_ = trades;
111 void setImportSuccess(
bool ok) { importSuccess_ = ok; }
112 void setImportError(
const QString& msg) { importError_ = msg; }
115 const std::set<std::string>& existingIsoCodes()
const {
return existingIsoCodes_; }
116 void setExistingIsoCodes(std::set<std::string> codes) {
117 existingIsoCodes_ = std::move(codes);
121 const std::vector<std::string>& existingPortfolioNames()
const {
122 return existingPortfolioNames_;
124 void setExistingPortfolioNames(std::vector<std::string> names) {
125 existingPortfolioNames_ = std::move(names);
135 std::set<std::string> existingIsoCodes_;
136 std::vector<std::string> existingPortfolioNames_;
138 int savedCurrencies_ = 0;
139 int savedPortfolios_ = 0;
141 int savedTrades_ = 0;
142 bool importSuccess_ =
false;
143 QString importError_;
150class OreWelcomePage final :
public QWizardPage {
158class OreDirectoryPage final :
public QWizardPage {
162 inline static std::string_view logger_name =
"ores.qt.ore_directory_page";
163 [[nodiscard]]
static auto& lg() {
165 static auto instance = make_logger(logger_name);
170 explicit OreDirectoryPage(OreImportWizard* wizard);
171 bool isComplete()
const override;
172 bool validatePage()
override;
175 void onBrowseClicked();
176 void onScanFinished();
181 OreImportWizard* wizard_;
183 QPushButton* browseBtn_;
184 QLabel* statusLabel_;
185 QProgressBar* progressBar_;
186 bool scanComplete_ =
false;
187 bool scanning_ =
false;
190class OreScanSummaryPage final :
public QWizardPage {
193 explicit OreScanSummaryPage(OreImportWizard* wizard);
194 void initializePage()
override;
197 void onExclusionAdded();
198 void onExclusionRemoved();
201 void refreshSummary();
203 OreImportWizard* wizard_;
204 QLabel* summaryLabel_;
205 QListWidget* exclusionList_;
206 QLineEdit* exclusionEdit_;
207 QPushButton* addBtn_;
208 QPushButton* removeBtn_;
209 QLabel* hierarchyLabel_;
212class OreCurrencyPage final :
public QWizardPage {
216 inline static std::string_view logger_name =
"ores.qt.ore_currency_page";
217 [[nodiscard]]
static auto& lg() {
219 static auto instance = make_logger(logger_name);
224 explicit OreCurrencyPage(OreImportWizard* wizard);
225 void initializePage()
override;
228 void onFetchFinished();
229 void onModeChanged();
232 OreImportWizard* wizard_;
233 QRadioButton* allRadio_;
234 QRadioButton* missingRadio_;
235 QLabel* statusLabel_;
237 bool fetchDone_ =
false;
240class OrePortfolioPage final :
public QWizardPage {
244 inline static std::string_view logger_name =
"ores.qt.ore_portfolio_page";
245 [[nodiscard]]
static auto& lg() {
247 static auto instance = make_logger(logger_name);
252 explicit OrePortfolioPage(OreImportWizard* wizard);
253 void initializePage()
override;
254 bool validatePage()
override;
257 void onCreateParentToggled(
bool checked);
258 void onPortfoliosFetchFinished();
261 OreImportWizard* wizard_;
262 QLabel* parentContextLabel_{
nullptr};
263 QCheckBox* createParentCheck_;
264 QComboBox* parentCombo_;
265 QLabel* hierarchyPreviewLabel_;
266 QRadioButton* addTradesRadio_;
267 QRadioButton* newVersionsRadio_;
268 bool fetchDone_ =
false;
271class OreTradeImportPage final :
public QWizardPage {
275 inline static std::string_view logger_name =
"ores.qt.ore_trade_import_page";
276 [[nodiscard]]
static auto& lg() {
278 static auto instance = make_logger(logger_name);
283 explicit OreTradeImportPage(OreImportWizard* wizard);
284 void initializePage()
override;
285 bool isComplete()
const override;
286 bool validatePage()
override;
289 void onActivityTypesFetchFinished();
290 void onCounterpartiesFetchFinished();
291 void onImportFinished();
295 void appendLog(
const QString& msg);
297 OreImportWizard* wizard_;
298 QLineEdit* tradeDateEdit_;
299 QComboBox* lifecycleEventCombo_;
300 QComboBox* defaultCounterpartyCombo_;
301 QLabel* counterpartyStatusLabel_;
302 QLabel* statusLabel_;
303 QProgressBar* progressBar_;
304 QTextEdit* logOutput_;
305 bool importDone_ =
false;
306 bool importStarted_ =
false;
309class OreDonePage final :
public QWizardPage {
312 explicit OreDonePage(OreImportWizard* wizard);
313 void initializePage()
override;
315 OreImportWizard* wizard_;
316 QLabel* summaryLabel_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
User-supplied choices that drive the import plan.
Definition import_choices.hpp:69
Complete, ready-to-execute import plan produced by ore_import_planner.
Definition ore_import_plan.hpp:37
Result of scanning an ORE directory for importable files.
Definition scan_result.hpp:31
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
7-page wizard for importing ORE directory data into OreStudio.
Definition OreImportWizard.hpp:59