15 #ifndef QGSAPPLICATION_H
16 #define QGSAPPLICATION_H
18 #include "qgis_core.h"
19 #include <QApplication>
21 #include <QStringList>
25 #include "qgsconfig.h"
50 class QgsAnnotationRegistry;
88 static char **qtgui_ArgvToC( PyObject *argvlist,
int &argc )
92 argc = PyList_GET_SIZE( argvlist );
96 if ( ( argv = (
char ** )sipMalloc( 2 * ( argc + 1 ) *
sizeof(
char * ) ) ) == NULL )
100 for (
int a = 0; a < argc; ++a )
104 if ( ( arg = PyBytes_AsString( PyList_GET_ITEM( argvlist, a ) ) ) == NULL ||
105 ( argv[a] = (
char * )sipMalloc( strlen( arg ) + 1 ) ) == NULL )
108 strcpy( argv[a], arg );
109 argv[a + argc + 1] = argv[a];
112 argv[argc + argc + 1] = argv[argc] = NULL;
119 static void qtgui_UpdatePyArgv( PyObject *argvlist,
int argc,
char **argv )
121 for (
int a = 0, na = 0; a < argc; ++a )
124 if ( argv[na] == argv[a + argc + 1] )
127 PyList_SetSlice( argvlist, na, na + 1, NULL );
155 QgsApplication(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"desktop" );
157 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" )];
165 if ( ( argv = qtgui_ArgvToC( a0, argc ) ) == NULL )
170 static int nargc = argc;
172 sipCpp =
new sipQgsApplication( nargc, argv, a1, *a2, *a3 );
175 qtgui_UpdatePyArgv( a0, argc, argv );
196 static void init( QString profileFolder = QString() )
SIP_SKIP;
199 bool event( QEvent *event ) override;
202 bool notify( QObject *receiver, QEvent *event ) override;
205 static
void setFileOpenEventReceiver( QObject *receiver );
217 static
void setThemeName( const QString &themeName );
223 static QString resolvePkgPath();
232 static QString themeName();
241 static
void setUITheme( const QString &themeName );
249 static QHash<QString, QString> uiThemes();
252 static QString authorsFilePath();
259 static QString contributorsFilePath();
267 static QString developersMapFilePath();
270 static QString sponsorsFilePath();
273 static QString donorsFilePath();
276 static QString serverResourcesPath();
281 static QString translatorsFilePath();
286 static QString licenceFilePath();
289 static QString i18nPath();
295 static QString metadataPath();
298 static QString qgisMasterDatabaseFilePath();
301 static QString qgisSettingsDirPath();
304 static QString qgisUserDatabaseFilePath();
307 static QString qgisAuthDatabaseFilePath();
310 static QString splashPath();
313 static QString iconsPath();
316 static QString srsDatabaseFilePath();
319 static QStringList svgPaths();
325 static QStringList layoutTemplatePaths();
328 static QMap<QString, QString> systemEnvVars();
331 static QString prefixPath();
334 static QString pluginPath();
337 static QString pkgDataPath();
340 static QString activeThemePath();
343 static QString defaultThemePath();
349 static QString iconPath( const QString &iconFile );
355 static QIcon getThemeIcon( const QString &name );
378 static QCursor getThemeCursor( Cursor cursor );
388 static QPixmap getThemePixmap(
const QString &name,
const QColor &foreColor = QColor(),
const QColor &backColor = QColor(),
int size = 16 );
391 static QString userStylePath();
394 static QRegExp shortNameRegExp();
401 static QString userLoginName();
408 static QString userFullName();
415 static QString osName();
422 static QString platform();
428 static QString locale();
431 static QString userThemesFolder();
434 static QString defaultStylePath();
437 static QString defaultThemesFolder();
440 static QString libraryPath();
443 static QString libexecPath();
451 static QString qmlImportPath();
454 static void setPrefixPath(
const QString &prefixPath,
bool useDefaultPaths =
false );
457 static void setPluginPath(
const QString &pluginPath );
460 static void setPkgDataPath(
const QString &pkgDataPath );
463 static void setDefaultSvgPaths(
const QStringList &pathList );
466 static void setAuthDatabaseDirPath(
const QString &authDbDirPath );
469 static void initQgis();
472 static bool createDatabase( QString *errorMessage =
nullptr );
475 static bool createThemeFolder();
478 static void exitQgis();
481 static QString appIconPath();
491 static endian_t endian();
513 static QString showSettings();
522 static void registerOgrDrivers();
525 static QString absolutePathToRelativePath(
const QString &apath,
const QString &targetPath );
527 static QString relativePathToAbsolutePath(
const QString &rpath,
const QString &targetPath );
531 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
532 static QString cfgIntDir()
SIP_SKIP;
534 static QString buildSourcePath();
537 static QString buildOutputPath();
544 static void skipGdalDriver(
const QString &driver );
551 static void restoreGdalDriver(
const QString &driver );
557 static QStringList skippedGdalDrivers();
565 static void applyGdalSkippedDrivers();
571 static void registerGdalDriversFromSettings();
579 static QStringList deferredSkippedGdalDrivers();
587 static void setSkippedGdalDrivers(
const QStringList &skippedGdalDrivers,
588 const QStringList &deferredSkippedGdalDrivers );
594 static int maxThreads();
601 static void setMaxThreads(
int maxThreads );
767 static QgsAnnotationRegistry *annotationRegistry()
SIP_SKIP;
842 static QString nullRepresentation();
847 static
void setNullRepresentation( const QString &nullRepresentation );
856 static QVariantMap customVariables();
865 static
void setCustomVariables( const QVariantMap &customVariables );
872 static
void setCustomVariable( const QString &name, const QVariant &value );
883 static
int scaleIconSize(
int standardSize,
bool applyDevicePixelRatio = false );
893 int maxConcurrentConnectionsPerPool() const;
900 static
void setTranslation( const QString &translation );
912 bool x11EventFilter( XEvent *event );
942 static void copyPath(
const QString &src,
const QString &dst );
943 static QObject *
ABISYM( mFileOpenEventReceiver );
945 static bool ABISYM( mInitialized );
948 static bool ABISYM( mRunningFromBuildDir );
953 static int ABISYM( sMaxThreads );
955 QMap<QString, QIcon> mIconCache;
956 QMap<Cursor, QCursor> mCursorCache;
958 QTranslator *mQgisTranslator =
nullptr;
959 QTranslator *mQtTranslator =
nullptr;
964 struct ApplicationMembers
969 QgsAnnotationRegistry *mAnnotationRegistry =
nullptr;
999 QString mNullRepresentation;
1001 ApplicationMembers();
1002 ~ApplicationMembers();
1006 ApplicationMembers *mApplicationMembers =
nullptr;
1008 static ApplicationMembers *sApplicationMembers;
1012 static ApplicationMembers *members();
1014 static void invalidateCaches();