Show realname on disassembly context menu (#2049)

* Show realname on disassembly context menu
This commit is contained in:
Itay Cohen 2020-02-15 19:31:11 +02:00 committed by GitHub
parent 9b7e3a3a30
commit dd7e01be3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,7 +329,15 @@ QVector<DisassemblyContextMenu::ThingUsedHere> DisassemblyContextMenu::getThingU
for (const auto &thing : array) {
auto obj = thing.toObject();
RVA offset = obj["offset"].toVariant().toULongLong();
QString name = obj["name"].toString();
QString name;
// If real names display is enabled, show flag's real name instead of full flag name
if (Config()->getConfigBool("asm.flags.real") && obj.contains("realname")) {
name = obj["realname"].toString();
} else {
name = obj["name"].toString();
}
QString typeString = obj["type"].toString();
ThingUsedHere::Type type = ThingUsedHere::Type::Address;
if (typeString == "var") {
@ -477,8 +485,17 @@ void DisassemblyContextMenu::aboutToShowSlot()
actionRename.setVisible(true);
actionRename.setText(tr("Rename function \"%1\"").arg(fcn->name));
} else if (f) {
QString name;
// Check if Realname is enabled. If yes, show it instead of the full flag-name.
if (Config()->getConfigBool("asm.flags.real") && f->realname) {
name = f->realname;
} else {
name = f->name;
}
actionRename.setVisible(true);
actionRename.setText(tr("Rename flag \"%1\"").arg(f->name));
actionRename.setText(tr("Rename flag \"%1\"").arg(name));
} else {
actionRename.setVisible(false);
}