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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Jul 24 07:22:42 EDT 2009


Author: jef
Date: 2009-07-24 07:22:42 -0400 (Fri, 24 Jul 2009)
New Revision: 11166

Modified:
   trunk/qgis/src/app/main.cpp
Log:
add command line arguments on windows

Modified: trunk/qgis/src/app/main.cpp
===================================================================
--- trunk/qgis/src/app/main.cpp	2009-07-23 22:15:46 UTC (rev 11165)
+++ trunk/qgis/src/app/main.cpp	2009-07-24 11:22:42 UTC (rev 11166)
@@ -75,7 +75,6 @@
 
 static const char * const ident_ = "$Id$";
 
-#ifndef WIN32
 /** print usage text
  */
 void usage( std::string const & appName )
@@ -102,7 +101,6 @@
 
 
 } // usage()
-#endif
 
 
 /////////////////////////////////////////////////////////////////
@@ -362,10 +360,33 @@
 #else
   for ( int i = 1; i < argc; i++ )
   {
-#ifdef QGISDEBUG
-    QgsDebugMsg( QString( "%1: %2" ).arg( i ).arg( argv[i] ) );
-#endif
-    myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );
+    QString arg = argv[i];
+
+    if ( arg == "--help" || arg == "-h" || arg == "-?" )
+    {
+      usage( argv[0] );
+      return 2;
+    }
+    else if ( i + 1 < argc && ( arg == "--snapshot" || arg == "-s" ) )
+    {
+      mySnapshotFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
+    }
+    else if ( i + 1 < argc && ( arg == "--lang" || arg == "-l" ) )
+    {
+      myTranslationCode = argv[++i];
+    }
+    else if ( i + 1 < argc && ( arg == "--project" || arg == "-p" ) )
+    {
+      myProjectFileName = QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[++i] ) ).absoluteFilePath() );
+    }
+    else if ( i + 1 < argc && ( arg == "--extent" || arg == "-e" ) )
+    {
+      myInitialExtent = argv[++i];
+    }
+    else
+    {
+      myFileList.append( QDir::convertSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ) );
+    }
   }
 #endif //WIN32
 



More information about the QGIS-commit mailing list