mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00
Implemented blacklisting libraries
Libraires may contain components that are default-simulator incompatible. For example RF-componenents library is SPICE-incompatible. And XSPICE devices libary is Qucs-incompatible. Blacklisting allows to hide undesired libraries in QucsLib library manager.
This commit is contained in:
parent
541f5c5d93
commit
a24152d92e
@ -19,6 +19,11 @@ SpiceOpamp.lib
|
||||
Xanalogue.lib
|
||||
)
|
||||
|
||||
INSTALL( FILES ${COMPLIBS} DESTINATION share/qucs/library )
|
||||
SET(BLACKLIST
|
||||
qucs.blacklist
|
||||
spice.blacklist
|
||||
)
|
||||
|
||||
INSTALL( FILES ${COMPLIBS} ${BLACKLIST} DESTINATION share/qucs/library )
|
||||
|
||||
ADD_SUBDIRECTORY( AnalogueCM )
|
||||
|
@ -28,7 +28,7 @@ SUBDIRS = AnalogueCM
|
||||
COMPLIBS = Transistors.lib Substrates.lib Diodes.lib MOSFETs.lib OpAmps.lib \
|
||||
Bridges.lib LEDs.lib JFETs.lib Z-Diodes.lib NMOSFETs.lib \
|
||||
PMOSFETs.lib Ideal.lib Regulators.lib Varistors.lib Cores.lib Transformers.lib \
|
||||
AnalogueCM.lib Xanalogue.lib
|
||||
AnalogueCM.lib Xanalogue.lib qucs.blacklist spice.blacklist
|
||||
|
||||
|
||||
|
||||
|
5
qucs-lib/library/qucs.blacklist
Normal file
5
qucs-lib/library/qucs.blacklist
Normal file
@ -0,0 +1,5 @@
|
||||
AnalogueCM.lib
|
||||
Cores.lib
|
||||
Transformers.lib
|
||||
Xanalogue.lib
|
||||
|
2
qucs-lib/library/spice.blacklist
Normal file
2
qucs-lib/library/spice.blacklist
Normal file
@ -0,0 +1,2 @@
|
||||
Substrates.lib
|
||||
|
@ -56,6 +56,9 @@ bool loadSettings()
|
||||
if(settings.contains("font"))QucsSettings.font.fromString(settings.value("font").toString());
|
||||
if(settings.contains("Language"))QucsSettings.Language=settings.value("Language").toString();
|
||||
|
||||
if(settings.contains("DefaultSimulator"))
|
||||
QucsSettings.DefaultSimulator = settings.value("DefaultSimulator").toInt();
|
||||
else QucsSettings.DefaultSimulator = spicecompat::simNotSpecified;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,8 @@
|
||||
#include "displaydialog.h"
|
||||
#include "symbolwidget.h"
|
||||
|
||||
#include "../qucs/extsimkernels/spicecompat.h"
|
||||
|
||||
|
||||
/* Constructor setups the GUI. */
|
||||
QucsLib::QucsLib()
|
||||
@ -189,6 +191,10 @@ void QucsLib::putLibrariesIntoCombobox()
|
||||
{
|
||||
//LibFiles = UserLibDir.entryList("*.lib", QDir::Files, QDir::Name);
|
||||
LibFiles = UserLibDir.entryList(QStringList("*.lib"), QDir::Files, QDir::Name);
|
||||
QStringList blacklist = getBlacklistedLibraries(UserLibDir.absolutePath());
|
||||
foreach(QString ss, blacklist) { // exclude blacklisted files
|
||||
LibFiles.removeAll(ss);
|
||||
}
|
||||
|
||||
UserLibCount = LibFiles.count();
|
||||
|
||||
@ -205,6 +211,10 @@ void QucsLib::putLibrariesIntoCombobox()
|
||||
|
||||
QDir LibDir(QucsSettings.LibDir);
|
||||
LibFiles = LibDir.entryList(QStringList("*.lib"), QDir::Files, QDir::Name);
|
||||
QStringList blacklist = getBlacklistedLibraries(QucsSettings.LibDir);
|
||||
foreach(QString ss, blacklist) { // exclude blacklisted files
|
||||
LibFiles.removeAll(ss);
|
||||
}
|
||||
|
||||
for(it = LibFiles.begin(); it != LibFiles.end(); it++)
|
||||
Library->addItem(QPixmap(":/bitmaps/big.qucs.xpm"), (*it).left((*it).length()-4));
|
||||
@ -524,3 +534,22 @@ void QucsLib::slotShowComponent(QListWidgetItem *Item)
|
||||
}
|
||||
|
||||
|
||||
QStringList QucsLib::getBlacklistedLibraries(QString dir)
|
||||
{
|
||||
QString filename;
|
||||
QStringList blacklisted_libs;
|
||||
blacklisted_libs.clear();
|
||||
if (QucsSettings.DefaultSimulator==spicecompat::simQucsator)
|
||||
filename = dir + QDir::separator()+ "qucs.blacklist";
|
||||
else filename = dir + QDir::separator() + "spice.blacklist";
|
||||
QFile f_blist(filename);
|
||||
if (!f_blist.open(QIODevice::ReadOnly)) return blacklisted_libs;
|
||||
|
||||
QTextStream ts(&f_blist);
|
||||
while (!ts.atEnd()) {
|
||||
QString lib = ts.readLine();
|
||||
if (!lib.isEmpty()) blacklisted_libs.append(lib);
|
||||
}
|
||||
f_blist.close();
|
||||
return blacklisted_libs;
|
||||
}
|
||||
|
@ -31,9 +31,12 @@
|
||||
|
||||
#include "symbolwidget.h"
|
||||
|
||||
#include "../qucs/extsimkernels/spicecompat.h"
|
||||
|
||||
|
||||
// Application settings.
|
||||
struct tQucsSettings {
|
||||
int DefaultSimulator;
|
||||
int x, y, dx, dy; // position and size of main window
|
||||
QFont font; // font
|
||||
QString LangDir; // translation directory
|
||||
@ -82,6 +85,8 @@ private:
|
||||
QTextEdit *CompDescr;
|
||||
QVBoxLayout *all;
|
||||
QLineEdit *CompSearch;
|
||||
|
||||
QStringList getBlacklistedLibraries(QString dir);
|
||||
};
|
||||
|
||||
#endif /* QUCSLIB_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user