diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index 454ca6b1..bc54e6b5 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -2720,72 +2720,66 @@ QStringList CutterCore::getAnalysisPluginNames() QList CutterCore::getRBinPluginDescriptions(const QString &type) { + CORE_LOCK(); QList 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(); - - RzBinPluginDescription desc; - - desc.name = pluginObject[RJsonKey::name].toString(); - desc.description = pluginObject[RJsonKey::description].toString(); - desc.license = pluginObject[RJsonKey::license].toString(); - desc.type = key; - - ret.append(desc); - } + RzListIter *it; + RzBinPlugin *bp; + CutterRzListForeach(core->bin->plugins, it, RzBinPlugin, bp) { + RzBinPluginDescription desc; + 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 CutterCore::getRIOPluginDescriptions() { + CORE_LOCK(); QList 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 CutterCore::getRCorePluginDescriptions() { + CORE_LOCK(); QList 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; } diff --git a/src/core/CutterDescriptions.h b/src/core/CutterDescriptions.h index aa786185..2fbaeac8 100644 --- a/src/core/CutterDescriptions.h +++ b/src/core/CutterDescriptions.h @@ -194,6 +194,7 @@ struct RzCorePluginDescription { QString name; QString description; + QString license; }; struct RzAsmPluginDescription diff --git a/src/dialogs/RizinPluginsDialog.cpp b/src/dialogs/RizinPluginsDialog.cpp index 8ff12331..cef30200 100644 --- a/src/dialogs/RizinPluginsDialog.cpp +++ b/src/dialogs/RizinPluginsDialog.cpp @@ -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); diff --git a/src/dialogs/RizinPluginsDialog.ui b/src/dialogs/RizinPluginsDialog.ui index 2492910c..2599b5d5 100644 --- a/src/dialogs/RizinPluginsDialog.ui +++ b/src/dialogs/RizinPluginsDialog.ui @@ -128,6 +128,11 @@ Description + + + License + +