mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00
Implemented Ngspice and Xyce executables setting
This commit is contained in:
parent
7d13064b8b
commit
92324f03da
@ -15,6 +15,7 @@ xyce.h
|
||||
qucs2spice.h
|
||||
spicecompat.h
|
||||
customsimdialog.h
|
||||
simsettingsdialog.h
|
||||
)
|
||||
|
||||
SET(EXTSIMKERNELS_SRCS
|
||||
@ -25,6 +26,7 @@ xyce.cpp
|
||||
qucs2spice.cpp
|
||||
spicecompat.cpp
|
||||
customsimdialog.cpp
|
||||
simsettingsdialog.cpp
|
||||
)
|
||||
|
||||
SET(EXTSIMKERNELS_MOC_HDRS
|
||||
@ -33,6 +35,7 @@ abstractspicekernel.h
|
||||
ngspice.h
|
||||
xyce.h
|
||||
customsimdialog.h
|
||||
simsettingsdialog.h
|
||||
)
|
||||
|
||||
QT4_WRAP_CPP( EXTSIMKERNELS_MOC_SRCS ${EXTSIMKERNELS_MOC_HDRS} )
|
||||
|
@ -535,3 +535,8 @@ QString AbstractSpiceKernel::getOutput()
|
||||
{
|
||||
return output;
|
||||
}
|
||||
|
||||
void AbstractSpiceKernel::setSimulatorCmd(QString cmd)
|
||||
{
|
||||
simulator_cmd = cmd;
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
void convertToQucsData(const QString &qucs_dataset, bool xyce = false);
|
||||
QString getOutput();
|
||||
|
||||
void setSimulatorCmd(QString cmd);
|
||||
|
||||
signals:
|
||||
void started();
|
||||
|
@ -20,6 +20,8 @@
|
||||
#endif
|
||||
|
||||
#include "externsimdialog.h"
|
||||
#include "simsettingsdialog.h"
|
||||
#include "main.h"
|
||||
|
||||
ExternSimDialog::ExternSimDialog(Schematic *sch,QWidget *parent) :
|
||||
QDialog(parent)
|
||||
@ -45,6 +47,9 @@ ExternSimDialog::ExternSimDialog(Schematic *sch,QWidget *parent) :
|
||||
connect(buttonStopSim,SIGNAL(clicked()),ngspice,SLOT(killThemAll()));
|
||||
buttonStopSim->setEnabled(false);
|
||||
|
||||
buttonSimSettings = new QPushButton(tr("Settings"),this);
|
||||
connect(buttonSimSettings,SIGNAL(clicked()),this,SLOT(slotSimSettings()));
|
||||
|
||||
lblSimulator = new QLabel(tr("Select external simulator:"));
|
||||
QGroupBox *grp1 = new QGroupBox(tr("Simulation console"),this);
|
||||
QVBoxLayout *vbl1 = new QVBoxLayout;
|
||||
@ -64,6 +69,7 @@ ExternSimDialog::ExternSimDialog(Schematic *sch,QWidget *parent) :
|
||||
QHBoxLayout *hl2 = new QHBoxLayout;
|
||||
hl2->addWidget(lblSimulator);
|
||||
hl2->addWidget(cbxSimualor);
|
||||
hl2->addWidget(buttonSimSettings);
|
||||
vl_top->addLayout(hl2);
|
||||
vl_top->addWidget(grp1);
|
||||
QHBoxLayout *hl1 = new QHBoxLayout;
|
||||
@ -171,6 +177,15 @@ void ExternSimDialog::slotStop()
|
||||
ngspice->killThemAll();
|
||||
}
|
||||
|
||||
void ExternSimDialog::slotSimSettings()
|
||||
{
|
||||
SimSettingsDialog *SetDlg = new SimSettingsDialog(this);
|
||||
if (SetDlg->exec()) {
|
||||
ngspice->setSimulatorCmd(QucsSettings.NgspiceExecutable);
|
||||
xyce->setSimulatorCmd(QucsSettings.XyceExecutable);
|
||||
}
|
||||
delete SetDlg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -35,6 +35,7 @@ private:
|
||||
QComboBox *cbxSimualor;
|
||||
QPushButton *buttonSimulate;
|
||||
QPushButton *buttonStopSim;
|
||||
QPushButton *buttonSimSettings;
|
||||
|
||||
QTextEdit *editSimConsole;
|
||||
|
||||
@ -61,6 +62,7 @@ private slots:
|
||||
void slotStart();
|
||||
void slotStop();
|
||||
void slotSetSimulator();
|
||||
void slotSimSettings();
|
||||
|
||||
};
|
||||
|
||||
|
93
qucs/extsimkernels/simsettingsdialog.cpp
Normal file
93
qucs/extsimkernels/simsettingsdialog.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
/***************************************************************************
|
||||
simsettingsdialog.cpp
|
||||
----------------
|
||||
begin : Tue Apr 21 2015
|
||||
copyright : (C) 2015 by Vadim Kuznetsov
|
||||
email : ra3xdh@gmail.com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "simsettingsdialog.h"
|
||||
#include "main.h"
|
||||
|
||||
SimSettingsDialog::SimSettingsDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
lblNgspice = new QLabel(tr("Ngspice executable location"));
|
||||
lblXyce = new QLabel(tr("Xyce executable location"));
|
||||
|
||||
edtNgspice = new QLineEdit(QucsSettings.NgspiceExecutable);
|
||||
edtXyce = new QLineEdit(QucsSettings.XyceExecutable);
|
||||
|
||||
btnOK = new QPushButton(tr("Apply changes"));
|
||||
connect(btnOK,SIGNAL(clicked()),this,SLOT(slotApply()));
|
||||
btnCancel = new QPushButton(tr("Cancel"));
|
||||
connect(btnCancel,SIGNAL(clicked()),this,SLOT(reject()));
|
||||
|
||||
btnSetNgspice = new QPushButton(tr("Select ..."));
|
||||
connect(btnSetNgspice,SIGNAL(clicked()),this,SLOT(slotSetNgspice()));
|
||||
btnSetXyce = new QPushButton(tr("Select.."));
|
||||
connect(btnSetXyce,SIGNAL(clicked()),this,SLOT(slotSetXyce()));
|
||||
|
||||
QVBoxLayout *top = new QVBoxLayout;
|
||||
top->addWidget(lblNgspice);
|
||||
QHBoxLayout *h1 = new QHBoxLayout;
|
||||
h1->addWidget(edtNgspice,3);
|
||||
h1->addWidget(btnSetNgspice,1);
|
||||
top->addLayout(h1);
|
||||
|
||||
top->addWidget(lblXyce);
|
||||
QHBoxLayout *h2 = new QHBoxLayout;
|
||||
h2->addWidget(edtXyce,3);
|
||||
h2->addWidget(btnSetXyce,1);
|
||||
top->addLayout(h2);
|
||||
|
||||
QHBoxLayout *h3 = new QHBoxLayout;
|
||||
h3->addWidget(btnOK);
|
||||
h3->addWidget(btnCancel);
|
||||
h3->addStretch(2);
|
||||
top->addLayout(h3);
|
||||
|
||||
this->setLayout(top);
|
||||
this->setFixedWidth(500);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SimSettingsDialog::slotApply()
|
||||
{
|
||||
QucsSettings.NgspiceExecutable = edtNgspice->text();
|
||||
QucsSettings.XyceExecutable = edtXyce->text();
|
||||
accept();
|
||||
}
|
||||
|
||||
void SimSettingsDialog::slotSetNgspice()
|
||||
{
|
||||
QFileDialog dialog(this,tr("Select Ngspice executable location"),edtNgspice->text(),"All files (*)");
|
||||
dialog.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
if (dialog.exec()) {
|
||||
edtNgspice->setText(dialog.selectedFile());
|
||||
}
|
||||
}
|
||||
|
||||
void SimSettingsDialog::slotSetXyce()
|
||||
{
|
||||
QFileDialog dialog(this,tr("Select Xyce executable location"),edtXyce->text(),"All files (*)");
|
||||
dialog.setAcceptMode(QFileDialog::AcceptOpen);
|
||||
if (dialog.exec()) {
|
||||
edtXyce->setText(dialog.selectedFile());
|
||||
}
|
||||
}
|
52
qucs/extsimkernels/simsettingsdialog.h
Normal file
52
qucs/extsimkernels/simsettingsdialog.h
Normal file
@ -0,0 +1,52 @@
|
||||
/***************************************************************************
|
||||
simsettingsdialog.h
|
||||
----------------
|
||||
begin : Tue Apr 21 2015
|
||||
copyright : (C) 2015 by Vadim Kuznetsov
|
||||
email : ra3xdh@gmail.com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SIMSETTINGSDIALOG_H
|
||||
#define SIMSETTINGSDIALOG_H
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
class SimSettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QLabel *lblXyce;
|
||||
QLabel *lblNgspice;
|
||||
|
||||
QLineEdit *edtNgspice;
|
||||
QLineEdit *edtXyce;
|
||||
|
||||
QPushButton *btnOK;
|
||||
QPushButton *btnCancel;
|
||||
|
||||
QPushButton *btnSetNgspice;
|
||||
QPushButton *btnSetXyce;
|
||||
|
||||
public:
|
||||
explicit SimSettingsDialog(QWidget *parent = 0);
|
||||
|
||||
|
||||
private slots:
|
||||
void slotApply();
|
||||
void slotSetNgspice();
|
||||
void slotSetXyce();
|
||||
|
||||
};
|
||||
|
||||
#endif // SIMSETTINGSDIALOG_H
|
@ -182,6 +182,8 @@ bool saveApplSettings()
|
||||
//settings.setValue("ExamplesDir", QucsSettings.ExamplesDir);
|
||||
//settings.setValue("DocDir", QucsSettings.DocDir);
|
||||
settings.setValue("OctaveBinDir", QucsSettings.OctaveBinDir.canonicalPath());
|
||||
settings.setValue("NgspiceExecutable",QucsSettings.NgspiceExecutable);
|
||||
settings.setValue("XyceExecutable",QucsSettings.XyceExecutable);
|
||||
settings.setValue("QucsHomeDir", QucsSettings.QucsHomeDir.canonicalPath());
|
||||
settings.setValue("IgnoreVersion", QucsSettings.IgnoreFutureVersion);
|
||||
settings.setValue("GraphAntiAliasing", QucsSettings.GraphAntiAliasing);
|
||||
|
Loading…
x
Reference in New Issue
Block a user