#pragma once #include #include #include #include #include #include #include "binaryninjaapi.h" #include "uitypes.h" class BINARYNINJAUIAPI GetTypesListThread: public QThread { Q_OBJECT QStringList m_allTypes; std::function m_completeFunc; std::mutex m_mutex; bool m_done; BinaryViewRef m_view; protected: virtual void run() override; public: GetTypesListThread(BinaryViewRef view, const std::function& 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; } };