1
0
Fork 0

GUI: jolly good fixes to various things

This commit is contained in:
mrexodia 2016-06-03 16:44:24 +02:00
parent 38546c51aa
commit c801811184
No known key found for this signature in database
GPG Key ID: D72F9A4FAA0073B4
11 changed files with 824 additions and 645 deletions

View File

@ -671,9 +671,8 @@ typedef struct
typedef struct
{
char mod[MAX_MODULE_SIZE];
duint refcount;
XREF_RECORD* references;
size_t refcount;
} XREF_INFO;
//Debugger functions

View File

@ -883,7 +883,7 @@ int Disassembly::paintJumpsGraphic(QPainter* painter, int x, int y, dsint addr,
duint max = selVa, min = selVa;
showXref = true;
int jmpcount = 0;
for(int i = 0; i < mXrefInfo.refcount; i++)
for(duint i = 0; i < mXrefInfo.refcount; i++)
{
if(mXrefInfo.references[i].type != XREF_JMP)
continue;

View File

@ -39,8 +39,8 @@ CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
mGeneralRegs = new RegistersView(0);
mGeneralRegs->setFixedWidth(1000);
mGeneralRegs->setFixedHeight(mGeneralRegs->getEstimateHeight());
mGeneralRegs->ShowFPU(true);
mGeneralRegs->setFixedHeight(mGeneralRegs->getEstimateHeight());
QScrollArea* upperScrollArea = new QScrollArea(this);
upperScrollArea->setWidget(mGeneralRegs);

View File

@ -43,6 +43,8 @@ EditFloatRegister::EditFloatRegister(int RegisterSize, QWidget* parent) :
GuiAddLogMessage(QString("Error, register size %1 is not supported.\n").arg(RegisterSize).toUtf8().constData());
break;
}
setFixedWidth(width());
adjustSize();
connect(ui->hexEdit, SIGNAL(textEdited(QString)), this, SLOT(editingHex1FinishedSlot(QString)));
ui->hexEdit->setValidator(&hexValidate);
@ -108,6 +110,7 @@ EditFloatRegister::EditFloatRegister(int RegisterSize, QWidget* parent) :
void EditFloatRegister::hideUpperPart()
{
ui->line->hide();
ui->labelH0->hide();
ui->labelH1->hide();
ui->labelH2->hide();
@ -167,6 +170,11 @@ const char* EditFloatRegister::getData()
return Data;
}
void EditFloatRegister::selectAllText()
{
ui->hexEdit->selectAll();
}
/**
* @brief reloads the lower 128-bit of data of the dialog
*/
@ -483,7 +491,7 @@ EditFloatRegister::~EditFloatRegister()
void EditFloatRegister::editingHex1FinishedSlot(QString arg)
{
mutex = sender();
QString filled(arg);
QString filled(arg.toUpper());
filled.append(QString(16 - filled.length(), QChar('0')));
for(int i = 0; i < 16; i++)
Data[i + 16] = filled.mid(i * 2, 2).toInt(0, 16);
@ -497,7 +505,7 @@ void EditFloatRegister::editingHex1FinishedSlot(QString arg)
void EditFloatRegister::editingHex2FinishedSlot(QString arg)
{
mutex = sender();
QString filled(arg);
QString filled(arg.toUpper());
filled.append(QString(16 - filled.length(), QChar('0')));
for(int i = 0; i < 16; i++)
Data[i] = filled.mid(i * 2, 2).toInt(0, 16);

View File

@ -20,6 +20,7 @@ public:
explicit EditFloatRegister(int RegisterSize, QWidget* parent = 0);
void loadData(char* RegisterData);
const char* getData();
void selectAllText();
~EditFloatRegister();

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,11 @@ LineEditDialog::~LineEditDialog()
delete ui;
}
void LineEditDialog::selectAllText()
{
ui->textEdit->selectAll();
}
void LineEditDialog::setCursorPosition(int position)
{
ui->textEdit->setCursorPosition(position);

View File

@ -23,6 +23,7 @@ public:
void setCheckBoxText(const QString & text);
void setCursorPosition(int position);
void ForceSize(unsigned int size);
void selectAllText();
private slots:
void on_textEdit_textChanged(const QString & arg1);

View File

@ -1882,6 +1882,8 @@ void RegistersView::displayEditDialog()
EditFloatRegister mEditFloat(256, this);
mEditFloat.setWindowTitle(tr("Edit YMM register"));
mEditFloat.loadData(registerValue(&wRegDumpStruct, mSelected));
mEditFloat.show();
mEditFloat.selectAllText();
if(mEditFloat.exec() == QDialog::Accepted)
setRegister(mSelected, (duint)mEditFloat.getData());
}
@ -1906,6 +1908,8 @@ void RegistersView::displayEditDialog()
do
{
errorinput = false;
mLineEdit.show();
mLineEdit.selectAllText();
if(mLineEdit.exec() != QDialog::Accepted)
return; //pressed cancel
else

View File

@ -14,7 +14,7 @@ XrefBrowseDialog::XrefBrowseDialog(QWidget* parent, duint address) :
{
char disasm[GUI_MAX_DISASSEMBLY_SIZE] = "";
setWindowTitle(QString(tr("xrefs at %1")).arg(ToHexString(address)));
for(int i = 0; i < mXrefInfo.refcount; i++)
for(duint i = 0; i < mXrefInfo.refcount; i++)
{
GuiGetDisassembly(mXrefInfo.references[i].addr, disasm);
ui->listWidget->addItem(disasm);

View File

@ -9,27 +9,26 @@ HexValidator::~HexValidator()
{
}
static bool isXDigit(const QChar & c)
{
return c.isDigit() || (c.toUpper() >= 'A' && c.toUpper() <= 'F');
}
void HexValidator::fixup(QString & input) const
{
for(auto i : input)
{
if(!i.isDigit())
{
if(i >= QChar('a') && i <= QChar('f'))
i = i.toUpper();
else
input.remove(i);
}
if(!isXDigit(i))
input.remove(i);
}
}
QValidator::State HexValidator::validate(QString & input, int & pos) const
{
Q_UNUSED(pos);
input = input.toUpper();
for(int i = 0; i < input.length(); i++)
{
if(!(input.at(i).isDigit() || (input.at(i) >= QChar('A') && input.at(i) <= QChar('F'))))
if(!isXDigit(input[i]))
return State::Invalid;
}
return State::Acceptable;