本文整理汇总了C++中QLibrary::fileName方法的典型用法代码示例。如果您正苦于以下问题:C++ QLibrary::fileName方法的具体用法?C++ QLibrary::fileName怎么用?C++ QLibrary::fileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLibrary
的用法示例。
在下文中一共展示了QLibrary::fileName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foreach
foreach ( QString key, providersList )
{
QLibrary *library = QgsProviderRegistry::instance()->providerLibrary( key );
if ( !library )
continue;
dataCapabilities_t * dataCapabilities = ( dataCapabilities_t * ) cast_to_fptr( library->resolve( "dataCapabilities" ) );
if ( !dataCapabilities )
{
QgsDebugMsg( library->fileName() + " does not have dataCapabilities" );
continue;
}
int capabilities = dataCapabilities();
if ( capabilities == QgsDataProvider::NoDataCapabilities )
{
QgsDebugMsg( library->fileName() + " does not have any dataCapabilities" );
continue;
}
dataItem_t *dataItem = ( dataItem_t * ) cast_to_fptr( library->resolve( "dataItem" ) );
if ( !dataItem )
{
QgsDebugMsg( library->fileName() + " does not have dataItem" );
continue;
}
QgsDataItem *item = dataItem( "", NULL ); // empty path -> top level
if ( item )
{
QgsDebugMsg( "Add new top level item : " + item->name() );
connectItem( item );
providerMap.insertMulti( capabilities, item );
}
}
示例2: init
//----------------------------------------------------------------------------
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.";
}
}
示例3: emitSignals
void emitSignals () {
bool openBabelAvailable = openBabelInterface.isLoaded ();
bool isInchiAvailable = inChIAvailable && inChIAvailable ();
bool isGen2dAvailable = gen2dAvailable && gen2dAvailable ();
qDebug() << "OpenBabel available: " << QString::number (openBabelAvailable)
<< "Library location:" << openBabelInterface.fileName();
qDebug() << "InChI available: " << QString::number (isInchiAvailable)
<< "gen2d available: " << QString::number (isGen2dAvailable);
emit parent->obabelIfaceAvailable (openBabelAvailable);
emit parent->inchiAvailable (isInchiAvailable && isGen2dAvailable);
emit parent->optimizeAvailable(isGen2dAvailable);
emit parent->obabelIfaceFileNameChanged(openBabelInterface.fileName());
}
示例4: load
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;
}
示例5: QLibrary
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;
}
示例6: QLibrary
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;
}
示例7: fname
inline const QString fname() { return library.fileName(); };
示例8: readSuffixFilter
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;
//.........这里部分代码省略.........
示例9: getPluginDescriptions
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 )
{
//.........这里部分代码省略.........