summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui/addressdialog.h2
-rw-r--r--ui/typedialog.h61
2 files changed, 62 insertions, 1 deletions
diff --git a/ui/addressdialog.h b/ui/addressdialog.h
index 5f23a452..ae30639b 100644
--- a/ui/addressdialog.h
+++ b/ui/addressdialog.h
@@ -47,7 +47,7 @@ class BINARYNINJAUIAPI AddressDialogWithPreview: public QDialog
QStringList m_historyEntries;
int m_historySize;
GetSymbolsListThread* m_updateThread;
- QColor m_defaultColor;
+ QColor m_defaultColor;
QFont m_defaultFont;
QString m_prompt;
bool m_initialTextSelection;
diff --git a/ui/typedialog.h b/ui/typedialog.h
new file mode 100644
index 00000000..0404372d
--- /dev/null
+++ b/ui/typedialog.h
@@ -0,0 +1,61 @@
+#pragma once
+
+#include <QtWidgets/QDialog>
+#include <QtWidgets/QLabel>
+#include <QtCore/QStringListModel>
+#include <QtWidgets/QComboBox>
+#include <QtCore/QTimer>
+#include <QtCore/QThread>
+#include "binaryninjaapi.h"
+#include "uitypes.h"
+
+
+class BINARYNINJAUIAPI GetTypesListThread: public QThread
+{
+ Q_OBJECT
+
+ QStringList m_allTypes;
+ std::function<void()> m_completeFunc;
+ std::mutex m_mutex;
+ bool m_done;
+ BinaryViewRef m_view;
+
+protected:
+ virtual void run() override;
+
+public:
+ GetTypesListThread(BinaryViewRef view, const std::function<void()>& completeFunc);
+ void cancel();
+
+ const QStringList& getTypes() const { return m_allTypes; }
+};
+
+class BINARYNINJAUIAPI TypeDialog: public QDialog
+{
+ Q_OBJECT
+
+ QComboBox* m_combo;
+ QStringListModel* m_model;
+ QLabel* m_previewText;
+ BinaryViewRef m_view;
+ bool m_resultValid;
+ QStringList m_historyEntries;
+ int m_historySize;
+ GetTypesListThread* m_updateThread;
+ QFont m_defaultFont;
+ QString m_prompt;
+ bool m_initialTextSelection;
+ BinaryNinja::QualifiedNameAndType m_type;
+
+ void commitHistory();
+ void customEvent(QEvent* event);
+
+private Q_SLOTS:
+ void accepted();
+
+public:
+ TypeDialog(QWidget* parent, BinaryViewRef view, const QString& title = "Specify Type",
+ const QString& prompt = "Enter Type Name", const QString& existing="");
+ ~TypeDialog() { delete m_updateThread; }
+ BinaryNinja::QualifiedNameAndType getType() const { return m_type; }
+}; \ No newline at end of file