CLIProcessor.cpp   CLIProcessor.cpp 
skipping to change at line 75 skipping to change at line 75
<< "--angle-d3d11 : Force use Direct3D 1 1 for ANGLE OpenGL ES2 rendering engine\n" << "--angle-d3d11 : Force use Direct3D 1 1 for ANGLE OpenGL ES2 rendering engine\n"
<< "--angle-warp : Force use the Direct 3D 11 software rasterizer for ANGLE OpenGL ES2 rendering engine\n" << "--angle-warp : Force use the Direct 3D 11 software rasterizer for ANGLE OpenGL ES2 rendering engine\n"
<< "--mesa-mode (or -m) : Use MESA as software OpenGL rendering engine\n" << "--mesa-mode (or -m) : Use MESA as software OpenGL rendering engine\n"
<< "--safe-mode (or -s) : Synonymous to --mesa -mode \n" << "--safe-mode (or -s) : Synonymous to --mesa -mode \n"
#endif #endif
<< "--dump-opengl-details (or -d) : dump informati on about OpenGL support to logfile.\n" << "--dump-opengl-details (or -d) : dump informati on about OpenGL support to logfile.\n"
<< " Use this is you have graphics problems\n" << " Use this is you have graphics problems\n"
<< " and want to send a b ug report\n" << " and want to send a b ug report\n"
<< "--full-screen (or -f) : With argument \"yes\ " or \"no\" over-rides\n" << "--full-screen (or -f) : With argument \"yes\ " or \"no\" over-rides\n"
<< " the full screen sett ing in the config file\n" << " the full screen sett ing in the config file\n"
#ifdef Q_OS_WIN
#ifdef ENABLE_SPOUT
<< "--spout (or -S) <sky|all> : Act as SPOUT sende
r (Sky only/including GUI)\n"
<< "--spout-name <name> : Set particular name
for SPOUT sender.\n"
#endif
#endif
<< "--screenshot-dir : Specify directory to save screenshots\n" << "--screenshot-dir : Specify directory to save screenshots\n"
<< "--startup-script : Specify name of star tup script\n" << "--startup-script : Specify name of star tup script\n"
<< "--home-planet : Specify observer pla net (English name)\n" << "--home-planet : Specify observer pla net (English name)\n"
<< "--altitude : Specify observer alt itude in meters\n" << "--altitude : Specify observer alt itude in meters\n"
<< "--longitude : Specify longitude, e .g. +53d58\\'16.65\\\"\n" << "--longitude : Specify longitude, e .g. +53d58\\'16.65\\\"\n"
<< "--latitude : Specify latitude, e. g. -1d4\\'27.48\\\"\n" << "--latitude : Specify latitude, e. g. -1d4\\'27.48\\\"\n"
<< "--list-landscapes : Print a list of vali d landscape IDs\n" << "--list-landscapes : Print a list of vali d landscape IDs\n"
<< "--landscape : Start using landscap e whose ID (dir name)\n" << "--landscape : Start using landscap e whose ID (dir name)\n"
<< " is passed as paramet er to option\n" << " is passed as paramet er to option\n"
<< "--sky-date : Specify sky date in format yyyymmdd\n" << "--sky-date : Specify sky date in format yyyymmdd\n"
skipping to change at line 170 skipping to change at line 176
} }
void CLIProcessor::parseCLIArgsPostConfig(const QStringList& argList, QSett ings* confSettings) void CLIProcessor::parseCLIArgsPostConfig(const QStringList& argList, QSett ings* confSettings)
{ {
// Over-ride config file options with command line options // Over-ride config file options with command line options
// We should catch exceptions from argsGetOptionWithArg... // We should catch exceptions from argsGetOptionWithArg...
int fullScreen, altitude; int fullScreen, altitude;
float fov; float fov;
QString landscapeId, homePlanet, longitude, latitude, skyDate, skyTi me; QString landscapeId, homePlanet, longitude, latitude, skyDate, skyTi me;
QString projectionType, screenshotDir, multiresImage, startupScript; QString projectionType, screenshotDir, multiresImage, startupScript;
#ifdef ENABLE_SPOUT
QString spoutStr, spoutName;
#endif
try try
{ {
bool dumpOpenGLDetails = argsGetOption(argList, "-d", "--dum p-opengl-details"); bool dumpOpenGLDetails = argsGetOption(argList, "-d", "--dum p-opengl-details");
qApp->setProperty("dump_OpenGL_details", dumpOpenGLDetails); qApp->setProperty("dump_OpenGL_details", dumpOpenGLDetails);
fullScreen = argsGetYesNoOption(argList, "-f", "--full-scree n", -1); fullScreen = argsGetYesNoOption(argList, "-f", "--full-scree n", -1);
landscapeId = argsGetOptionWithArg(argList, "", "--landscape ", "").toString(); landscapeId = argsGetOptionWithArg(argList, "", "--landscape ", "").toString();
homePlanet = argsGetOptionWithArg(argList, "", "--home-plane t", "").toString(); homePlanet = argsGetOptionWithArg(argList, "", "--home-plane t", "").toString();
altitude = argsGetOptionWithArg(argList, "", "--altitude", - 1).toInt(); altitude = argsGetOptionWithArg(argList, "", "--altitude", - 1).toInt();
longitude = argsGetOptionWithArg(argList, "", "--longitude", "").toString(); longitude = argsGetOptionWithArg(argList, "", "--longitude", "").toString();
latitude = argsGetOptionWithArg(argList, "", "--latitude", " ").toString(); latitude = argsGetOptionWithArg(argList, "", "--latitude", " ").toString();
skyDate = argsGetOptionWithArg(argList, "", "--sky-date", "" ).toString(); skyDate = argsGetOptionWithArg(argList, "", "--sky-date", "" ).toString();
skyTime = argsGetOptionWithArg(argList, "", "--sky-time", "" ).toString(); skyTime = argsGetOptionWithArg(argList, "", "--sky-time", "" ).toString();
fov = argsGetOptionWithArg(argList, "", "--fov", -1.f).toFlo at(); fov = argsGetOptionWithArg(argList, "", "--fov", -1.f).toFlo at();
projectionType = argsGetOptionWithArg(argList, "", "--projec tion-type", "").toString(); projectionType = argsGetOptionWithArg(argList, "", "--projec tion-type", "").toString();
screenshotDir = argsGetOptionWithArg(argList, "", "--screens hot-dir", "").toString(); screenshotDir = argsGetOptionWithArg(argList, "", "--screens hot-dir", "").toString();
multiresImage = argsGetOptionWithArg(argList, "", "--multire s-image", "").toString(); multiresImage = argsGetOptionWithArg(argList, "", "--multire s-image", "").toString();
startupScript = argsGetOptionWithArg(argList, "", "--startup -script", "").toString(); startupScript = argsGetOptionWithArg(argList, "", "--startup -script", "").toString();
#ifdef ENABLE_SPOUT
// For now, we default to spout=sky when no extra option is
given. Later, we should also accept "all".
// Unfortunately, this still throws an exception when no opt
arg string is given.
spoutStr = argsGetOptionWithArg(argList, "-S", "--spout", "
").toString();
spoutName = argsGetOptionWithArg(argList, "", "--spout-name"
, "").toString();
#endif
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qCritical() << "ERROR while checking command line options: " << e.what(); qCritical() << "ERROR while checking command line options: " << e.what();
exit(0); exit(0);
} }
// Will be -1 if option is not found, in which case we don't change anything. // Will be -1 if option is not found, in which case we don't change anything.
if (fullScreen==1) if (fullScreen==1)
confSettings->setValue("video/fullscreen", true); confSettings->setValue("video/fullscreen", true);
skipping to change at line 302 skipping to change at line 317
{ {
StelFileMgr::setScreenshotDir(screenshotDir) ; StelFileMgr::setScreenshotDir(screenshotDir) ;
confSettings->setValue("main/screenshot_dir" , screenshotDir); confSettings->setValue("main/screenshot_dir" , screenshotDir);
} }
catch (std::runtime_error &e) catch (std::runtime_error &e)
{ {
qDebug("Error: cannot create screenshot dire ctory: %s", e.what()); qDebug("Error: cannot create screenshot dire ctory: %s", e.what());
} }
} }
} }
#ifdef ENABLE_SPOUT
if (!spoutStr.isEmpty())
{
if (spoutStr=="all")
qApp->setProperty("spout", "all");
else
qApp->setProperty("spout", "sky");
}
else
qApp->setProperty("spout", "none");
if (!spoutName.isEmpty())
qApp->setProperty("spoutName", spoutName);
#endif
} }
bool CLIProcessor::argsGetOption(const QStringList& args, QString shortOpt, QString longOpt) bool CLIProcessor::argsGetOption(const QStringList& args, QString shortOpt, QString longOpt)
{ {
bool result=false; bool result=false;
// Don't see anything after a -- as an option // Don't see anything after a -- as an option
int lastOptIdx = args.indexOf("--"); int lastOptIdx = args.indexOf("--");
if (lastOptIdx == -1) if (lastOptIdx == -1)
lastOptIdx = args.size(); lastOptIdx = args.size();
skipping to change at line 353 skipping to change at line 383
else if (args.at(i).left(longOpt.length()+1)==longOpt+"=") else if (args.at(i).left(longOpt.length()+1)==longOpt+"=")
{ {
match=true; match=true;
argStr=args.at(i).right(args.at(i).length() - longOp t.length() - 1); argStr=args.at(i).right(args.at(i).length() - longOp t.length() - 1);
} }
// forms -n arg and --number arg // forms -n arg and --number arg
else if ((!shortOpt.isEmpty() && args.at(i)==shortOpt) || ar gs.at(i)==longOpt) else if ((!shortOpt.isEmpty() && args.at(i)==shortOpt) || ar gs.at(i)==longOpt)
{ {
if (i+1>=lastOptIdx) if (i+1>=lastOptIdx)
{ {
throw (std::runtime_error(qPrintable("optarg // i.e., option given as last option, but wi
_missing ("+longOpt+")"))); thout arguments. Last chance: default value!
if (defaultValue.isValid())
{
return defaultValue;
}
else
{
throw (std::runtime_error(qPrintable
("optarg_missing ("+longOpt+")")));
}
} }
else else
{ {
match=true; match=true;
argStr=args.at(i+1); argStr=args.at(i+1);
i++; // skip option argument in next iterat ion i++; // skip option argument in next iterat ion
} }
} }
if (match) if (match)
 End of changes. 5 change blocks. 
2 lines changed or deleted 47 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/