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) 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) 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/";
407 return path + iconFile;
419 return QIcon( myPreferredPath );
425 return QIcon( myDefaultPath );
440 return QPixmap( myPreferredPath );
446 return QPixmap( myDefaultPath );
455 ABISYM( mThemeName ) = theThemeName;
462 return ABISYM( mThemeName );
470 if ( !themes.
contains( themename ) )
471 themename =
"default";
473 QString path = themes[themename];
474 QString stylesheetname = path +
"/style.qss";
475 QString autostylesheet = stylesheetname +
".auto";
477 QFile file( stylesheetname );
478 QFile variablesfile( path +
"/variables.qss" );
479 QFile fileout( autostylesheet );
483 if ( variableInfo.
exists() && variablesfile.
open( QIODevice::ReadOnly ) )
485 if ( !file.
open( QIODevice::ReadOnly ) || !fileout.
open( QIODevice::WriteOnly | QIODevice::Text ) )
493 while ( !in.
atEnd() )
502 styledata.
replace( name, value );
505 variablesfile.
close();
510 stylesheetname = autostylesheet;
514 styleSheet.
append( stylesheetname );
515 qApp->setStyleSheet( styleSheet );
523 mapping.
insert(
"default",
"" );
524 Q_FOREACH (
const QString& path, paths )
527 QFileInfoList styleFiles = folder.
entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
528 Q_FOREACH (
const QFileInfo& info, styleFiles )
531 if ( !styleFile.exists() )
536 mapping.
insert( name, path );
547 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/AUTHORS" );
554 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/CONTRIBUTORS" );
558 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/developersmap.html" );
566 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/SPONSORS" );
574 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/DONORS" );
580 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/TRANSLATORS" );
586 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/LICENSE" );
600 helpAppPath +=
"/qgis_help";
602 helpAppPath +=
".exe";
611 if ( ABISYM( mRunningFromBuildDir ) )
612 return ABISYM( mBuildOutputPath ) +
QLatin1String(
"/i18n" );
622 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/resources/qgis.db" );
630 return ABISYM( mConfigPath );
646 return ABISYM( mAuthDbDirPath ) +
QLatin1String(
"qgis-auth.db" );
654 return QString(
":/images/splash/" );
662 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/images/icons/" );
669 if ( ABISYM( mRunningFromBuildDir ) )
673 if ( !
QFile( tempCopy ).exists() )
675 QFile f( ABISYM( mPkgDataPath ) +
"/resources/srs.db" );
676 if ( !f.
copy( tempCopy ) )
678 qFatal(
"Could not create temporary copy" );
686 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/resources/srs.db" );
702 myPathList = myPaths.
split(
'|' );
705 myPathList << ABISYM( mDefaultSvgPaths );
721 myPathList = myPaths.
split(
'|' );
734 return QRegExp(
"^[A-Za-z][A-Za-z0-9\\._-]*" );
743 TCHAR
name [ UNLEN + 1 ];
744 DWORD size = UNLEN + 1;
746 if ( GetUserName(( TCHAR* )name, &size ) )
754 process.
start(
"whoami" );
763 sUserName = qgetenv(
"USER" );
768 sUserName = qgetenv(
"USERNAME" );
774 if ( !sUserFullName.
isEmpty() )
775 return sUserFullName;
778 TCHAR
name [ UNLEN + 1 ];
779 DWORD size = UNLEN + 1;
782 if ( GetUserNameEx( NameDisplay, ( TCHAR* )name, &size ) )
784 sUserFullName =
QString( name );
790 #elif defined(Q_OS_ANDROID) 791 sUserFullName =
"Not available";
793 struct passwd *p = getpwuid( getuid() );
798 sUserFullName = gecosName.
left( gecosName.
indexOf(
',', 0 ) );
803 return sUserFullName;
808 #if defined(Q_OS_ANDROID) 810 #elif defined(Q_OS_MAC) 812 #elif defined(Q_OS_WIN) 814 #elif defined(Q_OS_LINUX) 823 return sPlatformName;
843 return ABISYM( mLibraryPath );
848 return ABISYM( mLibexecPath );
853 return ( htonl( 1 ) == 1 ) ?
XDR :
NDR;
884 GDALDestroyDriverManager();
889 QString myEnvironmentVar( getenv(
"QGIS_PREFIX_PATH" ) );
890 QString myState =
tr(
"Application state:\n" 891 "QGIS_PREFIX_PATH env var:\t\t%1\n" 893 "Plugin Path:\t\t%3\n" 894 "Package Data Path:\t%4\n" 895 "Active Theme Name:\t%5\n" 896 "Active Theme Path:\t%6\n" 897 "Default Theme Path:\t%7\n" 898 "SVG Search Paths:\t%8\n" 899 "User DB Path:\t%9\n" 900 "Auth DB Path:\t%10\n" )
901 .
arg( myEnvironmentVar,
908 svgPaths().join(
tr(
"\n\t\t",
"match indentation of application state" ) ),
921 QColor myColor1( Qt::lightGray );
922 QColor myColor2 = myColor1;
923 myColor2 = myColor2.
lighter( 110 );
925 myStyle =
"p.glossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, " 926 " stop: 0 " + myColor1.
name() +
"," 927 " stop: 0.1 " + myColor2.
name() +
"," 928 " stop: 0.5 " + myColor1.
name() +
"," 929 " stop: 0.9 " + myColor2.
name() +
"," 930 " stop: 1 " + myColor1.
name() +
");" 932 " padding-left: 4px;" 933 " padding-top: 20px;" 934 " padding-bottom: 8px;" 935 " border: 1px solid #6c6c6c;" 937 "p.subheaderglossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, " 938 " stop: 0 " + myColor1.
name() +
"," 939 " stop: 0.1 " + myColor2.
name() +
"," 940 " stop: 0.5 " + myColor1.
name() +
"," 941 " stop: 0.9 " + myColor2.
name() +
"," 942 " stop: 1 " + myColor1.
name() +
");" 943 " font-weight: bold;" 944 " font-size: medium;" 945 " line-height: 1.1em;" 948 " padding-left: 4px;" 949 " padding-right: 4px;" 950 " padding-top: 20px;" 951 " padding-bottom: 8px;" 952 " border: 1px solid #6c6c6c;" 954 "th.glossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, " 955 " stop: 0 " + myColor1.
name() +
"," 956 " stop: 0.1 " + myColor2.
name() +
"," 957 " stop: 0.5 " + myColor1.
name() +
"," 958 " stop: 0.9 " + myColor2.
name() +
"," 959 " stop: 1 " + myColor1.
name() +
");" 961 " border: 1px solid #6c6c6c;" 963 ".overview{ font: 1.82em; font-weight: bold;}" 964 "body{ background: white;" 966 " font-family: arial,sans-serif;" 968 "h1{ background-color: #F6F6F6;" 970 " font-size: x-large; " 971 " font-weight: normal;" 972 " font-family: luxi serif, georgia, times new roman, times, serif;" 974 " padding: 0.75em 0 0;" 978 "h2{ background-color: #F6F6F6;" 980 " font-size: medium; " 981 " font-weight: normal;" 982 " font-family: luxi serif, georgia, times new roman, times, serif;" 984 " padding: 0.75em 0 0;" 986 " line-height: 1.1em;" 988 "h3{ background-color: #F6F6F6;" 990 " font-family: luxi serif, georgia, times new roman, times, serif;" 991 " font-weight: bold;" 993 " text-align: right;" 994 " border-bottom: 5px solid #DCEB5C;" 996 "h4{ background-color: #F6F6F6;" 998 " font-family: luxi serif, georgia, times new roman, times, serif;" 999 " font-weight: bold;" 1000 " font-size: medium;" 1001 " text-align: right;" 1003 "h5{ background-color: #F6F6F6;" 1005 " font-family: luxi serif, georgia, times new roman, times, serif;" 1006 " font-weight: bold;" 1007 " font-size: small;" 1008 " text-align: right;" 1010 "a{ color: #729FCF;" 1011 " font-family: arial,sans-serif;" 1012 " font-size: small;" 1014 "label{ background-color: #FFFFCC;" 1015 " border: 1px solid black;" 1017 " padding: 0px 3px; " 1018 " font-size: small;" 1025 if ( 0 >= OGRGetDriverCount() )
1034 QString tPathUrl = targetPath;
1035 #if defined( Q_OS_WIN ) 1036 const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
1038 aPathUrl.
replace(
'\\',
'/' );
1042 aPathUrl =
"\\\\" + aPathUrl.
mid( 2 );
1045 tPathUrl.
replace(
'\\',
'/' );
1049 tPathUrl =
"\\\\" + tPathUrl.
mid( 2 );
1052 const Qt::CaseSensitivity cs = Qt::CaseSensitive;
1063 while ( !aPathElems.
isEmpty() &&
1065 aPathElems[0].compare( targetElems[0], cs ) == 0 )
1081 for (
int i = 0; i < targetElems.
size(); i++ )
1083 aPathElems.
insert( 0,
".." );
1090 aPathElems.
insert( 0,
"." );
1093 return aPathElems.
join(
"/" );
1105 QString targetPathUrl = targetPath;
1107 #if defined(Q_OS_WIN) 1108 rPathUrl.
replace(
'\\',
'/' );
1109 targetPathUrl.
replace(
'\\',
'/' );
1111 bool uncPath = targetPathUrl.
startsWith(
"//" );
1115 QStringList targetElems = targetPathUrl.
split(
'/', QString::SkipEmptyParts );
1117 #if defined(Q_OS_WIN) 1120 targetElems.
insert( 0,
"" );
1121 targetElems.
insert( 0,
"" );
1126 targetElems << srcElems;
1131 while (( pos = targetElems.
indexOf(
".." ) ) > 0 )
1138 #if !defined(Q_OS_WIN) 1143 return targetElems.
join(
"/" );
1148 if (
ABISYM( mGdalSkipList ).contains( theDriver ) || theDriver.
isEmpty() )
1152 ABISYM( mGdalSkipList ) << theDriver;
1158 if ( !
ABISYM( mGdalSkipList ).contains( theDriver ) )
1174 QgsDebugMsg(
"Gdal Skipped driver list set to:" );
1176 CPLSetConfigOption(
"GDAL_SKIP", myDriverList.
toUtf8() );
1183 QDir myDir( folder );
1193 void QgsApplication::copyPath(
const QString& src,
const QString& dst )
1199 Q_FOREACH (
const QString& d, dir.
entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
1218 QDir myDir( myPamPath );
1221 myDir.
mkpath( myPamPath );
1224 #if defined(Q_OS_WIN) 1225 CPLSetConfigOption(
"GDAL_PAM_PROXY_DIR", myPamPath.
toUtf8() );
1229 int myChangeFlag = 0;
1230 setenv(
"GDAL_PAM_PROXY_DIR", myPamPath.
toUtf8(), myChangeFlag );
1237 if ( !qgisPrivateDbFile.exists() )
1241 QFile masterFile( qgisMasterDbFileName );
1247 bool isDbFileCopied = masterFile.
copy( qgisPrivateDbFile.fileName() );
1249 if ( !isDbFileCopied )
1253 *errorMessage =
tr(
"[ERROR] Can not make qgis.db private copy" );
1266 *errorMessage =
tr(
"Could not open qgis.db" );
1272 int res = sqlite3_exec( db,
"SELECT epsg FROM tbl_srs LIMIT 0",
nullptr,
nullptr, &errmsg );
1273 if ( res == SQLITE_OK )
1276 if ( sqlite3_exec( db,
1277 "ALTER TABLE tbl_srs RENAME TO tbl_srs_bak;" 1278 "CREATE TABLE tbl_srs (" 1279 "srs_id INTEGER PRIMARY KEY," 1280 "description text NOT NULL," 1281 "projection_acronym text NOT NULL," 1282 "ellipsoid_acronym NOT NULL," 1283 "parameters text NOT NULL," 1285 "auth_name varchar," 1287 "is_geo integer NOT NULL," 1288 "deprecated boolean);" 1289 "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);" 1290 "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;" 1291 "DROP TABLE tbl_srs_bak",
nullptr,
nullptr, &errmsg ) != SQLITE_OK
1298 sqlite3_free( errmsg );
1299 sqlite3_close( db );
1305 sqlite3_free( errmsg );
1308 if ( sqlite3_exec( db,
"DROP VIEW vw_srs",
nullptr,
nullptr, &errmsg ) != SQLITE_OK )
1310 QgsDebugMsg(
QString(
"vw_srs didn't exists in private qgis.db: %1" ).arg( errmsg ) );
1313 if ( sqlite3_exec( db,
1314 "CREATE VIEW vw_srs AS" 1316 " a.description AS description" 1317 ",a.srs_id AS srs_id" 1318 ",a.is_geo AS is_geo" 1319 ",coalesce(b.name,a.projection_acronym) AS name" 1320 ",a.parameters AS parameters" 1321 ",a.auth_name AS auth_name" 1322 ",a.auth_id AS auth_id" 1323 ",a.deprecated AS deprecated" 1325 " LEFT OUTER JOIN tbl_projection b ON a.projection_acronym=b.acronym" 1326 " ORDER BY coalesce(b.name,a.projection_acronym),a.description",
nullptr,
nullptr, &errmsg ) != SQLITE_OK
1331 *errorMessage =
tr(
"Update of view in private qgis.db failed.\n%1" ).
arg(
QString::fromUtf8( errmsg ) );
1333 sqlite3_free( errmsg );
1334 sqlite3_close( db );
1338 sqlite3_close( db );
1356 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)
static void skipGdalDriver(const QString &theDriver)
Sets the GDAL_SKIP environment variable to include the specified driver and then calls GDALDriverMana...
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()
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.
static void applyGdalSkippedDrivers()
Apply the skipped drivers list to gdal.
const char * name() const
QString canonicalFilePath() const
endian_t
Constants for endian-ness.
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.
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 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)
bool waitForFinished(int msecs)
QByteArray toUtf8() const