1
0
Fork 0

Expression validation added to breakpoint dialog (red and green borders)

This commit is contained in:
AzuLX 2026-01-13 13:35:56 +00:00
parent 66860fef76
commit c570230060
No known key found for this signature in database
GPG Key ID: BED7E7DC23A637BC
2 changed files with 33 additions and 1 deletions

View File

@ -4,6 +4,7 @@
#include "MiscUtil.h"
#include "Configuration.h"
#include "BrowseDialog.h"
#include <QLineEdit>
EditBreakpointDialog::EditBreakpointDialog(QWidget* parent, const Breakpoints::Data & bp)
: QDialog(parent),
@ -38,9 +39,13 @@ EditBreakpointDialog::EditBreakpointDialog(QWidget* parent, const Breakpoints::D
break;
}
setWindowIcon(DIcon("breakpoint"));
loadFromBp();
connect(this, SIGNAL(accepted()), this, SLOT(acceptedSlot()));
connect(ui->editBreakCondition, SIGNAL(textChanged(QString)), this, SLOT(onExpressionChanged(QString)));
connect(ui->editLogCondition, SIGNAL(textChanged(QString)), this, SLOT(onExpressionChanged(QString)));
connect(ui->editCommandCondition, SIGNAL(textChanged(QString)), this, SLOT(onExpressionChanged(QString)));
loadFromBp();
Config()->loadWindowGeometry(this);
}
@ -105,3 +110,26 @@ void EditBreakpointDialog::acceptedSlot()
mBp.fastResume = ui->checkBoxFastResume->isChecked();
mBp.logFile = mLogFile;
}
void EditBreakpointDialog::onExpressionChanged(const QString & text)
{
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
if(edit)
updateExpressionStyle(edit, text);
}
void EditBreakpointDialog::updateExpressionStyle(QLineEdit* edit, const QString & text)
{
if(text.isEmpty() || !DbgIsDebugging())
{
edit->setStyleSheet("");
}
else if(DbgIsValidExpression(text.toUtf8().constData()))
{
edit->setStyleSheet("QLineEdit { border: 1px solid green; }");
}
else
{
edit->setStyleSheet("QLineEdit { border: 1px solid red; }");
}
}

View File

@ -4,6 +4,8 @@
#include "Bridge.h"
#include "Breakpoints.h"
class QLineEdit;
namespace Ui
{
class EditBreakpointDialog;
@ -25,6 +27,7 @@ private slots:
void on_editLogText_textEdited(const QString & arg1);
void on_buttonLogFile_clicked();
void acceptedSlot();
void onExpressionChanged(const QString & text);
private:
Ui::EditBreakpointDialog* ui;
@ -32,4 +35,5 @@ private:
QString mLogFile;
void loadFromBp();
void updateExpressionStyle(QLineEdit* edit, const QString & text);
};