QGIS API Documentation  2.6.0-Brighton
 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;
41  QgsApplication( int & argc, char ** argv, bool GUIenabled, QString customConfigPath = QString() );
42  virtual ~QgsApplication();
43 
49  static void init( QString customConfigPath = QString() );
50 
52  virtual bool event( QEvent * event );
53 
55  virtual bool notify( QObject * receiver, QEvent * event );
56 
58  static void setFileOpenEventReceiver( QObject * receiver );
59 
69  static void setThemeName( const QString &theThemeName );
70 
77  static const QString themeName();
78 
80  static const QString authorsFilePath();
81 
85  static const QString contributorsFilePath();
86 
88  static const QString sponsorsFilePath();
89 
91  static const QString donorsFilePath();
92 
96  static const QString translatorsFilePath();
97 
101  static const QString licenceFilePath();
102 
104  static const QString helpAppPath();
105 
107  static const QString i18nPath();
108 
110  static const QString qgisMasterDbFilePath();
111 
113  static const QString qgisSettingsDirPath();
114 
116  static const QString qgisUserDbFilePath();
117 
119  static const QString splashPath();
120 
122  static const QString iconsPath();
123 
125  static const QString srsDbFilePath();
126 
128  static const QStringList svgPaths();
129 
131  static const QMap<QString, QString> systemEnvVars() { return ABISYM( mSystemEnvVars ); }
132 
134  static const QString prefixPath();
135 
137  static const QString pluginPath();
138 
140  static const QString pkgDataPath();
141 
143  static const QString activeThemePath();
144 
146  static const QString defaultThemePath();
147 
150  static QString iconPath( QString iconFile );
151 
154  static QIcon getThemeIcon( const QString &theName );
155 
158  static QPixmap getThemePixmap( const QString &theName );
159 
161  static const QString userStyleV2Path();
162 
164  static const QString defaultStyleV2Path();
165 
167  static const QString libraryPath();
168 
170  static const QString libexecPath();
171 
173  static void setPrefixPath( const QString &thePrefixPath, bool useDefaultPaths = false );
174 
176  static void setPluginPath( const QString &thePluginPath );
177 
179  static void setPkgDataPath( const QString &thePkgDataPath );
180 
182  static void setDefaultSvgPaths( const QStringList& pathList );
183 
185  static void initQgis();
186 
188  static bool createDB( QString* errorMessage = 0 );
189 
191  static void exitQgis();
192 
194  typedef enum ENDIAN
195  {
196  XDR = 0, // network, or big-endian, byte order
197  NDR = 1 // little-endian byte order
198  }
199  endian_t;
200 
202  static endian_t endian();
203 
212  static QString reportStyleSheet();
213 
216  static QString showSettings();
217 
224  static void registerOgrDrivers();
225 
228  static QString absolutePathToRelativePath( QString apath, QString targetPath );
231  static QString relativePathToAbsolutePath( QString rpath, QString targetPath );
232 
234  static bool isRunningFromBuildDir() { return ABISYM( mRunningFromBuildDir ); }
235 #ifdef _MSC_VER
236  static QString cfgIntDir() { return ABISYM( mCfgIntDir ); }
237 #endif
238 
239  static QString buildSourcePath() { return ABISYM( mBuildSourcePath ); }
241  static QString buildOutputPath() { return ABISYM( mBuildOutputPath ); }
242 
247  static void skipGdalDriver( QString theDriver );
248 
253  static void restoreGdalDriver( QString theDriver );
254 
258  static QStringList skippedGdalDrivers() { return ABISYM( mGdalSkipList ); }
259 
264  static void applyGdalSkippedDrivers();
265 
268  static int maxThreads() { return ABISYM( mMaxThreads ); }
272  static void setMaxThreads( int maxThreads );
273 
274 #ifdef ANDROID
275  //dummy method to workaround sip generation issue issue
276  bool x11EventFilter( XEvent * event )
277  {
278  return 0;
279  }
280 #endif
281 
282  signals:
284  void preNotify( QObject * receiver, QEvent * event, bool * done );
285 
286  private:
287  static QObject* ABISYM( mFileOpenEventReceiver );
288  static QStringList ABISYM( mFileOpenEventList );
289 
290  static QString ABISYM( mPrefixPath );
291  static QString ABISYM( mPluginPath );
292  static QString ABISYM( mPkgDataPath );
293  static QString ABISYM( mLibraryPath );
294  static QString ABISYM( mLibexecPath );
295  static QString ABISYM( mThemeName );
296  static QStringList ABISYM( mDefaultSvgPaths );
297  static QMap<QString, QString> ABISYM( mSystemEnvVars );
298 
299  static QString ABISYM( mConfigPath );
300 
302  static bool ABISYM( mRunningFromBuildDir );
304  static QString ABISYM( mBuildSourcePath );
305 #ifdef _MSC_VER
306 
307  static QString ABISYM( mCfgIntDir );
308 #endif
309 
310  static QString ABISYM( mBuildOutputPath );
313  static QStringList ABISYM( mGdalSkipList );
316  static int ABISYM( mMaxThreads );
317 };
318 
319 #endif