Skip to content

Commit

Permalink
Allow disabling stdout and assert log options (#10500)
Browse files Browse the repository at this point in the history
Fixes #10467
Make the stdout and assert log options checked by default
When user unchecks then add -lv=-stdout
  • Loading branch information
adeas31 committed Apr 4, 2023
1 parent 724a324 commit 8afd6ca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
26 changes: 17 additions & 9 deletions OMEdit/OMEditLIB/Simulation/SimulationDialog.cpp
Expand Up @@ -448,14 +448,12 @@ void SimulationDialog::setUpForm()
for (int i = 0 ; i < logStreamNames.size() ; i++) {
QCheckBox *pLogStreamCheckBox = new QCheckBox(logStreamNames[i]);
pLogStreamCheckBox->setToolTip(logSteamDescriptions[i]);
if (column == 0) {
mpLoggingGroupLayout->addWidget(pLogStreamCheckBox, row, column++);
} else if (column == 1) {
mpLoggingGroupLayout->addWidget(pLogStreamCheckBox, row, column++);
} else if (column == 2) {
if (column == 2) {
mpLoggingGroupLayout->addWidget(pLogStreamCheckBox, row, column);
column = 0;
row++;
} else {
mpLoggingGroupLayout->addWidget(pLogStreamCheckBox, row, column++);
}
}
mpLoggingGroupBox->setLayout(mpLoggingGroupLayout);
Expand Down Expand Up @@ -826,8 +824,14 @@ void SimulationDialog::initializeFields(bool isReSimulate, SimulationOptions sim
while (QLayoutItem* pLayoutItem = mpLoggingGroupLayout->itemAt(i)) {
if (dynamic_cast<QCheckBox*>(pLayoutItem->widget())) {
QCheckBox *pLogStreamCheckBox = dynamic_cast<QCheckBox*>(pLayoutItem->widget());
if (logStreams.contains(pLogStreamCheckBox->text())) {
pLogStreamCheckBox->setChecked(true);
if ((pLogStreamCheckBox->text().compare(QStringLiteral("stdout")) == 0) || (pLogStreamCheckBox->text().compare(QStringLiteral("assert")) == 0)) {
if (logStreams.contains("-" + pLogStreamCheckBox->text())) {
pLogStreamCheckBox->setChecked(false);
}
} else {
if (logStreams.contains(pLogStreamCheckBox->text())) {
pLogStreamCheckBox->setChecked(true);
}
}
}
i++;
Expand Down Expand Up @@ -1184,7 +1188,9 @@ SimulationOptions SimulationDialog::createSimulationOptions()
while (QLayoutItem* pLayoutItem = mpLoggingGroupLayout->itemAt(i)) {
if (dynamic_cast<QCheckBox*>(pLayoutItem->widget())) {
QCheckBox *pLogStreamCheckBox = dynamic_cast<QCheckBox*>(pLayoutItem->widget());
if (pLogStreamCheckBox->isChecked()) {
if (!pLogStreamCheckBox->isChecked() && ((pLogStreamCheckBox->text().compare(QStringLiteral("stdout")) == 0) || (pLogStreamCheckBox->text().compare(QStringLiteral("assert")) == 0))) {
logStreams << "-" + pLogStreamCheckBox->text();
} else if (pLogStreamCheckBox->isChecked()) {
logStreams << pLogStreamCheckBox->text();
}
}
Expand Down Expand Up @@ -1549,7 +1555,9 @@ void SimulationDialog::saveSimulationFlagsAnnotation()
while (QLayoutItem* pLayoutItem = mpLoggingGroupLayout->itemAt(i)) {
if (dynamic_cast<QCheckBox*>(pLayoutItem->widget())) {
QCheckBox *pLogStreamCheckBox = dynamic_cast<QCheckBox*>(pLayoutItem->widget());
if (pLogStreamCheckBox->isChecked()) {
if (!pLogStreamCheckBox->isChecked() && ((pLogStreamCheckBox->text().compare(QStringLiteral("stdout")) == 0) || (pLogStreamCheckBox->text().compare(QStringLiteral("assert")) == 0))) {
logStreams << "-" + pLogStreamCheckBox->text();
} else if (pLogStreamCheckBox->isChecked()) {
logStreams << pLogStreamCheckBox->text();
}
}
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditLIB/Simulation/SimulationOptions.h
Expand Up @@ -100,7 +100,7 @@ class SimulationOptions
setBoundaryConditionCorrelationMatrixInputFile("");
setDataReconciliationEpsilon("");
setDataReconciliationSaveSetting(false);
setLogStreams(QStringList() << "LOG_STATS");
setLogStreams(QStringList() << "stdout" << "assert" << "LOG_STATS");
setAdditionalSimulationFlags("");
// Output
setOutputFormat("mat");
Expand Down

0 comments on commit 8afd6ca

Please sign in to comment.