mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 18:38:51 +00:00
Add ExportsWidget, Double Click in ImportsWidget (#174)
* Add QRCore::getAllExports() * Add ExportsWidget * ImportsWidget double click
This commit is contained in:
parent
117d547570
commit
5d91e3c884
@ -50,6 +50,7 @@ SOURCES += \
|
||||
widgets/stringswidget.cpp \
|
||||
widgets/flagswidget.cpp \
|
||||
widgets/memorywidget.cpp \
|
||||
widgets/exportswidget.cpp \
|
||||
qrdisasm.cpp \
|
||||
widgets/sdbdock.cpp \
|
||||
analthread.cpp \
|
||||
@ -87,6 +88,7 @@ HEADERS += \
|
||||
widgets/stringswidget.h \
|
||||
widgets/flagswidget.h \
|
||||
widgets/memorywidget.h \
|
||||
widgets/exportswidget.h \
|
||||
qrdisasm.h \
|
||||
widgets/sdbdock.h \
|
||||
analthread.h \
|
||||
@ -119,6 +121,7 @@ FORMS += \
|
||||
widgets/stringswidget.ui \
|
||||
widgets/flagswidget.ui \
|
||||
widgets/memorywidget.ui \
|
||||
widgets/exportswidget.ui \
|
||||
widgets/sdbdock.ui \
|
||||
dialogs/commentsdialog.ui \
|
||||
widgets/sidebar.ui \
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "widgets/sectionswidget.h"
|
||||
#include "widgets/commentswidget.h"
|
||||
#include "widgets/importswidget.h"
|
||||
#include "widgets/exportswidget.h"
|
||||
#include "widgets/symbolswidget.h"
|
||||
#include "widgets/stringswidget.h"
|
||||
#include "widgets/sectionsdock.h"
|
||||
@ -94,6 +95,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
graphicsBar(nullptr),
|
||||
functionsDock(nullptr),
|
||||
importsDock(nullptr),
|
||||
exportsDock(nullptr),
|
||||
symbolsDock(nullptr),
|
||||
relocsDock(nullptr),
|
||||
commentsDock(nullptr),
|
||||
@ -201,6 +203,10 @@ void MainWindow::initUI()
|
||||
this->importsDock = new ImportsWidget(this);
|
||||
dockWidgets.push_back(importsDock);
|
||||
|
||||
// Add exports DockWidget
|
||||
this->exportsDock = new ExportsWidget(this);
|
||||
dockWidgets.push_back(exportsDock);
|
||||
|
||||
// Add symbols DockWidget
|
||||
this->symbolsDock = new SymbolsWidget(this);
|
||||
dockWidgets.push_back(symbolsDock);
|
||||
@ -479,7 +485,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QMessageBox::StandardButton ret = QMessageBox::question(this, "Iaito",
|
||||
"Do you really want to exit?\nSave your project before closing!",
|
||||
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||
(QMessageBox::StandardButtons)(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel));
|
||||
//qDebug() << ret;
|
||||
if (ret == QMessageBox::Save)
|
||||
{
|
||||
@ -665,119 +671,52 @@ void MainWindow::on_actionMem_triggered()
|
||||
|
||||
void MainWindow::on_actionFunctions_triggered()
|
||||
{
|
||||
if (this->functionsDock->isVisible())
|
||||
{
|
||||
this->functionsDock->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->functionsDock->show();
|
||||
this->functionsDock->raise();
|
||||
}
|
||||
toggleDockWidget(functionsDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionImports_triggered()
|
||||
{
|
||||
if (this->importsDock->isVisible())
|
||||
{
|
||||
this->importsDock->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->importsDock->show();
|
||||
this->importsDock->raise();
|
||||
}
|
||||
toggleDockWidget(importsDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionExports_triggered()
|
||||
{
|
||||
toggleDockWidget(exportsDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSymbols_triggered()
|
||||
{
|
||||
if (this->symbolsDock->isVisible())
|
||||
{
|
||||
this->symbolsDock->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->symbolsDock->show();
|
||||
this->symbolsDock->raise();
|
||||
}
|
||||
toggleDockWidget(symbolsDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionReloc_triggered()
|
||||
{
|
||||
if (this->relocsDock->isVisible())
|
||||
{
|
||||
this->relocsDock->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->relocsDock->show();
|
||||
this->relocsDock->raise();
|
||||
}
|
||||
toggleDockWidget(relocsDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionStrings_triggered()
|
||||
{
|
||||
if (this->stringsDock->isVisible())
|
||||
{
|
||||
this->stringsDock->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->stringsDock->show();
|
||||
this->stringsDock->raise();
|
||||
}
|
||||
toggleDockWidget(stringsDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSections_triggered()
|
||||
{
|
||||
if (this->sectionsDock->isVisible())
|
||||
{
|
||||
this->sectionsDock->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->sectionsDock->show();
|
||||
this->sectionsDock->raise();
|
||||
}
|
||||
toggleDockWidget(sectionsDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionFlags_triggered()
|
||||
{
|
||||
if (this->flagsDock->isVisible())
|
||||
{
|
||||
this->flagsDock->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->flagsDock->show();
|
||||
this->flagsDock->raise();
|
||||
}
|
||||
toggleDockWidget(flagsDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionComents_triggered()
|
||||
{
|
||||
if (this->commentsDock->isVisible())
|
||||
{
|
||||
this->commentsDock->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->commentsDock->show();
|
||||
this->commentsDock->raise();
|
||||
}
|
||||
toggleDockWidget(commentsDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionNotepad_triggered()
|
||||
{
|
||||
if (this->notepadDock->isVisible())
|
||||
{
|
||||
this->notepadDock->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->notepadDock->show();
|
||||
this->notepadDock->raise();
|
||||
}
|
||||
toggleDockWidget(notepadDock);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAbout_triggered()
|
||||
@ -791,6 +730,18 @@ void MainWindow::on_actionRefresh_Panels_triggered()
|
||||
this->updateFrames();
|
||||
}
|
||||
|
||||
void MainWindow::toggleDockWidget(DockWidget *dock_widget)
|
||||
{
|
||||
if (dock_widget->isVisible())
|
||||
{
|
||||
dock_widget->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
dock_widget->show();
|
||||
dock_widget->raise();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::seek(const QString &offset, const QString &name, bool raise_memory_dock)
|
||||
{
|
||||
@ -900,6 +851,7 @@ void MainWindow::restoreDocks()
|
||||
this->tabifyDockWidget(this->dashboardDock, this->stringsDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->relocsDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->importsDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->exportsDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->symbolsDock);
|
||||
this->tabifyDockWidget(this->dashboardDock, this->notepadDock);
|
||||
this->dashboardDock->raise();
|
||||
@ -1087,9 +1039,10 @@ void MainWindow::on_actionTabs_on_Top_triggered()
|
||||
|
||||
void MainWindow::on_actionReset_settings_triggered()
|
||||
{
|
||||
QMessageBox::StandardButton ret = QMessageBox::question(this, "Iaito",
|
||||
"Do you really want to clear all settings?",
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
QMessageBox::StandardButton ret =
|
||||
(QMessageBox::StandardButton)QMessageBox::question(this, "Iaito",
|
||||
"Do you really want to clear all settings?",
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
if (ret == QMessageBox::Ok)
|
||||
{
|
||||
// Save options in settings
|
||||
|
@ -18,6 +18,7 @@ class AsciiHighlighter;
|
||||
class GraphicsBar;
|
||||
class FunctionsWidget;
|
||||
class ImportsWidget;
|
||||
class ExportsWidget;
|
||||
class SymbolsWidget;
|
||||
class RelocsWidget;
|
||||
class CommentsWidget;
|
||||
@ -89,21 +90,14 @@ public slots:
|
||||
void def_theme();
|
||||
|
||||
void on_actionFunctions_triggered();
|
||||
|
||||
void on_actionImports_triggered();
|
||||
|
||||
void on_actionExports_triggered();
|
||||
void on_actionSymbols_triggered();
|
||||
|
||||
void on_actionReloc_triggered();
|
||||
|
||||
void on_actionStrings_triggered();
|
||||
|
||||
void on_actionSections_triggered();
|
||||
|
||||
void on_actionFlags_triggered();
|
||||
|
||||
void on_actionComents_triggered();
|
||||
|
||||
void on_actionNotepad_triggered();
|
||||
|
||||
void on_actionLock_triggered();
|
||||
@ -195,6 +189,7 @@ private:
|
||||
GraphicsBar *graphicsBar;
|
||||
FunctionsWidget *functionsDock;
|
||||
ImportsWidget *importsDock;
|
||||
ExportsWidget *exportsDock;
|
||||
SymbolsWidget *symbolsDock;
|
||||
RelocsWidget *relocsDock;
|
||||
CommentsWidget *commentsDock;
|
||||
@ -213,6 +208,8 @@ private:
|
||||
void openProject(const QString &project_name);
|
||||
void openNewFile(const QString &fn, int anal_level);
|
||||
|
||||
void toggleDockWidget(DockWidget *dock_widget);
|
||||
|
||||
public:
|
||||
RVA getCursorAddress() const { return cursor_address; }
|
||||
void setCursorAddress(RVA addr);
|
||||
|
@ -159,7 +159,7 @@ border-top: 0px;
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>725</width>
|
||||
<height>22</height>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="defaultUp">
|
||||
@ -171,10 +171,10 @@ border-top: 0px;
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>351</x>
|
||||
<y>100</y>
|
||||
<width>125</width>
|
||||
<height>177</height>
|
||||
<x>2601</x>
|
||||
<y>136</y>
|
||||
<width>170</width>
|
||||
<height>214</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
@ -249,6 +249,7 @@ border-top: 0px;
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFunctions"/>
|
||||
<addaction name="actionImports"/>
|
||||
<addaction name="actionExports"/>
|
||||
<addaction name="actionSymbols"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionReloc"/>
|
||||
@ -901,6 +902,14 @@ background: rgb(64, 64, 64);</string>
|
||||
<string>Ctrl+Q</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExports">
|
||||
<property name="text">
|
||||
<string>Exports</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show/HIde Exports panel</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
@ -913,6 +913,34 @@ QList<ImportDescription> QRCore::getAllImports()
|
||||
}
|
||||
|
||||
|
||||
|
||||
QList<ExportDescription> QRCore::getAllExports()
|
||||
{
|
||||
CORE_LOCK();
|
||||
QList<ExportDescription> ret;
|
||||
|
||||
QJsonArray importsArray = cmdj("iEj").array();
|
||||
|
||||
foreach (QJsonValue value, importsArray)
|
||||
{
|
||||
QJsonObject importObject = value.toObject();
|
||||
|
||||
ExportDescription exp;
|
||||
|
||||
exp.vaddr = importObject["vaddr"].toVariant().toULongLong();
|
||||
exp.paddr = importObject["paddr"].toVariant().toULongLong();
|
||||
exp.size = importObject["size"].toVariant().toULongLong();
|
||||
exp.type = importObject["type"].toString();
|
||||
exp.name = importObject["name"].toString();
|
||||
exp.flag_name = importObject["flagname"].toString();
|
||||
|
||||
ret << exp;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
QList<SymbolDescription> QRCore::getAllSymbols()
|
||||
{
|
||||
CORE_LOCK();
|
||||
|
12
src/qrcore.h
12
src/qrcore.h
@ -74,6 +74,16 @@ struct ImportDescription
|
||||
QString name;
|
||||
};
|
||||
|
||||
struct ExportDescription
|
||||
{
|
||||
RVA vaddr;
|
||||
RVA paddr;
|
||||
RVA size;
|
||||
QString type;
|
||||
QString name;
|
||||
QString flag_name;
|
||||
};
|
||||
|
||||
struct SymbolDescription
|
||||
{
|
||||
RVA vaddr;
|
||||
@ -126,6 +136,7 @@ struct SectionDescription
|
||||
|
||||
Q_DECLARE_METATYPE(FunctionDescription)
|
||||
Q_DECLARE_METATYPE(ImportDescription)
|
||||
Q_DECLARE_METATYPE(ExportDescription)
|
||||
Q_DECLARE_METATYPE(SymbolDescription)
|
||||
Q_DECLARE_METATYPE(CommentDescription)
|
||||
Q_DECLARE_METATYPE(RelocDescription)
|
||||
@ -207,6 +218,7 @@ public:
|
||||
|
||||
QList<FunctionDescription> getAllFunctions();
|
||||
QList<ImportDescription> getAllImports();
|
||||
QList<ExportDescription> getAllExports();
|
||||
QList<SymbolDescription> getAllSymbols();
|
||||
QList<CommentDescription> getAllComments(const QString &filterType);
|
||||
QList<RelocDescription> getAllRelocs();
|
||||
|
189
src/widgets/exportswidget.cpp
Normal file
189
src/widgets/exportswidget.cpp
Normal file
@ -0,0 +1,189 @@
|
||||
#include "exportswidget.h"
|
||||
#include "ui_exportswidget.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "helpers.h"
|
||||
|
||||
|
||||
|
||||
ExportsModel::ExportsModel(QList<ExportDescription> *exports, QObject *parent)
|
||||
: QAbstractListModel(parent),
|
||||
exports(exports)
|
||||
{
|
||||
}
|
||||
|
||||
int ExportsModel::rowCount(const QModelIndex &) const
|
||||
{
|
||||
return exports->count();
|
||||
}
|
||||
|
||||
int ExportsModel::columnCount(const QModelIndex &) const
|
||||
{
|
||||
return Columns::COUNT;
|
||||
}
|
||||
|
||||
QVariant ExportsModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if(index.row() >= exports->count())
|
||||
return QVariant();
|
||||
|
||||
const ExportDescription &exp = exports->at(index.row());
|
||||
|
||||
switch(role)
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
switch(index.column())
|
||||
{
|
||||
case OFFSET:
|
||||
return RAddressString(exp.vaddr);
|
||||
case SIZE:
|
||||
return RSizeString(exp.size);
|
||||
case TYPE:
|
||||
return exp.type;
|
||||
case NAME:
|
||||
return exp.name;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
case ExportDescriptionRole:
|
||||
return QVariant::fromValue(exp);
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
QVariant ExportsModel::headerData(int section, Qt::Orientation, int role) const
|
||||
{
|
||||
switch(role)
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
switch(section)
|
||||
{
|
||||
case OFFSET:
|
||||
return tr("Address");
|
||||
case SIZE:
|
||||
return tr("Size");
|
||||
case TYPE:
|
||||
return tr("Type");
|
||||
case NAME:
|
||||
return tr("Name");
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
void ExportsModel::beginReloadExports()
|
||||
{
|
||||
beginResetModel();
|
||||
}
|
||||
|
||||
void ExportsModel::endReloadExports()
|
||||
{
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ExportsSortFilterProxyModel::ExportsSortFilterProxyModel(ExportsModel *source_model, QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
setSourceModel(source_model);
|
||||
}
|
||||
|
||||
bool ExportsSortFilterProxyModel::filterAcceptsRow(int row, const QModelIndex &parent) const
|
||||
{
|
||||
QModelIndex index = sourceModel()->index(row, 0, parent);
|
||||
ExportDescription exp = index.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
||||
return exp.name.contains(filterRegExp());
|
||||
}
|
||||
|
||||
bool ExportsSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
|
||||
{
|
||||
ExportDescription left_exp = left.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
||||
ExportDescription right_exp = right.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
||||
|
||||
switch(left.column())
|
||||
{
|
||||
case ExportsModel::SIZE:
|
||||
if(left_exp.size != right_exp.size)
|
||||
return left_exp.size < right_exp.size;
|
||||
// fallthrough
|
||||
case ExportsModel::OFFSET:
|
||||
if(left_exp.vaddr != right_exp.vaddr)
|
||||
return left_exp.vaddr < right_exp.vaddr;
|
||||
// fallthrough
|
||||
case ExportsModel::NAME:
|
||||
return left_exp.name < right_exp.name;
|
||||
case ExportsModel::TYPE:
|
||||
if(left_exp.type != right_exp.type)
|
||||
return left_exp.type < right_exp.type;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// fallback
|
||||
return left_exp.vaddr < right_exp.vaddr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ExportsWidget::ExportsWidget(MainWindow *main, QWidget *parent) :
|
||||
DockWidget(parent),
|
||||
ui(new Ui::ExportsWidget),
|
||||
main(main)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Radare core found in:
|
||||
this->main = main;
|
||||
|
||||
exports_model = new ExportsModel(&exports, this);
|
||||
exports_proxy_model = new ExportsSortFilterProxyModel(exports_model, this);
|
||||
ui->exportsTreeView->setModel(exports_proxy_model);
|
||||
ui->exportsTreeView->sortByColumn(ExportsModel::OFFSET, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
ExportsWidget::~ExportsWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ExportsWidget::setup()
|
||||
{
|
||||
setScrollMode();
|
||||
|
||||
refreshExports();
|
||||
}
|
||||
|
||||
void ExportsWidget::refresh()
|
||||
{
|
||||
setup();
|
||||
}
|
||||
|
||||
void ExportsWidget::refreshExports()
|
||||
{
|
||||
exports_model->beginReloadExports();
|
||||
exports = main->core->getAllExports();
|
||||
exports_model->endReloadExports();
|
||||
|
||||
ui->exportsTreeView->resizeColumnToContents(0);
|
||||
ui->exportsTreeView->resizeColumnToContents(1);
|
||||
ui->exportsTreeView->resizeColumnToContents(2);
|
||||
}
|
||||
|
||||
|
||||
void ExportsWidget::setScrollMode()
|
||||
{
|
||||
qhelpers::setVerticalScrollMode(ui->exportsTreeView);
|
||||
}
|
||||
|
||||
void ExportsWidget::on_exportsTreeView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
ExportDescription exp = index.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
||||
this->main->seek(exp.vaddr, exp.flag_name, true);
|
||||
}
|
89
src/widgets/exportswidget.h
Normal file
89
src/widgets/exportswidget.h
Normal file
@ -0,0 +1,89 @@
|
||||
#ifndef EXPORTSWIDGET_H
|
||||
#define EXPORTSWIDGET_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "qrcore.h"
|
||||
#include "dockwidget.h"
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidget;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ExportsWidget;
|
||||
}
|
||||
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
|
||||
class ExportsModel: public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QList<ExportDescription> *exports;
|
||||
|
||||
public:
|
||||
enum Columns { OFFSET = 0, SIZE, TYPE, NAME, COUNT };
|
||||
static const int ExportDescriptionRole = Qt::UserRole;
|
||||
|
||||
ExportsModel(QList<ExportDescription> *exports, QObject *parent = 0);
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
|
||||
void beginReloadExports();
|
||||
void endReloadExports();
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ExportsSortFilterProxyModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExportsSortFilterProxyModel(ExportsModel *source_model, QObject *parent = 0);
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int row, const QModelIndex &parent) const override;
|
||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ExportsWidget : public DockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExportsWidget(MainWindow *main, QWidget *parent = 0);
|
||||
~ExportsWidget();
|
||||
|
||||
void setup() override;
|
||||
void refresh() override;
|
||||
|
||||
private slots:
|
||||
void on_exportsTreeView_doubleClicked(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
Ui::ExportsWidget *ui;
|
||||
MainWindow *main;
|
||||
|
||||
ExportsModel *exports_model;
|
||||
ExportsSortFilterProxyModel *exports_proxy_model;
|
||||
QList<ExportDescription> exports;
|
||||
|
||||
void refreshExports();
|
||||
void setScrollMode();
|
||||
};
|
||||
|
||||
|
||||
#endif // EXPORTSWIDGET_H
|
72
src/widgets/exportswidget.ui
Normal file
72
src/widgets/exportswidget.ui
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExportsWidget</class>
|
||||
<widget class="QDockWidget" name="ExportsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Exports</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeView" name="exportsTreeView">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QTreeView::item
|
||||
{
|
||||
padding-left:10px;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
border-left: 10px;
|
||||
}
|
||||
|
||||
QTreeView::item:hover
|
||||
{
|
||||
background: rgb(242, 246, 248);
|
||||
color: black;
|
||||
}
|
||||
|
||||
QTreeView::item:selected
|
||||
{
|
||||
background: gray;
|
||||
color: white;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="indentation">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -208,6 +208,8 @@ void FlagsWidget::refreshFlags()
|
||||
ui->flagsTreeView->resizeColumnToContents(0);
|
||||
ui->flagsTreeView->resizeColumnToContents(1);
|
||||
|
||||
|
||||
// TODO: this is not a very good place for the following:
|
||||
QStringList flagNames;
|
||||
for (auto i : flags)
|
||||
flagNames.append(i.name);
|
||||
|
@ -92,15 +92,10 @@ private slots:
|
||||
void showFunctionsContextMenu(const QPoint &pt);
|
||||
|
||||
void on_actionDisasAdd_comment_triggered();
|
||||
|
||||
void on_actionFunctionsRename_triggered();
|
||||
|
||||
void on_action_References_triggered();
|
||||
|
||||
void showTitleContextMenu(const QPoint &pt);
|
||||
|
||||
void on_actionHorizontal_triggered();
|
||||
|
||||
void on_actionVertical_triggered();
|
||||
|
||||
void show_filter();
|
||||
@ -109,6 +104,8 @@ private slots:
|
||||
|
||||
void on_closeFilterButton_clicked();
|
||||
|
||||
void showTitleContextMenu(const QPoint &pt);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
|
@ -69,7 +69,10 @@ void ImportsWidget::fillImports()
|
||||
{
|
||||
ui->importsTreeWidget->clear();
|
||||
for (auto i : this->main->core->getAllImports())
|
||||
qhelpers::appendRow(ui->importsTreeWidget, RAddressString(i.plt), i.type, "", i.name);
|
||||
{
|
||||
QTreeWidgetItem *item = qhelpers::appendRow(ui->importsTreeWidget, RAddressString(i.plt), i.type, "", i.name);
|
||||
item->setData(0, Qt::UserRole, QVariant::fromValue(i));
|
||||
}
|
||||
|
||||
highlightUnsafe();
|
||||
qhelpers::adjustColumns(ui->importsTreeWidget, 0, 10);
|
||||
@ -106,3 +109,9 @@ void ImportsWidget::setScrollMode()
|
||||
{
|
||||
qhelpers::setVerticalScrollMode(ui->importsTreeWidget);
|
||||
}
|
||||
|
||||
void ImportsWidget::on_importsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int /* column */)
|
||||
{
|
||||
ImportDescription imp = item->data(0, Qt::UserRole).value<ImportDescription>();
|
||||
this->main->seek(imp.plt, imp.name, true);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "dockwidget.h"
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
class MainWindow;
|
||||
class QTreeWidget;
|
||||
@ -24,6 +25,9 @@ public:
|
||||
|
||||
void refresh() override;
|
||||
|
||||
private slots:
|
||||
void on_importsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column);
|
||||
|
||||
private:
|
||||
Ui::ImportsWidget *ui;
|
||||
MainWindow *main;
|
||||
|
Loading…
Reference in New Issue
Block a user