#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 = nullptr); public slots: void paintEvent(QPaintEvent *event) override; private slots: void fetchAndPaintData(); void fetchData(); void updateMetadataAndPaint(); void updateMetadata(); 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 = -1; 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