GUI: fill with NOPs option in GUI (resolved issue #43)
This commit is contained in:
parent
afdcd0a7d5
commit
de7556c95a
|
@ -1,4 +1,5 @@
|
|||
#include "CPUDisassembly.h"
|
||||
#include "Configuration.h"
|
||||
|
||||
CPUDisassembly::CPUDisassembly(QWidget *parent) : Disassembly(parent)
|
||||
{
|
||||
|
@ -651,11 +652,16 @@ void CPUDisassembly::assembleAt()
|
|||
|
||||
mLineEdit.setText(instr.instStr);
|
||||
mLineEdit.setWindowTitle("Assemble at " + addr_text);
|
||||
mLineEdit.setCheckBoxText("&Fill with NOP's");
|
||||
mLineEdit.enableCheckBox(true);
|
||||
mLineEdit.setCheckBox(ConfigBool("Disassembler", "FillNOPs"));
|
||||
if(mLineEdit.exec()!=QDialog::Accepted)
|
||||
return;
|
||||
Configuration::instance()->setBool("Disassembler", "FillNOPs", mLineEdit.bChecked);
|
||||
Configuration::instance()->writeBools();
|
||||
|
||||
char error[256]="";
|
||||
if(!DbgFunctions()->DbgAssembleAtEx(wVA, mLineEdit.editText.toUtf8().constData(), error, true))
|
||||
if(!DbgFunctions()->DbgAssembleAtEx(wVA, mLineEdit.editText.toUtf8().constData(), error, mLineEdit.bChecked))
|
||||
{
|
||||
QMessageBox msg(QMessageBox::Critical, "Error!", "Failed to assemble instruction \"" + mLineEdit.editText + "\" (" + error + ")");
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-error.png"));
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "LineEditDialog.h"
|
||||
#include "ui_LineEditDialog.h"
|
||||
#include "Bridge.h"
|
||||
|
||||
LineEditDialog::LineEditDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LineEditDialog)
|
||||
{
|
||||
|
@ -8,6 +9,7 @@ LineEditDialog::LineEditDialog(QWidget *parent) : QDialog(parent), ui(new Ui::Li
|
|||
setWindowFlags(Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint);
|
||||
setFixedSize(this->size()); //fixed size
|
||||
setModal(true); //modal window
|
||||
ui->checkBox->hide();
|
||||
}
|
||||
|
||||
LineEditDialog::~LineEditDialog()
|
||||
|
@ -21,7 +23,31 @@ void LineEditDialog::setText(const QString &text)
|
|||
ui->textEdit->selectAll();
|
||||
}
|
||||
|
||||
void LineEditDialog::enableCheckBox(bool bEnable)
|
||||
{
|
||||
if(bEnable)
|
||||
ui->checkBox->show();
|
||||
else
|
||||
ui->checkBox->hide();
|
||||
}
|
||||
|
||||
void LineEditDialog::setCheckBox(bool bSet)
|
||||
{
|
||||
ui->checkBox->setChecked(bSet);
|
||||
bChecked=bSet;
|
||||
}
|
||||
|
||||
void LineEditDialog::setCheckBoxText(const QString &text)
|
||||
{
|
||||
ui->checkBox->setText(text);
|
||||
}
|
||||
|
||||
void LineEditDialog::on_textEdit_textChanged(const QString &arg1)
|
||||
{
|
||||
editText=arg1;
|
||||
}
|
||||
|
||||
void LineEditDialog::on_checkBox_toggled(bool checked)
|
||||
{
|
||||
bChecked=checked;
|
||||
}
|
||||
|
|
|
@ -16,10 +16,15 @@ public:
|
|||
explicit LineEditDialog(QWidget *parent = 0);
|
||||
~LineEditDialog();
|
||||
QString editText;
|
||||
bool bChecked;
|
||||
void setText(const QString &text);
|
||||
void enableCheckBox(bool bEnable);
|
||||
void setCheckBox(bool bSet);
|
||||
void setCheckBoxText(const QString &text);
|
||||
|
||||
private slots:
|
||||
void on_textEdit_textChanged(const QString &arg1);
|
||||
void on_checkBox_toggled(bool checked);
|
||||
|
||||
private:
|
||||
Ui::LineEditDialog *ui;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<iconset resource="../../resource.qrc">
|
||||
<normaloff>:/icons/images/ui-combo-box-edit.png</normaloff>:/icons/images/ui-combo-box-edit.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
|
@ -45,6 +45,13 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>CheckBox</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonOk">
|
||||
<property name="text">
|
||||
|
|
|
@ -134,6 +134,7 @@ Configuration::Configuration() : QObject()
|
|||
QMap<QString, bool> disassemblyBool;
|
||||
disassemblyBool.insert("ArgumentSpaces", false);
|
||||
disassemblyBool.insert("MemorySpaces", false);
|
||||
disassemblyBool.insert("FillNOPs", false);
|
||||
defaultBools.insert("Disassembler", disassemblyBool);
|
||||
|
||||
load();
|
||||
|
@ -240,6 +241,27 @@ const bool Configuration::getBool(const QString category, const QString id)
|
|||
return false;
|
||||
}
|
||||
|
||||
void Configuration::setBool(const QString category, const QString id, const bool b)
|
||||
{
|
||||
if(Bools.contains(category))
|
||||
{
|
||||
if(Bools[category].contains(id))
|
||||
{
|
||||
Bools[category][id]=b;
|
||||
return;
|
||||
}
|
||||
QMessageBox msg(QMessageBox::Warning, "NOT FOUND IN CONFIG!", category+":"+id);
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-warning.png"));
|
||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
QMessageBox msg(QMessageBox::Warning, "NOT FOUND IN CONFIG!", category);
|
||||
msg.setWindowIcon(QIcon(":/icons/images/compile-warning.png"));
|
||||
msg.setWindowFlags(msg.windowFlags()&(~Qt::WindowContextHelpButtonHint));
|
||||
msg.exec();
|
||||
}
|
||||
|
||||
QColor Configuration::colorFromConfig(const QString id)
|
||||
{
|
||||
char setting[MAX_SETTING_SIZE]="";
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
|
||||
const QColor getColor(const QString id);
|
||||
const bool getBool(const QString category, const QString id);
|
||||
void setBool(const QString category, const QString id, const bool b);
|
||||
|
||||
//default setting maps
|
||||
QMap<QString, QColor> defaultColors;
|
||||
|
|
Loading…
Reference in New Issue