mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
recurse svg directories
git-svn-id: http://svn.osgeo.org/qgis/trunk@11853 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
47be6dcbc6
commit
da8e3988f6
@ -148,7 +148,12 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
|
||||
//! Returns the path to the srs.db file.
|
||||
static const QString srsDbFilePath();
|
||||
|
||||
//! Returns the path to the svg directory.
|
||||
//! Returns the paths to the svg directories.
|
||||
//! @note added in 1.4
|
||||
static const QStringList svgPaths();
|
||||
|
||||
//! Returns the path to the applications svg paths
|
||||
//! @note deprecated
|
||||
static const QString svgPath();
|
||||
|
||||
//! Returns the path to the application prefix directory.
|
||||
|
@ -74,38 +74,18 @@ void QgsMarkerCatalogue::refreshList()
|
||||
|
||||
for(int i=0; i<svgPaths.size(); i++)
|
||||
{
|
||||
// TODO recursive ?
|
||||
QDir dir( svgPaths[i] );
|
||||
|
||||
//
|
||||
// First check the root dir of this path for svgs
|
||||
//
|
||||
QStringList dl1 = dir.entryList( QStringList( "*.svg" ), QDir::Files );
|
||||
for ( QStringList::iterator it1 = dl1.begin(); it1 != dl1.end(); ++it1 )
|
||||
foreach(QString item, dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
|
||||
{
|
||||
// TODO test if it is correct SVG
|
||||
mList.append( "svg:" + dir.path() + "/" + *it1 );
|
||||
svgPaths.insert(i+1, dir.path() + "/" + item);
|
||||
}
|
||||
|
||||
//
|
||||
// Now check in any nested dirs for svgs
|
||||
//
|
||||
QStringList dl = dir.entryList( QDir::Dirs );
|
||||
for ( QStringList::iterator it = dl.begin(); it != dl.end(); ++it )
|
||||
QgsDebugMsg( QString( "Looking for svgs in %1" ).arg( dir.path() ) );
|
||||
|
||||
foreach(QString item, dir.entryList( QStringList( "*.svg" ), QDir::Files ) )
|
||||
{
|
||||
QgsDebugMsg( QString( "Looking for svgs in %1" ).arg( svgPaths[i] + *it ) );
|
||||
|
||||
if ( *it == "." || *it == ".." ) continue;
|
||||
|
||||
QDir dir2( svgPaths[i] + *it );
|
||||
|
||||
QStringList dl2 = dir2.entryList( QStringList( "*.svg" ), QDir::Files );
|
||||
|
||||
for ( QStringList::iterator it2 = dl2.begin(); it2 != dl2.end(); ++it2 )
|
||||
{
|
||||
// TODO test if it is correct SVG
|
||||
mList.append( "svg:" + svgPaths[i] + *it + "/" + *it2 );
|
||||
}
|
||||
// TODO test if it is correct SVG
|
||||
mList.append( "svg:" + dir.path() + "/" + item );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,20 +217,17 @@ void QgsSymbol::setNamedPointSymbol( QString name )
|
||||
QgsDebugMsg( "\n\n\n *** Svg Symbol not found on fs ***" );
|
||||
QgsDebugMsg( "Name: " + name );
|
||||
//see if we can resolve the problem...
|
||||
//by using the qgis svg dir from this local machine
|
||||
//one day when user specified svg are allowed we need
|
||||
//to adjust this logic probably...
|
||||
//
|
||||
|
||||
QStringList svgPaths = QgsApplication::svgPaths();
|
||||
|
||||
for( int i=0; i<svgPaths.size(); i++)
|
||||
{
|
||||
QgsDebugMsg( "SvgPath: " + svgPaths[i] );
|
||||
QFileInfo myInfo( myTempName );
|
||||
QString myFileName = myInfo.fileName(); // foo.svg
|
||||
QString myLowestDir = myInfo.dir().dirName();
|
||||
QString myLocalPath = svgPaths[i] + QDir::separator() +
|
||||
myLowestDir + QDir::separator() +
|
||||
myFileName;
|
||||
QString myLocalPath = svgPaths[i] + "/" + myLowestDir + "/" + myFileName;
|
||||
|
||||
QgsDebugMsg( "Alternative svg path: " + myLocalPath );
|
||||
if ( QFile( myLocalPath ).exists() )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user