31 #include <QFileOpenEvent>
32 #include <QMessageBox>
38 #include <QThreadPool>
41 #include <netinet/in.h>
46 #include "qgsconfig.h"
65 bool ABISYM( QgsApplication::mRunningFromBuildDir ) =
false;
72 int ABISYM( QgsApplication::mMaxThreads );
95 init( customConfigPath );
100 if ( customConfigPath.
isEmpty() )
102 if ( getenv(
"QGIS_CUSTOM_CONFIG_PATH" ) )
104 customConfigPath = getenv(
"QGIS_CUSTOM_CONFIG_PATH" );
112 qRegisterMetaType<QgsGeometry::Error>(
"QgsGeometry::Error" );
120 Q_FOREACH (
const QString& path,
QStringList() <<
"" <<
"/.." <<
"/bin" <<
"/../../.." )
122 f.
setFileName( prefixPath + path +
"/qgisbuildpath.txt" );
126 if ( f.
exists() && f.
open( QIODevice::ReadOnly ) )
128 ABISYM( mRunningFromBuildDir ) =
true;
129 ABISYM( mBuildSourcePath ) = f.
readLine().trimmed();
130 ABISYM( mBuildOutputPath ) = f.
readLine().trimmed();
131 qDebug(
"Running from build directory!" );
132 qDebug(
"- source directory: %s", ABISYM( mBuildSourcePath ).toUtf8().data() );
133 qDebug(
"- output directory of the build: %s", ABISYM( mBuildOutputPath ).toUtf8().data() );
135 ABISYM( mCfgIntDir ) = prefixPath.split(
"/", QString::SkipEmptyParts ).last();
136 qDebug(
"- cfg: %s", ABISYM( mCfgIntDir ).toUtf8().data() );
140 if ( ABISYM( mRunningFromBuildDir ) )
143 ABISYM( mPrefixPath ) =
QString();
144 #if defined(_MSC_VER) && !defined(USING_NMAKE)
145 setPluginPath( ABISYM( mBuildOutputPath ) +
"/" +
QString( QGIS_PLUGIN_SUBDIR ) +
"/" + ABISYM( mCfgIntDir ) );
150 ABISYM( mLibraryPath ) = ABISYM( mBuildOutputPath ) +
"/" + QGIS_LIB_SUBDIR +
"/";
151 #if defined(_MSC_VER) && !defined(USING_NMAKE)
152 ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) +
"/" + QGIS_LIBEXEC_SUBDIR +
"/" + ABISYM( mCfgIntDir ) +
"/";
154 ABISYM( mLibexecPath ) = ABISYM( mBuildOutputPath ) +
"/" + QGIS_LIBEXEC_SUBDIR +
"/";
159 char *prefixPath = getenv(
"QGIS_PREFIX_PATH" );
162 #if defined(Q_OS_MACX) || defined(Q_OS_WIN)
164 #elif defined(ANDROID)
183 if ( !customConfigPath.
isEmpty() )
185 ABISYM( mConfigPath ) = customConfigPath +
"/";
191 if ( getenv(
"QGIS_AUTH_DB_DIR_PATH" ) )
199 QString passfile(
"QGIS_AUTH_PASSWORD_FILE" );
207 if ( varStrName != passfile )
209 systemEnvVarMap.
insert( varStrName, varStrValue );
212 ABISYM( mSystemEnvVars ) = systemEnvVarMap;
220 ABISYM( mMaxThreads ) = -1;
230 if ( event->
type() == QEvent::FileOpen )
233 if ( ABISYM( mFileOpenEventReceiver ) )
236 done =
notify( ABISYM( mFileOpenEventReceiver ), event );
243 ABISYM( mFileOpenEventList ).append( static_cast<QFileOpenEvent *>( event )->file() );
260 emit
preNotify( receiver, event, &done );
277 catch ( std::exception & e )
285 QgsDebugMsg(
"Caught unhandled unknown exception" );
296 ABISYM( mFileOpenEventReceiver ) = receiver;
298 if ( ABISYM( mFileOpenEventList ).count() > 0 )
300 QStringListIterator i( ABISYM( mFileOpenEventList ) );
301 while ( i.hasNext() )
306 ABISYM( mFileOpenEventList ).clear();
312 ABISYM( mPrefixPath ) = thePrefixPath;
313 #if defined(_MSC_VER)
314 if ( ABISYM( mPrefixPath ).endsWith(
"/bin" ) )
316 ABISYM( mPrefixPath ).chop( 4 );
319 if ( useDefaultPaths && !ABISYM( mRunningFromBuildDir ) )
324 ABISYM( mLibraryPath ) = ABISYM( mPrefixPath ) +
"/" + QGIS_LIB_SUBDIR +
"/";
325 ABISYM( mLibexecPath ) = ABISYM( mPrefixPath ) +
"/" + QGIS_LIBEXEC_SUBDIR +
"/";
330 ABISYM( mPluginPath ) = thePluginPath;
335 ABISYM( mPkgDataPath ) = thePkgDataPath;
336 QString mySvgPath = thePkgDataPath + ( ABISYM( mRunningFromBuildDir ) ?
"/images/svg/" :
"/svg/" );
338 if ( !ABISYM( mDefaultSvgPaths ).contains( mySvgPath ) )
339 ABISYM( mDefaultSvgPaths ) << mySvgPath;
344 ABISYM( mDefaultSvgPaths ) = pathList;
358 if ( ABISYM( mRunningFromBuildDir ) )
360 static bool once =
true;
362 qWarning(
"!!! prefix path was requested, but it is not valid - we do not run from installed path !!!" );
366 return ABISYM( mPrefixPath );
370 return ABISYM( mPluginPath );
374 return ABISYM( mPkgDataPath );
378 return ":/images/themes/default/";
391 return path + iconFile;
403 return QIcon( myPreferredPath );
409 return QIcon( myDefaultPath );
424 return QPixmap( myPreferredPath );
430 return QPixmap( myDefaultPath );
439 ABISYM( mThemeName ) = theThemeName;
446 return ABISYM( mThemeName );
454 if ( !themes.
contains( themename ) )
455 themename =
"default";
457 QString path = themes[themename];
458 QString stylesheetname = path +
"/style.qss";
459 QString autostylesheet = stylesheetname +
".auto";
461 QFile file( stylesheetname );
462 QFile variablesfile( path +
"/variables.qss" );
463 QFile fileout( autostylesheet );
467 if ( variableInfo.
exists() && variablesfile.
open( QIODevice::ReadOnly ) )
469 if ( !file.
open( QIODevice::ReadOnly ) || !fileout.
open( QIODevice::WriteOnly | QIODevice::Text ) )
477 while ( !in.
atEnd() )
486 styledata.
replace( name, value );
489 variablesfile.
close();
494 stylesheetname = autostylesheet;
498 styleSheet.
append( stylesheetname );
499 qApp->setStyleSheet( styleSheet );
507 mapping.
insert(
"default",
"" );
508 Q_FOREACH (
const QString& path, paths )
511 QFileInfoList styleFiles = folder.
entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
512 Q_FOREACH (
const QFileInfo& info, styleFiles )
515 if ( !styleFile.exists() )
520 mapping.
insert( name, path );
531 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/AUTHORS" );
538 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/CONTRIBUTORS" );
542 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/developersmap.html" );
550 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/SPONSORS" );
558 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/DONORS" );
564 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/TRANSLATORS" );
570 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/doc/LICENSE" );
584 helpAppPath +=
"/qgis_help";
586 helpAppPath +=
".exe";
595 if ( ABISYM( mRunningFromBuildDir ) )
596 return ABISYM( mBuildOutputPath ) +
QLatin1String(
"/i18n" );
606 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/resources/qgis.db" );
614 return ABISYM( mConfigPath );
630 return ABISYM( mAuthDbDirPath ) +
QLatin1String(
"qgis-auth.db" );
638 return QString(
":/images/splash/" );
646 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/images/icons/" );
653 if ( ABISYM( mRunningFromBuildDir ) )
657 if ( !
QFile( tempCopy ).exists() )
659 QFile f( ABISYM( mPkgDataPath ) +
"/resources/srs.db" );
660 if ( !f.
copy( tempCopy ) )
662 qFatal(
"Could not create temporary copy" );
670 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/resources/srs.db" );
686 myPathList = myPaths.
split(
"|" );
689 myPathList << ABISYM( mDefaultSvgPaths );
705 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/resources/symbology-ng-style.db" );
710 return ABISYM( mPkgDataPath ) +
QLatin1String(
"/resources/themes" );
715 return ABISYM( mLibraryPath );
720 return ABISYM( mLibexecPath );
725 return ( htonl( 1 ) == 1 ) ?
XDR :
NDR;
757 QString myEnvironmentVar( getenv(
"QGIS_PREFIX_PATH" ) );
758 QString myState =
tr(
"Application state:\n"
759 "QGIS_PREFIX_PATH env var:\t\t%1\n"
761 "Plugin Path:\t\t%3\n"
762 "Package Data Path:\t%4\n"
763 "Active Theme Name:\t%5\n"
764 "Active Theme Path:\t%6\n"
765 "Default Theme Path:\t%7\n"
766 "SVG Search Paths:\t%8\n"
767 "User DB Path:\t%9\n"
768 "Auth DB Path:\t%10\n" )
769 .
arg( myEnvironmentVar,
776 svgPaths().join(
tr(
"\n\t\t",
"match indentation of application state" ) ),
789 QColor myColor1( Qt::lightGray );
790 QColor myColor2 = myColor1;
791 myColor2 = myColor2.
lighter( 110 );
793 myStyle =
"p.glossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, "
794 " stop: 0 " + myColor1.
name() +
","
795 " stop: 0.1 " + myColor2.
name() +
","
796 " stop: 0.5 " + myColor1.
name() +
","
797 " stop: 0.9 " + myColor2.
name() +
","
798 " stop: 1 " + myColor1.
name() +
");"
800 " padding-left: 4px;"
801 " padding-top: 20px;"
802 " padding-bottom: 8px;"
803 " border: 1px solid #6c6c6c;"
805 "p.subheaderglossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, "
806 " stop: 0 " + myColor1.
name() +
","
807 " stop: 0.1 " + myColor2.
name() +
","
808 " stop: 0.5 " + myColor1.
name() +
","
809 " stop: 0.9 " + myColor2.
name() +
","
810 " stop: 1 " + myColor1.
name() +
");"
811 " font-weight: bold;"
812 " font-size: medium;"
813 " line-height: 1.1em;"
816 " padding-left: 4px;"
817 " padding-right: 4px;"
818 " padding-top: 20px;"
819 " padding-bottom: 8px;"
820 " border: 1px solid #6c6c6c;"
822 "th.glossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, "
823 " stop: 0 " + myColor1.
name() +
","
824 " stop: 0.1 " + myColor2.
name() +
","
825 " stop: 0.5 " + myColor1.
name() +
","
826 " stop: 0.9 " + myColor2.
name() +
","
827 " stop: 1 " + myColor1.
name() +
");"
829 " border: 1px solid #6c6c6c;"
831 ".overview{ font: 1.82em; font-weight: bold;}"
832 "body{ background: white;"
834 " font-family: arial,sans-serif;"
836 "h1{ background-color: #F6F6F6;"
838 " font-size: x-large; "
839 " font-weight: normal;"
840 " font-family: luxi serif, georgia, times new roman, times, serif;"
842 " padding: 0.75em 0 0;"
846 "h2{ background-color: #F6F6F6;"
848 " font-size: medium; "
849 " font-weight: normal;"
850 " font-family: luxi serif, georgia, times new roman, times, serif;"
852 " padding: 0.75em 0 0;"
854 " line-height: 1.1em;"
856 "h3{ background-color: #F6F6F6;"
858 " font-family: luxi serif, georgia, times new roman, times, serif;"
859 " font-weight: bold;"
861 " text-align: right;"
862 " border-bottom: 5px solid #DCEB5C;"
864 "h4{ background-color: #F6F6F6;"
866 " font-family: luxi serif, georgia, times new roman, times, serif;"
867 " font-weight: bold;"
868 " font-size: medium;"
869 " text-align: right;"
871 "h5{ background-color: #F6F6F6;"
873 " font-family: luxi serif, georgia, times new roman, times, serif;"
874 " font-weight: bold;"
876 " text-align: right;"
879 " font-family: arial,sans-serif;"
882 "label{ background-color: #FFFFCC;"
883 " border: 1px solid black;"
885 " padding: 0px 3px; "
893 if ( 0 >= OGRGetDriverCount() )
901 #if defined( Q_OS_WIN )
902 const Qt::CaseSensitivity cs = Qt::CaseInsensitive;
908 aPath =
"\\\\" + aPath.
mid( 2 );
911 targetPath.
replace(
"\\",
"/" );
915 targetPath =
"\\\\" + targetPath.
mid( 2 );
918 const Qt::CaseSensitivity cs = Qt::CaseSensitive;
929 while ( aPathElems.
size() > 0 &&
930 targetElems.
size() > 0 &&
931 aPathElems[0].compare( targetElems[0], cs ) == 0 )
944 if ( targetElems.
size() > 0 )
947 for (
int i = 0; i < targetElems.
size(); i++ )
949 aPathElems.
insert( 0,
".." );
956 aPathElems.
insert( 0,
"." );
959 return aPathElems.
join(
"/" );
970 #if defined(Q_OS_WIN)
972 targetPath.
replace(
"\\",
"/" );
980 #if defined(Q_OS_WIN)
983 targetElems.
insert( 0,
"" );
984 targetElems.
insert( 0,
"" );
989 targetElems << srcElems;
994 while (( pos = targetElems.
indexOf(
".." ) ) > 0 )
1001 #if !defined(Q_OS_WIN)
1006 return targetElems.
join(
"/" );
1011 if ( ABISYM( mGdalSkipList ).contains( theDriver ) || theDriver.
isEmpty() )
1015 ABISYM( mGdalSkipList ) << theDriver;
1021 if ( !ABISYM( mGdalSkipList ).contains( theDriver ) )
1025 int myPos = ABISYM( mGdalSkipList ).indexOf( theDriver );
1028 ABISYM( mGdalSkipList ).removeAt( myPos );
1035 ABISYM( mGdalSkipList ).removeDuplicates();
1036 QString myDriverList = ABISYM( mGdalSkipList ).join(
" " );
1037 QgsDebugMsg(
"Gdal Skipped driver list set to:" );
1039 CPLSetConfigOption(
"GDAL_SKIP", myDriverList.
toUtf8() );
1046 QDir myDir( folder );
1056 void QgsApplication::copyPath(
const QString& src,
const QString& dst )
1059 if ( ! dir.exists() )
1062 Q_FOREACH (
const QString& d, dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
1065 dir.mkpath( dst_path );
1069 Q_FOREACH (
const QString& f, dir.entryList( QDir::Files ) )
1081 QDir myDir( myPamPath );
1084 myDir.
mkpath( myPamPath );
1087 #if defined(Q_OS_WIN)
1088 CPLSetConfigOption(
"GDAL_PAM_PROXY_DIR", myPamPath.
toUtf8() );
1092 int myChangeFlag = 0;
1093 setenv(
"GDAL_PAM_PROXY_DIR", myPamPath.
toUtf8(), myChangeFlag );
1100 if ( !qgisPrivateDbFile.exists() )
1104 QFile masterFile( qgisMasterDbFileName );
1110 bool isDbFileCopied = masterFile.
copy( qgisPrivateDbFile.fileName() );
1112 if ( !isDbFileCopied )
1116 *errorMessage =
tr(
"[ERROR] Can not make qgis.db private copy" );
1129 *errorMessage =
tr(
"Could not open qgis.db" );
1135 int res = sqlite3_exec( db,
"SELECT epsg FROM tbl_srs LIMIT 0", 0, 0, &errmsg );
1136 if ( res == SQLITE_OK )
1139 if ( sqlite3_exec( db,
1140 "ALTER TABLE tbl_srs RENAME TO tbl_srs_bak;"
1141 "CREATE TABLE tbl_srs ("
1142 "srs_id INTEGER PRIMARY KEY,"
1143 "description text NOT NULL,"
1144 "projection_acronym text NOT NULL,"
1145 "ellipsoid_acronym NOT NULL,"
1146 "parameters text NOT NULL,"
1148 "auth_name varchar,"
1150 "is_geo integer NOT NULL,"
1151 "deprecated boolean);"
1152 "CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);"
1153 "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;"
1154 "DROP TABLE tbl_srs_bak", 0, 0, &errmsg ) != SQLITE_OK
1161 sqlite3_free( errmsg );
1162 sqlite3_close( db );
1168 sqlite3_free( errmsg );
1171 if ( sqlite3_exec( db,
"DROP VIEW vw_srs", 0, 0, &errmsg ) != SQLITE_OK )
1173 QgsDebugMsg(
QString(
"vw_srs didn't exists in private qgis.db: %1" ).arg( errmsg ) );
1176 if ( sqlite3_exec( db,
1177 "CREATE VIEW vw_srs AS"
1179 " a.description AS description"
1180 ",a.srs_id AS srs_id"
1181 ",a.is_geo AS is_geo"
1182 ",coalesce(b.name,a.projection_acronym) AS name"
1183 ",a.parameters AS parameters"
1184 ",a.auth_name AS auth_name"
1185 ",a.auth_id AS auth_id"
1186 ",a.deprecated AS deprecated"
1188 " LEFT OUTER JOIN tbl_projection b ON a.projection_acronym=b.acronym"
1189 " ORDER BY coalesce(b.name,a.projection_acronym),a.description", 0, 0, &errmsg ) != SQLITE_OK
1194 *errorMessage =
tr(
"Update of view in private qgis.db failed.\n%1" ).
arg(
QString::fromUtf8( errmsg ) );
1196 sqlite3_free( errmsg );
1197 sqlite3_close( db );
1201 sqlite3_close( db );
1219 if ( maxThreads == -1 )
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.
enum QgsApplication::ENDIAN endian_t
Constants for endian-ness.
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)
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 void setPrefixPath(const QString &thePrefixPath, bool useDefaultPaths=false)
Alters prefix path - used by 3rd party apps.
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 QString absolutePathToRelativePath(QString apath, QString targetPath)
Converts absolute path to path relative to target.
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 developersMapFilePath()
Returns the path to the developers map file.
void addLibraryPath(const QString &path)
static void applyGdalSkippedDrivers()
Apply the skipped drivers list to gdal.
const char * name() const
QString canonicalFilePath() const
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 bool createDB(QString *errorMessage=0)
initialise qgis.db
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 pkgDataPath()
Returns the common root path of all application data directories.
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 relativePathToAbsolutePath(QString rpath, QString targetPath)
Converts path relative to target to an absolute path.
static QString defaultStyleV2Path()
Returns the path to default style (works as a starting point).
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 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.
QgsApplication(int &argc, char **argv, bool GUIenabled, const QString &customConfigPath=QString())
virtual bool event(QEvent *e)
QString absolutePath() const
void insert(int i, const T &value)
QThread * currentThread()
StandardButton critical(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
QString styleSheet() const
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 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.
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)
QByteArray toUtf8() const