15 #ifndef QGSAPPLICATION_H 16 #define QGSAPPLICATION_H 18 #include "qgis_core.h" 19 #include <QApplication> 21 #include <QStringList> 24 #include "qgsconfig.h" 42 class QgsAnnotationRegistry;
70 static char **qtgui_ArgvToC( PyObject *argvlist,
int &argc )
74 argc = PyList_GET_SIZE( argvlist );
78 if ( ( argv = (
char ** )sipMalloc( 2 * ( argc + 1 ) *
sizeof(
char * ) ) ) == NULL )
82 for (
int a = 0; a < argc; ++a )
86 if ( ( arg = PyBytes_AsString( PyList_GET_ITEM( argvlist, a ) ) ) == NULL ||
87 ( argv[a] = (
char * )sipMalloc( strlen( arg ) + 1 ) ) == NULL )
90 strcpy( argv[a], arg );
91 argv[a + argc + 1] = argv[a];
94 argv[argc + argc + 1] = argv[argc] = NULL;
101 static void qtgui_UpdatePyArgv( PyObject *argvlist,
int argc,
char **argv )
103 for (
int a = 0, na = 0; a < argc; ++a )
106 if ( argv[na] == argv[a + argc + 1] )
109 PyList_SetSlice( argvlist, na, na + 1, NULL );
123 QgsApplication(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"desktop" );
125 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" )];
133 if ( ( argv = qtgui_ArgvToC( a0, argc ) ) == NULL )
138 static int nargc = argc;
140 sipCpp =
new sipQgsApplication( nargc, argv, a1, *a2, *a3 );
143 qtgui_UpdatePyArgv( a0, argc, argv );
164 static void init( QString profileFolder = QString() )
SIP_SKIP;
167 bool event( QEvent *event ) override;
170 bool notify( QObject *receiver, QEvent *event ) override;
173 static
void setFileOpenEventReceiver( QObject *receiver );
185 static
void setThemeName( const QString &themeName );
191 static QString resolvePkgPath( );
200 static QString themeName();
209 static
void setUITheme( const QString &themeName );
217 static QHash<QString, QString> uiThemes();
220 static QString authorsFilePath();
226 static QString contributorsFilePath();
233 static QString developersMapFilePath();
236 static QString sponsorsFilePath();
239 static QString donorsFilePath();
242 static QString serverResourcesPath();
247 static QString translatorsFilePath();
252 static QString licenceFilePath();
255 static QString i18nPath();
261 static QString metadataPath();
264 static QString qgisMasterDatabaseFilePath();
267 static QString qgisSettingsDirPath();
270 static QString qgisUserDatabaseFilePath();
273 static QString qgisAuthDatabaseFilePath();
276 static QString splashPath();
279 static QString iconsPath();
282 static QString srsDatabaseFilePath();
285 static QStringList svgPaths();
291 static QStringList layoutTemplatePaths();
294 static QMap<QString, QString> systemEnvVars() {
return ABISYM( mSystemEnvVars ); }
297 static QString prefixPath();
300 static QString pluginPath();
303 static QString pkgDataPath();
306 static QString activeThemePath();
309 static QString defaultThemePath();
315 static QString
iconPath(
const QString &iconFile );
321 static QIcon getThemeIcon(
const QString &name );
344 static QCursor getThemeCursor(
Cursor cursor );
350 static QPixmap getThemePixmap(
const QString &name );
353 static QString userStylePath();
356 static QRegExp shortNameRegExp();
363 static QString userLoginName();
370 static QString userFullName();
377 static QString osName();
384 static QString platform();
390 static QString locale();
393 static QString userThemesFolder();
396 static QString defaultStylePath();
399 static QString defaultThemesFolder();
402 static QString libraryPath();
405 static QString libexecPath();
408 static void setPrefixPath(
const QString &prefixPath,
bool useDefaultPaths =
false );
411 static void setPluginPath(
const QString &pluginPath );
414 static void setPkgDataPath(
const QString &pkgDataPath );
417 static void setDefaultSvgPaths(
const QStringList &pathList );
420 static void setAuthDatabaseDirPath(
const QString &authDbDirPath );
423 static void initQgis();
426 static bool createDatabase( QString *errorMessage =
nullptr );
429 static bool createThemeFolder();
432 static void exitQgis();
435 static QString appIconPath();
455 char *data =
reinterpret_cast<char *
>( &value );
456 std::size_t n =
sizeof( value );
457 for ( std::size_t i = 0, m = n / 2; i < m; ++i )
459 std::swap( data[i], data[n - 1 - i] );
473 static QString reportStyleSheet();
478 static QString showSettings();
487 static void registerOgrDrivers();
490 static QString absolutePathToRelativePath(
const QString &apath,
const QString &targetPath );
492 static QString relativePathToAbsolutePath(
const QString &rpath,
const QString &targetPath );
497 static QString cfgIntDir() {
return ABISYM( mCfgIntDir ); }
SIP_SKIP 499 static QString buildSourcePath() {
return ABISYM( mBuildSourcePath ); }
509 static void skipGdalDriver(
const QString &driver );
516 static void restoreGdalDriver(
const QString &driver );
529 static void applyGdalSkippedDrivers();
540 static void setMaxThreads(
int maxThreads );
644 static QgsAnnotationRegistry *annotationRegistry()
SIP_SKIP;
679 static QString nullRepresentation();
684 static void setNullRepresentation(
const QString &nullRepresentation );
693 static QVariantMap customVariables();
702 static void setCustomVariables(
const QVariantMap &customVariables );
710 static void setCustomVariable(
const QString &name,
const QVariant &value );
715 bool x11EventFilter( XEvent *event );
721 void preNotify( QObject *receiver, QEvent *event,
bool *done )
SIP_SKIP;
727 void customVariablesChanged();
733 void nullRepresentationChanged();
737 static void copyPath(
const QString &src,
const QString &dst );
738 static QObject *
ABISYM( mFileOpenEventReceiver );
739 static QStringList
ABISYM( mFileOpenEventList );
741 static QString
ABISYM( mProfilePath );
742 static QString
ABISYM( mUIThemeName );
743 static QString
ABISYM( mPrefixPath );
744 static QString
ABISYM( mPluginPath );
745 static QString
ABISYM( mPkgDataPath );
746 static QString
ABISYM( mLibraryPath );
747 static QString
ABISYM( mLibexecPath );
748 static QString
ABISYM( mThemeName );
749 static QStringList
ABISYM( mDefaultSvgPaths );
750 static QMap<QString, QString>
ABISYM( mSystemEnvVars );
752 static QString
ABISYM( mConfigPath );
754 static bool ABISYM( mInitialized );
757 static bool ABISYM( mRunningFromBuildDir );
759 static QString
ABISYM( mBuildSourcePath );
761 static QString
ABISYM( mCfgIntDir );
764 static QString
ABISYM( mBuildOutputPath );
770 static QStringList
ABISYM( mGdalSkipList );
774 static int ABISYM( mMaxThreads );
778 static QString
ABISYM( mAuthDbDirPath );
780 static QString sUserName;
781 static QString sUserFullName;
782 static QString sPlatformName;
784 QMap<QString, QIcon> mIconCache;
785 QMap<Cursor, QCursor> mCursorCache;
790 struct ApplicationMembers
794 QgsAnnotationRegistry *mAnnotationRegistry =
nullptr;
811 QString mNullRepresentation;
813 ApplicationMembers();
814 ~ApplicationMembers();
818 ApplicationMembers *mApplicationMembers =
nullptr;
820 static ApplicationMembers *sApplicationMembers;
822 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()
Get 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.
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)
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.