From 54990215c2ad8bda17de857a7fe97d9a7559364f Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Sun, 27 Apr 2025 10:29:51 -0400 Subject: Add initial Workflow Monitor UI and support for nested subflows. --- ui/workflowmonitor.h | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 ui/workflowmonitor.h (limited to 'ui') diff --git a/ui/workflowmonitor.h b/ui/workflowmonitor.h new file mode 100644 index 00000000..7dcb05a5 --- /dev/null +++ b/ui/workflowmonitor.h @@ -0,0 +1,83 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include "binaryninjaapi.h" +#include "sidebarwidget.h" +#include "uicontext.h" + + +class BINARYNINJAUIAPI WorkflowMonitorWidget : public SidebarWidget +{ + 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; + + QAction* m_startAction; + QAction* m_haltAction; + QAction* m_stepAction; + QAction* m_resetAction; + QAction* m_toggleSuspendAction; + QAction* m_toggleLogAction; + QAction* m_topologyAction; + QPushButton* m_contextButton; + QLabel* m_contextLabel; + + std::map m_iconCache; + std::map m_colorCache; + std::string m_lastState; + QColor m_lastStatusColor; + QColor m_labelColor; + + QLabel* m_currentActivity; + QLabel* m_statusIndicator; + QPropertyAnimation* m_dotAnimation; + qreal m_dotBrightness; + bool m_animationRunning; + + virtual void contextMenuEvent(QContextMenuEvent*) override; + + void updateToolbarActions(bool force = false); + void updateToolbarIcons(); + void setupToolbar(); + void setupActions(); + void updateStatusIndicator(); + + qreal dotBrightness() const; + void setDotBrightness(qreal brightness); + +public: + WorkflowMonitorWidget(BinaryViewRef data); + ~WorkflowMonitorWidget(); + + void notifyRefresh() override; + void notifyFontChanged() override; + void notifyThemeChanged() override; + void notifyViewLocationChanged(View* view, const ViewLocation& viewLocation) override; + + void startDotAnimation(); + void stopDotAnimation(); +}; + + +class BINARYNINJAUIAPI WorkflowMonitorWidgetType : public SidebarWidgetType +{ +public: + WorkflowMonitorWidgetType(); + SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override; + SidebarWidgetLocation defaultLocation() const override { return SidebarWidgetLocation::LeftReference; } + SidebarContextSensitivity contextSensitivity() const override { return PerViewTypeSidebarContext; } +}; -- cgit v1.3.1