Skip to content

Commit 8d6fed8

Browse files
author
jef
committed
add command line arguments on windows
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11166 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent e7bc85e commit 8d6fed8

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

src/app/main.cpp

+27-6
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ typedef SInt32 SRefCon;
7575

7676
static const char * const ident_ = "$Id$";
7777

78-
#ifndef WIN32
7978
/** print usage text
8079
*/
8180
void usage( std::string const & appName )
@@ -102,7 +101,6 @@ void usage( std::string const & appName )
102101

103102

104103
} // usage()
105-
#endif
106104

107105

108106
/////////////////////////////////////////////////////////////////
@@ -362,10 +360,33 @@ int main( int argc, char *argv[] )
362360
#else
363361
for ( int i = 1; i < argc; i++ )
364362
{
365-
#ifdef QGISDEBUG
366-
QgsDebugMsg( QString( "%1: %2" ).arg( i ).arg( argv[i] ) );
367-
#endif
368-
myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );
363+
QString arg = argv[i];
364+
365+
if ( arg == "--help" || arg == "-h" || arg == "-?" )
366+
{
367+
usage( argv[0] );
368+
return 2;
369+
}
370+
else if ( i + 1 < argc && ( arg == "--snapshot" || arg == "-s" ) )
371+
{
372+
mySnapshotFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
373+
}
374+
else if ( i + 1 < argc && ( arg == "--lang" || arg == "-l" ) )
375+
{
376+
myTranslationCode = argv[++i];
377+
}
378+
else if ( i + 1 < argc && ( arg == "--project" || arg == "-p" ) )
379+
{
380+
myProjectFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
381+
}
382+
else if ( i + 1 < argc && ( arg == "--extent" || arg == "-e" ) )
383+
{
384+
myInitialExtent = argv[++i];
385+
}
386+
else
387+
{
388+
myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );
389+
}
369390
}
370391
#endif //WIN32
371392

0 commit comments

Comments
 (0)