From 7c9ada78241e08bf36bd04d989f742a6de721575 Mon Sep 17 00:00:00 2001 From: Xusheng Date: Wed, 5 May 2021 17:23:49 +0800 Subject: Add the ability to automatically create struct members --- ui/addressdialog.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'ui/addressdialog.h') diff --git a/ui/addressdialog.h b/ui/addressdialog.h index 557030ba..261f0732 100644 --- a/ui/addressdialog.h +++ b/ui/addressdialog.h @@ -89,4 +89,48 @@ public: const QString& title = "Go to File Offset", const QString& prompt = "Enter Expression", bool defaultToCurrent = false); ~FileOffsetDialogWithPreview() {} uint64_t getOffset() const { return m_fileOffset; } +}; + +class BINARYNINJAUIAPI AddUserXrefDialog: public QDialog +{ + Q_OBJECT + + QComboBox* m_combo; + QStringListModel* m_model; + QLabel* m_previewText, m_sizePrompt; + QLineEdit* m_sizeInput; + BinaryViewRef m_view; + uint64_t m_addr; + uint64_t m_here; + size_t m_size; + bool m_resultValid; + QTimer* m_updateTimer; + QStringList m_historyEntries; + int m_historySize; + GetSymbolsListThread* m_updateThread; + QColor m_defaultColor; + QFont m_defaultFont; + QString m_prompt; + bool m_initialTextSelection; + std::string m_errorString; + bool m_resultAmbiguous; + + void commitHistory(); + void customEvent(QEvent* event); + +private Q_SLOTS: + void updateTimerEvent(); + void accepted(); + void updatePreview(); + void updatePreviewText(); + void updatePreviewWithText(QString data); + +public: + AddUserXrefDialog(QWidget* parent, BinaryViewRef view, uint64_t here = 0, + size_t size = 0, const QString& title = "Add User Type Field Cross Reference", + const QString& sizeTitle = "Size of Reference (optional)", + const QString& prompt = "Enter Expression", bool defaultToCurrent = false); + ~AddUserXrefDialog() { delete m_updateThread; } + uint64_t getOffset() const { return m_addr; } + size_t getSize() const { return m_size; } }; \ No newline at end of file -- cgit v1.3.1