Fixed edit flag option

This commit is contained in:
Rohan-Sagar 2024-02-15 19:06:27 -05:00
parent 95e6928d46
commit 0ff545da63
2 changed files with 81 additions and 3 deletions

78
.vscode/settings.json vendored
View File

@ -1,3 +1,79 @@
{ {
"cmake.sourceDirectory": "${workspaceFolder}" "cmake.sourceDirectory": "${workspaceFolder}",
"files.associations": {
"typeinfo": "cpp",
"__bit_reference": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__functional_base": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__string": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"algorithm": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"cmath": "cpp",
"compare": "cpp",
"complex": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"exception": "cpp",
"functional": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"queue": "cpp",
"random": "cpp",
"ratio": "cpp",
"set": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"utility": "cpp",
"variant": "cpp",
"vector": "cpp"
}
} }

View File

@ -136,7 +136,6 @@ HexWidget::HexWidget(QWidget *parent)
&HexWidget::onActionDeleteCommentTriggered); &HexWidget::onActionDeleteCommentTriggered);
addAction(actionDeleteComment); addAction(actionDeleteComment);
// Flag Option - Rohan
// Add flag option // Add flag option
actionFlag = new QAction(tr("Add Flag"), this); actionFlag = new QAction(tr("Add Flag"), this);
actionFlag->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut); actionFlag->setShortcutContext(Qt::ShortcutContext::WidgetWithChildrenShortcut);
@ -1180,12 +1179,14 @@ void HexWidget::contextMenuEvent(QContextMenuEvent *event)
} }
QString flag = Core()->flagAt(cursor.address); QString flag = Core()->flagAt(cursor.address);
RzFlagItem *flagItem = rz_flag_get_i(Core()->core()->flags, cursor.address);
if (flag.isNull() || flag.isEmpty()) { if (flagItem == 0x0 || flag.isNull() || flag.isEmpty()) {
actionDeleteFlag->setVisible(false); actionDeleteFlag->setVisible(false);
actionFlag->setText(tr("Add Flag")); actionFlag->setText(tr("Add Flag"));
} else { } else {
actionDeleteFlag->setVisible(true); actionDeleteFlag->setVisible(true);
actionFlag->setText(tr("Edit Flag"));
} }
if (!ioModesController.canWrite()) { if (!ioModesController.canWrite()) {
@ -1261,6 +1262,7 @@ void HexWidget::onActionAddCommentTriggered()
CommentsDialog::addOrEditComment(addr, this); CommentsDialog::addOrEditComment(addr, this);
} }
// slog for add flag action
void HexWidget::onActionAddFlagTriggered() void HexWidget::onActionAddFlagTriggered()
{ {
uint64_t addr = cursor.address; uint64_t addr = cursor.address;