[QGIS Commit] r13045 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Mar 11 05:26:55 EST 2010


Author: mhugent
Date: 2010-03-11 05:26:50 -0500 (Thu, 11 Mar 2010)
New Revision: 13045

Modified:
   trunk/qgis/src/app/main.cpp
Log:
Add option to set QSettings path

Modified: trunk/qgis/src/app/main.cpp
===================================================================
--- trunk/qgis/src/app/main.cpp	2010-03-10 23:58:48 UTC (rev 13044)
+++ trunk/qgis/src/app/main.cpp	2010-03-11 10:26:50 UTC (rev 13045)
@@ -92,6 +92,7 @@
             << "\t[--project projectfile]\tload the given QGIS project\n"
             << "\t[--extent xmin,ymin,xmax,ymax]\tset initial map extent\n"
             << "\t[--nologo]\thide splash screen\n"
+            << "\t[--optionspath path]\tuse the given QSettings path\n"
             << "\t[--help]\t\tthis text\n\n"
             << "  FILES:\n"
             << "    Files specified on the command line can include rasters,\n"
@@ -303,13 +304,14 @@
         {"lang",     required_argument, 0, 'l'},
         {"project",  required_argument, 0, 'p'},
         {"extent",   required_argument, 0, 'e'},
+        {"optionspath", required_argument, 0, 'o'},
         {0, 0, 0, 0}
       };
 
       /* getopt_long stores the option index here. */
       int option_index = 0;
 
-      optionChar = getopt_long( argc, argv, "swhlpe",
+      optionChar = getopt_long( argc, argv, "swhlpeo",
                                 long_options, &option_index );
 
       /* Detect the end of the options. */
@@ -356,6 +358,10 @@
           myInitialExtent = optarg;
           break;
 
+        case 'o':
+          QSettings::setPath( QSettings::NativeFormat, QSettings::UserScope, optarg );
+          break;
+
         case '?':
           usage( argv[0] );
           return 2;   // XXX need standard exit codes
@@ -420,6 +426,10 @@
     {
       myInitialExtent = argv[++i];
     }
+    else if ( i + 1 < argc && ( arg == "--optionspath" || arg == "-o" ) )
+    {
+      QSettings::setPath( QSettings::NativeFormat, QSettings::UserScope, argv[++i] );
+    }
     else
     {
       myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );



More information about the QGIS-commit mailing list