Skip to content

Commit 6cf05b5

Browse files
author
g_j_m
committed
When looking for plugins, filter out the libraries that are providers
Tidy up of warning/error messages Some re-indenting too git-svn-id: http://svn.osgeo.org/qgis/trunk@4952 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 81d407f commit 6cf05b5

File tree

1 file changed

+40
-34
lines changed

1 file changed

+40
-34
lines changed

src/gui/qgspluginmanager.cpp

+40-34
Original file line numberDiff line numberDiff line change
@@ -106,41 +106,44 @@ sharedLibExtension = "*.so*";
106106

107107
} else
108108
{
109-
std::cout << "dlopen suceeded" << std::endl;
109+
std::cout << "dlopen suceeded for " << lib.toLocal8Bit().data() << std::endl;
110110
dlclose(handle);
111111
}
112112
#endif //#ifndef WIN32 && Q_OS_MACX
113113
#endif //#ifdef TESTLIB
114114

115115

116-
std::cout << "Examining " << txtPluginDir->text().toLocal8Bit().data() << "/" << pluginDir[i].toLocal8Bit().data() << std::endl;
117-
QLibrary *myLib = new QLibrary(txtPluginDir->text() + "/" + pluginDir[i]);
116+
std::cout << "Examining " << lib.toLocal8Bit().data() << std::endl;
117+
QLibrary *myLib = new QLibrary(lib);
118118
bool loaded = myLib->load();
119119
if (loaded)
120120
{
121121
std::cout << "Loaded " << myLib->library().toLocal8Bit().data() << std::endl;
122-
name_t *pName = (name_t *) myLib->resolve("name");
123-
description_t *pDesc = (description_t *) myLib->resolve("description");
124-
version_t *pVersion = (version_t *) myLib->resolve("version");
122+
// Don't bother with libraries that are providers
123+
if (!myLib->resolve("isProvider"))
124+
{
125+
name_t *pName = (name_t *) myLib->resolve("name");
126+
description_t *pDesc = (description_t *) myLib->resolve("description");
127+
version_t *pVersion = (version_t *) myLib->resolve("version");
125128
#ifdef QGISDEBUG
126-
// show the values (or lack of) for each function
127-
if(pName){
128-
std::cout << "Plugin name: " << pName().toLocal8Bit().data() << std::endl;
129-
}else{
130-
std::cout << "Plugin name not returned when queried\n";
131-
}
132-
if(pDesc){
133-
std::cout << "Plugin description: " << pDesc().toLocal8Bit().data() << std::endl;
134-
}else{
135-
std::cout << "Plugin description not returned when queried\n";
136-
}
137-
if(pVersion){
138-
std::cout << "Plugin version: " << pVersion().toLocal8Bit().data() << std::endl;
139-
}else{
140-
std::cout << "Plugin version not returned when queried\n";
141-
}
129+
// show the values (or lack of) for each function
130+
if(pName){
131+
std::cout << "Plugin name: " << pName().toLocal8Bit().data() << std::endl;
132+
}else{
133+
std::cout << "Plugin name not returned when queried\n";
134+
}
135+
if(pDesc){
136+
std::cout << "Plugin description: " << pDesc().toLocal8Bit().data() << std::endl;
137+
}else{
138+
std::cout << "Plugin description not returned when queried\n";
139+
}
140+
if(pVersion){
141+
std::cout << "Plugin version: " << pVersion().toLocal8Bit().data() << std::endl;
142+
}else{
143+
std::cout << "Plugin version not returned when queried\n";
144+
}
142145
#endif
143-
if (pName && pDesc && pVersion)
146+
if (pName && pDesc && pVersion)
144147
{
145148
Q3CheckListItem *pl = new Q3CheckListItem(lstPlugins, pName(), Q3CheckListItem::CheckBox); //, pDesc(), pluginDir[i])
146149
pl->setText(1, pVersion());
@@ -158,24 +161,27 @@ sharedLibExtension = "*.so*";
158161
#endif
159162
QString libName = pRegistry->library(pName());
160163
if (libName.length() > 0)
161-
{
164+
{
162165
#ifdef QGISDEBUG
163-
std::cout << "Found library name in the registry" << std::endl;
166+
std::cout << "Found library name in the registry" << std::endl;
164167
#endif
165-
if (libName == myLib->library())
166-
{
167-
// set the checkbox
168-
pl->setOn(true);
169-
}
168+
if (libName == myLib->library())
169+
{
170+
// set the checkbox
171+
pl->setOn(true);
170172
}
171-
} else
173+
}
174+
}
175+
else
172176
{
173177
std::cout << "Failed to get name, description, or type for " << myLib->library().toLocal8Bit().data() << std::endl;
174178
}
175-
} else
176-
{
177-
std::cout << "Failed to load " << myLib->library().toLocal8Bit().data() << std::endl;
179+
}
178180
}
181+
else
182+
{
183+
std::cout << "Failed to load " << myLib->library().toLocal8Bit().data() << std::endl;
184+
}
179185
}
180186
}
181187
}

0 commit comments

Comments
 (0)