ORE Studio 0.0.4
Loading...
Searching...
No Matches
TradingPlugin.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 details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
16 * Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 */
19#ifndef ORES_QT_TRADING_PLUGIN_HPP
20#define ORES_QT_TRADING_PLUGIN_HPP
21
22#include <memory>
23#include <QList>
24#include "ores.qt/PluginBase.hpp"
25
26class QAction;
27
28namespace ores::qt {
29
30class DetachableMdiSubWindow;
31class OreImportController;
32class PortfolioController;
33class BookController;
34class BookStatusController;
35class TradeController;
36
51class TradingPlugin : public PluginBase {
52 Q_OBJECT
53 Q_PLUGIN_METADATA(IID "ores.qt.IPlugin/1.0")
54 Q_INTERFACES(ores::qt::IPlugin)
55
56public:
57 explicit TradingPlugin(QObject* parent = nullptr);
58 ~TradingPlugin() override;
59
60 QString name() const override { return QStringLiteral("ores.qt.trading"); }
61 int load_order() const override { return 200; }
62
63 void on_login(const plugin_context& ctx) override;
64 void setup_menus(const shared_menus_context& ctx) override;
65 QList<QMenu*> create_menus() override;
66 QList<QAction*> toolbar_actions() override;
67 void on_logout() override;
68
69private:
70
71 plugin_context ctx_;
72
73 // Singleton MDI sub-windows (nullptr when not open)
74 DetachableMdiSubWindow* portfolio_explorer_sub_window_{nullptr};
75 DetachableMdiSubWindow* org_explorer_sub_window_{nullptr};
76
77 // Shared Trading Codes submenu (populated in setup_menus, appended in create_menus)
78 QMenu* trading_codes_menu_{nullptr};
79
80 QAction* act_portfolios_{nullptr};
81 QAction* act_books_{nullptr};
82 QAction* act_portfolio_explorer_{nullptr};
83 QAction* act_org_explorer_{nullptr};
84 QAction* act_trades_{nullptr};
85
86 // Entity controllers
87 std::unique_ptr<OreImportController> oreImportController_;
88 std::unique_ptr<PortfolioController> portfolioController_;
89 std::unique_ptr<BookController> bookController_;
90 std::unique_ptr<BookStatusController> bookStatusController_;
91 std::unique_ptr<TradeController> tradeController_;
92};
93
94}
95
96#endif
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
QMdiSubWindow that can be detached to become a floating window.
Definition DetachableMdiSubWindow.hpp:40
Context passed to setup_menus() containing all host-owned shared menus.
Definition IPlugin.hpp:39
Abstract interface that every domain plugin must implement.
Definition IPlugin.hpp:70
Context passed to each plugin at login time.
Definition plugin_context.hpp:47
Concrete base class for all domain plugins.
Definition PluginBase.hpp:46
Trading plugin: portfolios, books, trades, and the portfolio/org explorers.
Definition TradingPlugin.hpp:51
void on_logout() override
Destroy controllers and unsubscribe from server events.
Definition TradingPlugin.cpp:260
QList< QAction * > toolbar_actions() override
Return actions to be added to the main toolbar.
Definition TradingPlugin.cpp:249
QList< QMenu * > create_menus() override
Build and return standalone domain menus for this plugin.
Definition TradingPlugin.cpp:129
void setup_menus(const shared_menus_context &ctx) override
Contribute items to host-owned shared menus.
Definition TradingPlugin.cpp:95
QString name() const override
Returns a short, unique plugin name (e.g. "ores.qt.legacy").
Definition TradingPlugin.hpp:60
int load_order() const override
Load order hint — lower values are initialised first (default 100).
Definition TradingPlugin.hpp:61
void on_login(const plugin_context &ctx) override
Create controllers and subscribe to server events.
Definition TradingPlugin.cpp:60