15 #ifndef QGSAPPLICATION_H 16 #define QGSAPPLICATION_H 18 #include "qgis_core.h" 19 #include <QApplication> 21 #include <QStringList> 24 #include "qgsconfig.h" 44 class QgsAnnotationRegistry;
74 static char **qtgui_ArgvToC( PyObject *argvlist,
int &argc )
78 argc = PyList_GET_SIZE( argvlist );
82 if ( ( argv = (
char ** )sipMalloc( 2 * ( argc + 1 ) *
sizeof(
char * ) ) ) == NULL )
86 for (
int a = 0; a < argc; ++a )
90 if ( ( arg = PyBytes_AsString( PyList_GET_ITEM( argvlist, a ) ) ) == NULL ||
91 ( argv[a] = (
char * )sipMalloc( strlen( arg ) + 1 ) ) == NULL )
94 strcpy( argv[a], arg );
95 argv[a + argc + 1] = argv[a];
98 argv[argc + argc + 1] = argv[argc] = NULL;
105 static void qtgui_UpdatePyArgv( PyObject *argvlist,
int argc,
char **argv )
107 for (
int a = 0, na = 0; a < argc; ++a )
110 if ( argv[na] == argv[a + argc + 1] )
113 PyList_SetSlice( argvlist, na, na + 1, NULL );
127 QgsApplication(
int &argc,
char **argv,
bool GUIenabled,
const QString &profileFolder = QString(),
const QString &platformName =
"desktop" );
129 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" )];
137 if ( ( argv = qtgui_ArgvToC( a0, argc ) ) == NULL )
142 static int nargc = argc;
144 sipCpp =
new sipQgsApplication( nargc, argv, a1, *a2, *a3 );
147 qtgui_UpdatePyArgv( a0, argc, argv );
168 static void init( QString profileFolder = QString() )
SIP_SKIP;
171 bool event( QEvent *event ) override;
174 bool notify( QObject *receiver, QEvent *event ) override;
177 static
void setFileOpenEventReceiver( QObject *receiver );
189 static
void setThemeName( const QString &themeName );
195 static QString resolvePkgPath();
204 static QString themeName();
213 static
void setUITheme( const QString &themeName );
221 static QHash<QString, QString> uiThemes();
224 static QString authorsFilePath();
230 static QString contributorsFilePath();
237 static QString developersMapFilePath();
240 static QString sponsorsFilePath();
243 static QString donorsFilePath();
246 static QString serverResourcesPath();
251 static QString translatorsFilePath();
256 static QString licenceFilePath();
259 static QString i18nPath();
265 static QString metadataPath();
268 static QString qgisMasterDatabaseFilePath();
271 static QString qgisSettingsDirPath();
274 static QString qgisUserDatabaseFilePath();
277 static QString qgisAuthDatabaseFilePath();
280 static QString splashPath();
283 static QString iconsPath();
286 static QString srsDatabaseFilePath();
289 static QStringList svgPaths();
295 static QStringList layoutTemplatePaths();
298 static QMap<QString, QString> systemEnvVars() {
return ABISYM( mSystemEnvVars ); }
301 static QString prefixPath();
304 static QString pluginPath();
307 static QString pkgDataPath();
310 static QString activeThemePath();
313 static QString defaultThemePath();
319 static QString iconPath(
const QString &iconFile );
325 static QIcon getThemeIcon(
const QString &name );
348 static QCursor getThemeCursor(
Cursor cursor );
354 static QPixmap getThemePixmap(
const QString &name );
357 static QString userStylePath();
360 static QRegExp shortNameRegExp();
367 static QString userLoginName();
374 static QString userFullName();
381 static QString osName();
388 static QString platform();
394 static QString locale();
397 static QString userThemesFolder();
400 static QString defaultStylePath();
403 static QString defaultThemesFolder();
406 static QString libraryPath();
409 static QString libexecPath();
417 static QString qmlImportPath();
420 static void setPrefixPath(
const QString &prefixPath,
bool useDefaultPaths =
false );
423 static void setPluginPath(
const QString &pluginPath );
426 static void setPkgDataPath(
const QString &pkgDataPath );
429 static void setDefaultSvgPaths(
const QStringList &pathList );
432 static void setAuthDatabaseDirPath(
const QString &authDbDirPath );
435 static void initQgis();
438 static bool createDatabase( QString *errorMessage =
nullptr );
441 static bool createThemeFolder();
444 static void exitQgis();
447 static QString appIconPath();
467 char *data =
reinterpret_cast<char *
>( &value );
468 std::size_t n =
sizeof( value );
469 for ( std::size_t i = 0, m = n / 2; i < m; ++i )
471 std::swap( data[i], data[n - 1 - i] );
487 static QString reportStyleSheet();
492 static QString showSettings();
501 static void registerOgrDrivers();
504 static QString absolutePathToRelativePath(
const QString &apath,
const QString &targetPath );
506 static QString relativePathToAbsolutePath(
const QString &rpath,
const QString &targetPath );
510 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 511 static QString cfgIntDir() {
return ABISYM( mCfgIntDir ); }
SIP_SKIP 513 static QString buildSourcePath() {
return ABISYM( mBuildSourcePath ); }
523 static void skipGdalDriver(
const QString &driver );
530 static void restoreGdalDriver(
const QString &driver );
543 static void applyGdalSkippedDrivers();
554 static void setMaxThreads(
int maxThreads );
664 static QgsAnnotationRegistry *annotationRegistry()
SIP_SKIP;
704 static QString nullRepresentation();
709 static void setNullRepresentation(
const QString &nullRepresentation );
718 static QVariantMap customVariables();
727 static void setCustomVariables(
const QVariantMap &customVariables );
734 static void setCustomVariable(
const QString &name,
const QVariant &value );
744 int maxConcurrentConnectionsPerPool()
const;
751 static void setTranslation(
const QString &translation ) { sTranslation = translation; }
763 bool x11EventFilter( XEvent *event );
769 void preNotify( QObject *receiver, QEvent *event,
bool *done )
SIP_SKIP;
775 void customVariablesChanged();
781 void nullRepresentationChanged();
793 static void copyPath(
const QString &src,
const QString &dst );
794 static QObject *
ABISYM( mFileOpenEventReceiver );
795 static QStringList
ABISYM( mFileOpenEventList );
797 static QString
ABISYM( mProfilePath );
798 static QString
ABISYM( mUIThemeName );
799 static QString
ABISYM( mPrefixPath );
800 static QString
ABISYM( mPluginPath );
801 static QString
ABISYM( mPkgDataPath );
802 static QString
ABISYM( mLibraryPath );
803 static QString
ABISYM( mLibexecPath );
804 static QString
ABISYM( mQmlImportPath );
805 static QString
ABISYM( mThemeName );
806 static QStringList
ABISYM( mDefaultSvgPaths );
807 static QMap<QString, QString>
ABISYM( mSystemEnvVars );
809 static QString
ABISYM( mConfigPath );
811 static bool ABISYM( mInitialized );
814 static bool ABISYM( mRunningFromBuildDir );
816 static QString
ABISYM( mBuildSourcePath );
817 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 818 static QString
ABISYM( mCfgIntDir );
821 static QString
ABISYM( mBuildOutputPath );
827 static QStringList
ABISYM( mGdalSkipList );
831 static int ABISYM( mMaxThreads );
835 static QString
ABISYM( mAuthDbDirPath );
837 static QString sUserName;
838 static QString sUserFullName;
839 static QString sPlatformName;
840 static QString sTranslation;
842 QMap<QString, QIcon> mIconCache;
843 QMap<Cursor, QCursor> mCursorCache;
845 QTranslator *mQgisTranslator =
nullptr;
846 QTranslator *mQtTranslator =
nullptr;
851 struct ApplicationMembers
855 QgsAnnotationRegistry *mAnnotationRegistry =
nullptr;
874 QString mNullRepresentation;
876 ApplicationMembers();
877 ~ApplicationMembers();
881 ApplicationMembers *mApplicationMembers =
nullptr;
883 static ApplicationMembers *sApplicationMembers;
887 static ApplicationMembers *members();
889 static void invalidateCaches();
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.
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.
Used for the collecting of strings from projects for translation and creation of ts files...
#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
static void setTranslation(const QString &translation)
Set translation.
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.