blob: 0404372d6d18757df4690c47ef5d0d2720c9c7ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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; }
};
|