2017-03-29 10:18:37 +00:00
|
|
|
#include "stringswidget.h"
|
|
|
|
#include "ui_stringswidget.h"
|
|
|
|
|
2017-04-13 15:14:02 +00:00
|
|
|
//#include "dialogs/xrefsdialog.h"
|
2017-03-29 10:18:37 +00:00
|
|
|
#include "mainwindow.h"
|
2017-04-13 15:14:02 +00:00
|
|
|
#include "helpers.h"
|
|
|
|
|
|
|
|
#include <QTreeWidget>
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
StringsWidget::StringsWidget(MainWindow *main, QWidget *parent) :
|
2017-04-13 15:14:02 +00:00
|
|
|
DockWidget(parent),
|
|
|
|
ui(new Ui::StringsWidget),
|
|
|
|
main(main)
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
2017-04-13 15:14:02 +00:00
|
|
|
ui->stringsTreeWidget->hideColumn(0);
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StringsWidget::~StringsWidget()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
2017-04-13 15:14:02 +00:00
|
|
|
void StringsWidget::setup()
|
|
|
|
{
|
|
|
|
setScrollMode();
|
|
|
|
|
|
|
|
fillTreeWidget();
|
|
|
|
}
|
|
|
|
|
|
|
|
void StringsWidget::refresh()
|
|
|
|
{
|
|
|
|
setup();
|
|
|
|
}
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
void StringsWidget::on_stringsTreeWidget_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
|
|
|
|
QString offset = item->text(1);
|
|
|
|
QString name = item->text(2);
|
2017-04-09 19:55:06 +00:00
|
|
|
this->main->seek(offset);
|
2017-03-31 10:23:07 +00:00
|
|
|
// Rise and shine baby!
|
2017-04-13 15:14:02 +00:00
|
|
|
this->main->raiseMemoryDock();
|
|
|
|
}
|
|
|
|
|
|
|
|
void StringsWidget::fillTreeWidget()
|
|
|
|
{
|
|
|
|
ui->stringsTreeWidget->clear();
|
|
|
|
for (auto i : main->core->getList("bin", "strings"))
|
|
|
|
{
|
|
|
|
QStringList pieces = i.split(",");
|
|
|
|
if (pieces.length() == 2)
|
|
|
|
qhelpers::appendRow(ui->stringsTreeWidget, pieces[0], pieces[1]);
|
|
|
|
}
|
|
|
|
qhelpers::adjustColumns(ui->stringsTreeWidget);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StringsWidget::setScrollMode()
|
|
|
|
{
|
|
|
|
qhelpers::setVerticalScrollMode(ui->stringsTreeWidget);
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|