From 4bc108e48a80aed3c59ca9c03867b7a312392e97 Mon Sep 17 00:00:00 2001 From: Brian Knudson Date: Thu, 18 Mar 2021 11:23:59 -0400 Subject: Add Go to File Offset action --- ui/addressdialog.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'ui/addressdialog.h') diff --git a/ui/addressdialog.h b/ui/addressdialog.h index e3d02338..eee9d836 100644 --- a/ui/addressdialog.h +++ b/ui/addressdialog.h @@ -75,3 +75,36 @@ public: ~AddressDialogWithPreview() { delete m_updateThread; } uint64_t getOffset() const { return m_addr; } }; + +class BINARYNINJAUIAPI FileOffsetDialogWithPreview: public QDialog +{ + Q_OBJECT + + QComboBox* m_combo; + QLabel* m_previewText; + BinaryViewRef m_view; + uint64_t m_fileOffset; + uint64_t m_here; + bool m_resultValid; + QTimer* m_updateTimer; + QStringList m_historyEntries; + int m_historySize; + QColor m_defaultColor; + QFont m_defaultFont; + QString m_prompt; + bool m_initialTextSelection; + + void commitHistory(); + +private Q_SLOTS: + void updateTimerEvent(); + void accepted(); + void updatePreview(); + void updatePreview(QString data); + +public: + FileOffsetDialogWithPreview(QWidget* parent, BinaryViewRef view, uint64_t here, + const QString& title = "Go to File Offset", const QString& prompt = "Enter Expression", bool defaultToCurrent = false); + ~FileOffsetDialogWithPreview() {} + uint64_t getOffset() const { return m_fileOffset; } +}; \ No newline at end of file -- cgit v1.3.1