StelApp.cpp   StelApp.cpp 
skipping to change at line 28 skipping to change at line 28
*/ */
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelMainView.hpp" #include "StelMainView.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 "AsterismMgr.hpp"
#include "NebulaMgr.hpp" #include "NebulaMgr.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
#include "CustomObjectMgr.hpp" #include "CustomObjectMgr.hpp"
#include "GridLinesMgr.hpp" #include "GridLinesMgr.hpp"
#include "MilkyWay.hpp" #include "MilkyWay.hpp"
#include "ZodiacalLight.hpp" #include "ZodiacalLight.hpp"
#include "LabelMgr.hpp" #include "LabelMgr.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "SporadicMeteorMgr.hpp" #include "SporadicMeteorMgr.hpp"
#include "StarMgr.hpp" #include "StarMgr.hpp"
skipping to change at line 188 skipping to change at line 189
#ifdef USE_STATIC_PLUGIN_REMOTECONTROL #ifdef USE_STATIC_PLUGIN_REMOTECONTROL
Q_IMPORT_PLUGIN(RemoteControlStelPluginInterface) Q_IMPORT_PLUGIN(RemoteControlStelPluginInterface)
#endif #endif
#ifdef USE_STATIC_PLUGIN_REMOTESYNC #ifdef USE_STATIC_PLUGIN_REMOTESYNC
Q_IMPORT_PLUGIN(RemoteSyncStelPluginInterface) Q_IMPORT_PLUGIN(RemoteSyncStelPluginInterface)
#endif #endif
// Initialize static variables // Initialize static variables
StelApp* StelApp::singleton = NULL; StelApp* StelApp::singleton = Q_NULLPTR;
qint64 StelApp::startMSecs = 0; qint64 StelApp::startMSecs = 0;
float StelApp::animationScale = 1.f; float StelApp::animationScale = 1.f;
void StelApp::initStatic() void StelApp::initStatic()
{ {
StelApp::startMSecs = QDateTime::currentMSecsSinceEpoch(); StelApp::startMSecs = QDateTime::currentMSecsSinceEpoch();
} }
void StelApp::deinitStatic() void StelApp::deinitStatic()
{ {
StelApp::startMSecs = 0; StelApp::startMSecs = 0;
} }
/************************************************************************* /*************************************************************************
Create and initialize the main Stellarium application. Create and initialize the main Stellarium application.
*************************************************************************/ *************************************************************************/
StelApp::StelApp(StelMainView *parent) StelApp::StelApp(StelMainView *parent)
: QObject(parent) : QObject(parent)
, mainWin(parent) , mainWin(parent)
, core(NULL) , core(Q_NULLPTR)
, moduleMgr(NULL) , moduleMgr(Q_NULLPTR)
, localeMgr(NULL) , localeMgr(Q_NULLPTR)
, skyCultureMgr(NULL) , skyCultureMgr(Q_NULLPTR)
, actionMgr(NULL) , actionMgr(Q_NULLPTR)
, propMgr(NULL) , propMgr(Q_NULLPTR)
, textureMgr(NULL) , textureMgr(Q_NULLPTR)
, stelObjectMgr(NULL) , stelObjectMgr(Q_NULLPTR)
, planetLocationMgr(NULL) , planetLocationMgr(Q_NULLPTR)
, networkAccessManager(NULL) , networkAccessManager(Q_NULLPTR)
, audioMgr(NULL) , audioMgr(Q_NULLPTR)
, videoMgr(NULL) , videoMgr(Q_NULLPTR)
, skyImageMgr(NULL) , skyImageMgr(Q_NULLPTR)
#ifndef DISABLE_SCRIPTING #ifndef DISABLE_SCRIPTING
, scriptAPIProxy(NULL) , scriptAPIProxy(Q_NULLPTR)
, scriptMgr(NULL) , scriptMgr(Q_NULLPTR)
#endif #endif
, stelGui(NULL) , stelGui(Q_NULLPTR)
, devicePixelsPerPixel(1.f) , devicePixelsPerPixel(1.f)
, globalScalingRatio(1.f) , globalScalingRatio(1.f)
, fps(0) , fps(0)
, frame(0) , frame(0)
, frameTimeAccum(0.) , frameTimeAccum(0.)
, flagNightVision(false) , flagNightVision(false)
, confSettings(NULL) , confSettings(Q_NULLPTR)
, initialized(false) , initialized(false)
, saveProjW(-1) , saveProjW(-1)
, saveProjH(-1) , saveProjH(-1)
, nbDownloadedFiles(0) , nbDownloadedFiles(0)
, totalDownloadedSize(0) , totalDownloadedSize(0)
, nbUsedCache(0) , nbUsedCache(0)
, totalUsedCacheSize(0) , totalUsedCacheSize(0)
, baseFontSize(13) , baseFontSize(13)
, renderBuffer(NULL) , renderBuffer(Q_NULLPTR)
, viewportEffect(NULL) , viewportEffect(Q_NULLPTR)
, gl(Q_NULLPTR)
, flagShowDecimalDegrees(false) , flagShowDecimalDegrees(false)
, flagUseAzimuthFromSouth(false) , flagUseAzimuthFromSouth(false)
#ifdef ENABLE_SPOUT #ifdef ENABLE_SPOUT
, spoutSender(NULL) , spoutSender(Q_NULLPTR)
#endif #endif
, currentFbo(0) , currentFbo(0)
{ {
setObjectName("StelApp"); setObjectName("StelApp");
// Can't create 2 StelApp instances // Can't create 2 StelApp instances
Q_ASSERT(!singleton); Q_ASSERT(!singleton);
singleton = this; singleton = this;
moduleMgr = new StelModuleMgr(); moduleMgr = new StelModuleMgr();
skipping to change at line 279 skipping to change at line 281
StelApp::~StelApp() StelApp::~StelApp()
{ {
qDebug() << qPrintable(QString("Downloaded %1 files (%2 kbytes) in a session of %3 sec (average of %4 kB/s + %5 files from cache (%6 kB)).").ar g(nbDownloadedFiles).arg(totalDownloadedSize/1024).arg(getTotalRunTime()).a rg((double)(totalDownloadedSize/1024)/getTotalRunTime()).arg(nbUsedCache).a rg(totalUsedCacheSize/1024)); qDebug() << qPrintable(QString("Downloaded %1 files (%2 kbytes) in a session of %3 sec (average of %4 kB/s + %5 files from cache (%6 kB)).").ar g(nbDownloadedFiles).arg(totalDownloadedSize/1024).arg(getTotalRunTime()).a rg((double)(totalDownloadedSize/1024)/getTotalRunTime()).arg(nbUsedCache).a rg(totalUsedCacheSize/1024));
stelObjectMgr->unSelect(); stelObjectMgr->unSelect();
moduleMgr->unloadModule("StelVideoMgr", false); // We need to delet e it afterward moduleMgr->unloadModule("StelVideoMgr", false); // We need to delet e it afterward
moduleMgr->unloadModule("StelSkyLayerMgr", false); // We need to de lete it afterward moduleMgr->unloadModule("StelSkyLayerMgr", false); // We need to de lete it afterward
moduleMgr->unloadModule("StelObjectMgr", false);// We need to delete it afterward moduleMgr->unloadModule("StelObjectMgr", false);// We need to delete it afterward
StelModuleMgr* tmp = moduleMgr; StelModuleMgr* tmp = moduleMgr;
moduleMgr = new StelModuleMgr(); // Create a secondary instance to a void crashes at other deinit moduleMgr = new StelModuleMgr(); // Create a secondary instance to a void crashes at other deinit
delete tmp; tmp=NULL; delete tmp; tmp=Q_NULLPTR;
delete skyImageMgr; skyImageMgr=NULL; delete skyImageMgr; skyImageMgr=Q_NULLPTR;
delete core; core=NULL; delete core; core=Q_NULLPTR;
delete skyCultureMgr; skyCultureMgr=NULL; delete skyCultureMgr; skyCultureMgr=Q_NULLPTR;
delete localeMgr; localeMgr=NULL; delete localeMgr; localeMgr=Q_NULLPTR;
delete audioMgr; audioMgr=NULL; delete audioMgr; audioMgr=Q_NULLPTR;
delete videoMgr; videoMgr=NULL; delete videoMgr; videoMgr=Q_NULLPTR;
delete stelObjectMgr; stelObjectMgr=NULL; // Delete the module by ha delete stelObjectMgr; stelObjectMgr=Q_NULLPTR; // Delete the module
nd afterward by hand afterward
delete textureMgr; textureMgr=NULL; delete textureMgr; textureMgr=Q_NULLPTR;
delete planetLocationMgr; planetLocationMgr=NULL; delete planetLocationMgr; planetLocationMgr=Q_NULLPTR;
delete moduleMgr; moduleMgr=NULL; // Delete the secondary instance delete moduleMgr; moduleMgr=Q_NULLPTR; // Delete the secondary insta
delete actionMgr; actionMgr = NULL; nce
delete propMgr; propMgr = NULL; delete actionMgr; actionMgr = Q_NULLPTR;
delete propMgr; propMgr = Q_NULLPTR;
Q_ASSERT(singleton); Q_ASSERT(singleton);
singleton = NULL; singleton = Q_NULLPTR;
} }
void StelApp::setupNetworkProxy() 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(); QString proxyType = confSettings->value("proxy/type").toString();
skipping to change at line 392 skipping to change at line 394
// 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() {} void StelApp::initScriptMgr() {}
#endif #endif
QStringList StelApp::getCommandlineArguments()
{
return qApp->property("stelCommandLine").toStringList();
}
void StelApp::init(QSettings* conf) void StelApp::init(QSettings* conf)
{ {
gl = QOpenGLContext::currentContext()->functions(); gl = QOpenGLContext::currentContext()->functions();
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( ));
core = new StelCore(); core = new StelCore();
if (saveProjW!=-1 && saveProjH!=-1) if (saveProjW!=-1 && saveProjH!=-1)
core->windowHasBeenResized(0, 0, saveProjW, saveProjH); core->windowHasBeenResized(0, 0, saveProjW, saveProjH);
// Initialize AFTER creation of openGL context // Initialize AFTER creation of openGL context
textureMgr = new StelTextureMgr(); textureMgr = new StelTextureMgr();
textureMgr->init();
networkAccessManager = new QNetworkAccessManager(this); networkAccessManager = new QNetworkAccessManager(this);
// Activate http cache if Qt version >= 4.5 // Activate http cache if Qt version >= 4.5
QNetworkDiskCache* cache = new QNetworkDiskCache(networkAccessManage r); QNetworkDiskCache* cache = new QNetworkDiskCache(networkAccessManage r);
//make maximum cache size configurable (in MB) //make maximum cache size configurable (in MB)
//the default Qt value (50 MB) is quite low, especially for DSS //the default Qt value (50 MB) is quite low, especially for DSS
cache->setMaximumCacheSize(confSettings->value("main/network_cache_s ize",300).toInt() * 1024 * 1024); cache->setMaximumCacheSize(confSettings->value("main/network_cache_s ize",300).toInt() * 1024 * 1024);
QString cachePath = StelFileMgr::getCacheDir(); QString cachePath = StelFileMgr::getCacheDir();
qDebug() << "Cache directory is: " << QDir::toNativeSeparators(cache Path); qDebug() << "Cache directory is: " << QDir::toNativeSeparators(cache Path);
skipping to change at line 483 skipping to change at line 489
// Init audio manager // Init audio manager
audioMgr = new StelAudioMgr(); audioMgr = new StelAudioMgr();
// Init video manager // Init video manager
videoMgr = new StelVideoMgr(); videoMgr = new StelVideoMgr();
videoMgr->init(); videoMgr->init();
getModuleMgr().registerModule(videoMgr); getModuleMgr().registerModule(videoMgr);
// Constellations // Constellations
ConstellationMgr* asterisms = new ConstellationMgr(hip_stars); ConstellationMgr* constellations = new ConstellationMgr(hip_stars);
constellations->init();
getModuleMgr().registerModule(constellations);
// Asterisms
AsterismMgr* asterisms = new AsterismMgr(hip_stars);
asterisms->init(); asterisms->init();
getModuleMgr().registerModule(asterisms); getModuleMgr().registerModule(asterisms);
// 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();
skipping to change at line 590 skipping to change at line 601
// 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())
{ {
if (i.loadAtStartup==false) if (i.loadAtStartup==false)
continue; continue;
StelModule* m = moduleMgr->loadPlugin(i.info.id); StelModule* m = moduleMgr->loadPlugin(i.info.id);
if (m!=NULL) if (m!=Q_NULLPTR)
{ {
moduleMgr->registerModule(m, true); moduleMgr->registerModule(m, true);
//load extensions after the module is registered
moduleMgr->loadExtensions(i.info.id);
m->init(); m->init();
} }
} }
} }
void StelApp::deinit() void StelApp::deinit()
{ {
#ifdef ENABLE_SPOUT #ifdef ENABLE_SPOUT
delete spoutSender; delete spoutSender;
spoutSender = Q_NULLPTR; spoutSender = Q_NULLPTR;
skipping to change at line 724 skipping to change at line 737
core->windowHasBeenResized(rect.x(), rect.y(), rect.width(), rect.height()); core->windowHasBeenResized(rect.x(), rect.y(), rect.width(), rect.height());
else else
{ {
saveProjW = rect.width(); saveProjW = rect.width();
saveProjH = rect.height(); saveProjH = rect.height();
} }
if (renderBuffer) if (renderBuffer)
{ {
ensureGLContextCurrent(); ensureGLContextCurrent();
delete renderBuffer; delete renderBuffer;
renderBuffer = NULL; renderBuffer = Q_NULLPTR;
} }
#ifdef ENABLE_SPOUT #ifdef ENABLE_SPOUT
if (spoutSender) if (spoutSender)
spoutSender->resize(rect.width(),rect.height()); spoutSender->resize(rect.width(),rect.height());
#endif #endif
} }
// Handle mouse clics // Handle mouse clics
void StelApp::handleClick(QMouseEvent* inputEvent) void StelApp::handleClick(QMouseEvent* inputEvent)
{ {
skipping to change at line 920 skipping to change at line 933
} }
} }
void StelApp::setViewportEffect(const QString& name) void StelApp::setViewportEffect(const QString& name)
{ {
if (name == getViewportEffect()) return; if (name == getViewportEffect()) return;
if (renderBuffer) if (renderBuffer)
{ {
ensureGLContextCurrent(); ensureGLContextCurrent();
delete renderBuffer; delete renderBuffer;
renderBuffer = NULL; renderBuffer = Q_NULLPTR;
} }
if (viewportEffect) if (viewportEffect)
{ {
delete viewportEffect; delete viewportEffect;
viewportEffect = NULL; viewportEffect = Q_NULLPTR;
} }
if (name == "none") return; if (name == "none") return;
StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams(); StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams();
int w = params.viewportXywh[2]; int w = params.viewportXywh[2];
int h = params.viewportXywh[3]; int h = params.viewportXywh[3];
if (name == "sphericMirrorDistorter") if (name == "sphericMirrorDistorter")
{ {
viewportEffect = new StelViewportDistorterFisheyeToSphericMi rror(w, h); viewportEffect = new StelViewportDistorterFisheyeToSphericMi rror(w, h);
} }
 End of changes. 18 change blocks. 
42 lines changed or deleted 56 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/