summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2025-06-20 00:45:35 -0400
committerBrian Potchik <brian@vector35.com>2025-06-20 00:45:35 -0400
commit55b3ce7de85ef38158e0a248105d3eb2a8562871 (patch)
treef98a7d43fb1712f3a42d3722d1da2e6865c7069f
parent46e058a98054693037b9accba4265f8481e60231 (diff)
Initial support for Quick Settings.
-rw-r--r--binaryninjaapi.h3
-rw-r--r--python/settings.py9
-rw-r--r--ui/quicksettings.h32
-rw-r--r--ui/settingsview.h3
4 files changed, 42 insertions, 5 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 23b14797..2dc9b899 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -17022,8 +17022,9 @@ namespace BinaryNinja {
"readOnly" bool None Yes Only enforced by UI elements
"optional" bool None Yes Indicates setting can be null
"hidden" bool "type" is "string" Yes Indicates the UI should conceal the content. The "ignore" property is required to specify the applicable storage scopes
- "requiresRestart bool None Yes Enable restart notification in the UI upon change
+ "requiresRestart" bool None Yes Enable restart notification in the UI upon change
"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
+ "quickSettingsGroup" string None Yes Informs the submenu name in the UI when added to quick settings context menu
================== ====================================== ================== ======== =======================================================================
\note In order to facilitate deterministic analysis results, settings from the <em><tt>default</tt></em> schema that impact analysis are serialized
diff --git a/python/settings.py b/python/settings.py
index 661d6e15..50110df8 100644
--- a/python/settings.py
+++ b/python/settings.py
@@ -62,9 +62,9 @@ class Settings:
:func:`register_group` method allows for specifying a UI friendly title for use in the Binary Ninja UI. Defining a new setting requires a \
unique setting key and a JSON string of property, value pairs. The following table describes the available properties and values.
- =================== ====================================== ================== ======== =======================================================================
+ ==================== ====================================== ================== ======== =======================================================================
Property JSON Data Type Prerequisite Optional {Allowed Values} and Notes
- =================== ====================================== ================== ======== =======================================================================
+ ==================== ====================================== ================== ======== =======================================================================
"title" string None No Concise Setting Title
"type" string None No {"array", "boolean", "number", "string", "object"}
"sorted" boolean "type" is "array" Yes Automatically sort list items (default is false)
@@ -82,9 +82,10 @@ class Settings:
"readOnly" boolean None Yes Only enforced by UI elements
"optional" boolean None Yes Indicates setting can be null
"hidden" bool "type" is "string" Yes Indicates the UI should conceal the content. The "ignore" property is required to specify the applicable storage scopes
- "requiresRestart boolean None Yes Enable restart notification in the UI upon change
+ "requiresRestart" boolean None Yes Enable restart notification in the UI upon change
"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
- =================== ====================================== ================== ======== =======================================================================
+ "quickSettingsGroup" string None Yes Informs the submenu name in the UI when added to quick settings context menu
+ ==================== ====================================== ================== ======== =======================================================================
.. note:: In order to facilitate deterministic analysis results, settings from the *'default'* schema that impact analysis are serialized \
from Default, User, and Project scope into Resource scope during initial BinaryView analysis. This allows an analysis database to be opened \
diff --git a/ui/quicksettings.h b/ui/quicksettings.h
new file mode 100644
index 00000000..387ee4cc
--- /dev/null
+++ b/ui/quicksettings.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+
+#include "binaryninjaapi.h"
+#include "uitypes.h"
+
+class View;
+
+
+struct BINARYNINJAUIAPI QuickSettingsInfo
+{
+ QString settingKey;
+ QString displayName;
+ bool workflowDependent;
+};
+
+
+class BINARYNINJAUIAPI QuickSettings
+{
+ public:
+ static void bindDynamicActions(View* view, const std::function<bool()>& isValid);
+ static void addQuickSetting(const QString& settingKey, const QString& displayName, const QString& group = "", bool workflowDependent = false);
+ static void removeQuickSetting(const QString& settingKey, const QString& group = "");
+ static bool isQuickSetting(const QString& settingKey, const QString& group = "");
+ static QStringList getQuickSettingGroups();
+ static QList<QuickSettingsInfo> getQuickSettings(const QString& group = "");
+ static QString getDisplayName(const QString& settingKey, const QString& group = "");
+ static void resetAllQuickSettings();
+ static void printAll();
+};
diff --git a/ui/settingsview.h b/ui/settingsview.h
index b0f209b3..2506e2ac 100644
--- a/ui/settingsview.h
+++ b/ui/settingsview.h
@@ -156,6 +156,9 @@ class BINARYNINJAUIAPI SettingsEditor : public QWidget
std::string m_settingKey;
BinaryViewRef m_view = nullptr;
BNSettingsScope m_scope = SettingsAutoScope;
+ int m_ignoreScope = 0;
+ QString m_quickSettingsGroup;
+ bool m_workflowDependent = false;
QLabel* m_title = nullptr;
ClickableLabel* m_description = nullptr;