@@ -234,193 +234,193 @@ QgsDebugMsg( QString( "Starting qgis main" ) );
234
234
QString configpath;
235
235
236
236
#ifndef ANDROID
237
- #ifndef WIN32
238
- if ( !bundleclicked ( argc, argv ) )
239
- {
240
-
241
- // //////////////////////////////////////////////////////////////
242
- // USe the GNU Getopts utility to parse cli arguments
243
- // Invokes ctor `GetOpt (int argc, char **argv, char *optstring);'
244
- // /////////////////////////////////////////////////////////////
245
- int optionChar;
246
- while ( 1 )
247
- {
248
- static struct option long_options[] =
249
- {
250
- /* These options set a flag. */
251
- {" help" , no_argument, 0 , ' ?' },
252
- {" nologo" , no_argument, 0 , ' n' },
253
- {" noplugins" , no_argument, 0 , ' P' },
254
- {" nocustomization" , no_argument, 0 , ' C' },
255
- /* These options don't set a flag.
256
- * We distinguish them by their indices. */
257
- {" snapshot" , required_argument, 0 , ' s' },
258
- {" width" , required_argument, 0 , ' w' },
259
- {" height" , required_argument, 0 , ' h' },
260
- {" lang" , required_argument, 0 , ' l' },
261
- {" project" , required_argument, 0 , ' p' },
262
- {" extent" , required_argument, 0 , ' e' },
263
- {" optionspath" , required_argument, 0 , ' o' },
264
- {" configpath" , required_argument, 0 , ' c' },
265
- {" android" , required_argument, 0 , ' a' },
266
- {0 , 0 , 0 , 0 }
267
- };
268
-
269
- /* getopt_long stores the option index here. */
270
- int option_index = 0 ;
271
-
272
- optionChar = getopt_long ( argc, argv, " swhlpeoc" ,
273
- long_options, &option_index );
237
+ #ifndef WIN32
238
+ if ( !bundleclicked ( argc, argv ) )
239
+ {
240
+
241
+ // //////////////////////////////////////////////////////////////
242
+ // USe the GNU Getopts utility to parse cli arguments
243
+ // Invokes ctor `GetOpt (int argc, char **argv, char *optstring);'
244
+ // /////////////////////////////////////////////////////////////
245
+ int optionChar;
246
+ while ( 1 )
247
+ {
248
+ static struct option long_options[] =
249
+ {
250
+ /* These options set a flag. */
251
+ {" help" , no_argument, 0 , ' ?' },
252
+ {" nologo" , no_argument, 0 , ' n' },
253
+ {" noplugins" , no_argument, 0 , ' P' },
254
+ {" nocustomization" , no_argument, 0 , ' C' },
255
+ /* These options don't set a flag.
256
+ * We distinguish them by their indices. */
257
+ {" snapshot" , required_argument, 0 , ' s' },
258
+ {" width" , required_argument, 0 , ' w' },
259
+ {" height" , required_argument, 0 , ' h' },
260
+ {" lang" , required_argument, 0 , ' l' },
261
+ {" project" , required_argument, 0 , ' p' },
262
+ {" extent" , required_argument, 0 , ' e' },
263
+ {" optionspath" , required_argument, 0 , ' o' },
264
+ {" configpath" , required_argument, 0 , ' c' },
265
+ {" android" , required_argument, 0 , ' a' },
266
+ {0 , 0 , 0 , 0 }
267
+ };
268
+
269
+ /* getopt_long stores the option index here. */
270
+ int option_index = 0 ;
271
+
272
+ optionChar = getopt_long ( argc, argv, " swhlpeoc" ,
273
+ long_options, &option_index );
274
274
QgsDebugMsg ( QString ( " Qgis main Debug" ) + optionChar );
275
- /* Detect the end of the options. */
276
- if ( optionChar == -1 )
277
- break ;
278
-
279
- switch ( optionChar )
280
- {
281
- case 0 :
282
- /* If this option set a flag, do nothing else now. */
283
- if ( long_options[option_index].flag != 0 )
284
- break ;
285
- printf ( " option %s" , long_options[option_index].name );
286
- if ( optarg )
287
- printf ( " with arg %s" , optarg );
288
- printf ( " \n " );
289
- break ;
290
-
291
- case ' s' :
292
- mySnapshotFileName = QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( optarg ) ).absoluteFilePath () );
293
- break ;
294
-
295
- case ' w' :
296
- mySnapshotWidth = QString ( optarg ).toInt ();
297
- break ;
298
-
299
- case ' h' :
300
- mySnapshotHeight = QString ( optarg ).toInt ();
301
- break ;
302
-
303
- case ' n' :
304
- myHideSplash = true ;
305
- break ;
306
-
307
- case ' l' :
308
- myTranslationCode = optarg;
309
- break ;
310
-
311
- case ' p' :
312
- myProjectFileName = QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( optarg ) ).absoluteFilePath () );
313
- break ;
314
-
315
- case ' P' :
316
- myRestorePlugins = false ;
317
- break ;
318
-
319
- case ' C' :
320
- myCustomization = false ;
321
- break ;
322
-
323
- case ' e' :
324
- myInitialExtent = optarg;
325
- break ;
326
-
327
- case ' o' :
328
- QSettings::setPath ( QSettings::IniFormat, QSettings::UserScope, optarg );
329
- break ;
330
-
331
- case ' c' :
332
- configpath = optarg;
333
- break ;
334
-
335
- case ' ?' :
336
- usage ( argv[0 ] );
337
- return 2 ; // XXX need standard exit codes
338
- break ;
339
-
340
- default :
341
- QgsDebugMsg ( QString ( " %1: getopt returned character code %2" ).arg ( argv[0 ] ).arg ( optionChar ) );
342
- return 1 ; // XXX need standard exit codes
343
- }
344
- }
345
-
346
- // Add any remaining args to the file list - we will attempt to load them
347
- // as layers in the map view further down....
348
- QgsDebugMsg ( QString ( " Files specified on command line: %1" ).arg ( optind ) );
349
- if ( optind < argc )
350
- {
351
- while ( optind < argc )
352
- {
353
- #ifdef QGISDEBUG
354
- int idx = optind;
355
- QgsDebugMsg ( QString ( " %1: %2" ).arg ( idx ).arg ( argv[idx] ) );
356
- #endif
357
- myFileList.append ( QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( argv[optind++] ) ).absoluteFilePath () ) );
358
- }
359
- }
360
- }
361
- #else
362
- for ( int i = 1 ; i < argc; i++ )
363
- {
364
- QString arg = argv[i];
365
-
366
- if ( arg == " --help" || arg == " -?" )
367
- {
368
- usage ( argv[0 ] );
369
- return 2 ;
370
- }
371
- else if ( arg == " -nologo" || arg == " -n" )
372
- {
373
- myHideSplash = true ;
374
- }
375
- else if ( arg == " --noplugins" || arg == " -P" )
376
- {
377
- myRestorePlugins = false ;
378
- }
379
- else if ( arg == " --nocustomization" || arg == " -C" )
380
- {
381
- myCustomization = false ;
382
- }
383
- else if ( i + 1 < argc && ( arg == " --snapshot" || arg == " -s" ) )
384
- {
385
- mySnapshotFileName = QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( argv[++i] ) ).absoluteFilePath () );
386
- }
387
- else if ( i + 1 < argc && ( arg == " --width" || arg == " -w" ) )
388
- {
389
- mySnapshotWidth = QString ( argv[++i] ).toInt ();
390
- }
391
- else if ( i + 1 < argc && ( arg == " --height" || arg == " -h" ) )
392
- {
393
- mySnapshotHeight = QString ( argv[++i] ).toInt ();
394
- }
395
- else if ( i + 1 < argc && ( arg == " --lang" || arg == " -l" ) )
396
- {
397
- myTranslationCode = argv[++i];
398
- }
399
- else if ( i + 1 < argc && ( arg == " --project" || arg == " -p" ) )
400
- {
401
- myProjectFileName = QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( argv[++i] ) ).absoluteFilePath () );
402
- }
403
- else if ( i + 1 < argQgsDebugMsgc && ( arg == " --extent" || arg == " -e" ) )
404
- {
405
- myInitialExtent = argv[++i];
406
- }
407
- else if ( i + 1 < argc && ( arg == " --optionspath" || arg == " -o" ) )
408
- {
409
- QSettings::setPath ( QSettings::IniFormat, QSettings::UserScope, argv[++i] );
410
- }
411
- else if ( i + 1 < argc && ( arg == " --configpath" || arg == " -c" ) )
412
- {
413
- configpath = argv[++i];
414
- QSettings::setPath ( QSettings::IniFormat, QSettings::UserScope, configpath );
415
- }
416
- else
417
- {
418
- myFileList.append ( QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( argv[i] ) ).absoluteFilePath () ) );
419
- }
420
- }
421
- #endif // WIN32
275
+ /* Detect the end of the options. */
276
+ if ( optionChar == -1 )
277
+ break ;
278
+
279
+ switch ( optionChar )
280
+ {
281
+ case 0 :
282
+ /* If this option set a flag, do nothing else now. */
283
+ if ( long_options[option_index].flag != 0 )
284
+ break ;
285
+ printf ( " option %s" , long_options[option_index].name );
286
+ if ( optarg )
287
+ printf ( " with arg %s" , optarg );
288
+ printf ( " \n " );
289
+ break ;
290
+
291
+ case ' s' :
292
+ mySnapshotFileName = QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( optarg ) ).absoluteFilePath () );
293
+ break ;
294
+
295
+ case ' w' :
296
+ mySnapshotWidth = QString ( optarg ).toInt ();
297
+ break ;
298
+
299
+ case ' h' :
300
+ mySnapshotHeight = QString ( optarg ).toInt ();
301
+ break ;
302
+
303
+ case ' n' :
304
+ myHideSplash = true ;
305
+ break ;
306
+
307
+ case ' l' :
308
+ myTranslationCode = optarg;
309
+ break ;
310
+
311
+ case ' p' :
312
+ myProjectFileName = QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( optarg ) ).absoluteFilePath () );
313
+ break ;
314
+
315
+ case ' P' :
316
+ myRestorePlugins = false ;
317
+ break ;
318
+
319
+ case ' C' :
320
+ myCustomization = false ;
321
+ break ;
322
+
323
+ case ' e' :
324
+ myInitialExtent = optarg;
325
+ break ;
326
+
327
+ case ' o' :
328
+ QSettings::setPath ( QSettings::IniFormat, QSettings::UserScope, optarg );
329
+ break ;
330
+
331
+ case ' c' :
332
+ configpath = optarg;
333
+ break ;
334
+
335
+ case ' ?' :
336
+ usage ( argv[0 ] );
337
+ return 2 ; // XXX need standard exit codes
338
+ break ;
339
+
340
+ default :
341
+ QgsDebugMsg ( QString ( " %1: getopt returned character code %2" ).arg ( argv[0 ] ).arg ( optionChar ) );
342
+ return 1 ; // XXX need standard exit codes
343
+ }
344
+ }
345
+
346
+ // Add any remaining args to the file list - we will attempt to load them
347
+ // as layers in the map view further down....
348
+ QgsDebugMsg ( QString ( " Files specified on command line: %1" ).arg ( optind ) );
349
+ if ( optind < argc )
350
+ {
351
+ while ( optind < argc )
352
+ {
353
+ #ifdef QGISDEBUG
354
+ int idx = optind;
355
+ QgsDebugMsg ( QString ( " %1: %2" ).arg ( idx ).arg ( argv[idx] ) );
356
+ #endif
357
+ myFileList.append ( QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( argv[optind++] ) ).absoluteFilePath () ) );
358
+ }
359
+ }
360
+ }
361
+ #else
362
+ for ( int i = 1 ; i < argc; i++ )
363
+ {
364
+ QString arg = argv[i];
365
+
366
+ if ( arg == " --help" || arg == " -?" )
367
+ {
368
+ usage ( argv[0 ] );
369
+ return 2 ;
370
+ }
371
+ else if ( arg == " -nologo" || arg == " -n" )
372
+ {
373
+ myHideSplash = true ;
374
+ }
375
+ else if ( arg == " --noplugins" || arg == " -P" )
376
+ {
377
+ myRestorePlugins = false ;
378
+ }
379
+ else if ( arg == " --nocustomization" || arg == " -C" )
380
+ {
381
+ myCustomization = false ;
382
+ }
383
+ else if ( i + 1 < argc && ( arg == " --snapshot" || arg == " -s" ) )
384
+ {
385
+ mySnapshotFileName = QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( argv[++i] ) ).absoluteFilePath () );
386
+ }
387
+ else if ( i + 1 < argc && ( arg == " --width" || arg == " -w" ) )
388
+ {
389
+ mySnapshotWidth = QString ( argv[++i] ).toInt ();
390
+ }
391
+ else if ( i + 1 < argc && ( arg == " --height" || arg == " -h" ) )
392
+ {
393
+ mySnapshotHeight = QString ( argv[++i] ).toInt ();
394
+ }
395
+ else if ( i + 1 < argc && ( arg == " --lang" || arg == " -l" ) )
396
+ {
397
+ myTranslationCode = argv[++i];
398
+ }
399
+ else if ( i + 1 < argc && ( arg == " --project" || arg == " -p" ) )
400
+ {
401
+ myProjectFileName = QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( argv[++i] ) ).absoluteFilePath () );
402
+ }
403
+ else if ( i + 1 < argc && ( arg == " --extent" || arg == " -e" ) )
404
+ {
405
+ myInitialExtent = argv[++i];
406
+ }
407
+ else if ( i + 1 < argc && ( arg == " --optionspath" || arg == " -o" ) )
408
+ {
409
+ QSettings::setPath ( QSettings::IniFormat, QSettings::UserScope, argv[++i] );
410
+ }
411
+ else if ( i + 1 < argc && ( arg == " --configpath" || arg == " -c" ) )
412
+ {
413
+ configpath = argv[++i];
414
+ QSettings::setPath ( QSettings::IniFormat, QSettings::UserScope, configpath );
415
+ }
416
+ else
417
+ {
418
+ myFileList.append ( QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( argv[i] ) ).absoluteFilePath () ) );
419
+ }
420
+ }
421
+ #endif // WIN32
422
422
#else // ANDROID
423
- QgsDebugMsg ( QString ( " Android: All params stripped" ));// Param %1" ).arg( argv[0] ) );
423
+ QgsDebugMsg ( QString ( " Android: All params stripped" ));// Param %1" ).arg( argv[0] ) );
424
424
#endif // ANDROID
425
425
426
426
0 commit comments