31 #include <QFileOpenEvent> 32 #include <QMessageBox> 38 #include <QThreadPool> 41 #include <netinet/in.h> 47 #define SECURITY_WIN32 49 #pragma comment( lib, "Secur32.lib" ) 52 #include "qgsconfig.h" 71 bool ABISYM( QgsApplication::mRunningFromBuildDir ) =
false;
78 int ABISYM( QgsApplication::mMaxThreads );
81 QString QgsApplication::sUserName;
82 QString QgsApplication::sUserFullName;
83 QString QgsApplication::sPlatformName =
"desktop";
105 sPlatformName = platformName;
107 init( customConfigPath );
112 if ( customConfigPath.
isEmpty() )
114 if ( getenv(
"QGIS_CUSTOM_CONFIG_PATH" ) )
116 customConfigPath = getenv(
"QGIS_CUSTOM_CONFIG_PATH" );
124 qRegisterMetaType<QgsGeometry::Error>(
"QgsGeometry::Error" );
132 Q_FOREACH (
const QString& path,
QStringList() <<
"" <<
"/.." <<
"/bin" <<
"/../../.." )
134 f.
setFileName( prefixPath + path +
"/qgisbuildpath.txt" );
138 if ( f.
exists() && f.
open( QIODevice::ReadOnly ) )
140 ABISYM( mRunningFromBuildDir ) =
true;
141 ABISYM( mBuildSourcePath ) = f.
readLine().trimmed();
142 ABISYM( mBuildOutputPath ) = f.
readLine().trimmed();
143 qDebug(
"Running from build directory!" );
144 qDebug(
"- source directory: %s", ABISYM( mBuildSourcePath ).toUtf8().data() );
145 qDebug(
"- output directory of the build: %s", ABISYM( mBuildOutputPath ).toUtf8().data() );
147 ABISYM( mCfgIntDir ) = prefixPath.split(
'/', QString::SkipEmptyParts ).last();
148 qDebug(
"- cfg: %s", ABISYM( mCfgIntDir ).toUtf8().data() );
152 if ( ABISYM( mRunningFromBuildDir ) )
155 ABISYM( mPrefixPath ) =
QString();
156 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 157 setPluginPath( ABISYM( mBuildOutputPath ) +
'/' +
QString( QGIS_PLUGIN_SUBDIR ) +
'/' + ABISYM( mCfgIntDir ) );
162 ABISYM( mLibraryPath ) = ABISYM( mBuildOutputPath ) +
'/' + QGIS_LIB_SUBDIR +
'/';
163 #if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA) 164 ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) +
'/' + QGIS_LIBEXEC_SUBDIR +
'/' + ABISYM( mCfgIntDir ) +
'/';
166 ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) +
'/' + QGIS_LIBEXEC_SUBDIR +
'/';
171 char *prefixPath = getenv(
"QGIS_PREFIX_PATH" );
174 #if defined(Q_OS_MACX) || defined(Q_OS_WIN) 176 #elif defined(ANDROID) 195 if ( !customConfigPath.
isEmpty() )
197 ABISYM( mConfigPath ) = customConfigPath +
'/';
203 if ( getenv(
"QGIS_AUTH_DB_DIR_PATH" ) )
211 QString passfile(
"QGIS_AUTH_PASSWORD_FILE" );
219 if ( varStrName != passfile )
221 systemEnvVarMap.
insert( varStrName, varStrValue );
224 ABISYM( mSystemEnvVars ) = systemEnvVarMap;
232 ABISYM( mMaxThreads ) = -1;
242 if ( event->
type() == QEvent::FileOpen )
245 if ( ABISYM( mFileOpenEventReceiver ) )
248 done =
notify( ABISYM( mFileOpenEventReceiver ), event );
255 ABISYM( mFileOpenEventList ).append( static_cast<QFileOpenEvent *>( event )->file() );
272 emit
preNotify( receiver, event, &done );
289 catch ( std::exception & e )
297 QgsDebugMsg(
"Caught unhandled unknown exception" );
308 ABISYM( mFileOpenEventReceiver ) = receiver;
310 if ( ABISYM( mFileOpenEventList ).count() > 0 )
312 QStringListIterator i( ABISYM( mFileOpenEventList ) );
313 while ( i.hasNext() )
318 ABISYM( mFileOpenEventList ).clear();
324 ABISYM( mPrefixPath ) = thePrefixPath;
325 #if defined(_MSC_VER) 326 if ( ABISYM( mPrefixPath ).endsWith(
"/bin" ) )
328 ABISYM( mPrefixPath ).chop( 4 );
331 if ( useDefaultPaths && !ABISYM( mRunningFromBuildDir ) )
336 ABISYM( mLibraryPath ) = ABISYM( mPrefixPath ) +
'/' + QGIS_LIB_SUBDIR +
'/';
337 ABISYM( mLibexecPath ) = ABISYM( mPrefixPath ) +
'/' + QGIS_LIBEXEC_SUBDIR +
'/';
342 ABISYM( mPluginPath ) = thePluginPath;
347 ABISYM( mPkgDataPath ) = thePkgDataPath;
348 QString mySvgPath = thePkgDataPath + ( ABISYM( mRunningFromBuildDir ) ?
"/images/svg/" :
"/svg/" );
350 if ( !ABISYM( mDefaultSvgPaths ).contains( mySvgPath ) )
351 ABISYM( mDefaultSvgPaths ) << mySvgPath;
356 ABISYM( mDefaultSvgPaths ) = pathList;
370 if ( ABISYM( mRunningFromBuildDir ) )
372 static bool once =
true;
374 qWarning(
"!!! prefix path was requested, but it is not valid - we do not run from installed path !!!" );
378 return ABISYM( mPrefixPath );
382 return ABISYM( mPluginPath );
386 return ABISYM( mPkgDataPath );
390 return ":/images/themes/default/";
399 return iconsPath() +
"qgis-icon-60x60.png";
407 return path + iconFile;
416 if ( app && app->mIconCache.
contains( theName ) )
417 return app->mIconCache.
value( theName );
425 icon =
QIcon( myPreferredPath );
431 icon =
QIcon( myDefaultPath );
439 app->mIconCache.
insert( theName, icon );
450 return QPixmap( myPreferredPath );
456 return QPixmap( myDefaultPath );
465 ABISYM( mThemeName ) = theThemeName;
472 return ABISYM( mThemeName );
480 if ( !themes.
contains( themename ) )
481 themename =
"default";
483 QString path = themes[themename];
484 QString stylesheetname = path +
"/style.qss";
485 QString autostylesheet = stylesheetname +
".auto";
487 QFile file( stylesheetname );
488 QFile variablesfile( path +
"/variables.qss" );
489 QFile fileout( autostylesheet );
493 if ( variableInfo.
exists() && variablesfile.
open( QIODevice::ReadOnly ) )
495 if ( !file.
open( QIODevice::ReadOnly ) || !fileout.
open( QIODevice::WriteOnly | QIODevice::Text ) )
503 while ( !in.
atEnd() )
512 styledata.
replace( name, value );
515 variablesfile.
close();
520 stylesheetname = autostylesheet;
524 styleSheet.
append( stylesheetname );
525 qApp->setStyleSheet( styleSheet );
533 mapping.
insert(
"default",
"" );
534 Q_FOREACH (
const QString& path, paths )
537 QFileInfoList styleFiles = folder.
entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
538 Q_FOREACH (
const QFileInfo& info, styleFiles )
541 if ( !styleFile.exists() )
546 mapping.
insert( name, path );
557 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/AUTHORS" );
564 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/CONTRIBUTORS" );
568 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/developersmap.html" );
576 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/SPONSORS" );
584 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/DONORS" );
590 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/TRANSLATORS" );
596 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/LICENSE" );
610 helpAppPath +=
"/qgis_help";
612 helpAppPath +=
".exe";
621 if ( ABISYM( mRunningFromBuildDir ) )
622 return ABISYM( mBuildOutputPath ) +
QLatin1String(
"/i18n" );
632 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/resources/qgis.db" );
640 return ABISYM( mConfigPath );
656 return ABISYM( mAuthDbDirPath ) +
QLatin1String(
"qgis-auth.db" );
664 return QString(
":/images/splash/" );
672 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/images/icons/" );
679 if ( ABISYM( mRunningFromBuildDir ) )
683 if ( !
QFile( tempCopy ).exists() )
685 QFile f( ABISYM( mPkgDataPath ) +
"/resources/srs.db" );
686 if ( !f.
copy( tempCopy ) )
688 qFatal(
"Could not create temporary copy" );
696 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/resources/srs.db" );
712 myPathList = myPaths.
split(
'|' );
717 Q_FOREACH (
const QString& path, myPathList )
722 Q_FOREACH (
const QString& path, ABISYM( mDefaultSvgPaths ) )
743 myPathList = myPaths.
split(
'|' );
756 return QRegExp(
"^[A-Za-z_][A-Za-z0-9\\._-]*" );
765 TCHAR
name [ UNLEN + 1 ];
766 DWORD size = UNLEN + 1;
768 if ( GetUserName(( TCHAR* )name, &size ) )
776 process.
start(
"whoami" );
785 sUserName = qgetenv(
"USER" );
790 sUserName = qgetenv(
"USERNAME" );
796 if ( !sUserFullName.
isEmpty() )
797 return sUserFullName;
800 TCHAR
name [ UNLEN + 1 ];
801 DWORD size = UNLEN + 1;
804 if ( GetUserNameEx( NameDisplay, ( TCHAR* )name, &size ) )
806 sUserFullName =
QString( name );
812 #elif defined(Q_OS_ANDROID) 813 sUserFullName =
"Not available";
815 struct passwd *p = getpwuid( getuid() );
820 sUserFullName = gecosName.
left( gecosName.
indexOf(
',', 0 ) );
825 return sUserFullName;
830 #if defined(Q_OS_ANDROID) 832 #elif defined(Q_OS_MAC) 834 #elif defined(Q_OS_WIN) 836 #elif defined(Q_OS_LINUX) 845 return sPlatformName;
865 return ABISYM( mLibraryPath );
870 return ABISYM( mLibexecPath );
875 return ( htonl( 1 ) == 1 ) ?
XDR :
NDR;
906 GDALDestroyDriverManager();
911 QString myEnvironmentVar( getenv(
"QGIS_PREFIX_PATH" ) );
912 QString myState =
tr(
"Application state:\n" 913 "QGIS_PREFIX_PATH env var:\t\t%1\n" 915 "Plugin Path:\t\t%3\n" 916 "Package Data Path:\t%4\n" 917 "Active Theme Name:\t%5\n" 918 "Active Theme Path:\t%6\n" 919 "Default Theme Path:\t%7\n" 920 "SVG Search Paths:\t%8\n" 921 "User DB Path:\t%9\n" 922 "Auth DB Path:\t%10\n" )
923 .
arg( myEnvironmentVar,
930 svgPaths().join(
tr(
"\n\t\t",
"match indentation of application state" ) ),
943 QColor myColor1( Qt::lightGray );
944 QColor myColor2 = myColor1;
945 myColor2 = myColor2.
lighter( 110 );
947 myStyle =
"p.glossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, " 948 " stop: 0 " + myColor1.
name() +
"," 949 " stop: 0.1 " + myColor2.
name() +
"," 950 " stop: 0.5 " + myColor1.
name() +
"," 951 " stop: 0.9 " + myColor2.
name() +
"," 952 " stop: 1 " + myColor1.
name() +
");" 954 " padding-left: 4px;" 955 " padding-top: 20px;" 956 " padding-bottom: 8px;" 957 " border: 1px solid #6c6c6c;" 959 "p.subheaderglossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, " 960 " stop: 0 " + myColor1.
name() +
"," 961 " stop: 0.1 " + myColor2.
name() +
"," 962 " stop: 0.5 " + myColor1.
name() +
"," 963 " stop: 0.9 " + myColor2.
name() +
"," 964 " stop: 1 " + myColor1.
name() +
");" 965 " font-weight: bold;" 966 " font-size: medium;" 967 " line-height: 1.1em;" 970 " padding-left: 4px;" 971 " padding-right: 4px;" 972 " padding-top: 20px;" 973 " padding-bottom: 8px;" 974 " border: 1px solid #6c6c6c;" 976 "th.glossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, " 977 " stop: 0 " + myColor1.
name() +
"," 978 " stop: 0.1 " + myColor2.
name() +
"," 979 " stop: 0.5 " + myColor1.
name() +
"," 980 " stop: 0.9 " + myColor2.
name() +
"," 981 " stop: 1 " + myColor1.
name() +
");" 983 " border: 1px solid #6c6c6c;" 985 ".overview{ font: 1.82em; font-weight: bold;}" 986 "body{ background: white;" 988 " font-family: arial,sans-serif;" 990 "h1{ background-color: #F6F6F6;" 992 " font-size: x-large; " 993 " font-weight: normal;" 994 " font-family: luxi serif, georgia, times new roman, times, serif;" 996 " padding: 0.75em 0 0;" 1000 "h2{ background-color: #F6F6F6;" 1002 " font-size: medium; " 1003 " font-weight: normal;" 1004 " font-family: luxi serif, georgia, times new roman, times, serif;" 1005 " background: none;" 1006 " padding: 0.75em 0 0;" 1008 " line-height: 1.1em;" 1010 "h3{ background-color: #F6F6F6;" 1012 " font-family: luxi serif, georgia, times new roman, times, serif;" 1013 " font-weight: bold;" 1014 " font-size: large;" 1015 " text-align: right;" 1016 " border-bottom: 5px solid #DCEB5C;" 1018 "h4{ background-color: #F6F6F6;" 1020 " font-family: luxi serif, georgia, times new roman, times, serif;" 1021 " font-weight: bold;" 1022 " font-size: medium;" 1023 " text-align: right;" 1025 "h5{ background-color: #F6F6F6;" 1027 " font-family: luxi serif, georgia, times new roman, times, serif;" 1028 " font-weight: bold;" 1029 " font-size: small;" 1030 " text-align: right;" 1032 "a{ color: #729FCF;" 1033 " font-family: arial,sans-serif;" 1034 " font-size: small;" 1036 "label{ background-color: #FFFFCC;" 1037 " border: 1px solid black;" 1039 " padding: 0px 3px; " 1040 " font-size: small;" 1047 if ( 0 >= OGRGetDriverCount() )
1056 QString tPathUrl = targetPath;
1057 #if defined( Q_OS_WIN ) 1058 const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
1060 aPathUrl.
replace(
'\\',
'/' );
1064 aPathUrl =
"\\\\" + aPathUrl.
mid( 2 );
1067 tPathUrl.
replace(
'\\',
'/' );
1071 tPathUrl =
"\\\\" + tPathUrl.
mid( 2 );
1074 const Qt::CaseSensitivity cs = Qt::CaseSensitive;
1085 while ( !aPathElems.
isEmpty() &&
1087 aPathElems[0].compare( targetElems[0], cs ) == 0 )
1103 for (
int i = 0; i < targetElems.
size(); i++ )
1105 aPathElems.
insert( 0,
".." );
1112 aPathElems.
insert( 0,
"." );
1115 return aPathElems.
join(
"/" );
1127 QString targetPathUrl = targetPath;
1129 #if defined(Q_OS_WIN) 1130 rPathUrl.
replace(
'\\',
'/' );
1131 targetPathUrl.
replace(
'\\',
'/' );
1133 bool uncPath = targetPathUrl.
startsWith(
"//" );
1137 QStringList targetElems = targetPathUrl.
split(
'/', QString::SkipEmptyParts );
1139 #if defined(Q_OS_WIN) 1142 targetElems.
insert( 0,
"" );
1143 targetElems.
insert( 0,
"" );
1148 targetElems << srcElems;
1153 while (( pos = targetElems.
indexOf(
".." ) ) > 0 )
1160 #if !defined(Q_OS_WIN) 1165 return targetElems.
join(
"/" );
1170 if (
ABISYM( mGdalSkipList ).contains( theDriver ) || theDriver.
isEmpty() )
1174 ABISYM( mGdalSkipList ) << theDriver;
1180 if ( !
ABISYM( mGdalSkipList ).contains( theDriver ) )
1196 QgsDebugMsg(
"Gdal Skipped driver list set to:" );
1198 CPLSetConfigOption(
"GDAL_SKIP", myDriverList.
toUtf8() );
1205 QDir myDir( folder );
1215 void QgsApplication::copyPath(
const QString& src,
const QString& dst )
1221 Q_FOREACH (
const QString& d, dir.
entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
1240 QDir myDir( myPamPath );
1243 myDir.
mkpath( myPamPath );
1246 #if defined(Q_OS_WIN) 1247 CPLSetConfigOption(
"GDAL_PAM_PROXY_DIR", myPamPath.
toUtf8() );
1251 int myChangeFlag = 0;
1252 setenv(
"GDAL_PAM_PROXY_DIR", myPamPath.
toUtf8(), myChangeFlag );
1259 if ( !qgisPrivateDbFile.exists() )
1263 QFile masterFile( qgisMasterDbFileName );
1269 bool isDbFileCopied = masterFile.
copy( qgisPrivateDbFile.fileName() );
1271 if ( !isDbFileCopied )
1275 *errorMessage =
tr(
"[ERROR] Can not make qgis.db private copy" );
1288 *errorMessage =
tr(
"Could not open qgis.db" );
1294 int res = sqlite3_exec( db,
"SELECT epsg FROM tbl_srs LIMIT 0",
nullptr,
nullptr, &errmsg );
1295 if ( res == SQLITE_OK )
1298 if ( sqlite3_exec( db,
1299 "ALTER TABLE tbl_srs RENAME TO tbl_srs_bak;" 1300 "CREATE TABLE tbl_srs (" 1301 "srs_id INTEGER PRIMARY KEY," 1302 "description text NOT NULL," 1303 "projection_acronym text NOT NULL," 1304 "ellipsoid_acronym NOT NULL," 1305 "parameters text NOT NULL," 1307 "auth_name varchar," 1309 "is_geo integer NOT NULL," 1310 "deprecated boolean);" 1311 "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);" 1312 "INSERT INTO tbl_srs(srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,auth_name,auth_id,is_geo,deprecated) SELECT srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,'','',is_geo,0 FROM tbl_srs_bak;" 1313 "DROP TABLE tbl_srs_bak",
nullptr,
nullptr, &errmsg ) != SQLITE_OK
1320 sqlite3_free( errmsg );
1321 sqlite3_close( db );
1327 sqlite3_free( errmsg );
1330 if ( sqlite3_exec( db,
"DROP VIEW vw_srs",
nullptr,
nullptr, &errmsg ) != SQLITE_OK )
1332 QgsDebugMsg(
QString(
"vw_srs didn't exists in private qgis.db: %1" ).arg( errmsg ) );
1335 if ( sqlite3_exec( db,
1336 "CREATE VIEW vw_srs AS" 1338 " a.description AS description" 1339 ",a.srs_id AS srs_id" 1340 ",a.is_geo AS is_geo" 1341 ",coalesce(b.name,a.projection_acronym) AS name" 1342 ",a.parameters AS parameters" 1343 ",a.auth_name AS auth_name" 1344 ",a.auth_id AS auth_id" 1345 ",a.deprecated AS deprecated" 1347 " LEFT OUTER JOIN tbl_projection b ON a.projection_acronym=b.acronym" 1348 " ORDER BY coalesce(b.name,a.projection_acronym),a.description",
nullptr,
nullptr, &errmsg ) != SQLITE_OK
1353 *errorMessage =
tr(
"Update of view in private qgis.db failed.\n%1" ).
arg(
QString::fromUtf8( errmsg ) );
1355 sqlite3_free( errmsg );
1356 sqlite3_close( db );
1360 sqlite3_close( db );
1378 if ( maxThreads == -1 )
static bool createDB(QString *errorMessage=nullptr)
initialise qgis.db
static void init(QString customConfigPath=QString())
This method initialises paths etc for QGIS.
QString fromAscii(const char *str, int size)
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
static QgsProviderRegistry * instance(const QString &pluginPath=QString::null)
Means of accessing canonical single instance.
QString & append(QChar ch)
iterator insert(const Key &key, const T &value)
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.
static void skipGdalDriver(const QString &theDriver)
Sets the GDAL_SKIP environment variable to include the specified driver and then calls GDALDriverMana...
bool contains(const Key &key) const
static QgsAuthManager * instance()
Enforce singleton pattern.
QStringList systemEnvironment()
static QString authorsFilePath()
Returns the path to the authors file.
static QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
static QString qgisUserDbFilePath()
Returns the path to the user qgis.db file.
static QString libraryPath()
Returns the path containing qgis_core, qgis_gui, qgispython (and other) libraries.
static QString defaultThemePath()
Returns the path to the default theme directory.
QString readLine(qint64 maxlen)
QByteArray trimmed() const
virtual bool event(QEvent *event) override
Watch for QFileOpenEvent.
static QString qgisAuthDbFilePath()
Returns the path to the user authentication database file: qgis-auth.db.
static QString donorsFilePath()
Returns the path to the donors file.
static QString relativePathToAbsolutePath(const QString &rpath, const QString &targetPath)
Converts path relative to target to an absolute path.
static void setPrefixPath(const QString &thePrefixPath, bool useDefaultPaths=false)
Alters prefix path - used by 3rd party apps.
QgsApplication(int &argc, char **argv, bool GUIenabled, const QString &customConfigPath=QString(), const QString &platformName="desktop")
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
static QIcon getThemeIcon(const QString &theName)
Helper to get a theme icon.
static QString themeName()
Set the active theme to the specified theme.
static QString defaultThemesFolder()
Returns the path to default themes folder from install (works as a starting point).
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
QThreadPool * globalInstance()
bool contains(const QString &str, Qt::CaseSensitivity cs) const
void setFileName(const QString &name)
static void registerOgrDrivers()
Register OGR drivers ensuring this only happens once.
QString join(const QString &separator) const
static void setFileOpenEventReceiver(QObject *receiver)
Set the FileOpen event receiver.
static QString reportStyleSheet()
get a standard css style sheet for reports.
static int maxThreads()
Get maximum concurrent thread count.
static endian_t endian()
Returns whether this machine uses big or little endian.
QString tr(const char *sourceText, const char *disambiguation, int n)
static QPixmap getThemePixmap(const QString &theName)
Helper to get a theme icon as a pixmap.
bool copy(const QString &newName)
static QString userFullName()
Returns the user's operating system login account full display name.
static QString developersMapFilePath()
Returns the path to the developers map file.
void addLibraryPath(const QString &path)
static QString absolutePathToRelativePath(const QString &apath, const QString &targetPath)
Converts absolute path to path relative to target.
void emitSettingsChanged()
Causes the application instance to emit the settingsChanged() signal.
static void applyGdalSkippedDrivers()
Apply the skipped drivers list to gdal.
const char * name() const
QString canonicalFilePath() const
endian_t
Constants for endian-ness.
void append(const T &value)
QString fromUtf8(const char *str, int size)
void setMaxThreadCount(int maxThreadCount)
static QString pluginPath()
Returns the path to the application plugin directory.
static void setThemeName(const QString &theThemeName)
Set the active theme to the specified theme.
bool init(const QString &pluginPath=QString::null)
Initialize QCA, prioritize qca-ossl plugin and optionally set up the authentication database...
static QString helpAppPath()
Returns the path to the help application.
static bool createThemeFolder()
Create the users theme folder.
static void cleanRegisteredFunctions()
Deletes all registered functions whose ownership have been transferred to the expression engine...
QFileInfoList entryInfoList(QFlags< QDir::Filter > filters, QFlags< QDir::SortFlag > sort) const
QString absoluteFilePath() const
virtual ~QgsApplication()
int removeAll(const T &value)
static QString i18nPath()
Returns the path to the translation directory.
bool sendEvent(QObject *receiver, QEvent *event)
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
static void setPkgDataPath(const QString &thePkgDataPath)
Alters pkg data path - used by 3rd party apps.
static QString splashPath()
Returns the path to the splash screen image directory.
QCoreApplication * instance()
QStringList ABISYM(QgsApplication::mFileOpenEventList)
static const char * QGIS_ORGANIZATION_NAME
static QString qgisMasterDbFilePath()
Returns the path to the master qgis.db file.
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
static void setPluginPath(const QString &thePluginPath)
Alters plugin path - used by 3rd party apps.
static void restoreGdalDriver(const QString &theDriver)
Sets the GDAL_SKIP environment variable to exclude the specified driver and then calls GDALDriverMana...
static QString userLoginName()
Returns the user's operating system login account name.
static QString pkgDataPath()
Returns the common root path of all application data directories.
static QString osName()
Returns a string name of the operating system QGIS is running on.
static void initQgis()
loads providers
static void setDefaultSvgPaths(const QStringList &pathList)
Alters default svg paths - used by 3rd party apps.
QColor lighter(int factor) const
static void setAuthDbDirPath(const QString &theAuthDbDirPath)
Alters authentication data base directory path - used by 3rd party apps.
static QString defaultStyleV2Path()
Returns the path to default style (works as a starting point).
static QRegExp shortNameRegExp()
Returns the short name regular expression for line edit validator.
static QString userStyleV2Path()
Returns the path to user's style.
QString & replace(int position, int n, QChar after)
static QString showSettings()
Convenience function to get a summary of the paths used in this application instance useful for debug...
QVariant value(const QString &key, const QVariant &defaultValue) const
static QString appIconPath()
get application icon
static const char * QGIS_ORGANIZATION_DOMAIN
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
QString mid(int position, int n) const
virtual bool notify(QObject *receiver, QEvent *event) override
Catch exceptions when sending event to receiver.
static QString contributorsFilePath()
Returns the path to the contributors file.
static QString activeThemePath()
Returns the path to the currently active theme directory.
virtual bool event(QEvent *e)
QString absolutePath() const
void insert(int i, const T &value)
QThread * currentThread()
QStringList entryList(QFlags< QDir::Filter > filters, QFlags< QDir::SortFlag > sort) const
StandardButton critical(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
QString styleSheet() const
static QString platform()
Returns the QGIS platform name, eg "desktop" or "server".
QString left(int n) const
static void exitQgis()
deletes provider registry and map layer registry
static QStringList svgPaths()
Returns the pathes to svg directories.
static QString sponsorsFilePath()
Returns the path to the sponsors file.
int indexOf(const QRegExp &rx, int from) const
void prepend(const T &value)
iterator insert(const Key &key, const T &value)
bool contains(const Key &key) const
static QStringList composerTemplatePaths()
Returns the pathes to composer template directories.
static QString srsDbFilePath()
Returns the path to the srs.db file.
static QHash< QString, QString > uiThemes()
All themes found in ~/.qgis2/themes folder.
static QString libexecPath()
Returns the path with utility executables (help viewer, crssync, ...)
static QString prefixPath()
Returns the path to the application prefix directory.
static QString iconsPath()
Returns the path to the icons image directory.
static QString translatorsFilePath()
Returns the path to the sponsors file.
static const char * QGIS_APPLICATION_NAME
QString applicationDirPath()
virtual bool notify(QObject *receiver, QEvent *e)
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
static const int QGIS_VERSION_INT
Defines a qgis exception class.
QByteArray readAllStandardOutput()
void settingsChanged()
Emitted whenever any global, application-wide settings are changed.
void start(const QString &program, const QStringList &arguments, QFlags< QIODevice::OpenModeFlag > mode)
static void setMaxThreads(int maxThreads)
Set maximum concurrent thread count.
bool mkpath(const QString &dirPath) const
static void setUITheme(const QString &themeName)
Set the current UI theme used to style the interface.
static QString licenceFilePath()
Returns the path to the licence file.
qint64 readLine(char *data, qint64 maxSize)
static QString userThemesFolder()
Returns the path to user's themes folder.
void preNotify(QObject *receiver, QEvent *event, bool *done)
const T value(const Key &key) const
bool waitForFinished(int msecs)
QByteArray toUtf8() const