Skip to content

Commit

Permalink
show command line help as message box on windows
Browse files Browse the repository at this point in the history
(cherry picked from commit bd23bf1)
  • Loading branch information
jef-n committed Sep 17, 2016
1 parent 1556555 commit a465b0e
Showing 1 changed file with 50 additions and 39 deletions.
89 changes: 50 additions & 39 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,46 +105,57 @@ typedef SInt32 SRefCon;

/** Print usage text
*/
void usage( std::string const & appName )
void usage( QString appName )
{
std::cerr << "QGIS - " << VERSION << " '" << RELEASE_NAME << "' ("
<< QGSVERSION << ")\n"
<< "QGIS is a user friendly Open Source Geographic Information System.\n"
<< "Usage: " << appName << " [OPTION] [FILE]\n"
<< " OPTION:\n"
<< "\t[--snapshot filename]\temit snapshot of loaded datasets to given file\n"
<< "\t[--width width]\twidth of snapshot to emit\n"
<< "\t[--height height]\theight of snapshot to emit\n"
<< "\t[--lang language]\tuse language for interface text\n"
<< "\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[--noversioncheck]\tdon't check for new version of QGIS at startup"
<< "\t[--noplugins]\tdon't restore plugins on startup\n"
<< "\t[--nocustomization]\tdon't apply GUI customization\n"
<< "\t[--customizationfile]\tuse the given ini file as GUI customization\n"
<< "\t[--optionspath path]\tuse the given QSettings path\n"
<< "\t[--configpath path]\tuse the given path for all user configuration\n"
<< "\t[--authdbdirectory path] use the given directory for authentication database\n"
<< "\t[--code path]\trun the given python file on load\n"
<< "\t[--defaultui]\tstart by resetting user ui settings to default\n"
<< "\t[--dxf-export filename.dxf]\temit dxf output of loaded datasets to given file\n"
<< "\t[--dxf-extent xmin,ymin,xmax,ymax]\tset extent to export to dxf\n"
<< "\t[--dxf-symbology-mode none|symbollayer|feature]\tsymbology mode for dxf output\n"
<< "\t[--dxf-scale-denom scale]\tscale for dxf output\n"
<< "\t[--dxf-encoding encoding]\tencoding to use for dxf output\n"
<< "\t[--dxf-preset visiblity-preset]\tlayer visibility preset to use for dxf output\n"
<< "\t[--help]\t\tthis text\n"
<< "\t[--]\t\ttreat all following arguments as FILEs\n\n"
<< " FILE:\n"
<< " Files specified on the command line can include rasters,\n"
<< " vectors, and QGIS project files (.qgs): \n"
<< " 1. Rasters - supported formats include GeoTiff, DEM \n"
<< " and others supported by GDAL\n"
<< " 2. Vectors - supported formats include ESRI Shapefiles\n"
<< " and others supported by OGR and PostgreSQL layers using\n"
<< " the PostGIS extension\n" ; // OK
QStringList msg;

msg
<< "QGIS - " << VERSION << " '" << RELEASE_NAME << "' ("
<< QGSVERSION << ")\n"
<< "QGIS is a user friendly Open Source Geographic Information System.\n"
<< "Usage: " << appName << " [OPTION] [FILE]\n"
<< " OPTION:\n"
<< "\t[--snapshot filename]\temit snapshot of loaded datasets to given file\n"
<< "\t[--width width]\twidth of snapshot to emit\n"
<< "\t[--height height]\theight of snapshot to emit\n"
<< "\t[--lang language]\tuse language for interface text\n"
<< "\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[--noversioncheck]\tdon't check for new version of QGIS at startup\n"
<< "\t[--noplugins]\tdon't restore plugins on startup\n"
<< "\t[--nocustomization]\tdon't apply GUI customization\n"
<< "\t[--customizationfile]\tuse the given ini file as GUI customization\n"
<< "\t[--optionspath path]\tuse the given QSettings path\n"
<< "\t[--configpath path]\tuse the given path for all user configuration\n"
<< "\t[--authdbdirectory path] use the given directory for authentication database\n"
<< "\t[--code path]\trun the given python file on load\n"
<< "\t[--defaultui]\tstart by resetting user ui settings to default\n"
<< "\t[--dxf-export filename.dxf]\temit dxf output of loaded datasets to given file\n"
<< "\t[--dxf-extent xmin,ymin,xmax,ymax]\tset extent to export to dxf\n"
<< "\t[--dxf-symbology-mode none|symbollayer|feature]\tsymbology mode for dxf output\n"
<< "\t[--dxf-scale-denom scale]\tscale for dxf output\n"
<< "\t[--dxf-encoding encoding]\tencoding to use for dxf output\n"
<< "\t[--dxf-preset visiblity-preset]\tlayer visibility preset to use for dxf output\n"
<< "\t[--help]\t\tthis text\n"
<< "\t[--]\t\ttreat all following arguments as FILEs\n\n"
<< " FILE:\n"
<< " Files specified on the command line can include rasters,\n"
<< " vectors, and QGIS project files (.qgs): \n"
<< " 1. Rasters - supported formats include GeoTiff, DEM \n"
<< " and others supported by GDAL\n"
<< " 2. Vectors - supported formats include ESRI Shapefiles\n"
<< " and others supported by OGR and PostgreSQL layers using\n"
<< " the PostGIS extension\n" ; // OK

#ifdef Q_OS_WIN
MessageBox( nullptr,
msg.join( QString() ).toLocal8Bit().constData(),
"QGIS command line options",
MB_OK );
#else
std::cerr << msg.join( QString() ).toLocal8Bit().constData();
#endif

} // usage()

Expand Down Expand Up @@ -554,7 +565,7 @@ int main( int argc, char *argv[] )

if ( arg == "--help" || arg == "-?" )
{
usage( args[0].toStdString() );
usage( args[0] );
return 2;
}
else if ( arg == "--nologo" || arg == "-n" )
Expand Down

0 comments on commit a465b0e

Please sign in to comment.