2017-12-08 15:00:52 +00:00
|
|
|
#ifndef VISUALNAVBAR_H
|
|
|
|
#define VISUALNAVBAR_H
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
#include <QToolBar>
|
2017-12-08 09:55:47 +00:00
|
|
|
#include <QGraphicsScene>
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2017-12-07 23:41:15 +00:00
|
|
|
#include "cutter.h"
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
class MainWindow;
|
2017-04-13 15:14:02 +00:00
|
|
|
class QGraphicsView;
|
2017-03-29 10:18:37 +00:00
|
|
|
|
2017-12-08 15:00:52 +00:00
|
|
|
class VisualNavbar : public QToolBar
|
2017-03-29 10:18:37 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2017-12-07 23:41:15 +00:00
|
|
|
struct xToAddress {
|
|
|
|
double x_start;
|
|
|
|
double x_end;
|
|
|
|
RVA address_from;
|
|
|
|
RVA address_to;
|
|
|
|
};
|
|
|
|
|
2017-12-09 23:22:16 +00:00
|
|
|
struct MappedSegmentMetadata {
|
|
|
|
RVA address;
|
|
|
|
RVA size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MappedSegment {
|
|
|
|
QList<SectionDescription> sectionDescriptions;
|
|
|
|
QList<MappedSegmentMetadata> functions;
|
|
|
|
QList<MappedSegmentMetadata> symbols;
|
|
|
|
QList<MappedSegmentMetadata> strings;
|
|
|
|
RVA address_from;
|
|
|
|
RVA address_to;
|
|
|
|
};
|
|
|
|
|
2017-03-29 10:18:37 +00:00
|
|
|
public:
|
2017-12-08 15:00:52 +00:00
|
|
|
explicit VisualNavbar(MainWindow *main, QWidget *parent = 0);
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
public slots:
|
2017-12-07 23:41:15 +00:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
2017-11-19 12:56:10 +00:00
|
|
|
|
|
|
|
private slots:
|
2017-12-07 23:41:15 +00:00
|
|
|
void fetchAndPaintData();
|
|
|
|
void fetchData();
|
2017-12-11 13:07:12 +00:00
|
|
|
void updateMetadataAndPaint();
|
|
|
|
void updateMetadata();
|
2017-03-29 10:18:37 +00:00
|
|
|
void fillData();
|
2017-12-08 12:21:24 +00:00
|
|
|
void drawCursor();
|
2017-12-07 23:41:15 +00:00
|
|
|
void on_seekChanged(RVA addr);
|
2017-03-29 10:18:37 +00:00
|
|
|
|
|
|
|
private:
|
2017-12-08 15:00:52 +00:00
|
|
|
QGraphicsView *graphicsView;
|
2017-12-08 12:21:24 +00:00
|
|
|
QGraphicsScene *graphicsScene;
|
|
|
|
QGraphicsRectItem *cursorGraphicsItem;
|
|
|
|
MainWindow *main;
|
2017-12-09 23:22:16 +00:00
|
|
|
RVA totalMappedSize;
|
2017-12-07 23:41:15 +00:00
|
|
|
QList<SectionDescription> sections;
|
|
|
|
QList<struct xToAddress> xToAddress;
|
|
|
|
|
2017-12-09 23:22:16 +00:00
|
|
|
QList<MappedSegment> mappedSegments;
|
|
|
|
|
2017-12-08 09:55:47 +00:00
|
|
|
// Used to check whether the width changed. If yes we need to re-initialize the scene (slow)
|
|
|
|
int previousWidth;
|
2017-12-09 23:22:16 +00:00
|
|
|
void drawMetadata(QList<MappedSegmentMetadata> metadata,
|
|
|
|
RVA offset,
|
|
|
|
double x,
|
|
|
|
double width_per_byte,
|
|
|
|
double h, QColor color);
|
2017-12-08 12:21:24 +00:00
|
|
|
|
2017-12-09 23:22:16 +00:00
|
|
|
struct MappedSegment* mappedSegmentForAddress(RVA addr);
|
2017-12-08 12:21:24 +00:00
|
|
|
RVA localXToAddress(double x);
|
|
|
|
double addressToLocalX(RVA address);
|
2017-12-09 23:22:16 +00:00
|
|
|
QList<QString> sectionsForAddress(RVA address);
|
|
|
|
QString toolTipForAddress(RVA address);
|
|
|
|
|
|
|
|
static bool sortSectionLessThan(const SectionDescription §ion1, const SectionDescription §ion2);
|
|
|
|
|
2017-12-08 12:21:24 +00:00
|
|
|
|
2017-12-07 23:41:15 +00:00
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
2017-12-09 23:22:16 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
2017-03-29 10:18:37 +00:00
|
|
|
};
|
|
|
|
|
2017-12-08 15:00:52 +00:00
|
|
|
#endif // VISUALNAVBAR_H
|