2017-03-29 10:18:37 +00:00
|
|
|
#include "relocswidget.h"
|
|
|
|
#include "ui_relocswidget.h"
|
|
|
|
|
|
|
|
#include "mainwindow.h"
|
2017-04-13 15:14:02 +00:00
|
|
|
#include "helpers.h"
|
|
|
|
|
|
|
|
#include <QTreeWidget>
|
|
|
|
|
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-13 15:14:02 +00:00
|
|
|
ui->relocsTreeWidget->hideColumn(0);
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RelocsWidget::~RelocsWidget()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
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-04-09 17:09:35 +00:00
|
|
|
QNOTUSED(column);
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
// Get offset and name of item double clicked
|
|
|
|
// TODO: use this info to change disasm contents
|
2017-04-01 12:43:57 +00:00
|
|
|
QString offset = item->text(1);
|
|
|
|
QString name = item->text(2);
|
2017-03-29 10:18:37 +00:00
|
|
|
main->seek(offset, name);
|
2017-04-13 15:14:02 +00:00
|
|
|
|
|
|
|
main->raiseMemoryDock();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RelocsWidget::fillTreeWidget()
|
|
|
|
{
|
|
|
|
ui->relocsTreeWidget->clear();
|
|
|
|
for (auto i : main->core->getList("bin", "relocs"))
|
|
|
|
{
|
|
|
|
QStringList pieces = i.split(",");
|
|
|
|
if (pieces.length() == 3)
|
|
|
|
qhelpers::appendRow(ui->relocsTreeWidget, pieces[0], pieces[1], pieces[2]);
|
|
|
|
}
|
|
|
|
qhelpers::adjustColumns(ui->relocsTreeWidget);
|
|
|
|
}
|
|
|
|
|
|
|
|
void RelocsWidget::setScrollMode()
|
|
|
|
{
|
|
|
|
qhelpers::setVerticalScrollMode(ui->relocsTreeWidget);
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|