Skip to content

Commit a331381

Browse files
author
g_j_m
committed
Change indenting to something closer to the qgis 'standard'
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4950 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 7ddb5b2 commit a331381

File tree

1 file changed

+137
-136
lines changed

1 file changed

+137
-136
lines changed

src/core/qgsproviderregistry.cpp

+137-136
Original file line numberDiff line numberDiff line change
@@ -58,135 +58,135 @@ QgsProviderRegistry *QgsProviderRegistry::instance(QString pluginPath)
5858

5959
QgsProviderRegistry::QgsProviderRegistry(QString pluginPath)
6060
{
61-
// At startup, examine the libs in the qgis/lib dir and store those that
62-
// are a provider shared lib
63-
// check all libs in the current plugin directory and get name and descriptions
64-
//TODO figure out how to register and identify data source plugin for a specific
65-
//TODO layer type
66-
/* char **argv = qApp->argv();
67-
QString appDir = argv[0];
68-
int bin = appDir.findRev("/bin", -1, false);
69-
QString baseDir = appDir.left(bin);
70-
QString mLibraryDirectory = baseDir + "/lib"; */
71-
mLibraryDirectory = pluginPath;
72-
73-
mLibraryDirectory.setSorting( QDir::Name | QDir::IgnoreCase );
74-
mLibraryDirectory.setFilter( QDir::Files | QDir::NoSymLinks );
61+
// At startup, examine the libs in the qgis/lib dir and store those that
62+
// are a provider shared lib
63+
// check all libs in the current plugin directory and get name and descriptions
64+
//TODO figure out how to register and identify data source plugin for a specific
65+
//TODO layer type
66+
/* char **argv = qApp->argv();
67+
QString appDir = argv[0];
68+
int bin = appDir.findRev("/bin", -1, false);
69+
QString baseDir = appDir.left(bin);
70+
QString mLibraryDirectory = baseDir + "/lib"; */
71+
mLibraryDirectory = pluginPath;
72+
73+
mLibraryDirectory.setSorting( QDir::Name | QDir::IgnoreCase );
74+
mLibraryDirectory.setFilter( QDir::Files | QDir::NoSymLinks );
7575

7676
#ifdef WIN32
77-
mLibraryDirectory.setNameFilter( "*.dll" );
77+
mLibraryDirectory.setNameFilter( "*.dll" );
7878
#else
79-
mLibraryDirectory.setNameFilter( "*.so" );
79+
mLibraryDirectory.setNameFilter( "*.so" );
8080
#endif
8181

8282
#ifdef QGISDEBUG
83-
cerr << "Checking " << mLibraryDirectory.path().data() << " for provider plugins\n";
83+
cerr << "Checking " << mLibraryDirectory.path().data() << " for provider plugins\n";
8484
#endif
8585

86-
if (mLibraryDirectory.count() == 0)
87-
{
88-
QString msg = QObject::tr("No Data Provider Plugins",
89-
"No QGIS data provider plugins found in:");
90-
msg += "\n" + mLibraryDirectory.path() + "\n\n";
91-
msg += QObject::tr("No vector layers can be loaded. Check your QGIS installation");
92-
QMessageBox::critical(0, QObject::tr("No Data Providers"), msg);
93-
}
94-
else
95-
{
96-
const QFileInfoList list = mLibraryDirectory.entryInfoList();
97-
QListIterator<QFileInfo> it( list );
98-
QFileInfo fi;
86+
if (mLibraryDirectory.count() == 0)
87+
{
88+
QString msg = QObject::tr("No Data Provider Plugins",
89+
"No QGIS data provider plugins found in:");
90+
msg += "\n" + mLibraryDirectory.path() + "\n\n";
91+
msg += QObject::tr("No vector layers can be loaded. Check your QGIS installation");
92+
QMessageBox::critical(0, QObject::tr("No Data Providers"), msg);
93+
}
94+
else
95+
{
96+
const QFileInfoList list = mLibraryDirectory.entryInfoList();
97+
QListIterator<QFileInfo> it( list );
98+
QFileInfo fi;
9999

100-
while (it.hasNext())
101-
{
102-
fi = it.next();
100+
while (it.hasNext())
101+
{
102+
fi = it.next();
103103

104-
QLibrary *myLib = new QLibrary( fi.filePath() );
104+
QLibrary *myLib = new QLibrary( fi.filePath() );
105105

106-
bool loaded = myLib->load();
106+
bool loaded = myLib->load();
107107

108-
if (loaded)
109-
{
108+
if (loaded)
109+
{
110110
#ifdef QGISDEBUG
111-
std::cout << "Checking " << myLib->library().toLocal8Bit().data() << std::endl;
111+
std::cout << "Checking " << myLib->library().toLocal8Bit().data() << std::endl;
112112
#endif
113-
// get the description and the key for the provider plugin
114-
isprovider_t *isProvider = (isprovider_t *) myLib->resolve("isProvider");
113+
// get the description and the key for the provider plugin
114+
isprovider_t *isProvider = (isprovider_t *) myLib->resolve("isProvider");
115115

116-
if (isProvider)
117-
{
118-
// check to see if this is a provider plugin
119-
if (isProvider())
120-
{
121-
// looks like a provider. get the key and description
122-
description_t *pDesc = (description_t *) myLib->resolve("description");
123-
providerkey_t *pKey = (providerkey_t *) myLib->resolve("providerKey");
124-
if (pDesc && pKey)
125-
{
126-
// add this provider to the provider map
127-
mProviders[pKey()] =
128-
new QgsProviderMetadata(pKey(), pDesc(), myLib->library());
116+
if (isProvider)
117+
{
118+
// check to see if this is a provider plugin
119+
if (isProvider())
120+
{
121+
// looks like a provider. get the key and description
122+
description_t *pDesc = (description_t *) myLib->resolve("description");
123+
providerkey_t *pKey = (providerkey_t *) myLib->resolve("providerKey");
124+
if (pDesc && pKey)
125+
{
126+
// add this provider to the provider map
127+
mProviders[pKey()] =
128+
new QgsProviderMetadata(pKey(), pDesc(), myLib->library());
129129
#ifdef QGISDEBUG
130-
std::cout << "Loaded " << pDesc().toLocal8Bit().data() << std::endl;
130+
std::cout << "Loaded " << pDesc().toLocal8Bit().data() << std::endl;
131131
#endif
132132

133-
// now get vector file filters, if any
134-
fileVectorFilters_t *pFileVectorFilters =
135-
(fileVectorFilters_t *) myLib->resolve("fileVectorFilters");
136-
137-
if ( pFileVectorFilters )
138-
{
139-
QString vectorFileFilters = pFileVectorFilters();
140-
141-
142-
// now get vector file filters, if any
143-
fileVectorFilters_t *pVectorFileFilters =
144-
(fileVectorFilters_t *) myLib->resolve("fileVectorFilters");
145-
146-
if ( pVectorFileFilters )
147-
{
148-
QString fileVectorFilters = pVectorFileFilters();
149-
150-
if ( ! fileVectorFilters.isEmpty() )
151-
{
152-
mVectorFileFilters += fileVectorFilters;
153-
}
154-
else
155-
{
156-
QgsDebug( QString("No vector file filters for " + pKey()).ascii() );
157-
}
158-
}
159-
else
160-
{
161-
QgsDebug( "Unable to invoke fileVectorFilters()" );
162-
}
163-
}
164-
else
165-
{
166-
cout << myLib->library().data()
167-
<< " Unable to find one of the required provider functions:\n\tproviderKey() or description()"
168-
<< endl;
169-
}
170-
}
171-
}
172-
else
173-
{
174-
QgsDebug( "Unable to invoke fileVectorFilters()" );
175-
}
176-
}
133+
// now get vector file filters, if any
134+
fileVectorFilters_t *pFileVectorFilters =
135+
(fileVectorFilters_t *) myLib->resolve("fileVectorFilters");
136+
137+
if ( pFileVectorFilters )
138+
{
139+
QString vectorFileFilters = pFileVectorFilters();
140+
141+
142+
// now get vector file filters, if any
143+
fileVectorFilters_t *pVectorFileFilters =
144+
(fileVectorFilters_t *) myLib->resolve("fileVectorFilters");
145+
146+
if ( pVectorFileFilters )
147+
{
148+
QString fileVectorFilters = pVectorFileFilters();
149+
150+
if ( ! fileVectorFilters.isEmpty() )
151+
{
152+
mVectorFileFilters += fileVectorFilters;
153+
}
154+
else
155+
{
156+
QgsDebug( QString("No vector file filters for " + pKey()).ascii() );
157+
}
158+
}
177159
else
178160
{
179-
cout << myLib->library().data()
180-
<< " Unable to find one of the required provider functions:\n\tproviderKey() or description()"
181-
<< endl;
161+
QgsDebug( "Unable to invoke fileVectorFilters()" );
182162
}
163+
}
164+
else
165+
{
166+
cout << myLib->library().data()
167+
<< " Unable to find one of the required provider functions:\n\tproviderKey() or description()"
168+
<< endl;
169+
}
183170
}
171+
}
172+
else
173+
{
174+
QgsDebug( "Unable to invoke fileVectorFilters()" );
175+
}
176+
}
177+
else
178+
{
179+
cout << myLib->library().data()
180+
<< " Unable to find one of the required provider functions:\n\tproviderKey() or description()"
181+
<< endl;
182+
}
183+
}
184184

185-
//++it;
185+
//++it;
186186

187-
delete myLib;
188-
}
187+
delete myLib;
189188
}
189+
}
190190

191191
} // QgsProviderRegistry ctor
192192

@@ -203,29 +203,29 @@ static
203203
QgsProviderMetadata * findMetadata_( QgsProviderRegistry::Providers const & metaData,
204204
QString const & providerKey )
205205
{
206-
QgsProviderRegistry::Providers::const_iterator i =
207-
metaData.find( providerKey );
206+
QgsProviderRegistry::Providers::const_iterator i =
207+
metaData.find( providerKey );
208208

209-
if ( i != metaData.end() )
210-
{
211-
return i->second;
212-
}
209+
if ( i != metaData.end() )
210+
{
211+
return i->second;
212+
}
213213

214-
return 0x0;
214+
return 0x0;
215215
} // findMetadata_
216216

217217

218218

219219
QString QgsProviderRegistry::library(QString const & providerKey) const
220220
{
221-
QgsProviderMetadata * md = findMetadata_( mProviders, providerKey );
221+
QgsProviderMetadata * md = findMetadata_( mProviders, providerKey );
222222

223-
if (md)
224-
{
225-
return md->library();
226-
}
223+
if (md)
224+
{
225+
return md->library();
226+
}
227227

228-
return QString();
228+
return QString();
229229
}
230230

231231

@@ -236,32 +236,33 @@ QString QgsProviderRegistry::pluginList(bool asHTML) const
236236

237237
if ( mProviders.empty() )
238238
{
239-
list = QObject::tr("No data provider plugins are available. No vector layers can be loaded");
239+
list = QObject::tr("No data provider plugins are available. No vector layers can be loaded");
240240
}
241241
else
242242
{
243-
if (asHTML)
244-
{
245-
list += "<ol>";
246-
}
247-
while (it != mProviders.end())
248-
{
249-
QgsProviderMetadata *mp = (*it).second;
250-
251-
if (asHTML)
252-
{
253-
list += "<li>" + mp->description() + "<br>";
254-
} else
255-
{
256-
list += mp->description() + "\n";
257-
}
243+
if (asHTML)
244+
{
245+
list += "<ol>";
246+
}
247+
while (it != mProviders.end())
248+
{
249+
QgsProviderMetadata *mp = (*it).second;
258250

259-
it++;
260-
}
261251
if (asHTML)
262252
{
263-
list += "</ol>";
253+
list += "<li>" + mp->description() + "<br>";
254+
}
255+
else
256+
{
257+
list += mp->description() + "\n";
264258
}
259+
260+
it++;
261+
}
262+
if (asHTML)
263+
{
264+
list += "</ol>";
265+
}
265266
}
266267

267268
return list;

0 commit comments

Comments
 (0)