From cd38fb9277ea1e59c383899e41873121a1719e08 Mon Sep 17 00:00:00 2001 From: Abdel-Rahman A Date: Sun, 11 Mar 2018 10:39:31 +0200 Subject: [PATCH] Improve 'About' plugins window (#378) * Show detailed information of RAsm plugins in 'About' window * Improve 'About' plugins window UI with tabs --- src/Cutter.cpp | 24 ++- src/Cutter.h | 14 +- src/dialogs/R2PluginsDialog.cpp | 11 +- src/dialogs/R2PluginsDialog.ui | 266 ++++++++++++++++++++------------ 4 files changed, 205 insertions(+), 110 deletions(-) diff --git a/src/Cutter.cpp b/src/Cutter.cpp index 0af28336..18be525d 100644 --- a/src/Cutter.cpp +++ b/src/Cutter.cpp @@ -958,13 +958,27 @@ QList CutterCore::getRCorePluginDescriptions() return ret; } -QStringList CutterCore::getRAsmPlugins() +QList CutterCore::getRAsmPluginDescriptions() { - QStringList ret; + CORE_LOCK(); + RListIter *it; + QList ret; - QJsonArray plugins = cmdj("evj asm.arch").array()[0].toObject()["options"].toArray(); - for(QJsonValueRef pluginValue : plugins) - ret << pluginValue.toString(); + RAsmPlugin *ap; + CutterRListForeach(core_->assembler->plugins, it, RAsmPlugin, ap) + { + RAsmPluginDescription plugin; + + plugin.name = ap->name; + plugin.architecture = ap->arch; + plugin.author = ap->author; + plugin.version = ap->version; + plugin.cpus = ap->cpus; + plugin.description = ap->desc; + plugin.license = ap->license; + + ret << plugin; + } return ret; } diff --git a/src/Cutter.h b/src/Cutter.h index db988b27..f0686871 100644 --- a/src/Cutter.h +++ b/src/Cutter.h @@ -200,6 +200,17 @@ struct RCorePluginDescription QString description; }; +struct RAsmPluginDescription +{ + QString name; + QString architecture; + QString author; + QString version; + QString cpus; + QString description; + QString license; +}; + struct DisassemblyLine { RVA offset; @@ -257,6 +268,7 @@ Q_DECLARE_METATYPE(EntrypointDescription) Q_DECLARE_METATYPE(RBinPluginDescription) Q_DECLARE_METATYPE(RIOPluginDescription) Q_DECLARE_METATYPE(RCorePluginDescription) +Q_DECLARE_METATYPE(RAsmPluginDescription) Q_DECLARE_METATYPE(ClassMethodDescription) Q_DECLARE_METATYPE(ClassFieldDescription) Q_DECLARE_METATYPE(ClassDescription) @@ -390,7 +402,7 @@ public: QList getRBinPluginDescriptions(const QString &type = nullptr); QList getRIOPluginDescriptions(); QList getRCorePluginDescriptions(); - QStringList getRAsmPlugins(); + QList getRAsmPluginDescriptions(); QList getAllFunctions(); QList getAllImports(); diff --git a/src/dialogs/R2PluginsDialog.cpp b/src/dialogs/R2PluginsDialog.cpp index 985f3b5d..f0feb798 100644 --- a/src/dialogs/R2PluginsDialog.cpp +++ b/src/dialogs/R2PluginsDialog.cpp @@ -41,12 +41,19 @@ R2PluginsDialog::R2PluginsDialog(QWidget *parent) : } qhelpers::adjustColumns(ui->RCoreTreeWidget, 0); - for(auto plugin : Core()->getRAsmPlugins()) + for(auto plugin : Core()->getRAsmPluginDescriptions()) { QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setText(0, plugin); + item->setText(0, plugin.name); + item->setText(1, plugin.architecture); + item->setText(2, plugin.cpus); + item->setText(3, plugin.version); + item->setText(4, plugin.description); + item->setText(5, plugin.license); + item->setText(6, plugin.author); ui->RAsmTreeWidget->addTopLevelItem(item); } + qhelpers::adjustColumns(ui->RAsmTreeWidget, 0); } R2PluginsDialog::~R2PluginsDialog() diff --git a/src/dialogs/R2PluginsDialog.ui b/src/dialogs/R2PluginsDialog.ui index 8fca7041..780127b8 100644 --- a/src/dialogs/R2PluginsDialog.ui +++ b/src/dialogs/R2PluginsDialog.ui @@ -5,22 +5,172 @@ radare2 plugin information - - - - - - Name - - - - - Description - - + + + + + + RBin + + + + + + RBin plugins + + + + + + + true + + + + Name + + + + + Description + + + + + License + + + + + Type + + + + + + + + + RIO + + + + + + RIO plugins + + + + + + + + Name + + + + + Description + + + + + License + + + + + Permissions + + + + + + + + + RCore + + + + + + RCore plugins + + + + + + + + Name + + + + + Description + + + + + + + + + RAsm + + + + + + RAsm plugins + + + + + + + + Name + + + + + Architecture + + + + + CPU's + + + + + Version + + + + + Description + + + + + License + + + + + Author + + + + + + - + Qt::Horizontal @@ -30,94 +180,6 @@ - - - - RIO plugins - - - - - - - RAsm plugins - - - - - - - - Name - - - - - - - - true - - - - Name - - - - - Description - - - - - License - - - - - Type - - - - - - - - - Name - - - - - Description - - - - - License - - - - - Permissions - - - - - - - - RCore plugins - - - - - - - RBin plugins - - -