ORE Studio 0.0.4
Loading...
Searching...
No Matches
MarketFixingsMdiWindow.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_MARKET_FIXINGS_MDI_WINDOW_HPP
21#define ORES_QT_MARKET_FIXINGS_MDI_WINDOW_HPP
22
23#include <memory>
24#include <QTableView>
25#include <QToolBar>
26#include <QVBoxLayout>
27#include <QSortFilterProxyModel>
28#include "ores.qt/EntityListMdiWindow.hpp"
29#include "ores.qt/ClientManager.hpp"
30#include "ores.qt/ClientMarketSeriesModel.hpp"
31#include "ores.qt/PaginationWidget.hpp"
32#include "ores.logging/make_logger.hpp"
33#include "ores.marketdata.api/domain/market_series.hpp"
34
35namespace ores::qt {
36
45 Q_OBJECT
46
47private:
48 inline static std::string_view logger_name =
49 "ores.qt.market_fixings_mdi_window";
50
51 [[nodiscard]] static auto& lg() {
52 using namespace ores::logging;
53 static auto instance = make_logger(logger_name);
54 return instance;
55 }
56
57public:
58 explicit MarketFixingsMdiWindow(ClientManager* clientManager,
59 const QString& username,
60 QWidget* parent = nullptr);
61 ~MarketFixingsMdiWindow() override = default;
62
63 ClientMarketSeriesModel* seriesModel() const { return model_.get(); }
64
65public slots:
66 void doReload() override;
67
68signals:
69 void statusChanged(const QString& message);
70 void errorOccurred(const QString& error_message);
71 void showMarketFixings(const marketdata::domain::market_series& series);
72
73protected:
74 QString normalRefreshTooltip() const override {
75 return tr("Refresh fixing series");
76 }
77
78private slots:
79 void onDataLoaded();
80 void onLoadError(const QString& error_message, const QString& details = {});
81 void onRowDoubleClicked(const QModelIndex& index);
82 void onSelectionChanged();
83 void onConnectionStateChanged();
84 void viewFixings();
85
86private:
87 void setupUi();
88 void setupToolbar();
89 void updateActionStates();
90
91 QVBoxLayout* verticalLayout_;
92 QTableView* tableView_;
93 QToolBar* toolBar_;
94 PaginationWidget* paginationWidget_;
95
96 QAction* reloadAction_;
97 QAction* viewFixingsAction_;
98
99 std::unique_ptr<ClientMarketSeriesModel> model_;
100 QSortFilterProxyModel* proxyModel_;
101 ClientManager* clientManager_;
102 QString username_;
103};
104
105}
106
107#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Catalog entry for a market data series.
Definition market_series.hpp:44
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:123
Base class for entity list MDI windows providing stale indicator support.
Definition EntityListMdiWindow.hpp:63
Qt table model for market series fetched from the market data service.
Definition ClientMarketSeriesModel.hpp:37
MDI window listing index fixing series and their historical fixing values.
Definition MarketFixingsMdiWindow.hpp:44
QString normalRefreshTooltip() const override
Get the normal (non-stale) tooltip text for the refresh action.
Definition MarketFixingsMdiWindow.hpp:74