cutter/src/dialogs/XrefsDialog.h

76 lines
1.8 KiB
C
Raw Normal View History

#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"
#include "core/Cutter.h"
#include "common/AddressableItemModel.h"
class XrefModel: public AddressableItemModel<QAbstractListModel>
{
private:
QList<XrefDescription> xrefs;
bool to;
public:
enum Columns { OFFSET = 0, CODE, TYPE, COUNT };
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);
};
class MainWindow;
2018-03-21 20:32:32 +00:00
namespace Ui {
class XrefsDialog;
}
class XrefsDialog : public QDialog
{
Q_OBJECT
public:
explicit XrefsDialog(MainWindow *main, QWidget *parent);
~XrefsDialog();
void fillRefsForAddress(RVA addr, QString name, bool whole_function);
private slots:
2018-03-21 20:32:32 +00:00
QString normalizeAddr(const QString &addr) const;
void setupPreviewFont();
void setupPreviewColors();
void highlightCurrentLine();
void onFromTreeWidgetItemSelectionChanged();
void onToTreeWidgetItemSelectionChanged();
private:
RVA addr;
QString func_name;
XrefModel toModel;
XrefModel fromModel;
2017-10-02 09:41:28 +00:00
std::unique_ptr<Ui::XrefsDialog> ui;
2017-06-07 15:48:36 +00:00
void updateLabels(QString name);
void updatePreview(RVA addr);
};
#endif // XREFSDIALOG_H