2017-09-25 12:55:41 +00:00
|
|
|
#include <QTreeWidget>
|
2017-03-29 10:18:37 +00:00
|
|
|
#include "relocswidget.h"
|
|
|
|
#include "ui_relocswidget.h"
|
2017-10-01 19:09:42 +00:00
|
|
|
#include "MainWindow.h"
|
|
|
|
#include "utils/Helpers.h"
|
2017-04-13 15:14:02 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
RelocsWidget::RelocsWidget(MainWindow *main, QWidget *parent) :
|
2017-04-13 15:14:02 +00:00
|
|
|
DockWidget(parent),
|
|
|
|
ui(new Ui::RelocsWidget),
|
|
|
|
main(main)
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
2017-04-28 13:09:40 +00:00
|
|
|
// Radare core found in:
|
|
|
|
this->main = main;
|
|
|
|
|
2017-04-13 15:14:02 +00:00
|
|
|
ui->relocsTreeWidget->hideColumn(0);
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
2017-10-02 09:41:28 +00:00
|
|
|
RelocsWidget::~RelocsWidget() {}
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2017-04-13 15:14:02 +00:00
|
|
|
void RelocsWidget::setup()
|
|
|
|
{
|
|
|
|
setScrollMode();
|
|
|
|
|
|
|
|
fillTreeWidget();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RelocsWidget::refresh()
|
|
|
|
{
|
|
|
|
setup();
|
|
|
|
}
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
void RelocsWidget::on_relocsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column)
|
|
|
|
{
|
2017-10-01 18:08:12 +00:00
|
|
|
Q_UNUSED(column);
|
2017-04-09 17:09:35 +00:00
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
// Get offset and name of item double clicked
|
2017-04-28 13:09:40 +00:00
|
|
|
RelocDescription reloc = item->data(0, Qt::UserRole).value<RelocDescription>();
|
|
|
|
main->seek(reloc.vaddr, reloc.name, true);
|
2017-04-13 15:14:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RelocsWidget::fillTreeWidget()
|
|
|
|
{
|
|
|
|
ui->relocsTreeWidget->clear();
|
2017-04-28 13:09:40 +00:00
|
|
|
|
|
|
|
for (auto i : main->core->getAllRelocs())
|
2017-04-13 15:14:02 +00:00
|
|
|
{
|
2017-04-28 13:09:40 +00:00
|
|
|
QTreeWidgetItem *item = qhelpers::appendRow(ui->relocsTreeWidget, RAddressString(i.vaddr), i.type, i.name);
|
|
|
|
item->setData(0, Qt::UserRole, QVariant::fromValue(i));
|
2017-04-13 15:14:02 +00:00
|
|
|
}
|
2017-04-28 13:09:40 +00:00
|
|
|
|
2017-04-13 15:14:02 +00:00
|
|
|
qhelpers::adjustColumns(ui->relocsTreeWidget);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RelocsWidget::setScrollMode()
|
|
|
|
{
|
|
|
|
qhelpers::setVerticalScrollMode(ui->relocsTreeWidget);
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|