@@ -2004,11 +2004,7 @@ QgsGrassModuleInput::QgsGrassModuleInput( QgsGrassModule *module,
2004
2004
adjustTitle ();
2005
2005
2006
2006
// Check if this parameter is required
2007
- if (gnode.toElement ().attribute (" required" ) == " yes" ) {
2008
- mRequired = true ;
2009
- } else {
2010
- mRequired = false ;
2011
- }
2007
+ mRequired = gnode.toElement ().attribute ( " required" ) == " yes" ;
2012
2008
2013
2009
QDomNode promptNode = gnode.namedItem ( " gisprompt" );
2014
2010
QDomElement promptElem = promptNode.toElement ();
@@ -2221,11 +2217,12 @@ void QgsGrassModuleInput::updateQgisLayers()
2221
2217
2222
2218
// If not required, add an empty item to combobox and a padding item into
2223
2219
// layer containers.
2224
- if (!mRequired ){
2225
- mMaps .push_back (QString (" " ));
2226
- mVectorLayerNames .push_back (QString (" " ));
2227
- mMapLayers .push_back (NULL );
2228
- mLayerComboBox ->addItem (tr (" Select a layer" ), QVariant ());
2220
+ if ( !mRequired )
2221
+ {
2222
+ mMaps .push_back ( QString ( " " ) );
2223
+ mVectorLayerNames .push_back ( QString ( " " ) );
2224
+ mMapLayers .push_back ( NULL );
2225
+ mLayerComboBox ->addItem ( tr ( " Select a layer" ), QVariant () );
2229
2226
}
2230
2227
2231
2228
QgsMapCanvas *canvas = mModule ->qgisIface ()->mapCanvas ();
@@ -2439,18 +2436,16 @@ std::vector<QgsField> QgsGrassModuleInput::currentFields()
2439
2436
{
2440
2437
QgsDebugMsg ( " called." );
2441
2438
2442
- int limit = 0 ;
2443
- if (!mRequired )
2439
+ unsigned int limit = 0 ;
2440
+ if ( !mRequired )
2444
2441
limit = 1 ;
2445
2442
2446
2443
std::vector<QgsField> fields;
2447
2444
2448
- int c = mLayerComboBox ->currentIndex ();
2449
- if ( c < limit )
2445
+ unsigned int current = mLayerComboBox ->currentIndex ();
2446
+ if ( current < limit )
2450
2447
return fields;
2451
2448
2452
- unsigned current = c;
2453
-
2454
2449
if ( current >= limit && current < mVectorFields .size () )
2455
2450
{
2456
2451
fields = mVectorFields [current];
@@ -2463,16 +2458,14 @@ QgsMapLayer * QgsGrassModuleInput::currentLayer()
2463
2458
{
2464
2459
QgsDebugMsg ( " called." );
2465
2460
2466
- int limit = 0 ;
2467
- if (!mRequired )
2461
+ unsigned int limit = 0 ;
2462
+ if ( !mRequired )
2468
2463
limit = 1 ;
2469
2464
2470
- int c = mLayerComboBox ->currentIndex ();
2471
- if ( c < limit )
2465
+ unsigned int current = mLayerComboBox ->currentIndex ();
2466
+ if ( current < limit )
2472
2467
return 0 ;
2473
2468
2474
- unsigned int current = c;
2475
-
2476
2469
if ( current >= limit && current < mMapLayers .size () )
2477
2470
{
2478
2471
return mMapLayers [current];
@@ -2485,15 +2478,13 @@ QString QgsGrassModuleInput::currentMap()
2485
2478
{
2486
2479
QgsDebugMsg ( " called." );
2487
2480
2488
- int limit = 0 ;
2489
- if (!mRequired )
2481
+ unsigned int limit = 0 ;
2482
+ if ( !mRequired )
2490
2483
limit = 1 ;
2491
-
2492
- int c = mLayerComboBox ->currentIndex ();
2493
- if ( c < limit )
2494
- return QString ();
2495
2484
2496
- unsigned int current = c;
2485
+ unsigned int current = mLayerComboBox ->currentIndex ();
2486
+ if ( current < limit )
2487
+ return QString ();
2497
2488
2498
2489
if ( current >= limit && current < mMaps .size () )
2499
2490
{
@@ -2646,11 +2637,7 @@ QgsGrassModuleGdalInput::QgsGrassModuleGdalInput(
2646
2637
adjustTitle ();
2647
2638
2648
2639
// Check if this parameter is required
2649
- if (gnode.toElement ().attribute (" required" ) == " yes" ) {
2650
- mRequired = true ;
2651
- } else {
2652
- mRequired = false ;
2653
- }
2640
+ mRequired = gnode.toElement ().attribute ( " required" ) == " yes" ;
2654
2641
2655
2642
QDomNode promptNode = gnode.namedItem ( " gisprompt" );
2656
2643
QDomElement promptElem = promptNode.toElement ();
@@ -2721,10 +2708,11 @@ void QgsGrassModuleGdalInput::updateQgisLayers()
2721
2708
2722
2709
// If not required, add an empty item to combobox and a padding item into
2723
2710
// layer containers.
2724
- if (!mRequired ){
2725
- mUri .push_back (QString ());
2726
- mOgrLayers .push_back (QString ());
2727
- mLayerComboBox ->addItem (tr (" Select a layer" ), QVariant ());
2711
+ if ( !mRequired )
2712
+ {
2713
+ mUri .push_back ( QString () );
2714
+ mOgrLayers .push_back ( QString () );
2715
+ mLayerComboBox ->addItem ( tr ( " Select a layer" ), QVariant () );
2728
2716
}
2729
2717
2730
2718
QgsMapCanvas *canvas = mModule ->qgisIface ()->mapCanvas ();
0 commit comments