Skip to content

Commit 58c06d8

Browse files
committed
Migrate MemoryMap UI to use NotificationsDispatcher.
1 parent 6baf0bc commit 58c06d8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

ui/memorymap.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <QtWidgets/QStyledItemDelegate>
1111
#include <QtCore/QSortFilterProxyModel>
1212

13+
#include "binaryninjaapi.h"
14+
#include "notificationsdispatcher.h"
1315
#include "render.h"
1416
#include "sidebar.h"
1517
#include "uitypes.h"
@@ -94,7 +96,7 @@ enum class SegmentColumn : int {
9496
};
9597

9698

97-
class BINARYNINJAUIAPI SegmentModel : public QAbstractItemModel, public BinaryNinja::BinaryDataNotification
99+
class BINARYNINJAUIAPI SegmentModel : public QAbstractItemModel
98100
{
99101
BinaryViewRef m_data;
100102

@@ -118,9 +120,7 @@ class BINARYNINJAUIAPI SegmentModel : public QAbstractItemModel, public BinaryNi
118120

119121
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
120122

121-
virtual void OnSegmentAdded(BinaryNinja::BinaryView* data, BinaryNinja::Segment* segment) override;
122-
virtual void OnSegmentUpdated(BinaryNinja::BinaryView* data, BinaryNinja::Segment* segment) override;
123-
virtual void OnSegmentRemoved(BinaryNinja::BinaryView* data, BinaryNinja::Segment* segment) override;
123+
void updateSegments(std::vector<SegmentRef>&& segments);
124124
};
125125

126126
/*!
@@ -151,6 +151,8 @@ class BINARYNINJAUIAPI SegmentWidget : public QWidget
151151
SegmentWidget(BinaryViewRef data, QWidget* parent = nullptr);
152152
virtual ~SegmentWidget();
153153

154+
SegmentModel* model() { return m_model; }
155+
154156
void updateFont();
155157
void highlightRelatedSegments(SectionRef section);
156158
void currentRowChanged(const QModelIndex& current, const QModelIndex& previous);
@@ -172,7 +174,7 @@ enum class SectionColumn: int
172174
};
173175

174176

175-
class BINARYNINJAUIAPI SectionModel : public QAbstractItemModel, public BinaryNinja::BinaryDataNotification
177+
class BINARYNINJAUIAPI SectionModel : public QAbstractItemModel
176178
{
177179
BinaryViewRef m_data;
178180

@@ -196,9 +198,7 @@ class BINARYNINJAUIAPI SectionModel : public QAbstractItemModel, public BinaryNi
196198

197199
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
198200

199-
virtual void OnSectionAdded(BinaryNinja::BinaryView* data, BinaryNinja::Section* section) override;
200-
virtual void OnSectionUpdated(BinaryNinja::BinaryView* data, BinaryNinja::Section* section) override;
201-
virtual void OnSectionRemoved(BinaryNinja::BinaryView* data, BinaryNinja::Section* section) override;
201+
void updateSections(std::vector<SectionRef>&& sections);
202202
};
203203

204204
/*!
@@ -225,6 +225,8 @@ class BINARYNINJAUIAPI SectionWidget : public QWidget
225225
SectionWidget(BinaryViewRef data, QWidget* parent = nullptr);
226226
virtual ~SectionWidget();
227227

228+
SectionModel* model() { return m_model; }
229+
228230
void updateFont();
229231
void highlightRelatedSections(SegmentRef segment);
230232
void currentRowChanged(const QModelIndex& current, const QModelIndex& previous);
@@ -247,6 +249,7 @@ class BINARYNINJAUIAPI MemoryMapView : public QWidget, public View
247249
Q_OBJECT
248250

249251
BinaryViewRef m_data;
252+
std::unique_ptr<NotificationsDispatcher> m_dispatcher = nullptr;
250253
MemoryMapContainer* m_container;
251254

252255
SectionWidget* m_sectionWidget;

0 commit comments

Comments
 (0)