summaryrefslogtreecommitdiff
path: root/ui/settingsview.h
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2023-09-27 12:57:29 -0400
committerBrian Potchik <brian@vector35.com>2023-09-27 12:57:29 -0400
commitab7b675788f4d3a529670b3b84ae7d45548543b6 (patch)
tree56d03f4a248d184a3d12b21cdab537e2563edb21 /ui/settingsview.h
parentddb717455a7543e944ae5eeb6808bc477eb4b689 (diff)
Optimize settings UI to minimize loading time.
Diffstat (limited to 'ui/settingsview.h')
-rw-r--r--ui/settingsview.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/ui/settingsview.h b/ui/settingsview.h
index 3570cdcd..2b59332f 100644
--- a/ui/settingsview.h
+++ b/ui/settingsview.h
@@ -168,16 +168,17 @@ class BINARYNINJAUIAPI SettingsEditor : public QWidget
bool m_requiresRestart = false;
bool m_settingModified = false;
+ int m_minHeight;
+ int m_maxAdjustedWidth;
+
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:
- void geometryChanged();
void settingChanged();
void allSettingsChanged();
void showIdentifiers(bool enable);
@@ -211,6 +212,7 @@ class BINARYNINJAUIAPI SettingsEditor : public QWidget
public Q_SLOTS:
void updateScope(BinaryViewRef, BNSettingsScope);
void updateSize();
+ void notifyGeometryChanged();
void updateViewMode(bool enabled);
private:
@@ -247,14 +249,15 @@ class BINARYNINJAUIAPI SettingsDelegate : public QStyledItemDelegate
QTreeView* m_treeView;
std::function<void(const QModelIndex& index)> m_hoverAction = nullptr;
- std::function<void()> m_defaultSelectionAction = nullptr;
+ std::function<void(const QString&)> m_defaultSelectionAction = nullptr;
+ QString m_defaultGroupSelection;
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);
+ void setDefaultSelection(const QString& group, const std::function<void(const QString&)>& selectionAction);
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
@@ -265,9 +268,6 @@ class BINARYNINJAUIAPI SettingsDelegate : public QStyledItemDelegate
void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const override;
void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
- protected:
- bool eventFilter(QObject* object, QEvent* event) override;
-
public:
Q_SIGNALS:
void refreshAllSettings() const;
@@ -279,15 +279,15 @@ class BINARYNINJAUIAPI SettingsDelegate : public QStyledItemDelegate
void performHoverAction(QModelIndex index) const;
public Q_SLOTS:
+ void notifyUpdateModel();
void updateFonts();
void updateModel();
void updateScope(BinaryViewRef, BNSettingsScope);
- void updateSize();
+ void notifyResizeEvent();
void updateViewMode(bool enabled) const;
private Q_SLOTS:
void commitEditorData();
- void editorGeometryChanged();
};
@@ -422,6 +422,7 @@ class BINARYNINJAUIAPI SettingsView : public QWidget
QCheckBox* m_viewMode = nullptr;
SearchFilter* m_search = nullptr;
bool m_outlineNavEnabled = true;
+ int m_nextGroupIdx = 0;
public:
SettingsView(QWidget* parent);
@@ -430,6 +431,7 @@ class BINARYNINJAUIAPI SettingsView : public QWidget
SettingsRef getSettings() { return m_settings; }
+ void openPersistentEditors(int numToOpen = 0, bool update = true);
void init(std::string schema, bool uiScopeSelection);
void refreshAllSettings();
void refreshCurrentScope();