From cb407be11b08c1c427fcf33a49974155e522e14a Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Wed, 8 May 2024 16:19:26 -0400 Subject: Ref count undo objects --- ui/historyview.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ ui/uitypes.h | 2 ++ 2 files changed, 56 insertions(+) create mode 100644 ui/historyview.h (limited to 'ui') diff --git a/ui/historyview.h b/ui/historyview.h new file mode 100644 index 00000000..06f6561d --- /dev/null +++ b/ui/historyview.h @@ -0,0 +1,54 @@ +#pragma once + +#include "filter.h" +#include "sidebarwidget.h" +#include +#include +#include + + +class BINARYNINJAUIAPI HistorySidebarWidget : public SidebarWidget, public FilterTarget +{ + Q_OBJECT + QTreeView* m_tree; + QStandardItemModel* m_model; + QSortFilterProxyModel* m_proxyModel; + + QWidget* m_header; + FilteredView* m_libFilter; + BinaryViewRef m_data; + ContextMenuManager* m_contextMenuManager; + Menu m_contextMenu; + bool m_updating = false; + + std::unordered_map m_idIndices; + + virtual void scrollToFirstItem() override; + virtual void scrollToCurrentItem() override; + virtual void selectFirstItem() override; + virtual void activateFirstItem() override; + virtual void setFilter(const std::string& filter) override; + + virtual void contextMenuEvent(QContextMenuEvent*) override; + + void itemDoubleClicked(const QModelIndex& index); + void scrollBarRangeChanged(int min, int max); + + void populateTree(); + + public: + HistorySidebarWidget(BinaryViewRef data); + + void notifyFontChanged() override; + QWidget* headerWidget() override { return m_header; } +}; + + +class BINARYNINJAUIAPI HistorySidebarWidgetType : public SidebarWidgetType +{ + public: + HistorySidebarWidgetType(); + SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override; + SidebarWidgetLocation defaultLocation() const override { return SidebarWidgetLocation::RightBottom; } + SidebarContextSensitivity contextSensitivity() const override { return PerViewTypeSidebarContext; } +}; diff --git a/ui/uitypes.h b/ui/uitypes.h index 68022642..511e5aa9 100644 --- a/ui/uitypes.h +++ b/ui/uitypes.h @@ -115,6 +115,8 @@ typedef BinaryNinja::Ref RepoPluginRef; typedef BinaryNinja::Ref RepositoryRef; typedef BinaryNinja::Ref RepositoryManagerRef; typedef BinaryNinja::Ref LoggerRef; +typedef BinaryNinja::Ref UndoActionRef; +typedef BinaryNinja::Ref UndoEntryRef; typedef BinaryNinja::Ref RemoteRef; typedef BinaryNinja::Ref RemoteProjectRef; -- cgit v1.3.1