CLIProcessor.cpp   CLIProcessor.cpp 
skipping to change at line 24 skipping to change at line 24
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include "CLIProcessor.hpp" #include "CLIProcessor.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include <config.h>
#include <QSettings> #include <QSettings>
#include <QDateTime> #include <QDateTime>
#include <QDebug> #include <QDebug>
#include <iostream> #include <iostream>
#include <QApplication>
void CLIProcessor::parseCLIArgsPreConfig(const QStringList& argList) void CLIProcessor::parseCLIArgsPreConfig(const QStringList& argList)
{ {
if (argsGetOption(argList, "-v", "--version")) if (argsGetOption(argList, "-v", "--version"))
{ {
std::cout << qPrintable(StelUtils::getApplicationName()); std::cout << qPrintable(StelUtils::getApplicationName()) << std::endl;
exit(0); exit(0);
} }
if (argsGetOption(argList, "-h", "--help")) if (argsGetOption(argList, "-h", "--help"))
{ {
// Get the basename of binary // Get the basename of binary
QString binName = argList.at(0); QString binName = argList.at(0);
binName.remove(QRegExp("^.*[/\\\\]")); binName.remove(QRegExp("^.*[/\\\\]"));
std::cout << "Usage:\n" std::cout << "Usage:\n"
<< " " << " "
<< qPrintable(binName) << " [options]\n\n" << qPrintable(binName) << " [options]\n\n"
<< "Options:\n" << "Options:\n"
<< "--version (or -v) : Print program name an << "--version (or -v) : Print program name a
d version and exit.\n" nd version and exit.\n"
<< "--help (or -h) : This cruft.\n" << "--help (or -h) : This cruft.\n"
<< "--config-file (or -c) : Use an alternative na << "--config-file (or -c) : Use an alternative n
me for the config file\n" ame for the config file\n"
<< "--user-dir (or -u) : Use an alternative us << "--user-dir (or -u) : Use an alternative u
er data directory\n" ser data directory\n"
<< "--full-screen (or -f) : With argument \"yes\" << "--safe-mode (or -s) : Disable GL shaders a
or \"no\" over-rides\n" nd use older GL engine\n"
<< " the full screen setti << " Try this is you have
ng in the config file\n" graphics problems\n"
<< "--screenshot-dir : Specify directory to << "--full-screen (or -f) : With argument \"yes\
save screenshots\n" " or \"no\" over-rides\n"
<< "--startup-script : Specify name of start << " the full screen sett
up script\n" ing in the config file\n"
<< "--home-planet : Specify observer plan << "--screenshot-dir : Specify directory to
et (English name)\n" save screenshots\n"
<< "--altitude : Specify observer alti << "--startup-script : Specify name of star
tude in meters\n" tup script\n"
<< "--longitude : Specify longitude, e. << "--home-planet : Specify observer pla
g. +53d58\\'16.65\\\"\n" net (English name)\n"
<< "--latitude : Specify latitude, e.g << "--altitude : Specify observer alt
. -1d4\\'27.48\\\"\n" itude in meters\n"
<< "--list-landscapes : Print a list of value << "--longitude : Specify longitude, e
landscape IDs\n" .g. +53d58\\'16.65\\\"\n"
<< "--landscape : Start using landscape << "--latitude : Specify latitude, e.
whose ID (dir name)\n" g. -1d4\\'27.48\\\"\n"
<< " is passed as paramete << "--list-landscapes : Print a list of valu
r to option\n" e landscape IDs\n"
<< "--sky-date : Specify sky date in f << "--landscape : Start using landscap
ormat yyyymmdd\n" e whose ID (dir name)\n"
<< "--sky-time : Specify sky time in f << " is passed as paramet
ormat hh:mm:ss\n" er to option\n"
<< "--fov : Specify the field of << "--sky-date : Specify sky date in
view (degrees)\n" format yyyymmdd\n"
<< "--projection-type : Specify projection ty << "--sky-time : Specify sky time in
pe, e.g. stereographic\n" format hh:mm:ss\n"
<< "--restore-defaults : Delete existing confi << "--fov : Specify the field of
g.ini and use defaults\n" view (degrees)\n"
<< "--multires-image : With filename / URL a << "--projection-type : Specify projection t
rgument, specify a\n" ype, e.g. stereographic\n"
<< " multi-resolution imag << "--restore-defaults : Delete existing conf
e to load\n"; ig.ini and use defaults\n"
//Removed, as it is Qt argument, not Stellarium arg << "--multires-image : With filename / URL
ument, and does not follow the format argument, specify a\n"
//It accepts only "-graphicssystem value" instead o << " multi-resolution ima
f "--graphicssystem=value" ge to load\n";
//<< "-graphicssystem : (one dash only!) Ch
oose Qt graphics backend:\n"
//<< " it can be \"native\
", \"raster\", or \"opengl\"\n"
//<< " the default setting
is \"" DEFAULT_GRAPHICS_SYSTEM "\"\n";
exit(0); exit(0);
} }
if (argsGetOption(argList, "-s", "--safe-mode"))
{
qApp->setProperty("onetime_safe_mode", true);
}
if (argsGetOption(argList, "", "--list-landscapes")) if (argsGetOption(argList, "", "--list-landscapes"))
{ {
const QSet<QString>& landscapeIds = StelFileMgr::listContent s("landscapes", StelFileMgr::Directory); const QSet<QString>& landscapeIds = StelFileMgr::listContent s("landscapes", StelFileMgr::Directory);
foreach (const QString& i, landscapeIds) foreach (const QString& i, landscapeIds)
{ {
try try
{ {
// finding the file will throw an exception if it is not found // finding the file will throw an exception if it is not found
// in that case we won't output the landscap e ID as it cannot work // in that case we won't output the landscap e ID as it cannot work
StelFileMgr::findFile("landscapes/" + i + "/ landscape.ini"); StelFileMgr::findFile("landscapes/" + i + "/ landscape.ini");
std::cout << qPrintable(i); std::cout << qPrintable(i) << std::endl;
} }
catch (std::runtime_error& e){} catch (std::runtime_error& e){}
} }
exit(0); exit(0);
} }
try try
{ {
QString newUserDir; QString newUserDir;
newUserDir = argsGetOptionWithArg(argList, "-u", "--user-dir ", "").toString(); newUserDir = argsGetOptionWithArg(argList, "-u", "--user-dir ", "").toString();
skipping to change at line 127 skipping to change at line 130
try try
{ {
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.0).toDou ble(); 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 = CLIProcessor::argsGetOptionWithArg(argList, "", "--startup-script", "").toString(); startupScript = argsGetOptionWithArg(argList, "", "--startup -script", "").toString();
} }
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 210 skipping to change at line 213
if (!multiresImage.isEmpty()) if (!multiresImage.isEmpty())
confSettings->setValue("skylayers/clilayer", multiresImage); confSettings->setValue("skylayers/clilayer", multiresImage);
else else
{ {
confSettings->remove("skylayers/clilayer"); confSettings->remove("skylayers/clilayer");
} }
if (!startupScript.isEmpty()) if (!startupScript.isEmpty())
{ {
confSettings->setValue("scripts/startup_script", startupScri pt); qApp->setProperty("onetime_startup_script", startupScript);
} }
if (fov>0.0) confSettings->setValue("navigation/init_fov", fov); if (fov>0.0) confSettings->setValue("navigation/init_fov", fov);
if (!projectionType.isEmpty()) confSettings->setValue("projection/ty pe", projectionType); if (!projectionType.isEmpty()) confSettings->setValue("projection/ty pe", projectionType);
if (!screenshotDir.isEmpty()) if (!screenshotDir.isEmpty())
{ {
try try
{ {
QString newShotDir = argsGetOptionWithArg(argList, " ", "--screenshot-dir", "").toString(); QString newShotDir = argsGetOptionWithArg(argList, " ", "--screenshot-dir", "").toString();
if (!newShotDir.isEmpty()) if (!newShotDir.isEmpty())
 End of changes. 9 change blocks. 
62 lines changed or deleted 62 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/