#ifndef VISUALNAVBAR_H #define VISUALNAVBAR_H #include #include #include "cutter.h" class MainWindow; class QGraphicsView; class VisualNavbar : public QToolBar { Q_OBJECT struct xToAddress { double x_start; double x_end; RVA address_from; RVA address_to; }; struct MappedSegmentMetadata { RVA address; RVA size; }; struct MappedSegment { QList sectionDescriptions; QList functions; QList symbols; QList strings; RVA address_from; RVA address_to; }; public: explicit VisualNavbar(MainWindow *main, QWidget *parent = 0); public slots: void paintEvent(QPaintEvent *event) override; private slots: void fetchAndPaintData(); void fetchData(); void fillData(); void drawCursor(); void on_seekChanged(RVA addr); private: QGraphicsView *graphicsView; QGraphicsScene *graphicsScene; QGraphicsRectItem *cursorGraphicsItem; MainWindow *main; RVA totalMappedSize; QList sections; QList xToAddress; QList mappedSegments; // Used to check whether the width changed. If yes we need to re-initialize the scene (slow) int previousWidth; void drawMetadata(QList metadata, RVA offset, double x, double width_per_byte, double h, QColor color); struct MappedSegment* mappedSegmentForAddress(RVA addr); RVA localXToAddress(double x); double addressToLocalX(RVA address); QList sectionsForAddress(RVA address); QString toolTipForAddress(RVA address); static bool sortSectionLessThan(const SectionDescription §ion1, const SectionDescription §ion2); void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; }; #endif // VISUALNAVBAR_H