Skip to content

Commit

Permalink
Add explicit firsRun setting #299
Browse files Browse the repository at this point in the history
  • Loading branch information
ra3xdh committed Aug 18, 2023
1 parent 3d693e1 commit 7b11881
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 5 additions & 0 deletions qucs/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ bool loadSettings()
QucsSettings.DefaultSimulator = settings.value("DefaultSimulator").toInt();
else QucsSettings.DefaultSimulator = spicecompat::simNotSpecified;

if(settings.contains("firstRun"))
QucsSettings.firstRun = settings.value("firstRun").toBool();
else QucsSettings.firstRun = true;

if(settings.contains("x"))QucsSettings.x=settings.value("x").toInt();
if(settings.contains("y"))QucsSettings.y=settings.value("y").toInt();
if(settings.contains("dx"))QucsSettings.dx=settings.value("dx").toInt();
Expand Down Expand Up @@ -220,6 +224,7 @@ bool saveApplSettings()
QSettings settings ("qucs","qucs_s");

settings.setValue("DefaultSimulator", QucsSettings.DefaultSimulator);
settings.setValue("firstRun", false);

settings.setValue("x", QucsSettings.x);
settings.setValue("y", QucsSettings.y);
Expand Down
2 changes: 2 additions & 0 deletions qucs/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ struct tQucsSettings {
bool ViewToolbar;
bool WorkToolbar;
bool SimulateToolbar;

bool firstRun;
};

extern tQucsSettings QucsSettings; // extern because nearly everywhere used
Expand Down
15 changes: 6 additions & 9 deletions qucs/qucs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ QucsApp::QucsApp()
}
}

if (QucsSettings.DefaultSimulator == spicecompat::simNotSpecified) { // try to find Ngspice
if (QucsSettings.firstRun) { // try to find Ngspice
#ifdef Q_OS_WIN
QString ngspice_exe1 = QucsSettings.BinDir + QDir::separator() + "ngspice_con.exe";
QString ngspice_exe2 = "C:\\Spice64\\bin\\ngspice_con.exe";
Expand Down Expand Up @@ -237,17 +237,14 @@ QucsApp::QucsApp()
QucsSettings.DefaultSimulator = spicecompat::simNgspice;
QucsSettings.NgspiceExecutable = ngspice_exe;
fillSimulatorsComboBox();
} else {
QMessageBox::information(this,tr("Qucs"),tr("Ngspice not found automatically. Please specify simulators"
" in the next dialog window."));
slotSimSettings();
}
QucsSettings.firstRun = false;
}

if (QucsSettings.DefaultSimulator == spicecompat::simNotSpecified) {
QMessageBox::information(this,tr("Qucs"),tr("Default simulator is not specified yet.\n"
"Please setup it in the next dialog window.\n"
"If you have no simulators except Qucs installed\n"
"in your system leave default Qucsator setting\n"
"and simple press Apply button"));
slotSimSettings();
}
// fillLibrariesTreeView();
}

Expand Down

0 comments on commit 7b11881

Please sign in to comment.