diff options
| author | Mason Reed <mason@vector35.com> | 2025-10-12 22:46:54 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-10-12 22:50:20 -0400 |
| commit | 40f7d40e394657575001a8146d8233f1fc4356fd (patch) | |
| tree | a1dfac7f90bbd284119d0a3e10e205fe2e0303c1 /plugins/warp/ui/shared/misc.cpp | |
| parent | 49558b88ed5dacaac0bdf1946291bc37a4a88cb9 (diff) | |
[WARP] Improve UX surrounding removal of matched functions
- Adds Python API to remove matched function
- Adds command + UI actions to remove matched function
- Adds command + UI actions to ignore function in subsequent matches
Diffstat (limited to 'plugins/warp/ui/shared/misc.cpp')
| -rw-r--r-- | plugins/warp/ui/shared/misc.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/plugins/warp/ui/shared/misc.cpp b/plugins/warp/ui/shared/misc.cpp index f84237c9..6de314b1 100644 --- a/plugins/warp/ui/shared/misc.cpp +++ b/plugins/warp/ui/shared/misc.cpp @@ -1,5 +1,6 @@ #include "misc.h" +#include <QDialogButtonBox> #include <QGridLayout> #include <QHeaderView> @@ -140,3 +141,44 @@ ParsedQuery::ParsedQuery(const QString& rawQuery) // Normalize whitespace query = query.simplified(); } + +WarpRemoveMatchDialog::WarpRemoveMatchDialog(QWidget *parent, FunctionRef func) : QDialog(parent), m_func(func) +{ + setWindowTitle("Remove Matching Function"); + setModal(true); + + auto* vbox = new QVBoxLayout(this); + auto* text = new QLabel("Remove the match for this function? You can also mark it as ignored to prevent future automatic matches."); + text->setWordWrap(true); + vbox->addWidget(text); + + m_ignoreCheck = new QCheckBox("Tag function as ignored"); + m_ignoreCheck->setChecked(true); + vbox->addWidget(m_ignoreCheck); + + auto* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); + connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); + vbox->addWidget(buttons); +} + +bool WarpRemoveMatchDialog::execute() +{ + if (!m_func) + return false; + if (exec() != QDialog::Accepted) + return false; + Warp::Function::RemoveMatch(*m_func); + if (m_ignoreCheck->isChecked()) + { + // TODO: For now we just assume the tag type to exist (the matcher activity will create it) + const TagTypeRef tagType = m_func->GetView()->GetTagTypeByName("WARP: Ignored Function"); + if (!tagType) + return false; + const TagRef tag = new BinaryNinja::Tag(tagType, ""); + if (tagType) + m_func->AddUserFunctionTag(tag); + } + m_func->Reanalyze(); + return true; +} |
