QGIS API Documentation  2.0.1-Dufour
 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 
29 class CORE_EXPORT QgsApplication: public QApplication
30 {
31  Q_OBJECT
32  public:
34  QgsApplication( int & argc, char ** argv, bool GUIenabled, QString customConfigPath = QString() );
35  virtual ~QgsApplication();
36 
42  static void init( QString customConfigPath = QString() );
43 
45  virtual bool event( QEvent * event );
46 
48  virtual bool notify( QObject * receiver, QEvent * event );
49 
51  static void setFileOpenEventReceiver( QObject * receiver );
52 
62  static void setThemeName( const QString theThemeName );
63 
70  static const QString themeName();
71 
73  static const QString authorsFilePath();
74 
79  static const QString contributorsFilePath();
80 
83  static const QString sponsorsFilePath();
84 
87  static const QString donorsFilePath();
88 
93  static const QString translatorsFilePath();
94 
98  static const QString licenceFilePath();
99 
101  static const QString helpAppPath();
102 
104  static const QString i18nPath();
105 
107  static const QString qgisMasterDbFilePath();
108 
110  static const QString qgisSettingsDirPath();
111 
113  static const QString qgisUserDbFilePath();
114 
116  static const QString splashPath();
117 
119  static const QString iconsPath();
120 
122  static const QString srsDbFilePath();
123 
126  static const QStringList svgPaths();
127 
130  static const QMap<QString, QString> systemEnvVars() { return ABISYM( mSystemEnvVars ); }
131 
133  static const QString prefixPath();
134 
136  static const QString pluginPath();
137 
139  static const QString pkgDataPath();
140 
142  static const QString activeThemePath();
143 
145  static const QString defaultThemePath();
146 
150  static QString iconPath( QString iconFile );
151 
155  static QIcon getThemeIcon( const QString theName );
156 
160  static QPixmap getThemePixmap( const QString theName );
161 
163  static const QString userStyleV2Path();
164 
166  static const QString defaultStyleV2Path();
167 
170  static const QString libraryPath();
171 
174  static const QString libexecPath();
175 
177  static void setPrefixPath( const QString thePrefixPath, bool useDefaultPaths = false );
178 
180  static void setPluginPath( const QString thePluginPath );
181 
183  static void setPkgDataPath( const QString thePkgDataPath );
184 
186  static void setDefaultSvgPaths( const QStringList& pathList );
187 
189  static void initQgis();
190 
192  static bool createDB( QString* errorMessage = 0 );
193 
195  static void exitQgis();
196 
198  typedef enum ENDIAN
199  {
200  XDR = 0, // network, or big-endian, byte order
201  NDR = 1 // little-endian byte order
202  }
203  endian_t;
204 
206  static endian_t endian();
207 
216  static QString reportStyleSheet();
217 
220  static QString showSettings();
221 
228  static void registerOgrDrivers();
229 
232  static QString absolutePathToRelativePath( QString apath, QString targetPath );
235  static QString relativePathToAbsolutePath( QString rpath, QString targetPath );
236 
239  static bool isRunningFromBuildDir() { return ABISYM( mRunningFromBuildDir ); }
240 #ifdef _MSC_VER
241  static QString cfgIntDir() { return ABISYM( mCfgIntDir ); }
242 #endif
243 
245  static QString buildSourcePath() { return ABISYM( mBuildSourcePath ); }
248  static QString buildOutputPath() { return ABISYM( mBuildOutputPath ); }
249 
255  static void skipGdalDriver( QString theDriver );
256 
262  static void restoreGdalDriver( QString theDriver );
263 
268  static QStringList skippedGdalDrivers( ) { return ABISYM( mGdalSkipList ); }
269 
275  static void applyGdalSkippedDrivers();
276 
277  signals:
279  void preNotify( QObject * receiver, QEvent * event, bool * done );
280 
281  private:
282  static QObject* ABISYM( mFileOpenEventReceiver );
283  static QStringList ABISYM( mFileOpenEventList );
284 
285  static QString ABISYM( mPrefixPath );
286  static QString ABISYM( mPluginPath );
287  static QString ABISYM( mPkgDataPath );
288  static QString ABISYM( mLibraryPath );
289  static QString ABISYM( mLibexecPath );
290  static QString ABISYM( mThemeName );
291  static QStringList ABISYM( mDefaultSvgPaths );
292  static QMap<QString, QString> ABISYM( mSystemEnvVars );
293 
294  static QString ABISYM( mConfigPath );
295 
297  static bool ABISYM( mRunningFromBuildDir );
299  static QString ABISYM( mBuildSourcePath );
300 #ifdef _MSC_VER
301 
302  static QString ABISYM( mCfgIntDir );
303 #endif
304 
305  static QString ABISYM( mBuildOutputPath );
309  static QStringList ABISYM( mGdalSkipList );
310 };
311 
312 #endif