15 #ifndef QGSAPPLICATION_H
16 #define QGSAPPLICATION_H
18 #include "qgis_core.h"
19 #include <QApplication>
21 #include <QStringList>
24 #include "qgsconfig.h"
47 class QgsAnnotationRegistry;
84 static char **qtgui_ArgvToC( PyObject *argvlist,
int &argc )
88 argc = PyList_GET_SIZE( argvlist );
92 if ( ( argv = (
char ** )sipMalloc( 2 * ( argc + 1 ) *
sizeof(
char * ) ) ) == NULL )
96 for (
int a = 0; a < argc; ++a )
100 if ( ( arg = PyBytes_AsString( PyList_GET_ITEM( argvlist, a ) ) ) == NULL ||
101 ( argv[a] = (
char * )sipMalloc( strlen( arg ) + 1 ) ) == NULL )
104 strcpy( argv[a], arg );
105 argv[a + argc + 1] = argv[a];
108 argv[argc + argc + 1] = argv[argc] = NULL;
115 static void qtgui_UpdatePyArgv( PyObject *argvlist,
int argc,
char **argv )
117 for (
int a = 0, na = 0; a < argc; ++a )
120 if ( argv[na] == argv[a + argc + 1] )
123 PyList_SetSlice( argvlist, na, na + 1, NULL );
151 QgsApplication(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"desktop" );
153 QgsApplication( SIP_PYLIST argv,
bool GUIenabled, QString profileFolder = QString(), QString platformName =
"desktop" ) / PostHook = __pyQtQAppHook__ / [(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"desktop" )];
161 if ( ( argv = qtgui_ArgvToC( a0, argc ) ) == NULL )
166 static int nargc = argc;
168 sipCpp =
new sipQgsApplication( nargc, argv, a1, *a2, *a3 );
171 qtgui_UpdatePyArgv( a0, argc, argv );
192 static void init( QString profileFolder = QString() )
SIP_SKIP;
195 bool event( QEvent *event ) override;
198 bool notify( QObject *receiver, QEvent *event ) override;
201 static
void setFileOpenEventReceiver( QObject *receiver );
213 static
void setThemeName( const QString &themeName );
219 static QString resolvePkgPath();
228 static QString themeName();
237 static
void setUITheme( const QString &themeName );
245 static QHash<QString, QString> uiThemes();
248 static QString authorsFilePath();
254 static QString contributorsFilePath();
261 static QString developersMapFilePath();
264 static QString sponsorsFilePath();
267 static QString donorsFilePath();
270 static QString serverResourcesPath();
275 static QString translatorsFilePath();
280 static QString licenceFilePath();
283 static QString i18nPath();
289 static QString metadataPath();
292 static QString qgisMasterDatabaseFilePath();
295 static QString qgisSettingsDirPath();
298 static QString qgisUserDatabaseFilePath();
301 static QString qgisAuthDatabaseFilePath();
304 static QString splashPath();
307 static QString iconsPath();
310 static QString srsDatabaseFilePath();
313 static QStringList svgPaths();
319 static QStringList layoutTemplatePaths();
322 static QMap<QString, QString> systemEnvVars();
325 static QString prefixPath();
328 static QString pluginPath();
331 static QString pkgDataPath();
334 static QString activeThemePath();
337 static QString defaultThemePath();
343 static QString iconPath( const QString &iconFile );
349 static QIcon getThemeIcon( const QString &name );
372 static QCursor getThemeCursor( Cursor cursor );
378 static QPixmap getThemePixmap(
const QString &name );
381 static QString userStylePath();
384 static QRegExp shortNameRegExp();
391 static QString userLoginName();
398 static QString userFullName();
405 static QString osName();
412 static QString platform();
418 static QString locale();
421 static QString userThemesFolder();
424 static QString defaultStylePath();
427 static QString defaultThemesFolder();
430 static QString libraryPath();
433 static QString libexecPath();
441 static QString qmlImportPath();
444 static void setPrefixPath(
const QString &prefixPath,
bool useDefaultPaths =
false );
447 static void setPluginPath(
const QString &pluginPath );
450 static void setPkgDataPath(
const QString &pkgDataPath );
453 static void setDefaultSvgPaths(
const QStringList &pathList );
456 static void setAuthDatabaseDirPath(
const QString &authDbDirPath );
459 static void initQgis();
462 static bool createDatabase( QString *errorMessage =
nullptr );
465 static bool createThemeFolder();
468 static void exitQgis();
471 static QString appIconPath();
481 static endian_t endian();
502 static QString showSettings();
511 static void registerOgrDrivers();
514 static QString absolutePathToRelativePath(
const QString &apath,
const QString &targetPath );
516 static QString relativePathToAbsolutePath(
const QString &rpath,
const QString &targetPath );
520 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
521 static QString cfgIntDir()
SIP_SKIP;
523 static QString buildSourcePath();
526 static QString buildOutputPath();
533 static void skipGdalDriver(
const QString &driver );
540 static void restoreGdalDriver(
const QString &driver );
546 static QStringList skippedGdalDrivers();
554 static void applyGdalSkippedDrivers();
560 static void registerGdalDriversFromSettings();
568 static QStringList deferredSkippedGdalDrivers();
576 static void setSkippedGdalDrivers(
const QStringList &skippedGdalDrivers,
577 const QStringList &deferredSkippedGdalDrivers );
582 static int maxThreads();
588 static void setMaxThreads(
int maxThreads );
741 static QgsAnnotationRegistry *annotationRegistry()
SIP_SKIP;
810 static QString nullRepresentation();
815 static
void setNullRepresentation( const QString &nullRepresentation );
824 static QVariantMap customVariables();
833 static
void setCustomVariables( const QVariantMap &customVariables );
840 static
void setCustomVariable( const QString &name, const QVariant &value );
850 int maxConcurrentConnectionsPerPool() const;
857 static
void setTranslation( const QString &translation );
869 bool x11EventFilter( XEvent *event );
875 void preNotify( QObject *receiver, QEvent *event,
bool *done )
SIP_SKIP;
881 void customVariablesChanged();
887 void nullRepresentationChanged();
899 static void copyPath(
const QString &src,
const QString &dst );
900 static QObject *
ABISYM( mFileOpenEventReceiver );
902 static bool ABISYM( mInitialized );
905 static bool ABISYM( mRunningFromBuildDir );
909 static int ABISYM( sMaxThreads );
911 QMap<QString, QIcon> mIconCache;
912 QMap<Cursor, QCursor> mCursorCache;
914 QTranslator *mQgisTranslator =
nullptr;
915 QTranslator *mQtTranslator =
nullptr;
920 struct ApplicationMembers
924 QgsAnnotationRegistry *mAnnotationRegistry =
nullptr;
953 QString mNullRepresentation;
955 ApplicationMembers();
956 ~ApplicationMembers();
960 ApplicationMembers *mApplicationMembers =
nullptr;
962 static ApplicationMembers *sApplicationMembers;
966 static ApplicationMembers *members();
968 static void invalidateCaches();