ORE Studio 0.0.4
Loading...
Searching...
No Matches
CommodityInstrumentHistoryDialog.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_COMMODITY_INSTRUMENT_HISTORY_DIALOG_HPP
21#define ORES_QT_COMMODITY_INSTRUMENT_HISTORY_DIALOG_HPP
22
23#include <QWidget>
24#include <QToolBar>
25#include <QTableWidget>
26#include "ores.qt/ClientManager.hpp"
27#include "ores.logging/make_logger.hpp"
28#include "ores.trading.api/domain/commodity_instrument.hpp"
29
30namespace Ui {
31class CommodityInstrumentHistoryDialog;
32}
33
34namespace ores::qt {
35
39class CommodityInstrumentHistoryDialog final : public QWidget {
40 Q_OBJECT
41
42private:
43 inline static std::string_view logger_name =
44 "ores.qt.commodity_instrument_history_dialog";
45
46 [[nodiscard]] static auto& lg() {
47 using namespace ores::logging;
48 static auto instance = make_logger(logger_name);
49 return instance;
50 }
51
52public:
54 const QString& id,
55 ClientManager* clientManager,
56 QWidget* parent = nullptr);
58
59 void loadHistory();
60
61signals:
62 void statusChanged(const QString& message);
63 void errorOccurred(const QString& error_message);
64 void openVersionRequested(const trading::domain::commodity_instrument& v,
65 int versionNumber);
66 void revertVersionRequested(const trading::domain::commodity_instrument& v);
67
68private slots:
69 void onVersionSelected();
70 void onOpenVersionClicked();
71 void onRevertClicked();
72
73private:
74 void setupUi();
75 void setupToolbar();
76 void setupConnections();
77 void updateVersionList();
78 void updateChangesTable(int currentVersionIndex);
79 void updateFullDetails(int versionIndex);
80 void updateActionStates();
81
82 Ui::CommodityInstrumentHistoryDialog* ui_;
83 QString id_;
84 ClientManager* clientManager_;
85 std::vector<trading::domain::commodity_instrument> versions_;
86
87 QToolBar* toolbar_;
88 QAction* openVersionAction_;
89 QAction* revertAction_;
90};
91
92}
93
94#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Dialog for viewing the version history of a commodity instrument.
Definition CommodityInstrumentHistoryDialog.hpp:39
Commodity instrument economics for all commodity ORE product types.
Definition commodity_instrument.hpp:48