2017-03-29 10:18:37 +00:00
|
|
|
#ifndef XREFSDIALOG_H
|
|
|
|
#define XREFSDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QTreeWidgetItem>
|
2017-10-02 09:41:28 +00:00
|
|
|
#include <memory>
|
2018-10-17 07:55:53 +00:00
|
|
|
#include "common/Highlighter.h"
|
2019-02-22 16:50:45 +00:00
|
|
|
#include "core/Cutter.h"
|
2019-09-01 21:30:25 +00:00
|
|
|
#include "common/AddressableItemModel.h"
|
|
|
|
|
|
|
|
class XrefModel: public AddressableItemModel<QAbstractListModel>
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
QList<XrefDescription> xrefs;
|
|
|
|
bool to;
|
|
|
|
public:
|
2020-02-28 08:37:07 +00:00
|
|
|
enum Columns { OFFSET = 0, TYPE, CODE, COUNT };
|
2019-09-01 21:30:25 +00:00
|
|
|
static const int FlagDescriptionRole = Qt::UserRole;
|
|
|
|
|
|
|
|
XrefModel(QObject *parent = nullptr);
|
|
|
|
void readForOffset(RVA offset, bool to, bool whole_function);
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation,
|
|
|
|
int role = Qt::DisplayRole) const override;
|
|
|
|
|
|
|
|
RVA address(const QModelIndex &index) const override;
|
|
|
|
|
|
|
|
static QString xrefTypeString(const QString &type);
|
|
|
|
};
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
class MainWindow;
|
|
|
|
|
2018-03-21 20:32:32 +00:00
|
|
|
namespace Ui {
|
|
|
|
class XrefsDialog;
|
2017-03-29 10:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class XrefsDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2019-09-01 21:30:25 +00:00
|
|
|
explicit XrefsDialog(MainWindow *main, QWidget *parent);
|
2017-03-29 10:18:37 +00:00
|
|
|
~XrefsDialog();
|
|
|
|
|
2017-06-08 22:40:43 +00:00
|
|
|
void fillRefsForAddress(RVA addr, QString name, bool whole_function);
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
private slots:
|
2018-03-21 20:32:32 +00:00
|
|
|
QString normalizeAddr(const QString &addr) const;
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2017-11-20 20:11:56 +00:00
|
|
|
void setupPreviewFont();
|
|
|
|
void setupPreviewColors();
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
void highlightCurrentLine();
|
|
|
|
|
2019-09-01 21:30:25 +00:00
|
|
|
void onFromTreeWidgetItemSelectionChanged();
|
|
|
|
void onToTreeWidgetItemSelectionChanged();
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
private:
|
2017-06-07 19:35:38 +00:00
|
|
|
RVA addr;
|
|
|
|
QString func_name;
|
2019-09-01 21:30:25 +00:00
|
|
|
XrefModel toModel;
|
|
|
|
XrefModel fromModel;
|
2017-06-07 19:35:38 +00:00
|
|
|
|
2017-10-02 09:41:28 +00:00
|
|
|
std::unique_ptr<Ui::XrefsDialog> ui;
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2017-06-07 15:48:36 +00:00
|
|
|
void updateLabels(QString name);
|
2017-06-07 19:35:38 +00:00
|
|
|
void updatePreview(RVA addr);
|
2017-03-29 10:18:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // XREFSDIALOG_H
|