@@ -105,6 +105,7 @@ void usage( std::string const & appName )
105
105
<< " \t [--nologo]\t hide splash screen\n "
106
106
<< " \t [--noplugins]\t don't restore plugins on startup\n "
107
107
<< " \t [--nocustomization]\t don't apply GUI customization\n "
108
+ << " \t [--customizationfile]\t use the given ini file as GUI customization\n "
108
109
<< " \t [--optionspath path]\t use the given QSettings path\n "
109
110
<< " \t [--configpath path]\t use the given path for all user configuration\n "
110
111
<< " \t [--code path]\t Run the given python file on load. \n "
@@ -270,6 +271,8 @@ int main( int argc, char *argv[] )
270
271
271
272
QString pythonfile;
272
273
274
+ QString customizationfile;
275
+
273
276
#if defined(ANDROID)
274
277
QgsDebugMsg ( QString ( " Android: All params stripped" ) );// Param %1" ).arg( argv[0] ) );
275
278
// put all QGIS settings in the same place
@@ -333,6 +336,10 @@ int main( int argc, char *argv[] )
333
336
{
334
337
pythonfile = argv[++i];
335
338
}
339
+ else if ( i + 1 < argc && ( arg == " --customizationfile" || arg == " -z" ) )
340
+ {
341
+ customizationfile = argv[++i];
342
+ }
336
343
else
337
344
{
338
345
myFileList.append ( QDir::convertSeparators ( QFileInfo ( QFile::decodeName ( argv[i] ) ).absoluteFilePath () ) );
@@ -366,6 +373,7 @@ int main( int argc, char *argv[] )
366
373
{" extent" , required_argument, 0 , ' e' },
367
374
{" optionspath" , required_argument, 0 , ' o' },
368
375
{" configpath" , required_argument, 0 , ' c' },
376
+ {" customizationfile" , required_argument, 0 , ' z' },
369
377
{" code" , required_argument, 0 , ' f' },
370
378
{" android" , required_argument, 0 , ' a' },
371
379
{0 , 0 , 0 , 0 }
@@ -441,6 +449,10 @@ int main( int argc, char *argv[] )
441
449
pythonfile = optarg ;
442
450
break ;
443
451
452
+ case ' z' :
453
+ customizationfile = optarg ;
454
+ break ;
455
+
444
456
case ' ?' :
445
457
usage ( argv[0 ] );
446
458
return 2 ; // XXX need standard exit codes
@@ -531,6 +543,12 @@ int main( int argc, char *argv[] )
531
543
customizationsettings = new QSettings ( " QuantumGIS" , " QGISCUSTOMIZATION" );
532
544
}
533
545
546
+ // Using the customizationfile option always overrides the option and config path options.
547
+ if ( !customizationfile.isEmpty () )
548
+ {
549
+ customizationsettings = new QSettings ( customizationfile, QSettings::IniFormat);
550
+ }
551
+
534
552
// Load and set possible default customization, must be done afterQgsApplication init and QSettings ( QCoreApplication ) init
535
553
QgsCustomization::instance ()->setSettings ( customizationsettings );
536
554
QgsCustomization::instance ()->loadDefault ();
0 commit comments