summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2022-01-27 22:43:28 -0500
committerKyleMiles <krm504@nyu.edu>2022-01-28 00:24:06 -0500
commit6812c973c9fa9b4ad642ab81856c05f87bd6fcc4 (patch)
treedace4156d03148bcaf02df138ab4e0d93e61bc6f /ui
parent519c9db22367f2659d1a54599fab47e6313be06e (diff)
Format All Files
Diffstat (limited to 'ui')
-rw-r--r--ui/action.h109
-rw-r--r--ui/addressdialog.h37
-rw-r--r--ui/addressindicator.h6
-rw-r--r--ui/assembledialog.h11
-rw-r--r--ui/clickablelabel.h45
-rw-r--r--ui/commandpalette.h28
-rw-r--r--ui/commands.h41
-rw-r--r--ui/commentdialog.h4
-rw-r--r--ui/compiledialog.h8
-rw-r--r--ui/compileoptions.h6
-rw-r--r--ui/createstructdialog.h9
-rw-r--r--ui/createtypedialog.h15
-rw-r--r--ui/datatypelist.h8
-rw-r--r--ui/dialogtextedit.h8
-rw-r--r--ui/disassemblyview.h66
-rw-r--r--ui/dockhandler.h60
-rw-r--r--ui/expandablegroup.h10
-rw-r--r--ui/featuremap.h21
-rw-r--r--ui/filecontext.h11
-rw-r--r--ui/filter.h19
-rw-r--r--ui/flowgraphwidget.h38
-rw-r--r--ui/forminputdialog.h6
-rw-r--r--ui/getsymbolslistthread.h10
-rw-r--r--ui/globalarea.h133
-rw-r--r--ui/hexeditor.h44
-rw-r--r--ui/ilchooser.h10
-rw-r--r--ui/instructionedit.h8
-rw-r--r--ui/linearview.h64
-rw-r--r--ui/logview.h40
-rw-r--r--ui/menus.h24
-rw-r--r--ui/minigraph.h12
-rw-r--r--ui/options.h8
-rw-r--r--ui/pane.h72
-rw-r--r--ui/platformdialog.h6
-rw-r--r--ui/possiblevaluesetdialog.h7
-rw-r--r--ui/preview.h8
-rw-r--r--ui/progressindicator.h148
-rw-r--r--ui/progresstask.h363
-rw-r--r--ui/qfileaccessor.h2
-rw-r--r--ui/render.h29
-rw-r--r--ui/reportcollectionwidget.h6
-rw-r--r--ui/reportwidget.h32
-rw-r--r--ui/scriptingconsole.h51
-rw-r--r--ui/searchresult.h349
-rw-r--r--ui/settingsview.h120
-rw-r--r--ui/sidebar.h190
-rw-r--r--ui/stackview.h25
-rw-r--r--ui/statusbarwidget.h10
-rw-r--r--ui/stringsview.h39
-rw-r--r--ui/symbollist.h50
-rw-r--r--ui/symbolsview.h12
-rw-r--r--ui/syncgroup.h8
-rw-r--r--ui/tabwidget.h96
-rw-r--r--ui/taglist.h60
-rw-r--r--ui/tagtypelist.h44
-rw-r--r--ui/textbrowser.h28
-rw-r--r--ui/textdialog.h8
-rw-r--r--ui/theme.h12
-rw-r--r--ui/tokenizedtextview.h22
-rw-r--r--ui/transformparam.h8
-rw-r--r--ui/typedialog.h23
-rw-r--r--ui/typeview.h117
-rw-r--r--ui/uicomment.h18
-rw-r--r--ui/uicontext.h115
-rw-r--r--ui/uitypes.h51
-rw-r--r--ui/util.h18
-rw-r--r--ui/variablelist.h21
-rw-r--r--ui/viewframe.h163
-rw-r--r--ui/viewlist.h8
-rw-r--r--ui/viewtype.h4
-rw-r--r--ui/xreflist.h135
71 files changed, 1778 insertions, 1619 deletions
diff --git a/ui/action.h b/ui/action.h
index 19f3d317..ef43c779 100644
--- a/ui/action.h
+++ b/ui/action.h
@@ -4,9 +4,9 @@
#include <QtWidgets/QMenuBar>
#include <QtGui/QIcon>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-#include <QtWidgets/QShortcut>
+ #include <QtWidgets/QShortcut>
#else
-#include <QtGui/QShortcut>
+ #include <QtGui/QShortcut>
#endif
#include <QtCore/QPointer>
#include <functional>
@@ -15,11 +15,11 @@
#include <vector>
#include "uitypes.h"
-#define MENU_ORDER_FIRST 0
-#define MENU_ORDER_EARLY 64
+#define MENU_ORDER_FIRST 0
+#define MENU_ORDER_EARLY 64
#define MENU_ORDER_NORMAL 128
-#define MENU_ORDER_LATE 192
-#define MENU_ORDER_LAST 255
+#define MENU_ORDER_LATE 192
+#define MENU_ORDER_LAST 255
class View;
class UIContext;
@@ -68,20 +68,17 @@ struct BINARYNINJAUIAPI UIActionContext
struct BINARYNINJAUIAPI UIAction
{
- std::function<void (const UIActionContext& context)> activate;
- std::function<bool (const UIActionContext& context)> isValid;
+ std::function<void(const UIActionContext& context)> activate;
+ std::function<bool(const UIActionContext& context)> isValid;
UIAction();
- UIAction(const std::function<void (const UIActionContext& context)>& activate);
+ UIAction(const std::function<void(const UIActionContext& context)>& activate);
UIAction(const std::function<void()>& activate);
- UIAction(const std::function<void (const UIActionContext& context)>& activate,
- const std::function<bool (const UIActionContext& context)>& isValid);
- UIAction(const std::function<void()>& activate,
- const std::function<bool (const UIActionContext& context)>& isValid);
- UIAction(const std::function<void (const UIActionContext& context)>& activate,
- const std::function<bool()>& isValid);
- UIAction(const std::function<void()>& activate,
- const std::function<bool()>& isValid);
+ UIAction(const std::function<void(const UIActionContext& context)>& activate,
+ const std::function<bool(const UIActionContext& context)>& isValid);
+ UIAction(const std::function<void()>& activate, const std::function<bool(const UIActionContext& context)>& isValid);
+ UIAction(const std::function<void(const UIActionContext& context)>& activate, const std::function<bool()>& isValid);
+ UIAction(const std::function<void()>& activate, const std::function<bool()>& isValid);
UIAction(const UIAction& other);
UIAction& operator=(const UIAction& other);
@@ -97,7 +94,8 @@ struct BINARYNINJAUIAPI UIAction
static void setActionDisplayName(const QString& registeredName, const QString& displayName);
static void setActionDisplayName(const QString& registeredName, const std::function<QString()>& displayNameFunc);
- static void setActionDisplayName(const QString& registeredName, const std::function<QString(const UIActionContext&)>& displayNameFunc);
+ static void setActionDisplayName(
+ const QString& registeredName, const std::function<QString(const UIActionContext&)>& displayNameFunc);
static bool isActionRegistered(const QString& name);
static std::set<QString> getAllRegisteredActions();
@@ -116,48 +114,49 @@ struct BINARYNINJAUIAPI UIAction
struct BINARYNINJAUIAPI UITransformAction
{
- std::function<void (const UIActionContext& context, TransformRef xform)> activate;
- std::function<bool (const UIActionContext& context, TransformRef xform)> isValid;
+ std::function<void(const UIActionContext& context, TransformRef xform)> activate;
+ std::function<bool(const UIActionContext& context, TransformRef xform)> isValid;
UITransformAction();
- UITransformAction(const std::function<void (const UIActionContext& context, TransformRef xform)>& activate);
+ UITransformAction(const std::function<void(const UIActionContext& context, TransformRef xform)>& activate);
UITransformAction(const std::function<void(TransformRef xform)>& activate);
- UITransformAction(const std::function<void (const UIActionContext& context, TransformRef xform)>& activate,
- const std::function<bool (const UIActionContext& context, TransformRef xform)>& isValid);
+ UITransformAction(const std::function<void(const UIActionContext& context, TransformRef xform)>& activate,
+ const std::function<bool(const UIActionContext& context, TransformRef xform)>& isValid);
UITransformAction(const std::function<void(TransformRef xform)>& activate,
- const std::function<bool (const UIActionContext& context, TransformRef xform)>& isValid);
- UITransformAction(const std::function<void (const UIActionContext& context, TransformRef xform)>& activate,
- const std::function<bool(TransformRef xform)>& isValid);
+ const std::function<bool(const UIActionContext& context, TransformRef xform)>& isValid);
+ UITransformAction(const std::function<void(const UIActionContext& context, TransformRef xform)>& activate,
+ const std::function<bool(TransformRef xform)>& isValid);
UITransformAction(const std::function<void(TransformRef xform)>& activate,
- const std::function<bool(TransformRef xform)>& isValid);
+ const std::function<bool(TransformRef xform)>& isValid);
UITransformAction(const UITransformAction& other);
};
struct BINARYNINJAUIAPI UIHighlightColorAction
{
- std::function<void (const UIActionContext& context, BNHighlightColor color)> activate;
- std::function<bool (const UIActionContext& context)> isValid;
+ std::function<void(const UIActionContext& context, BNHighlightColor color)> activate;
+ std::function<bool(const UIActionContext& context)> isValid;
UIHighlightColorAction();
- UIHighlightColorAction(const std::function<void (const UIActionContext& context, BNHighlightColor color)>& activate);
+ UIHighlightColorAction(const std::function<void(const UIActionContext& context, BNHighlightColor color)>& activate);
UIHighlightColorAction(const std::function<void(BNHighlightColor color)>& activate);
- UIHighlightColorAction(const std::function<void (const UIActionContext& context, BNHighlightColor color)>& activate,
- const std::function<bool (const UIActionContext& context)>& isValid);
+ UIHighlightColorAction(const std::function<void(const UIActionContext& context, BNHighlightColor color)>& activate,
+ const std::function<bool(const UIActionContext& context)>& isValid);
UIHighlightColorAction(const std::function<void(BNHighlightColor color)>& activate,
- const std::function<bool (const UIActionContext& context)>& isValid);
- UIHighlightColorAction(const std::function<void (const UIActionContext& context, BNHighlightColor color)>& activate,
- const std::function<bool()>& isValid);
- UIHighlightColorAction(const std::function<void(BNHighlightColor color)>& activate,
- const std::function<bool()>& isValid);
+ const std::function<bool(const UIActionContext& context)>& isValid);
+ UIHighlightColorAction(const std::function<void(const UIActionContext& context, BNHighlightColor color)>& activate,
+ const std::function<bool()>& isValid);
+ UIHighlightColorAction(
+ const std::function<void(BNHighlightColor color)>& activate, const std::function<bool()>& isValid);
UIHighlightColorAction(const UIHighlightColorAction& other);
};
struct BINARYNINJAUIAPI UIBookmarkAction
{
- std::function<void (const UIActionContext& context, int index)> activate;
- std::function<bool (const UIActionContext& context, int index)> isValid;
+ std::function<void(const UIActionContext& context, int index)> activate;
+ std::function<bool(const UIActionContext& context, int index)> isValid;
- UIBookmarkAction(const std::function<void (const UIActionContext& context, int index)>& activate, const std::function<bool (const UIActionContext& context, int index)>& isValid);
+ UIBookmarkAction(const std::function<void(const UIActionContext& context, int index)>& activate,
+ const std::function<bool(const UIActionContext& context, int index)>& isValid);
};
enum ActionPriority
@@ -188,7 +187,7 @@ class BINARYNINJAUIAPI UIActionHandler
void addActionToChildren(const QString& name);
void removeActionFromChildren(const QString& name);
-public:
+ public:
UIActionHandler(bool isGlobal = false);
virtual ~UIActionHandler();
void setupActionHandler(QWidget* obj, bool inheritParentBindings = true);
@@ -216,8 +215,8 @@ public:
void bindPluginCommandActions();
void bindPluginCommandActions(const QString& prefix,
- const std::function<UIActionContext(const UIActionContext&, const BinaryNinja::PluginCommand&)>& context,
- const std::function<bool(const UIActionContext&, const BinaryNinja::PluginCommand&)>& isValid);
+ const std::function<UIActionContext(const UIActionContext&, const BinaryNinja::PluginCommand&)>& context,
+ const std::function<bool(const UIActionContext&, const BinaryNinja::PluginCommand&)>& isValid);
void unbindPluginCommandActions();
void unbindPluginCommandActions(const QString& prefix);
@@ -229,7 +228,8 @@ public:
void setActionDisplayName(const QString& registeredName, const QString& displayName);
void setActionDisplayName(const QString& registeredName, const std::function<QString()>& displayNameFunc);
- void setActionDisplayName(const QString& registeredName, const std::function<QString(const UIActionContext&)>& displayNameFunc);
+ void setActionDisplayName(
+ const QString& registeredName, const std::function<QString(const UIActionContext&)>& displayNameFunc);
QString getActionDisplayName(const QString& name);
QString getActionDisplayName(const QString& name, const UIActionContext& context);
@@ -281,12 +281,13 @@ class BINARYNINJAUIAPI Menu
Menu(bool global);
void setParentOrdering(const QString& path, const QString& group, uint8_t order);
-public:
+ public:
Menu();
Menu(const Menu& menu);
void addAction(const QString& action, const QString& group, uint8_t order = MENU_ORDER_NORMAL);
- void addAction(const QString& submenu, const QString& action, const QString& group, uint8_t order = MENU_ORDER_NORMAL);
+ void addAction(
+ const QString& submenu, const QString& action, const QString& group, uint8_t order = MENU_ORDER_NORMAL);
void removeAction(const QString& action);
void removeAction(const QString& submenu, const QString& action);
@@ -300,8 +301,8 @@ public:
void addPluginCommandActions(const QString& group);
void addPluginCommandActions(const QString& prefix, const QString& group, uint8_t order = MENU_ORDER_NORMAL);
void addPluginCommandSubmenuActions(const QString& submenu, const QString& group);
- void addPluginCommandSubmenuActions(const QString& submenu, const QString& prefix, const QString& group,
- uint8_t order = MENU_ORDER_NORMAL);
+ void addPluginCommandSubmenuActions(
+ const QString& submenu, const QString& prefix, const QString& group, uint8_t order = MENU_ORDER_NORMAL);
void removePluginCommandActions();
void removePluginCommandSubmenuActions(const QString& submenu);
@@ -317,8 +318,8 @@ public:
void setIcon(const QString& path, const QIcon& icon);
MenuInstance* create(QWidget* owner, UIActionHandler* handler, bool showInactiveActions = false);
- MenuInstance* create(QWidget* owner, UIActionHandler* handler, const UIActionContext& context,
- bool showInactiveActions = false);
+ MenuInstance* create(
+ QWidget* owner, UIActionHandler* handler, const UIActionContext& context, bool showInactiveActions = false);
uint64_t getVersion();
const std::map<QString, QString>& getActions();
@@ -364,11 +365,11 @@ class BINARYNINJAUIAPI MenuInstance
static std::map<QString, std::set<MenuInstance*>> m_actionBindings;
- std::vector<Group> layoutMenu(const std::map<QString, QString>& actions, const QString& prefix,
- bool showInactiveActions);
+ std::vector<Group> layoutMenu(
+ const std::map<QString, QString>& actions, const QString& prefix, bool showInactiveActions);
void addGroupsToMenu(QMenu* menu, const std::vector<Group>& groups);
-public:
+ public:
MenuInstance(Menu* menu, QMenu* instance);
virtual ~MenuInstance();
void update(UIActionHandler* handler, bool showInactiveActions = false);
@@ -385,7 +386,7 @@ class BINARYNINJAUIAPI MainMenuInstance
QMenuBar* m_instance;
std::map<QString, MenuInstance*> m_menus;
-public:
+ public:
MainMenuInstance(QMenuBar* instance);
~MainMenuInstance();
void update(UIActionHandler* handler);
diff --git a/ui/addressdialog.h b/ui/addressdialog.h
index 261f0732..f1dfec84 100644
--- a/ui/addressdialog.h
+++ b/ui/addressdialog.h
@@ -7,14 +7,14 @@
#include <QtWidgets/QComboBox>
#include <QtCore/QTimer>
#ifndef BINARYNINJAUI_BINDINGS
-#include <QtCore/QThread>
+ #include <QtCore/QThread>
#endif
#include "binaryninjaapi.h"
#include "uitypes.h"
#include "getsymbolslistthread.h"
-class BINARYNINJAUIAPI AddressDialogWithPreview: public QDialog
+class BINARYNINJAUIAPI AddressDialogWithPreview : public QDialog
{
Q_OBJECT
@@ -40,7 +40,7 @@ class BINARYNINJAUIAPI AddressDialogWithPreview: public QDialog
void commitHistory();
void customEvent(QEvent* event);
-private Q_SLOTS:
+ private Q_SLOTS:
void updateTimerEvent();
void accepted();
void updateRelativeState(int state);
@@ -48,14 +48,14 @@ private Q_SLOTS:
void updatePreviewText();
void updatePreviewWithText(QString data);
-public:
- AddressDialogWithPreview(QWidget* parent, BinaryViewRef view, uint64_t here,
- const QString& title = "Go to Address", const QString& prompt = "Enter Expression", bool defaultToCurrent = false);
+ public:
+ AddressDialogWithPreview(QWidget* parent, BinaryViewRef view, uint64_t here, const QString& title = "Go to Address",
+ const QString& prompt = "Enter Expression", bool defaultToCurrent = false);
~AddressDialogWithPreview() { delete m_updateThread; }
uint64_t getOffset() const { return m_addr; }
};
-class BINARYNINJAUIAPI FileOffsetDialogWithPreview: public QDialog
+class BINARYNINJAUIAPI FileOffsetDialogWithPreview : public QDialog
{
Q_OBJECT
@@ -77,27 +77,28 @@ class BINARYNINJAUIAPI FileOffsetDialogWithPreview: public QDialog
void commitHistory();
-private Q_SLOTS:
+ private Q_SLOTS:
void updateTimerEvent();
void accepted();
void updatePreview();
void updatePreviewText();
void updatePreview(QString data);
-public:
+ public:
FileOffsetDialogWithPreview(QWidget* parent, BinaryViewRef view, uint64_t here,
- const QString& title = "Go to File Offset", const QString& prompt = "Enter Expression", bool defaultToCurrent = false);
+ const QString& title = "Go to File Offset", const QString& prompt = "Enter Expression",
+ bool defaultToCurrent = false);
~FileOffsetDialogWithPreview() {}
uint64_t getOffset() const { return m_fileOffset; }
};
-class BINARYNINJAUIAPI AddUserXrefDialog: public QDialog
+class BINARYNINJAUIAPI AddUserXrefDialog : public QDialog
{
Q_OBJECT
QComboBox* m_combo;
QStringListModel* m_model;
- QLabel* m_previewText, m_sizePrompt;
+ QLabel *m_previewText, m_sizePrompt;
QLineEdit* m_sizeInput;
BinaryViewRef m_view;
uint64_t m_addr;
@@ -118,18 +119,18 @@ class BINARYNINJAUIAPI AddUserXrefDialog: public QDialog
void commitHistory();
void customEvent(QEvent* event);
-private Q_SLOTS:
+ private Q_SLOTS:
void updateTimerEvent();
void accepted();
void updatePreview();
void updatePreviewText();
void updatePreviewWithText(QString data);
-public:
- AddUserXrefDialog(QWidget* parent, BinaryViewRef view, uint64_t here = 0,
- size_t size = 0, const QString& title = "Add User Type Field Cross Reference",
- const QString& sizeTitle = "Size of Reference (optional)",
- const QString& prompt = "Enter Expression", bool defaultToCurrent = false);
+ public:
+ AddUserXrefDialog(QWidget* parent, BinaryViewRef view, uint64_t here = 0, size_t size = 0,
+ const QString& title = "Add User Type Field Cross Reference",
+ const QString& sizeTitle = "Size of Reference (optional)", const QString& prompt = "Enter Expression",
+ bool defaultToCurrent = false);
~AddUserXrefDialog() { delete m_updateThread; }
uint64_t getOffset() const { return m_addr; }
size_t getSize() const { return m_size; }
diff --git a/ui/addressindicator.h b/ui/addressindicator.h
index d67e7d79..3288de35 100644
--- a/ui/addressindicator.h
+++ b/ui/addressindicator.h
@@ -6,19 +6,19 @@
#include "uicontext.h"
-class BINARYNINJAUIAPI AddressIndicator: public MenuHelper
+class BINARYNINJAUIAPI AddressIndicator : public MenuHelper
{
Q_OBJECT
uint64_t m_begin, m_end;
BinaryViewRef m_view;
-public:
+ public:
AddressIndicator(QWidget* parent);
void clear();
void setOffsets(uint64_t begin, uint64_t end, BinaryViewRef view);
-protected:
+ protected:
virtual void showMenu();
};
diff --git a/ui/assembledialog.h b/ui/assembledialog.h
index 7db619a2..62be31ef 100644
--- a/ui/assembledialog.h
+++ b/ui/assembledialog.h
@@ -6,7 +6,7 @@
#include "dialogtextedit.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI AssembleDialog: public QDialog
+class BINARYNINJAUIAPI AssembleDialog : public QDialog
{
Q_OBJECT
@@ -19,19 +19,18 @@ class BINARYNINJAUIAPI AssembleDialog: public QDialog
BinaryNinja::DataBuffer m_bytes;
bool m_setDefault;
-public:
+ public:
AssembleDialog(QWidget* parent, BinaryViewRef data, uint64_t addr, ArchitectureRef prefArch = NULL,
- const QString& code = "", bool fixedArch = false);
+ const QString& code = "", bool fixedArch = false);
ArchitectureRef getArchitecture();
const BinaryNinja::DataBuffer& getBytes() const { return m_bytes; }
void setLength(size_t len) { m_length = len; }
-private Q_SLOTS:
+ private Q_SLOTS:
void saveOnFinish(int result);
void assemble();
-protected:
+ protected:
virtual void accept() override;
-
};
diff --git a/ui/clickablelabel.h b/ui/clickablelabel.h
index 0b373d6b..a1116f0b 100644
--- a/ui/clickablelabel.h
+++ b/ui/clickablelabel.h
@@ -18,23 +18,27 @@ struct BINARYNINJAUIAPI IconImage
};
-class BINARYNINJAUIAPI ClickableLabel: public QLabel
+class BINARYNINJAUIAPI ClickableLabel : public QLabel
{
Q_OBJECT
-public:
- ClickableLabel(QWidget* parent = nullptr, const QString& name = ""): QLabel(parent) { setText(name); }
+ public:
+ ClickableLabel(QWidget* parent = nullptr, const QString& name = "") : QLabel(parent) { setText(name); }
-Q_SIGNALS:
+ Q_SIGNALS:
void clicked();
-protected:
+ protected:
void mousePressEvent(QMouseEvent*) override {}
- void mouseReleaseEvent(QMouseEvent* event) override { if (event->button() == Qt::LeftButton) Q_EMIT clicked(); }
+ void mouseReleaseEvent(QMouseEvent* event) override
+ {
+ if (event->button() == Qt::LeftButton)
+ Q_EMIT clicked();
+ }
};
-class BINARYNINJAUIAPI ClickableIcon: public QWidget
+class BINARYNINJAUIAPI ClickableIcon : public QWidget
{
Q_OBJECT
@@ -44,7 +48,7 @@ class BINARYNINJAUIAPI ClickableIcon: public QWidget
bool m_hover = false;
QTimer* m_timer;
-public:
+ public:
ClickableIcon(const QImage& icon, const QSize& desiredPointSize);
void setAllowToggle(bool canToggle);
@@ -53,15 +57,15 @@ public:
void setImage(const QImage& icon);
-Q_SIGNALS:
+ Q_SIGNALS:
void clicked();
void toggle(bool newState);
-private Q_SLOTS:
+ private Q_SLOTS:
void underMouseTimerEvent();
void handleToggle();
-protected:
+ protected:
void enterEvent(QEnterEvent* event) override;
void leaveEvent(QEvent* event) override;
void paintEvent(QPaintEvent* event) override;
@@ -70,7 +74,7 @@ protected:
};
-class BINARYNINJAUIAPI ClickableStateLabel: public ClickableLabel
+class BINARYNINJAUIAPI ClickableStateLabel : public ClickableLabel
{
Q_OBJECT
@@ -82,25 +86,30 @@ class BINARYNINJAUIAPI ClickableStateLabel: public ClickableLabel
QPalette::ColorRole m_altOverlayColorRole;
int m_alpha;
-public:
- ClickableStateLabel(QWidget* parent, const QString& name, const QString& altName): ClickableLabel(parent, name), m_name(name), m_altName(altName) { }
+ public:
+ ClickableStateLabel(QWidget* parent, const QString& name, const QString& altName) :
+ ClickableLabel(parent, name), m_name(name), m_altName(altName)
+ {}
bool getState() { return m_state; }
- void setDisplayState(bool state) {
+ void setDisplayState(bool state)
+ {
m_state = state;
setText(m_state ? m_name : m_altName);
}
- void setAlternateTransparency(QPalette::ColorRole colorRole, int alpha, bool state) {
+ void setAlternateTransparency(QPalette::ColorRole colorRole, int alpha, bool state)
+ {
m_altOverlayColorRole = colorRole;
m_alpha = alpha;
m_altStateEffect = state;
m_stateEffectEnabled = true;
}
-protected:
- void paintEvent(QPaintEvent* event) override {
+ protected:
+ void paintEvent(QPaintEvent* event) override
+ {
ClickableLabel::paintEvent(event);
if (m_stateEffectEnabled && (m_state == m_altStateEffect))
{
diff --git a/ui/commandpalette.h b/ui/commandpalette.h
index eab17f39..af773ba9 100644
--- a/ui/commandpalette.h
+++ b/ui/commandpalette.h
@@ -20,19 +20,19 @@ class CommandPalette;
class CommandListFilter;
-class BINARYNINJAUIAPI CommandListDelegate: public QStyledItemDelegate
+class BINARYNINJAUIAPI CommandListDelegate : public QStyledItemDelegate
{
Q_OBJECT
QFont m_font;
int m_height;
-public:
+ public:
CommandListDelegate(QWidget* parent);
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& idx) const override;
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
};
-class BINARYNINJAUIAPI CommandListModel: public QAbstractItemModel
+class BINARYNINJAUIAPI CommandListModel : public QAbstractItemModel
{
Q_OBJECT
@@ -45,7 +45,7 @@ class BINARYNINJAUIAPI CommandListModel: public QAbstractItemModel
bool isFilterMatch(const QString& name, const QString& filter);
int getFilterMatchScore(const QString& name, const QString& filter);
-public:
+ public:
CommandListModel(QWidget* parent, const std::vector<CommandListItem>& items);
virtual QModelIndex index(int row, int col, const QModelIndex& parent) const override;
@@ -61,7 +61,7 @@ public:
void addRecentItem(const QString& name);
};
-class BINARYNINJAUIAPI CommandList: public QListView
+class BINARYNINJAUIAPI CommandList : public QListView
{
Q_OBJECT
@@ -69,7 +69,7 @@ class BINARYNINJAUIAPI CommandList: public QListView
CommandListModel* m_model;
CommandListFilter* m_filter;
-public:
+ public:
CommandList(CommandPalette* parent, const std::vector<CommandListItem>& items);
void setFilter(CommandListFilter* filter) { m_filter = filter; }
void setFilterText(const QString& text);
@@ -79,12 +79,12 @@ public:
QModelIndex index(int row, int col, const QModelIndex& parent = QModelIndex()) const;
void addRecentItem(const QString& name);
-protected:
+ protected:
virtual void keyPressEvent(QKeyEvent* event) override;
virtual void focusOutEvent(QFocusEvent* event) override;
};
-class BINARYNINJAUIAPI CommandListFilter: public QLineEdit
+class BINARYNINJAUIAPI CommandListFilter : public QLineEdit
{
Q_OBJECT
@@ -94,16 +94,16 @@ class BINARYNINJAUIAPI CommandListFilter: public QLineEdit
//! Focus the next or previous results list item.
bool cycleSelection(bool forward = true);
-public:
+ public:
CommandListFilter(CommandPalette* parent, CommandList* list);
-protected:
+ protected:
bool event(QEvent* event) override;
virtual void keyPressEvent(QKeyEvent* event) override;
virtual void focusOutEvent(QFocusEvent* event) override;
};
-class BINARYNINJAUIAPI CommandPalette: public QFrame
+class BINARYNINJAUIAPI CommandPalette : public QFrame
{
Q_OBJECT
@@ -119,7 +119,7 @@ class BINARYNINJAUIAPI CommandPalette: public QFrame
std::vector<CommandListItem> getCommandList();
void init();
-public:
+ public:
CommandPalette(QWidget* parent, UIActionHandler* handler);
CommandPalette(QWidget* parent, UIActionHandler* handler, const UIActionContext& context);
@@ -130,7 +130,7 @@ public:
void selectFirstItem();
void close();
-private Q_SLOTS:
+ private Q_SLOTS:
void itemClicked(const QModelIndex& idx);
void filterChanged(const QString& text);
};
diff --git a/ui/commands.h b/ui/commands.h
index 05da1ba5..9eee935e 100644
--- a/ui/commands.h
+++ b/ui/commands.h
@@ -6,39 +6,40 @@
#include "uicontext.h"
bool BINARYNINJAUIAPI undefineNameForAddress(BinaryViewRef data, uint64_t addr);
-bool BINARYNINJAUIAPI undefineNameForLocalVariable(BinaryViewRef data,
- FunctionRef func, const BinaryNinja::Variable& var);
+bool BINARYNINJAUIAPI undefineNameForLocalVariable(
+ BinaryViewRef data, FunctionRef func, const BinaryNinja::Variable& var);
bool BINARYNINJAUIAPI inputNameForAddress(QWidget* parent, BinaryViewRef data, uint64_t addr);
-bool BINARYNINJAUIAPI inputNameForLocalVariable(QWidget* parent, BinaryViewRef data,
- FunctionRef function, const BinaryNinja::Variable& var);
-bool BINARYNINJAUIAPI inputNameForType(QWidget* parent, std::string& name, const QString& title = "Set Name",
- const QString& msg = "Enter name:");
+bool BINARYNINJAUIAPI inputNameForLocalVariable(
+ QWidget* parent, BinaryViewRef data, FunctionRef function, const BinaryNinja::Variable& var);
+bool BINARYNINJAUIAPI inputNameForType(
+ QWidget* parent, std::string& name, const QString& title = "Set Name", const QString& msg = "Enter name:");
bool BINARYNINJAUIAPI InferArraySize(TypeRef& type, size_t selectionSize);
bool BINARYNINJAUIAPI askForNewType(QWidget* parent, BinaryViewRef data, FunctionRef func, const std::string& title,
- TypeRef& type, BinaryNinja::QualifiedName& name);
+ TypeRef& type, BinaryNinja::QualifiedName& name);
bool BINARYNINJAUIAPI inputNewType(QWidget* parent, BinaryViewRef data, FunctionRef currentFunction,
- uint64_t currentAddr, size_t selectionSize, HighlightTokenState& highlight);
+ uint64_t currentAddr, size_t selectionSize, HighlightTokenState& highlight);
bool BINARYNINJAUIAPI createInferredMember(QWidget* parent, BinaryViewRef data, HighlightTokenState& highlight,
- FunctionRef func, BNFunctionGraphType ilType, size_t instrIndex);
-bool BINARYNINJAUIAPI createStructMembers(QWidget* parent, BinaryViewRef data,
- HighlightTokenState& highlight, FunctionRef func);
+ FunctionRef func, BNFunctionGraphType ilType, size_t instrIndex);
+bool BINARYNINJAUIAPI createStructMembers(
+ QWidget* parent, BinaryViewRef data, HighlightTokenState& highlight, FunctionRef func);
bool BINARYNINJAUIAPI inputPossibleValueSet(QWidget* parent, BinaryViewRef data, FunctionRef currentFunction,
- HighlightTokenState& highlight, uint64_t defSiteAddress, size_t ilInstructionIndex = BN_INVALID_EXPR);
+ HighlightTokenState& highlight, uint64_t defSiteAddress, size_t ilInstructionIndex = BN_INVALID_EXPR);
-bool BINARYNINJAUIAPI overwriteCode(BinaryViewRef data, ArchitectureRef arch,
- uint64_t addr, size_t len, const BinaryNinja::DataBuffer& buffer);
-bool BINARYNINJAUIAPI overwriteCode(BinaryViewRef data, ArchitectureRef arch,
- uint64_t addr, const BinaryNinja::DataBuffer& buffer);
+bool BINARYNINJAUIAPI overwriteCode(
+ BinaryViewRef data, ArchitectureRef arch, uint64_t addr, size_t len, const BinaryNinja::DataBuffer& buffer);
+bool BINARYNINJAUIAPI overwriteCode(
+ BinaryViewRef data, ArchitectureRef arch, uint64_t addr, const BinaryNinja::DataBuffer& buffer);
StructureRef BINARYNINJAUIAPI getInnerMostStructureContaining(BinaryViewRef data, StructureRef structure,
- size_t& memberIndex, const std::vector<std::string>& nameList, size_t nameIndex, TypeRef& type, std::string& typeName);
+ size_t& memberIndex, const std::vector<std::string>& nameList, size_t nameIndex, TypeRef& type,
+ std::string& typeName);
StructureRef BINARYNINJAUIAPI getInnerMostStructureContainingOffset(BinaryViewRef data, StructureRef structure,
- const std::vector<std::string>& nameList, size_t nameIndex, size_t offset, TypeRef& type, std::string& typeName);
+ const std::vector<std::string>& nameList, size_t nameIndex, size_t offset, TypeRef& type, std::string& typeName);
// Get the offset of the inner most structure, ralative to the supplied outer most structure
-uint64_t BINARYNINJAUIAPI getInnerMostStructureOffset(BinaryViewRef data, StructureRef structure,
- const std::vector<std::string>& nameList, size_t nameIndex);
+uint64_t BINARYNINJAUIAPI getInnerMostStructureOffset(
+ BinaryViewRef data, StructureRef structure, const std::vector<std::string>& nameList, size_t nameIndex);
// Auto generate a structure name
std::string BINARYNINJAUIAPI createStructureName(BinaryViewRef data);
diff --git a/ui/commentdialog.h b/ui/commentdialog.h
index ddff7f06..2a70c3eb 100644
--- a/ui/commentdialog.h
+++ b/ui/commentdialog.h
@@ -7,14 +7,14 @@
#include "uicontext.h"
#include "uicomment.h"
-class BINARYNINJAUIAPI CommentDialog: public QDialog
+class BINARYNINJAUIAPI CommentDialog : public QDialog
{
Q_OBJECT
DialogTextEdit* m_comment;
UIComment m_uicomment;
-public:
+ public:
CommentDialog(QWidget* parent, const UIComment& comment);
QString getNewComment();
QString getCurrentComment();
diff --git a/ui/compiledialog.h b/ui/compiledialog.h
index c5d2123a..b40bc68d 100644
--- a/ui/compiledialog.h
+++ b/ui/compiledialog.h
@@ -14,7 +14,7 @@ enum CompileMode
CompilePatch
};
-class BINARYNINJAUIAPI CompileDialog: public QDialog
+class BINARYNINJAUIAPI CompileDialog : public QDialog
{
Q_OBJECT
@@ -33,17 +33,17 @@ class BINARYNINJAUIAPI CompileDialog: public QDialog
void appendOptionString(std::string& out, const std::string& text);
void updateOptionsText();
-public:
+ public:
CompileDialog(QWidget* parent, BinaryViewRef data, uint64_t addr, CompileMode mode, const QString& code = "");
ArchitectureRef getArchitecture();
const BinaryNinja::DataBuffer& getBytes() const { return m_bytes; }
-private Q_SLOTS:
+ private Q_SLOTS:
void saveOnFinish(int result);
void compile();
void options();
-protected:
+ protected:
virtual void accept() override;
};
diff --git a/ui/compileoptions.h b/ui/compileoptions.h
index 53a7e687..58521bd1 100644
--- a/ui/compileoptions.h
+++ b/ui/compileoptions.h
@@ -7,7 +7,7 @@
#include "binaryninjaapi.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI CompileOptions: public QDialog
+class BINARYNINJAUIAPI CompileOptions : public QDialog
{
Q_OBJECT
@@ -36,11 +36,11 @@ class BINARYNINJAUIAPI CompileOptions: public QDialog
QString optionValue(const std::map<std::string, std::string>& options, const std::string& name);
void updateOptions(const std::map<std::string, std::string>& options);
-public:
+ public:
CompileOptions(QWidget* parent, const std::map<std::string, std::string>& initialOptions);
std::map<std::string, std::string> getSettings();
-private Q_SLOTS:
+ private Q_SLOTS:
void reset();
};
diff --git a/ui/createstructdialog.h b/ui/createstructdialog.h
index ae044bdf..f273399f 100644
--- a/ui/createstructdialog.h
+++ b/ui/createstructdialog.h
@@ -5,7 +5,7 @@
#include "binaryninjaapi.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI CreateStructDialog: public QDialog
+class BINARYNINJAUIAPI CreateStructDialog : public QDialog
{
Q_OBJECT
@@ -16,16 +16,15 @@ class BINARYNINJAUIAPI CreateStructDialog: public QDialog
BinaryNinja::QualifiedName m_resultName;
uint64_t m_resultSize;
-public:
+ public:
CreateStructDialog(QWidget* parent, BinaryViewRef view, const std::string& name);
BinaryNinja::QualifiedName getName() { return m_resultName; }
uint64_t getSize() { return m_resultSize; }
-private Q_SLOTS:
+ private Q_SLOTS:
void createStruct();
-protected:
+ protected:
virtual void showEvent(QShowEvent* e) override;
-
};
diff --git a/ui/createtypedialog.h b/ui/createtypedialog.h
index 19880bc8..0df1c613 100644
--- a/ui/createtypedialog.h
+++ b/ui/createtypedialog.h
@@ -6,7 +6,7 @@
#include "dialogtextedit.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI CreateTypeDialog: public QDialog
+class BINARYNINJAUIAPI CreateTypeDialog : public QDialog
{
Q_OBJECT
@@ -16,15 +16,14 @@ class BINARYNINJAUIAPI CreateTypeDialog: public QDialog
std::map<BinaryNinja::QualifiedName, TypeRef> m_results;
std::set<BinaryNinja::QualifiedName> m_typesAllowRedefinition;
-public:
- CreateTypeDialog(QWidget* parent, BinaryViewRef data, const QString& title,
- const QString& definition, const std::set<BinaryNinja::QualifiedName>& typesAllowRedefinition = {});
- std::map<BinaryNinja::QualifiedName, TypeRef> getResults() { return m_results; }
+ public:
+ CreateTypeDialog(QWidget* parent, BinaryViewRef data, const QString& title, const QString& definition,
+ const std::set<BinaryNinja::QualifiedName>& typesAllowRedefinition = {});
+ std::map<BinaryNinja::QualifiedName, TypeRef> getResults() { return m_results; }
-private Q_SLOTS:
+ private Q_SLOTS:
void createType();
-protected:
+ protected:
virtual void showEvent(QShowEvent* e) override;
-
};
diff --git a/ui/datatypelist.h b/ui/datatypelist.h
index be0fc5e9..c2a96489 100644
--- a/ui/datatypelist.h
+++ b/ui/datatypelist.h
@@ -5,7 +5,7 @@
#include "viewframe.h"
#include "menus.h"
-class BINARYNINJAUIAPI DataTypeList: public MenuHelper
+class BINARYNINJAUIAPI DataTypeList : public MenuHelper
{
Q_OBJECT
@@ -13,14 +13,14 @@ class BINARYNINJAUIAPI DataTypeList: public MenuHelper
QString m_currentType;
std::string m_currentDataType;
-public:
+ public:
DataTypeList(QWidget* parent);
void setCurrentViewType(ViewFrame* view, const QString& type);
-protected:
+ protected:
virtual void showMenu();
-Q_SIGNALS:
+ Q_SIGNALS:
void viewChanged(QString type);
};
diff --git a/ui/dialogtextedit.h b/ui/dialogtextedit.h
index cc719aae..28f025c7 100644
--- a/ui/dialogtextedit.h
+++ b/ui/dialogtextedit.h
@@ -3,16 +3,16 @@
#include <QtWidgets/QTextEdit>
#include "uicontext.h"
-class BINARYNINJAUIAPI DialogTextEdit: public QTextEdit
+class BINARYNINJAUIAPI DialogTextEdit : public QTextEdit
{
Q_OBJECT
-public:
+ public:
DialogTextEdit(QWidget* parent);
-protected:
+ protected:
virtual void keyPressEvent(QKeyEvent* event) override;
-Q_SIGNALS:
+ Q_SIGNALS:
void contentAccepted();
};
diff --git a/ui/disassemblyview.h b/ui/disassemblyview.h
index 144101fe..ffd963e5 100644
--- a/ui/disassemblyview.h
+++ b/ui/disassemblyview.h
@@ -18,11 +18,11 @@
#define FUNCTION_UPDATE_CHECK_INTERVAL 100
-class BINARYNINJAUIAPI DisassemblyHistoryEntry: public FlowGraphHistoryEntry
+class BINARYNINJAUIAPI DisassemblyHistoryEntry : public FlowGraphHistoryEntry
{
BNFunctionGraphType m_graphType;
-public:
+ public:
BNFunctionGraphType getGraphType() const { return m_graphType; }
void setGraphType(BNFunctionGraphType type) { m_graphType = type; }
@@ -32,15 +32,15 @@ public:
class DisassemblyContainer;
-class BINARYNINJAUIAPI DisassemblyView: public FlowGraphWidget
+class BINARYNINJAUIAPI DisassemblyView : public FlowGraphWidget
{
Q_OBJECT
-friend class DisassemblyFunctionHeader;
+ friend class DisassemblyFunctionHeader;
-public:
+ public:
explicit DisassemblyView(DisassemblyContainer* parent, BinaryViewRef data, FunctionRef func = nullptr,
- bool navToAddr = false, uint64_t addr = 0);
+ bool navToAddr = false, uint64_t addr = 0);
virtual void updateFonts() override;
@@ -70,26 +70,26 @@ public:
static void registerActions();
-private:
- class DisassemblyViewOptionsWidget: public MenuHelper
+ private:
+ class DisassemblyViewOptionsWidget : public MenuHelper
{
- public:
+ public:
DisassemblyViewOptionsWidget(DisassemblyView* parent);
- protected:
+ protected:
virtual void mousePressEvent(QMouseEvent* event);
virtual void showMenu();
- private:
+ private:
DisassemblyView* m_view;
};
- class DisassemblyViewOptionsIconWidget: public QWidget
+ class DisassemblyViewOptionsIconWidget : public QWidget
{
- public:
+ public:
DisassemblyViewOptionsIconWidget(DisassemblyView* parent);
- private:
+ private:
DisassemblyView* m_view;
ContextMenuManager* m_contextMenuManager;
Menu m_menu;
@@ -97,13 +97,13 @@ private:
void showMenu();
};
- class DisassemblyViewStatusBarWidget: public StatusBarWidget
+ class DisassemblyViewStatusBarWidget : public StatusBarWidget
{
- public:
+ public:
DisassemblyViewStatusBarWidget(DisassemblyView* parent);
virtual void updateStatus() override;
- private:
+ private:
DisassemblyView* m_view;
ILChooserWidget* m_chooser;
DisassemblyViewOptionsWidget* m_options;
@@ -117,7 +117,7 @@ private:
DisassemblyContainer* m_container;
SettingsRef m_settings;
-private Q_SLOTS:
+ private Q_SLOTS:
void viewInHexEditor();
void viewInLinearDisassembly();
void viewInDecompiler();
@@ -125,7 +125,7 @@ private Q_SLOTS:
};
-class GraphTypeLabel: public MenuHelper
+class GraphTypeLabel : public MenuHelper
{
Q_OBJECT
@@ -134,16 +134,16 @@ class GraphTypeLabel: public MenuHelper
void updateCustomPalette();
-public:
+ public:
GraphTypeLabel(QWidget* parent, DisassemblyContainer* container);
-protected:
- void paintEvent(QPaintEvent* event) override;
+ protected:
+ void paintEvent(QPaintEvent* event) override;
void showMenu() override;
};
-class BINARYNINJAUIAPI DisassemblyFunctionHeader: public QWidget
+class BINARYNINJAUIAPI DisassemblyFunctionHeader : public QWidget
{
Q_OBJECT
@@ -163,17 +163,17 @@ class BINARYNINJAUIAPI DisassemblyFunctionHeader: public QWidget
void adjustSize(int width, int height);
-private Q_SLOTS:
+ private Q_SLOTS:
void updateTimerEvent();
-protected:
+ protected:
virtual void paintEvent(QPaintEvent* event) override;
virtual void resizeEvent(QResizeEvent* event) override;
virtual void mousePressEvent(QMouseEvent* event) override;
virtual void mouseDoubleClickEvent(QMouseEvent* event) override;
-public:
+ public:
DisassemblyFunctionHeader(DisassemblyContainer* parent, BinaryViewRef data);
void updateFonts();
@@ -184,7 +184,7 @@ public:
virtual QSize sizeHint() const override;
};
-class BINARYNINJAUIAPI DisassemblyContainer: public QWidget, public ViewContainer
+class BINARYNINJAUIAPI DisassemblyContainer : public QWidget, public ViewContainer
{
Q_OBJECT
@@ -194,9 +194,9 @@ class BINARYNINJAUIAPI DisassemblyContainer: public QWidget, public ViewContaine
QWidget* m_analysisWarning;
QLabel* m_analysisWarningText;
-public:
+ public:
explicit DisassemblyContainer(QWidget* parent, BinaryViewRef data, ViewFrame* view, FunctionRef func = nullptr,
- bool navToAddr = false, uint64_t addr = 0);
+ bool navToAddr = false, uint64_t addr = 0);
virtual View* getView() override { return m_view; }
ViewFrame* getViewFrame() { return m_viewFrame; }
@@ -209,18 +209,18 @@ public:
void setILViewType(BNFunctionGraphType ilViewType);
void setHeaderHighlightToken(const HighlightTokenState& state);
-protected:
+ protected:
virtual void focusInEvent(QFocusEvent* event) override;
-private Q_SLOTS:
+ private Q_SLOTS:
void linkActivatedEvent(const QString& link);
};
-class DisassemblyViewType: public ViewType
+class DisassemblyViewType : public ViewType
{
static DisassemblyViewType* m_instance;
-public:
+ public:
DisassemblyViewType();
virtual int getPriority(BinaryViewRef data, const QString& filename);
virtual QWidget* create(BinaryViewRef data, ViewFrame* viewFrame);
diff --git a/ui/dockhandler.h b/ui/dockhandler.h
index 9a053b46..cb150a81 100644
--- a/ui/dockhandler.h
+++ b/ui/dockhandler.h
@@ -17,14 +17,17 @@ class Menu;
struct BINARYNINJAUIAPI DockProperties
{
- DockProperties() { };
+ DockProperties() {};
DockProperties(QDockWidget* dw, bool vis, Qt::DockWidgetArea dar, Qt::Orientation dor, bool dvis, bool vs) :
- dockWidget(dw), visibleState(vis), defaultArea(dar), defaultOrientation(dor), defaultVisibility(dvis),
- viewSensitive(vs), neverBeenVisible(true), sizeStash(0, 0), actionOnShow(nullptr) { }
- DockProperties(const DockProperties &dp) :
- dockWidget(dp.dockWidget), visibleState(dp.visibleState), defaultArea(dp.defaultArea),
- defaultOrientation(dp.defaultOrientation), defaultVisibility(dp.defaultVisibility),
- viewSensitive(dp.viewSensitive), neverBeenVisible(dp.neverBeenVisible), sizeStash(dp.sizeStash), actionOnShow(dp.actionOnShow) { }
+ dockWidget(dw), visibleState(vis), defaultArea(dar), defaultOrientation(dor), defaultVisibility(dvis),
+ viewSensitive(vs), neverBeenVisible(true), sizeStash(0, 0), actionOnShow(nullptr)
+ {}
+ DockProperties(const DockProperties& dp) :
+ dockWidget(dp.dockWidget), visibleState(dp.visibleState), defaultArea(dp.defaultArea),
+ defaultOrientation(dp.defaultOrientation), defaultVisibility(dp.defaultVisibility),
+ viewSensitive(dp.viewSensitive), neverBeenVisible(dp.neverBeenVisible), sizeStash(dp.sizeStash),
+ actionOnShow(dp.actionOnShow)
+ {}
DockProperties& operator=(const DockProperties& dp)
{
dockWidget = dp.dockWidget;
@@ -53,7 +56,7 @@ struct BINARYNINJAUIAPI DockProperties
struct DockSizePrefs
{
- DockSizePrefs() { }
+ DockSizePrefs() {}
QList<QDockWidget*> docks;
QList<int> hDockSizes;
QList<int> vDockSizes;
@@ -63,32 +66,32 @@ struct DockSizePrefs
class BINARYNINJAUIAPI DockContextHandler
{
-protected:
+ protected:
QString m_name;
UIActionHandler m_actionHandler;
ContextMenuManager* m_contextMenuManager = nullptr;
Menu* m_menu = nullptr;
QWidget* m_parentWindow;
-public:
+ public:
DockContextHandler(QWidget* widget, const QString& name);
virtual ~DockContextHandler();
QString getName() const { return m_name; }
QWidget* getParentWindow() const { return m_parentWindow; }
- virtual void notifyFontChanged() { }
- virtual void notifyOffsetChanged(uint64_t /*offset*/) { }
- virtual void notifyThemeChanged() { }
- virtual void notifyViewChanged(ViewFrame* /*frame*/) { }
- virtual void notifyViewLocationChanged(View* /*view*/, const ViewLocation& /*viewLocation*/) { }
- virtual void notifyVisibilityChanged(bool /*visible*/) { }
+ virtual void notifyFontChanged() {}
+ virtual void notifyOffsetChanged(uint64_t /*offset*/) {}
+ virtual void notifyThemeChanged() {}
+ virtual void notifyViewChanged(ViewFrame* /*frame*/) {}
+ virtual void notifyViewLocationChanged(View* /*view*/, const ViewLocation& /*viewLocation*/) {}
+ virtual void notifyVisibilityChanged(bool /*visible*/) {}
virtual bool shouldBeVisible(ViewFrame* /*frame*/) { return true; }
};
Q_DECLARE_INTERFACE(DockContextHandler, "binary.ninja.dockcontexthandler/1.0");
-class BINARYNINJAUIAPI DockHandler: public QObject
+class BINARYNINJAUIAPI DockHandler : public QObject
{
Q_OBJECT
@@ -105,11 +108,13 @@ class BINARYNINJAUIAPI DockHandler: public QObject
friend class DockContextHandler;
std::map<QWidget*, DockContextHandler*> m_contexts;
- std::map<QString, std::pair<QString, std::function<QWidget*(const QString&, ViewFrame*, BinaryViewRef)>>> m_widgetFactories;
+ std::map<QString, std::pair<QString, std::function<QWidget*(const QString&, ViewFrame*, BinaryViewRef)>>>
+ m_widgetFactories;
DockContextHandler* getDockContextHandler(QWidget* widget);
- bool addDockWidget(const QString& name, QWidget* widget, Qt::DockWidgetArea area, Qt::Orientation orientation, bool defaultVisibility);
+ bool addDockWidget(const QString& name, QWidget* widget, Qt::DockWidgetArea area, Qt::Orientation orientation,
+ bool defaultVisibility);
-public:
+ public:
explicit DockHandler(QObject* parent, int windowIndex);
void close();
@@ -117,9 +122,14 @@ public:
void reset(bool initial = false);
void reset(const QString& name);
void resizeDocksOnShow(bool resizeDocks) { m_resizeDocksRequest = resizeDocks; }
- bool addDockWidget(QWidget* widget, Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, Qt::Orientation orientation = Qt::Horizontal, bool defaultVisibility = false);
- bool addDockWidget(const QString& name, const std::function<QWidget*(const QString&, ViewFrame*, BinaryViewRef)>& createWidget, Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, Qt::Orientation orientation = Qt::Horizontal, bool defaultVisibility = false);
- void createDynamicWidgets(ViewFrame* frame, BinaryViewRef data, std::map<QString, QPointer<QWidget>>& store, std::vector<QString> filter, bool isExcludeFilter = true);
+ bool addDockWidget(QWidget* widget, Qt::DockWidgetArea area = Qt::BottomDockWidgetArea,
+ Qt::Orientation orientation = Qt::Horizontal, bool defaultVisibility = false);
+ bool addDockWidget(const QString& name,
+ const std::function<QWidget*(const QString&, ViewFrame*, BinaryViewRef)>& createWidget,
+ Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, Qt::Orientation orientation = Qt::Horizontal,
+ bool defaultVisibility = false);
+ void createDynamicWidgets(ViewFrame* frame, BinaryViewRef data, std::map<QString, QPointer<QWidget>>& store,
+ std::vector<QString> filter, bool isExcludeFilter = true);
QDockWidget* getDockWidget(const QString& name);
ViewFrame* getViewFrame() { return m_viewFrame; }
bool isVisible(const QString& name);
@@ -139,10 +149,10 @@ public:
static DockHandler* getActiveDockHandler();
-Q_SIGNALS:
+ Q_SIGNALS:
void notifyVisibilityChanged();
-public Q_SLOTS:
+ public Q_SLOTS:
void viewChanged(ViewFrame* frame);
void visibilityChanged(bool visible);
void topLevelChanged(bool topLevel);
diff --git a/ui/expandablegroup.h b/ui/expandablegroup.h
index ee952171..1b28152e 100644
--- a/ui/expandablegroup.h
+++ b/ui/expandablegroup.h
@@ -10,18 +10,18 @@ class BINARYNINJAUIAPI ExpandableGroup : public QWidget
{
Q_OBJECT
-private:
+ private:
QToolButton* m_button;
QParallelAnimationGroup* m_animation;
QScrollArea* m_content;
int m_duration = 100;
-private Q_SLOTS:
+ private Q_SLOTS:
void toggled(bool expanded);
-public:
- explicit ExpandableGroup(QLayout* contentLayout, const QString& title = "", QWidget* parent = nullptr,
- bool expanded = false);
+ public:
+ explicit ExpandableGroup(
+ QLayout* contentLayout, const QString& title = "", QWidget* parent = nullptr, bool expanded = false);
void setupAnimation(QLayout* contentLayout);
void setTitle(const QString& title) { m_button->setText(title); }
void toggle(bool expanded);
diff --git a/ui/featuremap.h b/ui/featuremap.h
index 68fcab0a..93107eff 100644
--- a/ui/featuremap.h
+++ b/ui/featuremap.h
@@ -2,9 +2,9 @@
#include <QtGui/QColor>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-#include <QtWidgets/QAction>
+ #include <QtWidgets/QAction>
#else
-#include <QtGui/QAction>
+ #include <QtGui/QAction>
#endif
#include <QtGui/QImage>
#include <QtWidgets/QMenu>
@@ -27,7 +27,7 @@ class Menu;
class View;
class SplitPaneWidget;
-class BINARYNINJAUIAPI FeatureMap: public QWidget, public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI FeatureMap : public QWidget, public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
@@ -58,13 +58,13 @@ class BINARYNINJAUIAPI FeatureMap: public QWidget, public BinaryNinja::BinaryDat
Menu m_menu;
ContextMenuManager* m_contextMenuManager;
- class BackgroundRefresh: public BinaryNinja::RefCountObject
+ class BackgroundRefresh : public BinaryNinja::RefCountObject
{
std::mutex m_mutex;
bool m_valid;
QPointer<FeatureMap> m_featureMap;
- public:
+ public:
BackgroundRefresh(FeatureMap* featureMap);
void start();
void abort();
@@ -74,7 +74,7 @@ class BINARYNINJAUIAPI FeatureMap: public QWidget, public BinaryNinja::BinaryDat
void updateCoordinates();
-public:
+ public:
FeatureMap(SplitPaneWidget* owner, BinaryViewRef data, bool vertical = true);
virtual ~FeatureMap();
@@ -94,13 +94,14 @@ public:
virtual void OnDataVariableRemoved(BinaryNinja::BinaryView* data, const BinaryNinja::DataVariable& var) override;
virtual void OnDataVariableUpdated(BinaryNinja::BinaryView* data, const BinaryNinja::DataVariable& var) override;
virtual void OnStringFound(BinaryNinja::BinaryView* data, BNStringType type, uint64_t offset, size_t len) override;
- virtual void OnStringRemoved(BinaryNinja::BinaryView* data, BNStringType type, uint64_t offset, size_t len) override;
+ virtual void OnStringRemoved(
+ BinaryNinja::BinaryView* data, BNStringType type, uint64_t offset, size_t len) override;
void drawImageRect(uint64_t addr, size_t len, uint8_t color);
virtual QSize sizeHint() const override;
-protected:
+ protected:
virtual void contextMenuEvent(QContextMenuEvent* event) override;
virtual void mouseMoveEvent(QMouseEvent* event) override;
virtual void mousePressEvent(QMouseEvent* event) override;
@@ -108,10 +109,10 @@ protected:
virtual void paintEvent(QPaintEvent* event) override;
void scrollTo(int x, int y, bool addHistoryEntry = false);
-Q_SIGNALS:
+ Q_SIGNALS:
void notifyThemeUpdated();
-private Q_SLOTS:
+ private Q_SLOTS:
void refresh();
void updateThemeInternal();
void updateTimerEvent();
diff --git a/ui/filecontext.h b/ui/filecontext.h
index e31037ed..ef98d6a9 100644
--- a/ui/filecontext.h
+++ b/ui/filecontext.h
@@ -17,11 +17,11 @@ class SyncGroup;
// generator with a derived class with no base and a compiler error.
class FileContextBase
{
-public:
+ public:
FileContextBase() {}
};
-class BINARYNINJAUIAPI FileContext: public FileContextBase, public BinaryNinja::NavigationHandler
+class BINARYNINJAUIAPI FileContext : public FileContextBase, public BinaryNinja::NavigationHandler
{
QString m_filename;
bool m_isValidSaveFilename;
@@ -41,8 +41,9 @@ class BINARYNINJAUIAPI FileContext: public FileContextBase, public BinaryNinja::
void createBinaryViews();
-public:
- FileContext(FileMetadataRef file, BinaryViewRef rawData, const QString& filename = QString(), bool isValidSaveName = false, bool createViews = true);
+ public:
+ FileContext(FileMetadataRef file, BinaryViewRef rawData, const QString& filename = QString(),
+ bool isValidSaveName = false, bool createViews = true);
virtual ~FileContext();
void registerReference(QObject* widget);
@@ -54,7 +55,7 @@ public:
BinaryViewRef getRawData() const { return m_rawData; }
FileMetadataRef getMetadata() const { return m_file; }
QString getFilename() const { return m_filename; }
- void setFilename(QString newName) {m_filename = newName;}
+ void setFilename(QString newName) { m_filename = newName; }
ViewFrame* getCurrentViewFrame() const { return m_currentViewFrame; }
QString getTabName(QWidget* widget);
QString getShortFileName(QWidget* widget);
diff --git a/ui/filter.h b/ui/filter.h
index 7ed0ee78..ba186a38 100644
--- a/ui/filter.h
+++ b/ui/filter.h
@@ -6,7 +6,7 @@
class BINARYNINJAUIAPI FilterTarget
{
-public:
+ public:
virtual ~FilterTarget() {}
virtual void setFilter(const std::string& filter) = 0;
@@ -17,20 +17,20 @@ public:
virtual void closeFilter();
};
-class BINARYNINJAUIAPI FilterEdit: public QLineEdit
+class BINARYNINJAUIAPI FilterEdit : public QLineEdit
{
Q_OBJECT
FilterTarget* m_target;
-public:
+ public:
FilterEdit(FilterTarget* target);
-protected:
+ protected:
virtual void keyPressEvent(QKeyEvent* event) override;
};
-class BINARYNINJAUIAPI FilteredView: public QWidget
+class BINARYNINJAUIAPI FilteredView : public QWidget
{
Q_OBJECT
@@ -38,9 +38,8 @@ class BINARYNINJAUIAPI FilteredView: public QWidget
QWidget* m_widget;
FilterEdit* m_filter;
-public:
- FilteredView(QWidget* parent, QWidget* filtered, FilterTarget* target,
- FilterEdit* edit = nullptr);
+ public:
+ FilteredView(QWidget* parent, QWidget* filtered, FilterTarget* target, FilterEdit* edit = nullptr);
void setFilterPlaceholderText(const QString& text);
void updateFonts();
void clearFilter();
@@ -48,9 +47,9 @@ public:
static bool match(const std::string& name, const std::string& filter);
-protected:
+ protected:
virtual void keyPressEvent(QKeyEvent* event) override;
-private Q_SLOTS:
+ private Q_SLOTS:
void filterChanged(const QString& filter);
};
diff --git a/ui/flowgraphwidget.h b/ui/flowgraphwidget.h
index 2f294320..4de062f1 100644
--- a/ui/flowgraphwidget.h
+++ b/ui/flowgraphwidget.h
@@ -10,15 +10,16 @@
#include "commentdialog.h"
#include "instructionedit.h"
-class BINARYNINJAUIAPI GraphLayoutCompleteEvent: public QEvent
+class BINARYNINJAUIAPI GraphLayoutCompleteEvent : public QEvent
{
FlowGraphRef m_graph;
-public:
+
+ public:
GraphLayoutCompleteEvent(QEvent::Type type, const FlowGraphRef& graph);
FlowGraphRef GetGraph() { return m_graph; }
};
-class BINARYNINJAUIAPI FlowGraphHistoryEntry: public HistoryEntry
+class BINARYNINJAUIAPI FlowGraphHistoryEntry : public HistoryEntry
{
PlatformRef m_platform;
ArchitectureRef m_arch;
@@ -28,7 +29,7 @@ class BINARYNINJAUIAPI FlowGraphHistoryEntry: public HistoryEntry
uint64_t m_addr;
HighlightTokenState m_highlight;
-public:
+ public:
PlatformRef getPlatform() const { return m_platform; }
ArchitectureRef getArchitecture() const { return m_arch; }
uint64_t getFunction() const { return m_func; }
@@ -51,8 +52,11 @@ public:
virtual bool deserialize(const Json::Value& value) override;
};
-class BINARYNINJAUIAPI FlowGraphWidget: public QAbstractScrollArea, public View, public PreviewScrollHandler,
- public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI FlowGraphWidget :
+ public QAbstractScrollArea,
+ public View,
+ public PreviewScrollHandler,
+ public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
@@ -144,7 +148,7 @@ class BINARYNINJAUIAPI FlowGraphWidget: public QAbstractScrollArea, public View,
BNDeadStoreElimination getCurrentVariableDeadStoreElimination();
-protected:
+ protected:
virtual void paintEvent(QPaintEvent* event) override;
virtual void resizeEvent(QResizeEvent* event) override;
@@ -166,8 +170,8 @@ protected:
void navigateToAddress(uint64_t addr);
void navigateToGotoLabel(uint64_t label);
- void setGraphInternal(FlowGraphRef graph, BinaryNinja::Ref<FlowGraphHistoryEntry> entry, bool useAddr, uint64_t addr,
- bool notify, bool recenterWithPreviousGraph, size_t index = BN_INVALID_EXPR);
+ void setGraphInternal(FlowGraphRef graph, BinaryNinja::Ref<FlowGraphHistoryEntry> entry, bool useAddr,
+ uint64_t addr, bool notify, bool recenterWithPreviousGraph, size_t index = BN_INVALID_EXPR);
void up(bool selecting, size_t count = 1);
void down(bool selecting, size_t count = 1);
@@ -187,7 +191,7 @@ protected:
uint64_t getTokenAddress();
-public:
+ public:
FlowGraphWidget(QWidget* parent, BinaryViewRef view, FlowGraphRef graph = FlowGraphRef());
~FlowGraphWidget();
@@ -262,8 +266,8 @@ public:
bool paintMiniGraph(QWidget* owner, QPainter& p, QRect& miniRenderRect);
void paintNode(QPainter& p, FlowGraphNodeRef& node, int minY, int maxY);
- void paintHighlight(QPainter& p, const std::vector<BinaryNinja::DisassemblyTextLine>& lines,
- int nodeX, int nodeWidth, int x, int y, size_t line, int tagIndent);
+ void paintHighlight(QPainter& p, const std::vector<BinaryNinja::DisassemblyTextLine>& lines, int nodeX,
+ int nodeWidth, int x, int y, size_t line, int tagIndent);
void paintEdge(QPainter& p, const FlowGraphNodeRef& node, const BinaryNinja::FlowGraphEdge& edge);
void showAddress(uint64_t addr, bool select = false, bool center = false);
@@ -286,21 +290,21 @@ public:
virtual void onFunctionSelected(FunctionRef func);
virtual void onHighlightChanged(const HighlightTokenState& highlight);
-// protected:
+ // protected:
// These APIs are really supposed to be protected but since the bindings need to call them
// and they have out parameters (and thus need to be re-implemented) they must be public
bool getNodeForMouseEvent(QMouseEvent* event, FlowGraphNodeRef& node);
bool getLineForMouseEvent(QMouseEvent* event, CursorPosition& pos);
- bool getEdgeForMouseEvent(QMouseEvent* event, FlowGraphNodeRef& source,
- BinaryNinja::FlowGraphEdge& edge, bool& incoming);
+ bool getEdgeForMouseEvent(
+ QMouseEvent* event, FlowGraphNodeRef& source, BinaryNinja::FlowGraphEdge& edge, bool& incoming);
FlowGraphWidget* duplicate();
-Q_SIGNALS:
+ Q_SIGNALS:
void layoutComplete();
void updateMiniGraph();
-private Q_SLOTS:
+ private Q_SLOTS:
void loadingTimerEvent();
void updateTimerEvent();
void hoverTimerEvent();
diff --git a/ui/forminputdialog.h b/ui/forminputdialog.h
index 1a46d2ea..7c797366 100644
--- a/ui/forminputdialog.h
+++ b/ui/forminputdialog.h
@@ -9,7 +9,7 @@
#include "binaryninjaapi.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI FormInputDialog: public QDialog
+class BINARYNINJAUIAPI FormInputDialog : public QDialog
{
Q_OBJECT
@@ -20,9 +20,9 @@ class BINARYNINJAUIAPI FormInputDialog: public QDialog
void saveFileName(QLineEdit* edit, const std::string& ext, const std::string& defaultName);
void directoryName(QLineEdit* edit, const std::string& defaultName);
-public:
+ public:
FormInputDialog(QWidget* parent, std::vector<BinaryNinja::FormInputField>* fields, const std::string& title);
-protected Q_SLOTS:
+ protected Q_SLOTS:
void finish();
};
diff --git a/ui/getsymbolslistthread.h b/ui/getsymbolslistthread.h
index b806448a..220c8f84 100644
--- a/ui/getsymbolslistthread.h
+++ b/ui/getsymbolslistthread.h
@@ -1,8 +1,8 @@
#pragma once
#ifndef BINARYNINJAUI_BINDINGS
-#include <QtCore/QThread>
-#include <QtCore/QEvent>
+ #include <QtCore/QThread>
+ #include <QtCore/QEvent>
#endif
#include "binaryninjaapi.h"
#include "uitypes.h"
@@ -12,7 +12,7 @@
// QThread has issues working in the bindings on some platforms
class GetSymbolsListThread;
#else
-class BINARYNINJAUIAPI GetSymbolsListThread: public QThread
+class BINARYNINJAUIAPI GetSymbolsListThread : public QThread
{
Q_OBJECT
@@ -22,10 +22,10 @@ class BINARYNINJAUIAPI GetSymbolsListThread: public QThread
bool m_done;
BinaryViewRef m_view;
-protected:
+ protected:
virtual void run() override;
-public:
+ public:
GetSymbolsListThread(BinaryViewRef view, const std::function<void()>& completeFunc);
void cancel();
diff --git a/ui/globalarea.h b/ui/globalarea.h
index 2dffe3b0..1d0cd90b 100644
--- a/ui/globalarea.h
+++ b/ui/globalarea.h
@@ -5,46 +5,46 @@
#include "viewframe.h"
#include "tabwidget.h"
-class BINARYNINJAUIAPI GlobalAreaWidget: public QWidget
+class BINARYNINJAUIAPI GlobalAreaWidget : public QWidget
{
Q_OBJECT
-protected:
+ protected:
QString m_title;
UIActionHandler m_actionHandler;
ContextMenuManager* m_contextMenuManager = nullptr;
Menu* m_menu = nullptr;
-public:
+ public:
GlobalAreaWidget(const QString& title);
const QString& title() const { return m_title; }
- virtual void notifyFontChanged() { }
- virtual void notifyOffsetChanged(uint64_t /*offset*/) { }
- virtual void notifyThemeChanged() { }
- virtual void notifyViewChanged(ViewFrame* /*frame*/) { }
- virtual void notifyViewLocationChanged(View* /*view*/, const ViewLocation& /*viewLocation*/) { }
+ virtual void notifyFontChanged() {}
+ virtual void notifyOffsetChanged(uint64_t /*offset*/) {}
+ virtual void notifyThemeChanged() {}
+ virtual void notifyViewChanged(ViewFrame* /*frame*/) {}
+ virtual void notifyViewLocationChanged(View* /*view*/, const ViewLocation& /*viewLocation*/) {}
virtual void focus();
};
-class BINARYNINJAUIAPI GlobalAreaTabStyle: public DockableTabStyle
+class BINARYNINJAUIAPI GlobalAreaTabStyle : public DockableTabStyle
{
int closeButtonSize(const QWidget* widget) const;
-public:
- virtual QSize sizeForTab(const QWidget* widget, const DockableTabInfo& info, int idx,
- int count, int active) const override;
- virtual QRect closeButtonRect(const QWidget* widget, const DockableTabInfo& info, int idx,
- int count, int active) const override;
- virtual QRect closeIconRect(const QWidget* widget, const DockableTabInfo& info, int idx,
- int count, int active) const override;
- virtual void paintTab(const QWidget* widget, QStylePainter& p, const DockableTabInfo& info, int idx,
- int count, int active, DockableTabInteractionState state, const QRect& rect) const override;
+ public:
+ virtual QSize sizeForTab(
+ const QWidget* widget, const DockableTabInfo& info, int idx, int count, int active) const override;
+ virtual QRect closeButtonRect(
+ const QWidget* widget, const DockableTabInfo& info, int idx, int count, int active) const override;
+ virtual QRect closeIconRect(
+ const QWidget* widget, const DockableTabInfo& info, int idx, int count, int active) const override;
+ virtual void paintTab(const QWidget* widget, QStylePainter& p, const DockableTabInfo& info, int idx, int count,
+ int active, DockableTabInteractionState state, const QRect& rect) const override;
virtual DockableTabStyle* duplicate() override;
};
-class BINARYNINJAUIAPI CloseButton: public QWidget
+class BINARYNINJAUIAPI CloseButton : public QWidget
{
Q_OBJECT
@@ -52,11 +52,11 @@ class BINARYNINJAUIAPI CloseButton: public QWidget
bool m_buttonDown = false;
QTimer* m_timer;
-public:
+ public:
CloseButton();
virtual QSize sizeHint() const override;
-protected:
+ protected:
virtual void paintEvent(QPaintEvent* event) override;
virtual void enterEvent(QEnterEvent* event) override;
virtual void leaveEvent(QEvent* event) override;
@@ -64,14 +64,14 @@ protected:
virtual void mousePressEvent(QMouseEvent* event) override;
virtual void mouseReleaseEvent(QMouseEvent* event) override;
-private Q_SLOTS:
+ private Q_SLOTS:
void underMouseTimerEvent();
-Q_SIGNALS:
+ Q_SIGNALS:
void clicked();
};
-class BINARYNINJAUIAPI GlobalArea: public QWidget
+class BINARYNINJAUIAPI GlobalArea : public QWidget
{
Q_OBJECT
@@ -82,11 +82,11 @@ class BINARYNINJAUIAPI GlobalArea: public QWidget
static std::vector<std::function<GlobalAreaWidget*(UIContext*)>> m_widgetFactories;
- QString actionNameForWidget(const QString &title);
+ QString actionNameForWidget(const QString& title);
static QVariant sizesToVariant(const QList<int>& sizes);
static std::optional<QList<int>> variantToSizes(const QVariant& variant);
-public:
+ public:
GlobalArea();
void setSplitter(QSplitter* splitter);
@@ -120,7 +120,7 @@ public:
return context->globalArea();
}
- template<class T>
+ template <class T>
static T* widget(const QString& title)
{
GlobalArea* globalArea = current();
@@ -132,36 +132,34 @@ public:
return qobject_cast<T*>(widget);
}
- template<class T>
- static UIAction globalAreaAction(const QString& title,
- const std::function<void(T* obj)>& activate)
+ template <class T>
+ static UIAction globalAreaAction(const QString& title, const std::function<void(T* obj)>& activate)
{
- return globalAreaAction<T>(title,
- [=](T* obj, const UIActionContext&) { activate(obj); },
- [=](T*, const UIActionContext&) { return true; });
+ return globalAreaAction<T>(
+ title, [=](T* obj, const UIActionContext&) { activate(obj); },
+ [=](T*, const UIActionContext&) { return true; });
}
- template<class T>
- static UIAction globalAreaAction(const QString& title,
- const std::function<void(T* obj, const UIActionContext& ctxt)>& activate)
+ template <class T>
+ static UIAction globalAreaAction(
+ const QString& title, const std::function<void(T* obj, const UIActionContext& ctxt)>& activate)
{
- return globalAreaAction<T>(title, activate,
- [](T*, const UIActionContext&) { return true; });
+ return globalAreaAction<T>(title, activate, [](T*, const UIActionContext&) { return true; });
}
- template<class T>
- static UIAction globalAreaAction(const QString& title,
- const std::function<void(T* obj)>& activate, const std::function<bool(T* obj)>& isValid)
+ template <class T>
+ static UIAction globalAreaAction(
+ const QString& title, const std::function<void(T* obj)>& activate, const std::function<bool(T* obj)>& isValid)
{
- return globalAreaAction<T>(title,
- [=](T* obj, const UIActionContext&) { activate(obj); },
- [=](T* obj, const UIActionContext&) { return isValid(obj); });
+ return globalAreaAction<T>(
+ title, [=](T* obj, const UIActionContext&) { activate(obj); },
+ [=](T* obj, const UIActionContext&) { return isValid(obj); });
}
- template<class T>
+ template <class T>
static UIAction globalAreaAction(const QString& title,
- const std::function<void(T* obj, const UIActionContext& ctxt)>& activate,
- const std::function<bool(T* obj, const UIActionContext& ctxt)>& isValid)
+ const std::function<void(T* obj, const UIActionContext& ctxt)>& activate,
+ const std::function<bool(T* obj, const UIActionContext& ctxt)>& isValid)
{
std::function<T*(const UIActionContext& ctxt)> lookup = [=](const UIActionContext& ctxt) {
if (!ctxt.context)
@@ -175,30 +173,29 @@ public:
return qobject_cast<T*>(widget);
};
return UIAction(
- [=](const UIActionContext& ctxt) {
- T* obj = lookup(ctxt);
- if (obj)
- activate(obj, ctxt);
- },
- [=](const UIActionContext& ctxt) {
- T* obj = lookup(ctxt);
- if (obj)
- return isValid(obj, ctxt);
- return false;
- });
+ [=](const UIActionContext& ctxt) {
+ T* obj = lookup(ctxt);
+ if (obj)
+ activate(obj, ctxt);
+ },
+ [=](const UIActionContext& ctxt) {
+ T* obj = lookup(ctxt);
+ if (obj)
+ return isValid(obj, ctxt);
+ return false;
+ });
}
- template<class T>
- static std::function<bool(const UIActionContext&)> globalAreaActionChecked(const QString& title,
- const std::function<bool(T* obj)>& isChecked)
+ template <class T>
+ static std::function<bool(const UIActionContext&)> globalAreaActionChecked(
+ const QString& title, const std::function<bool(T* obj)>& isChecked)
{
- return globalAreaActionChecked<T>(title,
- [=](T* obj, const UIActionContext&) { return isChecked(obj); });
+ return globalAreaActionChecked<T>(title, [=](T* obj, const UIActionContext&) { return isChecked(obj); });
}
- template<class T>
- static std::function<bool(const UIActionContext&)> globalAreaActionChecked(const QString& title,
- const std::function<bool(T* obj, const UIActionContext& ctxt)>& isChecked)
+ template <class T>
+ static std::function<bool(const UIActionContext&)> globalAreaActionChecked(
+ const QString& title, const std::function<bool(T* obj, const UIActionContext& ctxt)>& isChecked)
{
return [=](const UIActionContext& ctxt) {
if (!ctxt.context)
@@ -216,10 +213,10 @@ public:
};
}
-Q_SIGNALS:
+ Q_SIGNALS:
void widgetClosed(GlobalAreaWidget* widget);
-private Q_SLOTS:
+ private Q_SLOTS:
void currentChanged(QWidget* widget);
void tabClosed(QWidget* widget);
void hideButtonClicked();
diff --git a/ui/hexeditor.h b/ui/hexeditor.h
index 0374f51d..5769ad47 100644
--- a/ui/hexeditor.h
+++ b/ui/hexeditor.h
@@ -11,11 +11,15 @@
#define HEX_EDITOR_UPDATE_CHECK_INTERVAL 200
-class BINARYNINJAUIAPI HexEditor : public QAbstractScrollArea, public View, public PreviewScrollHandler,
- public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI HexEditor :
+ public QAbstractScrollArea,
+ public View,
+ public PreviewScrollHandler,
+ public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
-public:
+
+ public:
explicit HexEditor(BinaryViewRef data, ViewFrame* view, uint64_t startAddr = 0);
virtual ~HexEditor();
@@ -55,25 +59,25 @@ public:
static void registerActions();
-private:
- class HexEditorHighlightWidget: public MenuHelper
+ private:
+ class HexEditorHighlightWidget : public MenuHelper
{
- public:
+ public:
HexEditorHighlightWidget(HexEditor* parent);
- protected:
+ protected:
virtual void showMenu();
- private:
+ private:
HexEditor* m_editor;
};
- class HexEditorOptionsIconWidget: public QWidget
+ class HexEditorOptionsIconWidget : public QWidget
{
- public:
+ public:
HexEditorOptionsIconWidget(HexEditor* parent);
- private:
+ private:
HexEditor* m_view;
ContextMenuManager* m_contextMenuManager;
Menu m_menu;
@@ -81,13 +85,13 @@ private:
void showMenu();
};
- class HexEditorStatusBarWidget: public StatusBarWidget
+ class HexEditorStatusBarWidget : public StatusBarWidget
{
- public:
+ public:
HexEditorStatusBarWidget(HexEditor* parent);
virtual void updateStatus() override;
- private:
+ private:
HexEditor* m_editor;
HexEditorHighlightWidget* m_highlight;
};
@@ -189,7 +193,7 @@ private:
ContextMenuManager* m_contextMenuManager;
-protected:
+ protected:
virtual void resizeEvent(QResizeEvent* event) override;
virtual void paintEvent(QPaintEvent* event) override;
virtual void focusInEvent(QFocusEvent* event) override;
@@ -201,25 +205,25 @@ protected:
virtual bool event(QEvent* event) override;
virtual void wheelEvent(QWheelEvent* event) override;
-Q_SIGNALS:
+ Q_SIGNALS:
-public Q_SLOTS:
+ public Q_SLOTS:
void disassembly();
void createFunc();
void createFuncWithPlatform(PlatformRef platform, bool autoSelect = false);
-private Q_SLOTS:
+ private Q_SLOTS:
void scrollBarMoved(int value);
void scrollBarAction(int action);
void cursorTimerEvent();
void updateTimerEvent();
};
-class HexEditorViewType: public ViewType
+class HexEditorViewType : public ViewType
{
static HexEditorViewType* m_instance;
-public:
+ public:
HexEditorViewType();
virtual int getPriority(BinaryViewRef data, const QString& filename) override;
virtual QWidget* create(BinaryViewRef data, ViewFrame* viewFrame) override;
diff --git a/ui/ilchooser.h b/ui/ilchooser.h
index acf1bd22..5779c7b2 100644
--- a/ui/ilchooser.h
+++ b/ui/ilchooser.h
@@ -3,32 +3,32 @@
#include "pane.h"
#include "menus.h"
-class BINARYNINJAUIAPI ILChooserWidget: public MenuHelper
+class BINARYNINJAUIAPI ILChooserWidget : public MenuHelper
{
Q_OBJECT
UIActionHandler* m_handler;
bool m_longDescription;
-public:
+ public:
ILChooserWidget(QWidget* parent, UIActionHandler* handler, bool longDescription);
void updateStatus(BNFunctionGraphType current);
static QString shortNameForILType(BNFunctionGraphType type);
static QString longNameForILType(BNFunctionGraphType type);
-protected:
+ protected:
virtual void showMenu() override;
};
-class BINARYNINJAUIAPI ViewPaneHeaderILChooserWidget: public ViewPaneHeaderSubtypeWidget
+class BINARYNINJAUIAPI ViewPaneHeaderILChooserWidget : public ViewPaneHeaderSubtypeWidget
{
Q_OBJECT
View* m_view;
ILChooserWidget* m_widget;
-public:
+ public:
ViewPaneHeaderILChooserWidget(View* view, UIActionHandler* handler);
virtual void updateStatus();
};
diff --git a/ui/instructionedit.h b/ui/instructionedit.h
index 9e388210..ea398f34 100644
--- a/ui/instructionedit.h
+++ b/ui/instructionedit.h
@@ -4,7 +4,7 @@
#include "binaryninjaapi.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI InstructionEdit: public QLineEdit
+class BINARYNINJAUIAPI InstructionEdit : public QLineEdit
{
Q_OBJECT
@@ -14,16 +14,16 @@ class BINARYNINJAUIAPI InstructionEdit: public QLineEdit
uint64_t m_offset;
bool m_preventDismiss;
-public:
+ public:
InstructionEdit(QWidget* parent, BinaryViewRef data, ArchitectureRef arch, FunctionRef func, uint64_t offset);
void acceptInstruction();
void rejectInstruction();
-protected:
+ protected:
virtual void keyPressEvent(QKeyEvent* event);
virtual void focusOutEvent(QFocusEvent* event);
-Q_SIGNALS:
+ Q_SIGNALS:
void done();
};
diff --git a/ui/linearview.h b/ui/linearview.h
index f27897a1..312299e9 100644
--- a/ui/linearview.h
+++ b/ui/linearview.h
@@ -14,9 +14,9 @@
#include <assembledialog.h>
#define LINEAR_VIEW_UPDATE_CHECK_INTERVAL 200
-#define MAX_STRING_TYPE_LENGTH 1048576
+#define MAX_STRING_TYPE_LENGTH 1048576
-struct BINARYNINJAUIAPI LinearViewLine: public BinaryNinja::LinearDisassemblyLine
+struct BINARYNINJAUIAPI LinearViewLine : public BinaryNinja::LinearDisassemblyLine
{
BinaryNinja::Ref<BinaryNinja::LinearViewCursor> cursor;
size_t cursorSize;
@@ -52,7 +52,7 @@ struct BINARYNINJAUIAPI LinearViewCursorPosition
LinearViewCursorPosition AsLine() const;
};
-class BINARYNINJAUIAPI LinearViewHistoryEntry: public HistoryEntry
+class BINARYNINJAUIAPI LinearViewHistoryEntry : public HistoryEntry
{
std::vector<BinaryNinja::LinearViewObjectIdentifier> m_topPath;
size_t m_topLineIndex;
@@ -65,7 +65,7 @@ class BINARYNINJAUIAPI LinearViewHistoryEntry: public HistoryEntry
bool m_inFunc = false;
HighlightTokenState m_highlight;
-public:
+ public:
const std::vector<BinaryNinja::LinearViewObjectIdentifier>& getTopPath() const { return m_topPath; }
size_t getTopLineIndex() const { return m_topLineIndex; }
uint64_t getTopAddress() const { return m_topAddr; }
@@ -92,28 +92,28 @@ public:
virtual bool deserialize(const Json::Value& value) override;
};
-class BINARYNINJAUIAPI LinearView: public QAbstractScrollArea, public View, public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI LinearView : public QAbstractScrollArea, public View, public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
- class LinearViewOptionsWidget: public MenuHelper
+ class LinearViewOptionsWidget : public MenuHelper
{
- public:
+ public:
LinearViewOptionsWidget(LinearView* parent);
- protected:
+ protected:
virtual void showMenu();
- private:
+ private:
LinearView* m_view;
};
- class LinearViewOptionsIconWidget: public QWidget
+ class LinearViewOptionsIconWidget : public QWidget
{
- public:
+ public:
LinearViewOptionsIconWidget(LinearView* parent);
- private:
+ private:
LinearView* m_view;
ContextMenuManager* m_contextMenuManager;
Menu m_menu;
@@ -121,13 +121,13 @@ class BINARYNINJAUIAPI LinearView: public QAbstractScrollArea, public View, publ
void showMenu();
};
- class LinearViewStatusBarWidget: public StatusBarWidget
+ class LinearViewStatusBarWidget : public StatusBarWidget
{
- public:
+ public:
LinearViewStatusBarWidget(LinearView* parent);
virtual void updateStatus() override;
- private:
+ private:
LinearView* m_view;
LinearViewOptionsWidget* m_options;
ILChooserWidget* m_chooser;
@@ -196,8 +196,8 @@ class BINARYNINJAUIAPI LinearView: public QAbstractScrollArea, public View, publ
void updateBounds();
void refreshAtCurrentLocation(bool cursorFixup = false);
bool navigateToAddress(uint64_t addr, bool center, bool updateHighlight, bool navByRef = false);
- bool navigateToLine(FunctionRef func, uint64_t offset, size_t instrIndex, bool center,
- bool updateHighlight, bool navByRef = false);
+ bool navigateToLine(
+ FunctionRef func, uint64_t offset, size_t instrIndex, bool center, bool updateHighlight, bool navByRef = false);
bool navigateToGotoLabel(uint64_t label);
void viewData();
@@ -206,8 +206,8 @@ class BINARYNINJAUIAPI LinearView: public QAbstractScrollArea, public View, publ
void bindActions();
static void addOptionsMenuActions(Menu& menu);
- void getHexDumpLineBytes(const BinaryNinja::LinearDisassemblyLine& line, size_t& skippedBytes, size_t& totalBytes,
- size_t& totalCols);
+ void getHexDumpLineBytes(
+ const BinaryNinja::LinearDisassemblyLine& line, size_t& skippedBytes, size_t& totalBytes, size_t& totalCols);
void paintHexDumpLine(QPainter& p, const LinearViewLine& line, int xoffset, int y, uint32_t addrLen, int tagOffset);
void paintAnalysisWarningLine(QPainter& p, const LinearViewLine& line, int xoffset, int y);
@@ -220,9 +220,10 @@ class BINARYNINJAUIAPI LinearView: public QAbstractScrollArea, public View, publ
TypeRef createStructure(BinaryNinja::QualifiedName& name, uint64_t size);
TypeRef getInnerType(TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
- StructureRef defineInnerType(TypeRef type, TypeRef baseType, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
- StructureRef defineInnerPointer(TypeRef type, ArchitectureRef arch, uint64_t baseAddress,
- uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
+ StructureRef defineInnerType(
+ TypeRef type, TypeRef baseType, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
+ StructureRef defineInnerPointer(TypeRef type, ArchitectureRef arch, uint64_t baseAddress, uint64_t offset,
+ uint64_t size, std::set<TypeRef>& seen);
StructureRef defineInnerStruct(TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
StructureRef defineInnerArray(TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
StructureRef defineInnerName(TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
@@ -236,8 +237,7 @@ class BINARYNINJAUIAPI LinearView: public QAbstractScrollArea, public View, publ
bool updateCursor(LinearViewCursorPosition& cursorToUpdate, BinaryNinja::LinearViewCursor* matched, bool fullMatch);
bool updateCursor(LinearViewCursorPosition& cursorToUpdate, BinaryNinja::LinearViewCursor* newCursor);
bool updateCursor(LinearViewCursorPosition& cursorToUpdate,
- const std::vector<BinaryNinja::LinearViewObjectIdentifier>& path,
- BinaryNinja::LinearViewCursor* newCursor);
+ const std::vector<BinaryNinja::LinearViewObjectIdentifier>& path, BinaryNinja::LinearViewCursor* newCursor);
uint64_t getOrderingIndexForLine(const LinearViewLine& line);
void updateAnalysisRequestorsForCache();
@@ -247,14 +247,14 @@ class BINARYNINJAUIAPI LinearView: public QAbstractScrollArea, public View, publ
BNAnalysisWarningActionType getAnalysisWarningActionAtPos(const LinearViewLine& line, int x);
- void getCurrentOffsetByTypeInternal(TypeRef resType, uint64_t baseAddr, uint64_t& begin, uint64_t& end,
- bool singleLine, std::set<TypeRef>& seen);
+ void getCurrentOffsetByTypeInternal(
+ TypeRef resType, uint64_t baseAddr, uint64_t& begin, uint64_t& end, bool singleLine, std::set<TypeRef>& seen);
BNDeadStoreElimination getCurrentVariableDeadStoreElimination();
void setDataButtonVisible(bool visible);
-private Q_SLOTS:
+ private Q_SLOTS:
void adjustSize(int width, int height);
void viewInHexEditor();
void viewInGraph();
@@ -334,10 +334,10 @@ private Q_SLOTS:
void setCurrentVariableDeadStoreElimination(BNDeadStoreElimination elimination);
-Q_SIGNALS:
+ Q_SIGNALS:
void notifyResizeEvent(int width, int height);
-public:
+ public:
explicit LinearView(BinaryViewRef data, ViewFrame* view);
virtual ~LinearView();
@@ -422,7 +422,7 @@ public:
static void registerActions();
-protected:
+ protected:
virtual void resizeEvent(QResizeEvent* event) override;
virtual void paintEvent(QPaintEvent* event) override;
virtual void wheelEvent(QWheelEvent* event) override;
@@ -444,11 +444,11 @@ protected:
void navigateToHighlightedToken();
};
-class LinearViewType: public ViewType
+class LinearViewType : public ViewType
{
static LinearViewType* m_instance;
-public:
+ public:
LinearViewType();
virtual int getPriority(BinaryViewRef data, const QString& filename) override;
virtual QWidget* create(BinaryViewRef data, ViewFrame* viewFrame) override;
diff --git a/ui/logview.h b/ui/logview.h
index bf9d4627..2a83d919 100644
--- a/ui/logview.h
+++ b/ui/logview.h
@@ -28,11 +28,12 @@ struct BINARYNINJAUIAPI LogListItem
std::string text;
bool selected;
- LogListItem(BNLogLevel level, std::string text, bool selected = false) : level(level), text(text), selected(selected) { };
+ LogListItem(BNLogLevel level, std::string text, bool selected = false) :
+ level(level), text(text), selected(selected) {};
};
-class BINARYNINJAUIAPI LogListModel: public QAbstractItemModel, public BinaryNinja::LogListener
+class BINARYNINJAUIAPI LogListModel : public QAbstractItemModel, public BinaryNinja::LogListener
{
Q_OBJECT
@@ -45,7 +46,7 @@ class BINARYNINJAUIAPI LogListModel: public QAbstractItemModel, public BinaryNin
std::mutex m_mutex;
std::mutex m_pendingMutex;
-public:
+ public:
LogListModel(QWidget* parent);
~LogListModel();
@@ -65,12 +66,12 @@ public:
virtual QVariant data(const QModelIndex& i, int role) const override;
virtual bool setData(const QModelIndex& i, const QVariant& value, int role) override;
-public Q_SLOTS:
+ public Q_SLOTS:
void notifyDataChanged();
};
-class BINARYNINJAUIAPI LogItemDelegate: public QStyledItemDelegate
+class BINARYNINJAUIAPI LogItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
@@ -84,25 +85,26 @@ class BINARYNINJAUIAPI LogItemDelegate: public QStyledItemDelegate
bool IsNavigable(const QString& str, const std::pair<int, int>& offsetLen, uint64_t& value, bool highlight) const;
-public:
+ public:
LogItemDelegate(QWidget* parent);
void updateFonts();
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& idx) const override;
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& idx) const override;
-protected:
- bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) override;
+ protected:
+ bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option,
+ const QModelIndex& index) override;
-Q_SIGNALS:
+ Q_SIGNALS:
void notifyDataChanged();
-public Q_SLOTS:
+ public Q_SLOTS:
void viewChanged(QWidget* frame);
};
-class BINARYNINJAUIAPI LogView: public GlobalAreaWidget
+class BINARYNINJAUIAPI LogView : public GlobalAreaWidget
{
Q_OBJECT
@@ -117,7 +119,7 @@ class BINARYNINJAUIAPI LogView: public GlobalAreaWidget
bool m_scrolledToEnd;
bool m_hasSelection = false;
-public:
+ public:
LogView(LogStatus* logStatus);
virtual void copy();
@@ -135,17 +137,17 @@ public:
LogListModel* model() { return m_listModel; }
-protected:
+ protected:
void contextMenuEvent(QContextMenuEvent* event) override;
-Q_SIGNALS:
+ Q_SIGNALS:
void notifyUiStatus();
void viewChanged(QWidget* frame);
-public Q_SLOTS:
+ public Q_SLOTS:
void clear();
-private Q_SLOTS:
+ private Q_SLOTS:
void scrollRangeChanged(int minimum, int maximum);
void scrollValueChanged(int value);
void updateSelection(const QItemSelection& selected, const QItemSelection& deselected);
@@ -154,7 +156,7 @@ private Q_SLOTS:
};
-class BINARYNINJAUIAPI LogStatus: public QWidget
+class BINARYNINJAUIAPI LogStatus : public QWidget
{
Q_OBJECT
@@ -164,7 +166,7 @@ class BINARYNINJAUIAPI LogStatus: public QWidget
int m_errorCount = 0;
int m_warnCount = 0;
-public:
+ public:
LogStatus(QWidget* parent);
void incrementErrorCount(int count);
@@ -173,6 +175,6 @@ public:
void updateTheme();
-private Q_SLOTS:
+ private Q_SLOTS:
void clearStatus();
};
diff --git a/ui/menus.h b/ui/menus.h
index 59791884..20464d62 100644
--- a/ui/menus.h
+++ b/ui/menus.h
@@ -12,7 +12,7 @@
#include "action.h"
#include "viewframe.h"
-class BINARYNINJAUIAPI ContextMenuManager: public QObject
+class BINARYNINJAUIAPI ContextMenuManager : public QObject
{
Q_OBJECT
@@ -20,8 +20,8 @@ class BINARYNINJAUIAPI ContextMenuManager: public QObject
QPointer<QMenu> m_menu;
MenuInstance* m_instance;
-public:
- ContextMenuManager(): m_parent(nullptr), m_menu(nullptr), m_instance(nullptr) { }
+ public:
+ ContextMenuManager() : m_parent(nullptr), m_menu(nullptr), m_instance(nullptr) {}
ContextMenuManager(QWidget* parent);
~ContextMenuManager();
QMenu* create();
@@ -31,13 +31,13 @@ public:
MenuInstance* show(QPoint pos, Menu* source, UIActionHandler* handler);
bool isActive() { return !m_menu.isNull(); }
-Q_SIGNALS:
+ Q_SIGNALS:
void onOpen();
void onClose();
};
-class BINARYNINJAUIAPI MenuHelper: public QLabel
+class BINARYNINJAUIAPI MenuHelper : public QLabel
{
Q_OBJECT
@@ -48,15 +48,15 @@ class BINARYNINJAUIAPI MenuHelper: public QLabel
QPalette::ColorRole m_activeForegroundRole;
QPalette::ColorRole m_pressedForegroundRole;
-protected:
+ protected:
Menu m_menu;
ContextMenuManager* m_contextMenuManager;
QTimer* m_timer;
bool m_active;
bool m_pressed;
-public:
- MenuHelper() { }
+ public:
+ MenuHelper() {}
explicit MenuHelper(QWidget* parent);
void setBackgroundColorRole(QPalette::ColorRole role);
@@ -66,16 +66,16 @@ public:
void setActiveForegroundColorRole(QPalette::ColorRole role);
void setPressedForegroundColorRole(QPalette::ColorRole role);
-Q_SIGNALS:
+ Q_SIGNALS:
void clicked();
-protected Q_SLOTS:
+ protected Q_SLOTS:
virtual void showMenu() = 0;
-private Q_SLOTS:
+ private Q_SLOTS:
void underMouseTimerEvent();
-protected:
+ protected:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void enterEvent(QEvent* event) override;
#else
diff --git a/ui/minigraph.h b/ui/minigraph.h
index 69b59768..a4be4368 100644
--- a/ui/minigraph.h
+++ b/ui/minigraph.h
@@ -13,7 +13,7 @@ class FlowGraphWidget;
class Menu;
class ViewFrame;
-class BINARYNINJAUIAPI MiniGraph: public SidebarWidget, public UIContextNotification
+class BINARYNINJAUIAPI MiniGraph : public SidebarWidget, public UIContextNotification
{
Q_OBJECT
@@ -23,7 +23,7 @@ class BINARYNINJAUIAPI MiniGraph: public SidebarWidget, public UIContextNotifica
bool m_popout;
QRect m_miniRenderRect;
-public:
+ public:
MiniGraph(bool popout = false);
~MiniGraph();
@@ -38,23 +38,23 @@ public:
void setSource(ViewFrame* frame, FlowGraphWidget* graphView);
-protected:
+ protected:
virtual void contextMenuEvent(QContextMenuEvent* event) override;
virtual void mouseMoveEvent(QMouseEvent* event) override;
virtual void mousePressEvent(QMouseEvent* event) override;
virtual void paintEvent(QPaintEvent* event) override;
virtual void scrollTo(int x, int y);
-public Q_SLOTS:
+ public Q_SLOTS:
void notifyUpdate();
void graphDestroyed();
void newPane();
};
-class BINARYNINJAUIAPI MiniGraphSidebarWidgetType: public SidebarWidgetType
+class BINARYNINJAUIAPI MiniGraphSidebarWidgetType : public SidebarWidgetType
{
-public:
+ public:
MiniGraphSidebarWidgetType();
virtual SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;
virtual bool isInReferenceArea() const override { return true; }
diff --git a/ui/options.h b/ui/options.h
index e3c2eab4..c0b9d77e 100644
--- a/ui/options.h
+++ b/ui/options.h
@@ -15,7 +15,7 @@
#include <tuple>
#include <vector>
-class BINARYNINJAUIAPI OptionsDialog: public QDialog
+class BINARYNINJAUIAPI OptionsDialog : public QDialog
{
Q_OBJECT
@@ -32,15 +32,15 @@ class BINARYNINJAUIAPI OptionsDialog: public QDialog
BinaryViewRef m_rawData = nullptr;
std::vector<std::tuple<std::string, size_t, std::string, uint64_t, uint64_t, std::string>> m_objects;
-public:
+ public:
OptionsDialog(QWidget* parent, const QString& name);
virtual ~OptionsDialog();
bool loadViews();
-Q_SIGNALS:
+ Q_SIGNALS:
void openFile(FileContext* file);
-private Q_SLOTS:
+ private Q_SLOTS:
void cancel();
void open();
void addSettingsViewForType(const std::string& bvtName);
diff --git a/ui/pane.h b/ui/pane.h
index 0fe3e8ec..5b02862d 100644
--- a/ui/pane.h
+++ b/ui/pane.h
@@ -15,7 +15,7 @@ class CloseButton;
class TabDragIndicator;
class SyncGroup;
-class BINARYNINJAUIAPI Pane: public QWidget
+class BINARYNINJAUIAPI Pane : public QWidget
{
Q_OBJECT
@@ -26,7 +26,7 @@ class BINARYNINJAUIAPI Pane: public QWidget
bool m_active = false;
QVBoxLayout* m_layout = nullptr;
-public:
+ public:
Pane(QWidget* widget);
QWidget* widget() const { return m_widget; }
@@ -45,17 +45,17 @@ public:
void setWidget(QWidget* widget);
-protected:
+ protected:
void init(PaneHeader* header);
-Q_SIGNALS:
+ Q_SIGNALS:
void paneCloseRequested();
void paneSplitRequested(Pane* newPane, Qt::Edge edge);
void movePane(Pane* target, Qt::Edge edge);
void newWindowForPane(QScreen* screen, QPoint pos);
void notifyViewChanged(ViewFrame* frame);
-public Q_SLOTS:
+ public Q_SLOTS:
void splitButtonClicked(Qt::Orientation orientation);
void closeButtonClicked();
void headerClicked();
@@ -63,7 +63,7 @@ public Q_SLOTS:
void newWindowForPaneRequested(QScreen* screen, QPoint pos);
};
-class BINARYNINJAUIAPI SplitButton: public ClickableIcon
+class BINARYNINJAUIAPI SplitButton : public ClickableIcon
{
Q_OBJECT
@@ -75,24 +75,24 @@ class BINARYNINJAUIAPI SplitButton: public ClickableIcon
void splitHorizontal();
void splitVertical();
-public:
+ public:
SplitButton();
void setDefaultOrientation(Qt::Orientation orientation);
Qt::Orientation orientation() const;
Qt::Orientation defaultOrientation() const { return m_defaultOrientation; }
-protected:
+ protected:
virtual void enterEvent(QEnterEvent* event) override;
virtual void leaveEvent(QEvent* event) override;
virtual bool eventFilter(QObject* obj, QEvent* event) override;
virtual void mousePressEvent(QMouseEvent* event) override;
-Q_SIGNALS:
+ Q_SIGNALS:
void splitWithDirection(Qt::Orientation orientation);
};
-class BINARYNINJAUIAPI PaneHeader: public QWidget
+class BINARYNINJAUIAPI PaneHeader : public QWidget
{
Q_OBJECT
@@ -104,17 +104,17 @@ class BINARYNINJAUIAPI PaneHeader: public QWidget
Qt::Edge m_dropEdge = Qt::RightEdge;
QRubberBand* m_dropIndicator = nullptr;
-public:
+ public:
PaneHeader();
void setOwner(Pane* pane) { m_owner = pane; }
-protected:
+ protected:
virtual void mousePressEvent(QMouseEvent* event) override;
virtual void mouseMoveEvent(QMouseEvent* event) override;
virtual void mouseReleaseEvent(QMouseEvent* event) override;
-Q_SIGNALS:
+ Q_SIGNALS:
void paneCloseRequested();
void paneSplitRequested(Qt::Orientation orientation);
void movePane(Pane* target, Qt::Edge edge);
@@ -125,7 +125,7 @@ Q_SIGNALS:
class ViewFrame;
class ViewPaneHeader;
-class BINARYNINJAUIAPI ViewPane: public Pane
+class BINARYNINJAUIAPI ViewPane : public Pane
{
Q_OBJECT
@@ -133,7 +133,7 @@ class BINARYNINJAUIAPI ViewPane: public Pane
UIActionHandler m_actionHandler;
ViewPaneHeader* m_header;
-public:
+ public:
ViewPane(ViewFrame* frame);
ViewFrame* viewFrame() const { return m_frame; }
@@ -148,7 +148,7 @@ public:
void recreateViewFrame(std::map<SyncGroup*, ViewLocation>& locations);
void sendViewChange();
-private Q_SLOTS:
+ private Q_SLOTS:
void viewChanged(ViewFrame* frame);
void viewChangeRequested(QString type);
};
@@ -157,16 +157,16 @@ class DataTypeList;
class ViewList;
class SyncGroupWidget;
-class BINARYNINJAUIAPI ViewPaneHeaderSubtypeWidget: public QWidget
+class BINARYNINJAUIAPI ViewPaneHeaderSubtypeWidget : public QWidget
{
Q_OBJECT
-public:
+ public:
ViewPaneHeaderSubtypeWidget() {}
virtual void updateStatus() = 0;
};
-class BINARYNINJAUIAPI ViewPaneHeader: public PaneHeader
+class BINARYNINJAUIAPI ViewPaneHeader : public PaneHeader
{
Q_OBJECT
@@ -183,7 +183,7 @@ class BINARYNINJAUIAPI ViewPaneHeader: public PaneHeader
SplitButton* m_splitButton;
-public:
+ public:
ViewPaneHeader(ViewPane* owner, UIActionHandler* handler);
void updateStatus();
@@ -191,47 +191,47 @@ public:
void setDefaultSplitDirection(Qt::Orientation orientation);
void setViewFrame(ViewFrame* frame);
-Q_SIGNALS:
+ Q_SIGNALS:
void viewChanged(QString type);
-private Q_SLOTS:
+ private Q_SLOTS:
void splitButtonClicked();
void splitButtonClickedWithDirection(Qt::Orientation orientation);
void viewChangeRequested(QString type);
void updateViewType(ViewFrame* frame);
};
-class BINARYNINJAUIAPI WidgetPane: public Pane
+class BINARYNINJAUIAPI WidgetPane : public Pane
{
Q_OBJECT
QString m_title;
-public:
+ public:
WidgetPane(QWidget* widget, QString title);
virtual QString title() override { return m_title; }
virtual void updateStatus() override;
-Q_SIGNALS:
+ Q_SIGNALS:
void updateWidgetStatus();
};
-class BINARYNINJAUIAPI WidgetPaneHeader: public PaneHeader
+class BINARYNINJAUIAPI WidgetPaneHeader : public PaneHeader
{
Q_OBJECT
QString m_title;
-public:
+ public:
WidgetPaneHeader(const QString& title);
-protected:
+ protected:
virtual void paintEvent(QPaintEvent* event) override;
};
class SplitPaneWidget;
-class BINARYNINJAUIAPI SplitPaneContainer: public QWidget
+class BINARYNINJAUIAPI SplitPaneContainer : public QWidget
{
Q_OBJECT
@@ -255,7 +255,7 @@ class BINARYNINJAUIAPI SplitPaneContainer: public QWidget
void deactivateIfCurrent(Pane* pane);
void notifyCurrentChanged(Pane* pane);
-public:
+ public:
SplitPaneContainer(Pane* initial);
Pane* currentPane() const { return m_currentChild; }
ViewPane* currentViewPane() const { return m_currentViewPane; }
@@ -284,7 +284,7 @@ public:
void recreateViewFrames(std::map<SyncGroup*, ViewLocation>& locations);
-Q_SIGNALS:
+ Q_SIGNALS:
void paneClosed(Pane* pane);
void currentChanged(Pane* pane);
void layoutChanged();
@@ -292,7 +292,7 @@ Q_SIGNALS:
void lastPaneClosed();
void newWindowForPane(SplitPaneWidget* paneWidget, QRect rect);
-private Q_SLOTS:
+ private Q_SLOTS:
void paneCloseRequested();
void paneSplitRequested(Pane* newPane, Qt::Edge edge);
void movePane(Pane* target, Qt::Edge edge);
@@ -303,7 +303,7 @@ private Q_SLOTS:
void childViewChanged(ViewFrame* frame);
};
-class BINARYNINJAUIAPI SplitPaneWidget: public QWidget
+class BINARYNINJAUIAPI SplitPaneWidget : public QWidget
{
Q_OBJECT
@@ -318,7 +318,7 @@ class BINARYNINJAUIAPI SplitPaneWidget: public QWidget
void bindActions();
-public:
+ public:
SplitPaneWidget(Pane* initial, FileContext* fileContext);
Pane* currentPane() const;
ViewPane* currentViewPane() const;
@@ -357,14 +357,14 @@ public:
static void registerActions();
-Q_SIGNALS:
+ Q_SIGNALS:
void paneClosed(Pane* pane);
void currentChanged(Pane* pane);
void layoutChanged();
void notifyViewChanged(ViewFrame* frame);
void newWindowForPane(SplitPaneWidget* paneWidget, QRect rect);
-private Q_SLOTS:
+ private Q_SLOTS:
void containerPaneClosed(Pane* pane);
void containerCurrentChanged(Pane* pane);
void containerLayoutChanged();
diff --git a/ui/platformdialog.h b/ui/platformdialog.h
index 01f2c75f..071d4f8e 100644
--- a/ui/platformdialog.h
+++ b/ui/platformdialog.h
@@ -5,7 +5,7 @@
#include "binaryninjaapi.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI PlatformDialog: public QDialog
+class BINARYNINJAUIAPI PlatformDialog : public QDialog
{
Q_OBJECT
@@ -16,13 +16,13 @@ class BINARYNINJAUIAPI PlatformDialog: public QDialog
std::map<QString, PlatformRef> m_platformsByName;
PlatformRef m_selectedPlatform;
-public:
+ public:
PlatformDialog(QWidget* parent, ArchitectureRef defaultArch = nullptr);
PlatformRef getPlatform();
void saveDefaults();
-private Q_SLOTS:
+ private Q_SLOTS:
void architectureChanged(const QString& name);
void osChanged(const QString& name);
diff --git a/ui/possiblevaluesetdialog.h b/ui/possiblevaluesetdialog.h
index d2229de7..8202fca0 100644
--- a/ui/possiblevaluesetdialog.h
+++ b/ui/possiblevaluesetdialog.h
@@ -7,7 +7,7 @@
#include "uitypes.h"
-class BINARYNINJAUIAPI PossibleValueSetDialog: public QDialog
+class BINARYNINJAUIAPI PossibleValueSetDialog : public QDialog
{
Q_OBJECT
@@ -26,8 +26,9 @@ class BINARYNINJAUIAPI PossibleValueSetDialog: public QDialog
BinaryNinja::PossibleValueSet m_valueSet;
-public:
- PossibleValueSetDialog(QWidget* parent, BinaryViewRef view, uint64_t addr, BinaryNinja::PossibleValueSet existingValue);
+ public:
+ PossibleValueSetDialog(
+ QWidget* parent, BinaryViewRef view, uint64_t addr, BinaryNinja::PossibleValueSet existingValue);
BinaryNinja::PossibleValueSet getPossibleValueSet() const { return m_valueSet; }
void validate(const QString& input);
diff --git a/ui/preview.h b/ui/preview.h
index 670e8fb9..4ce1e3b2 100644
--- a/ui/preview.h
+++ b/ui/preview.h
@@ -6,23 +6,23 @@
class BINARYNINJAUIAPI PreviewScrollHandler
{
-public:
+ public:
virtual ~PreviewScrollHandler() {}
virtual void sendWheelEvent(QWheelEvent* event) = 0;
};
-class BINARYNINJAUIAPI PreviewWidget: public QFrame
+class BINARYNINJAUIAPI PreviewWidget : public QFrame
{
Q_OBJECT
QWidget* m_contents;
PreviewScrollHandler* m_scrollHandler;
-protected:
+ protected:
virtual bool eventFilter(QObject* obj, QEvent* event) override;
virtual void wheelEvent(QWheelEvent* event) override;
-public:
+ public:
PreviewWidget();
virtual ~PreviewWidget();
diff --git a/ui/progressindicator.h b/ui/progressindicator.h
index 56976f31..2e2829e9 100644
--- a/ui/progressindicator.h
+++ b/ui/progressindicator.h
@@ -27,104 +27,108 @@
/*!
\class QProgressIndicator
- \brief The QProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way.
+ \brief The QProgressIndicator class lets an application display a progress indicator to show that a lengthy task is
+ under way.
Progress indicators are indeterminate and do nothing more than spin to show that the application is busy.
\sa QProgressBar
*/
class BINARYNINJAUIAPI QProgressIndicator : public QWidget
{
- Q_OBJECT
- Q_PROPERTY(int delay READ animationDelay WRITE setAnimationDelay)
- Q_PROPERTY(bool displayedWhenStopped READ isDisplayedWhenStopped WRITE setDisplayedWhenStopped)
- Q_PROPERTY(QColor color READ color WRITE setColor)
- int m_width = 18;
+ Q_OBJECT
+ Q_PROPERTY(int delay READ animationDelay WRITE setAnimationDelay)
+ Q_PROPERTY(bool displayedWhenStopped READ isDisplayedWhenStopped WRITE setDisplayedWhenStopped)
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+ int m_width = 18;
-public:
- QProgressIndicator(QWidget* parent = 0);
+ public:
+ QProgressIndicator(QWidget* parent = 0);
- /*! Returns the delay between animation steps.
- \return The number of milliseconds between animation steps. By default, the animation delay is set to 40 milliseconds.
- \sa setAnimationDelay
- */
- int animationDelay() const { return m_delay; }
+ /*! Returns the delay between animation steps.
+ \return The number of milliseconds between animation steps. By default, the animation delay is set to 40
+ milliseconds. \sa setAnimationDelay
+ */
+ int animationDelay() const { return m_delay; }
- /*! Returns a Boolean value indicating whether the component is currently animated.
- \return Animation state.
- \sa startAnimation stopAnimation
- */
- bool isAnimated () const;
+ /*! Returns a Boolean value indicating whether the component is currently animated.
+ \return Animation state.
+ \sa startAnimation stopAnimation
+ */
+ bool isAnimated() const;
- /*! Returns a Boolean value indicating whether the receiver shows itself even when it is not animating.
- \return Return true if the progress indicator shows itself even when it is not animating. By default, it returns false.
- \sa setDisplayedWhenStopped
- */
- bool isDisplayedWhenStopped() const;
+ /*! Returns a Boolean value indicating whether the receiver shows itself even when it is not animating.
+ \return Return true if the progress indicator shows itself even when it is not animating. By default, it returns
+ false. \sa setDisplayedWhenStopped
+ */
+ bool isDisplayedWhenStopped() const;
- /*! Returns the color of the component.
- \sa setColor
- */
- const QColor & color() const { return m_color; }
+ /*! Returns the color of the component.
+ \sa setColor
+ */
+ const QColor& color() const { return m_color; }
- QSize sizeHint() const override { return QSize(m_width, m_width); };
- void setWidth(int width) { m_width = width; };
- int heightForWidth(int w) const override;
-public Q_SLOTS:
- /*! Starts the spin animation.
- \sa stopAnimation isAnimated
- */
- void startAnimation();
+ QSize sizeHint() const override { return QSize(m_width, m_width); };
+ void setWidth(int width) { m_width = width; };
+ int heightForWidth(int w) const override;
+ public Q_SLOTS:
+ /*! Starts the spin animation.
+ \sa stopAnimation isAnimated
+ */
+ void startAnimation();
- /*! Stops the spin animation.
- \sa startAnimation isAnimated
- */
- void stopAnimation();
+ /*! Stops the spin animation.
+ \sa startAnimation isAnimated
+ */
+ void stopAnimation();
- /*! Sets the delay between animation steps.
- Setting the \a delay to a value larger than 40 slows the animation, while setting the \a delay to a smaller value speeds it up.
- \param delay The delay, in milliseconds.
- \sa animationDelay
- */
- void setAnimationDelay(int delay);
+ /*! Sets the delay between animation steps.
+ Setting the \a delay to a value larger than 40 slows the animation, while setting the \a delay to a smaller
+ value speeds it up. \param delay The delay, in milliseconds. \sa animationDelay
+ */
+ void setAnimationDelay(int delay);
- /*! Sets whether the component hides itself when it is not animating.
- \param state The animation state. Set false to hide the progress indicator when it is not animating; otherwise true.
- \sa isDisplayedWhenStopped
- */
- void setDisplayedWhenStopped(bool state, const QString& staticDisplay = "");
+ /*! Sets whether the component hides itself when it is not animating.
+ \param state The animation state. Set false to hide the progress indicator when it is not animating; otherwise
+ true. \sa isDisplayedWhenStopped
+ */
+ void setDisplayedWhenStopped(bool state, const QString& staticDisplay = "");
- void setToolTips(const QString& staticToolTip, const QString& animatedToolTip);
+ void setToolTips(const QString& staticToolTip, const QString& animatedToolTip);
- /*! Sets the color of the components to the given color.
- \sa color
- */
- void setColor(const QColor & color);
+ /*! Sets the color of the components to the given color.
+ \sa color
+ */
+ void setColor(const QColor& color);
-Q_SIGNALS:
+ Q_SIGNALS:
void clicked();
-protected:
+ protected:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void enterEvent(QEvent* event) override;
#else
void enterEvent(QEnterEvent* event) override;
#endif
void leaveEvent(QEvent* event) override;
- void mouseReleaseEvent(QMouseEvent* event) override { if (event->button() == Qt::LeftButton) Q_EMIT clicked(); }
- void timerEvent(QTimerEvent * event) override;
- void paintEvent(QPaintEvent * event) override;
+ void mouseReleaseEvent(QMouseEvent* event) override
+ {
+ if (event->button() == Qt::LeftButton)
+ Q_EMIT clicked();
+ }
+ void timerEvent(QTimerEvent* event) override;
+ void paintEvent(QPaintEvent* event) override;
-private:
- int m_angle;
- int m_timerId;
- int m_delay;
- bool m_displayedWhenStopped;
- QString m_staticDisplay;
- bool m_useAutoToolTips = false;
- QString m_staticToolTip;
- QString m_animatedToolTip;
- QColor m_color;
- bool m_activeHover = false;
+ private:
+ int m_angle;
+ int m_timerId;
+ int m_delay;
+ bool m_displayedWhenStopped;
+ QString m_staticDisplay;
+ bool m_useAutoToolTips = false;
+ QString m_staticToolTip;
+ QString m_animatedToolTip;
+ QColor m_color;
+ bool m_activeHover = false;
};
-#endif // QPROGRESSINDICATOR_H
+#endif // QPROGRESSINDICATOR_H
diff --git a/ui/progresstask.h b/ui/progresstask.h
index 88cb7609..3cbfdc69 100644
--- a/ui/progresstask.h
+++ b/ui/progresstask.h
@@ -19,9 +19,9 @@
/*!
- Dialog displaying a progress bar and cancel button
+ Dialog displaying a progress bar and cancel button
*/
-class BINARYNINJAUIAPI ProgressDialog: public QDialog
+class BINARYNINJAUIAPI ProgressDialog : public QDialog
{
Q_OBJECT
@@ -34,8 +34,8 @@ class BINARYNINJAUIAPI ProgressDialog: public QDialog
std::atomic<bool> m_wasCancelled;
std::chrono::steady_clock::time_point m_lastUpdate;
-public:
- ProgressDialog(QWidget* parent, const QString& title, const QString& text, const QString& cancel=QString());
+ public:
+ ProgressDialog(QWidget* parent, const QString& title, const QString& text, const QString& cancel = QString());
bool wasCancelled() const;
@@ -45,46 +45,46 @@ public:
void setText(const QString& text);
-protected:
+ protected:
virtual void keyPressEvent(QKeyEvent* event) override;
-private Q_SLOTS:
+ private Q_SLOTS:
void cancelButton();
-public Q_SLOTS:
+ public Q_SLOTS:
void update(int cur, int total);
void cancel();
-Q_SIGNALS:
+ Q_SIGNALS:
void canceled();
};
/*!
- Wrapper around QThread and ProgressDialog that runs a task in the background,
- providing updates to the progress bar on the main thread.
+ Wrapper around QThread and ProgressDialog that runs a task in the background,
+ providing updates to the progress bar on the main thread.
- Warning: You should always construct one of these with new() as it will outlive the current
- scope and delete itself automatically.
+ Warning: You should always construct one of these with new() as it will outlive the current
+ scope and delete itself automatically.
- Started automatically. Call wait() to wait for completion, or cancel() to cancel.
+ Started automatically. Call wait() to wait for completion, or cancel() to cancel.
- Example:
+ Example:
- // Starts task
- ProgressTask* task = new ProgressTask("Long Operation", "Long Operation", "Cancel",
- [](std::function<bool(size_t, size_t)> progress) {
- doLongOperationWithProgress(progress);
+ // Starts task
+ ProgressTask* task = new ProgressTask("Long Operation", "Long Operation", "Cancel",
+ [](std::function<bool(size_t, size_t)> progress) {
+ doLongOperationWithProgress(progress);
- // Report progress by calling the progress function
- if (!progress(current, maximum))
- return; // If the progress function returns false, then the user has cancelled the operation
- });
- // Throws if doLongOperationWithProgress threw
- task->wait();
- // Task deletes itself later
+ // Report progress by calling the progress function
+ if (!progress(current, maximum))
+ return; // If the progress function returns false, then the user has cancelled the operation
+ });
+ // Throws if doLongOperationWithProgress threw
+ task->wait();
+ // Task deletes itself later
*/
-class BINARYNINJAUIAPI ProgressTask: public QObject
+class BINARYNINJAUIAPI ProgressTask : public QObject
{
Q_OBJECT
@@ -103,7 +103,7 @@ class BINARYNINJAUIAPI ProgressTask: public QObject
*/
void start();
-public:
+ public:
/*!
Construct a new progress task, which automatically starts running a given function
\param parent Parent QWidget to display progress dialog on top of
@@ -111,10 +111,11 @@ public:
\param text Text for progress dialog
\param cancel Cancel button title. If empty, the cancel button will not be shown
\param func Function to run in the background, which takes a progress reporting function for its argument.
- The function should call the progress function periodically to signal updates and check for cancellation.
+ The function should call the progress function periodically to signal updates and check for
+ cancellation.
*/
ProgressTask(QWidget* parent, const QString& name, const QString& text, const QString& cancel,
- std::function<void(std::function<bool(size_t, size_t)>)> func);
+ std::function<void(std::function<bool(size_t, size_t)>)> func);
virtual ~ProgressTask();
/*!
@@ -143,13 +144,13 @@ public:
*/
void setText(const QString& text);
-public Q_SLOTS:
+ public Q_SLOTS:
/*!
Cancel the progress dialog
*/
void cancel();
-Q_SIGNALS:
+ Q_SIGNALS:
/*!
Signal reported every time there is a progress update (probably often)
\param cur Current progress value
@@ -165,94 +166,95 @@ Q_SIGNALS:
/*!
- Helper for BackgroundThread, basically lets you take functions of various types and converts them into
- std::function<QVariant(QVariant)> so it has something easy to call.
+ Helper for BackgroundThread, basically lets you take functions of various types and converts them into
+ std::function<QVariant(QVariant)> so it has something easy to call.
- \param func Original function, can have 0 arguments, or 1 argument that can be used with QVariant,
- function can either return void or some type that works with QVariant
- \return New function whose signature is QVariant(QVariant)
+ \param func Original function, can have 0 arguments, or 1 argument that can be used with QVariant,
+ function can either return void or some type that works with QVariant
+ \return New function whose signature is QVariant(QVariant)
*/
-template<typename Func>
+template <typename Func>
std::function<QVariant(QVariant)> convertToQVariantFunction(Func&& func);
/*!
- Helper class for running chains of actions on both the main thread and a background thread.
- Especially useful for doing ui that also needs networking.
- Think of it like a JS-like promise chain except with more C++.
+ Helper class for running chains of actions on both the main thread and a background thread.
+ Especially useful for doing ui that also needs networking.
+ Think of it like a JS-like promise chain except with more C++.
- Example:
+ Example:
- BackgroundThread::create()
- // Do actions serially in the background
- ->thenBackground([this](QVariant) {
- bool success = SomeLongNetworkOperation();
- // Return value will be passed to next action's QVariant parameter
- return success;
- })
- // And serially on the main thread
- ->thenMainThread([this](QVariant var) {
- // Retrieve value from last action
- bool success = var.value<bool>();
- UpdateUI(success);
- // You don't have to return anything (next QVariant param will be QVariant())
- })
- // You can also combine with a ProgressTask for showing a progress dialog
- ->thenBackgroundWithProgress(m_window, "Doing Task", "Please wait...", "Cancel", [this](QVariant var, ProgressTask* task, ProgressFunction progress) {
- progress(0, 0);
- DoTask1WithProgress(SplitProgress(progress, 0, 1));
- // You can interface with the task itself
- task->setText("Doing Part 2");
- DoTask2WithProgress(SplitProgress(progress, 1, 1));
- progress(1, 1);
- })
- // You can combine with another BackgroundThread to do its actions after all of the
- // ones you have enqueued so far
- ->then(SomeOtherFunctionThatReturnsABackgroundThread())
- // If any then-action throws, all future then-actions will be ignored and the catch-actions will be run, serially
- // NB: If a catch-action throws, the new exception will be passed to any further catch-actions
- ->catchMainThread([this](std::exception_ptr exc) {
- // So far the only way I've found to get the exception out:
- try
- {
- std::rethrow_exception(exc);
- }
- catch (std::exception e)
- {
- // Handle exception
- }
- })
- // You can also catch in the background
- ->catchBackground([this](std::exception_ptr exc) {
- ...
- })
- // Finally-actions will be run after all then-actions are finished
- // If a then-action throws, finally-actions will be run after all catch-actions are finished
- // NB: Finally-actions should not throw exceptions
- ->finallyMainThread([this](bool success) {
- if (success)
- {
- ReportSuccess();
- }
- })
- // You can also have finally-actions in the background
- ->finallyBackground([this](bool success) {
- ...
- })
- // Call start to start the thread
- ->start();
+ BackgroundThread::create()
+ // Do actions serially in the background
+ ->thenBackground([this](QVariant) {
+ bool success = SomeLongNetworkOperation();
+ // Return value will be passed to next action's QVariant parameter
+ return success;
+ })
+ // And serially on the main thread
+ ->thenMainThread([this](QVariant var) {
+ // Retrieve value from last action
+ bool success = var.value<bool>();
+ UpdateUI(success);
+ // You don't have to return anything (next QVariant param will be QVariant())
+ })
+ // You can also combine with a ProgressTask for showing a progress dialog
+ ->thenBackgroundWithProgress(m_window, "Doing Task", "Please wait...", "Cancel", [this](QVariant var,
+ ProgressTask* task, ProgressFunction progress) { progress(0, 0); DoTask1WithProgress(SplitProgress(progress, 0, 1));
+ // You can interface with the task itself
+ task->setText("Doing Part 2");
+ DoTask2WithProgress(SplitProgress(progress, 1, 1));
+ progress(1, 1);
+ })
+ // You can combine with another BackgroundThread to do its actions after all of the
+ // ones you have enqueued so far
+ ->then(SomeOtherFunctionThatReturnsABackgroundThread())
+ // If any then-action throws, all future then-actions will be ignored and the catch-actions will be run,
+ serially
+ // NB: If a catch-action throws, the new exception will be passed to any further catch-actions
+ ->catchMainThread([this](std::exception_ptr exc) {
+ // So far the only way I've found to get the exception out:
+ try
+ {
+ std::rethrow_exception(exc);
+ }
+ catch (std::exception e)
+ {
+ // Handle exception
+ }
+ })
+ // You can also catch in the background
+ ->catchBackground([this](std::exception_ptr exc) {
+ ...
+ })
+ // Finally-actions will be run after all then-actions are finished
+ // If a then-action throws, finally-actions will be run after all catch-actions are finished
+ // NB: Finally-actions should not throw exceptions
+ ->finallyMainThread([this](bool success) {
+ if (success)
+ {
+ ReportSuccess();
+ }
+ })
+ // You can also have finally-actions in the background
+ ->finallyBackground([this](bool success) {
+ ...
+ })
+ // Call start to start the thread
+ ->start();
*/
-class BINARYNINJAUIAPI BackgroundThread: public QObject
+class BINARYNINJAUIAPI BackgroundThread : public QObject
{
Q_OBJECT
-public:
+
+ public:
typedef std::function<bool(size_t, size_t)> ProgressFunction;
typedef std::function<QVariant(QVariant value)> ThenFunction;
typedef std::function<void(std::exception_ptr exc)> CatchFunction;
typedef std::function<void(bool success) /* noexcept */> FinallyFunction;
-private:
+ private:
enum FunctionType
{
MainThread,
@@ -268,41 +270,33 @@ private:
std::vector<std::pair<FunctionType, CatchFunction>> m_catch;
std::vector<std::pair<FunctionType, FinallyFunction>> m_finally;
- BackgroundThread(): QObject(), m_finished(false), m_exception()
- {
- }
+ BackgroundThread() : QObject(), m_finished(false), m_exception() {}
void runThread()
{
QVariant value = m_init;
try
{
- for (auto& func: m_then)
+ for (auto& func : m_then)
{
switch (func.first)
{
case MainThread:
- BinaryNinja::ExecuteOnMainThreadAndWait([&]()
- {
- value = func.second(value);
- });
+ BinaryNinja::ExecuteOnMainThreadAndWait([&]() { value = func.second(value); });
break;
case Background:
value = func.second(value);
break;
}
}
- for (auto& func: m_finally)
+ for (auto& func : m_finally)
{
try
{
switch (func.first)
{
case MainThread:
- BinaryNinja::ExecuteOnMainThreadAndWait([&]()
- {
- func.second(true);
- });
+ BinaryNinja::ExecuteOnMainThreadAndWait([&]() { func.second(true); });
break;
case Background:
func.second(true);
@@ -325,17 +319,14 @@ private:
catch (...)
{
std::exception_ptr exc = std::current_exception();
- for (auto& func: m_catch)
+ for (auto& func : m_catch)
{
try
{
switch (func.first)
{
case MainThread:
- BinaryNinja::ExecuteOnMainThreadAndWait([&]()
- {
- func.second(exc);
- });
+ BinaryNinja::ExecuteOnMainThreadAndWait([&]() { func.second(exc); });
break;
case Background:
func.second(exc);
@@ -347,17 +338,14 @@ private:
exc = std::current_exception();
}
}
- for (auto& func: m_finally)
+ for (auto& func : m_finally)
{
try
{
switch (func.first)
{
case MainThread:
- BinaryNinja::ExecuteOnMainThreadAndWait([&]()
- {
- func.second(false);
- });
+ BinaryNinja::ExecuteOnMainThreadAndWait([&]() { func.second(false); });
break;
case Background:
func.second(false);
@@ -379,7 +367,7 @@ private:
}
}
-public:
+ public:
/*!
Create a new background thread (but don't start it)
\return Empty thread with no functions
@@ -406,7 +394,7 @@ public:
else
{
m_init = init;
- m_future = QtConcurrent::run([&]{
+ m_future = QtConcurrent::run([&] {
runThread();
{
std::unique_lock lock(m_finishLock);
@@ -433,9 +421,7 @@ public:
// If it's not finished, wait for it to finish
watcher.setFuture(m_future);
// Make this connection before events start processing
- connect(&watcher, &QFutureWatcher<void>::finished, [&loop]() {
- loop.exit(0);
- });
+ connect(&watcher, &QFutureWatcher<void>::finished, [&loop]() { loop.exit(0); });
}
loop.exec();
}
@@ -463,7 +449,7 @@ public:
\param func Function to run on background thread
\return This BackgroundThread
*/
- template<typename Func>
+ template <typename Func>
BackgroundThread* thenBackground(Func&& func)
{
m_then.push_back({Background, convertToQVariantFunction(std::forward<Func>(func))});
@@ -475,7 +461,7 @@ public:
\param func Function to run on main thread
\return This BackgroundThread
*/
- template<typename Func>
+ template <typename Func>
BackgroundThread* thenMainThread(Func&& func)
{
m_then.push_back({MainThread, convertToQVariantFunction(std::forward<Func>(func))});
@@ -491,55 +477,59 @@ public:
\param func Function to run on background thread
\return This BackgroundThread
*/
- template<typename Func>
- BackgroundThread* thenBackgroundWithProgress(QWidget* parent, const QString& title, const QString& text, const QString& cancel, Func&& func)
+ template <typename Func>
+ BackgroundThread* thenBackgroundWithProgress(
+ QWidget* parent, const QString& title, const QString& text, const QString& cancel, Func&& func)
{
- m_then.push_back({MainThread, [=](QVariant v) {
- QVariant result;
- // Since the task starts immediately, we need to hold a lock to its value
- // Just in case it manages to get to the part of the lambda where it reads the value
- // before this thread actually assigns it.
- // This is *probably* not a race in practice due to the variable being stored on the stack before construction.
- std::mutex taskMutex;
- taskMutex.lock();
- ProgressTask* task = new ProgressTask(parent, title, text, cancel, [&](ProgressFunction progress) {
- auto innerProgress = [=](size_t cur, size_t max) {
- // Fix dialog disappearing if the backgrounded task thinks it's done
- if (cur >= max)
- {
- cur = max - 1;
- }
- return progress(cur, max);
- };
- try
- {
- // See above comment about race conditions
- taskMutex.lock();
- ProgressTask* innerTask = task;
- taskMutex.unlock();
+ m_then.push_back(
+ {MainThread, [=](QVariant v) {
+ QVariant result;
+ // Since the task starts immediately, we need to hold a lock to its value
+ // Just in case it manages to get to the part of the lambda where it reads the value
+ // before this thread actually assigns it.
+ // This is *probably* not a race in practice due to the variable being stored on the stack before
+ // construction.
+ std::mutex taskMutex;
+ taskMutex.lock();
+ ProgressTask* task = new ProgressTask(parent, title, text, cancel, [&](ProgressFunction progress) {
+ auto innerProgress = [=](size_t cur, size_t max) {
+ // Fix dialog disappearing if the backgrounded task thinks it's done
+ if (cur >= max)
+ {
+ cur = max - 1;
+ }
+ return progress(cur, max);
+ };
+ try
+ {
+ // See above comment about race conditions
+ taskMutex.lock();
+ ProgressTask* innerTask = task;
+ taskMutex.unlock();
- if constexpr (std::is_void_v<std::invoke_result_t<Func, QVariant, ProgressTask*, ProgressFunction>>)
- {
- func(v, innerTask, innerProgress);
- }
- else
- {
- result = func(v, innerTask, innerProgress);
- }
- // And actually report success
- progress(1, 1);
- }
- catch (...)
- {
- progress(1, 1);
- std::rethrow_exception(std::current_exception());
- };
- });
- taskMutex.unlock();
- task->wait();
+ if constexpr (std::is_void_v<
+ std::invoke_result_t<Func, QVariant, ProgressTask*, ProgressFunction>>)
+ {
+ func(v, innerTask, innerProgress);
+ }
+ else
+ {
+ result = func(v, innerTask, innerProgress);
+ }
+ // And actually report success
+ progress(1, 1);
+ }
+ catch (...)
+ {
+ progress(1, 1);
+ std::rethrow_exception(std::current_exception());
+ };
+ });
+ taskMutex.unlock();
+ task->wait();
- return result;
- }});
+ return result;
+ }});
return this;
}
@@ -587,7 +577,7 @@ public:
return this;
}
-Q_SIGNALS:
+ Q_SIGNALS:
/*!
Called when all functions have been run
\param result Final result
@@ -604,20 +594,21 @@ Q_SIGNALS:
// Implementation details of convertToQVariantFunction
// Inspired by boost function_traits and various other similarly named patterns
-template<typename Function>
+template <typename Function>
struct function_traits;
-template<typename Function>
-struct function_traits: public function_traits<decltype(&Function::operator())> {};
-template<typename C, typename R, typename ... Args>
-struct function_traits<R(C::*)(Args...) const>
+template <typename Function>
+struct function_traits : public function_traits<decltype(&Function::operator())>
+{};
+template <typename C, typename R, typename... Args>
+struct function_traits<R (C::*)(Args...) const>
{
using result_type = R;
- template<size_t index>
+ template <size_t index>
using arg_type = typename std::tuple_element_t<index, std::tuple<Args...>>;
static const size_t arity = sizeof...(Args);
};
-template<typename Func>
+template <typename Func>
std::function<QVariant(QVariant)> convertToQVariantFunction(Func&& func)
{
return [func](QVariant v) {
diff --git a/ui/qfileaccessor.h b/ui/qfileaccessor.h
index 728f7605..1686eccc 100644
--- a/ui/qfileaccessor.h
+++ b/ui/qfileaccessor.h
@@ -9,7 +9,7 @@ class BINARYNINJAUIAPI QFileAccessor : public BinaryNinja::FileAccessor
QFile* m_file;
QString m_error;
-public:
+ public:
QFileAccessor(const QString& name, bool write = false);
virtual ~QFileAccessor();
diff --git a/ui/render.h b/ui/render.h
index a1b55092..92dc654f 100644
--- a/ui/render.h
+++ b/ui/render.h
@@ -44,7 +44,7 @@ class BINARYNINJAUIAPI FontParameters
float m_fontScale;
bool m_customFont;
-public:
+ public:
FontParameters(QWidget* parent, float fontScale = 1.0f);
void update();
@@ -64,7 +64,7 @@ class BINARYNINJAUIAPI RenderContext
FontParameters m_fontParams;
bool m_drawIndents;
-public:
+ public:
RenderContext(QWidget* parent, float fontScale = 1.0f);
void update();
@@ -74,12 +74,14 @@ public:
void init(QPainter& p);
- QColor getColorForHexDumpByte(const HexEditorHighlightState& state, BNModificationStatus modification, uint8_t byte);
+ QColor getColorForHexDumpByte(
+ const HexEditorHighlightState& state, BNModificationStatus modification, uint8_t byte);
QColor getHighlightColor(BNHighlightColor color);
- HighlightTokenState getTokenForDisassemblyLinePosition(int64_t col, const std::vector<BinaryNinja::InstructionTextToken>& tokens);
- HighlightTokenState getTokenForDisassemblyTokenIndex(size_t tokenIndex,
- const std::vector<BinaryNinja::InstructionTextToken>& tokens);
+ HighlightTokenState getTokenForDisassemblyLinePosition(
+ int64_t col, const std::vector<BinaryNinja::InstructionTextToken>& tokens);
+ HighlightTokenState getTokenForDisassemblyTokenIndex(
+ size_t tokenIndex, const std::vector<BinaryNinja::InstructionTextToken>& tokens);
HighlightTokenState getHighlightTokenForTextToken(const BinaryNinja::InstructionTextToken& token);
void drawText(QPainter& p, int x, int y, QColor color, const QString& text);
@@ -88,14 +90,15 @@ public:
void drawSeparatorLine(QPainter& p, QColor top, QColor bottom, QColor line, const QRect& rect);
void drawInstructionHighlight(QPainter& p, const QRect& rect);
- void drawLinearDisassemblyLineBackground(QPainter& p, BNLinearDisassemblyLineType type, const QRect& rect,
- int gutterWidth);
- void drawDisassemblyLine(QPainter& p, int left, int top, const std::vector<BinaryNinja::InstructionTextToken>& tokens,
- HighlightTokenState& highlight, bool highlightOnly=false);
+ void drawLinearDisassemblyLineBackground(
+ QPainter& p, BNLinearDisassemblyLineType type, const QRect& rect, int gutterWidth);
+ void drawDisassemblyLine(QPainter& p, int left, int top,
+ const std::vector<BinaryNinja::InstructionTextToken>& tokens, HighlightTokenState& highlight,
+ bool highlightOnly = false);
- void drawHexEditorLine(QPainter& p, int left, int top, const HexEditorHighlightState& highlight,
- BinaryViewRef view, uint64_t lineStartAddr, size_t cols, size_t firstCol, size_t count,
- bool cursorVisible, bool cursorAscii, size_t cursorPos, bool byteCursor);
+ void drawHexEditorLine(QPainter& p, int left, int top, const HexEditorHighlightState& highlight, BinaryViewRef view,
+ uint64_t lineStartAddr, size_t cols, size_t firstCol, size_t count, bool cursorVisible, bool cursorAscii,
+ size_t cursorPos, bool byteCursor);
QFont getFont() { return m_fontParams.getFont(); }
QFont getEmojiFont() { return m_fontParams.getEmojiFont(); }
void setFont(const QFont& font);
diff --git a/ui/reportcollectionwidget.h b/ui/reportcollectionwidget.h
index 13c2d659..42d56421 100644
--- a/ui/reportcollectionwidget.h
+++ b/ui/reportcollectionwidget.h
@@ -8,7 +8,7 @@
#include "viewframe.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI ReportCollectionWidget: public QWidget, public ViewContainer
+class BINARYNINJAUIAPI ReportCollectionWidget : public QWidget, public ViewContainer
{
Q_OBJECT
@@ -22,13 +22,13 @@ class BINARYNINJAUIAPI ReportCollectionWidget: public QWidget, public ViewContai
int m_currentReportIndex;
std::string m_title;
-public:
+ public:
ReportCollectionWidget(QWidget* parent, ReportCollectionRef reports, const std::string& title);
virtual View* getView() override;
ReportCollectionWidget* duplicate();
-private Q_SLOTS:
+ private Q_SLOTS:
void selectReport(int i);
};
diff --git a/ui/reportwidget.h b/ui/reportwidget.h
index 51dd2d59..414fb412 100644
--- a/ui/reportwidget.h
+++ b/ui/reportwidget.h
@@ -4,13 +4,13 @@
#include <QtWidgets/QTextBrowser>
#include <QtWidgets/QScrollArea>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-#include <QtWebEngineWidgets/QWebEngineView>
-#include <QtWebEngineWidgets/QWebEngineScript>
-#include <QtWebEngineWidgets/QWebEngineScriptCollection>
-#include <QtWebEngineWidgets/QWebEnginePage>
-#include <QtWebEngineWidgets/QWebEngineSettings>
+ #include <QtWebEngineWidgets/QWebEngineView>
+ #include <QtWebEngineWidgets/QWebEngineScript>
+ #include <QtWebEngineWidgets/QWebEngineScriptCollection>
+ #include <QtWebEngineWidgets/QWebEnginePage>
+ #include <QtWebEngineWidgets/QWebEngineSettings>
#else
-#include <QtWidgets/QTextBrowser>
+ #include <QtWidgets/QTextBrowser>
#endif
#include "binaryninjaapi.h"
#include "action.h"
@@ -21,18 +21,18 @@ class WebPage2 : public QWebEnginePage
{
Q_OBJECT
-public:
- WebPage2(QObject *parent = nullptr) : QWebEnginePage(parent) {}
+ public:
+ WebPage2(QObject* parent = nullptr) : QWebEnginePage(parent) {}
-protected:
- virtual bool acceptNavigationRequest(const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame);
+ protected:
+ virtual bool acceptNavigationRequest(const QUrl& url, QWebEnginePage::NavigationType type, bool isMainFrame);
-Q_SIGNALS:
+ Q_SIGNALS:
void linkClicked(const QUrl&);
};
#endif
-class BINARYNINJAUIAPI ReportWidget: public QScrollArea, public UIActionHandler
+class BINARYNINJAUIAPI ReportWidget : public QScrollArea, public UIActionHandler
{
Q_OBJECT
@@ -47,12 +47,12 @@ class BINARYNINJAUIAPI ReportWidget: public QScrollArea, public UIActionHandler
BNReportType m_type;
std::string m_plaintext;
-private Q_SLOTS:
+ private Q_SLOTS:
void onLinkClicked(QUrl url);
-public:
- ReportWidget(QWidget* parent, BinaryViewRef view, const std::string& contents,
- BNReportType type, const std::string& title, const std::string& plaintext = "");
+ public:
+ ReportWidget(QWidget* parent, BinaryViewRef view, const std::string& contents, BNReportType type,
+ const std::string& title, const std::string& plaintext = "");
std::string getContents() const { return m_original; }
std::string getTitle() const { return m_title; }
BNReportType getType() const { return m_type; }
diff --git a/ui/scriptingconsole.h b/ui/scriptingconsole.h
index 3726514b..b0aa3600 100644
--- a/ui/scriptingconsole.h
+++ b/ui/scriptingconsole.h
@@ -24,13 +24,13 @@
class ScriptingConsole;
-class BINARYNINJAUIAPI ScriptingCompletionModel: public QAbstractListModel
+class BINARYNINJAUIAPI ScriptingCompletionModel : public QAbstractListModel
{
Q_OBJECT
std::vector<std::string> m_completions;
bool m_searching;
-public:
+ public:
ScriptingCompletionModel(QWidget* parent);
virtual QModelIndex index(int row, int col, const QModelIndex& parent = QModelIndex()) const override;
@@ -42,36 +42,37 @@ public:
void setModelData(const std::vector<std::string>& completions, bool searching);
};
-class BINARYNINJAUIAPI ScriptingCompletionPopup: public QDialog
+class BINARYNINJAUIAPI ScriptingCompletionPopup : public QDialog
{
Q_OBJECT
QListView* m_list;
ScriptingCompletionModel* m_model;
-protected:
+ protected:
virtual bool eventFilter(QObject* obj, QEvent* event) override;
-public:
+ public:
ScriptingCompletionPopup(QWidget* parent);
void showWithData(QPoint pt, int cursorSize, const std::vector<std::string>& completions, bool searching = false);
bool handleKeyEvent(QKeyEvent* event);
virtual ~ScriptingCompletionPopup();
-private Q_SLOTS:
+ private Q_SLOTS:
void clickRow(const QModelIndex& index);
-Q_SIGNALS:
+ Q_SIGNALS:
void complete(QString text);
};
-class BINARYNINJAUIAPI ScriptingConsoleEdit: public QTextEdit
+class BINARYNINJAUIAPI ScriptingConsoleEdit : public QTextEdit
{
Q_OBJECT
-public:
+
+ public:
typedef std::function<std::vector<std::string>(const std::string&)> CompletionCallback;
-private:
+ private:
ScriptingConsole* m_console;
int m_charHeight;
bool m_continuation;
@@ -84,22 +85,22 @@ private:
uint64_t m_completionRegionInitialStop;
uint64_t m_completionRegionStop;
-public:
+ public:
ScriptingConsoleEdit(ScriptingConsole* parent);
void setCharHeight(int height);
void setContinuation(bool cont);
void setCompletionCallback(CompletionCallback callback) { m_completionCallback = callback; }
- void insertFromMimeData(const QMimeData * source) override;
+ void insertFromMimeData(const QMimeData* source) override;
-private Q_SLOTS:
+ private Q_SLOTS:
void complete(QString text);
-protected:
+ protected:
virtual void keyPressEvent(QKeyEvent* event) override;
};
-class BINARYNINJAUIAPI ScriptingConsoleOutput: public QTextEdit
+class BINARYNINJAUIAPI ScriptingConsoleOutput : public QTextEdit
{
Q_OBJECT
@@ -110,20 +111,21 @@ class BINARYNINJAUIAPI ScriptingConsoleOutput: public QTextEdit
BinaryViewRef m_data;
Menu* m_menu;
-public:
+ public:
ScriptingConsoleOutput(ScriptingConsole* parent, Menu* menu);
bool IsNavigable(const QString& str, const std::pair<int, int>& offsetLen, uint64_t& value, bool highlight) const;
-protected:
+
+ protected:
void contextMenuEvent(QContextMenuEvent* event) override;
-public Q_SLOTS:
+ public Q_SLOTS:
virtual void mouseReleaseEvent(QMouseEvent* event) override;
void viewChanged(QWidget* frame);
};
class ScriptingConsoleWidget;
-class BINARYNINJAUIAPI ScriptingConsole: public GlobalAreaWidget, BinaryNinja::ScriptingOutputListener
+class BINARYNINJAUIAPI ScriptingConsole : public GlobalAreaWidget, BinaryNinja::ScriptingOutputListener
{
Q_OBJECT
@@ -154,20 +156,21 @@ class BINARYNINJAUIAPI ScriptingConsole: public GlobalAreaWidget, BinaryNinja::S
static int m_stateUpdatedEventType;
-private Q_SLOTS:
+ private Q_SLOTS:
void updateTimerEvent();
void consoleTextChanged();
void cancel();
void showCancelButton();
-Q_SIGNALS:
+ Q_SIGNALS:
void viewChanged(QWidget* frame);
-protected:
+ protected:
void customEvent(QEvent* event) override;
-public:
- ScriptingConsole(QWidget* parent, const QString& providerName, const QString& instanceName, ScriptingInstanceRef instance);
+ public:
+ ScriptingConsole(
+ QWidget* parent, const QString& providerName, const QString& instanceName, ScriptingInstanceRef instance);
virtual ~ScriptingConsole();
QString getProviderName() const { return m_providerName; }
diff --git a/ui/searchresult.h b/ui/searchresult.h
index fe2d075e..3b648367 100644
--- a/ui/searchresult.h
+++ b/ui/searchresult.h
@@ -9,258 +9,265 @@
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QStyledItemDelegate>
#include <QtWidgets/QDialog>
-#include <QtWidgets/QProgressBar>
-#include <QtWidgets/QToolButton>
+#include <QtWidgets/QProgressBar>
+#include <QtWidgets/QToolButton>
#include "binaryninjaapi.h"
#include "dockhandler.h"
#include "filter.h"
#include "expandablegroup.h"
#define FIND_RESULT_LIST_UPDATE_INTERVAL 250
-#define COLUMN_MIN_WIDTH_IN_CHAR 10
-#define COLUMN_MAX_WIDTH_IN_CHAR 30
+#define COLUMN_MIN_WIDTH_IN_CHAR 10
+#define COLUMN_MAX_WIDTH_IN_CHAR 30
class CachedTokens
{
-public:
- QVariant tokens;
- QVariant flattenedTokens;
- bool valid;
+ public:
+ QVariant tokens;
+ QVariant flattenedTokens;
+ bool valid;
- CachedTokens(): valid(false) {}
- CachedTokens(const CachedTokens& other):
- tokens(other.tokens), flattenedTokens(other.flattenedTokens), valid(other.valid)
- {}
+ CachedTokens() : valid(false) {}
+ CachedTokens(const CachedTokens& other) :
+ tokens(other.tokens), flattenedTokens(other.flattenedTokens), valid(other.valid)
+ {}
};
class SearchResultItem
{
-private:
- uint64_t m_addr;
- BinaryNinja::DataBuffer m_buffer;
- FunctionRef m_func;
- CachedTokens m_tokensCache[4];
+ private:
+ uint64_t m_addr;
+ BinaryNinja::DataBuffer m_buffer;
+ FunctionRef m_func;
+ CachedTokens m_tokensCache[4];
-public:
- SearchResultItem();
- SearchResultItem(uint64_t addr, const BinaryNinja::DataBuffer& buffer,
- FunctionRef func);
- SearchResultItem(uint64_t addr, const BinaryNinja::DataBuffer& buffer,
- FunctionRef func, const BinaryNinja::DisassemblyTextLine& line, QWidget* owner);
- SearchResultItem(const SearchResultItem& other);
- uint64_t addr() const { return m_addr; }
- BinaryNinja::DataBuffer buffer() const { return m_buffer; }
- FunctionRef func() const { return m_func; }
- bool operator==(const SearchResultItem& other) const { return m_addr == other.addr(); }
- bool operator!=(const SearchResultItem& other) const { return m_addr != other.addr(); }
- bool operator<(const SearchResultItem& other) const { return m_addr < other.addr(); }
+ public:
+ SearchResultItem();
+ SearchResultItem(uint64_t addr, const BinaryNinja::DataBuffer& buffer, FunctionRef func);
+ SearchResultItem(uint64_t addr, const BinaryNinja::DataBuffer& buffer, FunctionRef func,
+ const BinaryNinja::DisassemblyTextLine& line, QWidget* owner);
+ SearchResultItem(const SearchResultItem& other);
+ uint64_t addr() const { return m_addr; }
+ BinaryNinja::DataBuffer buffer() const { return m_buffer; }
+ FunctionRef func() const { return m_func; }
+ bool operator==(const SearchResultItem& other) const { return m_addr == other.addr(); }
+ bool operator!=(const SearchResultItem& other) const { return m_addr != other.addr(); }
+ bool operator<(const SearchResultItem& other) const { return m_addr < other.addr(); }
- CachedTokens getCachedTokens(size_t i) const;
- CachedTokens& getCachedTokens(size_t i);
- void setCachedTokens(size_t i, QVariant tokens, QVariant flattenedTokens);
+ CachedTokens getCachedTokens(size_t i) const;
+ CachedTokens& getCachedTokens(size_t i);
+ void setCachedTokens(size_t i, QVariant tokens, QVariant flattenedTokens);
};
Q_DECLARE_METATYPE(SearchResultItem);
-class BINARYNINJAUIAPI SearchResultModel: public QAbstractTableModel
+class BINARYNINJAUIAPI SearchResultModel : public QAbstractTableModel
{
- Q_OBJECT
+ Q_OBJECT
-protected:
- QWidget* m_owner;
- BinaryViewRef m_data;
- BinaryNinja::FindParameters m_params;
- std::vector<SearchResultItem> m_refs;
- mutable size_t m_columnWidths[4];
- // if this value is true, it means the user has overriden the automatically calculated width
- // of the coumn, and we should not resize it anymore
- bool m_userColumnWidth[4];
+ protected:
+ QWidget* m_owner;
+ BinaryViewRef m_data;
+ BinaryNinja::FindParameters m_params;
+ std::vector<SearchResultItem> m_refs;
+ mutable size_t m_columnWidths[4];
+ // if this value is true, it means the user has overriden the automatically calculated width
+ // of the coumn, and we should not resize it anymore
+ bool m_userColumnWidth[4];
- std::mutex m_updateMutex;
- std::set<SearchResultItem> m_pendingSearchResults;
+ std::mutex m_updateMutex;
+ std::set<SearchResultItem> m_pendingSearchResults;
-public:
- enum ColumnHeaders
- {
- AddressColumn = 0,
- DataColumn = 1,
- FunctionColumn = 2,
- PreviewColumn = 3,
- EndOfColumn = 4
- };
+ public:
+ enum ColumnHeaders
+ {
+ AddressColumn = 0,
+ DataColumn = 1,
+ FunctionColumn = 2,
+ PreviewColumn = 3,
+ EndOfColumn = 4
+ };
- SearchResultModel(QWidget* parent, BinaryViewRef data);
- virtual ~SearchResultModel();
+ SearchResultModel(QWidget* parent, BinaryViewRef data);
+ virtual ~SearchResultModel();
- virtual QModelIndex index(int row, int col, const QModelIndex& parent = QModelIndex()) const override;
+ virtual QModelIndex index(int row, int col, const QModelIndex& parent = QModelIndex()) const override;
- void reset();
- virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override { (void) parent; return (int)m_refs.size(); }
- virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override { (void) parent; return 4; }
- SearchResultItem getRow(int row) const;
- virtual QVariant data(const QModelIndex& i, int role) const override;
- virtual QVariant headerData(int column, Qt::Orientation orientation, int role) const override;
- void addItem(const SearchResultItem& addr);
- void clear();
- void updateFindParameters(const BinaryNinja::FindParameters params);
- void updateSearchResults();
+ void reset();
+ virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override
+ {
+ (void)parent;
+ return (int)m_refs.size();
+ }
+ virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override
+ {
+ (void)parent;
+ return 4;
+ }
+ SearchResultItem getRow(int row) const;
+ virtual QVariant data(const QModelIndex& i, int role) const override;
+ virtual QVariant headerData(int column, Qt::Orientation orientation, int role) const override;
+ void addItem(const SearchResultItem& addr);
+ void clear();
+ void updateFindParameters(const BinaryNinja::FindParameters params);
+ void updateSearchResults();
- size_t getColumnWidth(size_t column) const;
- // This function is marked as const, but it actually modifies the mutable member m_columnWidths.
- // It is called in SearchResultModel::data(), which is const. So it has to be const as well.
- void updateColumnWidth(size_t column, size_t size) const;
- void resetColumnWidth();
+ size_t getColumnWidth(size_t column) const;
+ // This function is marked as const, but it actually modifies the mutable member m_columnWidths.
+ // It is called in SearchResultModel::data(), which is const. So it has to be const as well.
+ void updateColumnWidth(size_t column, size_t size) const;
+ void resetColumnWidth();
- bool isUserColumnWidth(size_t column) const;
- void setUserColumnWidth(size_t column);
+ bool isUserColumnWidth(size_t column) const;
+ void setUserColumnWidth(size_t column);
};
-class BINARYNINJAUIAPI SearchResultFilterProxyModel: public QSortFilterProxyModel
+class BINARYNINJAUIAPI SearchResultFilterProxyModel : public QSortFilterProxyModel
{
- Q_OBJECT
+ Q_OBJECT
-public:
- SearchResultFilterProxyModel(QObject* parent);
- virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
- virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
- virtual QVariant data(const QModelIndex& idx, int role) const override;
+ public:
+ SearchResultFilterProxyModel(QObject* parent);
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
+ virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
+ virtual QVariant data(const QModelIndex& idx, int role) const override;
};
-class BINARYNINJAUIAPI SearchResultItemDelegate: public QStyledItemDelegate
+class BINARYNINJAUIAPI SearchResultItemDelegate : public QStyledItemDelegate
{
- Q_OBJECT
+ Q_OBJECT
- QFont m_font;
- int m_baseline, m_charWidth, m_charHeight, m_charOffset;
+ QFont m_font;
+ int m_baseline, m_charWidth, m_charHeight, m_charOffset;
-public:
- SearchResultItemDelegate(QWidget* parent);
- void updateFonts();
- void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& idx) const;
+ public:
+ SearchResultItemDelegate(QWidget* parent);
+ void updateFonts();
+ void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& idx) const;
};
class SearchResultWidget;
-class BINARYNINJAUIAPI SearchResultTable: public QTableView
+class BINARYNINJAUIAPI SearchResultTable : public QTableView
{
- Q_OBJECT
+ Q_OBJECT
- SearchResultModel* m_table;
- SearchResultFilterProxyModel* m_model;
- SearchResultItemDelegate* m_itemDelegate;
- BinaryViewRef m_data;
- BinaryNinja::FindParameters m_params;
- UIActionHandler m_actionHandler;
- QTimer* m_updateTimer;
+ SearchResultModel* m_table;
+ SearchResultFilterProxyModel* m_model;
+ SearchResultItemDelegate* m_itemDelegate;
+ BinaryViewRef m_data;
+ BinaryNinja::FindParameters m_params;
+ UIActionHandler m_actionHandler;
+ QTimer* m_updateTimer;
- int m_charWidth, m_charHeight;
+ int m_charWidth, m_charHeight;
- bool m_cacheThreadShouldExit;
+ bool m_cacheThreadShouldExit;
-public:
- SearchResultTable(SearchResultWidget* parent, BinaryViewRef data);
- virtual ~SearchResultTable();
+ public:
+ SearchResultTable(SearchResultWidget* parent, BinaryViewRef data);
+ virtual ~SearchResultTable();
- void addSearchResult(const SearchResultItem& addr);
- void updateFindParameters(const BinaryNinja::FindParameters& params);
- void clearSearchResult();
+ void addSearchResult(const SearchResultItem& addr);
+ void updateFindParameters(const BinaryNinja::FindParameters& params);
+ void clearSearchResult();
- void updateFonts();
- void updateHeaderFontAndSize();
+ void updateFonts();
+ void updateHeaderFontAndSize();
- virtual void keyPressEvent(QKeyEvent* e) override;
+ virtual void keyPressEvent(QKeyEvent* e) override;
- virtual bool hasSelection() const { return selectionModel()->selectedRows().size() != 0; }
+ virtual bool hasSelection() const { return selectionModel()->selectedRows().size() != 0; }
virtual QModelIndexList selectedRows() const { return selectionModel()->selectedRows(); }
- void goToResult(const QModelIndex& idx);
+ void goToResult(const QModelIndex& idx);
- int rowCount() const;
- int filteredCount() const;
+ int rowCount() const;
+ int filteredCount() const;
- void updateColumnWidth();
- void resetColumnWidth();
+ void updateColumnWidth();
+ void resetColumnWidth();
- void cacheTokens();
- void terminateCacheThread() { m_cacheThreadShouldExit = true; }
+ void cacheTokens();
+ void terminateCacheThread() { m_cacheThreadShouldExit = true; }
- SearchResultModel* model() const { return m_table; }
+ SearchResultModel* model() const { return m_table; }
-public Q_SLOTS:
- void resultActivated(const QModelIndex& idx);
- void updateFilter(const QString& filterText);
- void updateTimerEvent();
- void columnResized(int logicalIndex, int oldSize, int newSize);
+ public Q_SLOTS:
+ void resultActivated(const QModelIndex& idx);
+ void updateFilter(const QString& filterText);
+ void updateTimerEvent();
+ void columnResized(int logicalIndex, int oldSize, int newSize);
-Q_SIGNALS:
- void newSelection();
+ Q_SIGNALS:
+ void newSelection();
};
class SearchProgressBar;
-class BINARYNINJAUIAPI SearchResultWidget: public QWidget
+class BINARYNINJAUIAPI SearchResultWidget : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
UIActionHandler m_actionHandler;
ContextMenuManager* m_contextMenuManager = nullptr;
Menu* m_menu = nullptr;
- BinaryViewRef m_data;
- SearchResultTable* m_table;
- QLabel* m_label;
- QLineEdit* m_lineEdit;
- ExpandableGroup* m_group;
- SearchProgressBar* m_progress;
- BinaryNinja::FindParameters m_params;
- QThread* m_tokenCacheThread = nullptr;
+ BinaryViewRef m_data;
+ SearchResultTable* m_table;
+ QLabel* m_label;
+ QLineEdit* m_lineEdit;
+ ExpandableGroup* m_group;
+ SearchProgressBar* m_progress;
+ BinaryNinja::FindParameters m_params;
+ QThread* m_tokenCacheThread = nullptr;
- virtual void contextMenuEvent(QContextMenuEvent* event) override;
+ virtual void contextMenuEvent(QContextMenuEvent* event) override;
-public:
- SearchResultWidget(BinaryViewRef data);
- ~SearchResultWidget();
+ public:
+ SearchResultWidget(BinaryViewRef data);
+ ~SearchResultWidget();
- void notifyFontChanged();
+ void notifyFontChanged();
- void startNewFind(const BinaryNinja::FindParameters& params);
- virtual QString getHeaderText();
+ void startNewFind(const BinaryNinja::FindParameters& params);
+ virtual QString getHeaderText();
- void addSearchResult(uint64_t addr, const BinaryNinja::DataBuffer& match);
- void addSearchResult(uint64_t addr, const BinaryNinja::DataBuffer& match,
- const BinaryNinja::LinearDisassemblyLine& line);
- void clearSearchResult();
- bool updateProgress(uint64_t cur, uint64_t total);
- void notifySearchCompleted();
- void cacheTokens();
- void terminateCacheThread();
- bool isSearchActive() const;
+ void addSearchResult(uint64_t addr, const BinaryNinja::DataBuffer& match);
+ void addSearchResult(
+ uint64_t addr, const BinaryNinja::DataBuffer& match, const BinaryNinja::LinearDisassemblyLine& line);
+ void clearSearchResult();
+ bool updateProgress(uint64_t cur, uint64_t total);
+ void notifySearchCompleted();
+ void cacheTokens();
+ void terminateCacheThread();
+ bool isSearchActive() const;
-public Q_SLOTS:
- void updateTotal();
+ public Q_SLOTS:
+ void updateTotal();
};
-class BINARYNINJAUIAPI SearchProgressBar: public QWidget
+class BINARYNINJAUIAPI SearchProgressBar : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
-private:
- QProgressBar* m_progress;
- QToolButton* m_cancel;
- bool m_maxSet;
- bool m_running;
- // The minimal duration (in milliseconds) the progress bar must last, before it is displayed
- int m_minimalDuration;
- std::chrono::steady_clock::time_point m_lastUpdate;
+ private:
+ QProgressBar* m_progress;
+ QToolButton* m_cancel;
+ bool m_maxSet;
+ bool m_running;
+ // The minimal duration (in milliseconds) the progress bar must last, before it is displayed
+ int m_minimalDuration;
+ std::chrono::steady_clock::time_point m_lastUpdate;
-public:
- explicit SearchProgressBar(QWidget* parent = nullptr);
- bool updateProgress(uint64_t cur, uint64_t total);
- void init();
- void reset();
- void show();
- bool isRunning() const { return m_running; }
+ public:
+ explicit SearchProgressBar(QWidget* parent = nullptr);
+ bool updateProgress(uint64_t cur, uint64_t total);
+ void init();
+ void reset();
+ void show();
+ bool isRunning() const { return m_running; }
};
diff --git a/ui/settingsview.h b/ui/settingsview.h
index 6a11ee17..b2534436 100644
--- a/ui/settingsview.h
+++ b/ui/settingsview.h
@@ -32,7 +32,9 @@
struct SettingsEntry
{
- SettingsEntry(int p, const QString& h, const QString& g, std::vector<void*>&& j) : parent(p), heading(h), group(g), jsonDefs(j) { }
+ SettingsEntry(int p, const QString& h, const QString& g, std::vector<void*>&& j) :
+ parent(p), heading(h), group(g), jsonDefs(j)
+ {}
int parent;
QString heading;
QString group;
@@ -41,16 +43,16 @@ struct SettingsEntry
};
-class BINARYNINJAUIAPI SettingsTreeModel: public QAbstractItemModel
+class BINARYNINJAUIAPI SettingsTreeModel : public QAbstractItemModel
{
Q_OBJECT
-private:
+ private:
Json::Value m_schema;
std::vector<SettingsEntry> m_store;
std::map<std::string, QString> m_filterText;
-public:
+ public:
SettingsTreeModel(std::string schema, QObject* parent = 0);
~SettingsTreeModel();
@@ -70,7 +72,7 @@ public:
};
-class BINARYNINJAUIAPI SettingsFilterProxyModel: public QSortFilterProxyModel
+class BINARYNINJAUIAPI SettingsFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
@@ -79,40 +81,45 @@ class BINARYNINJAUIAPI SettingsFilterProxyModel: public QSortFilterProxyModel
mutable QRegularExpression m_regExp;
mutable std::map<QString, std::set<QString>> m_subgroupFilterCache;
-public:
+ public:
SettingsFilterProxyModel(QObject* parent = 0);
int scopeFilter() { return m_scopeFilter; }
- void setScopeFilter(int scope) { m_scopeFilter = scope; invalidateFilter(); m_subgroupFilterCache.clear(); }
+ void setScopeFilter(int scope)
+ {
+ m_scopeFilter = scope;
+ invalidateFilter();
+ m_subgroupFilterCache.clear();
+ }
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
-protected:
+ protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
-public Q_SLOTS:
+ public Q_SLOTS:
void updateScope(const std::string& key, int scope) { m_itemScope[key] = scope; }
};
-class BINARYNINJAUIAPI SettingsOutlineProxyModel: public QSortFilterProxyModel
+class BINARYNINJAUIAPI SettingsOutlineProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
-public:
+ public:
SettingsOutlineProxyModel(QObject* parent = 0);
-protected:
+ protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
};
-class BINARYNINJAUIAPI SettingsEditor: public QWidget
+class BINARYNINJAUIAPI SettingsEditor : public QWidget
{
Q_OBJECT
-private:
+ private:
SettingsRef m_settings;
Json::Value m_setting;
std::string m_settingKey;
@@ -141,14 +148,15 @@ private:
bool m_requiresRestart = false;
bool m_settingModified = false;
-public:
- SettingsEditor(QWidget* parent, SettingsRef settings, BinaryViewRef view, BNSettingsScope scope, const Json::Value* setting);
+ public:
+ SettingsEditor(
+ QWidget* parent, SettingsRef settings, BinaryViewRef view, BNSettingsScope scope, const Json::Value* setting);
~SettingsEditor();
QSize sizeHint() const override;
void setSetting(const Json::Value* value, bool updateSchema = false);
-Q_SIGNALS:
+ Q_SIGNALS:
void geometryChanged();
void settingChanged();
void allSettingsChanged();
@@ -157,10 +165,10 @@ Q_SIGNALS:
void notifySettingChanged(QString);
void notifyNeedsRestart();
-private:
- void notifySettingUpdate(); // TODO core notification callbacks
+ private:
+ void notifySettingUpdate(); // TODO core notification callbacks
-private Q_SLOTS:
+ private Q_SLOTS:
void toggleBoolSetting();
void updateBoolSetting(bool enabled);
void updateEnumStringSetting(const QString& text);
@@ -179,26 +187,26 @@ private Q_SLOTS:
void selectInterpreter();
void selectVirtualEnv();
-public Q_SLOTS:
+ public Q_SLOTS:
void updateScope(BinaryViewRef, BNSettingsScope);
void updateSize();
void updateViewMode(bool enabled);
-private:
+ private:
void contextMenu();
-protected:
+ protected:
bool eventFilter(QObject* obj, QEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
- void paintEvent(QPaintEvent *event) override;
+ void paintEvent(QPaintEvent* event) override;
};
-class BINARYNINJAUIAPI SettingsDelegate: public QStyledItemDelegate
+class BINARYNINJAUIAPI SettingsDelegate : public QStyledItemDelegate
{
Q_OBJECT
-private:
+ private:
SettingsRef m_settings;
SettingsFilterProxyModel* m_filterModel;
BinaryViewRef m_view = nullptr;
@@ -213,8 +221,9 @@ private:
std::function<void(const QModelIndex& index)> m_hoverAction = nullptr;
std::function<void()> m_defaultSelectionAction = nullptr;
-public:
- SettingsDelegate(QWidget* parent, SettingsRef settings, SettingsFilterProxyModel* filterModel, const std::function<void(const QModelIndex& index)>& hoverAction = nullptr);
+ public:
+ SettingsDelegate(QWidget* parent, SettingsRef settings, SettingsFilterProxyModel* filterModel,
+ const std::function<void(const QModelIndex& index)>& hoverAction = nullptr);
~SettingsDelegate();
void setDefaultSelection(const std::function<void()>& selectionAction);
@@ -226,13 +235,14 @@ public:
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
void setEditorData(QWidget* editor, const QModelIndex& index) const override;
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
- void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
+ void updateEditorGeometry(
+ QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
-protected:
+ protected:
bool eventFilter(QObject* object, QEvent* event) override;
-public:
-Q_SIGNALS:
+ public:
+ Q_SIGNALS:
void refreshAllSettings() const;
void scopeChanged(BinaryViewRef, BNSettingsScope);
void sizeChanged();
@@ -240,37 +250,37 @@ Q_SIGNALS:
void notifyNeedsRestart() const;
void notifySettingChanged(QString settingId) const;
-public Q_SLOTS:
+ public Q_SLOTS:
void updateFonts();
void updateModel();
void updateScope(BinaryViewRef, BNSettingsScope);
void updateSize();
void updateViewMode(bool enabled) const;
-private Q_SLOTS:
+ private Q_SLOTS:
void commitEditorData();
void editorGeometryChanged();
};
-class BINARYNINJAUIAPI SettingsTreeView: public QTreeView
+class BINARYNINJAUIAPI SettingsTreeView : public QTreeView
{
Q_OBJECT
-public:
+ public:
explicit SettingsTreeView(QWidget* parent);
~SettingsTreeView();
-protected:
+ protected:
virtual void resizeEvent(QResizeEvent* event) override;
-public Q_SLOTS:
+ public Q_SLOTS:
void modelChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
};
-class BINARYNINJAUIAPI BinaryViewScopeLabel: public MenuHelper
+class BINARYNINJAUIAPI BinaryViewScopeLabel : public MenuHelper
{
Q_OBJECT
@@ -283,23 +293,23 @@ class BINARYNINJAUIAPI BinaryViewScopeLabel: public MenuHelper
UIActionHandler m_actionHandler;
-public:
+ public:
BinaryViewScopeLabel(QWidget* parent, const QString& name = "", BNSettingsScope scope = SettingsAutoScope);
void refresh();
const QString& currentSelection() { return m_curName; }
BinaryViewRef currentBinaryView() { return m_curView; }
-Q_SIGNALS:
+ Q_SIGNALS:
void itemSelected(BinaryViewRef, BNSettingsScope);
-protected:
+ protected:
virtual void showEvent(QShowEvent* event) override;
virtual void showMenu() override;
};
-class BINARYNINJAUIAPI SettingsScopeBar: public QWidget
+class BINARYNINJAUIAPI SettingsScopeBar : public QWidget
{
Q_OBJECT
@@ -311,17 +321,17 @@ class BINARYNINJAUIAPI SettingsScopeBar: public QWidget
void setScopeHighlight(unsigned long highlightIdx);
-public:
+ public:
SettingsScopeBar(QWidget* parent = nullptr);
void refresh();
-Q_SIGNALS:
+ Q_SIGNALS:
void scopeChanged(BinaryViewRef, BNSettingsScope);
};
-class BINARYNINJAUIAPI SearchFilter: public QLineEdit
+class BINARYNINJAUIAPI SearchFilter : public QLineEdit
{
Q_OBJECT
@@ -330,7 +340,7 @@ class BINARYNINJAUIAPI SearchFilter: public QLineEdit
QTimer* m_filterDelayTimer = nullptr;
int m_delay;
-public:
+ public:
SearchFilter(QWidget* parent = nullptr);
void addTag(const QString& tagName, int tag);
@@ -339,19 +349,19 @@ public:
std::pair<QString, std::vector<int>> getSearchParams();
-protected:
+ protected:
void keyPressEvent(QKeyEvent* event) override;
-Q_SIGNALS:
+ Q_SIGNALS:
void delayedTextChanged();
};
-class BINARYNINJAUIAPI SettingsView: public QWidget
+class BINARYNINJAUIAPI SettingsView : public QWidget
{
Q_OBJECT
-private:
+ private:
QWidget* m_owner = nullptr;
SettingsRef m_settings;
SettingsFilterProxyModel* m_proxyModel = nullptr;
@@ -364,7 +374,7 @@ private:
SearchFilter* m_search = nullptr;
bool m_outlineNavEnabled = true;
-public:
+ public:
SettingsView(QWidget* parent);
SettingsView(QWidget* parent, SettingsRef settings);
~SettingsView();
@@ -374,16 +384,16 @@ public:
void setData(BinaryViewRef view, const QString& name = "");
void setDefaultGroupSelection(const QString& group);
-public Q_SLOTS:
+ public Q_SLOTS:
void updateFonts();
void updateTheme();
-private Q_SLOTS:
+ private Q_SLOTS:
void outlineSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
void updateScopeFilter();
void updateTextFilter();
-Q_SIGNALS:
+ Q_SIGNALS:
void fontsChanged();
void notifyNeedsRestart();
void notifySettingChanged(QString settingId) const;
diff --git a/ui/sidebar.h b/ui/sidebar.h
index 52ea38de..ef0b0c0b 100644
--- a/ui/sidebar.h
+++ b/ui/sidebar.h
@@ -22,38 +22,39 @@ struct SidebarIcon
static SidebarIcon generate(const QImage& src);
};
-class BINARYNINJAUIAPI SidebarWidget: public QWidget
+class BINARYNINJAUIAPI SidebarWidget : public QWidget
{
Q_OBJECT
-protected:
+ protected:
QString m_title;
UIActionHandler m_actionHandler;
ContextMenuManager* m_contextMenuManager = nullptr;
Menu* m_menu = nullptr;
-public:
+ public:
SidebarWidget(const QString& title);
const QString& title() const { return m_title; }
- virtual void notifyFontChanged() { }
- virtual void notifyOffsetChanged(uint64_t /*offset*/) { }
+ virtual void notifyFontChanged() {}
+ virtual void notifyOffsetChanged(uint64_t /*offset*/) {}
virtual void notifyThemeChanged();
- virtual void notifyViewChanged(ViewFrame* /*frame*/) { }
- virtual void notifyViewLocationChanged(View* /*view*/, const ViewLocation& /*viewLocation*/) { }
+ virtual void notifyViewChanged(ViewFrame* /*frame*/) {}
+ virtual void notifyViewLocationChanged(View* /*view*/, const ViewLocation& /*viewLocation*/) {}
virtual void focus();
virtual QWidget* headerWidget() { return nullptr; }
};
-class BINARYNINJAUIAPI SidebarWidgetAndHeader: public QWidget
+class BINARYNINJAUIAPI SidebarWidgetAndHeader : public QWidget
{
Q_OBJECT
SidebarWidget* m_widget;
QWidget* m_header;
ViewFrame* m_frame;
-public:
+
+ public:
SidebarWidgetAndHeader(SidebarWidget* widget, ViewFrame* frame);
SidebarWidget* widget() const { return m_widget; }
@@ -64,27 +65,30 @@ public:
void updateFonts();
};
-class BINARYNINJAUIAPI SidebarHeaderTitle: public QLabel
+class BINARYNINJAUIAPI SidebarHeaderTitle : public QLabel
{
Q_OBJECT
-public:
+
+ public:
SidebarHeaderTitle(const QString& name);
};
-class BINARYNINJAUIAPI SidebarHeader: public QWidget
+class BINARYNINJAUIAPI SidebarHeader : public QWidget
{
Q_OBJECT
-public:
+
+ public:
SidebarHeader(const QString& name, QWidget* rightSide = nullptr);
};
-class BINARYNINJAUIAPI SidebarInvalidContextWidget: public SidebarWidget
+class BINARYNINJAUIAPI SidebarInvalidContextWidget : public SidebarWidget
{
Q_OBJECT
-public:
+
+ public:
SidebarInvalidContextWidget(const QString& title);
-private Q_SLOTS:
+ private Q_SLOTS:
void openFile();
};
@@ -93,7 +97,7 @@ class BINARYNINJAUIAPI SidebarWidgetType
SidebarIcon m_icon;
QString m_name;
-public:
+ public:
SidebarWidgetType(const QImage& icon, const QString& name);
virtual ~SidebarWidgetType() {}
@@ -118,7 +122,7 @@ struct SidebarWidgetContainerState
QList<int> parentSplitterSizes;
};
-class BINARYNINJAUIAPI SidebarWidgetContainer: public QWidget
+class BINARYNINJAUIAPI SidebarWidgetContainer : public QWidget
{
Q_OBJECT
@@ -148,7 +152,7 @@ class BINARYNINJAUIAPI SidebarWidgetContainer: public QWidget
static QVariant sizesToVariant(const QList<int>& sizes);
static std::optional<QList<int>> variantToSizes(const QVariant& variant);
-public:
+ public:
SidebarWidgetContainer();
void setSplitter(QSplitter* splitter);
@@ -181,15 +185,15 @@ public:
void toggleSidebar();
- void moveContextToContainer(SplitPaneWidget* panes, const std::vector<ViewFrame*>& frames,
- SidebarWidgetContainer* target);
+ void moveContextToContainer(
+ SplitPaneWidget* panes, const std::vector<ViewFrame*>& frames, SidebarWidgetContainer* target);
-Q_SIGNALS:
+ Q_SIGNALS:
void showContents();
void hideContents();
};
-class BINARYNINJAUIAPI Sidebar: public QWidget
+class BINARYNINJAUIAPI Sidebar : public QWidget
{
Q_OBJECT
@@ -201,13 +205,13 @@ class BINARYNINJAUIAPI Sidebar: public QWidget
static SidebarWidgetType* m_defaultContentType;
static SidebarWidgetType* m_defaultReferenceType;
-protected:
+ protected:
virtual void paintEvent(QPaintEvent* event) override;
virtual void mouseMoveEvent(QMouseEvent* event) override;
virtual void mousePressEvent(QMouseEvent* event) override;
virtual void leaveEvent(QEvent* event) override;
-public:
+ public:
Sidebar();
SidebarWidgetContainer* container() const { return m_currentContainer; }
@@ -245,7 +249,7 @@ public:
return context->sidebar();
}
- template<class T>
+ template <class T>
static T* widget(SidebarWidgetType* type)
{
Sidebar* sidebar = current();
@@ -257,13 +261,13 @@ public:
return qobject_cast<T*>(widget);
}
- template<class T>
+ template <class T>
static T* widget(const QString& name)
{
return widget<T>(Sidebar::typeFromName(name));
}
- template<class T>
+ template <class T>
static T* activateWidget(SidebarWidgetType* type)
{
Sidebar* sidebar = current();
@@ -279,76 +283,72 @@ public:
return result;
}
- template<class T>
+ template <class T>
static T* activateWidget(const QString& name)
{
return activateWidget<T>(Sidebar::typeFromName(name));
}
- template<class T>
- static UIAction globalSidebarAction(const QString& name,
- const std::function<void(T* obj)>& activate)
+ template <class T>
+ static UIAction globalSidebarAction(const QString& name, const std::function<void(T* obj)>& activate)
{
- return globalSidebarAction<T>(name,
- [=](T* obj, const UIActionContext&) { activate(obj); },
- [=](T*, const UIActionContext&) { return true; });
+ return globalSidebarAction<T>(
+ name, [=](T* obj, const UIActionContext&) { activate(obj); },
+ [=](T*, const UIActionContext&) { return true; });
}
- template<class T>
- static UIAction globalSidebarAction(const QString& name,
- const std::function<void(T* obj, const UIActionContext& ctxt)>& activate)
+ template <class T>
+ static UIAction globalSidebarAction(
+ const QString& name, const std::function<void(T* obj, const UIActionContext& ctxt)>& activate)
{
- return globalSidebarAction<T>(name, activate,
- [](T*, const UIActionContext&) { return true; });
+ return globalSidebarAction<T>(name, activate, [](T*, const UIActionContext&) { return true; });
}
- template<class T>
- static UIAction globalSidebarAction(const QString& name,
- const std::function<void(T* obj)>& activate, const std::function<bool(T* obj)>& isValid)
+ template <class T>
+ static UIAction globalSidebarAction(
+ const QString& name, const std::function<void(T* obj)>& activate, const std::function<bool(T* obj)>& isValid)
{
- return globalSidebarAction<T>(name,
- [=](T* obj, const UIActionContext&) { activate(obj); },
- [=](T* obj, const UIActionContext&) { return isValid(obj); });
+ return globalSidebarAction<T>(
+ name, [=](T* obj, const UIActionContext&) { activate(obj); },
+ [=](T* obj, const UIActionContext&) { return isValid(obj); });
}
- template<class T>
+ template <class T>
static UIAction globalSidebarAction(const QString& name,
- const std::function<void(T* obj, const UIActionContext& ctxt)>& activate,
- const std::function<bool(T* obj, const UIActionContext& ctxt)>& isValid)
+ const std::function<void(T* obj, const UIActionContext& ctxt)>& activate,
+ const std::function<bool(T* obj, const UIActionContext& ctxt)>& isValid)
{
return globalSidebarAction<T>(Sidebar::typeFromName(name), activate, isValid);
}
- template<class T>
- static UIAction globalSidebarAction(SidebarWidgetType* type,
- const std::function<void(T* obj)>& activate)
+ template <class T>
+ static UIAction globalSidebarAction(SidebarWidgetType* type, const std::function<void(T* obj)>& activate)
{
- return globalSidebarAction<T>(type,
- [=](T* obj, const UIActionContext&) { activate(obj); },
- [=](T*, const UIActionContext&) { return true; });
+ return globalSidebarAction<T>(
+ type, [=](T* obj, const UIActionContext&) { activate(obj); },
+ [=](T*, const UIActionContext&) { return true; });
}
- template<class T>
- static UIAction globalSidebarAction(SidebarWidgetType* type,
- const std::function<void(T* obj, const UIActionContext& ctxt)>& activate)
+ template <class T>
+ static UIAction globalSidebarAction(
+ SidebarWidgetType* type, const std::function<void(T* obj, const UIActionContext& ctxt)>& activate)
{
- return globalSidebarAction<T>(type, activate,
- [](T*, const UIActionContext&) { return true; });
+ return globalSidebarAction<T>(type, activate, [](T*, const UIActionContext&) { return true; });
}
- template<class T>
- static UIAction globalSidebarAction(SidebarWidgetType* type,
- const std::function<void(T* obj)>& activate, const std::function<bool(T* obj)>& isValid)
+ template <class T>
+ static UIAction globalSidebarAction(SidebarWidgetType* type, const std::function<void(T* obj)>& activate,
+ const std::function<bool(T* obj)>& isValid)
{
- return globalSidebarAction<T>(type,
- [=](T* obj, const UIActionContext&) { activate(obj); },
- [=](T* obj, const UIActionContext&) { return isValid(obj); });
+ return globalSidebarAction<T>(
+ type, [=](T* obj, const UIActionContext&) { activate(obj); },
+ [=](T* obj, const UIActionContext&) { return isValid(obj); });
}
- template<class T>
+ template <class T>
static UIAction globalSidebarAction(SidebarWidgetType* type,
- const std::function<void(T* obj, const UIActionContext& ctxt)>& activate,
- const std::function<bool(T* obj, const UIActionContext& ctxt)>& isValid)
+ const std::function<void(T* obj, const UIActionContext& ctxt)>& activate,
+ const std::function<bool(T* obj, const UIActionContext& ctxt)>& isValid)
{
std::function<T*(const UIActionContext& ctxt)> lookup = [=](const UIActionContext& ctxt) {
if (!type || !ctxt.context)
@@ -362,45 +362,43 @@ public:
return qobject_cast<T*>(widget);
};
return UIAction(
- [=](const UIActionContext& ctxt) {
- T* obj = lookup(ctxt);
- if (obj)
- activate(obj, ctxt);
- },
- [=](const UIActionContext& ctxt) {
- T* obj = lookup(ctxt);
- if (obj)
- return isValid(obj, ctxt);
- return false;
- });
+ [=](const UIActionContext& ctxt) {
+ T* obj = lookup(ctxt);
+ if (obj)
+ activate(obj, ctxt);
+ },
+ [=](const UIActionContext& ctxt) {
+ T* obj = lookup(ctxt);
+ if (obj)
+ return isValid(obj, ctxt);
+ return false;
+ });
}
- template<class T>
- static std::function<bool(const UIActionContext&)> globalSidebarActionChecked(const QString& name,
- const std::function<bool(T* obj)>& isChecked)
+ template <class T>
+ static std::function<bool(const UIActionContext&)> globalSidebarActionChecked(
+ const QString& name, const std::function<bool(T* obj)>& isChecked)
{
- return globalSidebarActionChecked<T>(name,
- [=](T* obj, const UIActionContext&) { return isChecked(obj); });
+ return globalSidebarActionChecked<T>(name, [=](T* obj, const UIActionContext&) { return isChecked(obj); });
}
- template<class T>
- static std::function<bool(const UIActionContext&)> globalSidebarActionChecked(const QString& name,
- const std::function<bool(T* obj, const UIActionContext& ctxt)>& isChecked)
+ template <class T>
+ static std::function<bool(const UIActionContext&)> globalSidebarActionChecked(
+ const QString& name, const std::function<bool(T* obj, const UIActionContext& ctxt)>& isChecked)
{
return globalSidebarActionChecked<T>(Sidebar::typeFromName(name), isChecked);
}
- template<class T>
- static std::function<bool(const UIActionContext&)> globalSidebarActionChecked(SidebarWidgetType* type,
- const std::function<bool(T* obj)>& isChecked)
+ template <class T>
+ static std::function<bool(const UIActionContext&)> globalSidebarActionChecked(
+ SidebarWidgetType* type, const std::function<bool(T* obj)>& isChecked)
{
- return globalSidebarActionChecked<T>(type,
- [=](T* obj, const UIActionContext&) { return isChecked(obj); });
+ return globalSidebarActionChecked<T>(type, [=](T* obj, const UIActionContext&) { return isChecked(obj); });
}
- template<class T>
- static std::function<bool(const UIActionContext&)> globalSidebarActionChecked(SidebarWidgetType* type,
- const std::function<bool(T* obj, const UIActionContext& ctxt)>& isChecked)
+ template <class T>
+ static std::function<bool(const UIActionContext&)> globalSidebarActionChecked(
+ SidebarWidgetType* type, const std::function<bool(T* obj, const UIActionContext& ctxt)>& isChecked)
{
return [=](const UIActionContext& ctxt) {
if (!type || !ctxt.context)
diff --git a/ui/stackview.h b/ui/stackview.h
index 34e83950..c2e31a11 100644
--- a/ui/stackview.h
+++ b/ui/stackview.h
@@ -27,18 +27,17 @@ class BINARYNINJAUIAPI CreateStackVariableDialog : public QDialog
//! Automatically update/sanitize the offset and name fields after input.
void autoFillFields();
- protected:
+ protected:
void accept() override;
- public:
- CreateStackVariableDialog(
- QWidget* parent, BinaryViewRef data, FunctionRef func, int64_t initialOffset = 0);
+ public:
+ CreateStackVariableDialog(QWidget* parent, BinaryViewRef data, FunctionRef func, int64_t initialOffset = 0);
};
//! A single line in the stack view.
class StackViewLine
{
- public:
+ public:
enum class Type
{
Variable,
@@ -49,12 +48,10 @@ class StackViewLine
};
//! Create a new line for a variable.
- static StackViewLine variable(
- int64_t offset, const BinaryNinja::VariableNameAndType& vnat, PlatformRef plat);
+ static StackViewLine variable(int64_t offset, const BinaryNinja::VariableNameAndType& vnat, PlatformRef plat);
//! Create a new line for a struct or array member.
- static StackViewLine member(
- int64_t offset, const BinaryNinja::VariableNameAndType& vnat, PlatformRef plat);
+ static StackViewLine member(int64_t offset, const BinaryNinja::VariableNameAndType& vnat, PlatformRef plat);
//! Create a new line for a struct offset reference.
static StackViewLine offsetRef(int64_t base, uint64_t offset, size_t size);
@@ -128,7 +125,7 @@ class StackViewLine
//! Indent this line's content.
void indent(size_t levels = 1);
- private:
+ private:
StackViewLine(StackViewLine::Type type, int64_t offset);
StackViewLine::Type m_type;
@@ -184,12 +181,12 @@ class BINARYNINJAUIAPI StackView : public QAbstractScrollArea, public View
//! Find the end of a stack void given a start offset.
int64_t findVoidEnd(int64_t start) const;
- protected:
+ protected:
void paintEvent(QPaintEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void mouseDoubleClickEvent(QMouseEvent* event) override;
- public:
+ public:
StackView(ViewFrame* view, BinaryViewRef data);
//! Refresh the stack view's content.
@@ -252,7 +249,7 @@ class BINARYNINJAUIAPI StackViewSidebarWidget : public SidebarWidget
StackView* m_stackView;
QWidget* m_header;
- public:
+ public:
StackViewSidebarWidget(ViewFrame* view, BinaryViewRef data);
void refresh();
@@ -263,7 +260,7 @@ class BINARYNINJAUIAPI StackViewSidebarWidget : public SidebarWidget
class BINARYNINJAUIAPI StackViewSidebarWidgetType : public SidebarWidgetType
{
- public:
+ public:
StackViewSidebarWidgetType();
SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;
};
diff --git a/ui/statusbarwidget.h b/ui/statusbarwidget.h
index b41391a0..b7ab2537 100644
--- a/ui/statusbarwidget.h
+++ b/ui/statusbarwidget.h
@@ -4,20 +4,20 @@
#include <QtWidgets/QLabel>
#include "uicontext.h"
-class BINARYNINJAUIAPI StatusBarWidget: public QWidget
+class BINARYNINJAUIAPI StatusBarWidget : public QWidget
{
Q_OBJECT
-public:
+ public:
StatusBarWidget(QWidget* parent);
virtual void updateStatus();
};
-class BINARYNINJAUIAPI DisabledOptionsStatusBarWidget: public StatusBarWidget
+class BINARYNINJAUIAPI DisabledOptionsStatusBarWidget : public StatusBarWidget
{
-public:
+ public:
DisabledOptionsStatusBarWidget(QFrame* parent);
-private:
+ private:
QLabel* m_label;
};
diff --git a/ui/stringsview.h b/ui/stringsview.h
index b70c6d68..4a843bb1 100644
--- a/ui/stringsview.h
+++ b/ui/stringsview.h
@@ -9,7 +9,7 @@
#define STRINGS_LIST_UPDATE_INTERVAL 250
-class BINARYNINJAUIAPI StringsListModel: public QAbstractItemModel, public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI StringsListModel : public QAbstractItemModel, public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
@@ -33,7 +33,7 @@ class BINARYNINJAUIAPI StringsListModel: public QAbstractItemModel, public Binar
std::vector<StringUpdateEvent> getQueuedStringUpdates();
-public:
+ public:
StringsListModel(QWidget* parent, BinaryViewRef data);
virtual ~StringsListModel();
@@ -48,13 +48,14 @@ public:
QModelIndex findString(const BNStringReference& ref);
virtual void OnStringFound(BinaryNinja::BinaryView* data, BNStringType type, uint64_t offset, size_t len) override;
- virtual void OnStringRemoved(BinaryNinja::BinaryView* data, BNStringType type, uint64_t offset, size_t len) override;
+ virtual void OnStringRemoved(
+ BinaryNinja::BinaryView* data, BNStringType type, uint64_t offset, size_t len) override;
void updateStrings();
void setFilter(const std::string& filter);
};
-class BINARYNINJAUIAPI StringItemDelegate: public QStyledItemDelegate
+class BINARYNINJAUIAPI StringItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
@@ -64,7 +65,7 @@ class BINARYNINJAUIAPI StringItemDelegate: public QStyledItemDelegate
void initFont();
-public:
+ public:
StringItemDelegate(QWidget* parent);
void updateFonts();
@@ -76,7 +77,7 @@ public:
class StringsContainer;
-class BINARYNINJAUIAPI StringsView: public QListView, public View, public FilterTarget
+class BINARYNINJAUIAPI StringsView : public QListView, public View, public FilterTarget
{
Q_OBJECT
@@ -90,7 +91,7 @@ class BINARYNINJAUIAPI StringsView: public QListView, public View, public Filter
uint64_t m_selectionBegin, m_selectionEnd;
-public:
+ public:
StringsView(BinaryViewRef data, ViewFrame* view, StringsContainer* container);
virtual BinaryViewRef getData() override { return m_data; }
@@ -111,16 +112,17 @@ public:
virtual void selectFirstItem() override;
virtual void activateFirstItem() override;
virtual QFont getFont() override { return m_itemDelegate->getFont(); }
-protected:
+
+ protected:
virtual void keyPressEvent(QKeyEvent* event) override;
virtual bool event(QEvent* event) override;
-private Q_SLOTS:
+ private Q_SLOTS:
void goToString(const QModelIndex& idx);
void updateTimerEvent();
};
-class BINARYNINJAUIAPI StringsContainer: public QWidget, public ViewContainer
+class BINARYNINJAUIAPI StringsContainer : public QWidget, public ViewContainer
{
Q_OBJECT
@@ -129,7 +131,7 @@ class BINARYNINJAUIAPI StringsContainer: public QWidget, public ViewContainer
FilteredView* m_filter;
FilterEdit* m_separateEdit = nullptr;
-public:
+ public:
StringsContainer(BinaryViewRef data, ViewFrame* view, bool separateEdit = false);
virtual View* getView() override { return m_strings; }
@@ -137,15 +139,15 @@ public:
FilteredView* getFilter() { return m_filter; }
FilterEdit* getSeparateFilterEdit() { return m_separateEdit; }
-protected:
+ protected:
virtual void focusInEvent(QFocusEvent* event) override;
};
-class StringsViewType: public ViewType
+class StringsViewType : public ViewType
{
static StringsViewType* m_instance;
-public:
+ public:
StringsViewType();
virtual int getPriority(BinaryViewRef data, const QString& filename);
virtual QWidget* create(BinaryViewRef data, ViewFrame* viewFrame);
@@ -153,22 +155,23 @@ public:
};
-class BINARYNINJAUIAPI StringsViewSidebarWidget: public SidebarWidget
+class BINARYNINJAUIAPI StringsViewSidebarWidget : public SidebarWidget
{
Q_OBJECT
QWidget* m_header;
StringsContainer* m_container;
-public:
+
+ public:
StringsViewSidebarWidget(BinaryViewRef data, ViewFrame* frame);
virtual QWidget* headerWidget() override { return m_header; }
virtual void focus() override;
};
-class BINARYNINJAUIAPI StringsViewSidebarWidgetType: public SidebarWidgetType
+class BINARYNINJAUIAPI StringsViewSidebarWidgetType : public SidebarWidgetType
{
-public:
+ public:
StringsViewSidebarWidgetType();
virtual SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;
};
diff --git a/ui/symbollist.h b/ui/symbollist.h
index 471a6e00..ffefa3c8 100644
--- a/ui/symbollist.h
+++ b/ui/symbollist.h
@@ -20,22 +20,23 @@
class SymbolsView;
static std::string emptyArch;
-class BINARYNINJAUIAPI SymbolListDelegate: public QStyledItemDelegate
+class BINARYNINJAUIAPI SymbolListDelegate : public QStyledItemDelegate
{
Q_OBJECT
QFont m_font;
int m_height, m_charWidth;
-public:
+ public:
SymbolListDelegate(QWidget* parent);
void updateFonts();
- virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
};
-class BINARYNINJAUIAPI SymbolListModel: public QAbstractItemModel, public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI SymbolListModel : public QAbstractItemModel, public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
-public:
+
+ public:
enum SortType
{
SortAscendingAddresses,
@@ -90,10 +91,7 @@ public:
return (getStart() == other.getStart()) && (getType() == other.getType());
}
- bool operator!=(const NamedObject& other) const
- {
- return !((*this) == other);
- }
+ bool operator!=(const NamedObject& other) const { return !((*this) == other); }
bool operator<(const NamedObject& other) const
{
@@ -113,7 +111,11 @@ public:
return false;
}
- bool isFunc() const { return (getType() == FunctionSymbol) || (getType() == ImportedFunctionSymbol) || (getType() == LibraryFunctionSymbol); }
+ bool isFunc() const
+ {
+ return (getType() == FunctionSymbol) || (getType() == ImportedFunctionSymbol)
+ || (getType() == LibraryFunctionSymbol);
+ }
uint64_t getStart() const { return sym->GetAddress(); }
std::string getName() const { return name; }
std::string getRawName() const { return rawName; }
@@ -148,7 +150,7 @@ public:
BNSymbolType getType() const { return sym->GetType(); }
};
-private:
+ private:
enum SymbolListUpdateType
{
UnnamedFunctionAddedToSymbolList,
@@ -170,13 +172,13 @@ private:
}
};
- class SymbolListUpdate: public BinaryNinja::RefCountObject
+ class SymbolListUpdate : public BinaryNinja::RefCountObject
{
std::mutex m_mutex;
bool m_valid;
SymbolListModel* m_model;
- public:
+ public:
SymbolListUpdate(SymbolListModel* model);
void start();
void abort();
@@ -213,7 +215,7 @@ private:
void getValidObject(std::deque<NamedObject>& result);
-public:
+ public:
SymbolListModel(QWidget* parent, ViewFrame* view, BinaryViewRef data);
virtual ~SymbolListModel();
@@ -259,11 +261,11 @@ public:
void toggleLocalDataVars() { m_showLocalDataVars = !m_showLocalDataVars; }
void toggleImports() { m_showImports = !m_showImports; }
- bool getShowExportedFunctions() const { return m_showExportedFunctions; }
- bool getShowExportedDataVars() const { return m_showExportedDataVars; }
- bool getShowLocalFunctions() const { return m_showLocalFunctions; }
- bool getShowLocalDataVars() const { return m_showLocalDataVars; }
- bool getShowImports() const { return m_showImports; }
+ bool getShowExportedFunctions() const { return m_showExportedFunctions; }
+ bool getShowExportedDataVars() const { return m_showExportedDataVars; }
+ bool getShowLocalFunctions() const { return m_showLocalFunctions; }
+ bool getShowLocalDataVars() const { return m_showLocalDataVars; }
+ bool getShowImports() const { return m_showImports; }
bool getShowMangled() const { return m_displayMangled; }
void setShowMangled(bool show) { m_displayMangled = show; }
@@ -275,13 +277,13 @@ public:
bool checkTriggerFullUpdate();
-Q_SIGNALS:
+ Q_SIGNALS:
void afterListReset();
void beforeListReset();
};
-class BINARYNINJAUIAPI SymbolList: public QListView, public FilterTarget
+class BINARYNINJAUIAPI SymbolList : public QListView, public FilterTarget
{
Q_OBJECT
@@ -303,7 +305,7 @@ class BINARYNINJAUIAPI SymbolList: public QListView, public FilterTarget
SymbolListModel::NamedObject m_topIndex;
bool m_doubleClick;
-public:
+ public:
SymbolList(SymbolsView* parent, ViewFrame* frame, BinaryViewRef data);
void updateFonts();
@@ -335,12 +337,12 @@ public:
void toggleLocalDataVars() { m_list->toggleLocalDataVars(); }
void toggleImports() { m_list->toggleImports(); }
-protected:
+ protected:
virtual void focusOutEvent(QFocusEvent* event) override;
virtual void keyPressEvent(QKeyEvent* event) override;
virtual bool event(QEvent* event) override;
-private Q_SLOTS:
+ private Q_SLOTS:
void goToSymbol(const QModelIndex& i);
void updateTimerEvent();
void savePosition();
diff --git a/ui/symbolsview.h b/ui/symbolsview.h
index 0a948d81..0997285b 100644
--- a/ui/symbolsview.h
+++ b/ui/symbolsview.h
@@ -9,7 +9,7 @@
class ViewFrame;
class SymbolList;
-class BINARYNINJAUIAPI SymbolsView: public SidebarWidget, public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI SymbolsView : public SidebarWidget, public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
@@ -24,7 +24,7 @@ class BINARYNINJAUIAPI SymbolsView: public SidebarWidget, public BinaryNinja::Bi
bool m_updatesPending;
QTimer* m_updateTimer;
-public:
+ public:
SymbolsView(ViewFrame* frame, BinaryViewRef data);
virtual ~SymbolsView();
@@ -51,18 +51,18 @@ public:
virtual QWidget* headerWidget() override { return m_header; }
virtual void focus() override;
-protected:
+ protected:
virtual void contextMenuEvent(QContextMenuEvent* event) override;
virtual void notifyFontChanged() override;
-private Q_SLOTS:
+ private Q_SLOTS:
void updateTimerEvent();
void showContextMenu();
};
-class BINARYNINJAUIAPI SymbolsViewSidebarWidgetType: public SidebarWidgetType
+class BINARYNINJAUIAPI SymbolsViewSidebarWidgetType : public SidebarWidgetType
{
-public:
+ public:
SymbolsViewSidebarWidgetType();
virtual SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;
};
diff --git a/ui/syncgroup.h b/ui/syncgroup.h
index ff4fd9d0..6600f8ce 100644
--- a/ui/syncgroup.h
+++ b/ui/syncgroup.h
@@ -9,7 +9,7 @@ class BINARYNINJAUIAPI SyncGroup
ViewFrame* m_lastSyncFrame = nullptr;
int m_id;
-public:
+ public:
SyncGroup(int id);
void addMember(ViewFrame* frame);
@@ -26,18 +26,18 @@ public:
static void syncToTarget(View* srcView, ViewFrame* targetFrame, const ViewLocation& location);
};
-class BINARYNINJAUIAPI SyncGroupWidget: public ClickableIcon
+class BINARYNINJAUIAPI SyncGroupWidget : public ClickableIcon
{
Q_OBJECT
ViewFrame* m_frame;
-public:
+ public:
SyncGroupWidget(ViewFrame* frame);
void updateStatus();
void setViewFrame(ViewFrame* frame);
-private Q_SLOTS:
+ private Q_SLOTS:
void handleClick();
};
diff --git a/ui/tabwidget.h b/ui/tabwidget.h
index 08b84182..bf0c3ca2 100644
--- a/ui/tabwidget.h
+++ b/ui/tabwidget.h
@@ -19,14 +19,14 @@ class BINARYNINJAUIAPI DockableTabCollection
{
std::set<DockableTabWidget*> m_containers;
-public:
+ public:
void registerContainer(DockableTabWidget* widget);
void unregisterContainer(DockableTabWidget* widget);
const std::set<DockableTabWidget*>& containers() const { return m_containers; }
};
-class BINARYNINJAUIAPI TabDragIndicator: public QWidget
+class BINARYNINJAUIAPI TabDragIndicator : public QWidget
{
Q_OBJECT
@@ -36,7 +36,7 @@ class BINARYNINJAUIAPI TabDragIndicator: public QWidget
QPoint m_offset;
bool m_newWindow;
-public:
+ public:
TabDragIndicator(QPixmap pixmap, QSize size, QPoint pt, QPoint offset, bool newWindow);
void moveToMouse(QPoint pt);
@@ -44,7 +44,7 @@ public:
QSize size() const { return m_size; }
QPoint offset() const { return m_offset; }
-protected:
+ protected:
virtual QSize sizeHint() const override;
virtual QSize minimumSizeHint() const override;
virtual void paintEvent(QPaintEvent* event) override;
@@ -70,42 +70,40 @@ struct BINARYNINJAUIAPI DockableTabInfo
class BINARYNINJAUIAPI DockableTabStyle
{
-public:
+ public:
virtual ~DockableTabStyle() {}
- virtual QSize sizeForTab(const QWidget* widget, const DockableTabInfo& info, int idx,
- int count, int active) const;
- virtual QRect closeButtonRect(const QWidget* widget, const DockableTabInfo& info, int idx,
- int count, int active) const;
- virtual QRect closeIconRect(const QWidget* widget, const DockableTabInfo& info, int idx,
- int count, int active) const;
- virtual void paintTab(const QWidget* widget, QStylePainter& p, const DockableTabInfo& info, int idx,
- int count, int active, DockableTabInteractionState state, const QRect& rect) const;
- virtual void paintBase(const QWidget* widget, QStylePainter& p, const QRect& rect,
- const QRect& activeRect) const;
+ virtual QSize sizeForTab(const QWidget* widget, const DockableTabInfo& info, int idx, int count, int active) const;
+ virtual QRect closeButtonRect(
+ const QWidget* widget, const DockableTabInfo& info, int idx, int count, int active) const;
+ virtual QRect closeIconRect(
+ const QWidget* widget, const DockableTabInfo& info, int idx, int count, int active) const;
+ virtual void paintTab(const QWidget* widget, QStylePainter& p, const DockableTabInfo& info, int idx, int count,
+ int active, DockableTabInteractionState state, const QRect& rect) const;
+ virtual void paintBase(const QWidget* widget, QStylePainter& p, const QRect& rect, const QRect& activeRect) const;
virtual DockableTabStyle* duplicate();
};
-class BINARYNINJAUIAPI DefaultDockableTabStyle: public DockableTabStyle
+class BINARYNINJAUIAPI DefaultDockableTabStyle : public DockableTabStyle
{
- QStyleOptionTab styleForTab(const QWidget* widget, const DockableTabInfo& info, int idx,
- int count, int active) const;
+ QStyleOptionTab styleForTab(
+ const QWidget* widget, const DockableTabInfo& info, int idx, int count, int active) const;
int closeButtonSize(const QWidget* widget) const;
-public:
- virtual QSize sizeForTab(const QWidget* widget, const DockableTabInfo& info, int idx,
- int count, int active) const override;
- virtual QRect closeButtonRect(const QWidget* widget, const DockableTabInfo& info, int idx,
- int count, int active) const override;
- virtual QRect closeIconRect(const QWidget* widget, const DockableTabInfo& info, int idx,
- int count, int active) const override;
- virtual void paintTab(const QWidget* widget, QStylePainter& p, const DockableTabInfo& info, int idx,
- int count, int active, DockableTabInteractionState state, const QRect& rect) const override;
- virtual void paintBase(const QWidget* widget, QStylePainter& p, const QRect& rect,
- const QRect& activeRect) const override;
+ public:
+ virtual QSize sizeForTab(
+ const QWidget* widget, const DockableTabInfo& info, int idx, int count, int active) const override;
+ virtual QRect closeButtonRect(
+ const QWidget* widget, const DockableTabInfo& info, int idx, int count, int active) const override;
+ virtual QRect closeIconRect(
+ const QWidget* widget, const DockableTabInfo& info, int idx, int count, int active) const override;
+ virtual void paintTab(const QWidget* widget, QStylePainter& p, const DockableTabInfo& info, int idx, int count,
+ int active, DockableTabInteractionState state, const QRect& rect) const override;
+ virtual void paintBase(
+ const QWidget* widget, QStylePainter& p, const QRect& rect, const QRect& activeRect) const override;
virtual DockableTabStyle* duplicate() override;
};
-class BINARYNINJAUIAPI DockableTabBar: public QAbstractScrollArea
+class BINARYNINJAUIAPI DockableTabBar : public QAbstractScrollArea
{
Q_OBJECT
@@ -138,7 +136,7 @@ class BINARYNINJAUIAPI DockableTabBar: public QAbstractScrollArea
void updateLayout();
-public:
+ public:
DockableTabBar(DockableTabCollection* collection);
virtual ~DockableTabBar();
@@ -169,7 +167,7 @@ public:
DockableTabStyle* tabStyle() const { return m_style; }
void setTabStyle(DockableTabStyle* style);
-Q_SIGNALS:
+ Q_SIGNALS:
void currentChanged(int idx);
void tabCloseRequested(int idx);
void tabMoved(int oldIdx, int newIdx);
@@ -177,10 +175,10 @@ Q_SIGNALS:
void reparentTab(int oldIdx, DockableTabWidget* target, int newIdx);
void splitTab(int idx, Qt::Edge edge);
-private Q_SLOTS:
+ private Q_SLOTS:
void underMouseTimerEvent();
-protected:
+ protected:
virtual QSize sizeHint() const override;
virtual QSize minimumSizeHint() const override;
virtual void paintEvent(QPaintEvent* event) override;
@@ -193,7 +191,7 @@ protected:
virtual void wheelEvent(QWheelEvent* event) override;
};
-class BINARYNINJAUIAPI DockableTabBarWithCornerWidget: public QWidget
+class BINARYNINJAUIAPI DockableTabBarWithCornerWidget : public QWidget
{
DockableTabBar* m_bar;
QHBoxLayout* m_barLayout;
@@ -201,10 +199,10 @@ class BINARYNINJAUIAPI DockableTabBarWithCornerWidget: public QWidget
QWidget* m_cornerWidget = nullptr;
QWidget* m_cornerWidgetContainer = nullptr;
-protected:
+ protected:
virtual void paintEvent(QPaintEvent* event) override;
-public:
+ public:
DockableTabBarWithCornerWidget(DockableTabBar* bar);
DockableTabBar* tabBar() const { return m_bar; }
void setCornerWidget(QWidget* widget, Qt::Corner corner = Qt::TopRightCorner);
@@ -212,7 +210,7 @@ public:
QWidget* cornerWidget() const { return m_cornerWidget; }
};
-class BINARYNINJAUIAPI DockableTabWidget: public QWidget
+class BINARYNINJAUIAPI DockableTabWidget : public QWidget
{
Q_OBJECT
@@ -221,10 +219,10 @@ class BINARYNINJAUIAPI DockableTabWidget: public QWidget
DockableTabBarWithCornerWidget* m_cornerWidget;
QStackedWidget* m_widgets;
- void addReparentedTab(DockableTabWidget* source, int idx, QWidget* widget,
- const QString& title, const QString& toolTip, bool canClose);
+ void addReparentedTab(DockableTabWidget* source, int idx, QWidget* widget, const QString& title,
+ const QString& toolTip, bool canClose);
-public:
+ public:
DockableTabWidget(DockableTabCollection* collection, DockableTabBar* bar = nullptr);
int addTab(QWidget* widget, const QString& title);
@@ -261,7 +259,7 @@ public:
virtual QSize sizeHint() const override;
-Q_SIGNALS:
+ Q_SIGNALS:
void tabCloseRequested(int idx);
void currentChanged(int idx);
void tabMoved(int oldIdx, int newIdx);
@@ -270,7 +268,7 @@ Q_SIGNALS:
void tabAddedForReparent(int idx, DockableTabWidget* source);
void splitTab(int idx, Qt::Edge edge);
-private Q_SLOTS:
+ private Q_SLOTS:
void tabBarCurrentChanged(int idx);
void tabBarCloseRequested(int idx);
void tabBarTabMoved(int oldIdx, int newIdx);
@@ -279,7 +277,7 @@ private Q_SLOTS:
void reparentTab(int oldIdx, DockableTabWidget* target, int newIdx);
};
-class BINARYNINJAUIAPI SplitTabWidget: public QWidget
+class BINARYNINJAUIAPI SplitTabWidget : public QWidget
{
Q_OBJECT
@@ -298,12 +296,12 @@ class BINARYNINJAUIAPI SplitTabWidget: public QWidget
void enumerateTabTree(const std::function<void(SplitTabWidget*, QWidget*, QString)>& func);
Json::Value savedLayoutObject() const;
void restoreLayoutObject(const Json::Value& layout);
- void restoreLayoutObjectWithTabs(const Json::Value& layout,
- std::map<QString, std::pair<DockableTabWidget*, QWidget*>>& tabWidgets);
+ void restoreLayoutObjectWithTabs(
+ const Json::Value& layout, std::map<QString, std::pair<DockableTabWidget*, QWidget*>>& tabWidgets);
DockableTabWidget* findFirstTabWidget();
void collapseEmptyTabs();
-public:
+ public:
SplitTabWidget(DockableTabCollection* collection);
void addTab(QWidget* widget, const QString& title);
@@ -319,12 +317,12 @@ public:
QString savedLayoutString() const;
void restoreLayoutString(const QString& layout);
-Q_SIGNALS:
+ Q_SIGNALS:
void tabClosed(QWidget* widget);
void currentChanged(QWidget* widget);
void layoutChanged();
-private Q_SLOTS:
+ private Q_SLOTS:
void tabCloseRequested(int idx);
void currentTabChanged(int idx);
void splitTab(int idx, Qt::Edge edge);
diff --git a/ui/taglist.h b/ui/taglist.h
index 8b28ef32..c5ef0c7d 100644
--- a/ui/taglist.h
+++ b/ui/taglist.h
@@ -13,11 +13,11 @@
#include "tagtypelist.h"
-class BINARYNINJAUIAPI TagListModel: public QAbstractItemModel
+class BINARYNINJAUIAPI TagListModel : public QAbstractItemModel
{
Q_OBJECT
-protected:
+ protected:
QWidget* m_owner;
BinaryViewRef m_data;
std::map<TagTypeRef, size_t> m_typeIndexes;
@@ -25,7 +25,7 @@ protected:
std::map<int, QSize> m_sectionSizeHints;
DisassemblySettingsRef m_settings;
-private:
+ private:
void AddDisassemblyTokens(QList<QVariant>& line, std::vector<BinaryNinja::InstructionTextToken> tokens) const;
void TrimLeadingWhitespace(QList<QVariant>& line) const;
@@ -40,7 +40,7 @@ private:
QVariant GetDataColumn(const TagTypeRef& ref) const;
QVariant GetPreviewColumn(const TagTypeRef& ref) const;
-public:
+ public:
TagListModel(QWidget* parent, BinaryViewRef data);
BinaryNinja::TagReference& GetRef(const QModelIndex& index);
@@ -62,21 +62,22 @@ public:
virtual Qt::ItemFlags flags(const QModelIndex& i) const override;
virtual void sort(int column, Qt::SortOrder order) override;
- bool setModelData(const std::vector<std::pair<TagTypeRef, std::vector<BinaryNinja::TagReference>>>& refs, QItemSelectionModel* selectionModel, int sortColumn, Qt::SortOrder sortOrder, bool& selectionUpdated);
+ bool setModelData(const std::vector<std::pair<TagTypeRef, std::vector<BinaryNinja::TagReference>>>& refs,
+ QItemSelectionModel* selectionModel, int sortColumn, Qt::SortOrder sortOrder, bool& selectionUpdated);
};
-class BINARYNINJAUIAPI TagItemDelegate: public QStyledItemDelegate
+class BINARYNINJAUIAPI TagItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
-protected:
+ protected:
QFont m_font, m_monospaceFont, m_emojiFont;
int m_baseline, m_charWidth, m_charHeight, m_charOffset;
void initFont();
-public:
+ public:
TagItemDelegate(QWidget* parent);
void updateFonts();
@@ -87,8 +88,7 @@ public:
};
-class BINARYNINJAUIAPI TagList: public QTreeView,
- public BinaryNinja::BinaryDataNotification, public FilterTarget
+class BINARYNINJAUIAPI TagList : public QTreeView, public BinaryNinja::BinaryDataNotification, public FilterTarget
{
Q_OBJECT
@@ -104,10 +104,10 @@ class BINARYNINJAUIAPI TagList: public QTreeView,
Menu* m_menu;
std::unordered_map<std::string, bool> m_expandedItems;
-public:
+ public:
typedef std::function<bool(const BinaryNinja::TagReference&)> FilterFn;
-private:
+ private:
bool m_hasFilter;
FilterFn m_filter;
std::string m_searchFilter;
@@ -120,13 +120,13 @@ private:
bool m_needsUpdate;
bool m_navToNextOrPrevStarted = false;
-protected:
+ protected:
virtual void contextMenuEvent(QContextMenuEvent* event) override;
virtual void keyPressEvent(QKeyEvent* e) override;
virtual void mouseMoveEvent(QMouseEvent* e) override;
virtual void mousePressEvent(QMouseEvent* e) override;
virtual void wheelEvent(QWheelEvent* e) override;
- virtual void resizeEvent(QResizeEvent *event) override;
+ virtual void resizeEvent(QResizeEvent* event) override;
void goToReference(const QModelIndex& idx);
void setFilter(const std::string& filter) override;
@@ -137,10 +137,10 @@ protected:
virtual void OnTagRemoved(BinaryNinja::BinaryView*, const BinaryNinja::TagReference&) override;
virtual void OnTagTypeUpdated(BinaryNinja::BinaryView*, TagTypeRef) override;
- virtual void showEvent(QShowEvent *event) override;
- virtual void hideEvent(QHideEvent *event) override;
+ virtual void showEvent(QShowEvent* event) override;
+ virtual void hideEvent(QHideEvent* event) override;
-private Q_SLOTS:
+ private Q_SLOTS:
void hoverTimerEvent();
void updateTimerEvent();
void referenceActivated(const QModelIndex& idx);
@@ -148,10 +148,10 @@ private Q_SLOTS:
void saveExpanded();
void restoreExpanded();
-public Q_SLOTS:
+ public Q_SLOTS:
void showContextMenu();
-public:
+ public:
TagList(QWidget* parent, ViewFrame* view, BinaryViewRef data, TagListModel* model = nullptr, Menu* menu = nullptr);
virtual ~TagList();
@@ -178,7 +178,7 @@ public:
};
-class BINARYNINJAUIAPI TagListWidget: public SidebarWidget
+class BINARYNINJAUIAPI TagListWidget : public SidebarWidget
{
Q_OBJECT
@@ -196,14 +196,14 @@ class BINARYNINJAUIAPI TagListWidget: public SidebarWidget
BinaryViewRef m_data;
UIActionHandler* m_handler;
-protected:
+ protected:
virtual void notifyFontChanged() override;
-private Q_SLOTS:
+ private Q_SLOTS:
void showContextMenu();
void onTabChanged(int which);
-public:
+ public:
TagList* GetList();
void editTag(TagRef tag);
TagList* getNotificationList() { return m_notificationList; }
@@ -217,14 +217,14 @@ public:
};
-class BINARYNINJAUIAPI TagListDialog: public QDialog
+class BINARYNINJAUIAPI TagListDialog : public QDialog
{
Q_OBJECT
-public:
+ public:
typedef std::function<void(const TagRef&)> AddFn;
-private:
+ private:
BinaryViewRef m_data;
TagList* m_list;
FilteredView* m_filter;
@@ -233,11 +233,11 @@ private:
QPushButton* m_removeButton;
-public:
+ public:
TagListDialog(QWidget* parent, ViewFrame* frame, BinaryViewRef data, AddFn addFn);
void setFilter(TagList::FilterFn filter);
-private Q_SLOTS:
+ private Q_SLOTS:
void updateActive(const QItemSelection&, const QItemSelection&);
void createTag();
void createTagAccept(TagTypeRef tt);
@@ -245,9 +245,9 @@ private Q_SLOTS:
};
-class BINARYNINJAUIAPI TagListSidebarWidgetType: public SidebarWidgetType
+class BINARYNINJAUIAPI TagListSidebarWidgetType : public SidebarWidgetType
{
-public:
+ public:
TagListSidebarWidgetType();
virtual SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;
};
diff --git a/ui/tagtypelist.h b/ui/tagtypelist.h
index d28dd5e8..b272113f 100644
--- a/ui/tagtypelist.h
+++ b/ui/tagtypelist.h
@@ -12,7 +12,7 @@
#define TAGS_UPDATE_CHECK_INTERVAL 200
-class BINARYNINJAUIAPI TagTypeListModel: public QAbstractItemModel, public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI TagTypeListModel : public QAbstractItemModel, public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
@@ -21,7 +21,7 @@ class BINARYNINJAUIAPI TagTypeListModel: public QAbstractItemModel, public Binar
std::vector<TagTypeRef> m_refs;
std::map<std::string, uint64_t> m_count;
-public:
+ public:
TagTypeListModel(QWidget* parent, BinaryViewRef data);
TagTypeRef& GetRef(int index) { return m_refs[index]; }
@@ -41,14 +41,15 @@ public:
virtual void OnTagAdded(BinaryNinja::BinaryView*, const BinaryNinja::TagReference&) override;
virtual void OnTagRemoved(BinaryNinja::BinaryView*, const BinaryNinja::TagReference&) override;
- bool setModelData(const std::vector<TagTypeRef>& refs, QItemSelectionModel* selectionModel, int sortColumn, Qt::SortOrder sortOrder, bool& selectionUpdated);
+ bool setModelData(const std::vector<TagTypeRef>& refs, QItemSelectionModel* selectionModel, int sortColumn,
+ Qt::SortOrder sortOrder, bool& selectionUpdated);
-Q_SIGNALS:
+ Q_SIGNALS:
void needRepaint();
};
-class BINARYNINJAUIAPI TagTypeItemDelegate: public QItemDelegate
+class BINARYNINJAUIAPI TagTypeItemDelegate : public QItemDelegate
{
Q_OBJECT
@@ -59,7 +60,7 @@ class BINARYNINJAUIAPI TagTypeItemDelegate: public QItemDelegate
void initFont();
-public:
+ public:
TagTypeItemDelegate(QWidget* parent);
void updateFonts();
@@ -67,11 +68,12 @@ public:
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& idx) const override;
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& idx) const override;
virtual void setEditorData(QWidget* editor, const QModelIndex& index) const override;
- virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
+ virtual bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option,
+ const QModelIndex& index) override;
};
-class BINARYNINJAUIAPI TagTypeList: public QTableView, public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI TagTypeList : public QTableView, public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
@@ -88,26 +90,26 @@ class BINARYNINJAUIAPI TagTypeList: public QTableView, public BinaryNinja::Binar
bool m_needsUpdate;
bool m_needsRepaint;
-protected:
+ protected:
virtual void contextMenuEvent(QContextMenuEvent* event) override;
- virtual void showEvent(QShowEvent *event) override;
- virtual void hideEvent(QHideEvent *event) override;
+ virtual void showEvent(QShowEvent* event) override;
+ virtual void hideEvent(QHideEvent* event) override;
virtual void OnTagTypeUpdated(BinaryNinja::BinaryView*, const TagTypeRef) override;
-private:
+ private:
void createTagType();
void removeTagType();
-private Q_SLOTS:
+ private Q_SLOTS:
void updateTimerEvent();
void needRepaint();
-public Q_SLOTS:
+ public Q_SLOTS:
void showContextMenu();
-public:
+ public:
TagTypeList(QWidget* parent, ViewFrame* view, BinaryViewRef data, Menu* menu = nullptr);
virtual ~TagTypeList();
void notifyFontChanged();
@@ -118,7 +120,7 @@ public:
bool hasSelection();
};
-class BINARYNINJAUIAPI TagTypeDialogModel: public QAbstractItemModel
+class BINARYNINJAUIAPI TagTypeDialogModel : public QAbstractItemModel
{
Q_OBJECT
@@ -126,7 +128,7 @@ class BINARYNINJAUIAPI TagTypeDialogModel: public QAbstractItemModel
BinaryViewRef m_data;
std::vector<TagTypeRef> m_refs;
-public:
+ public:
TagTypeDialogModel(QWidget* parent, BinaryViewRef data);
TagTypeRef& GetRef(int index) { return m_refs[index]; }
@@ -140,7 +142,7 @@ public:
virtual QVariant data(const QModelIndex& i, int role) const override;
};
-class BINARYNINJAUIAPI TagTypeSelectDialog: public QDialog
+class BINARYNINJAUIAPI TagTypeSelectDialog : public QDialog
{
Q_OBJECT
@@ -148,12 +150,12 @@ class BINARYNINJAUIAPI TagTypeSelectDialog: public QDialog
TagTypeDialogModel* m_model;
QComboBox* m_tagTypeList;
-private Q_SLOTS:
+ private Q_SLOTS:
void select();
-public:
+ public:
TagTypeSelectDialog(QWidget* parent, BinaryViewRef data);
-Q_SIGNALS:
+ Q_SIGNALS:
void selected(TagTypeRef tagType);
};
diff --git a/ui/textbrowser.h b/ui/textbrowser.h
index 9d4d33c3..d58a0c2f 100644
--- a/ui/textbrowser.h
+++ b/ui/textbrowser.h
@@ -23,7 +23,7 @@ class BINARYNINJAUIAPI TextBrowserDownloadCache
std::map<QUrl, QByteArray> m_downloadCache;
std::set<QUrl> m_inProgress;
-public:
+ public:
TextBrowserDownloadCache();
bool lookup(const QUrl& url, QByteArray& result);
@@ -34,7 +34,7 @@ public:
bool isInProgress(const QUrl& url);
};
-class TextBrowserDownloadQueue: public QObject
+class TextBrowserDownloadQueue : public QObject
{
Q_OBJECT
@@ -48,7 +48,7 @@ class TextBrowserDownloadQueue: public QObject
static uint64_t AppendDataCallback(uint8_t* data, uint64_t len, void* ctxt);
-public:
+ public:
TextBrowserDownloadQueue(TextBrowser* owner);
void stop();
@@ -56,11 +56,11 @@ public:
bool processNextEvent(BinaryNinja::DownloadInstance* downloadInstance);
void downloadData(const QUrl& name);
-Q_SIGNALS:
+ Q_SIGNALS:
void dataDownloaded(QUrl name, QByteArray contents);
};
-class TextBrowserDownloadThread: public QThread
+class TextBrowserDownloadThread : public QThread
{
Q_OBJECT
@@ -70,14 +70,14 @@ class TextBrowserDownloadThread: public QThread
BinaryNinja::Ref<BinaryNinja::DownloadProvider> m_provider;
BinaryNinja::Ref<BinaryNinja::DownloadInstance> m_downloadInstance;
-protected:
+ protected:
virtual void run() override;
-public:
+ public:
TextBrowserDownloadThread(TextBrowserDownloadQueue* queue);
};
-class BINARYNINJAUIAPI TextBrowser: public QTextBrowser
+class BINARYNINJAUIAPI TextBrowser : public QTextBrowser
{
Q_OBJECT
@@ -91,24 +91,24 @@ class BINARYNINJAUIAPI TextBrowser: public QTextBrowser
std::optional<QUrl> m_markdownUrl;
QString m_markdownPrefix;
- void resizeImageFragment(QTextBlock& block, QTextFragment fragment,
- QTextImageFormat imgFormat, const QImage& contents);
+ void resizeImageFragment(
+ QTextBlock& block, QTextFragment fragment, QTextImageFormat imgFormat, const QImage& contents);
-protected:
+ protected:
virtual void resizeEvent(QResizeEvent* e) override;
-public:
+ public:
TextBrowser(QSharedPointer<TextBrowserDownloadCache> cache = QSharedPointer<TextBrowserDownloadCache>());
virtual ~TextBrowser();
void reset();
- virtual QVariant loadResource(int type, const QUrl &name) override;
+ virtual QVariant loadResource(int type, const QUrl& name) override;
void resizeImagesToWidth();
QSharedPointer<TextBrowserDownloadCache> cache() { return m_cache; }
void downloadMarkdown(QUrl url, QString prefix = QString());
-private Q_SLOTS:
+ private Q_SLOTS:
void dataDownloaded(QUrl name, QByteArray contents);
};
diff --git a/ui/textdialog.h b/ui/textdialog.h
index dc8ad03b..81750bf9 100644
--- a/ui/textdialog.h
+++ b/ui/textdialog.h
@@ -8,7 +8,7 @@
#include "uitypes.h"
#include "binaryninjaapi.h"
-class BINARYNINJAUIAPI TextDialog: public QDialog
+class BINARYNINJAUIAPI TextDialog : public QDialog
{
Q_OBJECT
QString m_qSettingsListName;
@@ -19,11 +19,11 @@ class BINARYNINJAUIAPI TextDialog: public QDialog
QLabel* m_messageText;
QComboBox* m_combo;
-public:
+ public:
TextDialog(QWidget* parent, const QString& title, const QString& msg, const QString& qSettingsListName,
- const std::string& initialText = "");
+ const std::string& initialText = "");
TextDialog(QWidget* parent, const QString& title, const QString& msg, const QString& qSettingsListName,
- const QString& initialText);
+ const QString& initialText);
QString getItem();
void setInitialText(const std::string& initialText) { m_initialText = QString::fromStdString(initialText); }
void commitHistory();
diff --git a/ui/theme.h b/ui/theme.h
index b4c1ead5..5b1e5253 100644
--- a/ui/theme.h
+++ b/ui/theme.h
@@ -6,15 +6,15 @@
#include "binaryninjaapi.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI CustomFusionStyle: public QProxyStyle
+class BINARYNINJAUIAPI CustomFusionStyle : public QProxyStyle
{
-public:
+ public:
CustomFusionStyle(QStyle* parent);
virtual int pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const override;
- virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption* option,
- const QWidget* widget) const override;
- virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption* option,
- const QWidget* widget) const override;
+ virtual QIcon standardIcon(
+ StandardPixmap standardIcon, const QStyleOption* option, const QWidget* widget) const override;
+ virtual QPixmap standardPixmap(
+ StandardPixmap standardPixmap, const QStyleOption* option, const QWidget* widget) const override;
};
diff --git a/ui/tokenizedtextview.h b/ui/tokenizedtextview.h
index 6424e6e4..5132a476 100644
--- a/ui/tokenizedtextview.h
+++ b/ui/tokenizedtextview.h
@@ -9,12 +9,12 @@
#include "menus.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI TokenizedTextViewHistoryEntry: public HistoryEntry
+class BINARYNINJAUIAPI TokenizedTextViewHistoryEntry : public HistoryEntry
{
size_t m_topLine, m_cursorLine;
HighlightTokenState m_highlight;
-public:
+ public:
size_t getTopLine() const { return m_topLine; }
size_t getCursorLine() const { return m_cursorLine; }
const HighlightTokenState& getHighlightTokenState() const { return m_highlight; }
@@ -27,7 +27,10 @@ public:
virtual bool deserialize(const Json::Value& value) override;
};
-class BINARYNINJAUIAPI TokenizedTextView: public QAbstractScrollArea, public View, public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI TokenizedTextView :
+ public QAbstractScrollArea,
+ public View,
+ public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
@@ -59,8 +62,8 @@ class BINARYNINJAUIAPI TokenizedTextView: public QAbstractScrollArea, public Vie
void scrollLines(int count);
void bindActions();
- void getHexDumpLineBytes(const BinaryNinja::LinearDisassemblyLine& line, size_t& skippedBytes, size_t& totalBytes,
- size_t& totalCols);
+ void getHexDumpLineBytes(
+ const BinaryNinja::LinearDisassemblyLine& line, size_t& skippedBytes, size_t& totalBytes, size_t& totalCols);
void setSectionSemantics(const std::string& name, BNSectionSemantics semantics);
@@ -110,14 +113,15 @@ class BINARYNINJAUIAPI TokenizedTextView: public QAbstractScrollArea, public Vie
void setInstructionHighlight(BNHighlightColor color);
void setBlockHighlight(BNHighlightColor color);
-private Q_SLOTS:
+ private Q_SLOTS:
void scrollBarMoved(int value);
void scrollBarAction(int action);
void updateTimerEvent();
-public:
+ public:
explicit TokenizedTextView(QWidget* parent, BinaryViewRef data,
- const std::vector<BinaryNinja::LinearDisassemblyLine>& lines = std::vector<BinaryNinja::LinearDisassemblyLine>());
+ const std::vector<BinaryNinja::LinearDisassemblyLine>& lines =
+ std::vector<BinaryNinja::LinearDisassemblyLine>());
virtual ~TokenizedTextView();
virtual BinaryViewRef getData() override { return m_data; }
@@ -168,7 +172,7 @@ public:
void setFunction(FunctionRef func);
-protected:
+ protected:
virtual void resizeEvent(QResizeEvent* event) override;
virtual void paintEvent(QPaintEvent* event) override;
virtual void wheelEvent(QWheelEvent* event) override;
diff --git a/ui/transformparam.h b/ui/transformparam.h
index 042a38c3..5c67650a 100644
--- a/ui/transformparam.h
+++ b/ui/transformparam.h
@@ -4,15 +4,15 @@
#include "binaryninjaapi.h"
#include "uicontext.h"
-class BINARYNINJAUIAPI TransformParameterDialog: public QDialog
+class BINARYNINJAUIAPI TransformParameterDialog : public QDialog
{
Q_OBJECT
std::vector<BinaryNinja::TransformParameter> m_params;
std::map<std::string, BinaryDataRef> m_paramData;
-public:
- TransformParameterDialog(QWidget* parent, TransformRef xform,
- const std::vector<BinaryNinja::TransformParameter>& params);
+ public:
+ TransformParameterDialog(
+ QWidget* parent, TransformRef xform, const std::vector<BinaryNinja::TransformParameter>& params);
std::map<std::string, BinaryNinja::DataBuffer> getParameterData();
};
diff --git a/ui/typedialog.h b/ui/typedialog.h
index 76931d13..2f171b21 100644
--- a/ui/typedialog.h
+++ b/ui/typedialog.h
@@ -6,7 +6,7 @@
#include <QtWidgets/QComboBox>
#include <QtCore/QTimer>
#ifndef BINARYNINJAUI_BINDINGS
-#include <QtCore/QThread>
+ #include <QtCore/QThread>
#endif
#include "binaryninjaapi.h"
#include "uitypes.h"
@@ -17,7 +17,7 @@
class GetTypesListThread;
class ParseTypeThread;
#else
-class BINARYNINJAUIAPI GetTypesListThread: public QThread
+class BINARYNINJAUIAPI GetTypesListThread : public QThread
{
Q_OBJECT
@@ -27,10 +27,10 @@ class BINARYNINJAUIAPI GetTypesListThread: public QThread
bool m_done;
BinaryViewRef m_view;
-protected:
+ protected:
virtual void run() override;
-public:
+ public:
GetTypesListThread(BinaryViewRef view, const std::function<void()>& completeFunc);
void cancel();
@@ -40,7 +40,8 @@ public:
Q_DECLARE_METATYPE(BinaryNinja::QualifiedNameAndType);
//! QThread subclass for handling type string parsing to avoid UI interruptions.
-class ParseTypeThread: public QThread {
+class ParseTypeThread : public QThread
+{
Q_OBJECT
BinaryViewRef m_view;
@@ -48,16 +49,16 @@ class ParseTypeThread: public QThread {
void run() override;
-Q_SIGNALS:
+ Q_SIGNALS:
void parsingComplete(bool valid, BinaryNinja::QualifiedNameAndType type, QString error);
-public:
+ public:
ParseTypeThread(BinaryViewRef view, QString text);
void cancel();
};
#endif
-class BINARYNINJAUIAPI TypeDialog: public QDialog
+class BINARYNINJAUIAPI TypeDialog : public QDialog
{
Q_OBJECT
@@ -84,15 +85,15 @@ class BINARYNINJAUIAPI TypeDialog: public QDialog
void commitHistory();
void customEvent(QEvent* event);
-private Q_SLOTS:
+ private Q_SLOTS:
void accepted();
void checkParse();
void typeParsed(bool valid, BinaryNinja::QualifiedNameAndType type, QString error);
void updateTimerEvent();
-public:
+ public:
TypeDialog(QWidget* parent, BinaryViewRef view, const QString& title = "Specify Type",
- const QString& prompt = "Enter Type Name", const QString& existing="");
+ const QString& prompt = "Enter Type Name", const QString& existing = "");
~TypeDialog() { delete m_updateThread; }
BinaryNinja::QualifiedNameAndType getType() const { return m_type; }
};
diff --git a/ui/typeview.h b/ui/typeview.h
index 527e35cf..3a7e744b 100644
--- a/ui/typeview.h
+++ b/ui/typeview.h
@@ -3,9 +3,9 @@
#include <QtWidgets/QAbstractScrollArea>
#include <QtWidgets/QComboBox>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-#include <QtWidgets/QAction>
+ #include <QtWidgets/QAction>
#else
-#include <QtGui/QAction>
+ #include <QtGui/QAction>
#endif
#include <QtCore/QTimer>
#include <string>
@@ -63,7 +63,7 @@ struct BINARYNINJAUIAPI TypeDefinitionLinesAndFilterStatus
};
-class BINARYNINJAUIAPI TypeViewHistoryEntry: public HistoryEntry
+class BINARYNINJAUIAPI TypeViewHistoryEntry : public HistoryEntry
{
BinaryNinja::QualifiedName m_cursorType;
size_t m_cursorLine;
@@ -74,7 +74,7 @@ class BINARYNINJAUIAPI TypeViewHistoryEntry: public HistoryEntry
size_t m_selectionStartOffset;
HighlightTokenState m_highlight;
-public:
+ public:
const BinaryNinja::QualifiedName& getCursorType() const { return m_cursorType; }
size_t getCursorLine() const { return m_cursorLine; }
size_t getCursorOffset() const { return m_cursorOffset; }
@@ -103,7 +103,7 @@ public:
class TypesContainer;
-class BINARYNINJAUIAPI TypeView: public QAbstractScrollArea, public View, public BinaryNinja::BinaryDataNotification
+class BINARYNINJAUIAPI TypeView : public QAbstractScrollArea, public View, public BinaryNinja::BinaryDataNotification
{
Q_OBJECT
@@ -189,22 +189,23 @@ class BINARYNINJAUIAPI TypeView: public QAbstractScrollArea, public View, public
void goToAddress(bool selecting);
void moveCursorToMouse(QMouseEvent* event, bool selecting);
- void createNewTypes(const QString& definition = "", const std::set<BinaryNinja::QualifiedName>& typesAllowRedefinition = {});
+ void createNewTypes(
+ const QString& definition = "", const std::set<BinaryNinja::QualifiedName>& typesAllowRedefinition = {});
void bindActions();
void checkForValidSelection();
static TypeDefinitionLine getTypeDefinitionHeaderLine(PlatformRef platform, const std::string& name, TypeRef type);
-public:
+ public:
explicit TypeView(BinaryViewRef data, ViewFrame* view, TypesContainer* container, bool compact = false);
virtual ~TypeView();
- virtual bool findNextData(uint64_t start, uint64_t end, const BinaryNinja::DataBuffer& data, uint64_t& addr, BNFindFlag flags,
- const std::function<bool (size_t current, size_t total)>& cb) override;
+ virtual bool findNextData(uint64_t start, uint64_t end, const BinaryNinja::DataBuffer& data, uint64_t& addr,
+ BNFindFlag flags, const std::function<bool(size_t current, size_t total)>& cb) override;
virtual bool findNextText(uint64_t start, uint64_t end, const std::string& text, uint64_t& addr,
- DisassemblySettingsRef settings, BNFindFlag flags, BNFunctionGraphType graph,
- const std::function<bool (size_t current, size_t total)>& cb) override;
+ DisassemblySettingsRef settings, BNFindFlag flags, BNFunctionGraphType graph,
+ const std::function<bool(size_t current, size_t total)>& cb) override;
virtual BinaryViewRef getData() override { return m_data; }
virtual uint64_t getCurrentOffset() override;
virtual BNAddressRange getSelectionOffsets() override;
@@ -216,20 +217,23 @@ public:
virtual void setNavigationMode(std::string mode) override;
virtual std::vector<std::string> getNavigationModes() override;
- uint64_t findMatchingLine(const BinaryNinja::QualifiedName& name, uint64_t offset,
- size_t& cursorOffset);
+ uint64_t findMatchingLine(const BinaryNinja::QualifiedName& name, uint64_t offset, size_t& cursorOffset);
bool navigateToType(const std::string& name, uint64_t offset = 0);
- virtual void OnTypeDefined(BinaryNinja::BinaryView* view, const BinaryNinja::QualifiedName& name,
- BinaryNinja::Type* type) override;
- virtual void OnTypeUndefined(BinaryNinja::BinaryView* view, const BinaryNinja::QualifiedName& name,
- BinaryNinja::Type* type) override;
- virtual void OnTypeReferenceChanged(BinaryNinja::BinaryView* view, const BinaryNinja::QualifiedName& name,
- BinaryNinja::Type* type) override;
- virtual void OnTypeFieldReferenceChanged(BinaryNinja::BinaryView* view, const BinaryNinja::QualifiedName& name,
- uint64_t offset) override;
+ virtual void OnTypeDefined(
+ BinaryNinja::BinaryView* view, const BinaryNinja::QualifiedName& name, BinaryNinja::Type* type) override;
+ virtual void OnTypeUndefined(
+ BinaryNinja::BinaryView* view, const BinaryNinja::QualifiedName& name, BinaryNinja::Type* type) override;
+ virtual void OnTypeReferenceChanged(
+ BinaryNinja::BinaryView* view, const BinaryNinja::QualifiedName& name, BinaryNinja::Type* type) override;
+ virtual void OnTypeFieldReferenceChanged(
+ BinaryNinja::BinaryView* view, const BinaryNinja::QualifiedName& name, uint64_t offset) override;
- void MarkFilterChanged() { m_updatesRequired = true; m_filterChanged = true; }
+ void MarkFilterChanged()
+ {
+ m_updatesRequired = true;
+ m_filterChanged = true;
+ }
void MarkTypeChanged(const BinaryNinja::QualifiedName& typeName);
virtual void updateFonts() override;
@@ -238,7 +242,7 @@ public:
virtual BinaryNinja::Ref<HistoryEntry> getHistoryEntry() override;
virtual void navigateToHistoryEntry(BinaryNinja::Ref<HistoryEntry> entry) override;
- void lineNumberAreaPaintEvent(QPaintEvent *event);
+ void lineNumberAreaPaintEvent(QPaintEvent* event);
int lineNumberAreaWidth();
virtual bool canCut() override { return false; }
@@ -258,10 +262,12 @@ public:
virtual ArchitectureRef getOrAskForArchitecture();
- bool isTypeCollapsed(const std::string& name) const { return m_collapsedTypes.find(name) != m_collapsedTypes.end(); }
- static std::vector<TypeDefinitionLine> getLinesForType(const std::string& name,
- const std::string& varName, size_t index, TypeRef type, TypeRef parent, BinaryViewRef data,
- int paddingCols, bool collapsed = false);
+ bool isTypeCollapsed(const std::string& name) const
+ {
+ return m_collapsedTypes.find(name) != m_collapsedTypes.end();
+ }
+ static std::vector<TypeDefinitionLine> getLinesForType(const std::string& name, const std::string& varName,
+ size_t index, TypeRef type, TypeRef parent, BinaryViewRef data, int paddingCols, bool collapsed = false);
void showContextMenu(Menu* source = nullptr);
@@ -271,7 +277,7 @@ public:
bool isTypeTextFiltered(const std::string& name) const;
-protected:
+ protected:
virtual void resizeEvent(QResizeEvent* event) override;
virtual void paintEvent(QPaintEvent* event) override;
virtual void mousePressEvent(QMouseEvent* event) override;
@@ -279,7 +285,7 @@ protected:
virtual void mouseDoubleClickEvent(QMouseEvent* event) override;
virtual void scrollContentsBy(int dx, int dy) override;
-private Q_SLOTS:
+ private Q_SLOTS:
void copySelection();
void selectAll();
void updateTimerEvent();
@@ -309,23 +315,23 @@ private Q_SLOTS:
class BINARYNINJAUIAPI LineNumberArea : public QWidget
{
-public:
- LineNumberArea(TypeView *editor) : QWidget(editor), m_typeEditor(editor) { }
+ public:
+ LineNumberArea(TypeView* editor) : QWidget(editor), m_typeEditor(editor) {}
QSize sizeHint() const override { return QSize(m_typeEditor->lineNumberAreaWidth(), 0); }
-protected:
- void paintEvent(QPaintEvent *event) override { m_typeEditor->lineNumberAreaPaintEvent(event); }
+ protected:
+ void paintEvent(QPaintEvent* event) override { m_typeEditor->lineNumberAreaPaintEvent(event); }
-private:
+ private:
TypeView* m_typeEditor;
};
-class TypeViewType: public ViewType
+class TypeViewType : public ViewType
{
static TypeViewType* m_instance;
-public:
+ public:
TypeViewType();
virtual int getPriority(BinaryViewRef data, const QString& filename) override;
virtual QWidget* create(BinaryViewRef data, ViewFrame* viewFrame) override;
@@ -333,22 +339,22 @@ public:
};
-class BINARYNINJAUIAPI TypeFilterEdit: public QLineEdit
+class BINARYNINJAUIAPI TypeFilterEdit : public QLineEdit
{
Q_OBJECT
-public:
+ public:
TypeFilterEdit(QWidget* parent);
-protected:
+ protected:
virtual void keyPressEvent(QKeyEvent* event) override;
-Q_SIGNALS:
+ Q_SIGNALS:
void focusView();
};
-class BINARYNINJAUIAPI TypeFilter: public QWidget
+class BINARYNINJAUIAPI TypeFilter : public QWidget
{
Q_OBJECT
@@ -359,18 +365,18 @@ class BINARYNINJAUIAPI TypeFilter: public QWidget
bool MatchesAutoFilter(BinaryViewRef data, const BinaryNinja::QualifiedName& name);
bool MatchesTextFilter(const std::vector<TypeDefinitionLine>& lines);
-Q_SIGNALS:
+ Q_SIGNALS:
void filterChanged();
-private Q_SLOTS:
+ private Q_SLOTS:
void focusView();
-public:
+ public:
TypeFilter(TypesContainer* container = nullptr);
void setContainer(TypesContainer* container) { m_container = container; }
- TypeLinesFilteredReason checkTypeLinesForFilter(BinaryViewRef data, const BinaryNinja::QualifiedName& name,
- const std::vector<TypeDefinitionLine>& lines);
+ TypeLinesFilteredReason checkTypeLinesForFilter(
+ BinaryViewRef data, const BinaryNinja::QualifiedName& name, const std::vector<TypeDefinitionLine>& lines);
void showAndFocus();
bool areAutoTypesVisible();
void setShowAutoTypes(bool showAutoTypes);
@@ -378,7 +384,7 @@ public:
};
-class BINARYNINJAUIAPI TypesContainer: public QWidget, public ViewContainer
+class BINARYNINJAUIAPI TypesContainer : public QWidget, public ViewContainer
{
Q_OBJECT
@@ -386,9 +392,8 @@ class BINARYNINJAUIAPI TypesContainer: public QWidget, public ViewContainer
TypeFilter* m_typeFilter;
UIActionHandler m_actionHandler;
-public:
- TypesContainer(BinaryViewRef data, ViewFrame* view,
- TypeFilter* filter = nullptr, bool compact = false);
+ public:
+ TypesContainer(BinaryViewRef data, ViewFrame* view, TypeFilter* filter = nullptr, bool compact = false);
virtual View* getView() override { return m_typeView; }
TypeView* getTypesView() { return m_typeView; }
@@ -396,12 +401,12 @@ public:
bool navigateToType(const std::string& name, uint64_t offset = 0);
-protected:
+ protected:
virtual void focusInEvent(QFocusEvent* event) override;
};
-class BINARYNINJAUIAPI TypeViewSidebarWidget: public SidebarWidget
+class BINARYNINJAUIAPI TypeViewSidebarWidget : public SidebarWidget
{
Q_OBJECT
@@ -409,7 +414,7 @@ class BINARYNINJAUIAPI TypeViewSidebarWidget: public SidebarWidget
QWidget* m_header;
Menu m_addMenu;
-public:
+ public:
TypeViewSidebarWidget(BinaryViewRef data, ViewFrame* frame);
TypesContainer* container() const { return m_container; }
@@ -417,14 +422,14 @@ public:
virtual QWidget* headerWidget() override { return m_header; }
-private Q_SLOTS:
+ private Q_SLOTS:
void showAddMenu();
};
-class BINARYNINJAUIAPI TypeViewSidebarWidgetType: public SidebarWidgetType
+class BINARYNINJAUIAPI TypeViewSidebarWidgetType : public SidebarWidgetType
{
-public:
+ public:
TypeViewSidebarWidgetType();
virtual SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;
};
diff --git a/ui/uicomment.h b/ui/uicomment.h
index 1ed71af7..d80444ec 100644
--- a/ui/uicomment.h
+++ b/ui/uicomment.h
@@ -13,7 +13,7 @@ typedef enum
class UIComment
{
-public:
+ public:
UICommentType type;
FunctionRef func;
BinaryViewRef data;
@@ -21,21 +21,13 @@ public:
QString content;
- UIComment(UICommentType type,
- FunctionRef func,
- uint64_t address,
- QString content):
- type(type), func(func),
- address(address), content(content)
+ UIComment(UICommentType type, FunctionRef func, uint64_t address, QString content) :
+ type(type), func(func), address(address), content(content)
{}
- UIComment(UICommentType type,
- BinaryViewRef data,
- uint64_t address,
- QString content):
- type(type), data(data),
- address(address), content(content)
+ UIComment(UICommentType type, BinaryViewRef data, uint64_t address, QString content) :
+ type(type), data(data), address(address), content(content)
{}
diff --git a/ui/uicontext.h b/ui/uicontext.h
index cb9a5391..44c1e53d 100644
--- a/ui/uicontext.h
+++ b/ui/uicontext.h
@@ -30,7 +30,7 @@ struct SelectionInfoForXref;
*/
class BINARYNINJAUIAPI UIContextNotification
{
-public:
+ public:
/*!
Callback after a UIContext is opened (eg MainWindow)
\param context Opened context
@@ -48,7 +48,12 @@ public:
\param metadata Object with info about the database file
\return True if the database should be opened
*/
- virtual bool OnBeforeOpenDatabase(UIContext* context, FileMetadataRef metadata) { (void)context; (void)metadata; return true; }
+ virtual bool OnBeforeOpenDatabase(UIContext* context, FileMetadataRef metadata)
+ {
+ (void)context;
+ (void)metadata;
+ return true;
+ }
/*!
Callback after a database (specifically a database, not a raw file) is opened
\param context Context which opened the database
@@ -56,21 +61,37 @@ public:
\param data Raw data which is backed by the database
\return True if the database should be opened
*/
- virtual bool OnAfterOpenDatabase(UIContext* context, FileMetadataRef metadata, BinaryViewRef data) { (void)context; (void)metadata; (void)data; return true; }
+ virtual bool OnAfterOpenDatabase(UIContext* context, FileMetadataRef metadata, BinaryViewRef data)
+ {
+ (void)context;
+ (void)metadata;
+ (void)data;
+ return true;
+ }
/*!
Callback before a file (raw or database) is opened (after OnAfterOpenDatabase if opening a database)
\param context Context opening the file
\param file Context with the file and ui views
\return True if the file should be opened
*/
- virtual bool OnBeforeOpenFile(UIContext* context, FileContext* file) { (void)context; (void)file; return true; }
+ virtual bool OnBeforeOpenFile(UIContext* context, FileContext* file)
+ {
+ (void)context;
+ (void)file;
+ return true;
+ }
/*!
Callback after a file (raw or database) is opened
\param context Context which opened the file
\param file Context with the file and ui views
\param frame ViewFrame constructed to display the file
*/
- virtual void OnAfterOpenFile(UIContext* context, FileContext* file, ViewFrame* frame) { (void)context; (void)file; (void)frame; }
+ virtual void OnAfterOpenFile(UIContext* context, FileContext* file, ViewFrame* frame)
+ {
+ (void)context;
+ (void)file;
+ (void)frame;
+ }
/*!
Callback before a file is saved (either as a database or raw)
\param context Context which is saving the file
@@ -78,14 +99,25 @@ public:
\param frame ViewFrame for the file
\return True if the file should be saved
*/
- virtual bool OnBeforeSaveFile(UIContext* context, FileContext* file, ViewFrame* frame) { (void)context; (void)file; (void)frame; return true; }
+ virtual bool OnBeforeSaveFile(UIContext* context, FileContext* file, ViewFrame* frame)
+ {
+ (void)context;
+ (void)file;
+ (void)frame;
+ return true;
+ }
/*!
Callback after a file is saved (either as a database or raw)
\param context Context which saved the file
\param file Context with the file and ui views
\param frame ViewFrame for the file
*/
- virtual void OnAfterSaveFile(UIContext* context, FileContext* file, ViewFrame* frame) { (void)context; (void)file; (void)frame; }
+ virtual void OnAfterSaveFile(UIContext* context, FileContext* file, ViewFrame* frame)
+ {
+ (void)context;
+ (void)file;
+ (void)frame;
+ }
/*!
Callback before a file is closed
\param context Context which is closing the file
@@ -93,14 +125,25 @@ public:
\param frame ViewFrame for the file
\return True if the file should be closed
*/
- virtual bool OnBeforeCloseFile(UIContext* context, FileContext* file, ViewFrame* frame) { (void)context; (void)file; (void)frame; return true; }
+ virtual bool OnBeforeCloseFile(UIContext* context, FileContext* file, ViewFrame* frame)
+ {
+ (void)context;
+ (void)file;
+ (void)frame;
+ return true;
+ }
/*!
Callback after a file is closed
\param context Context which closed the file
\param file Context with the file and ui views
\param frame ViewFrame which former showed the file (will be deleted after this)
*/
- virtual void OnAfterCloseFile(UIContext* context, FileContext* file, ViewFrame* frame) { (void)context; (void)file; (void)frame; }
+ virtual void OnAfterCloseFile(UIContext* context, FileContext* file, ViewFrame* frame)
+ {
+ (void)context;
+ (void)file;
+ (void)frame;
+ }
/*!
Callback when the ui changes views
@@ -108,7 +151,12 @@ public:
\param frame ViewFrame which changed views
\param type New view name
*/
- virtual void OnViewChange(UIContext* context, ViewFrame* frame, const QString& type) { (void)context; (void)frame; (void)type; }
+ virtual void OnViewChange(UIContext* context, ViewFrame* frame, const QString& type)
+ {
+ (void)context;
+ (void)frame;
+ (void)type;
+ }
/*!
Callback when the ui changes address
\param context Context changing address
@@ -116,26 +164,44 @@ public:
\param view Currently open View
\param location New location
*/
- virtual void OnAddressChange(UIContext* context, ViewFrame* frame, View* view, const ViewLocation& location) { (void)context; (void)frame; (void)view; (void)location; }
+ virtual void OnAddressChange(UIContext* context, ViewFrame* frame, View* view, const ViewLocation& location)
+ {
+ (void)context;
+ (void)frame;
+ (void)view;
+ (void)location;
+ }
/*!
Callback to modify the displayed file name for a FileContext (eg in the window title or tab title)
Note: Due to the out param &name, this is not usable from Python with PySide
- \param context Context which will display this name
+ \param context Context which will display this name
\param file File whose name to get
\param name [Out] Name to be displayed
\return True if the value in name should be used
*/
- virtual bool GetNameForFile(UIContext* context, FileContext* file, QString& name) { (void)context; (void)file; (void)name; return false; }
+ virtual bool GetNameForFile(UIContext* context, FileContext* file, QString& name)
+ {
+ (void)context;
+ (void)file;
+ (void)name;
+ return false;
+ }
/*!
Callback to modify the displayed file name for a file path (eg in the new tab widget)
Note: Due to the out param &name, this is not usable from Python with PySide
- \param context Context which will display this name
+ \param context Context which will display this name
\param path Path to file whose name to get
\param name [Out] Name to be displayed
\return True if the value in name should be used
*/
- virtual bool GetNameForPath(UIContext* context, const QString& path, QString& name) { (void)context; (void)path; (void)name; return false; }
+ virtual bool GetNameForPath(UIContext* context, const QString& path, QString& name)
+ {
+ (void)context;
+ (void)path;
+ (void)name;
+ return false;
+ }
/*!
Callback when the ui changes selection and should update cross references
@@ -144,12 +210,19 @@ public:
\param view View that changed selection
\param selection New selection
*/
- virtual void OnNewSelectionForXref(UIContext* context, ViewFrame* frame, View* view, const SelectionInfoForXref& selection) { (void)context; (void)frame; (void)view; (void)selection; }
+ virtual void OnNewSelectionForXref(
+ UIContext* context, ViewFrame* frame, View* view, const SelectionInfoForXref& selection)
+ {
+ (void)context;
+ (void)frame;
+ (void)view;
+ (void)selection;
+ }
};
class BINARYNINJAUIAPI UIContextHandler
{
-public:
+ public:
virtual ~UIContextHandler();
virtual void updateStatus() = 0;
virtual void notifyThemeChanged() = 0;
@@ -165,7 +238,7 @@ class BINARYNINJAUIAPI UIContext
static QPointer<PreviewWidget> m_currentPreview;
-protected:
+ protected:
void setupUIContext(QWidget* obj);
void NotifyOnContextOpen();
@@ -184,7 +257,7 @@ protected:
void NotifyOnAddressChange(ViewFrame* frame, View* view, const ViewLocation& location);
void NotifyOnNewSelectionForXref(ViewFrame* frame, View* view, const SelectionInfoForXref& selection);
-public:
+ public:
UIContext();
virtual ~UIContext();
@@ -223,7 +296,7 @@ public:
/*!
Open a new pane in the active tab
\param pane Pane widget to open
- \param primaryDirection Primary axis for content in pane (determines default split direction)
+ \param primaryDirection Primary axis for content in pane (determines default split direction)
*/
virtual void openPane(Pane* pane, Qt::Orientation primaryDirection = Qt::Vertical) = 0;
/*!
@@ -257,7 +330,7 @@ public:
/*!
Close the tab with the given QWidget
\param tab QWidget which is in a tab
- \param closeWindowIfLast If false, displays the new tab page if the widget was the last tab
+ \param closeWindowIfLast If false, displays the new tab page if the widget was the last tab
*/
virtual void closeTab(QWidget* tab, bool closeWindowIfLast = false) = 0;
/*!
diff --git a/ui/uitypes.h b/ui/uitypes.h
index 3ed27da8..62111001 100644
--- a/ui/uitypes.h
+++ b/ui/uitypes.h
@@ -16,44 +16,41 @@
#define BN_MINIMUM_UI_ABI_VERSION 4
#ifdef __GNUC__
-# ifdef BINARYNINJAUI_LIBRARY
-# define BINARYNINJAUIAPI __attribute__((visibility("default")))
-# else
-# define BINARYNINJAUIAPI
-# endif
+ #ifdef BINARYNINJAUI_LIBRARY
+ #define BINARYNINJAUIAPI __attribute__((visibility("default")))
+ #else
+ #define BINARYNINJAUIAPI
+ #endif
#else
-#ifdef _MSC_VER
-# ifndef DEMO_VERSION
-# ifdef BINARYNINJAUI_LIBRARY
-# define BINARYNINJAUIAPI __declspec(dllexport)
-# else
-# define BINARYNINJAUIAPI __declspec(dllimport)
-# endif
-# else
-# define BINARYNINJAUIAPI
-# endif
-#else
-#define BINARYNINJAUIAPI
-#endif
+ #ifdef _MSC_VER
+ #ifndef DEMO_VERSION
+ #ifdef BINARYNINJAUI_LIBRARY
+ #define BINARYNINJAUIAPI __declspec(dllexport)
+ #else
+ #define BINARYNINJAUIAPI __declspec(dllimport)
+ #endif
+ #else
+ #define BINARYNINJAUIAPI
+ #endif
+ #else
+ #define BINARYNINJAUIAPI
+ #endif
#endif
#ifdef BINARYNINJAUI_PYTHON_BINDINGS
-#include "bindings.h"
+ #include "bindings.h"
#endif
// The BN_DECLARE_UI_ABI_VERSION must be included in native UI plugin modules. If
// the ABI version is not declared, the UI will not load the plugin.
#ifdef DEMO_VERSION
-#define BN_DECLARE_UI_ABI_VERSION
+ #define BN_DECLARE_UI_ABI_VERSION
#else
-#define BN_DECLARE_UI_ABI_VERSION \
- extern "C" \
- { \
- BINARYNINJAPLUGIN uint32_t UIPluginABIVersion() \
+ #define BN_DECLARE_UI_ABI_VERSION \
+ extern "C" \
{ \
- return BN_CURRENT_UI_ABI_VERSION; \
- } \
- }
+ BINARYNINJAPLUGIN uint32_t UIPluginABIVersion() { return BN_CURRENT_UI_ABI_VERSION; } \
+ }
#endif
// The Python bindings generator does not recognize automatic conversion of API types into their
diff --git a/ui/util.h b/ui/util.h
index 761e83c4..e434b28e 100644
--- a/ui/util.h
+++ b/ui/util.h
@@ -6,17 +6,23 @@
#include <QtWidgets/QWidget>
#include <QtCore/QFileInfo>
-std::string BINARYNINJAUIAPI getStringForLocalVariable(ArchitectureRef arch, FunctionRef func, BinaryNinja::Variable localVar);
+std::string BINARYNINJAUIAPI getStringForLocalVariable(
+ ArchitectureRef arch, FunctionRef func, BinaryNinja::Variable localVar);
std::string BINARYNINJAUIAPI getStringForRegisterValue(ArchitectureRef arch, BinaryNinja::RegisterValue value);
std::string BINARYNINJAUIAPI getPossibleValueSetStateName(BNRegisterValueType state);
std::string BINARYNINJAUIAPI getStringForIntegerValue(int64_t value);
std::string BINARYNINJAUIAPI getStringForIntegerValue(uint64_t value);
-std::string BINARYNINJAUIAPI getStringForPossibleValueSet(ArchitectureRef arch, const BinaryNinja::PossibleValueSet& values);
-std::string BINARYNINJAUIAPI getStringForInstructionDataflowDetails(BinaryViewRef data, ArchitectureRef arch, FunctionRef func, uint64_t address);
-BinaryNinja::PossibleValueSet BINARYNINJAUIAPI getPossibleValueSetForToken(View* view, BinaryViewRef data, ArchitectureRef arch, FunctionRef func, HighlightTokenState token, size_t instrIdx);
+std::string BINARYNINJAUIAPI getStringForPossibleValueSet(
+ ArchitectureRef arch, const BinaryNinja::PossibleValueSet& values);
+std::string BINARYNINJAUIAPI getStringForInstructionDataflowDetails(
+ BinaryViewRef data, ArchitectureRef arch, FunctionRef func, uint64_t address);
+BinaryNinja::PossibleValueSet BINARYNINJAUIAPI getPossibleValueSetForToken(
+ View* view, BinaryViewRef data, ArchitectureRef arch, FunctionRef func, HighlightTokenState token, size_t instrIdx);
-void BINARYNINJAUIAPI showHexPreview(QWidget* parent, ViewFrame* frame, const QPoint& previewPos, BinaryViewRef data, uint64_t address);
-bool BINARYNINJAUIAPI showDisassemblyPreview(QWidget* parent, ViewFrame* frame, const QPoint& previewPos, BinaryViewRef data, FunctionRef func, const ViewLocation& location);
+void BINARYNINJAUIAPI showHexPreview(
+ QWidget* parent, ViewFrame* frame, const QPoint& previewPos, BinaryViewRef data, uint64_t address);
+bool BINARYNINJAUIAPI showDisassemblyPreview(QWidget* parent, ViewFrame* frame, const QPoint& previewPos,
+ BinaryViewRef data, FunctionRef func, const ViewLocation& location);
void BINARYNINJAUIAPI showTextTooltip(QWidget* parent, const QPoint& previewPos, const QString& text);
bool BINARYNINJAUIAPI isBinaryNinjaDataBase(QFileInfo& info, QFileAccessor& accessor);
diff --git a/ui/variablelist.h b/ui/variablelist.h
index cc1e1de5..bbf0a51a 100644
--- a/ui/variablelist.h
+++ b/ui/variablelist.h
@@ -32,14 +32,13 @@ class VariableListItem
BinaryNinja::PossibleValueSet m_pvs;
bool m_hasUidf;
- public:
+ public:
//! Create a new VariableListItem of the LocalVariable type.
- VariableListItem(FunctionRef func, BinaryNinja::Variable var, BinaryNinja::PossibleValueSet pvs,
- bool hasUidf, std::string name);
+ VariableListItem(
+ FunctionRef func, BinaryNinja::Variable var, BinaryNinja::PossibleValueSet pvs, bool hasUidf, std::string name);
//! Create a new VariableListItem of the DataVariable type.
- VariableListItem(
- FunctionRef func, BinaryNinja::DataVariable dataVar, uint64_t refPoint, std::string name);
+ VariableListItem(FunctionRef func, BinaryNinja::DataVariable dataVar, uint64_t refPoint, std::string name);
//! Get the type of this list item.
VariableListItemType type() const;
@@ -91,7 +90,7 @@ class BINARYNINJAUIAPI VariableListModel : public QAbstractListModel
size_t m_prevVariableCount;
uint64_t m_prevSelectionId;
- public:
+ public:
VariableListModel(QWidget* parent, ViewFrame* view, BinaryViewRef data);
//! Clear the list's content.
@@ -107,8 +106,7 @@ class BINARYNINJAUIAPI VariableListModel : public QAbstractListModel
void setSelectionModel(QItemSelectionModel* model);
virtual QVariant data(const QModelIndex& i, int role) const override;
- virtual QModelIndex index(
- int row, int col, const QModelIndex& parent = QModelIndex()) const override;
+ virtual QModelIndex index(int row, int col, const QModelIndex& parent = QModelIndex()) const override;
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override;
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
@@ -118,7 +116,8 @@ class BINARYNINJAUIAPI VariableListModel : public QAbstractListModel
class VariableListItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
- public:
+
+ public:
VariableListItemDelegate();
void paint(QPainter* painter, const QStyleOptionViewItem& opt, const QModelIndex& index) const;
@@ -143,7 +142,7 @@ class BINARYNINJAUIAPI VariableList : public SidebarWidget
void processRefresh();
- public:
+ public:
VariableList(ViewFrame* view, BinaryViewRef data);
QWidget* headerWidget() override { return m_header; }
@@ -181,7 +180,7 @@ class BINARYNINJAUIAPI VariableList : public SidebarWidget
class BINARYNINJAUIAPI VariableListSidebarWidgetType : public SidebarWidgetType
{
- public:
+ public:
VariableListSidebarWidgetType();
virtual SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;
};
diff --git a/ui/viewframe.h b/ui/viewframe.h
index 713dee56..00ec700a 100644
--- a/ui/viewframe.h
+++ b/ui/viewframe.h
@@ -2,9 +2,9 @@
#include <QtWidgets/QGestureEvent>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-#include <QtWidgets/QAction>
+ #include <QtWidgets/QAction>
#else
-#include <QtGui/QAction>
+ #include <QtGui/QAction>
#endif
#include <QtWidgets/QLabel>
#include <QtCore/QPointer>
@@ -43,11 +43,10 @@ struct SelectionInfoForXref
FunctionRef func;
ArchitectureRef arch;
- bool operator== (const SelectionInfoForXref& other) const
+ bool operator==(const SelectionInfoForXref& other) const
{
if (addrValid && other.addrValid)
- return (start == other.start) && (end == other.end) &&
- (func == other.func) && (arch == other.arch);
+ return (start == other.start) && (end == other.end) && (func == other.func) && (arch == other.arch);
else if (typeValid && other.typeValid)
return type == other.type;
else if (typeFieldValid && other.typeFieldValid)
@@ -57,15 +56,15 @@ struct SelectionInfoForXref
return false;
}
- bool operator!= (const SelectionInfoForXref& other) const { return !(*this == other); }
+ bool operator!=(const SelectionInfoForXref& other) const { return !(*this == other); }
bool isValid() const { return addrValid || typeValid || typeFieldValid || localVarValid; }
};
-class BINARYNINJAUIAPI HistoryEntry: public BinaryNinja::RefCountObject
+class BINARYNINJAUIAPI HistoryEntry : public BinaryNinja::RefCountObject
{
QString m_viewType;
-public:
+ public:
virtual ~HistoryEntry() {}
QString getViewType() const { return m_viewType; }
@@ -100,7 +99,7 @@ class ViewPaneHeaderSubtypeWidget;
class BINARYNINJAUIAPI View
{
-protected:
+ protected:
Menu m_contextMenu;
UIActionHandler m_actionHandler;
bool m_binaryDataNavigable = false;
@@ -118,7 +117,7 @@ protected:
virtual void setNavigationMode(std::string mode) { (void)mode; }
virtual std::vector<std::string> getNavigationModes() { return {}; }
-public:
+ public:
View();
virtual ~View() {}
@@ -127,30 +126,25 @@ public:
virtual bool canAssemble() { return false; }
virtual bool canCompile() { return false; }
- virtual bool findNextData(uint64_t start, uint64_t end, const BinaryNinja::DataBuffer& data,
- uint64_t& addr, BNFindFlag flags,
- const std::function<bool (size_t current, size_t total)>& cb);
- virtual bool findNextText(uint64_t start, uint64_t end, const std::string& text,
- uint64_t& addr, DisassemblySettingsRef settings, BNFindFlag flags,
- BNFunctionGraphType graph,
- const std::function<bool (size_t current, size_t total)>& cb);
- virtual bool findNextConstant(uint64_t start, uint64_t end, uint64_t constant,
- uint64_t& addr, DisassemblySettingsRef settings, BNFunctionGraphType graph,
- const std::function<bool (size_t current, size_t total)>& cb);
+ virtual bool findNextData(uint64_t start, uint64_t end, const BinaryNinja::DataBuffer& data, uint64_t& addr,
+ BNFindFlag flags, const std::function<bool(size_t current, size_t total)>& cb);
+ virtual bool findNextText(uint64_t start, uint64_t end, const std::string& text, uint64_t& addr,
+ DisassemblySettingsRef settings, BNFindFlag flags, BNFunctionGraphType graph,
+ const std::function<bool(size_t current, size_t total)>& cb);
+ virtual bool findNextConstant(uint64_t start, uint64_t end, uint64_t constant, uint64_t& addr,
+ DisassemblySettingsRef settings, BNFunctionGraphType graph,
+ const std::function<bool(size_t current, size_t total)>& cb);
virtual bool findAllData(uint64_t start, uint64_t end, const BinaryNinja::DataBuffer& data, BNFindFlag flags,
- const std::function<bool (size_t current, size_t total)>& cb,
- const std::function<bool (uint64_t addr, const BinaryNinja::DataBuffer& match)>& matchCallback);
- virtual bool findAllText(uint64_t start, uint64_t end, const std::string& data,
- DisassemblySettingsRef settings, BNFindFlag flags, BNFunctionGraphType graph,
- const std::function<bool (size_t current, size_t total)>& cb,
- const std::function<bool (uint64_t addr, const std::string& match,
- const BinaryNinja::LinearDisassemblyLine& line)>& matchCallback);
- virtual bool findAllConstant(uint64_t start, uint64_t end, uint64_t constant,
- DisassemblySettingsRef settings, BNFunctionGraphType graph,
- const std::function<bool (size_t current, size_t total)>& cb,
- const std::function<bool (uint64_t addr,
- const BinaryNinja::LinearDisassemblyLine& line)>& matchCallback);
+ const std::function<bool(size_t current, size_t total)>& cb,
+ const std::function<bool(uint64_t addr, const BinaryNinja::DataBuffer& match)>& matchCallback);
+ virtual bool findAllText(uint64_t start, uint64_t end, const std::string& data, DisassemblySettingsRef settings,
+ BNFindFlag flags, BNFunctionGraphType graph, const std::function<bool(size_t current, size_t total)>& cb,
+ const std::function<bool(
+ uint64_t addr, const std::string& match, const BinaryNinja::LinearDisassemblyLine& line)>& matchCallback);
+ virtual bool findAllConstant(uint64_t start, uint64_t end, uint64_t constant, DisassemblySettingsRef settings,
+ BNFunctionGraphType graph, const std::function<bool(size_t current, size_t total)>& cb,
+ const std::function<bool(uint64_t addr, const BinaryNinja::LinearDisassemblyLine& line)>& matchCallback);
virtual BinaryViewRef getData() = 0;
virtual uint64_t getCurrentOffset() = 0;
@@ -169,9 +163,9 @@ public:
void setBinaryDataNavigable(bool navigable) { m_binaryDataNavigable = navigable; }
virtual bool closeRequest() { return true; }
- virtual void closing() { }
- virtual void updateFonts() { }
- virtual void updateTheme() { }
+ virtual void closing() {}
+ virtual void updateFonts() {}
+ virtual void updateTheme() {}
virtual void undo();
virtual void redo();
@@ -214,7 +208,7 @@ public:
virtual MediumLevelILFunctionRef getCurrentMediumLevelILFunction() { return nullptr; }
virtual HighLevelILFunctionRef getCurrentHighLevelILFunction() { return nullptr; }
virtual BNFunctionGraphType getILViewType() { return InvalidILViewType; }
- virtual void setILViewType(BNFunctionGraphType ilViewType) { }
+ virtual void setILViewType(BNFunctionGraphType ilViewType) {}
virtual size_t getCurrentILInstructionIndex() { return BN_INVALID_EXPR; }
virtual QFont getFont() = 0;
@@ -234,8 +228,16 @@ public:
void forceSyncFromView(ViewFrame* frame = nullptr);
virtual void clearRelatedHighlights() {}
- virtual void setRelatedIndexHighlights(FunctionRef func, const std::set<size_t>& related) { (void)func; (void)related; }
- virtual void setRelatedInstructionHighlights(FunctionRef func, const std::set<uint64_t>& related) { (void)func; (void)related; }
+ virtual void setRelatedIndexHighlights(FunctionRef func, const std::set<size_t>& related)
+ {
+ (void)func;
+ (void)related;
+ }
+ virtual void setRelatedInstructionHighlights(FunctionRef func, const std::set<uint64_t>& related)
+ {
+ (void)func;
+ (void)related;
+ }
static void registerActions();
};
@@ -248,8 +250,12 @@ class BINARYNINJAUIAPI ViewNavigationMode
ViewNavigationMode();
-public:
- ViewNavigationMode(View* view, std::string mode) : m_view(view) { m_mode = m_view->getNavigationMode(); m_view->setNavigationMode(mode); }
+ public:
+ ViewNavigationMode(View* view, std::string mode) : m_view(view)
+ {
+ m_mode = m_view->getNavigationMode();
+ m_view->setNavigationMode(mode);
+ }
~ViewNavigationMode() { m_view->setNavigationMode(m_mode); }
};
@@ -263,17 +269,25 @@ class BINARYNINJAUIAPI ViewLocation
BNFunctionGraphType m_ilViewType = NormalFunctionGraph;
size_t m_instrIndex = BN_INVALID_EXPR;
-public:
- ViewLocation() { }
- ViewLocation(const QString& viewType, uint64_t offset) : m_valid(true), m_viewType(viewType), m_offset(offset) { }
- ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType) : m_valid(true),
- m_viewType(viewType), m_offset(offset), m_ilViewType(ilViewType) { }
- ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex) : m_valid(true),
- m_viewType(viewType), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex) { }
- ViewLocation(const QString& viewType, FunctionRef function, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex) :
- m_valid(true), m_viewType(viewType), m_function(function), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex) { }
- ViewLocation(FunctionRef function, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex = BN_INVALID_EXPR) : m_valid(true),
- m_function(function), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex) { }
+ public:
+ ViewLocation() {}
+ ViewLocation(const QString& viewType, uint64_t offset) : m_valid(true), m_viewType(viewType), m_offset(offset) {}
+ ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType) :
+ m_valid(true), m_viewType(viewType), m_offset(offset), m_ilViewType(ilViewType)
+ {}
+ ViewLocation(const QString& viewType, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex) :
+ m_valid(true), m_viewType(viewType), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex)
+ {}
+ ViewLocation(const QString& viewType, FunctionRef function, uint64_t offset, BNFunctionGraphType ilViewType,
+ size_t instrIndex) :
+ m_valid(true),
+ m_viewType(viewType), m_function(function), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex)
+ {}
+ ViewLocation(
+ FunctionRef function, uint64_t offset, BNFunctionGraphType ilViewType, size_t instrIndex = BN_INVALID_EXPR) :
+ m_valid(true),
+ m_function(function), m_offset(offset), m_ilViewType(ilViewType), m_instrIndex(instrIndex)
+ {}
bool isValid() const { return m_valid; }
QString getViewType() const { return m_viewType; }
@@ -290,12 +304,9 @@ public:
bool operator==(const ViewLocation& other) const
{
- return (m_valid == other.m_valid) &&
- (m_viewType == other.m_viewType) &&
- (m_offset == other.m_offset) &&
- (m_ilViewType == other.m_ilViewType) &&
- (m_instrIndex == other.m_instrIndex) &&
- (m_function == other.m_function);
+ return (m_valid == other.m_valid) && (m_viewType == other.m_viewType) && (m_offset == other.m_offset)
+ && (m_ilViewType == other.m_ilViewType) && (m_instrIndex == other.m_instrIndex)
+ && (m_function == other.m_function);
}
bool operator!=(const ViewLocation& other) const { return !((*this) == other); }
};
@@ -303,7 +314,7 @@ public:
class BINARYNINJAUIAPI ViewContainer
{
-public:
+ public:
virtual ~ViewContainer() {}
virtual View* getView() = 0;
};
@@ -315,13 +326,13 @@ class BINARYNINJAUIAPI ViewFrame : public QWidget
{
Q_OBJECT
-private:
+ private:
QWidget* createView(const QString& typeName, ViewType* type, BinaryViewRef data, bool createDynamicWidgets = true);
BinaryNinja::Ref<HistoryEntry> getHistoryEntry();
ViewFrame* searchForOtherPane(const std::function<void(const std::function<void(ViewPane*)>&)>& enumerator);
FileContext* m_context;
- bool m_fileContentsLock = true; // file contents protection from accidental modification in the UI
+ bool m_fileContentsLock = true; // file contents protection from accidental modification in the UI
BinaryViewRef m_data;
QWidget* m_view = nullptr;
QWidget* m_viewContainer;
@@ -335,7 +346,7 @@ private:
UIActionHandler m_actionHandler;
-protected:
+ protected:
QPointer<CompileDialog> compileDialog;
bool event(QEvent* event) override;
@@ -350,7 +361,7 @@ protected:
*/
BinaryNinja::Ref<HistoryEntry> deserializeHistoryEntry(const Json::Value& json);
-public:
+ public:
explicit ViewFrame(QWidget* parent, FileContext* file, const QString& type, bool createDynamicWidgets = false);
virtual ~ViewFrame();
@@ -385,7 +396,7 @@ public:
Sidebar* getSidebar();
- template<class T>
+ template <class T>
T* getSidebarWidget(const QString& name)
{
Sidebar* sidebar = getSidebar();
@@ -398,12 +409,14 @@ public:
}
bool navigate(const QString& type, uint64_t offset, bool updateInfo = true, bool addHistoryEntry = true);
- bool navigate(const QString& type, const std::function<bool(View*)>& handler, bool updateInfo = true, bool addHistoryEntry = true);
+ bool navigate(const QString& type, const std::function<bool(View*)>& handler, bool updateInfo = true,
+ bool addHistoryEntry = true);
bool navigate(BinaryViewRef data, uint64_t offset, bool updateInfo = true, bool addHistoryEntry = true);
bool navigateToFunction(FunctionRef func, uint64_t offset, bool updateInfo = true, bool addHistoryEntry = true);
- bool goToReference(BinaryViewRef data, FunctionRef func, uint64_t source, uint64_t target, bool addHistoryEntry = true);
- bool navigateToViewLocation(BinaryViewRef data, const ViewLocation& viewLocation,
- bool addHistoryEntry = true, bool center = false);
+ bool goToReference(
+ BinaryViewRef data, FunctionRef func, uint64_t source, uint64_t target, bool addHistoryEntry = true);
+ bool navigateToViewLocation(
+ BinaryViewRef data, const ViewLocation& viewLocation, bool addHistoryEntry = true, bool center = false);
bool navigateToHistoryEntry(BinaryNinja::Ref<HistoryEntry> entry);
QString getTypeForView(QWidget* view) const;
QString getDataTypeForView(const QString& type) const;
@@ -432,12 +445,12 @@ public:
void back();
void forward();
- static bool getAddressFromString(QWidget* parent, BinaryViewRef data, uint64_t& offset,
- uint64_t currentAddress, const QString& addrStr, std::string& errorString);
- static bool getAddressFromInput(QWidget* parent, BinaryViewRef data, uint64_t& offset,
- uint64_t currentAddress, const QString& title = "Go to Address", const QString& msg = "Address:", bool defaultToCurrent = false);
- static bool getFileOffsetFromInput(QWidget* parent, BinaryViewRef data, uint64_t& offset,
- uint64_t currentAddress, const QString& title = "Go to File Offset", const QString& msg = "File Offset:", bool defaultToCurrent = false);
+ static bool getAddressFromString(QWidget* parent, BinaryViewRef data, uint64_t& offset, uint64_t currentAddress,
+ const QString& addrStr, std::string& errorString);
+ static bool getAddressFromInput(QWidget* parent, BinaryViewRef data, uint64_t& offset, uint64_t currentAddress,
+ const QString& title = "Go to Address", const QString& msg = "Address:", bool defaultToCurrent = false);
+ static bool getFileOffsetFromInput(QWidget* parent, BinaryViewRef data, uint64_t& offset, uint64_t currentAddress,
+ const QString& title = "Go to File Offset", const QString& msg = "File Offset:", bool defaultToCurrent = false);
void setCurrentFunction(FunctionRef func);
void updateCrossReferences();
@@ -475,11 +488,11 @@ public:
ViewFrame* getOtherPane();
-public Q_SLOTS:
+ public Q_SLOTS:
virtual void assemble();
virtual void compile();
-Q_SIGNALS:
+ Q_SIGNALS:
void notifyCloseFeatureMap(bool recreate);
void notifyViewChanged(ViewFrame* frame);
};
diff --git a/ui/viewlist.h b/ui/viewlist.h
index c1926106..e79f76b5 100644
--- a/ui/viewlist.h
+++ b/ui/viewlist.h
@@ -6,7 +6,7 @@
#include "menus.h"
#include "action.h"
-class BINARYNINJAUIAPI ViewList: public MenuHelper
+class BINARYNINJAUIAPI ViewList : public MenuHelper
{
Q_OBJECT
@@ -16,16 +16,16 @@ class BINARYNINJAUIAPI ViewList: public MenuHelper
UIActionHandler* m_handler;
-public:
+ public:
ViewList(QWidget* parent);
void bindActions(UIActionHandler* handler);
void addMenuActions(Menu* menu, const QString& group);
void setCurrentViewType(ViewFrame* view, const QString& type);
-protected:
+ protected:
virtual void showMenu();
-Q_SIGNALS:
+ Q_SIGNALS:
void viewChanged(QString type);
};
diff --git a/ui/viewtype.h b/ui/viewtype.h
index 2216b9dd..e68c02e2 100644
--- a/ui/viewtype.h
+++ b/ui/viewtype.h
@@ -12,7 +12,7 @@ class BINARYNINJAUIAPI ViewType
{
QString m_name, m_longName;
-public:
+ public:
ViewType(const QString& name, const QString& longName);
virtual ~ViewType();
@@ -33,7 +33,7 @@ public:
class BINARYNINJAUIAPI ViewTypeContainer
{
-public:
+ public:
std::vector<ViewType*> m_types;
static ViewTypeContainer& GetViewTypeContainer();
diff --git a/ui/xreflist.h b/ui/xreflist.h
index 76942954..f1426ee9 100644
--- a/ui/xreflist.h
+++ b/ui/xreflist.h
@@ -28,11 +28,11 @@
class XrefHeader;
class XrefItem
{
-public:
+ public:
enum XrefDirection
{
- Forward, // current address is addressing another address
- Backward // current address is being referenced by another address
+ Forward, // current address is addressing another address
+ Backward // current address is being referenced by another address
};
enum XrefType
@@ -43,7 +43,7 @@ public:
TypeXrefType
};
-protected:
+ protected:
FunctionRef m_func;
ArchitectureRef m_arch;
uint64_t m_addr;
@@ -58,14 +58,15 @@ protected:
mutable int m_size;
-public:
+ public:
explicit XrefItem();
explicit XrefItem(XrefHeader* parent, XrefType type, FunctionRef func);
// The four constructors are used for code/data/type/variable referecens, respectively
explicit XrefItem(BinaryNinja::ReferenceSource ref, XrefType type, XrefDirection direction);
explicit XrefItem(uint64_t addr, XrefType type, XrefDirection direction);
explicit XrefItem(BinaryNinja::TypeReferenceSource ref, XrefType type, XrefDirection direction);
- explicit XrefItem(BinaryNinja::Variable var, BinaryNinja::ILReferenceSource ref, XrefType type, XrefDirection direction);
+ explicit XrefItem(
+ BinaryNinja::Variable var, BinaryNinja::ILReferenceSource ref, XrefType type, XrefDirection direction);
XrefItem(const XrefItem& ref);
virtual ~XrefItem();
@@ -92,11 +93,12 @@ public:
};
-class XrefHeader: public XrefItem
+class XrefHeader : public XrefItem
{
-protected:
+ protected:
QString m_name;
-public:
+
+ public:
XrefHeader();
XrefHeader(const QString& name, XrefItem::XrefType type, XrefHeader* parent, FunctionRef func);
virtual ~XrefHeader() {}
@@ -114,7 +116,8 @@ public:
class XrefFunctionHeader : public XrefHeader
{
std::deque<XrefItem*> m_refs;
-public:
+
+ public:
XrefFunctionHeader();
XrefFunctionHeader(FunctionRef func, XrefHeader* parent, XrefItem* child);
XrefFunctionHeader(const XrefFunctionHeader& header);
@@ -129,7 +132,8 @@ public:
class XrefTypeHeader : public XrefHeader
{
std::deque<XrefItem*> m_refs;
-public:
+
+ public:
XrefTypeHeader();
XrefTypeHeader(BinaryNinja::QualifiedName name, XrefHeader* parent, XrefItem* child);
XrefTypeHeader(const XrefTypeHeader& header);
@@ -143,7 +147,8 @@ public:
class XrefVariableHeader : public XrefHeader
{
std::deque<XrefItem*> m_refs;
-public:
+
+ public:
XrefVariableHeader();
XrefVariableHeader(XrefHeader* parent, XrefItem* child);
XrefVariableHeader(const XrefVariableHeader& header);
@@ -154,11 +159,12 @@ public:
};
-class XrefCodeReferences: public XrefHeader
+class XrefCodeReferences : public XrefHeader
{
std::map<FunctionRef, XrefFunctionHeader*> m_refs;
std::deque<XrefFunctionHeader*> m_refList;
-public:
+
+ public:
XrefCodeReferences(XrefHeader* parent);
virtual ~XrefCodeReferences();
virtual int childCount() const override { return (int)m_refs.size(); }
@@ -169,10 +175,11 @@ public:
};
-class XrefDataReferences: public XrefHeader
+class XrefDataReferences : public XrefHeader
{
std::deque<XrefItem*> m_refs;
-public:
+
+ public:
XrefDataReferences(XrefHeader* parent);
virtual ~XrefDataReferences();
virtual int childCount() const override { return (int)m_refs.size(); };
@@ -182,11 +189,12 @@ public:
};
-class XrefTypeReferences: public XrefHeader
+class XrefTypeReferences : public XrefHeader
{
std::map<BinaryNinja::QualifiedName, XrefTypeHeader*> m_refs;
std::deque<XrefTypeHeader*> m_refList;
-public:
+
+ public:
XrefTypeReferences(XrefHeader* parent);
virtual ~XrefTypeReferences();
virtual int childCount() const override { return (int)m_refs.size(); };
@@ -197,11 +205,12 @@ public:
};
-class XrefVariableReferences: public XrefHeader
+class XrefVariableReferences : public XrefHeader
{
std::map<BinaryNinja::Variable, XrefVariableHeader*> m_refs;
std::deque<XrefVariableHeader*> m_refList;
-public:
+
+ public:
XrefVariableReferences(XrefHeader* parent);
virtual ~XrefVariableReferences();
virtual int childCount() const override { return (int)m_refs.size(); };
@@ -212,10 +221,11 @@ public:
};
-class XrefRoot: public XrefHeader
+class XrefRoot : public XrefHeader
{
std::map<XrefItem::XrefType, XrefHeader*> m_refs;
-public:
+
+ public:
XrefRoot();
XrefRoot(XrefRoot&& root);
~XrefRoot();
@@ -238,7 +248,7 @@ class BINARYNINJAUIAPI CrossReferenceTreeModel : public QAbstractItemModel
size_t m_maxUIItems;
std::optional<BNFunctionGraphType> m_graphType;
-public:
+ public:
CrossReferenceTreeModel(QWidget* parent, BinaryViewRef data, ViewFrame* view);
virtual ~CrossReferenceTreeModel();
@@ -273,7 +283,7 @@ class BINARYNINJAUIAPI CrossReferenceTableModel : public QAbstractTableModel
size_t m_maxUIItems;
std::optional<BNFunctionGraphType> m_graphType;
-public:
+ public:
enum ColumnHeaders
{
Direction = 0,
@@ -288,9 +298,21 @@ public:
virtual QModelIndex index(int row, int col, const QModelIndex& parent = QModelIndex()) const override;
virtual QVariant data(const QModelIndex& i, int role) const override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
- virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override { (void)parent; return (int)m_refs.size(); };
- virtual QModelIndex parent(const QModelIndex& i) const override { (void)i; return QModelIndex(); }
- virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override { (void) parent; return 4;};
+ virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override
+ {
+ (void)parent;
+ return (int)m_refs.size();
+ };
+ virtual QModelIndex parent(const QModelIndex& i) const override
+ {
+ (void)i;
+ return QModelIndex();
+ }
+ virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override
+ {
+ (void)parent;
+ return 4;
+ };
virtual QVariant headerData(int column, Qt::Orientation orientation, int role) const override;
virtual bool hasChildren(const QModelIndex&) const override { return false; }
bool setModelData(std::vector<XrefItem>& refs, QItemSelectionModel* selectionModel, bool& selectionUpdated);
@@ -302,7 +324,7 @@ public:
};
-class BINARYNINJAUIAPI CrossReferenceItemDelegate: public QStyledItemDelegate
+class BINARYNINJAUIAPI CrossReferenceItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
@@ -312,7 +334,7 @@ class BINARYNINJAUIAPI CrossReferenceItemDelegate: public QStyledItemDelegate
bool m_table;
size_t m_maxUIItems;
-public:
+ public:
CrossReferenceItemDelegate(QWidget* parent, bool table);
void updateFonts();
@@ -338,20 +360,20 @@ class BINARYNINJAUIAPI CrossReferenceFilterProxyModel : public QSortFilterProxyM
bool m_showOutgoing = true;
bool m_table;
-public:
+ public:
CrossReferenceFilterProxyModel(QObject* parent, bool table);
QModelIndex nextValidIndex(const QModelIndex& current) const;
QModelIndex getFirstLeaf(const QModelIndex& index) const;
QModelIndex prevValidIndex(const QModelIndex& current) const;
QModelIndex getLastLeaf(const QModelIndex& index) const;
-protected:
+ protected:
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override;
virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
virtual QVariant data(const QModelIndex& index, int role) const override;
virtual bool hasChildren(const QModelIndex& parent) const override;
-public Q_SLOTS:
+ public Q_SLOTS:
void directionChanged(int index, bool checked);
void typeChanged(int index, bool checked);
void resetFilter();
@@ -360,12 +382,13 @@ public Q_SLOTS:
class CrossReferenceWidget;
class BINARYNINJAUIAPI CrossReferenceContainer
{
-protected:
+ protected:
ViewFrame* m_view;
CrossReferenceWidget* m_parent;
BinaryViewRef m_data;
UIActionHandler m_actionHandler;
-public:
+
+ public:
CrossReferenceContainer(CrossReferenceWidget* parent, ViewFrame* view, BinaryViewRef data);
virtual ~CrossReferenceContainer() {}
virtual QModelIndex translateIndex(const QModelIndex& idx) const = 0;
@@ -382,7 +405,7 @@ public:
};
-class BINARYNINJAUIAPI CrossReferenceTree: public QTreeView, public CrossReferenceContainer
+class BINARYNINJAUIAPI CrossReferenceTree : public QTreeView, public CrossReferenceContainer
{
Q_OBJECT
@@ -390,11 +413,11 @@ class BINARYNINJAUIAPI CrossReferenceTree: public QTreeView, public CrossReferen
CrossReferenceFilterProxyModel* m_model;
CrossReferenceItemDelegate* m_itemDelegate;
-protected:
- void drawBranches(QPainter *painter, const QRect &rect, const QModelIndex &index) const override;
+ protected:
+ void drawBranches(QPainter* painter, const QRect& rect, const QModelIndex& index) const override;
virtual bool getReference(const QModelIndex& idx, XrefItem** refPtr) const override;
-public:
+ public:
CrossReferenceTree(CrossReferenceWidget* parent, ViewFrame* view, BinaryViewRef data);
virtual ~CrossReferenceTree();
@@ -415,12 +438,12 @@ public:
virtual void updateMaxUIItems(size_t count) override;
void setGraphType(BNFunctionGraphType type) { m_tree->setGraphType(type); }
-Q_SIGNALS:
+ Q_SIGNALS:
void newSelection();
};
-class BINARYNINJAUIAPI CrossReferenceTable: public QTableView, public CrossReferenceContainer
+class BINARYNINJAUIAPI CrossReferenceTable : public QTableView, public CrossReferenceContainer
{
Q_OBJECT
@@ -428,7 +451,7 @@ class BINARYNINJAUIAPI CrossReferenceTable: public QTableView, public CrossRefer
CrossReferenceItemDelegate* m_itemDelegate;
CrossReferenceFilterProxyModel* m_model;
-public:
+ public:
CrossReferenceTable(CrossReferenceWidget* parent, ViewFrame* view, BinaryViewRef data);
virtual ~CrossReferenceTable();
@@ -450,15 +473,15 @@ public:
virtual void updateMaxUIItems(size_t count) override;
void setGraphType(BNFunctionGraphType type) { m_table->setGraphType(type); }
-public Q_SLOTS:
+ public Q_SLOTS:
void updateTextFilter(const QString& filterText);
-Q_SIGNALS:
+ Q_SIGNALS:
void newSelection();
};
class ExpandableGroup;
class QCheckboxCombo;
-class BINARYNINJAUIAPI CrossReferenceWidget: public SidebarWidget, public UIContextNotification
+class BINARYNINJAUIAPI CrossReferenceWidget : public SidebarWidget, public UIContextNotification
{
Q_OBJECT
@@ -494,7 +517,7 @@ class BINARYNINJAUIAPI CrossReferenceWidget: public SidebarWidget, public UICont
virtual void contextMenuEvent(QContextMenuEvent* event) override;
virtual void wheelEvent(QWheelEvent* e) override;
-public:
+ public:
CrossReferenceWidget(ViewFrame* view, BinaryViewRef data, bool pinned);
virtual ~CrossReferenceWidget();
virtual void notifyFontChanged() override;
@@ -522,16 +545,16 @@ public:
virtual void focus() override;
- virtual void OnNewSelectionForXref(UIContext* context, ViewFrame* frame, View* view,
- const SelectionInfoForXref& selection) override;
+ virtual void OnNewSelectionForXref(
+ UIContext* context, ViewFrame* frame, View* view, const SelectionInfoForXref& selection) override;
virtual QWidget* headerWidget() override { return m_header; }
-private Q_SLOTS:
+ private Q_SLOTS:
void hoverTimerEvent();
void newPinnedPane();
-public Q_SLOTS:
+ public Q_SLOTS:
void referenceActivated(const QModelIndex& idx);
void pinnedStateChanged(bool state);
void selectionChanged();
@@ -540,9 +563,9 @@ public Q_SLOTS:
};
-class BINARYNINJAUIAPI CrossReferenceSidebarWidgetType: public SidebarWidgetType
+class BINARYNINJAUIAPI CrossReferenceSidebarWidgetType : public SidebarWidgetType
{
-public:
+ public:
CrossReferenceSidebarWidgetType();
virtual bool isInReferenceArea() const override { return true; }
virtual SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;
@@ -559,18 +582,18 @@ class BINARYNINJAUIAPI QCheckboxCombo : public QComboBox
{
Q_OBJECT
-public:
- explicit QCheckboxCombo(QWidget *parent = nullptr);
+ public:
+ explicit QCheckboxCombo(QWidget* parent = nullptr);
bool eventFilter(QObject* watched, QEvent* event);
void hidePopup();
void showPopup();
- void addItem(const QString &text, bool checked = true);
+ void addItem(const QString& text, bool checked = true);
-Q_SIGNALS:
+ Q_SIGNALS:
void selectionChanged(const QString& text);
void itemToggled(int index, bool checked);
-private:
+ private:
bool m_popupVisible = false;
bool m_editable = false;
QString m_selectionString;