summaryrefslogtreecommitdiff
path: root/plugins/warp/ui/shared/misc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/warp/ui/shared/misc.cpp')
-rw-r--r--plugins/warp/ui/shared/misc.cpp42
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;
+}