mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Make af from DisassemblyContextMenu more meaningful
This commit is contained in:
parent
08e55827b7
commit
f92fb71b0e
@ -31,3 +31,8 @@ QString RenameDialog::getName() const
|
||||
{
|
||||
return ui->nameEdit->text();
|
||||
}
|
||||
|
||||
void RenameDialog::setPlaceholderText(const QString &text)
|
||||
{
|
||||
ui->nameEdit->setPlaceholderText(text);
|
||||
}
|
@ -19,6 +19,8 @@ public:
|
||||
void setName(QString fcnName);
|
||||
QString getName() const;
|
||||
|
||||
void setPlaceholderText(const QString &text);
|
||||
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
|
||||
|
@ -33,10 +33,6 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
|
||||
SLOT(on_actionAddFlag_triggered()), getAddFlagSequence());
|
||||
addAction(&actionAddFlag);
|
||||
|
||||
initAction(&actionCreateFunction, tr("Create Function"),
|
||||
SLOT(on_actionCreateFunction_triggered()));
|
||||
addAction(&actionCreateFunction);
|
||||
|
||||
initAction(&actionRename, tr("Rename"),
|
||||
SLOT(on_actionRename_triggered()), getRenameSequence());
|
||||
addAction(&actionRename);
|
||||
@ -54,6 +50,8 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
|
||||
initAction(&actionDeleteFunction, tr("Undefine function"), SLOT(on_actionDeleteFunction_triggered()));
|
||||
addAction(&actionDeleteFunction);
|
||||
|
||||
addAnalyzeMenu();
|
||||
|
||||
addSetBaseMenu();
|
||||
|
||||
addSetBitsMenu();
|
||||
@ -92,6 +90,16 @@ DisassemblyContextMenu::~DisassemblyContextMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void DisassemblyContextMenu::addAnalyzeMenu()
|
||||
{
|
||||
analyzeMenu = addMenu(tr("Analyze..."));
|
||||
|
||||
initAction(&actionAnalyzeFunction, tr("Create Function"));
|
||||
analyzeMenu->addAction(&actionAnalyzeFunction);
|
||||
connect(&actionAnalyzeFunction, &QAction::triggered, this,
|
||||
&DisassemblyContextMenu::on_actionAnalyzeFunction_triggered);
|
||||
}
|
||||
|
||||
void DisassemblyContextMenu::addSetBaseMenu()
|
||||
{
|
||||
setBaseMenu = addMenu(tr("Set Immediate Base to..."));
|
||||
@ -228,7 +236,7 @@ void DisassemblyContextMenu::aboutToShowSlot()
|
||||
setBaseMenu->menuAction()->setVisible(immBase);
|
||||
setBitsMenu->menuAction()->setVisible(true);
|
||||
|
||||
actionCreateFunction.setVisible(true);
|
||||
actionAnalyzeFunction.setVisible(true);
|
||||
|
||||
QString comment = Core()->cmd("CC." + RAddressString(offset));
|
||||
if (comment.isNull() || comment.isEmpty()) {
|
||||
@ -251,7 +259,7 @@ void DisassemblyContextMenu::aboutToShowSlot()
|
||||
actionDeleteFunction.setVisible(fcn ? true : false);
|
||||
|
||||
if (fcn) {
|
||||
actionCreateFunction.setVisible(false);
|
||||
actionAnalyzeFunction.setVisible(false);
|
||||
actionRename.setVisible(true);
|
||||
actionRename.setText(tr("Rename function \"%1\"").arg(fcn->name));
|
||||
} else if (f) {
|
||||
@ -457,10 +465,11 @@ void DisassemblyContextMenu::on_actionAddComment_triggered()
|
||||
}
|
||||
}
|
||||
|
||||
void DisassemblyContextMenu::on_actionCreateFunction_triggered()
|
||||
void DisassemblyContextMenu::on_actionAnalyzeFunction_triggered()
|
||||
{
|
||||
RenameDialog *dialog = new RenameDialog(this);
|
||||
dialog->setWindowTitle(tr("Add function at %1").arg(RAddressString(offset)));
|
||||
dialog->setWindowTitle(tr("Analyze function at %1").arg(RAddressString(offset)));
|
||||
dialog->setPlaceholderText(tr("Auto"));
|
||||
if (dialog->exec()) {
|
||||
QString function_name = dialog->getName();
|
||||
Core()->createFunctionAt(offset, function_name);
|
||||
|
@ -32,7 +32,7 @@ private slots:
|
||||
void on_actionCopy_triggered();
|
||||
void on_actionCopyAddr_triggered();
|
||||
void on_actionAddComment_triggered();
|
||||
void on_actionCreateFunction_triggered();
|
||||
void on_actionAnalyzeFunction_triggered();
|
||||
void on_actionAddFlag_triggered();
|
||||
void on_actionRename_triggered();
|
||||
void on_actionRenameUsedHere_triggered();
|
||||
@ -82,7 +82,8 @@ private:
|
||||
|
||||
QAction actionAddComment;
|
||||
QAction actionAddFlag;
|
||||
QAction actionCreateFunction;
|
||||
QMenu *analyzeMenu;
|
||||
QAction actionAnalyzeFunction;
|
||||
QAction actionRename;
|
||||
QAction actionRenameUsedHere;
|
||||
QAction actionXRefs;
|
||||
@ -132,6 +133,7 @@ private:
|
||||
void setToData(int size, int repeat = 1);
|
||||
void setBits(int bits);
|
||||
|
||||
void addAnalyzeMenu();
|
||||
void addSetBaseMenu();
|
||||
void addSetBitsMenu();
|
||||
void addSetToDataMenu();
|
||||
|
Loading…
Reference in New Issue
Block a user