"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/widgets/RegistersWidget.cpp" between
cutter-1.10.2.tar.gz and cutter-1.10.3.tar.gz

About: cutter is a Qt and C++ GUI for radare2 reverse engineering framework.

RegistersWidget.cpp  (cutter-1.10.2):RegistersWidget.cpp  (cutter-1.10.3)
skipping to change at line 54 skipping to change at line 54
setRegisterGrid(); setRegisterGrid();
} }
void RegistersWidget::setRegisterGrid() void RegistersWidget::setRegisterGrid()
{ {
int i = 0; int i = 0;
int col = 0; int col = 0;
QString regValue; QString regValue;
QLabel *registerLabel; QLabel *registerLabel;
QLineEdit *registerEditValue; QLineEdit *registerEditValue;
QJsonObject registerValues = Core()->getRegisterValues().object(); const auto registerRefs = Core()->getRegisterRefValues();
QJsonObject registerRefs = Core()->getRegisterJson();
QStringList registerNames = registerValues.keys();
QCollator collator; registerLen = registerRefs.size();
collator.setNumericMode(true); for (auto &reg : registerRefs) {
std::sort(registerNames.begin(), registerNames.end(), collator); regValue = "0x" + reg.value;
registerLen = registerValues.size();
for (const QString &key : registerNames) {
regValue = RAddressString(registerValues[key].toVariant().toULongLong())
;
// check if we already filled this grid space with label/value // check if we already filled this grid space with label/value
if (!registerLayout->itemAtPosition(i, col)) { if (!registerLayout->itemAtPosition(i, col)) {
registerLabel = new QLabel; registerLabel = new QLabel;
registerLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); registerLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
registerLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); registerLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
registerLabel->setMaximumWidth(60); registerLabel->setMaximumWidth(60);
registerLabel->setStyleSheet("font-weight: bold; font-family: mono;" ); registerLabel->setStyleSheet("font-weight: bold; font-family: mono;" );
registerEditValue = new QLineEdit; registerEditValue = new QLineEdit;
registerEditValue->setMaximumWidth(140); registerEditValue->setMaximumWidth(140);
registerEditValue->setFont(Config()->getFont()); registerEditValue->setFont(Config()->getFont());
skipping to change at line 90 skipping to change at line 84
connect(registerEditValue, &QWidget::customContextMenuRequested, thi s, [this, registerEditValue](QPoint p){ connect(registerEditValue, &QWidget::customContextMenuRequested, thi s, [this, registerEditValue](QPoint p){
openContextMenu(registerEditValue->mapToGlobal(p), registerEditV alue->text()); openContextMenu(registerEditValue->mapToGlobal(p), registerEditV alue->text());
}); });
// add label and register value to grid // add label and register value to grid
registerLayout->addWidget(registerLabel, i, col); registerLayout->addWidget(registerLabel, i, col);
registerLayout->addWidget(registerEditValue, i, col + 1); registerLayout->addWidget(registerEditValue, i, col + 1);
connect(registerEditValue, &QLineEdit::editingFinished, [ = ]() { connect(registerEditValue, &QLineEdit::editingFinished, [ = ]() {
QString regNameString = registerLabel->text(); QString regNameString = registerLabel->text();
QString regValueString = registerEditValue->text(); QString regValueString = registerEditValue->text();
Core()->setRegister(regNameString, regValueString); Core()->setRegister(regNameString, regValueString);
printf("dr %s %s\n", regNameString.toLocal8Bit().constData(),
regValueString.toLocal8Bit().constData());
}); });
} else { } else {
QWidget *regNameWidget = registerLayout->itemAtPosition(i, col)->wid get(); QWidget *regNameWidget = registerLayout->itemAtPosition(i, col)->wid get();
QWidget *regValueWidget = registerLayout->itemAtPosition(i, col + 1) ->widget(); QWidget *regValueWidget = registerLayout->itemAtPosition(i, col + 1) ->widget();
registerLabel = qobject_cast<QLabel *>(regNameWidget); registerLabel = qobject_cast<QLabel *>(regNameWidget);
registerEditValue = qobject_cast<QLineEdit *>(regValueWidget); registerEditValue = qobject_cast<QLineEdit *>(regValueWidget);
} }
// decide to highlight QLine Box in case of change of register value // decide to highlight QLine Box in case of change of register value
if (regValue != registerEditValue->text() && registerEditValue->text() ! = 0) { if (regValue != registerEditValue->text() && registerEditValue->text() ! = 0) {
registerEditValue->setStyleSheet("border: 1px solid green;"); registerEditValue->setStyleSheet("border: 1px solid green;");
} else { } else {
// reset stylesheet // reset stylesheet
registerEditValue->setStyleSheet(""); registerEditValue->setStyleSheet("");
} }
// define register label and value // define register label and value
registerLabel->setText(key); registerLabel->setText(reg.name);
if (registerRefs.contains(key)) {
// add register references to tooltips registerLabel->setToolTip(reg.ref);
QString reference = registerRefs[key].toObject()["ref"].toString(); registerEditValue->setToolTip(reg.ref);
registerLabel->setToolTip(reference);
registerEditValue->setToolTip(reference);
}
registerEditValue->setPlaceholderText(regValue); registerEditValue->setPlaceholderText(regValue);
registerEditValue->setText(regValue); registerEditValue->setText(regValue);
i++; i++;
// decide if we should change column // decide if we should change column
if (i >= (registerLen + numCols - 1) / numCols) { if (i >= (registerLen + numCols - 1) / numCols) {
i = 0; i = 0;
col += 2; col += 2;
} }
} }
} }
 End of changes. 4 change blocks. 
20 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)