StelApp.cpp   StelApp.cpp 
skipping to change at line 40 skipping to change at line 40
#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"
#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 "StelPropertyMgr.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"
#include "StelJsonParser.hpp" #include "StelJsonParser.hpp"
#include "StelSkyLayerMgr.hpp" #include "StelSkyLayerMgr.hpp"
#include "StelAudioMgr.hpp" #include "StelAudioMgr.hpp"
#include "StelVideoMgr.hpp" #include "StelVideoMgr.hpp"
skipping to change at line 176 skipping to change at line 177
#endif #endif
#ifdef USE_STATIC_PLUGIN_OBSERVABILITY #ifdef USE_STATIC_PLUGIN_OBSERVABILITY
Q_IMPORT_PLUGIN(ObservabilityStelPluginInterface) Q_IMPORT_PLUGIN(ObservabilityStelPluginInterface)
#endif #endif
#ifdef USE_STATIC_PLUGIN_SCENERY3D #ifdef USE_STATIC_PLUGIN_SCENERY3D
Q_IMPORT_PLUGIN(Scenery3dStelPluginInterface) Q_IMPORT_PLUGIN(Scenery3dStelPluginInterface)
#endif #endif
#ifdef USE_STATIC_PLUGIN_REMOTECONTROL
Q_IMPORT_PLUGIN(RemoteControlStelPluginInterface)
#endif
#ifdef USE_STATIC_PLUGIN_REMOTESYNC
Q_IMPORT_PLUGIN(RemoteSyncStelPluginInterface)
#endif
// Initialize static variables // Initialize static variables
StelApp* StelApp::singleton = NULL; StelApp* StelApp::singleton = NULL;
qint64 StelApp::startMSecs = 0; qint64 StelApp::startMSecs = 0;
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;
} }
skipping to change at line 237 skipping to change at line 247
setObjectName("StelApp"); setObjectName("StelApp");
skyCultureMgr=NULL; skyCultureMgr=NULL;
localeMgr=NULL; localeMgr=NULL;
stelObjectMgr=NULL; stelObjectMgr=NULL;
textureMgr=NULL; textureMgr=NULL;
moduleMgr=NULL; moduleMgr=NULL;
networkAccessManager=NULL; networkAccessManager=NULL;
actionMgr = NULL; actionMgr = NULL;
propMgr = NULL;
// 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();
wheelEventTimer = new QTimer(this); wheelEventTimer = new QTimer(this);
wheelEventTimer->setInterval(25); wheelEventTimer->setInterval(25);
wheelEventTimer->setSingleShot(true); wheelEventTimer->setSingleShot(true);
skipping to change at line 260 skipping to change at line 271
} }
/************************************************************************* /*************************************************************************
Deinitialize and destroy the main Stellarium application. Deinitialize and destroy the main Stellarium application.
*************************************************************************/ *************************************************************************/
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("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=NULL;
delete skyImageMgr; skyImageMgr=NULL; delete skyImageMgr; skyImageMgr=NULL;
delete core; core=NULL; delete core; core=NULL;
delete skyCultureMgr; skyCultureMgr=NULL; delete skyCultureMgr; skyCultureMgr=NULL;
delete localeMgr; localeMgr=NULL; delete localeMgr; localeMgr=NULL;
delete audioMgr; audioMgr=NULL; delete audioMgr; audioMgr=NULL;
delete videoMgr; videoMgr=NULL; delete videoMgr; videoMgr=NULL;
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;
delete propMgr; propMgr = NULL;
Q_ASSERT(singleton); Q_ASSERT(singleton);
singleton = NULL; singleton = NULL;
} }
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();
skipping to change at line 402 skipping to change at line 415
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);
QString cachePath = StelFileMgr::getCacheDir(); QString cachePath = StelFileMgr::getCacheDir();
qDebug() << "Cache directory is: " << QDir::toNativeSeparators(cache Path); qDebug() << "Cache directory is: " << QDir::toNativeSeparators(cache Path);
cache->setCacheDirectory(cachePath); cache->setCacheDirectory(cachePath);
networkAccessManager->setCache(cache); networkAccessManager->setCache(cache);
connect(networkAccessManager, SIGNAL(finished(QNetworkReply*)), this , SLOT(reportFileDownloadFinished(QNetworkReply*))); connect(networkAccessManager, SIGNAL(finished(QNetworkReply*)), this , SLOT(reportFileDownloadFinished(QNetworkReply*)));
// Stel Object Data Base manager //create non-StelModule managers
stelObjectMgr = new StelObjectMgr(); propMgr = new StelPropertyMgr();
stelObjectMgr->init();
getModuleMgr().registerModule(stelObjectMgr);
localeMgr = new StelLocaleMgr(); localeMgr = new StelLocaleMgr();
skyCultureMgr = new StelSkyCultureMgr(); skyCultureMgr = new StelSkyCultureMgr();
propMgr->registerObject(skyCultureMgr);
planetLocationMgr = new StelLocationMgr(); planetLocationMgr = new StelLocationMgr();
actionMgr = new StelActionMgr(); actionMgr = new StelActionMgr();
// Stel Object Data Base manager
stelObjectMgr = new StelObjectMgr();
stelObjectMgr->init();
getModuleMgr().registerModule(stelObjectMgr);
localeMgr->init(); localeMgr->init();
// Init the solar system first // Init the solar system first
SolarSystem* ssystem = new SolarSystem(); SolarSystem* ssystem = new SolarSystem();
ssystem->init(); ssystem->init();
getModuleMgr().registerModule(ssystem); getModuleMgr().registerModule(ssystem);
// Load hipparcos stars & names // Load hipparcos stars & names
StarMgr* hip_stars = new StarMgr(); StarMgr* hip_stars = new StarMgr();
hip_stars->init(); hip_stars->init();
skipping to change at line 451 skipping to change at line 467
// Init sky image manager // Init sky image manager
skyImageMgr = new StelSkyLayerMgr(); skyImageMgr = new StelSkyLayerMgr();
skyImageMgr->init(); skyImageMgr->init();
getModuleMgr().registerModule(skyImageMgr); getModuleMgr().registerModule(skyImageMgr);
// 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();
getModuleMgr().registerModule(videoMgr);
// Constellations // Constellations
ConstellationMgr* asterisms = new ConstellationMgr(hip_stars); ConstellationMgr* asterisms = new ConstellationMgr(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);
skipping to change at line 497 skipping to change at line 515
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
setupNetworkProxy(); 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", "Ctrl+N");
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 setFlagSouthAzimuthUsage(confSettings->value("gui/flag_use_azimuth_f
m_south", false).toBool()); rom_south", false).toBool());
// Animation
animationScale = confSettings->value("gui/pointer_animation_speed",
1.f).toFloat();
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())
skipping to change at line 766 skipping to change at line 787
} }
// Update translations and font for sky everywhere in the program // Update translations and font for sky everywhere in the program
void StelApp::updateI18n() void StelApp::updateI18n()
{ {
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
emit(languageChanged()); emit(languageChanged());
#endif #endif
} }
// Update and reload sky culture informations everywhere in the program
void StelApp::updateSkyCulture()
{
QString skyCultureDir = getSkyCultureMgr().getCurrentSkyCultureID();
emit(skyCultureChanged(skyCultureDir));
}
// Return the time since when stellarium is running in second. // Return the time since when stellarium is running in second.
double StelApp::getTotalRunTime() double StelApp::getTotalRunTime()
{ {
return (double)(QDateTime::currentMSecsSinceEpoch() - StelApp::start MSecs)/1000.; return (double)(QDateTime::currentMSecsSinceEpoch() - StelApp::start MSecs)/1000.;
} }
// Return the scaled time since when stellarium is running in second.
double StelApp::getAnimationTime()
{
return (double)(QDateTime::currentMSecsSinceEpoch() - StelApp::start
MSecs)*StelApp::animationScale/1000.;
}
void StelApp::reportFileDownloadFinished(QNetworkReply* reply) void StelApp::reportFileDownloadFinished(QNetworkReply* reply)
{ {
bool fromCache = reply->attribute(QNetworkRequest::SourceIsFromCache Attribute).toBool(); bool fromCache = reply->attribute(QNetworkRequest::SourceIsFromCache Attribute).toBool();
if (fromCache) if (fromCache)
{ {
++nbUsedCache; ++nbUsedCache;
totalUsedCacheSize+=reply->bytesAvailable(); totalUsedCacheSize+=reply->bytesAvailable();
} }
else else
{ {
 End of changes. 14 change blocks. 
15 lines changed or deleted 37 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/