Skip to content
Permalink
Browse files
Make default svg path configurable for third party apps
git-svn-id: http://svn.osgeo.org/qgis/trunk@13217 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 1, 2010
1 parent e107bfa commit 8ee2e3cea0e36e42a866a865a248bfadb713c5ae
Showing with 24 additions and 6 deletions.
  1. +3 −0 python/core/qgsapplication.sip
  2. +6 −1 src/app/composer/qgscomposerpicturewidget.cpp
  3. +11 −5 src/core/qgsapplication.cpp
  4. +4 −0 src/core/qgsapplication.h
@@ -185,6 +185,9 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)

//! Alters pkg data path - used by 3rd party apps
static void setPkgDataPath(const QString thePkgDataPath);

//! Alters default svg paths - used by 3rd party apps. Added in QGIS 1.5
static void setDefaultSvgPaths( const QStringList& pathList );

//! loads providers
static void initQgis();
@@ -445,9 +445,14 @@ void QgsComposerPictureWidget::addStandardDirectoriesToPreview()
QDir svgDirectory( svgPaths[i] );
if ( !svgDirectory.exists() || !svgDirectory.isReadable() )
{
return; //error
continue;
}

//add directory itself
mSearchDirectoriesComboBox->addItem( svgDirectory.absolutePath() );
addDirectoryToPreview( svgDirectory.absolutePath() );

//and also subdirectories
QFileInfoList directoryList = svgDirectory.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
QFileInfoList::const_iterator dirIt = directoryList.constBegin();
for ( ; dirIt != directoryList.constEnd(); ++dirIt )
@@ -43,6 +43,7 @@ QString QgsApplication::mPrefixPath;
QString QgsApplication::mPluginPath;
QString QgsApplication::mPkgDataPath;
QString QgsApplication::mThemeName;
QStringList QgsApplication::mDefaultSvgPaths;

/*!
\class QgsApplication
@@ -73,6 +74,9 @@ QgsApplication::QgsApplication( int & argc, char ** argv, bool GUIenabled )
#if ! defined(Q_WS_WIN) && ! defined(Q_WS_MAC)
setWindowIcon( QPixmap( qgis_xpm ) ); // Linux
#endif

mDefaultSvgPaths << mPkgDataPath + QString( "/svg/" );
mDefaultSvgPaths << qgisSettingsDirPath() + QString( "svg/" );
}

QgsApplication::~QgsApplication()
@@ -129,6 +133,11 @@ void QgsApplication::setPkgDataPath( const QString thePkgDataPath )
mPkgDataPath = thePkgDataPath;
}

void QgsApplication::setDefaultSvgPaths( const QStringList& pathList )
{
mDefaultSvgPaths = pathList;
}

const QString QgsApplication::prefixPath()
{
return mPrefixPath;
@@ -313,12 +322,9 @@ const QStringList QgsApplication::svgPaths()
{
myPathList = myPaths.split( "|" );
}
//additional default paths
myPathList
<< mPkgDataPath + QString( "/svg/" )
<< qgisSettingsDirPath() + QString( "svg/" );
return myPathList;

myPathList << mDefaultSvgPaths;
return myPathList;
}

/*!
@@ -142,6 +142,9 @@ class CORE_EXPORT QgsApplication: public QApplication
//! Alters pkg data path - used by 3rd party apps
static void setPkgDataPath( const QString thePkgDataPath );

//! Alters default svg paths - used by 3rd party apps. Added in QGIS 1.5
static void setDefaultSvgPaths( const QStringList& pathList );

//! loads providers
static void initQgis();

@@ -184,6 +187,7 @@ class CORE_EXPORT QgsApplication: public QApplication
static QString mPluginPath;
static QString mPkgDataPath;
static QString mThemeName;
static QStringList mDefaultSvgPaths;
};

#endif

0 comments on commit 8ee2e3c

Please sign in to comment.