Combine Set-As menu items (#1601)

This commit is contained in:
Itay Cohen 2019-06-12 10:08:15 +03:00 committed by GitHub
parent d59ea03f87
commit a3657f913b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 11 deletions

View File

@ -64,7 +64,7 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
SLOT(on_actionDeleteFunction_triggered())); SLOT(on_actionDeleteFunction_triggered()));
addAction(&actionDeleteFunction); addAction(&actionDeleteFunction);
initAction(&actionAnalyzeFunction, tr("Define function here..."), initAction(&actionAnalyzeFunction, tr("Define function here"),
SLOT(on_actionAnalyzeFunction_triggered())); SLOT(on_actionAnalyzeFunction_triggered()));
addAction(&actionAnalyzeFunction); addAction(&actionAnalyzeFunction);
@ -82,15 +82,7 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
SLOT(on_actionLinkType_triggered()), getLinkTypeSequence()); SLOT(on_actionLinkType_triggered()), getLinkTypeSequence());
addAction(&actionLinkType); addAction(&actionLinkType);
initAction(&actionSetToCode, tr("Set as Code"), addSetAsMenu();
SLOT(on_actionSetToCode_triggered()), getSetToCodeSequence());
addAction(&actionSetToCode);
initAction(&actionSetAsString, tr("Set as String"),
SLOT(on_actionSetAsString_triggered()), getSetAsStringSequence());
addAction(&actionSetAsString);
addSetToDataMenu();
addSeparator(); addSeparator();
@ -174,9 +166,25 @@ void DisassemblyContextMenu::addSetBitsMenu()
connect(&actionSetBits64, &QAction::triggered, this, [this] { setBits(64); }); connect(&actionSetBits64, &QAction::triggered, this, [this] { setBits(64); });
} }
void DisassemblyContextMenu::addSetAsMenu()
{
setAsMenu = addMenu(tr("Set as..."));
initAction(&actionSetToCode, tr("Code"),
SLOT(on_actionSetToCode_triggered()), getSetToCodeSequence());
setAsMenu->addAction(&actionSetToCode);
initAction(&actionSetAsString, tr("String"),
SLOT(on_actionSetAsString_triggered()), getSetAsStringSequence());
setAsMenu->addAction(&actionSetAsString);
addSetToDataMenu();
}
void DisassemblyContextMenu::addSetToDataMenu() void DisassemblyContextMenu::addSetToDataMenu()
{ {
setToDataMenu = addMenu(tr("Set to Data...")); setToDataMenu = setAsMenu->addMenu(tr("Data..."));
initAction(&actionSetToDataByte, tr("Byte")); initAction(&actionSetToDataByte, tr("Byte"));
setToDataMenu->addAction(&actionSetToDataByte); setToDataMenu->addAction(&actionSetToDataByte);

View File

@ -157,6 +157,7 @@ private:
QAction actionSetAsString; QAction actionSetAsString;
QMenu *setToDataMenu; QMenu *setToDataMenu;
QMenu *setAsMenu;
QAction actionSetToDataEx; QAction actionSetToDataEx;
QAction actionSetToDataByte; QAction actionSetToDataByte;
QAction actionSetToDataWord; QAction actionSetToDataWord;
@ -176,6 +177,7 @@ private:
void addSetBaseMenu(); void addSetBaseMenu();
void addSetBitsMenu(); void addSetBitsMenu();
void addSetAsMenu();
void addSetToDataMenu(); void addSetToDataMenu();
void addEditMenu(); void addEditMenu();
void addDebugMenu(); void addDebugMenu();