Skip to content

Commit fe3bb76

Browse files
committed
backport 813609f
1 parent a9c35fd commit fe3bb76

File tree

2 files changed

+64
-62
lines changed

2 files changed

+64
-62
lines changed

src/core/qgsapplication.cpp

+54-54
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535

3636
#include <ogr_api.h>
3737

38-
QObject * QgsApplication::mFileOpenEventReceiver;
39-
QStringList QgsApplication::mFileOpenEventList;
40-
QString QgsApplication::mPrefixPath;
41-
QString QgsApplication::mPluginPath;
42-
QString QgsApplication::mPkgDataPath;
43-
QString QgsApplication::mThemeName;
44-
QStringList QgsApplication::mDefaultSvgPaths;
45-
QString QgsApplication::mConfigPath = QDir::homePath() + QString( "/.qgis/" );
38+
QObject * ABISYM( QgsApplication::mFileOpenEventReceiver );
39+
QStringList ABISYM( QgsApplication::mFileOpenEventList );
40+
QString ABISYM( QgsApplication::mPrefixPath );
41+
QString ABISYM( QgsApplication::mPluginPath );
42+
QString ABISYM( QgsApplication::mPkgDataPath );
43+
QString ABISYM( QgsApplication::mThemeName );
44+
QStringList ABISYM( QgsApplication::mDefaultSvgPaths );
45+
QString ABISYM( QgsApplication::mConfigPath ) = QDir::homePath() + QString( "/.qgis/" );
4646

4747
/*!
4848
\class QgsApplication
@@ -71,10 +71,10 @@ QgsApplication::QgsApplication( int & argc, char ** argv, bool GUIenabled, QStri
7171

7272
if ( !customConfigPath.isEmpty() )
7373
{
74-
mConfigPath = customConfigPath + "/"; // make sure trailing slash is included
74+
ABISYM( mConfigPath ) = customConfigPath + "/"; // make sure trailing slash is included
7575
}
7676

77-
mDefaultSvgPaths << qgisSettingsDirPath() + QString( "svg/" );
77+
ABISYM( mDefaultSvgPaths ) << qgisSettingsDirPath() + QString( "svg/" );
7878
}
7979

8080
QgsApplication::~QgsApplication()
@@ -87,17 +87,17 @@ bool QgsApplication::event( QEvent * event )
8787
if ( event->type() == QEvent::FileOpen )
8888
{
8989
// handle FileOpen event (double clicking a file icon in Mac OS X Finder)
90-
if ( mFileOpenEventReceiver )
90+
if ( ABISYM( mFileOpenEventReceiver ) )
9191
{
9292
// Forward event to main window.
93-
done = notify( mFileOpenEventReceiver, event );
93+
done = notify( ABISYM( mFileOpenEventReceiver ), event );
9494
}
9595
else
9696
{
9797
// Store filename because receiver has not registered yet.
9898
// If QGIS has been launched by double clicking a file icon, FileOpen will be
9999
// the first event; the main window is not yet ready to handle the event.
100-
mFileOpenEventList.append( static_cast<QFileOpenEvent *>( event )->file() );
100+
ABISYM( mFileOpenEventList ).append( static_cast<QFileOpenEvent *>( event )->file() );
101101
done = true;
102102
}
103103
}
@@ -135,74 +135,74 @@ bool QgsApplication::notify( QObject * receiver, QEvent * event )
135135
void QgsApplication::setFileOpenEventReceiver( QObject * receiver )
136136
{
137137
// Set receiver for FileOpen events
138-
mFileOpenEventReceiver = receiver;
138+
ABISYM( mFileOpenEventReceiver ) = receiver;
139139
// Propagate any events collected before the receiver has registered.
140-
if ( mFileOpenEventList.count() > 0 )
140+
if ( ABISYM( mFileOpenEventList ).count() > 0 )
141141
{
142-
QStringListIterator i( mFileOpenEventList );
142+
QStringListIterator i( ABISYM( mFileOpenEventList ) );
143143
while ( i.hasNext() )
144144
{
145145
QFileOpenEvent foe( i.next() );
146-
QgsApplication::sendEvent( mFileOpenEventReceiver, &foe );
146+
QgsApplication::sendEvent( ABISYM( mFileOpenEventReceiver ), &foe );
147147
}
148-
mFileOpenEventList.clear();
148+
ABISYM( mFileOpenEventList ).clear();
149149
}
150150
}
151151

152152
void QgsApplication::setPrefixPath( const QString thePrefixPath, bool useDefaultPaths )
153153
{
154-
mPrefixPath = thePrefixPath;
154+
ABISYM( mPrefixPath ) = thePrefixPath;
155155
#if defined(_MSC_VER)
156-
if ( mPrefixPath.endsWith( "/bin" ) )
156+
if ( ABISYM( mPrefixPath ).endsWith( "/bin" ) )
157157
{
158-
mPrefixPath.chop( 4 );
158+
ABISYM( mPrefixPath ).chop( 4 );
159159
}
160160
#endif
161161
if ( useDefaultPaths )
162162
{
163-
setPluginPath( mPrefixPath + "/" + QString( QGIS_PLUGIN_SUBDIR ) );
164-
setPkgDataPath( mPrefixPath + "/" + QString( QGIS_DATA_SUBDIR ) );
163+
setPluginPath( ABISYM( mPrefixPath ) + "/" + QString( QGIS_PLUGIN_SUBDIR ) );
164+
setPkgDataPath( ABISYM( mPrefixPath ) + "/" + QString( QGIS_DATA_SUBDIR ) );
165165
}
166166
}
167167

168168
void QgsApplication::setPluginPath( const QString thePluginPath )
169169
{
170-
mPluginPath = thePluginPath;
170+
ABISYM( mPluginPath ) = thePluginPath;
171171
}
172172

173173
void QgsApplication::setPkgDataPath( const QString thePkgDataPath )
174174
{
175-
mPkgDataPath = thePkgDataPath;
176-
QString svgPath = mPkgDataPath + QString( "/svg/" );
175+
ABISYM( mPkgDataPath ) = thePkgDataPath;
176+
QString svgPath = ABISYM( mPkgDataPath ) + QString( "/svg/" );
177177
// avoid duplicate entries
178-
if ( !mDefaultSvgPaths.contains( svgPath ) )
179-
mDefaultSvgPaths << svgPath;
178+
if ( !ABISYM( mDefaultSvgPaths ).contains( svgPath ) )
179+
ABISYM( mDefaultSvgPaths ) << svgPath;
180180
}
181181

182182
void QgsApplication::setDefaultSvgPaths( const QStringList& pathList )
183183
{
184-
mDefaultSvgPaths = pathList;
184+
ABISYM( mDefaultSvgPaths ) = pathList;
185185
}
186186

187187
const QString QgsApplication::prefixPath()
188188
{
189-
return mPrefixPath;
189+
return ABISYM( mPrefixPath );
190190
}
191191
const QString QgsApplication::pluginPath()
192192
{
193-
return mPluginPath;
193+
return ABISYM( mPluginPath );
194194
}
195195
const QString QgsApplication::pkgDataPath()
196196
{
197-
return mPkgDataPath;
197+
return ABISYM( mPkgDataPath );
198198
}
199199
const QString QgsApplication::defaultThemePath()
200200
{
201201
return ":/images/themes/default/";
202202
}
203203
const QString QgsApplication::activeThemePath()
204204
{
205-
return ":/images/themes/" + mThemeName + "/";
205+
return ":/images/themes/" + ABISYM( mThemeName ) + "/";
206206
}
207207

208208

@@ -226,48 +226,48 @@ void QgsApplication::setThemeName( const QString theThemeName )
226226
//check it exists and if not roll back to default theme
227227
if ( QFile::exists( myPath ) )
228228
{
229-
mThemeName = theThemeName;
229+
ABISYM( mThemeName ) = theThemeName;
230230
}
231231
else
232232
{
233-
mThemeName = "default";
233+
ABISYM( mThemeName ) = "default";
234234
}
235235
}
236236
/*!
237237
* Get the active theme name
238238
*/
239239
const QString QgsApplication::themeName()
240240
{
241-
return mThemeName;
241+
return ABISYM( mThemeName );
242242
}
243243
/*!
244244
Returns the path to the authors file.
245245
*/
246246
const QString QgsApplication::authorsFilePath()
247247
{
248-
return mPkgDataPath + QString( "/doc/AUTHORS" );
248+
return ABISYM( mPkgDataPath ) + QString( "/doc/AUTHORS" );
249249
}
250250
/*!
251251
Returns the path to the contributors file.
252252
*/
253253
const QString QgsApplication::contributorsFilePath()
254254
{
255-
return mPkgDataPath + QString( "/doc/CONTRIBUTORS" );
255+
return ABISYM( mPkgDataPath ) + QString( "/doc/CONTRIBUTORS" );
256256
}
257257
/*!
258258
Returns the path to the sponsors file.
259259
*/
260260
const QString QgsApplication::sponsorsFilePath()
261261
{
262-
return mPkgDataPath + QString( "/doc/SPONSORS" );
262+
return ABISYM( mPkgDataPath ) + QString( "/doc/SPONSORS" );
263263
}
264264

265265
/*!
266266
Returns the path to the donors file.
267267
*/
268268
const QString QgsApplication::donorsFilePath()
269269
{
270-
return mPkgDataPath + QString( "/doc/DONORS" );
270+
return ABISYM( mPkgDataPath ) + QString( "/doc/DONORS" );
271271
}
272272

273273
/*!
@@ -276,14 +276,14 @@ const QString QgsApplication::donorsFilePath()
276276
*/
277277
const QString QgsApplication::translatorsFilePath()
278278
{
279-
return mPkgDataPath + QString( "/doc/TRANSLATORS" );
279+
return ABISYM( mPkgDataPath ) + QString( "/doc/TRANSLATORS" );
280280
}
281281
/*!
282282
Returns the path to the developer image directory.
283283
*/
284284
const QString QgsApplication::developerPath()
285285
{
286-
return mPkgDataPath + QString( "/images/developers/" );
286+
return ABISYM( mPkgDataPath ) + QString( "/images/developers/" );
287287
}
288288

289289
/*!
@@ -305,23 +305,23 @@ const QString QgsApplication::helpAppPath()
305305
*/
306306
const QString QgsApplication::i18nPath()
307307
{
308-
return mPkgDataPath + QString( "/i18n/" );
308+
return ABISYM( mPkgDataPath ) + QString( "/i18n/" );
309309
}
310310

311311
/*!
312312
Returns the path to the master qgis.db file.
313313
*/
314314
const QString QgsApplication::qgisMasterDbFilePath()
315315
{
316-
return mPkgDataPath + QString( "/resources/qgis.db" );
316+
return ABISYM( mPkgDataPath ) + QString( "/resources/qgis.db" );
317317
}
318318

319319
/*!
320320
Returns the path to the settings directory in user's home dir
321321
*/
322322
const QString QgsApplication::qgisSettingsDirPath()
323323
{
324-
return mConfigPath;
324+
return ABISYM( mConfigPath );
325325
}
326326

327327
/*!
@@ -337,22 +337,22 @@ const QString QgsApplication::qgisUserDbFilePath()
337337
*/
338338
const QString QgsApplication::splashPath()
339339
{
340-
return mPkgDataPath + QString( "/images/splash/" );
340+
return ABISYM( mPkgDataPath ) + QString( "/images/splash/" );
341341
}
342342

343343
/*!
344344
Returns the path to the icons image directory.
345345
*/
346346
const QString QgsApplication::iconsPath()
347347
{
348-
return mPkgDataPath + QString( "/images/icons/" );
348+
return ABISYM( mPkgDataPath ) + QString( "/images/icons/" );
349349
}
350350
/*!
351351
Returns the path to the srs.db file.
352352
*/
353353
const QString QgsApplication::srsDbFilePath()
354354
{
355-
return mPkgDataPath + QString( "/resources/srs.db" );
355+
return ABISYM( mPkgDataPath ) + QString( "/resources/srs.db" );
356356
}
357357

358358
/*!
@@ -370,7 +370,7 @@ const QStringList QgsApplication::svgPaths()
370370
myPathList = myPaths.split( "|" );
371371
}
372372

373-
myPathList << mDefaultSvgPaths;
373+
myPathList << ABISYM( mDefaultSvgPaths );
374374
return myPathList;
375375
}
376376

@@ -379,7 +379,7 @@ const QStringList QgsApplication::svgPaths()
379379
*/
380380
const QString QgsApplication::svgPath()
381381
{
382-
return mPkgDataPath + QString( "/svg/" );
382+
return ABISYM( mPkgDataPath ) + QString( "/svg/" );
383383
}
384384

385385
const QString QgsApplication::userStyleV2Path()
@@ -389,7 +389,7 @@ const QString QgsApplication::userStyleV2Path()
389389

390390
const QString QgsApplication::defaultStyleV2Path()
391391
{
392-
return mPkgDataPath + QString( "/resources/symbology-ng-style.xml" );
392+
return ABISYM( mPkgDataPath ) + QString( "/resources/symbology-ng-style.xml" );
393393
}
394394

395395
QgsApplication::endian_t QgsApplication::endian()
@@ -423,9 +423,9 @@ QString QgsApplication::showSettings()
423423
"Default Theme Path : %6\n"
424424
"SVG Search Paths : %7\n"
425425
"User DB Path : %8\n" )
426-
.arg( mPrefixPath )
427-
.arg( mPluginPath )
428-
.arg( mPkgDataPath )
426+
.arg( ABISYM( mPrefixPath ) )
427+
.arg( ABISYM( mPluginPath ) )
428+
.arg( ABISYM( mPkgDataPath ) )
429429
.arg( themeName() )
430430
.arg( activeThemePath() )
431431
.arg( defaultThemePath() )

src/core/qgsapplication.h

+10-8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include <qgis.h>
2323

24+
#define ABISYM(x) x ## VERSION_INT
25+
2426
/** \ingroup core
2527
* Extends QApplication to provide access to QGIS specific resources such
2628
* as theme paths, database paths etc.
@@ -202,16 +204,16 @@ class CORE_EXPORT QgsApplication: public QApplication
202204
static QString relativePathToAbsolutePath( QString rpath, QString targetPath );
203205

204206
private:
205-
static QObject* mFileOpenEventReceiver;
206-
static QStringList mFileOpenEventList;
207+
static QObject* ABISYM( mFileOpenEventReceiver );
208+
static QStringList ABISYM( mFileOpenEventList );
207209

208-
static QString mPrefixPath;
209-
static QString mPluginPath;
210-
static QString mPkgDataPath;
211-
static QString mThemeName;
212-
static QStringList mDefaultSvgPaths;
210+
static QString ABISYM( mPrefixPath );
211+
static QString ABISYM( mPluginPath );
212+
static QString ABISYM( mPkgDataPath );
213+
static QString ABISYM( mThemeName );
214+
static QStringList ABISYM( mDefaultSvgPaths );
213215

214-
static QString mConfigPath;
216+
static QString ABISYM( mConfigPath );
215217
};
216218

217219
#endif

0 commit comments

Comments
 (0)