ORE Studio 0.0.4
Loading...
Searching...
No Matches
AdminPlugin.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_ADMIN_PLUGIN_HPP
20#define ORES_QT_ADMIN_PLUGIN_HPP
21
22#include <memory>
23#include <QList>
24#include "ores.qt/PluginBase.hpp"
25
26class QAction;
27
28namespace ores::qt {
29
30class AccountController;
31class RoleController;
32class TenantController;
33class TenantTypeController;
34class SystemSettingController;
35class BadgeDefinitionController;
36class BadgeSeverityController;
37
44class AdminPlugin : public PluginBase {
45 Q_OBJECT
46 Q_PLUGIN_METADATA(IID "ores.qt.IPlugin/1.0")
47 Q_INTERFACES(ores::qt::IPlugin)
48
49public:
50 explicit AdminPlugin(QObject* parent = nullptr);
51 ~AdminPlugin() override;
52
53 QString name() const override { return QStringLiteral("ores.qt.admin"); }
54 int load_order() const override { return 50; } // setup_menus only; no standalone menus
55
56 void on_login(const plugin_context& ctx) override;
57 void setup_menus(const shared_menus_context& ctx) override;
58 QList<QMenu*> create_menus() override;
59 QList<QAction*> toolbar_actions() override;
60 void on_logout() override;
61
62private:
63 void show_onboarding_wizard();
64
65 plugin_context ctx_;
66
67 QAction* act_accounts_{nullptr};
68 QAction* act_tenants_{nullptr};
69 QAction* act_system_settings_{nullptr};
70
71 std::unique_ptr<AccountController> accountController_;
72 std::unique_ptr<RoleController> roleController_;
73 std::unique_ptr<TenantController> tenantController_;
74 std::unique_ptr<TenantTypeController> tenantTypeController_;
75 std::unique_ptr<SystemSettingController> systemSettingController_;
76 std::unique_ptr<BadgeDefinitionController> badgeDefinitionController_;
77 std::unique_ptr<BadgeSeverityController> badgeSeverityController_;
78};
79
80}
81
82#endif
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
Plugin owning all admin-domain entity controllers.
Definition AdminPlugin.hpp:44
void on_logout() override
Destroy controllers and unsubscribe from server events.
Definition AdminPlugin.cpp:186
QList< QAction * > toolbar_actions() override
Return actions to be added to the main toolbar.
Definition AdminPlugin.cpp:180
QList< QMenu * > create_menus() override
Build and return standalone domain menus for this plugin.
Definition AdminPlugin.cpp:175
void setup_menus(const shared_menus_context &ctx) override
Contribute items to host-owned shared menus.
Definition AdminPlugin.cpp:118
QString name() const override
Returns a short, unique plugin name (e.g. "ores.qt.legacy").
Definition AdminPlugin.hpp:53
int load_order() const override
Load order hint — lower values are initialised first (default 100).
Definition AdminPlugin.hpp:54
void on_login(const plugin_context &ctx) override
Create controllers and subscribe to server events.
Definition AdminPlugin.cpp:78
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