15 #ifndef QGSAPPLICATION_H 16 #define QGSAPPLICATION_H 18 #include "qgis_core.h" 19 #include <QApplication> 21 #include <QStringList> 24 #include "qgsconfig.h" 43 class QgsAnnotationRegistry;
72 static char **qtgui_ArgvToC( PyObject *argvlist,
int &argc )
76 argc = PyList_GET_SIZE( argvlist );
80 if ( ( argv = (
char ** )sipMalloc( 2 * ( argc + 1 ) *
sizeof(
char * ) ) ) == NULL )
84 for (
int a = 0; a < argc; ++a )
88 if ( ( arg = PyBytes_AsString( PyList_GET_ITEM( argvlist, a ) ) ) == NULL ||
89 ( argv[a] = (
char * )sipMalloc( strlen( arg ) + 1 ) ) == NULL )
92 strcpy( argv[a], arg );
93 argv[a + argc + 1] = argv[a];
96 argv[argc + argc + 1] = argv[argc] = NULL;
103 static void qtgui_UpdatePyArgv( PyObject *argvlist,
int argc,
char **argv )
105 for (
int a = 0, na = 0; a < argc; ++a )
108 if ( argv[na] == argv[a + argc + 1] )
111 PyList_SetSlice( argvlist, na, na + 1, NULL );
125 QgsApplication(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"desktop" );
127 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" )];
135 if ( ( argv = qtgui_ArgvToC( a0, argc ) ) == NULL )
140 static int nargc = argc;
142 sipCpp =
new sipQgsApplication( nargc, argv, a1, *a2, *a3 );
145 qtgui_UpdatePyArgv( a0, argc, argv );
166 static void init( QString profileFolder = QString() )
SIP_SKIP;
169 bool event( QEvent *event ) override;
172 bool notify( QObject *receiver, QEvent *event ) override;
175 static
void setFileOpenEventReceiver( QObject *receiver );
187 static
void setThemeName( const QString &themeName );
193 static QString resolvePkgPath( );
202 static QString themeName();
211 static
void setUITheme( const QString &themeName );
219 static QHash<QString, QString> uiThemes();
222 static QString authorsFilePath();
228 static QString contributorsFilePath();
235 static QString developersMapFilePath();
238 static QString sponsorsFilePath();
241 static QString donorsFilePath();
244 static QString serverResourcesPath();
249 static QString translatorsFilePath();
254 static QString licenceFilePath();
257 static QString i18nPath();
263 static QString metadataPath();
266 static QString qgisMasterDatabaseFilePath();
269 static QString qgisSettingsDirPath();
272 static QString qgisUserDatabaseFilePath();
275 static QString qgisAuthDatabaseFilePath();
278 static QString splashPath();
281 static QString iconsPath();
284 static QString srsDatabaseFilePath();
287 static QStringList svgPaths();
293 static QStringList layoutTemplatePaths();
296 static QMap<QString, QString> systemEnvVars() {
return ABISYM( mSystemEnvVars ); }
299 static QString prefixPath();
302 static QString pluginPath();
305 static QString pkgDataPath();
308 static QString activeThemePath();
311 static QString defaultThemePath();
317 static QString
iconPath(
const QString &iconFile );
323 static QIcon getThemeIcon(
const QString &name );
346 static QCursor getThemeCursor(
Cursor cursor );
352 static QPixmap getThemePixmap(
const QString &name );
355 static QString userStylePath();
358 static QRegExp shortNameRegExp();
365 static QString userLoginName();
372 static QString userFullName();
379 static QString osName();
386 static QString platform();
392 static QString locale();
395 static QString userThemesFolder();
398 static QString defaultStylePath();
401 static QString defaultThemesFolder();
404 static QString libraryPath();
407 static QString libexecPath();
415 static QString qmlImportPath();
418 static void setPrefixPath(
const QString &prefixPath,
bool useDefaultPaths =
false );
421 static void setPluginPath(
const QString &pluginPath );
424 static void setPkgDataPath(
const QString &pkgDataPath );
427 static void setDefaultSvgPaths(
const QStringList &pathList );
430 static void setAuthDatabaseDirPath(
const QString &authDbDirPath );
433 static void initQgis();
436 static bool createDatabase( QString *errorMessage =
nullptr );
439 static bool createThemeFolder();
442 static void exitQgis();
445 static QString appIconPath();
465 char *data =
reinterpret_cast<char *
>( &value );
466 std::size_t n =
sizeof( value );
467 for ( std::size_t i = 0, m = n / 2; i < m; ++i )
469 std::swap( data[i], data[n - 1 - i] );
485 static QString reportStyleSheet();
490 static QString showSettings();
499 static void registerOgrDrivers();
502 static QString absolutePathToRelativePath(
const QString &apath,
const QString &targetPath );
504 static QString relativePathToAbsolutePath(
const QString &rpath,
const QString &targetPath );
509 static QString cfgIntDir() {
return ABISYM( mCfgIntDir ); }
SIP_SKIP 511 static QString buildSourcePath() {
return ABISYM( mBuildSourcePath ); }
521 static void skipGdalDriver(
const QString &driver );
528 static void restoreGdalDriver(
const QString &driver );
541 static void applyGdalSkippedDrivers();
552 static void setMaxThreads(
int maxThreads );
662 static QgsAnnotationRegistry *annotationRegistry()
SIP_SKIP;
702 static QString nullRepresentation();
707 static void setNullRepresentation(
const QString &nullRepresentation );
716 static QVariantMap customVariables();
725 static void setCustomVariables(
const QVariantMap &customVariables );
733 static void setCustomVariable(
const QString &name,
const QVariant &value );
738 bool x11EventFilter( XEvent *event );
744 void preNotify( QObject *receiver, QEvent *event,
bool *done )
SIP_SKIP;
750 void customVariablesChanged();
756 void nullRepresentationChanged();
760 static void copyPath(
const QString &src,
const QString &dst );
761 static QObject *
ABISYM( mFileOpenEventReceiver );
762 static QStringList
ABISYM( mFileOpenEventList );
764 static QString
ABISYM( mProfilePath );
765 static QString
ABISYM( mUIThemeName );
766 static QString
ABISYM( mPrefixPath );
767 static QString
ABISYM( mPluginPath );
768 static QString
ABISYM( mPkgDataPath );
769 static QString
ABISYM( mLibraryPath );
770 static QString
ABISYM( mLibexecPath );
771 static QString
ABISYM( mQmlImportPath );
772 static QString
ABISYM( mThemeName );
773 static QStringList
ABISYM( mDefaultSvgPaths );
774 static QMap<QString, QString>
ABISYM( mSystemEnvVars );
776 static QString
ABISYM( mConfigPath );
778 static bool ABISYM( mInitialized );
781 static bool ABISYM( mRunningFromBuildDir );
783 static QString
ABISYM( mBuildSourcePath );
785 static QString
ABISYM( mCfgIntDir );
788 static QString
ABISYM( mBuildOutputPath );
794 static QStringList
ABISYM( mGdalSkipList );
798 static int ABISYM( mMaxThreads );
802 static QString
ABISYM( mAuthDbDirPath );
804 static QString sUserName;
805 static QString sUserFullName;
806 static QString sPlatformName;
808 QMap<QString, QIcon> mIconCache;
809 QMap<Cursor, QCursor> mCursorCache;
814 struct ApplicationMembers
818 QgsAnnotationRegistry *mAnnotationRegistry =
nullptr;
837 QString mNullRepresentation;
839 ApplicationMembers();
840 ~ApplicationMembers();
844 ApplicationMembers *mApplicationMembers =
nullptr;
846 static ApplicationMembers *sApplicationMembers;
848 static ApplicationMembers *members();
Singleton offering an interface to manage the authentication configuration database and to utilize co...
static void endian_swap(T &value)
Swap the endianness of the specified value.
This class keeps a list of data item providers that may add items to the browser tree.
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.
Cursor
The Cursor enum defines constants for QGIS custom cursors.
Registry of color schemes.
A registry of plugin layers types.
A cache for images / pictures derived from svg files.
Registry for raster renderers.
User profile contains information about the user profile folders on the machine.
Precisely identify a point on the canvas.
static QStringList skippedGdalDrivers()
Returns the list of gdal drivers that should be skipped (based on GDAL_SKIP environment variable) ...
static bool isRunningFromBuildDir()
Indicates whether running from build directory (not installed)
static int maxThreads()
Gets maximum concurrent thread count.
QString iconPath(const QString &iconFile)
endian_t
Constants for endian-ness.
Keeps track of available 3D renderers.
Registry of available symbol layer classes.
Registry for temporary fetched files.
static QString buildOutputPath()
Returns path to the build output directory. Valid only when running from build directory.
A registry for known page sizes.
static const char * QGIS_ORGANIZATION_NAME
Task manager for managing a set of long-running QgsTask tasks.
#define SIP_IF_FEATURE(feature)
Identify: obtain information about the object.
Registry for various processing components, including providers, algorithms and various parameters an...
static const char * QGIS_ORGANIZATION_DOMAIN
Registry of available layout item types.
A class to register / unregister existing GPS connections such that the information is available to a...
QObject * ABISYM(QgsApplication::mFileOpenEventReceiver)
Registry of storage backends that QgsProject may use.
The action scope registry is an application wide registry that contains a list of available action sc...
static const char * QGIS_APPLICATION_NAME
User profile manager is used to manager list, and manage user profiles on the users machine...
Interface for logging messages from QGIS in GUI independent way.
Select and capture a point or a feature.
Registry of available paint effects.