2019-03-16 12:41:45 +00:00
|
|
|
|
|
|
|
#include "PluginsOptionsWidget.h"
|
|
|
|
|
|
|
|
#include "PreferencesDialog.h"
|
|
|
|
|
|
|
|
#include "common/Helpers.h"
|
|
|
|
#include "common/Configuration.h"
|
|
|
|
#include "plugins/PluginManager.h"
|
|
|
|
#include "dialogs/R2PluginsDialog.h"
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QTreeWidget>
|
|
|
|
#include <QVBoxLayout>
|
2020-01-25 19:26:41 +00:00
|
|
|
#include <QUrl>
|
2019-03-16 12:41:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
PluginsOptionsWidget::PluginsOptionsWidget(PreferencesDialog *dialog)
|
|
|
|
: QDialog(dialog)
|
|
|
|
{
|
|
|
|
auto layout = new QVBoxLayout(this);
|
|
|
|
setLayout(layout);
|
|
|
|
|
|
|
|
auto dirLabel = new QLabel(this);
|
2020-01-25 19:26:41 +00:00
|
|
|
dirLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
|
|
dirLabel->setOpenExternalLinks(true);
|
2019-03-16 12:41:45 +00:00
|
|
|
layout->addWidget(dirLabel);
|
2020-01-25 19:26:41 +00:00
|
|
|
auto pluginPath = Plugins()->getUserPluginsDirectory();
|
|
|
|
dirLabel->setText(tr("Plugins are loaded from <a href=\"%1\">%2</a>")
|
|
|
|
.arg(QUrl::fromLocalFile(pluginPath).toString(), pluginPath.toHtmlEscaped()));
|
2019-03-16 12:41:45 +00:00
|
|
|
|
|
|
|
auto treeWidget = new QTreeWidget(this);
|
|
|
|
layout->addWidget(treeWidget);
|
|
|
|
treeWidget->setRootIsDecorated(false);
|
|
|
|
treeWidget->setHeaderLabels({
|
|
|
|
tr("Name"),
|
|
|
|
tr("Description"),
|
|
|
|
tr("Version"),
|
|
|
|
tr("Author")
|
|
|
|
});
|
|
|
|
|
2020-01-31 10:13:28 +00:00
|
|
|
for (auto &plugin : Plugins()->getPlugins()) {
|
2019-03-16 12:41:45 +00:00
|
|
|
auto item = new QTreeWidgetItem();
|
|
|
|
item->setText(0, plugin->getName());
|
|
|
|
item->setText(1, plugin->getDescription());
|
|
|
|
item->setText(2, plugin->getVersion());
|
|
|
|
item->setText(3, plugin->getAuthor());
|
|
|
|
treeWidget->addTopLevelItem(item);
|
|
|
|
}
|
|
|
|
qhelpers::adjustColumns(treeWidget, 0);
|
|
|
|
|
|
|
|
auto r2PluginsButton = new QPushButton(this);
|
|
|
|
layout->addWidget(r2PluginsButton);
|
|
|
|
r2PluginsButton->setText(tr("Show radare2 plugin information"));
|
|
|
|
connect(r2PluginsButton, &QPushButton::clicked, this, [this]() {
|
|
|
|
R2PluginsDialog dialog(this);
|
|
|
|
dialog.exec();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-04-04 19:30:27 +00:00
|
|
|
PluginsOptionsWidget::~PluginsOptionsWidget() {}
|