diff --git a/qucs/extsimkernels/spicelibcompdialog.cpp b/qucs/extsimkernels/spicelibcompdialog.cpp index 817ac586..2e2ff1b4 100644 --- a/qucs/extsimkernels/spicelibcompdialog.cpp +++ b/qucs/extsimkernels/spicelibcompdialog.cpp @@ -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); @@ -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())); } @@ -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); @@ -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()) { @@ -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); diff --git a/qucs/projectView.cpp b/qucs/projectView.cpp index 24f4878f..1d09e73b 100644 --- a/qucs/projectView.cpp +++ b/qucs/projectView.cpp @@ -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") ); @@ -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); } } diff --git a/qucs/qucs_init.cpp b/qucs/qucs_init.cpp index e676b9f9..7dd099de 100644 --- a/qucs/qucs_init.cpp +++ b/qucs/qucs_init.cpp @@ -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())); diff --git a/qucs/spicecomponents/spicelibcomp.cpp b/qucs/spicecomponents/spicelibcomp.cpp index e96d70cd..8e0f4600 100644 --- a/qucs/spicecomponents/spicelibcomp.cpp +++ b/qucs/spicecomponents/spicelibcomp.cpp @@ -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 {