Add a listing of plugin commands

This commit is contained in:
Mm2PL 2023-01-31 15:55:53 +01:00
parent dc5141dfc7
commit 50e71195b2
No known key found for this signature in database
GPG key ID: 94AC9B80EFA15ED9
2 changed files with 22 additions and 0 deletions

View file

@ -79,6 +79,16 @@ public:
return true; return true;
} }
std::set<QString> listRegisteredCommands()
{
std::set<QString> out;
for (const auto &[name, _] : this->ownedCommands)
{
out.insert(name);
}
return out;
}
private: private:
QDir loadDirectory_; QDir loadDirectory_;
lua_State *state_; lua_State *state_;

View file

@ -83,6 +83,18 @@ void PluginsPage::rebuildContent()
} }
pl->addRow("Used libraries", libs); 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"); auto *reload = new QPushButton("Reload");
QObject::connect(reload, &QPushButton::pressed, QObject::connect(reload, &QPushButton::pressed,
[name = codename, this]() { [name = codename, this]() {