Skip to content

Commit

Permalink
Merge branch 'ra3xdh:current' into current
Browse files Browse the repository at this point in the history
  • Loading branch information
NN708 authored Nov 12, 2024
2 parents b489d1a + 94c2ca5 commit 7ae6f4b
Showing 1 changed file with 34 additions and 22 deletions.
56 changes: 34 additions & 22 deletions qucs/extsimkernels/externsimdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ExternSimDialog::ExternSimDialog(Schematic *sch, bool netlist_mode) :
QDialog(sch)
{
Sch = sch;
wasSimulated = false;
wasSimulated = true;
hasError = false;

QSettings settings("qucs", "qucs_s");
Expand Down Expand Up @@ -190,6 +190,8 @@ void ExternSimDialog::slotProcessOutput()
if (logContainsError(out)) {
addLogEntry(tr("There were simulation errors. Please check log."),
this->style()->standardIcon(QStyle::SP_MessageBoxCritical));
hasError = true;
wasSimulated = false;
emit warnings();
} else if (logContainsWarning(out)) {
addLogEntry(tr("There were simulation warnings. Please check log."),
Expand All @@ -198,33 +200,37 @@ void ExternSimDialog::slotProcessOutput()
QIcon(":/bitmaps/svg/ok_apply.svg"));
emit warnings();
} else {
addLogEntry(tr("Simulation successful. Now place diagram on schematic to plot the result."),
if ( !hasError ) {
addLogEntry(tr("Simulation successful. Now place diagram on schematic to plot the result."),
QIcon(":/bitmaps/svg/ok_apply.svg"));
emit success();
emit success();
}
}
//editSimConsole->clear();
/*editSimConsole->insertPlainText(out);
editSimConsole->moveCursor(QTextCursor::End);*/
saveLog();
editSimConsole->insertPlainText("Simulation finished\n");

QFileInfo inf(Sch->DocName);
//QString qucs_dataset = inf.canonicalPath()+QDir::separator()+inf.baseName()+"_ngspice.dat";
QString qucs_dataset = inf.canonicalPath()+QDir::separator()+inf.completeBaseName()+ext;
switch (QucsSettings.DefaultSimulator) {
case spicecompat::simNgspice:
case spicecompat::simSpiceOpus:
ngspice->convertToQucsData(qucs_dataset);
break;
case spicecompat::simXyce:
xyce->convertToQucsData(qucs_dataset);
break;
default:
break;
if ( !hasError ) {
QFileInfo inf(Sch->DocName);
//QString qucs_dataset = inf.canonicalPath()+QDir::separator()+inf.baseName()+"_ngspice.dat";
QString qucs_dataset = inf.canonicalPath()+QDir::separator()+inf.completeBaseName()+ext;
switch (QucsSettings.DefaultSimulator) {
case spicecompat::simNgspice:
case spicecompat::simSpiceOpus:
ngspice->convertToQucsData(qucs_dataset);
break;
case spicecompat::simXyce:
xyce->convertToQucsData(qucs_dataset);
break;
default:
break;
}
}
wasSimulated = true;
if (out.contains("error",Qt::CaseInsensitive))
hasError = true;
//wasSimulated = true;
//if (out.contains("error",Qt::CaseInsensitive))
// hasError = true;
emit simulated(this);
//if (Sch->showBias>0 || QucsMain->TuningMode) this->close();
}
Expand All @@ -243,18 +249,24 @@ void ExternSimDialog::slotNgspiceStartError(QProcess::ProcessError err)
{
QString msg;
switch (err) {
case QProcess::FailedToStart : msg = tr("Failed to start simulator!");
case QProcess::FailedToStart:
msg = tr("Failed to start simulator!");
break;
case QProcess::Crashed : msg = tr("Simulator crashed!");
case QProcess::Crashed:
msg = tr("Simulator crashed!");
break;
default : msg = tr("Simulator error!");
default:
msg = tr("Simulator error!");
}

//QMessageBox::critical(this,tr("Simulate with SPICE"),msg,QMessageBox::Ok);
addLogEntry(msg,this->style()->standardIcon(QStyle::SP_MessageBoxCritical));

QString sim = spicecompat::getDefaultSimulatorName(QucsSettings.DefaultSimulator);
editSimConsole->insertPlainText(sim + tr(" error..."));

wasSimulated = false;
hasError = true;
}

void ExternSimDialog::slotStart()
Expand Down

0 comments on commit 7ae6f4b

Please sign in to comment.