Skip to content

Commit bd23bf1

Browse files
committed
show command line help as message box on windows
1 parent f9219b3 commit bd23bf1

File tree

1 file changed

+50
-39
lines changed

1 file changed

+50
-39
lines changed

src/app/main.cpp

+50-39
Original file line numberDiff line numberDiff line change
@@ -106,46 +106,57 @@ typedef SInt32 SRefCon;
106106

107107
/** Print usage text
108108
*/
109-
void usage( std::string const & appName )
109+
void usage( QString appName )
110110
{
111-
std::cerr << "QGIS - " << VERSION << " '" << RELEASE_NAME << "' ("
112-
<< QGSVERSION << ")\n"
113-
<< "QGIS is a user friendly Open Source Geographic Information System.\n"
114-
<< "Usage: " << appName << " [OPTION] [FILE]\n"
115-
<< " OPTION:\n"
116-
<< "\t[--snapshot filename]\temit snapshot of loaded datasets to given file\n"
117-
<< "\t[--width width]\twidth of snapshot to emit\n"
118-
<< "\t[--height height]\theight of snapshot to emit\n"
119-
<< "\t[--lang language]\tuse language for interface text\n"
120-
<< "\t[--project projectfile]\tload the given QGIS project\n"
121-
<< "\t[--extent xmin,ymin,xmax,ymax]\tset initial map extent\n"
122-
<< "\t[--nologo]\thide splash screen\n"
123-
<< "\t[--noversioncheck]\tdon't check for new version of QGIS at startup\n"
124-
<< "\t[--noplugins]\tdon't restore plugins on startup\n"
125-
<< "\t[--nocustomization]\tdon't apply GUI customization\n"
126-
<< "\t[--customizationfile]\tuse the given ini file as GUI customization\n"
127-
<< "\t[--optionspath path]\tuse the given QSettings path\n"
128-
<< "\t[--configpath path]\tuse the given path for all user configuration\n"
129-
<< "\t[--authdbdirectory path] use the given directory for authentication database\n"
130-
<< "\t[--code path]\trun the given python file on load\n"
131-
<< "\t[--defaultui]\tstart by resetting user ui settings to default\n"
132-
<< "\t[--dxf-export filename.dxf]\temit dxf output of loaded datasets to given file\n"
133-
<< "\t[--dxf-extent xmin,ymin,xmax,ymax]\tset extent to export to dxf\n"
134-
<< "\t[--dxf-symbology-mode none|symbollayer|feature]\tsymbology mode for dxf output\n"
135-
<< "\t[--dxf-scale-denom scale]\tscale for dxf output\n"
136-
<< "\t[--dxf-encoding encoding]\tencoding to use for dxf output\n"
137-
<< "\t[--dxf-preset visiblity-preset]\tlayer visibility preset to use for dxf output\n"
138-
<< "\t[--help]\t\tthis text\n"
139-
<< "\t[--]\t\ttreat all following arguments as FILEs\n\n"
140-
<< " FILE:\n"
141-
<< " Files specified on the command line can include rasters,\n"
142-
<< " vectors, and QGIS project files (.qgs): \n"
143-
<< " 1. Rasters - supported formats include GeoTiff, DEM \n"
144-
<< " and others supported by GDAL\n"
145-
<< " 2. Vectors - supported formats include ESRI Shapefiles\n"
146-
<< " and others supported by OGR and PostgreSQL layers using\n"
147-
<< " the PostGIS extension\n" ; // OK
111+
QStringList msg;
112+
113+
msg
114+
<< "QGIS - " << VERSION << " '" << RELEASE_NAME << "' ("
115+
<< QGSVERSION << ")\n"
116+
<< "QGIS is a user friendly Open Source Geographic Information System.\n"
117+
<< "Usage: " << appName << " [OPTION] [FILE]\n"
118+
<< " OPTION:\n"
119+
<< "\t[--snapshot filename]\temit snapshot of loaded datasets to given file\n"
120+
<< "\t[--width width]\twidth of snapshot to emit\n"
121+
<< "\t[--height height]\theight of snapshot to emit\n"
122+
<< "\t[--lang language]\tuse language for interface text\n"
123+
<< "\t[--project projectfile]\tload the given QGIS project\n"
124+
<< "\t[--extent xmin,ymin,xmax,ymax]\tset initial map extent\n"
125+
<< "\t[--nologo]\thide splash screen\n"
126+
<< "\t[--noversioncheck]\tdon't check for new version of QGIS at startup\n"
127+
<< "\t[--noplugins]\tdon't restore plugins on startup\n"
128+
<< "\t[--nocustomization]\tdon't apply GUI customization\n"
129+
<< "\t[--customizationfile]\tuse the given ini file as GUI customization\n"
130+
<< "\t[--optionspath path]\tuse the given QSettings path\n"
131+
<< "\t[--configpath path]\tuse the given path for all user configuration\n"
132+
<< "\t[--authdbdirectory path] use the given directory for authentication database\n"
133+
<< "\t[--code path]\trun the given python file on load\n"
134+
<< "\t[--defaultui]\tstart by resetting user ui settings to default\n"
135+
<< "\t[--dxf-export filename.dxf]\temit dxf output of loaded datasets to given file\n"
136+
<< "\t[--dxf-extent xmin,ymin,xmax,ymax]\tset extent to export to dxf\n"
137+
<< "\t[--dxf-symbology-mode none|symbollayer|feature]\tsymbology mode for dxf output\n"
138+
<< "\t[--dxf-scale-denom scale]\tscale for dxf output\n"
139+
<< "\t[--dxf-encoding encoding]\tencoding to use for dxf output\n"
140+
<< "\t[--dxf-preset visiblity-preset]\tlayer visibility preset to use for dxf output\n"
141+
<< "\t[--help]\t\tthis text\n"
142+
<< "\t[--]\t\ttreat all following arguments as FILEs\n\n"
143+
<< " FILE:\n"
144+
<< " Files specified on the command line can include rasters,\n"
145+
<< " vectors, and QGIS project files (.qgs): \n"
146+
<< " 1. Rasters - supported formats include GeoTiff, DEM \n"
147+
<< " and others supported by GDAL\n"
148+
<< " 2. Vectors - supported formats include ESRI Shapefiles\n"
149+
<< " and others supported by OGR and PostgreSQL layers using\n"
150+
<< " the PostGIS extension\n" ; // OK
148151

152+
#ifdef Q_OS_WIN
153+
MessageBox( nullptr,
154+
msg.join( QString() ).toLocal8Bit().constData(),
155+
"QGIS command line options",
156+
MB_OK );
157+
#else
158+
std::cerr << msg.join( QString() ).toLocal8Bit().constData();
159+
#endif
149160

150161
} // usage()
151162

@@ -571,7 +582,7 @@ int main( int argc, char *argv[] )
571582

572583
if ( arg == "--help" || arg == "-?" )
573584
{
574-
usage( args[0].toStdString() );
585+
usage( args[0] );
575586
return 2;
576587
}
577588
else if ( arg == "--nologo" || arg == "-n" )

0 commit comments

Comments
 (0)