Fix Bin, IO and Core plugin info (Fix #2764) (#2765)

This commit is contained in:
Florian Märkl 2021-09-19 10:58:08 +02:00 committed by GitHub
parent 3e1b3ce865
commit 7e68147eab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 49 deletions

View File

@ -2720,72 +2720,66 @@ QStringList CutterCore::getAnalysisPluginNames()
QList<RzBinPluginDescription> CutterCore::getRBinPluginDescriptions(const QString &type)
{
CORE_LOCK();
QList<RzBinPluginDescription> ret;
QJsonObject jsonRoot = cmdj("iLj").object();
for (const QString &key : jsonRoot.keys()) {
if (!type.isNull() && key != type)
continue;
QJsonArray pluginArray = jsonRoot[key].toArray();
for (const QJsonValue &pluginValue : pluginArray) {
QJsonObject pluginObject = pluginValue.toObject();
RzListIter *it;
RzBinPlugin *bp;
CutterRzListForeach(core->bin->plugins, it, RzBinPlugin, bp) {
RzBinPluginDescription desc;
desc.name = pluginObject[RJsonKey::name].toString();
desc.description = pluginObject[RJsonKey::description].toString();
desc.license = pluginObject[RJsonKey::license].toString();
desc.type = key;
desc.name = bp->name ? bp->name : "";
desc.description = bp->desc ? bp->desc : "";
desc.license = bp->license ? bp->license : "";
desc.type = "bin";
ret.append(desc);
}
RzBinXtrPlugin *bx;
CutterRzListForeach(core->bin->binxtrs, it, RzBinXtrPlugin, bx) {
RzBinPluginDescription desc;
desc.name = bx->name ? bx->name : "";
desc.description = bx->desc ? bx->desc : "";
desc.license = bx->license ? bx->license : "";
desc.type = "xtr";
ret.append(desc);
}
return ret;
}
QList<RzIOPluginDescription> CutterCore::getRIOPluginDescriptions()
{
CORE_LOCK();
QList<RzIOPluginDescription> ret;
QJsonArray plugins = cmdj("oLj").object()["io_plugins"].toArray();
for (const QJsonValue &pluginValue : plugins) {
QJsonObject pluginObject = pluginValue.toObject();
RzIOPluginDescription plugin;
plugin.name = pluginObject["name"].toString();
plugin.description = pluginObject["description"].toString();
plugin.license = pluginObject["license"].toString();
plugin.permissions = pluginObject["permissions"].toString();
for (const auto &uri : pluginObject["uris"].toArray()) {
plugin.uris << uri.toString();
RzListIter *it;
RzIOPlugin *p;
CutterRzListForeach(core->io->plugins, it, RzIOPlugin, p) {
RzIOPluginDescription desc;
desc.name = p->name ? p->name : "";
desc.description = p->desc ? p->desc : "";
desc.license = p->license ? p->license : "";
desc.permissions =
QString("r") +
(p->write ? "w" : "_") +
(p->isdbg ? "d" : "_");
if (p->uris) {
desc.uris = QString::fromUtf8(p->uris).split(",");
}
ret << plugin;
ret.append(desc);
}
return ret;
}
QList<RzCorePluginDescription> CutterCore::getRCorePluginDescriptions()
{
CORE_LOCK();
QList<RzCorePluginDescription> ret;
QJsonArray plugins = cmdj("Lcj").array();
for (const QJsonValue &pluginValue : plugins) {
QJsonObject pluginObject = pluginValue.toObject();
RzCorePluginDescription plugin;
plugin.name = pluginObject["Name"].toString();
plugin.description = pluginObject["Description"].toString();
ret << plugin;
RzListIter *it;
RzCorePlugin *p;
CutterRzListForeach(core->plugins, it, RzCorePlugin, p) {
RzCorePluginDescription desc;
desc.name = p->name ? p->name : "";
desc.description = p->desc ? p->desc : "";
desc.license = p->license ? p->license : "";
ret.append(desc);
}
return ret;
}

View File

@ -194,6 +194,7 @@ struct RzCorePluginDescription
{
QString name;
QString description;
QString license;
};
struct RzAsmPluginDescription

View File

@ -36,6 +36,7 @@ RizinPluginsDialog::RizinPluginsDialog(QWidget *parent)
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, plugin.name);
item->setText(1, plugin.description);
item->setText(2, plugin.license);
ui->RzCoreTreeWidget->addTopLevelItem(item);
}
ui->RzCoreTreeWidget->sortByColumn(0, Qt::AscendingOrder);

View File

@ -128,6 +128,11 @@
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>License</string>
</property>
</column>
</widget>
</item>
</layout>