ORE Studio 0.0.4
Loading...
Searching...
No Matches
IPlugin.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_IPLUGIN_HPP
20#define ORES_QT_IPLUGIN_HPP
21
22#include <QList>
23#include <QString>
24#include <QtPlugin>
25#include "ores.qt/export.hpp"
26#include "ores.qt/plugin_context.hpp"
27
28class QMenu;
29class QAction;
30
31namespace ores::qt {
32
40 QMenu* system_menu = nullptr;
41 QMenu* reference_data_menu = nullptr;
42 QMenu* telemetry_menu = nullptr;
43 QMenu* identity_menu = nullptr;
44 QMenu* data_transfer_menu = nullptr;
45 QMenu* trading_codes_menu = nullptr;
46};
47
70class ORES_QT_API IPlugin {
71public:
72 virtual ~IPlugin() = default;
73
77 virtual QString name() const = 0;
78
82 virtual int load_order() const { return 100; }
83
90 virtual void on_login(const plugin_context& ctx) = 0;
91
104 virtual void setup_menus(const shared_menus_context& ctx) {
105 Q_UNUSED(ctx)
106 }
107
118 virtual QList<QMenu*> create_menus() = 0;
119
125 virtual void on_logout() = 0;
126
137 virtual QList<QAction*> toolbar_actions() { return {}; }
138};
139
140}
141
142Q_DECLARE_INTERFACE(ores::qt::IPlugin, "ores.qt.IPlugin/1.0")
143
144#endif
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
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
virtual void on_logout()=0
Destroy controllers and unsubscribe from server events.
virtual int load_order() const
Load order hint — lower values are initialised first (default 100).
Definition IPlugin.hpp:82
virtual QString name() const =0
Returns a short, unique plugin name (e.g. "ores.qt.legacy").
virtual QList< QAction * > toolbar_actions()
Return actions to be added to the main toolbar.
Definition IPlugin.hpp:137
virtual void setup_menus(const shared_menus_context &ctx)
Contribute items to host-owned shared menus.
Definition IPlugin.hpp:104
virtual QList< QMenu * > create_menus()=0
Build and return standalone domain menus for this plugin.
virtual void on_login(const plugin_context &ctx)=0
Create controllers and subscribe to server events.
Context passed to each plugin at login time.
Definition plugin_context.hpp:47