Skip to content

Commit 55b3ce7

Browse files
committed
Initial support for Quick Settings.
1 parent 46e058a commit 55b3ce7

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

binaryninjaapi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17022,8 +17022,9 @@ namespace BinaryNinja {
1702217022
"readOnly" bool None Yes Only enforced by UI elements
1702317023
"optional" bool None Yes Indicates setting can be null
1702417024
"hidden" bool "type" is "string" Yes Indicates the UI should conceal the content. The "ignore" property is required to specify the applicable storage scopes
17025-
"requiresRestart bool None Yes Enable restart notification in the UI upon change
17025+
"requiresRestart" bool None Yes Enable restart notification in the UI upon change
1702617026
"uiSelectionAction" string "type" is "string" Yes {"file", "directory", <Registered UIAction Name>} Informs the UI to add a button to open a selection dialog or run a registered UIAction
17027+
"quickSettingsGroup" string None Yes Informs the submenu name in the UI when added to quick settings context menu
1702717028
================== ====================================== ================== ======== =======================================================================
1702817029

1702917030
\note In order to facilitate deterministic analysis results, settings from the <em><tt>default</tt></em> schema that impact analysis are serialized

python/settings.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ class Settings:
6262
:func:`register_group` method allows for specifying a UI friendly title for use in the Binary Ninja UI. Defining a new setting requires a \
6363
unique setting key and a JSON string of property, value pairs. The following table describes the available properties and values.
6464
65-
=================== ====================================== ================== ======== =======================================================================
65+
==================== ====================================== ================== ======== =======================================================================
6666
Property JSON Data Type Prerequisite Optional {Allowed Values} and Notes
67-
=================== ====================================== ================== ======== =======================================================================
67+
==================== ====================================== ================== ======== =======================================================================
6868
"title" string None No Concise Setting Title
6969
"type" string None No {"array", "boolean", "number", "string", "object"}
7070
"sorted" boolean "type" is "array" Yes Automatically sort list items (default is false)
@@ -82,9 +82,10 @@ class Settings:
8282
"readOnly" boolean None Yes Only enforced by UI elements
8383
"optional" boolean None Yes Indicates setting can be null
8484
"hidden" bool "type" is "string" Yes Indicates the UI should conceal the content. The "ignore" property is required to specify the applicable storage scopes
85-
"requiresRestart boolean None Yes Enable restart notification in the UI upon change
85+
"requiresRestart" boolean None Yes Enable restart notification in the UI upon change
8686
"uiSelectionAction" string "type" is "string" Yes {"file", "directory", <Registered UIAction Name>} Informs the UI to add a button to open a selection dialog or run a registered UIAction
87-
=================== ====================================== ================== ======== =======================================================================
87+
"quickSettingsGroup" string None Yes Informs the submenu name in the UI when added to quick settings context menu
88+
==================== ====================================== ================== ======== =======================================================================
8889
8990
.. note:: In order to facilitate deterministic analysis results, settings from the *'default'* schema that impact analysis are serialized \
9091
from Default, User, and Project scope into Resource scope during initial BinaryView analysis. This allows an analysis database to be opened \

ui/quicksettings.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#pragma once
2+
3+
#include <QtCore/QString>
4+
#include <QtCore/QStringList>
5+
6+
#include "binaryninjaapi.h"
7+
#include "uitypes.h"
8+
9+
class View;
10+
11+
12+
struct BINARYNINJAUIAPI QuickSettingsInfo
13+
{
14+
QString settingKey;
15+
QString displayName;
16+
bool workflowDependent;
17+
};
18+
19+
20+
class BINARYNINJAUIAPI QuickSettings
21+
{
22+
public:
23+
static void bindDynamicActions(View* view, const std::function<bool()>& isValid);
24+
static void addQuickSetting(const QString& settingKey, const QString& displayName, const QString& group = "", bool workflowDependent = false);
25+
static void removeQuickSetting(const QString& settingKey, const QString& group = "");
26+
static bool isQuickSetting(const QString& settingKey, const QString& group = "");
27+
static QStringList getQuickSettingGroups();
28+
static QList<QuickSettingsInfo> getQuickSettings(const QString& group = "");
29+
static QString getDisplayName(const QString& settingKey, const QString& group = "");
30+
static void resetAllQuickSettings();
31+
static void printAll();
32+
};

ui/settingsview.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ class BINARYNINJAUIAPI SettingsEditor : public QWidget
156156
std::string m_settingKey;
157157
BinaryViewRef m_view = nullptr;
158158
BNSettingsScope m_scope = SettingsAutoScope;
159+
int m_ignoreScope = 0;
160+
QString m_quickSettingsGroup;
161+
bool m_workflowDependent = false;
159162

160163
QLabel* m_title = nullptr;
161164
ClickableLabel* m_description = nullptr;

0 commit comments

Comments
 (0)