Improve 'About' plugins window (#378)

* Show detailed information of RAsm plugins in 'About' window
* Improve 'About' plugins window UI with tabs
This commit is contained in:
Abdel-Rahman A 2018-03-11 10:39:31 +02:00 committed by xarkes
parent 3ef8218e49
commit cd38fb9277
4 changed files with 205 additions and 110 deletions

View File

@ -958,13 +958,27 @@ QList<RCorePluginDescription> CutterCore::getRCorePluginDescriptions()
return ret; return ret;
} }
QStringList CutterCore::getRAsmPlugins() QList<RAsmPluginDescription> CutterCore::getRAsmPluginDescriptions()
{ {
QStringList ret; CORE_LOCK();
RListIter *it;
QList<RAsmPluginDescription> ret;
QJsonArray plugins = cmdj("evj asm.arch").array()[0].toObject()["options"].toArray(); RAsmPlugin *ap;
for(QJsonValueRef pluginValue : plugins) CutterRListForeach(core_->assembler->plugins, it, RAsmPlugin, ap)
ret << pluginValue.toString(); {
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; return ret;
} }

View File

@ -200,6 +200,17 @@ struct RCorePluginDescription
QString description; QString description;
}; };
struct RAsmPluginDescription
{
QString name;
QString architecture;
QString author;
QString version;
QString cpus;
QString description;
QString license;
};
struct DisassemblyLine struct DisassemblyLine
{ {
RVA offset; RVA offset;
@ -257,6 +268,7 @@ Q_DECLARE_METATYPE(EntrypointDescription)
Q_DECLARE_METATYPE(RBinPluginDescription) Q_DECLARE_METATYPE(RBinPluginDescription)
Q_DECLARE_METATYPE(RIOPluginDescription) Q_DECLARE_METATYPE(RIOPluginDescription)
Q_DECLARE_METATYPE(RCorePluginDescription) Q_DECLARE_METATYPE(RCorePluginDescription)
Q_DECLARE_METATYPE(RAsmPluginDescription)
Q_DECLARE_METATYPE(ClassMethodDescription) Q_DECLARE_METATYPE(ClassMethodDescription)
Q_DECLARE_METATYPE(ClassFieldDescription) Q_DECLARE_METATYPE(ClassFieldDescription)
Q_DECLARE_METATYPE(ClassDescription) Q_DECLARE_METATYPE(ClassDescription)
@ -390,7 +402,7 @@ public:
QList<RBinPluginDescription> getRBinPluginDescriptions(const QString &type = nullptr); QList<RBinPluginDescription> getRBinPluginDescriptions(const QString &type = nullptr);
QList<RIOPluginDescription> getRIOPluginDescriptions(); QList<RIOPluginDescription> getRIOPluginDescriptions();
QList<RCorePluginDescription> getRCorePluginDescriptions(); QList<RCorePluginDescription> getRCorePluginDescriptions();
QStringList getRAsmPlugins(); QList<RAsmPluginDescription> getRAsmPluginDescriptions();
QList<FunctionDescription> getAllFunctions(); QList<FunctionDescription> getAllFunctions();
QList<ImportDescription> getAllImports(); QList<ImportDescription> getAllImports();

View File

@ -41,12 +41,19 @@ R2PluginsDialog::R2PluginsDialog(QWidget *parent) :
} }
qhelpers::adjustColumns(ui->RCoreTreeWidget, 0); qhelpers::adjustColumns(ui->RCoreTreeWidget, 0);
for(auto plugin : Core()->getRAsmPlugins()) for(auto plugin : Core()->getRAsmPluginDescriptions())
{ {
QTreeWidgetItem* item = new QTreeWidgetItem(); 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); ui->RAsmTreeWidget->addTopLevelItem(item);
} }
qhelpers::adjustColumns(ui->RAsmTreeWidget, 0);
} }
R2PluginsDialog::~R2PluginsDialog() R2PluginsDialog::~R2PluginsDialog()

View File

@ -5,22 +5,172 @@
<property name="windowTitle"> <property name="windowTitle">
<string>radare2 plugin information</string> <string>radare2 plugin information</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item row="1" column="1"> <item>
<widget class="QTreeWidget" name="RCoreTreeWidget"> <widget class="QTabWidget" name="tabWidget">
<column> <widget class="QWidget" name="RBinTab">
<property name="text"> <attribute name="title">
<string>Name</string> <string>RBin</string>
</property> </attribute>
</column> <layout class="QVBoxLayout" name="verticalLayout_2">
<column> <item>
<property name="text"> <widget class="QLabel" name="RBinLabel">
<string>Description</string> <property name="text">
</property> <string>RBin plugins</string>
</column> </property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="RBinTreeWidget">
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>License</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="RIOTab">
<attribute name="title">
<string>RIO</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="RIOLabel">
<property name="text">
<string>RIO plugins</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="RIOTreeWidget">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>License</string>
</property>
</column>
<column>
<property name="text">
<string>Permissions</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="RCoreTab">
<attribute name="title">
<string>RCore</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="RCoreLabel">
<property name="text">
<string>RCore plugins</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="RCoreTreeWidget">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="RAsmTab">
<attribute name="title">
<string>RAsm</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="RAsmLabel">
<property name="text">
<string>RAsm plugins</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="RAsmTreeWidget">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Architecture</string>
</property>
</column>
<column>
<property name="text">
<string>CPU's</string>
</property>
</column>
<column>
<property name="text">
<string>Version</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>License</string>
</property>
</column>
<column>
<property name="text">
<string>Author</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="2"> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -30,94 +180,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="RIOLabel">
<property name="text">
<string>RIO plugins</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="RAsmLabel">
<property name="text">
<string>RAsm plugins</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QTreeWidget" name="RAsmTreeWidget">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QTreeWidget" name="RBinTreeWidget">
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>License</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
</widget>
</item>
<item row="3" column="0">
<widget class="QTreeWidget" name="RIOTreeWidget">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>Description</string>
</property>
</column>
<column>
<property name="text">
<string>License</string>
</property>
</column>
<column>
<property name="text">
<string>Permissions</string>
</property>
</column>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="RCoreLabel">
<property name="text">
<string>RCore plugins</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="RBinLabel">
<property name="text">
<string>RBin plugins</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>