summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2025-06-17 21:35:08 -0400
committerRusty Wagner <rusty.wagner@gmail.com>2025-06-23 15:19:52 -0400
commitf59acf14a8a8630a5b9a0e0cb422a1192f247f5d (patch)
tree7018ad230557f9e1fcb68cbbd4e6fdefb9b3005a
parentdf2691ad3443fdf9767869be73c1014f49383239 (diff)
Allow sidebar icons to be hidden
-rw-r--r--docs/guide/index.md13
-rw-r--r--docs/img/more.pngbin0 -> 63115 bytes
-rw-r--r--ui/globalarea.h3
-rw-r--r--ui/sidebar.h10
-rw-r--r--ui/sidebarcontainer.h16
-rw-r--r--ui/sidebaricons.h2
-rw-r--r--ui/sidebarwidget.h64
-rw-r--r--ui/workflowmonitor.h1
8 files changed, 103 insertions, 6 deletions
diff --git a/docs/guide/index.md b/docs/guide/index.md
index a0657c98..b4287074 100644
--- a/docs/guide/index.md
+++ b/docs/guide/index.md
@@ -240,7 +240,7 @@ Once you have a file open, the sidebar lets you quickly access the most common f
- 5-6: Primarily for horizontal content, the bottom-most panel icon regions behave much like sections 1-2 except they are applied to two regions in the bottom of the window. Clicking a different icon in this region will switch to that panel, or hide that panel entirely if it is already selected.
???+ Info "Tip"
- Note that you can also right-click on sidebar icons and choose from `Docked`, `Floating`, and `Window` options to expose even more possible layout options.
+ Note that you can also right-click on sidebar icons and choose from `Docked`, `Floating`, and `Window` options to expose even more possible layout options. From the right-click menu, you can also control if and when a sidebar icon is hidden.
Here's a more detailed look into each of those panels:
@@ -456,6 +456,17 @@ The search types are available from a drop-down next to the text input field and
The log window lets you search and filter through logs. You can search by text or filter by loggers to identify messages of interest. By default, only the logs for a specific BinaryView that's open as well as any Global logs will show up but this setting can either be changed through the right-click menu or the drop down menu in the upper-right of the log window.
+### Hidden Sidebar Icons
+
+Some sidebar icons are hidden when they are not relevant, and some containing information for plugin debugging are
+hidden by default. You can also choose to hide any sidebar icon by right-clicking on it.
+
+If a sidebar icon is hidden and you want to open it or change the visibility of the icon, you can click the `More...`
+icon in the sidebar (the icon with three dots) and choose the sidebar you want to open from the popup menu. Once it is
+open, right-clicking on the icon and choosing `Show` from the menu will make the icon stay visible at all times.
+
+![More](../img/more.png "More"){ width="300" }
+
## Tiling Panes
![tiling panes ](../img/tiling-panes.png "Tiling Panes"){ width="1000" }
diff --git a/docs/img/more.png b/docs/img/more.png
new file mode 100644
index 00000000..507d1e3c
--- /dev/null
+++ b/docs/img/more.png
Binary files differ
diff --git a/ui/globalarea.h b/ui/globalarea.h
index f040b802..5ef9d541 100644
--- a/ui/globalarea.h
+++ b/ui/globalarea.h
@@ -215,5 +215,6 @@ public:
SidebarWidgetLocation defaultLocation() const override { return SidebarWidgetLocation::LeftBottom; }
SidebarContextSensitivity contextSensitivity() const override { return GlobalSidebarContext; }
bool alwaysShowTabs() const override { return true; }
- bool hideIfNoContent() const override { return true; }
+ SidebarIconVisibility defaultIconVisibility() const override { return InvisibleIfNoContent; }
+ SidebarContentClassifier* contentClassifier(ViewFrame*, BinaryViewRef) override;
};
diff --git a/ui/sidebar.h b/ui/sidebar.h
index f4cc81f9..df749fe4 100644
--- a/ui/sidebar.h
+++ b/ui/sidebar.h
@@ -60,6 +60,7 @@ class BINARYNINJAUIAPI Sidebar : public QObject
static std::set<Sidebar*> m_instances;
static std::set<SidebarWidgetType*> m_defaultTypes;
static std::optional<SidebarMetrics> m_metrics;
+ static std::map<QString, SidebarIconVisibility> m_iconVisibility;
private Q_SLOTS:
void containerUpdated();
@@ -122,6 +123,8 @@ public:
bool isContentActive() const;
bool isSideContentActive() const;
bool isBottomContentActive() const;
+ bool allIconsVisible() const;
+ std::vector<SidebarWidgetType*> hiddenIcons() const;
void updateTheme();
void updateFonts();
@@ -146,6 +149,8 @@ public:
static std::vector<SidebarWidgetType*> typesForContainerLocation(SidebarContainerLocation location);
static void initSavedTypeOrdering();
static void saveTypeOrdering();
+ static void initIconVisibility();
+ static void saveIconVisibility();
static SidebarMetrics metrics();
static void refreshMetrics();
@@ -153,6 +158,11 @@ public:
static std::set<SidebarWidgetType*> defaultTypes() { return m_defaultTypes; }
static void setDefaultTypes(const std::set<SidebarWidgetType*>& types) { m_defaultTypes = types; }
+ static SidebarIconVisibility iconVisibility(SidebarWidgetType* type);
+ static SidebarIconVisibility iconVisibility(const QString& name);
+ static void setIconVisibility(SidebarWidgetType* type, SidebarIconVisibility visibility);
+ static void setIconVisibility(const QString& name, SidebarIconVisibility visibility);
+
static Sidebar* current()
{
UIContext* context = UIContext::activeContext();
diff --git a/ui/sidebarcontainer.h b/ui/sidebarcontainer.h
index 3ab30c83..acd27761 100644
--- a/ui/sidebarcontainer.h
+++ b/ui/sidebarcontainer.h
@@ -4,10 +4,9 @@
#include <QtWidgets/QStackedWidget>
#include <QtWidgets/QWidget>
#include "splitter.h"
+#include "sidebarwidget.h"
class Sidebar;
-class SidebarWidgetType;
-class SidebarWidgetAndHeader;
class SplitPaneWidget;
/*!
@@ -88,17 +87,22 @@ class BINARYNINJAUIAPI SidebarWidgetContainer : public QWidget
std::map<SplitPaneWidget*,
std::map<ViewFrame*, std::map<QString, std::map<SidebarWidgetType*, SidebarWidgetAndHeader*>>>>
m_widgets;
+ std::map<SplitPaneWidget*,
+ std::map<ViewFrame*, std::map<QString, std::map<SidebarWidgetType*, SidebarContentClassifier*>>>>
+ m_contentClassifiers;
std::map<SplitPaneWidget*, std::map<QString, std::set<SidebarWidgetType*>>> m_priorWidgets;
std::map<SidebarWidgetType*, SidebarFloatingWidgetState> m_savedFloatingWidgetState;
SidebarStackedWidget& stackedWidgetForType(SidebarWidgetType* type);
std::vector<SidebarWidgetAndHeader*> widgetsForContext() const;
+ std::vector<SidebarContentClassifier*> contentClassifiersForContext() const;
void insertWidgetIntoContainer(SidebarWidgetType* type, QStackedWidget* widget);
void updateContentsVisibility();
private Q_SLOTS:
void floatingWidgetClosed(SidebarWidgetType* type);
+ void childContentClassificationChanged();
public:
SidebarWidgetContainer(Sidebar* sidebar, SidebarContainerLocation location);
@@ -134,8 +138,11 @@ public:
SidebarWidget* widgetWithTitle(SidebarWidgetType* type, const QString& title) const;
bool hasWidgetWithTitle(SidebarWidgetType* type, const QString& title) const;
bool activateWidgetWithTitle(SidebarWidgetType* type, const QString& title) const;
- bool hasContent(SidebarWidgetType* type) const;
- bool shouldHide(SidebarWidgetType* type) const;
+ SidebarContentClassification contentClassification(SidebarWidgetType* type);
+ bool hasContent(SidebarWidgetType* type);
+ bool shouldHide(SidebarWidgetType* type);
+
+ SidebarContentClassifier* contentClassifier(SidebarWidgetType* type);
virtual QSize sizeHint() const override;
@@ -162,4 +169,5 @@ public:
Q_SIGNALS:
void showContents();
void hideContents();
+ void contentClassificationChanged();
};
diff --git a/ui/sidebaricons.h b/ui/sidebaricons.h
index b68ace9e..7ba57f77 100644
--- a/ui/sidebaricons.h
+++ b/ui/sidebaricons.h
@@ -78,9 +78,11 @@ class BINARYNINJAUIAPI SidebarIconsWidget : public QWidget
std::pair<SidebarWidgetLocation, size_t> findDropLocation(int y) const;
QRect placeholderRect() const;
bool shouldBeVisible() const;
+ bool shouldContainMoreIcon() const;
private Q_SLOTS:
void containerUpdated();
+ void contentClassificationChanged();
protected:
virtual void paintEvent(QPaintEvent* event) override;
diff --git a/ui/sidebarwidget.h b/ui/sidebarwidget.h
index 8308991e..44b6ea8c 100644
--- a/ui/sidebarwidget.h
+++ b/ui/sidebarwidget.h
@@ -188,6 +188,51 @@ enum SidebarContextSensitivity
/*!
\ingroup sidebar
*/
+enum SidebarIconVisibility
+{
+ AlwaysShowSidebarIcon,
+ HideSidebarIconIfNoContent,
+ AlwaysHideSidebarIcon,
+ InvisibleIfNoContent
+};
+
+/*!
+ \ingroup sidebar
+*/
+enum SidebarContentClassification
+{
+ SidebarHasRelevantContent,
+ SidebarHasGeneralMessage,
+ SidebarHasNoContent,
+ SidebarIsWidgetContainer
+};
+
+class BINARYNINJAUIAPI SidebarContentClassifier : public QObject
+{
+ Q_OBJECT
+
+public:
+ virtual SidebarContentClassification contentClassification() = 0;
+ virtual void notifyViewChanged(ViewFrame*) {}
+
+Q_SIGNALS:
+ void contentClassificationChanged();
+};
+
+class BINARYNINJAUIAPI StaticSidebarContentClassifier : public SidebarContentClassifier
+{
+ Q_OBJECT
+
+ SidebarContentClassification m_classification;
+
+public:
+ StaticSidebarContentClassifier(SidebarContentClassification classification) : m_classification(classification) {}
+ SidebarContentClassification contentClassification() override { return m_classification; }
+};
+
+/*!
+ \ingroup sidebar
+*/
class BINARYNINJAUIAPI SidebarWidgetType
{
SidebarIcon m_icon;
@@ -213,8 +258,14 @@ public:
virtual SidebarWidgetLocation defaultLocation() const;
virtual SidebarContextSensitivity contextSensitivity() const;
virtual bool alwaysShowTabs() const { return false; }
+
+ /*!
+ \deprecated Use `defaultIconVisibility()`
+ */
virtual bool hideIfNoContent() const { return false; }
+ virtual SidebarIconVisibility defaultIconVisibility() const;
+
virtual SidebarWidget* createWidget(ViewFrame* /*frame*/, BinaryViewRef /*data*/) { return nullptr; }
virtual SidebarWidget* createInvalidContextWidget();
virtual QWidget* headerWidget(SplitPaneWidget* /*panes*/, ViewFrame* /*frame*/, BinaryViewRef /*data*/)
@@ -228,5 +279,18 @@ public:
virtual bool canUseAsPane(SplitPaneWidget* /*panes*/, BinaryViewRef /*data*/) const { return false; }
virtual Pane* createPane(SplitPaneWidget* /*panes*/, BinaryViewRef /*data*/) { return nullptr; }
+ virtual SidebarContentClassifier* contentClassifier(ViewFrame* /*frame*/, BinaryViewRef /*data*/)
+ {
+ return nullptr;
+ }
+
void updateTheme();
};
+
+class BINARYNINJAUIAPI MoreSidebarWidgetType : public SidebarWidgetType
+{
+public:
+ MoreSidebarWidgetType();
+
+ static MoreSidebarWidgetType* instance();
+};
diff --git a/ui/workflowmonitor.h b/ui/workflowmonitor.h
index 1a5a81f1..94fe7062 100644
--- a/ui/workflowmonitor.h
+++ b/ui/workflowmonitor.h
@@ -102,6 +102,7 @@ public:
SidebarWidgetLocation defaultLocation() const override { return SidebarWidgetLocation::LeftReference; }
SidebarContextSensitivity contextSensitivity() const override { return PerViewTypeSidebarContext; }
+ SidebarIconVisibility defaultIconVisibility() const override { return AlwaysHideSidebarIcon; }
SidebarWidget* createWidget(ViewFrame* frame, BinaryViewRef data) override;