@@ -384,31 +384,33 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions(
384
384
QHBoxLayout *mypAdvancedPushButtonFrameLayout = new QHBoxLayout ( mypAdvancedPushButtonFrame );
385
385
connect ( &mAdvancedPushButton , SIGNAL ( clicked () ), this , SLOT ( switchAdvanced () ) );
386
386
mypAdvancedPushButtonFrameLayout->addWidget ( &mAdvancedPushButton );
387
- mypAdvancedPushButtonFrameLayout->addStretch (1 );
387
+ mypAdvancedPushButtonFrameLayout->addStretch ( 1 );
388
388
389
389
mypInnerFrameLayout->addWidget ( mypSimpleFrame );
390
390
mypInnerFrameLayout->addWidget ( mypAdvancedPushButtonFrame );
391
391
mypInnerFrameLayout->addWidget ( &mAdvancedFrame );
392
- mypInnerFrameLayout->addStretch (1 );
392
+ mypInnerFrameLayout->addStretch ( 1 );
393
393
394
394
// Hide advanced and set butto next
395
395
switchAdvanced ();
396
-
396
+
397
397
QVBoxLayout *mypSimpleLayout = new QVBoxLayout ( mypSimpleFrame );
398
398
QVBoxLayout *mypAdvancedLayout = new QVBoxLayout ( &mAdvancedFrame );
399
- QVBoxLayout *layout;
399
+ QVBoxLayout *layout = 0 ;
400
400
while ( !n.isNull () )
401
401
{
402
402
QDomElement e = n.toElement ();
403
403
if ( !e.isNull () )
404
404
{
405
405
QString optionType = e.tagName ();
406
406
QgsDebugMsg ( " optionType = " + optionType );
407
-
408
- if ( e.attribute ( " advanced" , " no" ) == " yes" )
407
+
408
+ if ( e.attribute ( " advanced" , " no" ) == " yes" )
409
409
{
410
410
layout = mypAdvancedLayout;
411
- } else {
411
+ }
412
+ else
413
+ {
412
414
layout = mypSimpleLayout;
413
415
}
414
416
@@ -505,8 +507,8 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions(
505
507
}
506
508
n = n.nextSibling ();
507
509
}
508
-
509
- if ( mypAdvancedLayout->count () == 0 )
510
+
511
+ if ( mypAdvancedLayout->count () == 0 )
510
512
{
511
513
mypAdvancedPushButtonFrame->hide ();
512
514
}
@@ -531,18 +533,22 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions(
531
533
n = n.nextSibling ();
532
534
}
533
535
534
- layout->addStretch ();
536
+ if ( layout )
537
+ layout->addStretch ();
535
538
}
536
539
537
540
void QgsGrassModuleStandardOptions::switchAdvanced ()
538
541
{
539
- if ( mAdvancedFrame .isHidden () ) {
540
- mAdvancedFrame .show ();
541
- mAdvancedPushButton .setText ( tr (" << Hide advanced options" ) );
542
- } else {
543
- mAdvancedFrame .hide ();
544
- mAdvancedPushButton .setText ( tr (" Show advanced options >>" ) );
545
- }
542
+ if ( mAdvancedFrame .isHidden () )
543
+ {
544
+ mAdvancedFrame .show ();
545
+ mAdvancedPushButton .setText ( tr ( " << Hide advanced options" ) );
546
+ }
547
+ else
548
+ {
549
+ mAdvancedFrame .hide ();
550
+ mAdvancedPushButton .setText ( tr ( " Show advanced options >>" ) );
551
+ }
546
552
}
547
553
548
554
QStringList QgsGrassModuleStandardOptions::arguments ()
@@ -1412,7 +1418,7 @@ void QgsGrassModule::readStdout()
1412
1418
{
1413
1419
// line = QString::fromLocal8Bit( mProcess.readLineStdout().ascii() );
1414
1420
QByteArray ba = mProcess .readLine ();
1415
- line = QString::fromUtf8 ( ba ).replace (' \n ' , " " );
1421
+ line = QString::fromUtf8 ( ba ).replace ( ' \n ' , " " );
1416
1422
// QgsDebugMsg(QString("line: '%1'").arg(line));
1417
1423
1418
1424
// GRASS_INFO_PERCENT is catched here only because of bugs in GRASS,
@@ -1447,7 +1453,7 @@ void QgsGrassModule::readStderr()
1447
1453
{
1448
1454
// line = QString::fromLocal8Bit( mProcess.readLineStderr().ascii() );
1449
1455
QByteArray ba = mProcess .readLine ();
1450
- line = QString::fromUtf8 ( ba ).replace (' \n ' , " " );
1456
+ line = QString::fromUtf8 ( ba ).replace ( ' \n ' , " " );
1451
1457
// QgsDebugMsg(QString("line: '%1'").arg(line));
1452
1458
1453
1459
if ( rxpercent.indexIn ( line ) != -1 )
@@ -2654,7 +2660,7 @@ QgsGrassModuleGdalInput::QgsGrassModuleGdalInput(
2654
2660
{
2655
2661
if ( mTitle .isEmpty () )
2656
2662
{
2657
- mTitle = tr (" OGR/PostGIS/GDAL Input" );
2663
+ mTitle = tr ( " OGR/PostGIS/GDAL Input" );
2658
2664
}
2659
2665
adjustTitle ();
2660
2666
@@ -2929,9 +2935,12 @@ QgsGrassModuleField::QgsGrassModuleField(
2929
2935
mType = qdesc.attribute ( " type" );
2930
2936
2931
2937
mLayerKey = qdesc.attribute ( " layer" );
2932
- if ( mLayerKey .isNull () || mLayerKey .length () == 0 ) {
2938
+ if ( mLayerKey .isNull () || mLayerKey .length () == 0 )
2939
+ {
2933
2940
QMessageBox::warning ( 0 , tr ( " Warning" ), tr ( " 'layer' attribute in field tag with key= %1 is missing." ).arg ( mKey ) );
2934
- } else {
2941
+ }
2942
+ else
2943
+ {
2935
2944
QgsGrassModuleItem *item = mModuleStandardOptions ->itemByKey ( mLayerKey );
2936
2945
// TODO check type
2937
2946
if ( item )
0 commit comments