@@ -81,6 +81,7 @@ void usage( std::string const & appName )
81
81
<< " \t [--extent xmin,ymin,xmax,ymax]\t set initial map extent\n "
82
82
<< " \t [--optionspath path]\t use the given QSettings path\n "
83
83
<< " \t [--configpath path]\t use the given path for all user configuration\n "
84
+ << " \t [--prefix path]\t path to a different build of qgis, may be used to test old versions\n "
84
85
<< " \t [--quality]\t renderer hint(s), comma separated, possible values: Antialiasing,TextAntialiasing,SmoothPixmapTransform,NonCosmeticDefaultPen\n "
85
86
<< " \t [--help]\t\t this text\n\n "
86
87
<< " FILES:\n "
@@ -132,6 +133,7 @@ int main( int argc, char *argv[] )
132
133
int myIterations = 1 ;
133
134
QString mySnapshotFileName = " " ;
134
135
QString myLogFileName = " " ;
136
+ QString myPrefixPath = " " ;
135
137
int mySnapshotWidth = 800 ;
136
138
int mySnapshotHeight = 600 ;
137
139
QString myQuality = " " ;
@@ -171,14 +173,15 @@ int main( int argc, char *argv[] )
171
173
{" extent" , required_argument, 0 , ' e' },
172
174
{" optionspath" , required_argument, 0 , ' o' },
173
175
{" configpath" , required_argument, 0 , ' c' },
176
+ {" prefix" , required_argument, 0 , ' r' },
174
177
{" quality" , required_argument, 0 , ' q' },
175
178
{0 , 0 , 0 , 0 }
176
179
};
177
180
178
181
/* getopt_long stores the option index here. */
179
182
int option_index = 0 ;
180
183
181
- optionChar = getopt_long ( argc, argv, " rswhlpeoc " ,
184
+ optionChar = getopt_long ( argc, argv, " islwhpeocrq " ,
182
185
long_options, &option_index );
183
186
184
187
/* Detect the end of the options. */
@@ -233,6 +236,10 @@ int main( int argc, char *argv[] )
233
236
configpath = optarg;
234
237
break ;
235
238
239
+ case ' r' :
240
+ myPrefixPath = optarg;
241
+ break ;
242
+
236
243
case ' q' :
237
244
myQuality = optarg;
238
245
break ;
@@ -309,7 +316,11 @@ int main( int argc, char *argv[] )
309
316
configpath = argv[++i];
310
317
QSettings::setPath ( QSettings::IniFormat, QSettings::UserScope, configpath );
311
318
}
312
- else if ( i + 1 < argc && ( arg == " --configpath" || arg == " -c" ) )
319
+ else if ( i + 1 < argc && ( arg == " --prefix" ) )
320
+ {
321
+ myPrefixPath = argv[++i];
322
+ }
323
+ else if ( i + 1 < argc && ( arg == " --quality" || arg == " -q" ) )
313
324
{
314
325
myQuality = argv[++i];
315
326
}
@@ -338,7 +349,18 @@ int main( int argc, char *argv[] )
338
349
// but QgsApplication inherits from QApplication (GUI)
339
350
// it is working, but maybe we should make QgsCoreApplication, which
340
351
// could also be used by mapserver
341
- QgsApplication myApp ( argc, argv, false , configpath );
352
+ // Don't use QgsApplication( int, char **, bool GUIenabled, QString) which is new
353
+ // so that this program may be run with old libraries
354
+ // QgsApplication myApp( argc, argv, false, configpath );
355
+ QCoreApplication myApp ( argc, argv );
356
+
357
+ if ( myPrefixPath.isEmpty () )
358
+ {
359
+ QDir dir ( QCoreApplication::applicationDirPath () );
360
+ dir.cdUp ();
361
+ myPrefixPath = dir.absolutePath ();
362
+ }
363
+ QgsApplication::setPrefixPath ( myPrefixPath, true );
342
364
343
365
// Set up the QSettings environment must be done after qapp is created
344
366
QgsApplication::setOrganizationName ( " QuantumGIS" );
0 commit comments