From 4b6fb132a97a7852e69a746e2e259bf423b14969 Mon Sep 17 00:00:00 2001 From: kat Date: Thu, 16 Mar 2023 14:26:49 -0400 Subject: Add interaction.get_large_choice_input for large numbers of options --- ui/metadatachoicedialog.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'ui') diff --git a/ui/metadatachoicedialog.h b/ui/metadatachoicedialog.h index ed25f3e1..b34dccdc 100644 --- a/ui/metadatachoicedialog.h +++ b/ui/metadatachoicedialog.h @@ -43,7 +43,7 @@ public: }; // Model that is blind and queries info from its delegate. -class ManagedTableModel : public QAbstractTableModel +class BINARYNINJAUIAPI ManagedTableModel : public QAbstractTableModel { ManagedTableDelegate* m_delegate; @@ -228,8 +228,6 @@ class BINARYNINJAUIAPI MetadataChoiceDialog : public QDialog, public ManagedTabl protected: std::vector m_entries; - - QHBoxLayout* m_midRowLayout; // ManagedTableDelegate @@ -297,11 +295,12 @@ protected: QPushButton* m_choose; bool ExtraFilterEnabled() { return m_extraFilter.exists && m_extraFilter.enabled; }; - +public: void AddWidthRequiredByItem(void* item, size_t widthRequired); void RemoveWidthRequiredByItem(QWidget* item); void AddHeightRequiredByItem(void* item, size_t widthRequired); void RemoveHeightRequiredByItem(QWidget* item); +protected: void UpdateMinimumSpace(); std::optional m_chosenEntry; @@ -328,10 +327,11 @@ public: \param parent Parent Widget \param title Title of the dialog + \param prompt Text of the button to select a choice \param entries List of entries \param metadata Map of indices to the metadata for those entries. */ - MetadataChoiceDialog(QWidget* parent, const QString& title, const QStringList& entries, + MetadataChoiceDialog(QWidget* parent, const QString& title, const QString& prompt, const QStringList& entries, std::unordered_map metadata); /*! Create a choice selection dialog with a Title, list of entries, and pre-built set of metadata for those entries. @@ -343,10 +343,11 @@ public: \param parent Parent Widget \param title Title of the dialog + \param prompt Text of the button to select a choice \param entries List of entries \param metadata Map of indices to the metadata (as InstructionTextTokens) for those entries. */ - MetadataChoiceDialog(QWidget* parent, const QString& title, const QStringList& entries, + MetadataChoiceDialog(QWidget* parent, const QString& title, const QString& prompt, const QStringList& entries, std::unordered_map> metadata); /*! Create a choice selection dialog with a Title and list of entries. @@ -355,12 +356,13 @@ public: \param parent Parent Widget \param title Title of the dialog + \param prompt Text of the button to select a choice \param entries List of entries */ - MetadataChoiceDialog(QWidget* parent, const QString& title, const QStringList& entries); + MetadataChoiceDialog(QWidget* parent, const QString& title, const QString& prompt, const QStringList& entries); - MetadataChoiceDialog(QWidget* parent, const QString& title) : - MetadataChoiceDialog(parent, title, {}) {} + MetadataChoiceDialog(QWidget* parent, const QString& title, const QString& prompt = "Select") : + MetadataChoiceDialog(parent, title, prompt, {}) {} /*! Set the callback the dialog will execute to retrieve metadata for a given item. -- cgit v1.3.1