summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2024-01-22 16:11:19 -0500
committerJosh Ferrell <josh@vector35.com>2024-01-22 16:11:19 -0500
commit3dd22f40996fc128ffce6026e8e747ca66bcc21d (patch)
treea5e7fc57dc620fc4d4a408ffdbf114bb66dcf91d /ui
parent96053ffc711aa27fcaeeb6cbfa89df0c253361f8 (diff)
Project support
Diffstat (limited to 'ui')
-rw-r--r--ui/externallocationdialog.h29
-rw-r--r--ui/linearview.h5
-rw-r--r--ui/options.h1
-rw-r--r--ui/settingsview.h6
-rw-r--r--ui/uicontext.h46
-rw-r--r--ui/uitypes.h5
-rw-r--r--ui/util.h2
7 files changed, 90 insertions, 4 deletions
diff --git a/ui/externallocationdialog.h b/ui/externallocationdialog.h
new file mode 100644
index 00000000..c86eea70
--- /dev/null
+++ b/ui/externallocationdialog.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <QtWidgets/QComboBox>
+#include <QtWidgets/QDialog>
+#include <QtWidgets/QLineEdit>
+#include <QtWidgets/QPushButton>
+#include "uitypes.h"
+
+
+class BINARYNINJAUIAPI ExternalLocationDialog : public QDialog
+{
+ QPushButton* m_acceptButton;
+ QPushButton* m_cancelButton;
+
+ QLineEdit* m_internalSymbolField;
+ QComboBox* m_libraryField;
+ QLineEdit* m_externalSymbolField;
+ QLineEdit* m_addressField;
+
+ BinaryViewRef m_data;
+ ExternalLocationRef m_location;
+
+ void Submit();
+
+ void updateForm();
+
+public:
+ ExternalLocationDialog(QWidget* parent, BinaryViewRef data, ExternalLocationRef loc = nullptr, ExternalLibraryRef lib = nullptr, std::optional<std::string> rawSym = {});
+};
diff --git a/ui/linearview.h b/ui/linearview.h
index 7f590ce0..936ceb59 100644
--- a/ui/linearview.h
+++ b/ui/linearview.h
@@ -251,6 +251,7 @@ class BINARYNINJAUIAPI LinearView : public QAbstractScrollArea, public View, pub
bool navigateToLine(
FunctionRef func, uint64_t offset, size_t instrIndex, bool center, bool updateHighlight, bool navByRef = false);
bool navigateToGotoLabel(uint64_t label);
+ bool navigateToExternalLink(uint64_t linkSourceAddr);
void viewData();
void scrollLines(int count);
@@ -335,6 +336,10 @@ private Q_SLOTS:
void tagAddressAccepted(TagTypeRef tt);
void manageAddressTags();
+ void createExternalLink();
+ void editExternalLink();
+ void removeExternalLink();
+
void convertToNop();
void alwaysBranch();
void invertBranch();
diff --git a/ui/options.h b/ui/options.h
index 0bfba08c..4c7153c7 100644
--- a/ui/options.h
+++ b/ui/options.h
@@ -43,6 +43,7 @@ class BINARYNINJAUIAPI OptionsDialog : public QDialog
FileContext* m_file = nullptr;
FileMetadataRef m_fileMetadata = nullptr;
BinaryViewRef m_rawData = nullptr;
+ ProjectRef m_project = nullptr;
std::vector<std::tuple<std::string, size_t, std::string, uint64_t, uint64_t, std::string>> m_objects;
const std::string m_oldFlag = "old:";
diff --git a/ui/settingsview.h b/ui/settingsview.h
index 8ec548b7..812eed3c 100644
--- a/ui/settingsview.h
+++ b/ui/settingsview.h
@@ -371,9 +371,9 @@ class BINARYNINJAUIAPI SettingsScopeBar : public QWidget
Q_OBJECT
QPushButton* m_userLabel;
- BinaryViewScopeLabel* m_projectLabel;
+ QPushButton* m_projectLabel;
BinaryViewScopeLabel* m_resourceLabel;
- ClickableLabel* m_openProjectLabel;
+ //ClickableLabel* m_openProjectLabel;
QLabel* m_desc;
unsigned long m_highlightIdx;
@@ -384,6 +384,7 @@ class BINARYNINJAUIAPI SettingsScopeBar : public QWidget
void refresh();
void setResource(BinaryViewRef view);
+ void setScope(BNSettingsScope scope);
void updateTheme();
Q_SIGNALS:
@@ -453,6 +454,7 @@ class BINARYNINJAUIAPI SettingsView : public QWidget
void refreshAllSettings();
void refreshCurrentScope();
void setData(BinaryViewRef view, const QString& name = "");
+ void setScope(BNSettingsScope scope);
void setDefaultGroupSelection(const QString& group, const QString& subgroup = "");
void focusSearch();
void setSearchFilter(const QString& filter) { if (m_search) m_search->setText(filter); };
diff --git a/ui/uicontext.h b/ui/uicontext.h
index 99abb84e..df4ff0a2 100644
--- a/ui/uicontext.h
+++ b/ui/uicontext.h
@@ -7,6 +7,7 @@
#include "binaryninjaapi.h"
#include "action.h"
#include "preview.h"
+#include "uitypes.h"
#define PREVIEW_HOVER_TIME 500
@@ -79,6 +80,41 @@ class BINARYNINJAUIAPI UIContextNotification
return true;
}
/*!
+ Callback after a project is opened
+ \param context Context which opened the project
+ \param project Project that was opened
+ \param frame ViewFrame constructed to display the project
+ */
+ virtual void OnAfterOpenProject(UIContext* context, ProjectRef project)
+ {
+ (void)context;
+ (void)project;
+ }
+ /*!
+ Callback before a project file is opened
+ \param context Context opening the project file
+ \param projectFile Project file that is being opened
+ \return True if the project file should be opened
+ */
+ virtual bool OnBeforeOpenProjectFile(UIContext* context, ProjectFileRef projectFile)
+ {
+ (void)context;
+ (void)projectFile;
+ return true;
+ }
+ /*!
+ Callback after a project file is opened
+ \param context Context which opened the project file
+ \param projectFile Project file that was opened
+ \param frame ViewFrame constructed to display the project file
+ */
+ virtual void OnAfterOpenProjectFile(UIContext* context, ProjectFileRef projectFile, ViewFrame* frame)
+ {
+ (void)context;
+ (void)projectFile;
+ (void)frame;
+ }
+ /*!
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
@@ -264,6 +300,9 @@ class BINARYNINJAUIAPI UIContext
bool NotifyOnBeforeOpenDatabase(FileMetadataRef metadata);
bool NotifyOnAfterOpenDatabase(FileMetadataRef metadata, BinaryViewRef data);
+ void NotifyOnAfterOpenProject(ProjectRef project);
+ bool NotifyOnBeforeOpenProjectFile(ProjectFileRef projectFile);
+ void NotifyOnAfterOpenProjectFile(ProjectFileRef projectFile, ViewFrame* frame);
bool NotifyOnBeforeOpenFile(FileContext* file);
void NotifyOnAfterOpenFile(FileContext* file, ViewFrame* frame);
bool NotifyOnBeforeSaveFile(FileContext* file, ViewFrame* frame);
@@ -326,8 +365,9 @@ public:
Open a tab containing the given widget with the given name
\param name Name for tab
\param widget Widget to display in the tab (optionally a ViewFrame)
+ \return Index of created tab
*/
- virtual void createTabForWidget(const QString& name, QWidget* widget) = 0;
+ virtual int createTabForWidget(const QString& name, QWidget* widget) = 0;
/*!
* Open a new window with the same file context and Navigate to a given location
@@ -409,8 +449,12 @@ public:
*/
virtual std::vector<ViewFrame*> getAllViewFramesForTab(QWidget* tab) const = 0;
+ virtual ProjectRef getProject();
+
virtual bool openFilename(const QString& path, bool openOptions = false);
+ virtual ProjectRef openProject(const QString& path);
virtual ViewFrame* openFileContext(FileContext* file, const QString& forcedView = "", bool addTab = true);
+ virtual bool openProjectFile(ProjectFileRef file, ExternalLocationRef loc = nullptr, bool openWithOptions = false);
virtual void recreateViewFrames(FileContext* file) = 0;
UIActionHandler* globalActions() { return &m_globalActions; }
diff --git a/ui/uitypes.h b/ui/uitypes.h
index 083c4ac5..49ef0480 100644
--- a/ui/uitypes.h
+++ b/ui/uitypes.h
@@ -75,6 +75,8 @@ typedef BinaryNinja::Ref<BinaryNinja::DisassemblySettings> DisassemblySettingsRe
typedef BinaryNinja::Ref<BinaryNinja::DownloadInstance> DownloadInstanceRef;
typedef BinaryNinja::Ref<BinaryNinja::DownloadProvider> DownloadProviderRef;
typedef BinaryNinja::Ref<BinaryNinja::Enumeration> EnumerationRef;
+typedef BinaryNinja::Ref<BinaryNinja::ExternalLibrary> ExternalLibraryRef;
+typedef BinaryNinja::Ref<BinaryNinja::ExternalLocation> ExternalLocationRef;
typedef BinaryNinja::Ref<BinaryNinja::FileMetadata> FileMetadataRef;
typedef BinaryNinja::Ref<BinaryNinja::FlowGraph> FlowGraphRef;
typedef BinaryNinja::Ref<BinaryNinja::FlowGraphLayoutRequest> FlowGraphLayoutRequestRef;
@@ -86,6 +88,9 @@ typedef BinaryNinja::Ref<BinaryNinja::MainThreadAction> MainThreadActionRef;
typedef BinaryNinja::Ref<BinaryNinja::MediumLevelILFunction> MediumLevelILFunctionRef;
typedef BinaryNinja::Ref<BinaryNinja::HighLevelILFunction> HighLevelILFunctionRef;
typedef BinaryNinja::Ref<BinaryNinja::Platform> PlatformRef;
+typedef BinaryNinja::Ref<BinaryNinja::Project> ProjectRef;
+typedef BinaryNinja::Ref<BinaryNinja::ProjectFile> ProjectFileRef;
+typedef BinaryNinja::Ref<BinaryNinja::ProjectFolder> ProjectFolderRef;
typedef BinaryNinja::Ref<BinaryNinja::ReportCollection> ReportCollectionRef;
typedef BinaryNinja::Ref<BinaryNinja::SaveSettings> SaveSettingsRef;
typedef BinaryNinja::Ref<BinaryNinja::ScriptingInstance> ScriptingInstanceRef;
diff --git a/ui/util.h b/ui/util.h
index a49fc007..a733acea 100644
--- a/ui/util.h
+++ b/ui/util.h
@@ -29,7 +29,7 @@ bool BINARYNINJAUIAPI showDisassemblyPreview(QWidget* parent, ViewFrame* frame,
const ViewLocation& location);
void BINARYNINJAUIAPI showTextTooltip(QWidget* parent, const QPoint& previewPos, const QString& text);
-bool BINARYNINJAUIAPI isBinaryNinjaDataBase(QFileInfo& info, QFileAccessor& accessor);
+bool BINARYNINJAUIAPI isBinaryNinjaDatabase(QFileInfo& info, QFileAccessor& accessor);
PlatformRef BINARYNINJAUIAPI getOrAskForPlatform(QWidget* parent, BinaryViewRef data);
PlatformRef BINARYNINJAUIAPI getOrAskForPlatform(QWidget* parent, PlatformRef defaultValue);