From 40f7d40e394657575001a8146d8233f1fc4356fd Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sun, 12 Oct 2025 22:46:54 -0400 Subject: [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 --- plugins/warp/ui/shared/misc.cpp | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'plugins/warp/ui/shared/misc.cpp') 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 #include #include @@ -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; +} -- cgit v1.3.1