[QGIS Commit] r13217 - in trunk/qgis: python/core src/app/composer src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Apr 1 04:06:21 EDT 2010


Author: mhugent
Date: 2010-04-01 04:06:19 -0400 (Thu, 01 Apr 2010)
New Revision: 13217

Modified:
   trunk/qgis/python/core/qgsapplication.sip
   trunk/qgis/src/app/composer/qgscomposerpicturewidget.cpp
   trunk/qgis/src/core/qgsapplication.cpp
   trunk/qgis/src/core/qgsapplication.h
Log:
Make default svg path configurable for third party apps

Modified: trunk/qgis/python/core/qgsapplication.sip
===================================================================
--- trunk/qgis/python/core/qgsapplication.sip	2010-03-31 22:48:26 UTC (rev 13216)
+++ trunk/qgis/python/core/qgsapplication.sip	2010-04-01 08:06:19 UTC (rev 13217)
@@ -185,6 +185,9 @@
 
     //! 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();

Modified: trunk/qgis/src/app/composer/qgscomposerpicturewidget.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposerpicturewidget.cpp	2010-03-31 22:48:26 UTC (rev 13216)
+++ trunk/qgis/src/app/composer/qgscomposerpicturewidget.cpp	2010-04-01 08:06:19 UTC (rev 13217)
@@ -445,9 +445,14 @@
     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 )

Modified: trunk/qgis/src/core/qgsapplication.cpp
===================================================================
--- trunk/qgis/src/core/qgsapplication.cpp	2010-03-31 22:48:26 UTC (rev 13216)
+++ trunk/qgis/src/core/qgsapplication.cpp	2010-04-01 08:06:19 UTC (rev 13217)
@@ -43,6 +43,7 @@
 QString QgsApplication::mPluginPath;
 QString QgsApplication::mPkgDataPath;
 QString QgsApplication::mThemeName;
+QStringList QgsApplication::mDefaultSvgPaths;
 
 /*!
   \class QgsApplication
@@ -73,6 +74,9 @@
 #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 @@
   mPkgDataPath = thePkgDataPath;
 }
 
+void QgsApplication::setDefaultSvgPaths( const QStringList& pathList )
+{
+  mDefaultSvgPaths = pathList;
+}
+
 const QString QgsApplication::prefixPath()
 {
   return mPrefixPath;
@@ -313,12 +322,9 @@
   {
     myPathList = myPaths.split( "|" );
   }
-  //additional default paths
-  myPathList
-  << mPkgDataPath + QString( "/svg/" )
-  << qgisSettingsDirPath() + QString( "svg/" );
+
+  myPathList << mDefaultSvgPaths;
   return myPathList;
-
 }
 
 /*!

Modified: trunk/qgis/src/core/qgsapplication.h
===================================================================
--- trunk/qgis/src/core/qgsapplication.h	2010-03-31 22:48:26 UTC (rev 13216)
+++ trunk/qgis/src/core/qgsapplication.h	2010-04-01 08:06:19 UTC (rev 13217)
@@ -142,6 +142,9 @@
     //! 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 @@
     static QString mPluginPath;
     static QString mPkgDataPath;
     static QString mThemeName;
+    static QStringList mDefaultSvgPaths;
 };
 
 #endif



More information about the QGIS-commit mailing list