[QGIS Commit] r11853 - in trunk/qgis: python/core src/core/symbology
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Oct 26 15:50:08 EDT 2009
Author: jef
Date: 2009-10-26 15:50:08 -0400 (Mon, 26 Oct 2009)
New Revision: 11853
Modified:
trunk/qgis/python/core/qgsapplication.sip
trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp
trunk/qgis/src/core/symbology/qgssymbol.cpp
Log:
recurse svg directories
Modified: trunk/qgis/python/core/qgsapplication.sip
===================================================================
--- trunk/qgis/python/core/qgsapplication.sip 2009-10-26 16:25:22 UTC (rev 11852)
+++ trunk/qgis/python/core/qgsapplication.sip 2009-10-26 19:50:08 UTC (rev 11853)
@@ -148,7 +148,12 @@
//! 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.
Modified: trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp
===================================================================
--- trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp 2009-10-26 16:25:22 UTC (rev 11852)
+++ trunk/qgis/src/core/symbology/qgsmarkercatalogue.cpp 2009-10-26 19:50:08 UTC (rev 11853)
@@ -74,38 +74,18 @@
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 );
}
}
Modified: trunk/qgis/src/core/symbology/qgssymbol.cpp
===================================================================
--- trunk/qgis/src/core/symbology/qgssymbol.cpp 2009-10-26 16:25:22 UTC (rev 11852)
+++ trunk/qgis/src/core/symbology/qgssymbol.cpp 2009-10-26 19:50:08 UTC (rev 11853)
@@ -217,20 +217,17 @@
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() )
{
More information about the QGIS-commit
mailing list