Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixeds of SpiceLibComp #802

Merged
merged 4 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions qucs/extsimkernels/spicelibcompdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ SpiceLibCompDialog::SpiceLibCompDialog(Component *pc, Schematic *sch) : QDialog{
btnOpenSym = new QPushButton(tr("Open"));
edtSymFile = new QLineEdit();
connect(btnOpenSym,SIGNAL(clicked(bool)),this,SLOT(slotBtnOpenSym()));
connect(edtSymFile,SIGNAL(textChanged(QString)),this,SLOT(slotSetSymbol()));
connect(edtSymFile,SIGNAL(textChanged(QString)),this,SLOT(slotChanged()));

chbShowLib = new QCheckBox(tr("Show"));
chbShowLib->setChecked(show_lib);
Expand Down Expand Up @@ -197,6 +195,8 @@ SpiceLibCompDialog::SpiceLibCompDialog(Component *pc, Schematic *sch) : QDialog{
connect(tbwPinsTable,SIGNAL(cellChanged(int,int)),this,SLOT(slotChanged()));
connect(listSymPattern,SIGNAL(currentIndexChanged(int)),this,SLOT(slotChanged()));
connect(cbxSelectSubcir,SIGNAL(currentIndexChanged(int)),this,SLOT(slotChanged()));
connect(edtSymFile,SIGNAL(textChanged(QString)),this,SLOT(slotSetSymbol()));
connect(edtSymFile,SIGNAL(textChanged(QString)),this,SLOT(slotChanged()));

}

Expand Down Expand Up @@ -307,6 +307,7 @@ int SpiceLibCompDialog::parseLibFile(const QString &filename)

void SpiceLibCompDialog::slotSetSymbol()
{
int result = -1;
if (rbAutoSymbol->isChecked()) {
tbwPinsTable->setEnabled(false);
listSymPattern->setEnabled(false);
Expand All @@ -315,6 +316,7 @@ void SpiceLibCompDialog::slotSetSymbol()
QString s1 = "";
QString s2 = "SpLib";
symbol->setSymbol(s1, s1, s2);
result = 0;
symbol->setWarning(tr("No symbol loaded"));
symbolPinsCount = 0;
} else if (rbSymFromTemplate->isChecked()) {
Expand All @@ -324,16 +326,26 @@ void SpiceLibCompDialog::slotSetSymbol()
btnOpenSym->setEnabled(false);
QString dir_name = QucsSettings.BinDir + "/../share/" QUCS_NAME "/symbols/";
QString file = dir_name + listSymPattern->currentItem()->text() + ".sym";
symbol->loadSymFile(file);
result = symbol->loadSymFile(file);
symbolPinsCount = symbol->getPortsNumber();
} else if (rbUserSym->isChecked()) {
tbwPinsTable->setEnabled(true);
listSymPattern->setEnabled(false);
edtSymFile->setEnabled(true);
btnOpenSym->setEnabled(true);
symbol->loadSymFile(edtSymFile->text());
if (edtSymFile->text().isEmpty()) {
symbolPinsCount = 0;
return;
}
result = symbol->loadSymFile(edtSymFile->text());
symbolPinsCount = symbol->getPortsNumber();
}

if (result < 0) {
QMessageBox::critical(this,tr("Error"),tr("Failed to load symbol file!"));
return;
}

for (int i = 0; i < tbwPinsTable->rowCount(); i++) {
QTableWidgetItem *itm = new QTableWidgetItem("NC");
tbwPinsTable->setItem(i,1,itm);
Expand Down
10 changes: 6 additions & 4 deletions qucs/projectView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ ProjectView::refresh()
APPEND_ROW(m_model, tr("VHDL") );
APPEND_ROW(m_model, tr("Octave") );
APPEND_ROW(m_model, tr("Schematics") );
APPEND_ROW(m_model, tr("Symbols") );
APPEND_ROW(m_model, tr("SPICE") );
APPEND_ROW(m_model, tr("Others") );

Expand Down Expand Up @@ -139,13 +140,14 @@ ProjectView::refresh()
}
APPEND_CHILD(6, columnData);
}
}
else if ((extName == "cir") || (extName=="ckt") ||
(extName=="sp")) {
} else if (extName == "sym") {
APPEND_CHILD(7,columnData);
} else if ((extName == "cir") || (extName=="ckt") ||
(extName=="sp")) {
APPEND_CHILD(8,columnData);
}
else {
APPEND_CHILD(8, columnData);
APPEND_CHILD(9, columnData);
}
}

Expand Down
2 changes: 1 addition & 1 deletion qucs/qucs_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ void QucsApp::initActions()
helpGetStart->setWhatsThis(tr("Getting Started\n\nShort introduction into Qucs"));
connect(helpGetStart, SIGNAL(triggered()), SLOT(slotGettingStarted()));

helpAboutApp = new QAction(tr("&About qucs-s"), this);
helpAboutApp = new QAction(tr("&About Qucs-S"), this);
helpAboutApp->setStatusTip(tr("About the application"));
helpAboutApp->setWhatsThis(tr("About\n\nAbout the application"));
connect(helpAboutApp, SIGNAL(triggered()),this, SLOT(slotHelpAbout()));
Expand Down
2 changes: 1 addition & 1 deletion qucs/spicecomponents/spicelibcomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void SpiceLibComp::createSymbol()
{
int No;
QString FileName;
QString symname = Props.at(2)->Value;
QString symname = misc::properAbsFileName(Props.at(2)->Value, containingSchematic);
if (QFileInfo::exists(symname)) {
FileName = symname;
} else {
Expand Down
Loading