@@ -101,6 +101,13 @@ QgsGrassNewMapset::QgsGrassNewMapset ( QgisApp *qgisApp, QgisIface *iface,
101
101
setHelpEnabled ( page (MAPSET), false );
102
102
setHelpEnabled ( page (FINISH), false );
103
103
104
+ setTitle ( page (DATABASE), " GRASS database" );
105
+ setTitle ( page (LOCATION), " GRASS location" );
106
+ setTitle ( page (PROJECTION), " Projection" );
107
+ setTitle ( page (REGION), " Default GRASS Region" );
108
+ setTitle ( page (MAPSET), " Mapset" );
109
+ setTitle ( page (FINISH), " Create New Mapset" );
110
+
104
111
setError ( mDatabaseErrorLabel , " " );
105
112
setError ( mLocationErrorLabel , " " );
106
113
setError ( mProjErrorLabel , " " );
@@ -134,18 +141,18 @@ QgsGrassNewMapset::QgsGrassNewMapset ( QgisApp *qgisApp, QgisIface *iface,
134
141
dbi->setOpen (true );
135
142
136
143
// First inserted is last in the view
137
- Q3ListViewItem *l = new Q3ListViewItem ( dbi, " New Zealand" , " Location 1 " );
144
+ Q3ListViewItem *l = new Q3ListViewItem ( dbi, " New Zealand" , " Location 2 " );
138
145
l->setOpen (true );
139
- Q3ListViewItem *m = new Q3ListViewItem ( l, " Klima " , " User's mapset" );
146
+ Q3ListViewItem *m = new Q3ListViewItem ( l, " Cimrman " , " User's mapset" );
140
147
m->setOpen (true );
141
148
m = new Q3ListViewItem ( l, " PERMANENT" , " System mapset" );
142
149
m->setOpen (true );
143
150
144
- l = new Q3ListViewItem ( dbi, " Mexico" , " Location 2 " );
151
+ l = new Q3ListViewItem ( dbi, " Mexico" , " Location 1 " );
145
152
m->setOpen (true );
146
- m = new Q3ListViewItem ( l, " Jirovec " , " User's mapset" );
153
+ m = new Q3ListViewItem ( l, " Juan " , " User's mapset" );
147
154
l->setOpen (true );
148
- m = new Q3ListViewItem ( l, " Cimrman " , " User's mapset" );
155
+ m = new Q3ListViewItem ( l, " Alejandra " , " User's mapset" );
149
156
m->setOpen (true );
150
157
m = new Q3ListViewItem ( l, " PERMANENT" , " System mapset" );
151
158
m->setOpen (true );
@@ -197,48 +204,52 @@ void QgsGrassNewMapset::databaseChanged()
197
204
QSettings settings (" QuantumGIS" , " qgis" );
198
205
settings.writeEntry (" /GRASS/lastGisdbase" , mDatabaseLineEdit ->text () );
199
206
207
+ setNextEnabled ( page (DATABASE), false );
200
208
setError ( mDatabaseErrorLabel , " " );
209
+
210
+ QString database = mDatabaseLineEdit ->text ().trimmed ();
211
+
212
+ if ( database.length () == 0 )
213
+ {
214
+ setError ( mDatabaseErrorLabel , " Enter path to GRASS database" );
215
+ return ;
216
+ }
217
+
201
218
QFileInfo databaseInfo ( mDatabaseLineEdit ->text () );
202
219
203
- if ( databaseInfo.exists () )
204
- {
205
- // Check if at least one writable location exists or
206
- // database is writable
207
- bool locationExists = false ;
208
- QDir d ( mDatabaseLineEdit ->text () );
209
- for ( int i = 0 ; i < d.count (); i++ )
210
- {
211
- if ( d[i] == " ." || d[i] == " .." ) continue ;
220
+ if ( !databaseInfo.exists () )
221
+ {
222
+ setError ( mDatabaseErrorLabel , " The directory doesn't exist!" );
223
+ return ;
224
+ }
212
225
213
- QString windName = mDatabaseLineEdit ->text () + " /" + d[i] + " /PERMANENT/DEFAULT_WIND" ;
214
- QString locationName = mDatabaseLineEdit ->text () + " /" + d[i];
215
- QFileInfo locationInfo ( locationName );
226
+ // Check if at least one writable location exists or
227
+ // database is writable
228
+ bool locationExists = false ;
229
+ QDir d ( mDatabaseLineEdit ->text () );
230
+ for ( int i = 0 ; i < d.count (); i++ )
231
+ {
232
+ if ( d[i] == " ." || d[i] == " .." ) continue ;
216
233
217
- if ( QFile::exists ( windName ) && locationInfo.isWritable () )
218
- {
219
- locationExists = true ;
220
- break ;
221
- }
222
- }
234
+ QString windName = mDatabaseLineEdit ->text () + " /" + d[i] + " /PERMANENT/DEFAULT_WIND" ;
235
+ QString locationName = mDatabaseLineEdit ->text () + " /" + d[i];
236
+ QFileInfo locationInfo ( locationName );
223
237
224
- if ( locationExists || databaseInfo.isWritable () )
225
- {
226
- setNextEnabled ( page (DATABASE), true );
227
- }
228
- else
238
+ if ( QFile::exists ( windName ) && locationInfo.isWritable () )
229
239
{
230
- setNextEnabled ( page (DATABASE), false );
231
- setError ( mDatabaseErrorLabel , " No writable "
232
- " locations, the database not writable!" );
240
+ locationExists = true ;
241
+ break ;
233
242
}
234
243
}
244
+
245
+ if ( locationExists || databaseInfo.isWritable () )
246
+ {
247
+ setNextEnabled ( page (DATABASE), true );
248
+ }
235
249
else
236
250
{
237
- setNextEnabled ( page (DATABASE), false );
238
- if ( mDatabaseLineEdit ->text ().stripWhiteSpace ().length () > 0 )
239
- {
240
- setError ( mDatabaseErrorLabel , " The directory doesn't exist!" );
241
- }
251
+ setError ( mDatabaseErrorLabel , " No writable "
252
+ " locations, the database not writable!" );
242
253
}
243
254
}
244
255
@@ -331,14 +342,17 @@ void QgsGrassNewMapset::checkLocation()
331
342
{
332
343
// TODO?: Check spaces in the name
333
344
334
- QString location = mLocationLineEdit ->text ().stripWhiteSpace ();
345
+ QString location = mLocationLineEdit ->text ().trimmed ();
335
346
336
- if ( location.length () > 0 )
347
+ if ( location.length () == 0 )
337
348
{
349
+ setNextEnabled ( page (LOCATION), false );
350
+ setError ( mLocationErrorLabel , " Enter location name!" );
351
+ }
352
+ else
353
+ {
338
354
QDir d ( mDatabaseLineEdit ->text () );
339
355
340
- setNextEnabled ( page (LOCATION), true );
341
-
342
356
for ( int i = 0 ; i < d.count (); i++ )
343
357
{
344
358
if ( d[i] == " ." || d[i] == " .." ) continue ;
@@ -350,11 +364,7 @@ void QgsGrassNewMapset::checkLocation()
350
364
break ;
351
365
}
352
366
}
353
- }
354
- else
355
- {
356
- setNextEnabled ( page (LOCATION), false );
357
- }
367
+ }
358
368
}
359
369
}
360
370
@@ -381,6 +391,7 @@ void QgsGrassNewMapset::setProjectionPage()
381
391
#ifdef QGISDEBUG
382
392
std::cerr << " QgsGrassNewMapset::setProjectionPage()" << std::endl;
383
393
#endif
394
+ setGrassProjection ();
384
395
}
385
396
386
397
void QgsGrassNewMapset::sridSelected (QString theSRID)
@@ -618,13 +629,15 @@ void QgsGrassNewMapset::setRegionPage()
618
629
mCurrentRegionButton ->hide ();
619
630
mRegionsComboBox ->hide ();
620
631
mRegionButton ->hide ();
632
+ mSetRegionFrame ->hide ();
621
633
}
622
634
else
623
635
{
624
636
mRegionMap ->show ();
625
637
mCurrentRegionButton ->show ();
626
638
mRegionsComboBox ->show ();
627
639
mRegionButton ->show ();
640
+ mSetRegionFrame ->show ();
628
641
629
642
QgsRect ext = mQgisApp ->getMapCanvas ()->extent ();
630
643
@@ -635,7 +648,11 @@ void QgsGrassNewMapset::setRegionPage()
635
648
}
636
649
637
650
checkRegion ();
638
- drawRegion ();
651
+
652
+ if ( !mNoProjRadioButton ->isChecked () )
653
+ {
654
+ drawRegion ();
655
+ }
639
656
}
640
657
641
658
void QgsGrassNewMapset::setGrassRegionDefaults ()
@@ -1254,43 +1271,42 @@ void QgsGrassNewMapset::mapsetChanged()
1254
1271
setNextEnabled ( page (MAPSET), false );
1255
1272
setError ( mMapsetErrorLabel , " " );
1256
1273
1257
- QString mapset = mMapsetLineEdit ->text ().stripWhiteSpace ();
1274
+ QString mapset = mMapsetLineEdit ->text ().trimmed ();
1258
1275
1259
1276
// TODO?: Check spaces in the name
1260
- if ( mapset.length () > 0 )
1277
+ if ( mapset.length () == 0 )
1261
1278
{
1262
- // Check if exists
1263
- if ( mSelectLocationRadioButton ->isChecked () )
1264
- {
1265
- bool exists = false ;
1266
- QString locationPath = mDatabaseLineEdit ->text () + " /" + mLocationComboBox ->currentText ();
1267
- QDir d ( locationPath );
1279
+ setError ( mMapsetErrorLabel , " Enter mapset name." );
1280
+ return ;
1281
+ }
1268
1282
1269
- for ( int i = 0 ; i < d.count (); i++ )
1270
- {
1271
- if ( d[i] == " ." || d[i] == " .." ) continue ;
1283
+ // Check if exists
1284
+ if ( mSelectLocationRadioButton ->isChecked () )
1285
+ {
1286
+ bool exists = false ;
1287
+ QString locationPath = mDatabaseLineEdit ->text () + " /" + mLocationComboBox ->currentText ();
1288
+ QDir d ( locationPath );
1272
1289
1273
- if ( d[i] == mapset )
1274
- {
1275
- setError ( mMapsetErrorLabel , " The mapset already exists" );
1276
- exists = true ;
1277
- break ;
1278
- }
1279
- }
1290
+ for ( int i = 0 ; i < d.count (); i++ )
1291
+ {
1292
+ if ( d[i] == " ." || d[i] == " .." ) continue ;
1280
1293
1281
- if ( !exists )
1294
+ if ( d[i] == mapset )
1282
1295
{
1283
- setNextEnabled ( page (MAPSET), true );
1296
+ setError ( mMapsetErrorLabel , " The mapset already exists" );
1297
+ exists = true ;
1298
+ break ;
1284
1299
}
1285
1300
}
1286
- else
1301
+
1302
+ if ( !exists )
1287
1303
{
1288
- setNextEnabled ( page (MAPSET), true );
1304
+ setNextEnabled ( page (MAPSET), true );
1289
1305
}
1290
1306
}
1291
1307
else
1292
1308
{
1293
- setNextEnabled ( page (MAPSET), false );
1309
+ setNextEnabled ( page (MAPSET), true );
1294
1310
}
1295
1311
}
1296
1312
0 commit comments