[QGIS Commit] r13681 - in trunk/qgis/src/plugins/grass: . modules-common

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Jun 7 13:12:42 EDT 2010


Author: jef
Date: 2010-06-07 13:12:41 -0400 (Mon, 07 Jun 2010)
New Revision: 13681

Modified:
   trunk/qgis/src/plugins/grass/modules-common/r.in.gdal.qgis.qgm
   trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
   trunk/qgis/src/plugins/grass/qgsgrassmodule.h
Log:
fix #2788

Modified: trunk/qgis/src/plugins/grass/modules-common/r.in.gdal.qgis.qgm
===================================================================
--- trunk/qgis/src/plugins/grass/modules-common/r.in.gdal.qgis.qgm	2010-06-07 16:33:48 UTC (rev 13680)
+++ trunk/qgis/src/plugins/grass/modules-common/r.in.gdal.qgis.qgm	2010-06-07 17:12:41 UTC (rev 13681)
@@ -4,6 +4,6 @@
 <qgisgrassmodule label="Import loaded raster" module="r.in.gdal">
 	<flag key="o" answer="on" hidden="yes" />
 	<flag key="e" answer="off" hidden="yes" />
-    <gdal key="input" label="GDAL raster layer" />
+	<gdal key="input" label="GDAL raster layer" />
 	<option key="output" />
 </qgisgrassmodule>

Modified: trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp	2010-06-07 16:33:48 UTC (rev 13680)
+++ trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp	2010-06-07 17:12:41 UTC (rev 13681)
@@ -2269,11 +2269,11 @@
 
   QString current = mLayerComboBox->currentText();
   mLayerComboBox->clear();
-  mMaps.resize( 0 );
-  mGeometryTypes.resize( 0 );
-  mVectorLayerNames.resize( 0 );
-  mMapLayers.resize( 0 );
-  mVectorFields.resize( 0 );
+  mMaps.clear();
+  mGeometryTypes.clear();
+  mVectorLayerNames.clear();
+  mMapLayers.clear();
+  mVectorFields.clear();
 
   // If not required, add an empty item to combobox and a padding item into
   // layer containers.
@@ -2458,12 +2458,10 @@
   QStringList list;
   QString opt;
 
-  int c = mLayerComboBox->currentIndex();
-  if ( c < 0 ) // not found
+  int current = mLayerComboBox->currentIndex();
+  if ( current < 0 ) // not found
     return list;
 
-  unsigned current = c;
-
   // TODO: this is hack for network nodes, do it somehow better
   if ( mMapId.isEmpty() )
   {
@@ -2537,15 +2535,15 @@
 {
   QgsDebugMsg( "called." );
 
-  unsigned int limit = 0;
+  int limit = 0;
   if ( !mRequired )
     limit = 1;
 
-  unsigned int current = mLayerComboBox->currentIndex();
+  int current = mLayerComboBox->currentIndex();
   if ( current < limit )
     return QString();
 
-  if ( current >= limit && current <  mMaps.size() )
+  if ( current >= limit && current < mMaps.size() )
   {
     return mMaps[current];
   }
@@ -2762,8 +2760,8 @@
 
   QString current = mLayerComboBox->currentText();
   mLayerComboBox->clear();
-  mUri.resize( 0 );
-  mOgrLayers.resize( 0 );
+  mUri.clear();
+  mOgrLayers.clear();
 
   // If not required, add an empty item to combobox and a padding item into
   // layer containers.
@@ -2857,7 +2855,6 @@
       if ( layer->name() == current ) mLayerComboBox->setItemText( mLayerComboBox->currentIndex(), current );
 
       mUri.push_back( uri );
-
       mOgrLayers.push_back( ogrLayer );
       mOgrWheres.push_back( ogrWhere );
     }
@@ -2867,6 +2864,8 @@
       mLayerComboBox->addItem( layer->name() );
       if ( layer->name() == current ) mLayerComboBox->setItemText( mLayerComboBox->currentIndex(), current );
       mUri.push_back( uri );
+      mOgrLayers.push_back( "" );
+      mOgrWheres.push_back( "" );
     }
   }
 }
@@ -2875,21 +2874,19 @@
 {
   QStringList list;
 
-  int c = mLayerComboBox->currentIndex();
-  if ( c < 0 )
+  int current = mLayerComboBox->currentIndex();
+  if ( current < 0 )
     return list;
 
-  unsigned int current = c;
-
   QString opt( mKey + "=" );
 
-  if ( current >= 0 && current <  mUri.size() )
+  if ( current >= 0 && current < mUri.size() )
   {
     opt.append( mUri[current] );
   }
   list.push_back( opt );
 
-  if ( !mOgrLayerOption.isNull() && mOgrLayers[current].length() > 0 )
+  if ( !mOgrLayerOption.isEmpty() && mOgrLayers[current].size() > 0 )
   {
     opt = mOgrLayerOption + "=";
     // GDAL 1.4.0 supports schemas (r9998)
@@ -2918,7 +2915,7 @@
     list.push_back( opt );
   }
 
-  if ( !mOgrWhereOption.isNull() && mOgrWheres[current].length() > 0 )
+  if ( !mOgrWhereOption.isEmpty() && mOgrWheres[current].length() > 0 )
   {
     list.push_back( mOgrWhereOption + "=" + mOgrWheres[current] );
   }

Modified: trunk/qgis/src/plugins/grass/qgsgrassmodule.h
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassmodule.h	2010-06-07 16:33:48 UTC (rev 13680)
+++ trunk/qgis/src/plugins/grass/qgsgrassmodule.h	2010-06-07 17:12:41 UTC (rev 13681)
@@ -640,13 +640,13 @@
     QString mMapId;
 
     //! Vector of map at mapset in the combobox
-    std::vector<QString> mMaps;
+    QStringList mMaps;
 
     //! Type of vector in the combobox
-    std::vector<QString> mGeometryTypes;
+    QStringList mGeometryTypes;
 
     //! Layer names in the combobox
-    std::vector<QString> mVectorLayerNames;
+    QStringList mVectorLayerNames;
 
     //! Pointers to vector layers in combobox
     std::vector<QgsMapLayer*> mMapLayers;
@@ -709,13 +709,13 @@
     QComboBox *mLayerComboBox;
 
     //! Vector of URI in the combobox
-    std::vector<QString> mUri;
+    QStringList mUri;
 
     //! Ogr layer options
-    std::vector<QString> mOgrLayers;
+    QStringList mOgrLayers;
 
     //! Ogr where clauses
-    std::vector<QString> mOgrWheres;
+    QStringList mOgrWheres;
 
     //! Required field
     bool mRequired;



More information about the QGIS-commit mailing list