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