mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-20 19:38:49 +00:00
Added hex flag option #2932
This commit is contained in:
parent
330803db99
commit
51761961fe
@ -1,13 +1,11 @@
|
||||
#include "CommentsDialog.h"
|
||||
#include "ui_CommentsDialog.h"
|
||||
#include <iostream>
|
||||
#include <QErrorMessage>
|
||||
|
||||
#include "core/Cutter.h"
|
||||
|
||||
CommentsDialog::CommentsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CommentsDialog)
|
||||
{
|
||||
std::cout << "Comments dialog parent object name" << " " << parent->objectName().toStdString() << std::endl;
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||
|
||||
|
@ -1,21 +1,15 @@
|
||||
#include "FlagDialog.h"
|
||||
#include "ui_FlagDialog.h"
|
||||
|
||||
#include <QIntValidator>
|
||||
#include <iostream>
|
||||
#include "core/Cutter.h"
|
||||
|
||||
FlagDialog::FlagDialog(RVA offset, QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::FlagDialog), offset(offset), flagName(""), flagOffset(RVA_INVALID)
|
||||
{
|
||||
std::cout << "offset" << " " << offset << std::endl;
|
||||
std::cout << "parent" << " " << parent << std::endl;
|
||||
std::cout << "parentObjectName" << " " << parent->objectName().toStdString() << std::endl;
|
||||
// Setup UI
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||
RzFlagItem *flag = rz_flag_get_i(Core()->core()->flags, offset);
|
||||
std::cout << "flag" << " " << flag << std::endl;
|
||||
if (flag) {
|
||||
flagName = QString(flag->name);
|
||||
flagOffset = flag->offset;
|
||||
@ -28,7 +22,6 @@ FlagDialog::FlagDialog(RVA offset, QWidget *parent)
|
||||
ui->nameEdit->setText(flag->name);
|
||||
ui->labelAction->setText(tr("Edit flag at %1").arg(RzAddressString(offset)));
|
||||
} else {
|
||||
std::cout << "offset in if condition" << " " << offset << std::endl;
|
||||
ui->labelAction->setText(tr("Add flag at %1").arg(RzAddressString(offset)));
|
||||
}
|
||||
|
||||
@ -43,7 +36,6 @@ void FlagDialog::buttonBoxAccepted()
|
||||
{
|
||||
RVA size = ui->sizeEdit->text().toULongLong();
|
||||
QString name = ui->nameEdit->text();
|
||||
std::cout << "name" << " " << name.toStdString() << std::endl;
|
||||
|
||||
if (name.isEmpty()) {
|
||||
if (flagOffset != RVA_INVALID) {
|
||||
@ -59,7 +51,6 @@ void FlagDialog::buttonBoxAccepted()
|
||||
} else {
|
||||
// Name provided and flag does not exist -> create the flag
|
||||
Core()->addFlag(offset, name, size);
|
||||
std::cout << "Adding flag" << std::endl;
|
||||
}
|
||||
}
|
||||
close();
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "dialogs/EditStringDialog.h"
|
||||
#include "dialogs/BreakpointsDialog.h"
|
||||
#include "MainWindow.h"
|
||||
#include <iostream>
|
||||
#include <QtCore>
|
||||
#include <QShortcut>
|
||||
#include <QJsonArray>
|
||||
|
@ -4,8 +4,6 @@
|
||||
#include "dialogs/WriteCommandsDialogs.h"
|
||||
#include "dialogs/CommentsDialog.h"
|
||||
#include "dialogs/FlagDialog.h"
|
||||
#include <iostream>
|
||||
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#include <QResizeEvent>
|
||||
@ -1182,14 +1180,12 @@ void HexWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
}
|
||||
|
||||
QString flag = Core()->flagAt(cursor.address);
|
||||
std::cout << "Flag at " << std::hex << cursor.address << " is " << flag.toStdString() << std::endl;
|
||||
|
||||
if (flag.isNull() || flag.isEmpty()) {
|
||||
actionDeleteFlag->setVisible(false);
|
||||
actionFlag->setText(tr("Add Flag"));
|
||||
} else {
|
||||
actionDeleteFlag->setVisible(true);
|
||||
actionFlag->setText(tr("Edit Flag"));
|
||||
}
|
||||
|
||||
if (!ioModesController.canWrite()) {
|
||||
@ -1268,7 +1264,6 @@ void HexWidget::onActionAddCommentTriggered()
|
||||
void HexWidget::onActionAddFlagTriggered()
|
||||
{
|
||||
uint64_t addr = cursor.address;
|
||||
std::cout << "Add flag at " << std::hex << addr << std::endl;
|
||||
FlagDialog dialog(addr, this);
|
||||
dialog.exec();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user