mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 02:48:49 +00:00
Add plugin information in 'About' window (#363)
* Add RBin plugin information in 'About' window * Add RIO plugin information in 'About' window * Add RCore plugin information in 'About' window * Add RAsm plugin information in 'About' window
This commit is contained in:
parent
051b95c69d
commit
4cc5e49a24
@ -910,6 +910,57 @@ QList<RBinPluginDescription> CutterCore::getRBinPluginDescriptions(const QString
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<RIOPluginDescription> CutterCore::getRIOPluginDescriptions()
|
||||
{
|
||||
QList<RIOPluginDescription> ret;
|
||||
|
||||
QJsonArray plugins = cmdj("oLj").object()["IO_Plugins"].toArray();
|
||||
for(QJsonValueRef pluginValue : plugins)
|
||||
{
|
||||
QJsonObject pluginObject = pluginValue.toObject();
|
||||
RIOPluginDescription plugin;
|
||||
|
||||
plugin.name = pluginObject["Name"].toString();
|
||||
plugin.description = pluginObject["Description"].toString();
|
||||
plugin.license = pluginObject["License"].toString();
|
||||
plugin.permissions = pluginObject["Permissions"].toString();
|
||||
|
||||
ret << plugin;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<RCorePluginDescription> CutterCore::getRCorePluginDescriptions()
|
||||
{
|
||||
QList<RCorePluginDescription> ret;
|
||||
|
||||
QJsonArray plugins = cmdj("Lsj").array();
|
||||
for(QJsonValueRef pluginValue : plugins)
|
||||
{
|
||||
QJsonObject pluginObject = pluginValue.toObject();
|
||||
RCorePluginDescription plugin;
|
||||
|
||||
plugin.name = pluginObject["Name"].toString();
|
||||
plugin.description = pluginObject["Description"].toString();
|
||||
|
||||
ret << plugin;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
QStringList CutterCore::getRAsmPlugins()
|
||||
{
|
||||
QStringList ret;
|
||||
|
||||
QJsonArray plugins = cmdj("evj asm.arch").array()[0].toObject()["options"].toArray();
|
||||
for(QJsonValueRef pluginValue : plugins)
|
||||
ret << pluginValue.toString();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<FunctionDescription> CutterCore::getAllFunctions()
|
||||
{
|
||||
CORE_LOCK();
|
||||
|
19
src/Cutter.h
19
src/Cutter.h
@ -186,6 +186,20 @@ struct RBinPluginDescription
|
||||
QString type;
|
||||
};
|
||||
|
||||
struct RIOPluginDescription
|
||||
{
|
||||
QString name;
|
||||
QString description;
|
||||
QString license;
|
||||
QString permissions;
|
||||
};
|
||||
|
||||
struct RCorePluginDescription
|
||||
{
|
||||
QString name;
|
||||
QString description;
|
||||
};
|
||||
|
||||
struct DisassemblyLine
|
||||
{
|
||||
RVA offset;
|
||||
@ -241,6 +255,8 @@ Q_DECLARE_METATYPE(FlagDescription)
|
||||
Q_DECLARE_METATYPE(XrefDescription)
|
||||
Q_DECLARE_METATYPE(EntrypointDescription)
|
||||
Q_DECLARE_METATYPE(RBinPluginDescription)
|
||||
Q_DECLARE_METATYPE(RIOPluginDescription)
|
||||
Q_DECLARE_METATYPE(RCorePluginDescription)
|
||||
Q_DECLARE_METATYPE(ClassMethodDescription)
|
||||
Q_DECLARE_METATYPE(ClassFieldDescription)
|
||||
Q_DECLARE_METATYPE(ClassDescription)
|
||||
@ -371,6 +387,9 @@ public:
|
||||
static bool isProjectNameValid(const QString &name);
|
||||
|
||||
QList<RBinPluginDescription> getRBinPluginDescriptions(const QString &type = nullptr);
|
||||
QList<RIOPluginDescription> getRIOPluginDescriptions();
|
||||
QList<RCorePluginDescription> getRCorePluginDescriptions();
|
||||
QStringList getRAsmPlugins();
|
||||
|
||||
QList<FunctionDescription> getAllFunctions();
|
||||
QList<ImportDescription> getAllImports();
|
||||
|
@ -140,7 +140,8 @@ SOURCES += \
|
||||
utils/JupyterConnection.cpp \
|
||||
widgets/JupyterWidget.cpp \
|
||||
utils/PythonAPI.cpp \
|
||||
utils/NestedIPyKernel.cpp
|
||||
utils/NestedIPyKernel.cpp \
|
||||
dialogs/R2PluginsDialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
Cutter.h \
|
||||
@ -206,7 +207,8 @@ HEADERS += \
|
||||
utils/JupyterConnection.h \
|
||||
widgets/JupyterWidget.h \
|
||||
utils/PythonAPI.h \
|
||||
utils/NestedIPyKernel.h
|
||||
utils/NestedIPyKernel.h \
|
||||
dialogs/R2PluginsDialog.h
|
||||
|
||||
FORMS += \
|
||||
dialogs/AboutDialog.ui \
|
||||
@ -245,7 +247,8 @@ FORMS += \
|
||||
widgets/VTablesWidget.ui \
|
||||
widgets/TypesWidget.ui \
|
||||
widgets/SearchWidget.ui \
|
||||
widgets/JupyterWidget.ui
|
||||
widgets/JupyterWidget.ui \
|
||||
dialogs/R2PluginsDialog.ui
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc \
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <Cutter.h>
|
||||
#include "AboutDialog.h"
|
||||
#include "ui_AboutDialog.h"
|
||||
#include "R2PluginsDialog.h"
|
||||
#include "r_version.h"
|
||||
#include "utils/Configuration.h"
|
||||
|
||||
@ -53,3 +54,9 @@ void AboutDialog::on_showVersionButton_clicked()
|
||||
popup.setText(versionInformation);
|
||||
popup.exec();
|
||||
}
|
||||
|
||||
void AboutDialog::on_showPluginsButton_clicked()
|
||||
{
|
||||
R2PluginsDialog dialog(this);
|
||||
dialog.exec();
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
private slots:
|
||||
void on_buttonBox_rejected();
|
||||
void on_showVersionButton_clicked();
|
||||
void on_showPluginsButton_clicked();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::AboutDialog> ui;
|
||||
|
@ -33,17 +33,37 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="showVersionButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show version information</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<widget class="QPushButton" name="showVersionButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show version information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="showPluginsButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show plugin information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
55
src/dialogs/R2PluginsDialog.cpp
Normal file
55
src/dialogs/R2PluginsDialog.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "R2PluginsDialog.h"
|
||||
#include "ui_R2PluginsDialog.h"
|
||||
|
||||
#include "Cutter.h"
|
||||
#include "utils/Helpers.h"
|
||||
|
||||
R2PluginsDialog::R2PluginsDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::R2PluginsDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
for(auto plugin : Core()->getRBinPluginDescriptions())
|
||||
{
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
item->setText(0, plugin.name);
|
||||
item->setText(1, plugin.description);
|
||||
item->setText(2, plugin.license);
|
||||
item->setText(3, plugin.type);
|
||||
ui->RBinTreeWidget->addTopLevelItem(item);
|
||||
}
|
||||
qhelpers::adjustColumns(ui->RBinTreeWidget, 0);
|
||||
|
||||
for(auto plugin : Core()->getRIOPluginDescriptions())
|
||||
{
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
item->setText(0, plugin.name);
|
||||
item->setText(1, plugin.description);
|
||||
item->setText(2, plugin.license);
|
||||
item->setText(3, plugin.permissions);
|
||||
ui->RIOTreeWidget->addTopLevelItem(item);
|
||||
}
|
||||
qhelpers::adjustColumns(ui->RIOTreeWidget, 0);
|
||||
|
||||
for(auto plugin : Core()->getRCorePluginDescriptions())
|
||||
{
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
item->setText(0, plugin.name);
|
||||
item->setText(1, plugin.description);
|
||||
ui->RCoreTreeWidget->addTopLevelItem(item);
|
||||
}
|
||||
qhelpers::adjustColumns(ui->RCoreTreeWidget, 0);
|
||||
|
||||
for(auto plugin : Core()->getRAsmPlugins())
|
||||
{
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
item->setText(0, plugin);
|
||||
ui->RAsmTreeWidget->addTopLevelItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
R2PluginsDialog::~R2PluginsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
26
src/dialogs/R2PluginsDialog.h
Normal file
26
src/dialogs/R2PluginsDialog.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef PLUGINSDIALOG_H
|
||||
#define PLUGINSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
#include "Cutter.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class R2PluginsDialog;
|
||||
}
|
||||
|
||||
class R2PluginsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit R2PluginsDialog(QWidget *parent = 0);
|
||||
~R2PluginsDialog();
|
||||
|
||||
private:
|
||||
Ui::R2PluginsDialog *ui;
|
||||
};
|
||||
|
||||
#endif // PLUGINSDIALOG_H
|
142
src/dialogs/R2PluginsDialog.ui
Normal file
142
src/dialogs/R2PluginsDialog.ui
Normal file
@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>R2PluginsDialog</class>
|
||||
<widget class="QDialog" name="R2PluginsDialog">
|
||||
<property name="windowTitle">
|
||||
<string>radare2 plugin information</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<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>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>R2PluginsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user