-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathworkflowmonitor.h
More file actions
147 lines (114 loc) · 4.19 KB
/
workflowmonitor.h
File metadata and controls
147 lines (114 loc) · 4.19 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#pragma once
#include <QAction>
#include <QToolBar>
#include <QPushButton>
#include <QIcon>
#include <QLabel>
#include <QPropertyAnimation>
#include <QTabWidget>
#include "binaryninjaapi.h"
#include "flowgraphwidget.h"
#include "fontsettings.h"
#include "pane.h"
#include "sidebarwidget.h"
#include "uicontext.h"
#include "viewframe.h"
class BINARYNINJAUIAPI WorkflowMonitorWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(qreal dotBrightness READ dotBrightness WRITE setDotBrightness)
BinaryViewRef m_data;
FunctionRef m_function;
WorkflowRef m_workflow;
Menu m_menu;
ContextMenuManager* m_contextMenuManager;
UIActionHandler m_actionHandler;
QToolBar* m_toolbar;
QTabWidget* m_tabs;
FlowGraphWidget* m_flowGraphWidget;
QAction* m_startAction;
QAction* m_haltAction;
QAction* m_stepAction;
QAction* m_resetAction;
QAction* m_toggleSuspendAction;
QAction* m_toggleLogAction;
QPushButton* m_contextButton;
QLabel* m_contextLabel;
std::map<std::string, QIcon> m_iconCache;
std::map<std::string, QColor> m_colorCache;
std::string m_lastState;
QColor m_lastStatusColor;
QColor m_labelColor;
std::string m_breakRequest;
QLabel* m_currentActivity;
QLabel* m_statusIndicator;
QPropertyAnimation* m_dotAnimation;
qreal m_dotBrightness;
bool m_animationRunning;
void updateVisualState(const BinaryNinja::WorkflowMachine::Status& status, bool force);
void updateButtonStates(const BinaryNinja::WorkflowMachine::Status& status);
void updateToolbarActions(bool force = false);
void updateToolbarIcons();
void setupToolbar();
void setupActions();
void updateStatusIndicator();
qreal dotBrightness() const;
void setDotBrightness(qreal brightness);
public:
WorkflowMonitorWidget(BinaryViewRef data, FunctionRef function = nullptr);
~WorkflowMonitorWidget();
FunctionRef getCurrentFunction() const { return m_function; }
void notifyRefresh();
void notifyFontChanged();
void notifyThemeChanged();
void notifyViewLocationChanged(View* view, const ViewLocation& viewLocation);
void startDotAnimation();
void stopDotAnimation();
};
class BINARYNINJAUIAPI WorkflowMonitorSidebarWidget : public SidebarWidget
{
Q_OBJECT
WorkflowMonitorWidget* m_widget;
public:
WorkflowMonitorSidebarWidget(BinaryViewRef data);
void notifyRefresh() override { m_widget->notifyRefresh(); }
void notifyFontChanged() override { m_widget->notifyFontChanged(); }
void notifyThemeChanged() override { m_widget->notifyThemeChanged(); }
void notifyViewLocationChanged(View* view, const ViewLocation& viewLocation) override { m_widget->notifyViewLocationChanged(view, viewLocation); }
};
class BINARYNINJAUIAPI WorkflowMonitorSidebarWidgetType : public SidebarWidgetType
{
public:
WorkflowMonitorSidebarWidgetType();
SidebarWidgetLocation defaultLocation() const override { return SidebarWidgetLocation::LeftReference; }
SidebarContextSensitivity contextSensitivity() const override { return PerViewTypeSidebarContext; }
SidebarIconVisibility defaultIconVisibility() const override { return AlwaysHideSidebarIcon; }
SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;
bool canUseAsPane(SplitPaneWidget* panes, BinaryViewRef data) const override { return true; }
Pane* createPane(SplitPaneWidget* panes, BinaryViewRef data) override;
};
class BINARYNINJAUIAPI WorkflowView : public QWidget, public View
{
Q_OBJECT
BinaryViewRef m_data;
uint64_t m_currentOffset = 0;
WorkflowMonitorWidget* m_widget;
public:
WorkflowView(BinaryViewRef data, ViewFrame* frame);
void notifyRefresh() override { m_widget->notifyRefresh(); }
BinaryViewRef getData() override { return m_data; }
uint64_t getCurrentOffset() override { return m_currentOffset; }
void setSelectionOffsets(BNAddressRange range) override { m_currentOffset = range.start; }
bool navigate(uint64_t offset) override;
QFont getFont() override { return getMonospaceFont(m_widget); }
FunctionRef getCurrentFunction() override { return m_widget->getCurrentFunction(); }
};
class BINARYNINJAUIAPI WorkflowViewType : public ViewType
{
static WorkflowViewType* m_instance;
public:
WorkflowViewType();
virtual int getPriority(BinaryViewRef data, const QString& filename);
virtual QWidget* create(BinaryViewRef data, ViewFrame* viewFrame);
static void init();
};