From 50e71195b239add3e72647e516fa17b51883da34 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Tue, 31 Jan 2023 15:55:53 +0100 Subject: [PATCH] Add a listing of plugin commands --- src/controllers/plugins/PluginController.hpp | 10 ++++++++++ src/widgets/settingspages/PluginsPage.cpp | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/controllers/plugins/PluginController.hpp b/src/controllers/plugins/PluginController.hpp index b672cf9d1..c9e9757fe 100644 --- a/src/controllers/plugins/PluginController.hpp +++ b/src/controllers/plugins/PluginController.hpp @@ -79,6 +79,16 @@ public: return true; } + std::set listRegisteredCommands() + { + std::set out; + for (const auto &[name, _] : this->ownedCommands) + { + out.insert(name); + } + return out; + } + private: QDir loadDirectory_; lua_State *state_; diff --git a/src/widgets/settingspages/PluginsPage.cpp b/src/widgets/settingspages/PluginsPage.cpp index 7b195f74f..a333e3c91 100644 --- a/src/widgets/settingspages/PluginsPage.cpp +++ b/src/widgets/settingspages/PluginsPage.cpp @@ -83,6 +83,18 @@ void PluginsPage::rebuildContent() } pl->addRow("Used libraries", libs); + QString cmds; + for (const auto &cmdName : plugin->listRegisteredCommands()) + { + if (!cmds.isEmpty()) + { + cmds += ", "; + } + + cmds += cmdName; + } + pl->addRow("Commands", new QLabel(cmds)); + auto *reload = new QPushButton("Reload"); QObject::connect(reload, &QPushButton::pressed, [name = codename, this]() {