Skip to content

Commit 0770f17

Browse files
author
jef
committedJun 7, 2010
fix #2788
git-svn-id: http://svn.osgeo.org/qgis/trunk@13681 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8a54d4e commit 0770f17

File tree

3 files changed

+26
-29
lines changed

3 files changed

+26
-29
lines changed
 

‎src/plugins/grass/modules-common/r.in.gdal.qgis.qgm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
<qgisgrassmodule label="Import loaded raster" module="r.in.gdal">
55
<flag key="o" answer="on" hidden="yes" />
66
<flag key="e" answer="off" hidden="yes" />
7-
<gdal key="input" label="GDAL raster layer" />
7+
<gdal key="input" label="GDAL raster layer" />
88
<option key="output" />
99
</qgisgrassmodule>

‎src/plugins/grass/qgsgrassmodule.cpp

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,11 +2269,11 @@ void QgsGrassModuleInput::updateQgisLayers()
22692269

22702270
QString current = mLayerComboBox->currentText();
22712271
mLayerComboBox->clear();
2272-
mMaps.resize( 0 );
2273-
mGeometryTypes.resize( 0 );
2274-
mVectorLayerNames.resize( 0 );
2275-
mMapLayers.resize( 0 );
2276-
mVectorFields.resize( 0 );
2272+
mMaps.clear();
2273+
mGeometryTypes.clear();
2274+
mVectorLayerNames.clear();
2275+
mMapLayers.clear();
2276+
mVectorFields.clear();
22772277

22782278
// If not required, add an empty item to combobox and a padding item into
22792279
// layer containers.
@@ -2458,12 +2458,10 @@ QStringList QgsGrassModuleInput::options()
24582458
QStringList list;
24592459
QString opt;
24602460

2461-
int c = mLayerComboBox->currentIndex();
2462-
if ( c < 0 ) // not found
2461+
int current = mLayerComboBox->currentIndex();
2462+
if ( current < 0 ) // not found
24632463
return list;
24642464

2465-
unsigned current = c;
2466-
24672465
// TODO: this is hack for network nodes, do it somehow better
24682466
if ( mMapId.isEmpty() )
24692467
{
@@ -2537,15 +2535,15 @@ QString QgsGrassModuleInput::currentMap()
25372535
{
25382536
QgsDebugMsg( "called." );
25392537

2540-
unsigned int limit = 0;
2538+
int limit = 0;
25412539
if ( !mRequired )
25422540
limit = 1;
25432541

2544-
unsigned int current = mLayerComboBox->currentIndex();
2542+
int current = mLayerComboBox->currentIndex();
25452543
if ( current < limit )
25462544
return QString();
25472545

2548-
if ( current >= limit && current < mMaps.size() )
2546+
if ( current >= limit && current < mMaps.size() )
25492547
{
25502548
return mMaps[current];
25512549
}
@@ -2762,8 +2760,8 @@ void QgsGrassModuleGdalInput::updateQgisLayers()
27622760

27632761
QString current = mLayerComboBox->currentText();
27642762
mLayerComboBox->clear();
2765-
mUri.resize( 0 );
2766-
mOgrLayers.resize( 0 );
2763+
mUri.clear();
2764+
mOgrLayers.clear();
27672765

27682766
// If not required, add an empty item to combobox and a padding item into
27692767
// layer containers.
@@ -2857,7 +2855,6 @@ void QgsGrassModuleGdalInput::updateQgisLayers()
28572855
if ( layer->name() == current ) mLayerComboBox->setItemText( mLayerComboBox->currentIndex(), current );
28582856

28592857
mUri.push_back( uri );
2860-
28612858
mOgrLayers.push_back( ogrLayer );
28622859
mOgrWheres.push_back( ogrWhere );
28632860
}
@@ -2867,6 +2864,8 @@ void QgsGrassModuleGdalInput::updateQgisLayers()
28672864
mLayerComboBox->addItem( layer->name() );
28682865
if ( layer->name() == current ) mLayerComboBox->setItemText( mLayerComboBox->currentIndex(), current );
28692866
mUri.push_back( uri );
2867+
mOgrLayers.push_back( "" );
2868+
mOgrWheres.push_back( "" );
28702869
}
28712870
}
28722871
}
@@ -2875,21 +2874,19 @@ QStringList QgsGrassModuleGdalInput::options()
28752874
{
28762875
QStringList list;
28772876

2878-
int c = mLayerComboBox->currentIndex();
2879-
if ( c < 0 )
2877+
int current = mLayerComboBox->currentIndex();
2878+
if ( current < 0 )
28802879
return list;
28812880

2882-
unsigned int current = c;
2883-
28842881
QString opt( mKey + "=" );
28852882

2886-
if ( current >= 0 && current < mUri.size() )
2883+
if ( current >= 0 && current < mUri.size() )
28872884
{
28882885
opt.append( mUri[current] );
28892886
}
28902887
list.push_back( opt );
28912888

2892-
if ( !mOgrLayerOption.isNull() && mOgrLayers[current].length() > 0 )
2889+
if ( !mOgrLayerOption.isEmpty() && mOgrLayers[current].size() > 0 )
28932890
{
28942891
opt = mOgrLayerOption + "=";
28952892
// GDAL 1.4.0 supports schemas (r9998)
@@ -2918,7 +2915,7 @@ QStringList QgsGrassModuleGdalInput::options()
29182915
list.push_back( opt );
29192916
}
29202917

2921-
if ( !mOgrWhereOption.isNull() && mOgrWheres[current].length() > 0 )
2918+
if ( !mOgrWhereOption.isEmpty() && mOgrWheres[current].length() > 0 )
29222919
{
29232920
list.push_back( mOgrWhereOption + "=" + mOgrWheres[current] );
29242921
}

‎src/plugins/grass/qgsgrassmodule.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -640,13 +640,13 @@ class QgsGrassModuleInput: public QgsGrassModuleGroupBoxItem
640640
QString mMapId;
641641

642642
//! Vector of map@mapset in the combobox
643-
std::vector<QString> mMaps;
643+
QStringList mMaps;
644644

645645
//! Type of vector in the combobox
646-
std::vector<QString> mGeometryTypes;
646+
QStringList mGeometryTypes;
647647

648648
//! Layer names in the combobox
649-
std::vector<QString> mVectorLayerNames;
649+
QStringList mVectorLayerNames;
650650

651651
//! Pointers to vector layers in combobox
652652
std::vector<QgsMapLayer*> mMapLayers;
@@ -709,13 +709,13 @@ class QgsGrassModuleGdalInput: public QgsGrassModuleGroupBoxItem
709709
QComboBox *mLayerComboBox;
710710

711711
//! Vector of URI in the combobox
712-
std::vector<QString> mUri;
712+
QStringList mUri;
713713

714714
//! Ogr layer options
715-
std::vector<QString> mOgrLayers;
715+
QStringList mOgrLayers;
716716

717717
//! Ogr where clauses
718-
std::vector<QString> mOgrWheres;
718+
QStringList mOgrWheres;
719719

720720
//! Required field
721721
bool mRequired;

0 commit comments

Comments
 (0)
Please sign in to comment.