static void resolveLibrary() { QLibrary lib; #ifdef LIBRESOLV_SO lib.setFileName(QStringLiteral(LIBRESOLV_SO)); if (!lib.load()) #endif { lib.setFileName(QLatin1String("resolv")); if (!lib.load()) return; } local_dn_expand = dn_expand_proto(lib.resolve("__dn_expand")); if (!local_dn_expand) local_dn_expand = dn_expand_proto(lib.resolve("dn_expand")); local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose")); if (!local_res_nclose) local_res_nclose = res_nclose_proto(lib.resolve("res_9_nclose")); if (!local_res_nclose) local_res_nclose = res_nclose_proto(lib.resolve("res_nclose")); local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit")); if (!local_res_ninit) local_res_ninit = res_ninit_proto(lib.resolve("res_9_ninit")); if (!local_res_ninit) local_res_ninit = res_ninit_proto(lib.resolve("res_ninit")); local_res_nquery = res_nquery_proto(lib.resolve("__res_nquery")); if (!local_res_nquery) local_res_nquery = res_nquery_proto(lib.resolve("res_9_nquery")); if (!local_res_nquery) local_res_nquery = res_nquery_proto(lib.resolve("res_nquery")); }
bool load() { m_libUdev.setLoadHints(QLibrary::ResolveAllSymbolsHint); m_libUdev.setFileNameAndVersion(QStringLiteral("udev"), 1); m_loaded = m_libUdev.load(); if (resolveMethods()) return true; m_libUdev.setFileNameAndVersion(QStringLiteral("udev"), 0); m_loaded = m_libUdev.load(); return resolveMethods(); }
QLibrary* RazorPluginInfo::loadLibrary(const QString& libDir) const { QString baseName, path; QFileInfo fi = QFileInfo(fileName()); path = fi.canonicalPath(); baseName = value("X-Razor-Library", fi.completeBaseName()).toString(); QString soPath = QString("%1/lib%2.so").arg(libDir, baseName); QLibrary* library = new QLibrary(soPath); if (!library->load()) { qWarning() << QString("Can't load plugin lib \"%1\"").arg(soPath) << library->errorString(); delete library; return 0; } QString locale = QLocale::system().name(); QTranslator* translator = new QTranslator(library); translator->load(QString("%1/%2/%2_%3.qm").arg(path, baseName, locale)); qApp->installTranslator(translator); return library; }
bool FirebirdDriver::initialize() { if (_library != NULL) return true; FirebirdConfig config; if (!config.load()) return error("Can't read firebird.cfg file"); // Set firebird install directory #ifdef WIN32 SetEnvironmentVariable("INTERBASE", parseDir(config.installDir)); SetEnvironmentVariable("FIREBIRD", parseDir(config.installDir)); #else setenv("INTERBASE", parseDir(config.installDir), true); setenv("FIREBIRD", parseDir(config.installDir), true); #endif // Try to load the library QLibrary* library = new QLibrary(config.library); if (!library->load()) { libraryError(); delete library; return error("Can't load firebird library: " + config.library); } _library = library; _procs = new FirebirdProcs(_library); return true; }
void Converter::initialize() { initialized = true; QLibrary libopencc; libopencc.setFileNameAndVersion("opencc", "1.0.0"); if (!libopencc.load()) return; opencc_open = (opencc_t (*)(const char *))libopencc.resolve("opencc_open"); if (opencc_open == NULL) return; opencc_close = (int (*)(opencc_t))libopencc.resolve("opencc_close"); if (opencc_close == NULL) return; opencc_convert_utf8 = (char * (*)(opencc_t, const char *, size_t))libopencc.resolve("opencc_convert_utf8"); if (opencc_convert_utf8 == NULL) return; opencc_errno = (opencc_error (*)(void))libopencc.resolve("opencc_errno"); if (opencc_errno == NULL) return; opencc_perror = (void (*)(const char *))libopencc.resolve("opencc_perror"); if (opencc_perror == NULL) return; s_loaded = true; }
bool load(const char* dllname) { if (library(dllname)) { DBG("'%s' is already loaded\n", dllname); return true; } std::list<std::string> libnames = sLibNamesMap[dllname]; if (libnames.empty()) libnames.push_back(dllname); std::list<std::string>::const_iterator it; QLibrary *dll = new QLibrary(); for (it = libnames.begin(); it != libnames.end(); ++it) { dll->setFileName((*it).c_str()); if (dll->load()) break; DBG("%s\n", dll->errorString().toLocal8Bit().constData()); //why qDebug use toUtf8() and printf use toLocal8Bit()? } if (it == libnames.end()) { DBG("No dll loaded\n"); delete dll; return false; } DBG("'%s' is loaded~~~\n", dll->fileName().toUtf8().constData()); sDllMap[dllname] = dll; //map.insert will not replace the old one return true; }
Garmin::IDevice * CDeviceGarmin::getDevice() { Garmin::IDevice * (*func)(const char*) = 0; Garmin::IDevice * dev = 0; #if defined(Q_OS_MAC) // MacOS X: plug-ins are stored in the bundle folder QString libname = QString("%1/lib%2" XSTR(SHARED_LIB_EXT)) .arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), "Resources/Drivers")) .arg(devkey); #else QString libname = QString("%1/lib%2" XSTR(SHARED_LIB_EXT)).arg(XSTR(PLUGINDIR)).arg(devkey); #endif QString funcname = QString("init%1").arg(devkey); QLibrary lib; lib.setFileName(libname); bool lib_loaded = lib.load(); if (lib_loaded) { func = (Garmin::IDevice * (*)(const char*))lib.resolve(funcname.toLatin1()); } if(!lib_loaded || func == 0) { QMessageBox warn; warn.setIcon(QMessageBox::Warning); warn.setWindowTitle(tr("Error ...")); warn.setText(tr("Failed to load driver.")); warn.setDetailedText(lib.errorString()); warn.setStandardButtons(QMessageBox::Ok); warn.exec(); return 0; } dev = func(INTERFACE_VERSION); if(dev == 0) { QMessageBox warn; warn.setIcon(QMessageBox::Warning); warn.setWindowTitle(tr("Error ...")); warn.setText(tr("Driver version mismatch.")); QString detail = QString( tr("The version of your driver plugin \"%1\" does not match the version QLandkarteGT expects (\"%2\").") ).arg(libname).arg(INTERFACE_VERSION); warn.setDetailedText(detail); warn.setStandardButtons(QMessageBox::Ok); warn.exec(); func = 0; } if(dev) { dev->setPort(port.toLatin1()); dev->setGuiCallback(GUICallback,this); } return dev; }
//General library functions void LoadLibraries(void) { //Load Library eCompass if(!eCompass.isLoaded()) { eCompass.load(); } if(!Altimeter.isLoaded()) { Altimeter.load(); } if(!Nordic.isLoaded()) { Nordic.load(); } if(!GPS.isLoaded()) { GPS.load(); } }
//---------------------------------------------------------------------------- void ctkPluginFrameworkContext::init() { log() << "initializing"; if (firstInit && ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT == props[ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN]) { deleteFWDir(); firstInit = false; } // Pre-load libraries // This may speed up installing new plug-ins if they have dependencies on // one of these libraries. It prevents repeated loading and unloading of the // pre-loaded libraries during caching of the plug-in meta-data. if (props[ctkPluginConstants::FRAMEWORK_PRELOAD_LIBRARIES].isValid()) { QStringList preloadLibs = props[ctkPluginConstants::FRAMEWORK_PRELOAD_LIBRARIES].toStringList(); QLibrary::LoadHints loadHints; QVariant loadHintsVariant = props[ctkPluginConstants::FRAMEWORK_PLUGIN_LOAD_HINTS]; if (loadHintsVariant.isValid()) { loadHints = loadHintsVariant.value<QLibrary::LoadHints>(); } foreach(QString preloadLib, preloadLibs) { QLibrary lib; QStringList nameAndVersion = preloadLib.split(":"); QString libraryName; if (nameAndVersion.count() == 1) { libraryName = nameAndVersion.front(); lib.setFileName(nameAndVersion.front()); } else if (nameAndVersion.count() == 2) { libraryName = nameAndVersion.front() + "." + nameAndVersion.back(); lib.setFileNameAndVersion(nameAndVersion.front(), nameAndVersion.back()); } else { qWarning() << "Wrong syntax in" << preloadLib << ". Use <lib-name>[:version]. Skipping."; continue; } lib.setLoadHints(loadHints); log() << "Pre-loading library" << lib.fileName() << "with hints [" << static_cast<int>(loadHints) << "]"; if (!lib.load()) { qWarning() << "Pre-loading library" << lib.fileName() << "failed:" << lib.errorString() << "\nCheck your library search paths."; } }
void tst_QLibrary::errorString() { QFETCH(int, operation); QFETCH(QString, fileName); QFETCH(bool, success); QFETCH(QString, errorString); QLibrary lib; if (!(operation & DontSetFileName)) { lib.setFileName(fileName); } bool ok = false; switch (operation & OperationMask) { case Load: ok = lib.load(); break; case Unload: ok = lib.load(); //### ok = lib.unload(); break; case Resolve: { ok = lib.load(); QCOMPARE(ok, true); if (success) { ok = lib.resolve("mylibversion"); } else { ok = lib.resolve("nosuchsymbol"); } break;} default: QFAIL(qPrintable(QString("Unknown operation: %1").arg(operation))); break; } QRegExp re(errorString); QString libErrorString = lib.errorString(); QVERIFY(!lib.isLoaded() || lib.unload()); QVERIFY2(re.exactMatch(libErrorString), qPrintable(libErrorString)); QCOMPARE(ok, success); }
qint64 GetLibAPILevel (const QString& file) { if (file.isEmpty ()) return static_cast<quint64> (-1); QLibrary library (file); if (!library.load ()) return static_cast<quint64> (-1); typedef quint64 (*APIVersion_t) (); auto getter = reinterpret_cast<APIVersion_t> (library.resolve ("GetAPILevels")); return getter ? getter () : static_cast<quint64> (-1); }
static bool resolveLibraryInternal() { #if QT_CONFIG(library) && !defined(Q_OS_QNX) QLibrary lib; #ifdef LIBRESOLV_SO lib.setFileName(QStringLiteral(LIBRESOLV_SO)); if (!lib.load()) #endif { lib.setFileName(QLatin1String("resolv")); if (!lib.load()) return false; } local_res_init = res_init_proto(lib.resolve("__res_init")); if (!local_res_init) local_res_init = res_init_proto(lib.resolve("res_init")); local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit")); if (!local_res_ninit) local_res_ninit = res_ninit_proto(lib.resolve("res_ninit")); if (!local_res_ninit) { // if we can't get a thread-safe context, we have to use the global _res state local_res = res_state_ptr(lib.resolve("_res")); } else { local_res_nclose = res_nclose_proto(lib.resolve("res_nclose")); if (!local_res_nclose) local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose")); if (!local_res_nclose) local_res_ninit = 0; } #endif return true; }
QLibrary *QgsAuthMethodRegistry::authMethodLibrary( const QString &authMethodKey ) const { QLibrary *myLib = new QLibrary( library( authMethodKey ) ); QgsDebugMsg( "Library name is " + myLib->fileName() ); if ( myLib->load() ) return myLib; QgsDebugMsg( "Cannot load library: " + myLib->errorString() ); delete myLib; return 0; }
QLibrary *QgsProviderRegistry::providerLibrary( QString const & providerKey ) const { QLibrary *myLib = new QLibrary( library( providerKey ) ); QgsDebugMsg( "Library name is " + myLib->fileName() ); if ( myLib->load() ) return myLib; QgsDebugMsg( "Cannot load library: " + myLib->errorString() ); delete myLib; return 0; }
PlazaClient::PlazaClient(QWidget *parent) :QWidget(parent) ,ui(new Ui::wgtPlazaMainUI) ,m_process(NULL) { ui->setupUi(this); connect(ui->btnStartGame,SIGNAL(clicked()),this,SLOT(sltStartGame())); connect(ui->btnSendData,SIGNAL(clicked()),this,SLOT(sltSendData())); connect(ui->btnCloseGame,SIGNAL(clicked()),this,SLOT(sltGameClosed())); connect(qApp,SIGNAL(aboutToQuit()),this,SLOT()); QLibrary *libChannelModule = new QLibrary(this); #if defined(Q_OS_WIN) #if defined(QT_DEBUG) libChannelModule->setFileName("H:/MyProjects/QtBasis/IPCTest/build-Debug/ChannelModule/debug/ChannelModule.dll"); #elif defined(QT_RELEASE) libChannelModule->setFileName("H:/MyProjects/QtBasis/IPCTest/build-Release/ChannelModule/release/ChannelModule.dll"); #endif #elif defined(Q_OS_LINUX) #if defined(QT_DEBUG) libChannelModule->setFileName("H:/MyProjects/QtBasis/IPCTest/build-Debug/ChannelModule/debug/ChannelModule.dll"); #elif defined(QT_RELEASE) libChannelModule->setFileName("H:/MyProjects/QtBasis/IPCTest/build-Release/ChannelModule/release/ChannelModule.dll"); #endif #endif if(!libChannelModule->load()) { qDebug() << "PlazaUI initial failed:ChannelModule load failed.ErrorString:" << libChannelModule->errorString() << endl; } else { pCreate f = (pCreate)libChannelModule->resolve("create"); if(f) { m_pChannelModule = f(); } else { qDebug() << Utility::instance()->strErrorPosition(QString::fromUtf8(__FILE__), QString::fromUtf8(__FUNCTION__), __LINE__) << libChannelModule->errorString() << endl; } } }
bool PluginManager::loadPlugin(QString file, bool silent) { QLibrary* library = new QLibrary(file); if(!library->load()) { if(!silent) { QMessageBox::critical (_gi, tr("Error loading plugin"), library->errorString()); } return false; } std::cout << file.toStdString() << " loaded" << std::endl; QFunctionPointer ptr = library->resolve("loadPlugin"); if(ptr == 0) { if(!silent) { QMessageBox::critical (_gi, tr("Error loading plugin"), tr("Could not find the plugin's entry point \"loadPlugin\"")); } return false; } std::cout << file.toStdString() << ": entry point found" << std::endl; typedef Plugin* (*entryPoint)(); entryPoint getPlugin = reinterpret_cast<entryPoint>(ptr); Plugin* plugin = getPlugin(); if(plugin==NULL) { if(!silent) { QMessageBox::critical (_gi, tr("Error loading plugin"), tr("The getPlugin entry point does not return a valid Plugin")); } return false; } std::cout << file.toStdString() << ": got Plugin" << std::endl; vector<GenericOperation*> operations = plugin->getOperations(); std::cout << "Plugin " << plugin->getName() << " loaded : " << operations.size() << " operations "<< std::endl; //PluginService* pluginService = new PluginService(plugin); _plugins.insert(pair<string,Plugin*>(file.toStdString(), plugin)); _libraries.insert(pair<Plugin*,QLibrary*>(plugin, library)); //_gi->addService(pluginService); emit addPlugin(plugin); return true; }
void SupportLibraryLoader::loadLibraries() const{ std::map<quint32, QString> order; QLibrary lib; bool ok = order.size() > 0; for(auto name : _order){ QFileInfo file; if (QFileInfo(name.second).exists()) { file = QFileInfo(name.second); } else { file = QFileInfo(_configLocation.absolutePath() + "/../" + name.second); } QString path = file.canonicalFilePath(); lib.setFileName(path); ok = lib.load(); if ( !ok){ kernel()->issues()->log(TR("Could not load library ") + path + ",error :" + lib.errorString()); } } }
void SupportLibraryLoader::loadLibraries() const{ std::map<quint32, QString> order; QLibrary lib; bool ok = order.size() > 0; for(auto name : _order){ QFileInfo file; if (QFileInfo(name.second).exists()) { file = QFileInfo(name.second); } else { file = QFileInfo(_configLocation.absolutePath() + "/../" + name.second); } QString path = file.canonicalFilePath(); lib.setFileName(path); ok = lib.load(); if ( !ok){ ERROR2(ERR_COULD_NOT_LOAD_2, TR("name"), "connector"); } } }
bool PluginLoader::loadAll(QString from){ QDir dir(from); QStringList listfile; listfile = dir.entryList("*.*"); #ifdef MYDEBUG qDebug(from.latin1()); #endif for(int i = 2; i<listfile.size();i++){ #ifdef MYDEBUG qDebug("Pillo ficheros"); qDebug(listfile[i].latin1()); #endif QLibrary * lib = new QLibrary(dir.path()+QString("/")+listfile[i]); if(lib->load()){ _pluginlist.push_back(lib); #ifdef MYDEBUG qDebug("Se añadio a la lista de plugins"); #endif } } for(int i=0;i<_pluginlist.size();i++){ getPluginType getP = (getPluginType)_pluginlist[i]->resolve("getMVPlugin"); if(getP){ ModelsViewPlugin * modv = NULL; modv = getP(); if(modv){ _viewerlist.push_back(modv); QStringList l = modv->keys(); for(int j = 0 ; j<l.size();j++) if(_keys.findIndex(l[j])==-1) _keys<<l[j]; } #ifdef MYDEBUG else qDebug("En Plugin no se cargo nada"); #endif } } return true; }
void tst_QLibrary::loadHints() { QFETCH( QString, lib ); QFETCH( int, loadHints); QFETCH( bool, result ); //QLibrary library( lib ); QLibrary library; QLibrary::LoadHints lh(loadHints); if (int(loadHints) != 0) { lh |= library.loadHints(); library.setLoadHints(lh); } library.setFileName(lib); QCOMPARE(library.loadHints(), lh); bool ok = library.load(); if ( result ) { QVERIFY( ok ); QVERIFY(library.unload()); } else { QVERIFY( !ok ); } }
SnoopWinDivertLib() { WinDivertOpen = NULL; WinDivertClose = NULL; WinDivertSetParam = NULL; WinDivertRecv = NULL; WinDivertSend = NULL; ok = false; lib = new QLibrary("WinDivert.dll"); if (!lib->load()) { LOG_FATAL("lib->load() return false"); return; // gilgil temp 2013.11.29 } if ((WinDivertOpen = (WinDivertOpenFunc) lib->resolve("WinDivertOpen")) == NULL) LOG_FATAL("can not find WinDivertOpen"); if ((WinDivertClose = (WinDivertCloseFunc) lib->resolve("WinDivertClose")) == NULL) LOG_FATAL("can not find WinDivertClose"); if ((WinDivertSetParam = (WinDivertSetParamFunc)lib->resolve("WinDivertSetParam")) == NULL) LOG_FATAL("can not find WinDivertSetParam"); if ((WinDivertRecv = (WinDivertRecvFunc) lib->resolve("WinDivertRecv")) == NULL) LOG_FATAL("can not find WinDivertRecv"); if ((WinDivertSend = (WinDivertSendFunc) lib->resolve("WinDivertSend")) == NULL) LOG_FATAL("can not find WinDivertSend"); ok = true; }
void Init( bool b, int rate2, int bits2, int chn2, int /*buff*/ ) { mustReset = false; if ( !b ) { Save.odczytajopcje(); fs.Init(); fs.ApplyB(); } PlErr = false; if ( b ) { if ( !isOpen ) { if ( !pa_lib.isLoaded() ) { QString libName = "libpulse-simple" + libExt; #ifdef Q_WS_X11 libName += ".0"; #endif pa_lib.setFileName( libName ); if ( !pa_lib.load() ) { errStr = pa_lib.errorString(); PlErr = true; return; } qmplay_pa_simple_new = ( _qmplay_pa_simple_new )pa_lib.resolve( "pa_simple_new" ); qmplay_pa_simple_free = ( _qmplay_pa_simple_free )pa_lib.resolve( "pa_simple_free" ); qmplay_pa_simple_write = ( _qmplay_pa_simple_write )pa_lib.resolve( "pa_simple_write" ); qmplay_pa_simple_read = ( _qmplay_pa_simple_read )pa_lib.resolve( "pa_simple_read" ); qmplay_pa_simple_flush = ( _qmplay_pa_simple_flush )pa_lib.resolve( "pa_simple_flush" ); if ( !qmplay_pa_simple_new || !qmplay_pa_simple_free || !qmplay_pa_simple_write || !qmplay_pa_simple_read || !qmplay_pa_simple_flush ) { pa_lib.unload(); errStr = "błąd podczas pobierania funkcji z biblioteki: " + libName; PlErr = true; return; } } switch ( bits2 ) { case 8: ss.format = PA_SAMPLE_U8; break; case 16: ss.format = PA_SAMPLE_S16NE; break; case 24: ss.format = PA_SAMPLE_S24NE; break; case 32: ss.format = PA_SAMPLE_S32NE; break; } ss.channels = chn2; ss.rate = rate2; attr.maxlength = ( uint32_t ) -1; attr.tlength = delay * ( rate2 * ( bits2/8 ) * chn2 ); attr.prebuf = ( uint32_t ) -1; attr.minreq = ( uint32_t ) -1; attr.fragsize = attr.tlength; pa_channel_map *chn_map = NULL; if ( chn2 > 2 && chn2 <= 8 ) { chn_map = new pa_channel_map; chn_map->channels = chn2; chn_map->map[ 0 ] = PA_CHANNEL_POSITION_FRONT_LEFT; chn_map->map[ 1 ] = PA_CHANNEL_POSITION_FRONT_RIGHT; chn_map->map[ 2 ] = PA_CHANNEL_POSITION_FRONT_CENTER; chn_map->map[ 3 ] = PA_CHANNEL_POSITION_LFE; chn_map->map[ 4 ] = PA_CHANNEL_POSITION_REAR_LEFT; chn_map->map[ 5 ] = PA_CHANNEL_POSITION_REAR_RIGHT; chn_map->map[ 6 ] = PA_CHANNEL_POSITION_SIDE_LEFT; chn_map->map[ 7 ] = PA_CHANNEL_POSITION_SIDE_RIGHT; } pulse = qmplay_pa_simple_new( NULL, "QMPlay", PA_STREAM_PLAYBACK, NULL, "Output", &ss, chn_map, &attr, NULL ); delete chn_map; if ( !pulse ) { pa_lib.unload(); errStr = "błąd podczas otwierania wyjścia PulseAudio"; PlErr = true; return; } if ( REC ) { pulseREC = qmplay_pa_simple_new( NULL, "QMPlay", PA_STREAM_RECORD, NULL, "Input", &ss, chn_map, &attr, NULL ); if ( !pulseREC ) { qmplay_pa_simple_free( pulse ); pa_lib.unload(); errStr = "błąd podczas otwierania wejścia PulseAudio"; PlErr = true; return; } } isOpen = true; } } }
void QgsPluginManager::getPluginDescriptions() { QString sharedLibExtension; #ifdef WIN32 sharedLibExtension = "*.dll"; #else sharedLibExtension = "*.so*"; #endif // check all libs in the current ans user plugins directories, and get name and descriptions QSettings settings; QStringList myPathList( lblPluginDir->text() ); QString myPaths = settings.value( "plugins/searchPathsForPlugins", "" ).toString(); if ( !myPaths.isEmpty() ) { myPathList.append( myPaths.split( "|" ) ); } for ( int j = 0; j < myPathList.size(); ++j ) { QString myPluginDir = myPathList.at( j ); QDir pluginDir( myPluginDir, sharedLibExtension, QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::NoSymLinks ); if ( pluginDir.count() == 0 ) { QMessageBox::information( this, tr( "No Plugins" ), tr( "No QGIS plugins found in %1" ).arg( myPluginDir ) ); return; } QgsDebugMsg( "PLUGIN MANAGER:" ); for ( uint i = 0; i < pluginDir.count(); i++ ) { QString lib = QString( "%1/%2" ).arg( myPluginDir ).arg( pluginDir[i] ); #ifdef TESTLIB // This doesn't work on WIN32 and causes problems with plugins // on OS X (the code doesn't cause a problem but including dlfcn.h // renders plugins unloadable) #if !defined(WIN32) && !defined(Q_OS_MACX) // test code to help debug loading problems // This doesn't work on WIN32 and causes problems with plugins // on OS X (the code doesn't cause a problem but including dlfcn.h // renders plugins unloadable) //void *handle = dlopen((const char *) lib, RTLD_LAZY); void *handle = dlopen( lib.toLocal8Bit().data(), RTLD_LAZY | RTLD_GLOBAL ); if ( !handle ) { QgsDebugMsg( "Error in dlopen: " ); QgsDebugMsg( dlerror() ); } else { QgsDebugMsg( "dlopen suceeded for " + lib ); dlclose( handle ); } #endif //#ifndef WIN32 && Q_OS_MACX #endif //#ifdef TESTLIB QgsDebugMsg( "Examining: " + lib ); QLibrary *myLib = new QLibrary( lib ); bool loaded = myLib->load(); if ( !loaded ) { QgsDebugMsg( QString( "Failed to load: %1 (%2)" ).arg( myLib->fileName() ).arg( myLib->errorString() ) ); delete myLib; continue; } QgsDebugMsg( "Loaded library: " + myLib->fileName() ); // Don't bother with libraries that are providers //if(!myLib->resolve("isProvider")) //MH: Replaced to allow for plugins that are linked to providers //type is only used in non-provider plugins if ( !myLib->resolve( "type" ) ) { delete myLib; continue; } // resolve the metadata from plugin name_t *pName = ( name_t * ) cast_to_fptr( myLib->resolve( "name" ) ); description_t *pDesc = ( description_t * ) cast_to_fptr( myLib->resolve( "description" ) ); category_t *pCat = ( category_t * ) cast_to_fptr( myLib->resolve( "category" ) ); version_t *pVersion = ( version_t * ) cast_to_fptr( myLib->resolve( "version" ) ); icon_t* pIcon = ( icon_t * ) cast_to_fptr( myLib->resolve( "icon" ) ); // show the values (or lack of) for each function if ( pName ) { QgsDebugMsg( "Plugin name: " + pName() ); } else { QgsDebugMsg( "Plugin name not returned when queried" ); } if ( pDesc ) { QgsDebugMsg( "Plugin description: " + pDesc() ); } else { QgsDebugMsg( "Plugin description not returned when queried" ); } if ( pCat ) { QgsDebugMsg( "Plugin category: " + pCat() ); } else { QgsDebugMsg( "Plugin category not returned when queried" ); } if ( pVersion ) { QgsDebugMsg( "Plugin version: " + pVersion() ); } else { QgsDebugMsg( "Plugin version not returned when queried" ); } if ( pIcon ) { QgsDebugMsg( "Plugin icon: " + pIcon() ); } if ( !pName || !pDesc || !pVersion ) { QgsDebugMsg( "Failed to get name, description, or type for " + myLib->fileName() ); delete myLib; continue; } QString pluginName = pName(); QString pluginDesc = pDesc(); // if no category defined - use default value QString pluginCat = ( pCat ? pCat() : tr( "Plugins" ) ); QString pluginVersion = pVersion(); QString pluginIconFileName = ( pIcon ? pIcon() : QString() ); QString baseName = QFileInfo( lib ).baseName(); QString myLibraryName = pluginDir[i]; // filtering will be done on the display role so give it name and desription // user wont see this text since we are using a custome delegate QStandardItem * mypDetailItem = new QStandardItem( pluginName + " - " + pluginDesc ); mypDetailItem->setData( myLibraryName, PLUGIN_LIBRARY_ROLE ); mypDetailItem->setData( myPluginDir, PLUGIN_DIRECTORY_ROLE ); mypDetailItem->setData( baseName, PLUGIN_BASE_NAME_ROLE ); //for matching in registry later QgsDetailedItemData myData; myData.setTitle( pluginName ); myData.setDetail( pluginDesc ); myData.setCategory( tr( "Installed in %1 menu/toolbar" ).arg( pluginCat ) ); myData.setRenderAsWidget( false ); myData.setCheckable( true ); myData.setChecked( false ); //start unchecked - we will check it later if needed if ( pluginIconFileName.isEmpty() ) myData.setIcon( QPixmap( QgsApplication::defaultThemePath() + "/plugin.png" ) ); else myData.setIcon( QPixmap( pluginIconFileName ) ); QgsDebugMsg( "Getting an instance of the QgsPluginRegistry" ); // check to see if the plugin is loaded and set the checkbox accordingly QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance(); // get the library using the plugin description if ( !pRegistry->isLoaded( baseName ) ) { QgsDebugMsg( "Couldn't find plugin in the registry" ); } else { QgsDebugMsg( "Found plugin in the registry" ); // TODO: this check shouldn't be necessary, plugin base names must be unique if ( pRegistry->library( baseName ) == myLib->fileName() ) { // set the checkbox myData.setChecked( true ); } } QVariant myVariant = qVariantFromValue( myData ); mypDetailItem->setData( myVariant, PLUGIN_DATA_ROLE ); // Add items to model mModelPlugins->appendRow( mypDetailItem ); delete myLib; } } }
// this is static QString QgsNewVectorLayerDialog::runAndCreateLayer( QWidget* parent, QString* pEnc ) { QgsNewVectorLayerDialog geomDialog( parent ); if ( geomDialog.exec() == QDialog::Rejected ) { return QLatin1String( "" ); } QgsWkbTypes::Type geometrytype = geomDialog.selectedType(); QString fileformat = geomDialog.selectedFileFormat(); QString enc = geomDialog.selectedFileEncoding(); int crsId = geomDialog.selectedCrsId(); QgsDebugMsg( QString( "New file format will be: %1" ).arg( fileformat ) ); QList< QPair<QString, QString> > attributes; geomDialog.attributes( attributes ); QSettings settings; QString lastUsedDir = settings.value( QStringLiteral( "/UI/lastVectorFileFilterDir" ), QDir::homePath() ).toString(); QString filterString = QgsVectorFileWriter::filterForDriver( fileformat ); QString fileName = QFileDialog::getSaveFileName( nullptr, tr( "Save layer as..." ), lastUsedDir, filterString ); if ( fileName.isNull() ) { return QLatin1String( "" ); } if ( fileformat == QLatin1String( "ESRI Shapefile" ) && !fileName.endsWith( QLatin1String( ".shp" ), Qt::CaseInsensitive ) ) fileName += QLatin1String( ".shp" ); settings.setValue( QStringLiteral( "/UI/lastVectorFileFilterDir" ), QFileInfo( fileName ).absolutePath() ); settings.setValue( QStringLiteral( "/UI/encoding" ), enc ); //try to create the new layer with OGRProvider instead of QgsVectorFileWriter QgsProviderRegistry * pReg = QgsProviderRegistry::instance(); QString ogrlib = pReg->library( QStringLiteral( "ogr" ) ); // load the data provider QLibrary* myLib = new QLibrary( ogrlib ); bool loaded = myLib->load(); if ( loaded ) { QgsDebugMsg( "ogr provider loaded" ); typedef bool ( *createEmptyDataSourceProc )( const QString&, const QString&, const QString&, QgsWkbTypes::Type, const QList< QPair<QString, QString> >&, const QgsCoordinateReferenceSystem & ); createEmptyDataSourceProc createEmptyDataSource = ( createEmptyDataSourceProc ) cast_to_fptr( myLib->resolve( "createEmptyDataSource" ) ); if ( createEmptyDataSource ) { if ( geometrytype != QgsWkbTypes::Unknown ) { QgsCoordinateReferenceSystem srs = QgsCoordinateReferenceSystem::fromSrsId( crsId ); if ( !createEmptyDataSource( fileName, fileformat, enc, geometrytype, attributes, srs ) ) { return QString::null; } } else { QgsDebugMsg( "geometry type not recognised" ); return QString::null; } } else { QgsDebugMsg( "Resolving newEmptyDataSource(...) failed" ); return QString::null; } } if ( pEnc ) *pEnc = enc; return fileName; }
bool KviModuleManager::loadModule(const QString &modName) { if(findModule(modName)) { //qDebug("MODULE %s ALREADY IN CORE MEMORY",modName); return true; } QString tmp; QString szName; #if defined(COMPILE_ON_WINDOWS) KviQString::appendFormatted(szName,"kvi%Q.dll",&modName); #elif defined(COMPILE_ON_MINGW) KviQString::appendFormatted(szName,"libkvi%Q.dll",&modName); #else KviQString::appendFormatted(szName,"libkvi%Q.so",&modName); #endif szName=szName.toLower(); g_pApp->getLocalKvircDirectory(tmp,KviApplication::Modules,szName); if(!KviFileUtils::fileExists(tmp)) { g_pApp->getGlobalKvircDirectory(tmp,KviApplication::Modules,szName); } QLibrary* pLibrary = new QLibrary(tmp); pLibrary->setLoadHints(QLibrary::ExportExternalSymbolsHint); if(!pLibrary->load()) { m_szLastError = pLibrary->errorString(); delete pLibrary; return false; } KviModuleInfo * info = (KviModuleInfo *)pLibrary->resolve(KVIRC_MODULE_STRUCTURE_SYMBOL); if(!info) { m_szLastError = __tr2qs("No " KVIRC_MODULE_STRUCTURE_SYMBOL " symbol exported: not a kvirc module ?"); pLibrary->unload(); delete pLibrary; return false; } if(!info->szKVIrcVersion) { m_szLastError = __tr2qs("This module has no version information: refusing to load it"); pLibrary->unload(); delete pLibrary; return false; } if(!KVI_OPTION_BOOL(KviOption_boolIgnoreModuleVersions)) { if(!kvi_strEqualCS(info->szKVIrcVersion,KVI_VERSION)) { m_szLastError = __tr2qs("This module was compiled for a different KVIrc version and can't be loaded"); m_szLastError += " ("; m_szLastError += info->szKVIrcVersion; m_szLastError += ")"; pLibrary->unload(); delete pLibrary; return false; } } KviModule * module = new KviModule(pLibrary,info,modName,szName.toUtf8().data()); // the module is probably up.. the only thing can fail is the init_routine now // load the message catalogue if any if(info->szModuleContext) { QString szDir; // it's more probable to have the translations in the global directory // try it as first... (yes, catalogue overriding is impossible this way.. but, anybody cares ?) g_pApp->getGlobalKvircDirectory(szDir,KviApplication::Locale); if(!KviLocale::instance()->loadCatalogue(info->szModuleContext,szDir)) { // try the local directory then g_pApp->getLocalKvircDirectory(szDir,KviApplication::Locale); KviLocale::instance()->loadCatalogue(info->szModuleContext,szDir); } } if(info->init_routine) { if(!((info->init_routine)(module))) { m_szLastError = __tr2qs("Failed to execute the init routine"); //qDebug("ERROR IN LOADING MODULE %s (%s): failed to execute the init routine",modName,szName.ptr()); delete module; // kill the message catalogue too then KviLocale::instance()->unloadCatalogue(modName); return false; } } m_pModuleDict->insert(modName,module); /* registerDefaultCommands(module); */ module->registerDefaultCommands(); if(KVI_OPTION_BOOL(KviOption_boolCleanupUnusedModules)) { if(!m_pCleanupTimer->isActive()) { if(KVI_OPTION_UINT(KviOption_uintModuleCleanupTimerInterval) < 30) KVI_OPTION_UINT(KviOption_uintModuleCleanupTimerInterval) = 30; m_pCleanupTimer->start(KVI_OPTION_UINT(KviOption_uintModuleCleanupTimerInterval) * 1000); } } // be verbose if needed....just make sure that we're not shutting down... if(_OUTPUT_VERBOSE && !g_pApp->kviClosingDown()) { if(g_pMainWindow) { KviConsoleWindow * pWnd = g_pMainWindow->firstConsole(); if(pWnd) // this may be NULL when the app is starting up pWnd->output( KVI_OUT_VERBOSE, __tr2qs("Loaded module '%s' (%s)"), modName.toUtf8().data(), szName.toUtf8().data() ); } } return true; }
bool QgsNewSpatialiteLayerDialog::createDb() { QString dbPath = mDatabaseComboBox->currentText(); if ( dbPath.isEmpty() ) return false; QFile newDb( dbPath ); if ( newDb.exists() ) { QMessageBox msgBox; msgBox.setIcon( QMessageBox::Question ); msgBox.setWindowTitle( tr( "The File Already Exists." ) ); msgBox.setText( tr( "Do you want to overwrite the existing file with a new database or add a new layer to it?" ) ); QPushButton *overwriteButton = msgBox.addButton( tr( "Overwrite" ), QMessageBox::ActionRole ); QPushButton *addNewLayerButton = msgBox.addButton( tr( "Add new layer" ), QMessageBox::ActionRole ); msgBox.setStandardButtons( QMessageBox::Cancel ); msgBox.setDefaultButton( addNewLayerButton ); int ret = msgBox.exec(); if ( ret == QMessageBox::Cancel ) { return false; } if ( msgBox.clickedButton() == overwriteButton ) { newDb.remove(); } } if ( !newDb.exists() ) { QString errCause; bool res = false; QString spatialite_lib = QgsProviderRegistry::instance()->library( QStringLiteral( "spatialite" ) ); QLibrary *myLib = new QLibrary( spatialite_lib ); bool loaded = myLib->load(); if ( loaded ) { QgsDebugMsg( "SpatiaLite provider loaded" ); typedef bool ( *createDbProc )( const QString &, QString & ); createDbProc createDbPtr = ( createDbProc ) cast_to_fptr( myLib->resolve( "createDb" ) ); if ( createDbPtr ) { res = createDbPtr( dbPath, errCause ); } else { errCause = QStringLiteral( "Resolving createDb(...) failed" ); } } delete myLib; if ( !res ) { QMessageBox::warning( nullptr, tr( "SpatiaLite Database" ), errCause ); pbnFindSRID->setEnabled( false ); } } QFileInfo fi( newDb ); if ( !fi.exists() ) { pbnFindSRID->setEnabled( false ); return false; } QString key = "/SpatiaLite/connections/" + fi.fileName() + "/sqlitepath"; QgsSettings settings; if ( !settings.contains( key ) ) { settings.setValue( QStringLiteral( "SpatiaLite/connections/selected" ), fi.fileName() + tr( "@" ) + fi.canonicalFilePath() ); settings.setValue( key, fi.canonicalFilePath() ); QMessageBox::information( nullptr, tr( "SpatiaLite Database" ), tr( "Registered new database!" ) ); } pbnFindSRID->setEnabled( true ); return true; }
void LocalApp::readSuffixFilter(){ QFile *suffixFilterFile = 0; if ( appName == "home") suffixFilterFile = new QFile (home+"/"+QString("home.suffixfilter")); else suffixFilterFile = new QFile (home+"/"+ appName + "/"+ appName + QString(".suffixfilter")); ERR<<"INFO: LocalApp::readSuffixFilter(): "<<suffixFilterFile->fileName()<<endl; #ifndef USE_QT5 if ( ! suffixFilterFile->open(QIODevice::ReadOnly) ){ #else if ( ! suffixFilterFile->open(QFile::ReadOnly) ){ #endif ERR<<"WARN: LocalApp::readSuffixFilter(): Unable to read : "<<suffixFilterFile->fileName()<<endl; suffixFilterFile->close(); }else { suffixFilter += suffixFilterFile->readAll(); suffixFilterFile->close(); } //TODO: convert suffix filter to map of string ERR<<"DBUG: LocalApp::readSuffixFilter(): "<<suffixFilter<<endl; delete suffixFilterFile; } void LocalApp::readLibraryLoadConfig(){ QFile *llConfigFile = 0; if ( appName == "home") llConfigFile = new QFile (home+"/"+QString("home.cfg")); else llConfigFile = new QFile (home+"/"+ appName + "/"+ appName + QString(".cfg")); #ifndef USE_QT5 if ( ! llConfigFile->open(QIODevice::ReadOnly) ){ #else if ( ! llConfigFile->open(QFile::ReadOnly) ){ #endif ERR<<"DBUG: LocalApp::readLibraryLoadConfig(): Unable to open file :"<<llConfigFile->fileName()<<endl; } else { QByteArray libConfig; while ( (libConfig = llConfigFile->readLine() ).length() > 0 ){ /* * Read the config file * <scriptname>:<libraryname> */ QString line(libConfig); if( line.split(":").length() > 1) { QString script = line.split(":")[0]; QString soFile = line.split(":")[1]; #ifndef WINDOWS soFile.replace(QString("\n"), QString("")); soFile += QString(".so"); //soFile.remove(soFile.length()-1,1); #else soFile.replace(QString("\r\n"), QString("")); soFile += QString(".dll"); //soFile.remove(soFile.length()-2,2); #endif if( appName == "home"){ QLibrary *lib = new QLibrary( home + "/" + soFile ); lib->setLoadHints(QLibrary::ResolveAllSymbolsHint); lib->load(); ERR<<"ERRR: LocalApp::readLibraryLoadConfig(): "<< script<<" -> "<<lib->fileName()<<": Loaded ? "<<lib->isLoaded()<<endl; mapScriptToSo[script] = lib; } else { QLibrary *lib = new QLibrary( home + "/" + appName + "/" + soFile, this ); lib->setLoadHints(QLibrary::ResolveAllSymbolsHint); lib->load(); ERR<<"ERRR: LocalApp::readLibraryLoadConfig(): "<<script<<" -> "<<lib->fileName()<<": Loaded ? "<<lib->isLoaded()<<endl; mapScriptToSo[script] = lib; } } } } delete llConfigFile; } QString LocalApp::readAppName( QUrl url ){ QString app(""); #ifndef USE_QT5 ERR<<"INFO: LocalApp::readAppName(): Encoded Path: "<<url.encodedPath()<<endl; //QStringList app = url.encodedPath().split('/')[0]; //app = list[0]; if ( app.contains(".py")){ app = "home"; } ERR<<"INFO: LocalApp::readAppName(): App: "<<app<<endl; #else ERR<<"INFO: LocalApp::readAppName(): Path: "<<url.path()<<endl; app = url.path().split('/')[0]; if ( app.contains(".py") || app.contains(".")){ app = "home"; } ERR<<"INFO: LocalApp::readAppName(): App: "<<app<<endl; ERR<<"INFO: LocalApp::readAppName(): Path: "<<url.path()<<endl; #endif return app; }
bool QgsNewSpatialiteLayerDialog::createDb() { QString dbPath = mDatabaseComboBox->currentText(); if ( dbPath.isEmpty() ) return false; QFile newDb( dbPath ); if ( !newDb.exists() ) { QString errCause; bool res = false; QString spatialite_lib = QgsProviderRegistry::instance()->library( "spatialite" ); QLibrary* myLib = new QLibrary( spatialite_lib ); bool loaded = myLib->load(); if ( loaded ) { QgsDebugMsg( "spatialite provider loaded" ); typedef bool ( *createDbProc )( const QString&, QString& ); createDbProc createDbPtr = ( createDbProc ) cast_to_fptr( myLib->resolve( "createDb" ) ); if ( createDbPtr ) { res = createDbPtr( dbPath, errCause ); } else { errCause = "Resolving createDb(...) failed"; } } delete myLib; if ( !res ) { QMessageBox::warning( 0, tr( "SpatiaLite Database" ), errCause ); pbnFindSRID->setEnabled( false ); } } QFileInfo fi( newDb ); if ( !fi.exists() ) { pbnFindSRID->setEnabled( false ); return false; } QString key = "/SpatiaLite/connections/" + fi.fileName() + "/sqlitepath"; QSettings settings; if ( !settings.contains( key ) ) { settings.setValue( "/SpatiaLite/connections/selected", fi.fileName() + tr( "@" ) + fi.canonicalFilePath() ); settings.setValue( key, fi.canonicalFilePath() ); QMessageBox::information( 0, tr( "SpatiaLite Database" ), tr( "Registered new database!" ) ); } pbnFindSRID->setEnabled( true ); return true; }
int main(int argc, char *argv[]) { int ret = -1; LibraryCleanupHandler cleanup; { ::initApp("tokoloshtail", argc, argv); QCoreApplication app(argc, argv); if (!QDBusConnection::sessionBus().isConnected()) { fprintf(stderr, "Cannot connect to the D-Bus session bus.\n" "To start it, run:\n" "\teval `dbus-launch --auto-syntax`\n"); return 1; } { QDBusInterface iface(SERVICE_NAME, "/"); if (iface.isValid()) { iface.call("quit"); } } // const QString pluginDirectory = Config::value<QString>("plugindir", PLUGINDIR); // ### Can't make this work const QString pluginDirectory = Config::value<QString>("plugindir", QDir::cleanPath(QCoreApplication::applicationDirPath() + "/../plugins")); Log::log(10) << "Using plugin directory" << pluginDirectory; const QString backendName = Config::value<QString>("backend", "xine"); Log::log(10) << "Searching for backend" << backendName; QDir dir(pluginDirectory); if (!dir.exists()) { Log::log(0) << pluginDirectory << " doesn't seem to exist"; return 1; } { Tail tail; Backend *backend = 0; QLibrary *library = 0; QHash<QLibrary*, BackendPlugin*> candidates; foreach(const QFileInfo &fi, dir.entryInfoList(QDir::Files, QDir::Size)) { QLibrary *lib = new QLibrary(fi.absoluteFilePath()); CreateBackend createBackend = 0; if (lib->load() && (createBackend = (CreateBackend)lib->resolve("createTokoloshBackendInterface"))) { BackendPlugin *interface = createBackend(); if (interface && interface->keys().contains(backendName, Qt::CaseInsensitive)) { backend = interface->createBackend(&tail); if (backend) { library = lib; break; } else { Log::log(0) << fi.absoluteFilePath() << "doesn't seem to be able to create a backend"; } delete interface; } else if (!interface) { delete lib; } else { candidates[lib] = interface; } } else { if (lib->isLoaded()) { Log::log(1) << "Can't load" << fi.absoluteFilePath() << lib->errorString(); } delete lib; } } Q_ASSERT(!backend == !library); if (!backend) { for (QHash<QLibrary*, BackendPlugin*>::const_iterator it = candidates.begin(); it != candidates.end(); ++it) { const bool hadBackend = backend != 0; if (!backend) backend = it.value()->createBackend(&app); if (hadBackend || !backend) { it.key()->unload(); delete it.key(); } else { library = it.key(); } delete it.value(); } } if (!backend) { Log::log(0) << "Can't find a suitable backend"; return 1; } cleanup.library = library; bool registered = false; for (int i=0; i<5; ++i) { if (QDBusConnection::sessionBus().registerService(SERVICE_NAME)) { registered = true; break; } ::sleep(500); } if (!registered) { Log::log(0) << "Can't seem to register service" << QDBusConnection::sessionBus().lastError().message(); return 1; } if (!tail.setBackend(backend)) { Log::log(0) << backend->errorMessage() << backend->errorCode(); return 1; } QDBusConnection::sessionBus().registerObject("/", &tail, QDBusConnection::ExportScriptableSlots |QDBusConnection::ExportScriptableSignals); Log::log(10) << "Using" << backend->name(); ret = app.exec(); } } return ret; }
PluginInfoList& PluginFactory::rescan() { //remove plugins that are not loaded PluginInfoList::Iterator it = infoList.begin(); while( it != infoList.end() ) { PluginInfo *info = (*it).first; if( !info ) continue; //plugin is not loaded if( !info->get() ) { QLibrary *lib = (*it).second; lib->unload(); delete lib; it = infoList.remove(it); continue; } ++it; } //load all plugins (and avoid collisions) QRegExp libRxp = QRegExp( "^lib.*\\.so[0-9.]*$" ); //QRegExp libRxp = QRegExp( "^lib.*" ); PluginInfoList pluginList; QStringList libraryPaths = ancaConf->readListEntry( LIBRARY_PATHS, LIBRARY_PATHS_DEFAULT ); #ifdef PREL libraryPaths.append( PREL "/share/anca/plugins"); #endif libraryPaths.append(QDir::homeDirPath() + "/.anca/plugins"); //iterate all paths where plugins should be for ( QStringList::iterator it = libraryPaths.begin(); it != libraryPaths.end(); ++it ) { PTRACE( 3, "Searching directory " << ( *it ).latin1() << " for plugins" ); QDir dir( *it ); if ( !dir.exists() ) continue; dir.setFilter( QDir::Files | QDir::NoSymLinks ); const QFileInfoList *fileList = dir.entryInfoList(); QFileInfo *file; QLibrary *lib; //iterate all files in the directory for ( QFileInfoListIterator fit( *fileList ); ( file = *fit ); ++fit ) { //is the file plugin? if ( !file->fileName().contains( libRxp ) ) continue; //open plugin lib = new QLibrary( file->filePath().latin1() ); if( !lib->load() ) { PTRACE( 3, "Library " << file->fileName().latin1() << " could not be loaded" ); continue; } //resolve symbol 'getPluginInfo' if ( GetPluginInfo * getPluginInfo = ( GetPluginInfo* ) lib->resolve( "getPluginInfo" ) ) { PluginInfo * pluginInfo = getPluginInfo(); pluginList.append( PluginInfoPair(pluginInfo, lib) ); } else { PTRACE( 3, "Symbol \"getPluginInfo\" not found in library " << file->fileName().latin1() ); delete lib; } } } //insert that pluginInfo to class infoList that in not already there for( PluginInfoList::iterator it = pluginList.begin(); it != pluginList.end(); ++it ) { QLibrary *lib = (*it).second; if( !lib ) continue; if( !infoList.contains( *it ) ) infoList.append( *it ); else { lib->unload(); delete lib; } } // sort plugins according to type qHeapSort(infoList); return infoList; }