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 "CommentsDialog.h"
|
||||||
#include "ui_CommentsDialog.h"
|
#include "ui_CommentsDialog.h"
|
||||||
#include <iostream>
|
|
||||||
#include <QErrorMessage>
|
#include <QErrorMessage>
|
||||||
|
|
||||||
#include "core/Cutter.h"
|
#include "core/Cutter.h"
|
||||||
|
|
||||||
CommentsDialog::CommentsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CommentsDialog)
|
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);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
|
|
||||||
|
@ -1,21 +1,15 @@
|
|||||||
#include "FlagDialog.h"
|
#include "FlagDialog.h"
|
||||||
#include "ui_FlagDialog.h"
|
#include "ui_FlagDialog.h"
|
||||||
|
|
||||||
#include <QIntValidator>
|
#include <QIntValidator>
|
||||||
#include <iostream>
|
|
||||||
#include "core/Cutter.h"
|
#include "core/Cutter.h"
|
||||||
|
|
||||||
FlagDialog::FlagDialog(RVA offset, QWidget *parent)
|
FlagDialog::FlagDialog(RVA offset, QWidget *parent)
|
||||||
: QDialog(parent), ui(new Ui::FlagDialog), offset(offset), flagName(""), flagOffset(RVA_INVALID)
|
: 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
|
// Setup UI
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
RzFlagItem *flag = rz_flag_get_i(Core()->core()->flags, offset);
|
RzFlagItem *flag = rz_flag_get_i(Core()->core()->flags, offset);
|
||||||
std::cout << "flag" << " " << flag << std::endl;
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
flagName = QString(flag->name);
|
flagName = QString(flag->name);
|
||||||
flagOffset = flag->offset;
|
flagOffset = flag->offset;
|
||||||
@ -28,7 +22,6 @@ FlagDialog::FlagDialog(RVA offset, QWidget *parent)
|
|||||||
ui->nameEdit->setText(flag->name);
|
ui->nameEdit->setText(flag->name);
|
||||||
ui->labelAction->setText(tr("Edit flag at %1").arg(RzAddressString(offset)));
|
ui->labelAction->setText(tr("Edit flag at %1").arg(RzAddressString(offset)));
|
||||||
} else {
|
} else {
|
||||||
std::cout << "offset in if condition" << " " << offset << std::endl;
|
|
||||||
ui->labelAction->setText(tr("Add flag at %1").arg(RzAddressString(offset)));
|
ui->labelAction->setText(tr("Add flag at %1").arg(RzAddressString(offset)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +36,6 @@ void FlagDialog::buttonBoxAccepted()
|
|||||||
{
|
{
|
||||||
RVA size = ui->sizeEdit->text().toULongLong();
|
RVA size = ui->sizeEdit->text().toULongLong();
|
||||||
QString name = ui->nameEdit->text();
|
QString name = ui->nameEdit->text();
|
||||||
std::cout << "name" << " " << name.toStdString() << std::endl;
|
|
||||||
|
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
if (flagOffset != RVA_INVALID) {
|
if (flagOffset != RVA_INVALID) {
|
||||||
@ -59,7 +51,6 @@ void FlagDialog::buttonBoxAccepted()
|
|||||||
} else {
|
} else {
|
||||||
// Name provided and flag does not exist -> create the flag
|
// Name provided and flag does not exist -> create the flag
|
||||||
Core()->addFlag(offset, name, size);
|
Core()->addFlag(offset, name, size);
|
||||||
std::cout << "Adding flag" << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include "dialogs/EditStringDialog.h"
|
#include "dialogs/EditStringDialog.h"
|
||||||
#include "dialogs/BreakpointsDialog.h"
|
#include "dialogs/BreakpointsDialog.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include <iostream>
|
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
#include "dialogs/WriteCommandsDialogs.h"
|
#include "dialogs/WriteCommandsDialogs.h"
|
||||||
#include "dialogs/CommentsDialog.h"
|
#include "dialogs/CommentsDialog.h"
|
||||||
#include "dialogs/FlagDialog.h"
|
#include "dialogs/FlagDialog.h"
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
@ -1182,14 +1180,12 @@ void HexWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString flag = Core()->flagAt(cursor.address);
|
QString flag = Core()->flagAt(cursor.address);
|
||||||
std::cout << "Flag at " << std::hex << cursor.address << " is " << flag.toStdString() << std::endl;
|
|
||||||
|
|
||||||
if (flag.isNull() || flag.isEmpty()) {
|
if (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()) {
|
||||||
@ -1268,7 +1264,6 @@ void HexWidget::onActionAddCommentTriggered()
|
|||||||
void HexWidget::onActionAddFlagTriggered()
|
void HexWidget::onActionAddFlagTriggered()
|
||||||
{
|
{
|
||||||
uint64_t addr = cursor.address;
|
uint64_t addr = cursor.address;
|
||||||
std::cout << "Add flag at " << std::hex << addr << std::endl;
|
|
||||||
FlagDialog dialog(addr, this);
|
FlagDialog dialog(addr, this);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user