QGIS API Documentation  2.4.0-Chugiak
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsapplication.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsapplication.h - Accessors for application-wide data
3  --------------------------------------
4  Date : 02-Jan-2006
5  Copyright : (C) 2006 by Tom Elwertowski
6  Email : telwertowski at users dot sourceforge dot net
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSAPPLICATION_H
16 #define QGSAPPLICATION_H
17 
18 #include <QApplication>
19 #include <QEvent>
20 #include <QStringList>
21 
22 #include <qgis.h>
23 #include <qgsconfig.h>
24 
30 #ifdef ANDROID
31 typedef void XEvent;
32 #endif
33 
34 class CORE_EXPORT QgsApplication : public QApplication
35 {
36  Q_OBJECT
37  public:
38  static const char* QGIS_ORGANIZATION_NAME;
39  static const char* QGIS_ORGANIZATION_DOMAIN;
40  static const char* QGIS_APPLICATION_NAME;
42  QgsApplication( int & argc, char ** argv, bool GUIenabled, QString customConfigPath = QString() );
43  virtual ~QgsApplication();
44 
50  static void init( QString customConfigPath = QString() );
51 
53  virtual bool event( QEvent * event );
54 
56  virtual bool notify( QObject * receiver, QEvent * event );
57 
59  static void setFileOpenEventReceiver( QObject * receiver );
60 
70  static void setThemeName( const QString &theThemeName );
71 
78  static const QString themeName();
79 
81  static const QString authorsFilePath();
82 
87  static const QString contributorsFilePath();
88 
91  static const QString sponsorsFilePath();
92 
95  static const QString donorsFilePath();
96 
101  static const QString translatorsFilePath();
102 
106  static const QString licenceFilePath();
107 
109  static const QString helpAppPath();
110 
112  static const QString i18nPath();
113 
115  static const QString qgisMasterDbFilePath();
116 
118  static const QString qgisSettingsDirPath();
119 
121  static const QString qgisUserDbFilePath();
122 
124  static const QString splashPath();
125 
127  static const QString iconsPath();
128 
130  static const QString srsDbFilePath();
131 
134  static const QStringList svgPaths();
135 
138  static const QMap<QString, QString> systemEnvVars() { return ABISYM( mSystemEnvVars ); }
139 
141  static const QString prefixPath();
142 
144  static const QString pluginPath();
145 
147  static const QString pkgDataPath();
148 
150  static const QString activeThemePath();
151 
153  static const QString defaultThemePath();
154 
158  static QString iconPath( QString iconFile );
159 
163  static QIcon getThemeIcon( const QString &theName );
164 
168  static QPixmap getThemePixmap( const QString &theName );
169 
171  static const QString userStyleV2Path();
172 
174  static const QString defaultStyleV2Path();
175 
178  static const QString libraryPath();
179 
182  static const QString libexecPath();
183 
185  static void setPrefixPath( const QString &thePrefixPath, bool useDefaultPaths = false );
186 
188  static void setPluginPath( const QString &thePluginPath );
189 
191  static void setPkgDataPath( const QString &thePkgDataPath );
192 
194  static void setDefaultSvgPaths( const QStringList& pathList );
195 
197  static void initQgis();
198 
200  static bool createDB( QString* errorMessage = 0 );
201 
203  static void exitQgis();
204 
206  typedef enum ENDIAN
207  {
208  XDR = 0, // network, or big-endian, byte order
209  NDR = 1 // little-endian byte order
210  }
211  endian_t;
212 
214  static endian_t endian();
215 
224  static QString reportStyleSheet();
225 
228  static QString showSettings();
229 
236  static void registerOgrDrivers();
237 
240  static QString absolutePathToRelativePath( QString apath, QString targetPath );
243  static QString relativePathToAbsolutePath( QString rpath, QString targetPath );
244 
247  static bool isRunningFromBuildDir() { return ABISYM( mRunningFromBuildDir ); }
248 #ifdef _MSC_VER
249  static QString cfgIntDir() { return ABISYM( mCfgIntDir ); }
250 #endif
251 
253  static QString buildSourcePath() { return ABISYM( mBuildSourcePath ); }
256  static QString buildOutputPath() { return ABISYM( mBuildOutputPath ); }
257 
263  static void skipGdalDriver( QString theDriver );
264 
270  static void restoreGdalDriver( QString theDriver );
271 
276  static QStringList skippedGdalDrivers() { return ABISYM( mGdalSkipList ); }
277 
283  static void applyGdalSkippedDrivers();
284 
287  static int maxThreads() { return ABISYM( mMaxThreads ); }
291  static void setMaxThreads( int maxThreads );
292 
293 #ifdef ANDROID
294  //dummy method to workaround sip generation issue issue
295  bool x11EventFilter( XEvent * event )
296  {
297  return 0;
298  }
299 #endif
300 
301  signals:
303  void preNotify( QObject * receiver, QEvent * event, bool * done );
304 
305  private:
306  static QObject* ABISYM( mFileOpenEventReceiver );
307  static QStringList ABISYM( mFileOpenEventList );
308 
309  static QString ABISYM( mPrefixPath );
310  static QString ABISYM( mPluginPath );
311  static QString ABISYM( mPkgDataPath );
312  static QString ABISYM( mLibraryPath );
313  static QString ABISYM( mLibexecPath );
314  static QString ABISYM( mThemeName );
315  static QStringList ABISYM( mDefaultSvgPaths );
316  static QMap<QString, QString> ABISYM( mSystemEnvVars );
317 
318  static QString ABISYM( mConfigPath );
319 
321  static bool ABISYM( mRunningFromBuildDir );
323  static QString ABISYM( mBuildSourcePath );
324 #ifdef _MSC_VER
325 
326  static QString ABISYM( mCfgIntDir );
327 #endif
328 
329  static QString ABISYM( mBuildOutputPath );
333  static QStringList ABISYM( mGdalSkipList );
336  static int ABISYM( mMaxThreads );
337 };
338 
339 #endif
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.
ENDIAN
constants for endian-ness
static QStringList skippedGdalDrivers()
Returns the list of gdal drivers that should be skipped (based on GDAL_SKIP environment variable) ...
static bool isRunningFromBuildDir()
Indicates whether running from build directory (not installed)
static int maxThreads()
Get maximum concurrent thread count.
static QString buildOutputPath()
Returns path to the build output directory.
static const char * QGIS_ORGANIZATION_NAME
static const QMap< QString, QString > systemEnvVars()
Returns the system environment variables passed to application.
static QString buildSourcePath()
Returns path to the source directory.
static const char * QGIS_ORGANIZATION_DOMAIN
QObject * ABISYM(QgsApplication::mFileOpenEventReceiver)
static const char * QGIS_APPLICATION_NAME