StelApp.cpp   StelApp.cpp 
skipping to change at line 32 skipping to change at line 32
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTextureMgr.hpp" #include "StelTextureMgr.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "ConstellationMgr.hpp" #include "ConstellationMgr.hpp"
#include "NebulaMgr.hpp" #include "NebulaMgr.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
#include "GridLinesMgr.hpp" #include "GridLinesMgr.hpp"
#include "MilkyWay.hpp" #include "MilkyWay.hpp"
#include "ZodiacalLight.hpp" #include "ZodiacalLight.hpp"
#include "MeteorMgr.hpp"
#include "LabelMgr.hpp" #include "LabelMgr.hpp"
#include "StarMgr.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "SporadicMeteorMgr.hpp"
#include "StarMgr.hpp"
#include "StelIniParser.hpp" #include "StelIniParser.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelLocationMgr.hpp" #include "StelLocationMgr.hpp"
#include "StelActionMgr.hpp" #include "StelActionMgr.hpp"
#include "StelProgressController.hpp" #include "StelProgressController.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelSkyCultureMgr.hpp" #include "StelSkyCultureMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
skipping to change at line 220 skipping to change at line 220
, timeBase(0.) , timeBase(0.)
, flagNightVision(false) , flagNightVision(false)
, confSettings(NULL) , confSettings(NULL)
, initialized(false) , initialized(false)
, saveProjW(-1) , saveProjW(-1)
, saveProjH(-1) , saveProjH(-1)
, baseFontSize(13) , baseFontSize(13)
, renderBuffer(NULL) , renderBuffer(NULL)
, viewportEffect(NULL) , viewportEffect(NULL)
, flagShowDecimalDegrees(false) , flagShowDecimalDegrees(false)
, flagUseAzimuthFromSouth(false)
{ {
// Stat variables // Stat variables
nbDownloadedFiles=0; nbDownloadedFiles=0;
totalDownloadedSize=0; totalDownloadedSize=0;
nbUsedCache=0; nbUsedCache=0;
totalUsedCacheSize=0; totalUsedCacheSize=0;
setObjectName("StelApp"); setObjectName("StelApp");
skyCultureMgr=NULL; skyCultureMgr=NULL;
skipping to change at line 280 skipping to change at line 281
delete stelObjectMgr; stelObjectMgr=NULL; // Delete the module by ha nd afterward delete stelObjectMgr; stelObjectMgr=NULL; // Delete the module by ha nd afterward
delete textureMgr; textureMgr=NULL; delete textureMgr; textureMgr=NULL;
delete planetLocationMgr; planetLocationMgr=NULL; delete planetLocationMgr; planetLocationMgr=NULL;
delete moduleMgr; moduleMgr=NULL; // Delete the secondary instance delete moduleMgr; moduleMgr=NULL; // Delete the secondary instance
delete actionMgr; actionMgr = NULL; delete actionMgr; actionMgr = NULL;
Q_ASSERT(singleton); Q_ASSERT(singleton);
singleton = NULL; singleton = NULL;
} }
void StelApp::setupHttpProxy() void StelApp::setupNetworkProxy()
{ {
QString proxyHost = confSettings->value("proxy/host_name").toString( ); QString proxyHost = confSettings->value("proxy/host_name").toString( );
QString proxyPort = confSettings->value("proxy/port").toString(); QString proxyPort = confSettings->value("proxy/port").toString();
QString proxyUser = confSettings->value("proxy/user").toString(); QString proxyUser = confSettings->value("proxy/user").toString();
QString proxyPass = confSettings->value("proxy/password").toString() ; QString proxyPass = confSettings->value("proxy/password").toString() ;
QString proxyType = confSettings->value("proxy/type").toString();
bool useSocksProxy = proxyType.contains("socks", Qt::CaseInsensitive
);
// If proxy settings not found in config, use environment variable // If proxy settings not found in config, use environment variable
// if it is defined. (Config file over-rides environment). // if it is defined. (Config file over-rides environment).
if (proxyHost.isEmpty() && proxyUser.isEmpty() && proxyPass.isEmpty( ) && proxyPort.isEmpty()) if (proxyHost.isEmpty() && proxyUser.isEmpty() && proxyPass.isEmpty( ) && proxyPort.isEmpty())
{ {
char *httpProxyEnv; char *httpProxyEnv;
httpProxyEnv = std::getenv("http_proxy"); httpProxyEnv = std::getenv("http_proxy");
if (!httpProxyEnv) if (!httpProxyEnv)
{ {
httpProxyEnv = std::getenv("HTTP_PROXY"); httpProxyEnv = std::getenv("HTTP_PROXY");
skipping to change at line 329 skipping to change at line 333
qDebug() << "indecipherable environm ent variable http_proxy:" << proxyString; qDebug() << "indecipherable environm ent variable http_proxy:" << proxyString;
return; return;
} }
} }
} }
} }
if (!proxyHost.isEmpty()) if (!proxyHost.isEmpty())
{ {
QNetworkProxy proxy; QNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy); if (useSocksProxy)
proxy.setType(QNetworkProxy::Socks5Proxy);
else
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName(proxyHost); proxy.setHostName(proxyHost);
if (!proxyPort.isEmpty()) if (!proxyPort.isEmpty())
proxy.setPort(proxyPort.toUShort()); proxy.setPort(proxyPort.toUShort());
if (!proxyUser.isEmpty()) if (!proxyUser.isEmpty())
proxy.setUser(proxyUser); proxy.setUser(proxyUser);
if (!proxyPass.isEmpty()) if (!proxyPass.isEmpty())
proxy.setPassword(proxyPass); proxy.setPassword(proxyPass);
QString ppDisp = proxyPass; QString ppDisp = proxyPass;
ppDisp.fill('*'); ppDisp.fill('*');
qDebug() << "Using HTTP proxy:" << proxyUser << ppDisp << pr if (useSocksProxy)
oxyHost << proxyPort; qDebug() << "Using SOCKS proxy:" << proxyUser << ppD
isp << proxyHost << proxyPort;
else
qDebug() << "Using HTTP proxy:" << proxyUser << ppDi
sp << proxyHost << proxyPort;
QNetworkProxy::setApplicationProxy(proxy); QNetworkProxy::setApplicationProxy(proxy);
} }
} }
#ifndef DISABLE_SCRIPTING #ifndef DISABLE_SCRIPTING
void StelApp::initScriptMgr(QSettings *conf) void StelApp::initScriptMgr()
{ {
scriptAPIProxy = new StelMainScriptAPIProxy(this);
scriptMgr = new StelScriptMgr(this);
scriptMgr->addModules(); scriptMgr->addModules();
QString startupScript; QString startupScript;
if (qApp->property("onetime_startup_script").isValid()) if (qApp->property("onetime_startup_script").isValid())
startupScript = qApp->property("onetime_startup_script").toS tring(); startupScript = qApp->property("onetime_startup_script").toS tring();
else else
startupScript = conf->value("scripts/startup_script", "start up.ssc").toString(); startupScript = confSettings->value("scripts/startup_script" , "startup.ssc").toString();
// Use a queued slot call to start the script only once the main qAp p event loop is running... // Use a queued slot call to start the script only once the main qAp p event loop is running...
QMetaObject::invokeMethod(scriptMgr, QMetaObject::invokeMethod(scriptMgr,
"runScript", "runScript",
Qt::QueuedConnection, Qt::QueuedConnection,
Q_ARG(QString, startupScript)); Q_ARG(QString, startupScript));
} }
#else #else
void StelApp::initScriptMgr(QSettings *conf) {Q_UNUSED(conf);} void StelApp::initScriptMgr() {}
#endif #endif
void StelApp::init(QSettings* conf) void StelApp::init(QSettings* conf)
{ {
confSettings = conf; confSettings = conf;
devicePixelsPerPixel = QOpenGLContext::currentContext()->screen()->d evicePixelRatio(); devicePixelsPerPixel = QOpenGLContext::currentContext()->screen()->d evicePixelRatio();
setBaseFontSize(confSettings->value("gui/base_font_size", 13).toInt( )); setBaseFontSize(confSettings->value("gui/base_font_size", 13).toInt( ));
skipping to change at line 458 skipping to change at line 466
// Landscape, atmosphere & cardinal points section // Landscape, atmosphere & cardinal points section
LandscapeMgr* landscape = new LandscapeMgr(); LandscapeMgr* landscape = new LandscapeMgr();
landscape->init(); landscape->init();
getModuleMgr().registerModule(landscape); getModuleMgr().registerModule(landscape);
GridLinesMgr* gridLines = new GridLinesMgr(); GridLinesMgr* gridLines = new GridLinesMgr();
gridLines->init(); gridLines->init();
getModuleMgr().registerModule(gridLines); getModuleMgr().registerModule(gridLines);
// Meteors // Sporadic Meteors
MeteorMgr* meteors = new MeteorMgr(10, 72); SporadicMeteorMgr* meteors = new SporadicMeteorMgr(10, 72);
meteors->init(); meteors->init();
getModuleMgr().registerModule(meteors); getModuleMgr().registerModule(meteors);
// User labels // User labels
LabelMgr* skyLabels = new LabelMgr(); LabelMgr* skyLabels = new LabelMgr();
skyLabels->init(); skyLabels->init();
getModuleMgr().registerModule(skyLabels); getModuleMgr().registerModule(skyLabels);
skyCultureMgr->init(); skyCultureMgr->init();
initScriptMgr(conf); //Create the script manager here, maybe some modules/plugins may wan
t to connect to it
//It has to be initialized later after all modules have been loaded
by calling initScriptMgr
#ifndef DISABLE_SCRIPTING
scriptAPIProxy = new StelMainScriptAPIProxy(this);
scriptMgr = new StelScriptMgr(this);
#endif
// Initialisation of the color scheme // Initialisation of the color scheme
emit colorSchemeChanged("color"); emit colorSchemeChanged("color");
setVisionModeNight(confSettings->value("viewing/flag_night").toBool( )); setVisionModeNight(confSettings->value("viewing/flag_night").toBool( ));
// Enable viewport effect at startup if he set // Enable viewport effect at startup if he set
setViewportEffect(confSettings->value("video/viewport_effect", "none ").toString()); setViewportEffect(confSettings->value("video/viewport_effect", "none ").toString());
// Proxy Initialisation // Proxy Initialisation
setupHttpProxy(); setupNetworkProxy();
updateI18n(); updateI18n();
// Init actions. // Init actions.
actionMgr->addAction("actionShow_Night_Mode", N_("Display Options"), N_("Night mode"), this, "nightMode"); actionMgr->addAction("actionShow_Night_Mode", N_("Display Options"), N_("Night mode"), this, "nightMode");
setFlagShowDecimalDegrees(confSettings->value("gui/flag_show_decimal _degrees", false).toBool()); setFlagShowDecimalDegrees(confSettings->value("gui/flag_show_decimal _degrees", false).toBool());
setFlagOldAzimuthUsage(confSettings->value("gui/flag_use_azimuth_fro m_south", false).toBool());
initialized = true; initialized = true;
} }
// Load and initialize external modules (plugins) // Load and initialize external modules (plugins)
void StelApp::initPlugIns() void StelApp::initPlugIns()
{ {
// Load dynamically all the modules found in the modules/ directorie s // Load dynamically all the modules found in the modules/ directorie s
// which are configured to be loaded at startup // which are configured to be loaded at startup
foreach (StelModuleMgr::PluginDescriptor i, moduleMgr->getPluginsLis t()) foreach (StelModuleMgr::PluginDescriptor i, moduleMgr->getPluginsLis t())
 End of changes. 16 change blocks. 
15 lines changed or deleted 33 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/