2017-03-29 10:18:37 +00:00
|
|
|
#include "symbolswidget.h"
|
|
|
|
#include "ui_symbolswidget.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
|
|
|
|
|
|
|
SymbolsWidget::SymbolsWidget(MainWindow *main, QWidget *parent) :
|
2017-04-13 15:14:02 +00:00
|
|
|
DockWidget(parent),
|
|
|
|
ui(new Ui::SymbolsWidget),
|
|
|
|
main(main)
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2017-04-13 15:14:02 +00:00
|
|
|
|
|
|
|
ui->symbolsTreeWidget->hideColumn(0);
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SymbolsWidget::~SymbolsWidget()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2017-04-13 15:14:02 +00:00
|
|
|
void SymbolsWidget::setup()
|
2017-04-09 19:55:06 +00:00
|
|
|
{
|
2017-04-13 15:14:02 +00:00
|
|
|
setScrollMode();
|
|
|
|
|
|
|
|
fillSymbols();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SymbolsWidget::refresh()
|
|
|
|
{
|
|
|
|
setup();
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SymbolsWidget::on_symbolsTreeWidget_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
|
2017-04-28 13:09:40 +00:00
|
|
|
SymbolDescription symbol = item->data(0, Qt::UserRole).value<SymbolDescription>();
|
|
|
|
this->main->seek(symbol.vaddr, symbol.name, true);
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
2017-04-13 15:14:02 +00:00
|
|
|
|
|
|
|
void SymbolsWidget::fillSymbols()
|
|
|
|
{
|
|
|
|
ui->symbolsTreeWidget->clear();
|
2017-04-28 13:09:40 +00:00
|
|
|
for (auto symbol : this->main->core->getAllSymbols())
|
2017-04-13 15:14:02 +00:00
|
|
|
{
|
2017-04-28 13:09:40 +00:00
|
|
|
QTreeWidgetItem *item = qhelpers::appendRow(ui->symbolsTreeWidget,
|
|
|
|
RAddressString(symbol.vaddr),
|
|
|
|
QString("%1 %2").arg(symbol.bind, symbol.type).trimmed(),
|
|
|
|
symbol.name);
|
|
|
|
|
|
|
|
item->setData(0, Qt::UserRole, QVariant::fromValue(symbol));
|
2017-04-13 15:14:02 +00:00
|
|
|
}
|
|
|
|
qhelpers::adjustColumns(ui->symbolsTreeWidget);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SymbolsWidget::setScrollMode()
|
|
|
|
{
|
|
|
|
qhelpers::setVerticalScrollMode(ui->symbolsTreeWidget);
|
|
|
|
}
|