QGIS API Documentation  2.2.0-Valmiera
 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:
39  QgsApplication( int & argc, char ** argv, bool GUIenabled, QString customConfigPath = QString() );
40  virtual ~QgsApplication();
41 
47  static void init( QString customConfigPath = QString() );
48 
50  virtual bool event( QEvent * event );
51 
53  virtual bool notify( QObject * receiver, QEvent * event );
54 
56  static void setFileOpenEventReceiver( QObject * receiver );
57 
67  static void setThemeName( const QString &theThemeName );
68 
75  static const QString themeName();
76 
78  static const QString authorsFilePath();
79 
84  static const QString contributorsFilePath();
85 
88  static const QString sponsorsFilePath();
89 
92  static const QString donorsFilePath();
93 
98  static const QString translatorsFilePath();
99 
103  static const QString licenceFilePath();
104 
106  static const QString helpAppPath();
107 
109  static const QString i18nPath();
110 
112  static const QString qgisMasterDbFilePath();
113 
115  static const QString qgisSettingsDirPath();
116 
118  static const QString qgisUserDbFilePath();
119 
121  static const QString splashPath();
122 
124  static const QString iconsPath();
125 
127  static const QString srsDbFilePath();
128 
131  static const QStringList svgPaths();
132 
135  static const QMap<QString, QString> systemEnvVars() { return ABISYM( mSystemEnvVars ); }
136 
138  static const QString prefixPath();
139 
141  static const QString pluginPath();
142 
144  static const QString pkgDataPath();
145 
147  static const QString activeThemePath();
148 
150  static const QString defaultThemePath();
151 
155  static QString iconPath( QString iconFile );
156 
160  static QIcon getThemeIcon( const QString &theName );
161 
165  static QPixmap getThemePixmap( const QString &theName );
166 
168  static const QString userStyleV2Path();
169 
171  static const QString defaultStyleV2Path();
172 
175  static const QString libraryPath();
176 
179  static const QString libexecPath();
180 
182  static void setPrefixPath( const QString &thePrefixPath, bool useDefaultPaths = false );
183 
185  static void setPluginPath( const QString &thePluginPath );
186 
188  static void setPkgDataPath( const QString &thePkgDataPath );
189 
191  static void setDefaultSvgPaths( const QStringList& pathList );
192 
194  static void initQgis();
195 
197  static bool createDB( QString* errorMessage = 0 );
198 
200  static void exitQgis();
201 
203  typedef enum ENDIAN
204  {
205  XDR = 0, // network, or big-endian, byte order
206  NDR = 1 // little-endian byte order
207  }
208  endian_t;
209 
211  static endian_t endian();
212 
221  static QString reportStyleSheet();
222 
225  static QString showSettings();
226 
233  static void registerOgrDrivers();
234 
237  static QString absolutePathToRelativePath( QString apath, QString targetPath );
240  static QString relativePathToAbsolutePath( QString rpath, QString targetPath );
241 
244  static bool isRunningFromBuildDir() { return ABISYM( mRunningFromBuildDir ); }
245 #ifdef _MSC_VER
246  static QString cfgIntDir() { return ABISYM( mCfgIntDir ); }
247 #endif
248 
250  static QString buildSourcePath() { return ABISYM( mBuildSourcePath ); }
253  static QString buildOutputPath() { return ABISYM( mBuildOutputPath ); }
254 
260  static void skipGdalDriver( QString theDriver );
261 
267  static void restoreGdalDriver( QString theDriver );
268 
273  static QStringList skippedGdalDrivers( ) { return ABISYM( mGdalSkipList ); }
274 
280  static void applyGdalSkippedDrivers();
281 
282 #ifdef ANDROID
283  //dummy method to workaround sip generation issue issue
284  bool x11EventFilter( XEvent * event )
285  {
286  return 0;
287  }
288 #endif
289 
290  signals:
292  void preNotify( QObject * receiver, QEvent * event, bool * done );
293 
294  private:
295  static QObject* ABISYM( mFileOpenEventReceiver );
296  static QStringList ABISYM( mFileOpenEventList );
297 
298  static QString ABISYM( mPrefixPath );
299  static QString ABISYM( mPluginPath );
300  static QString ABISYM( mPkgDataPath );
301  static QString ABISYM( mLibraryPath );
302  static QString ABISYM( mLibexecPath );
303  static QString ABISYM( mThemeName );
304  static QStringList ABISYM( mDefaultSvgPaths );
305  static QMap<QString, QString> ABISYM( mSystemEnvVars );
306 
307  static QString ABISYM( mConfigPath );
308 
310  static bool ABISYM( mRunningFromBuildDir );
312  static QString ABISYM( mBuildSourcePath );
313 #ifdef _MSC_VER
314 
315  static QString ABISYM( mCfgIntDir );
316 #endif
317 
318  static QString ABISYM( mBuildOutputPath );
322  static QStringList ABISYM( mGdalSkipList );
323 };
324 
325 #endif