StelApp.cpp   StelApp.cpp 
skipping to change at line 29 skipping to change at line 29
#include "StelApp.hpp" #include "StelApp.hpp"
#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 "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"
#include "StelIniParser.hpp" #include "StelIniParser.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelLocationMgr.hpp" #include "StelLocationMgr.hpp"
#include "ToastMgr.hpp"
#include "StelActionMgr.hpp" #include "StelActionMgr.hpp"
#include "StelPropertyMgr.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"
#include "StelViewportEffect.hpp" #include "StelViewportEffect.hpp"
skipping to change at line 80 skipping to change at line 81
#include <QOpenGLFramebufferObject> #include <QOpenGLFramebufferObject>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QSysInfo> #include <QSysInfo>
#include <QTextStream> #include <QTextStream>
#include <QTimer> #include <QTimer>
#include <QDir> #include <QDir>
#include <QCoreApplication> #include <QCoreApplication>
#include <QScreen> #include <QScreen>
#include <QDateTime> #include <QDateTime>
#ifdef ENABLE_SPOUT
#include <QMessageBox>
#include "SpoutSender.hpp"
#endif
#ifdef USE_STATIC_PLUGIN_HELLOSTELMODULE #ifdef USE_STATIC_PLUGIN_HELLOSTELMODULE
Q_IMPORT_PLUGIN(HelloStelModuleStelPluginInterface) Q_IMPORT_PLUGIN(HelloStelModuleStelPluginInterface)
#endif #endif
#ifdef USE_STATIC_PLUGIN_SIMPLEDRAWLINE #ifdef USE_STATIC_PLUGIN_SIMPLEDRAWLINE
Q_IMPORT_PLUGIN(SimpleDrawLineStelPluginInterface) Q_IMPORT_PLUGIN(SimpleDrawLineStelPluginInterface)
#endif #endif
#ifdef USE_STATIC_PLUGIN_ANGLEMEASURE #ifdef USE_STATIC_PLUGIN_ANGLEMEASURE
skipping to change at line 125 skipping to change at line 130
#endif #endif
#ifdef USE_STATIC_PLUGIN_TELESCOPECONTROL #ifdef USE_STATIC_PLUGIN_TELESCOPECONTROL
Q_IMPORT_PLUGIN(TelescopeControlStelPluginInterface) Q_IMPORT_PLUGIN(TelescopeControlStelPluginInterface)
#endif #endif
#ifdef USE_STATIC_PLUGIN_SOLARSYSTEMEDITOR #ifdef USE_STATIC_PLUGIN_SOLARSYSTEMEDITOR
Q_IMPORT_PLUGIN(SolarSystemEditorStelPluginInterface) Q_IMPORT_PLUGIN(SolarSystemEditorStelPluginInterface)
#endif #endif
#ifdef USE_STATIC_PLUGIN_TIMEZONECONFIGURATION
Q_IMPORT_PLUGIN(TimeZoneConfigurationStelPluginInterface)
#endif
#ifdef USE_STATIC_PLUGIN_METEORSHOWERS #ifdef USE_STATIC_PLUGIN_METEORSHOWERS
Q_IMPORT_PLUGIN(MeteorShowersStelPluginInterface) Q_IMPORT_PLUGIN(MeteorShowersStelPluginInterface)
#endif #endif
#ifdef USE_STATIC_PLUGIN_NAVSTARS #ifdef USE_STATIC_PLUGIN_NAVSTARS
Q_IMPORT_PLUGIN(NavStarsStelPluginInterface) Q_IMPORT_PLUGIN(NavStarsStelPluginInterface)
#endif #endif
#ifdef USE_STATIC_PLUGIN_NOVAE #ifdef USE_STATIC_PLUGIN_NOVAE
Q_IMPORT_PLUGIN(NovaeStelPluginInterface) Q_IMPORT_PLUGIN(NovaeStelPluginInterface)
skipping to change at line 206 skipping to change at line 207
{ {
StelApp::startMSecs = 0; StelApp::startMSecs = 0;
} }
/************************************************************************* /*************************************************************************
Create and initialize the main Stellarium application. Create and initialize the main Stellarium application.
*************************************************************************/ *************************************************************************/
StelApp::StelApp(QObject* parent) StelApp::StelApp(QObject* parent)
: QObject(parent) : QObject(parent)
, core(NULL) , core(NULL)
, moduleMgr(NULL)
, localeMgr(NULL)
, skyCultureMgr(NULL)
, actionMgr(NULL)
, propMgr(NULL)
, textureMgr(NULL)
, stelObjectMgr(NULL)
, planetLocationMgr(NULL) , planetLocationMgr(NULL)
, networkAccessManager(NULL)
, audioMgr(NULL) , audioMgr(NULL)
, videoMgr(NULL) , videoMgr(NULL)
, skyImageMgr(NULL) , skyImageMgr(NULL)
#ifndef DISABLE_SCRIPTING #ifndef DISABLE_SCRIPTING
, scriptAPIProxy(NULL) , scriptAPIProxy(NULL)
, scriptMgr(NULL) , scriptMgr(NULL)
#endif #endif
, stelGui(NULL) , stelGui(NULL)
, devicePixelsPerPixel(1.f) , devicePixelsPerPixel(1.f)
, globalScalingRatio(1.f) , globalScalingRatio(1.f)
, fps(0) , fps(0)
, frame(0) , frame(0)
, timefr(0.) , timefr(0.)
, timeBase(0.) , timeBase(0.)
, flagNightVision(false) , flagNightVision(false)
, confSettings(NULL) , confSettings(NULL)
, initialized(false) , initialized(false)
, saveProjW(-1) , saveProjW(-1)
, saveProjH(-1) , saveProjH(-1)
, nbDownloadedFiles(0)
, totalDownloadedSize(0)
, nbUsedCache(0)
, totalUsedCacheSize(0)
, baseFontSize(13) , baseFontSize(13)
, renderBuffer(NULL) , renderBuffer(NULL)
, viewportEffect(NULL) , viewportEffect(NULL)
, flagShowDecimalDegrees(false) , flagShowDecimalDegrees(false)
, flagUseAzimuthFromSouth(false) , flagUseAzimuthFromSouth(false)
#ifdef ENABLE_SPOUT
, spoutSender(NULL)
#endif
{ {
// Stat variables
nbDownloadedFiles=0;
totalDownloadedSize=0;
nbUsedCache=0;
totalUsedCacheSize=0;
setObjectName("StelApp"); setObjectName("StelApp");
skyCultureMgr=NULL;
localeMgr=NULL;
stelObjectMgr=NULL;
textureMgr=NULL;
moduleMgr=NULL;
networkAccessManager=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 408 skipping to change at line 409
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(); 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)
//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);
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*)));
//create non-StelModule managers //create non-StelModule managers
propMgr = new StelPropertyMgr(); propMgr = new StelPropertyMgr();
localeMgr = new StelLocaleMgr(); localeMgr = new StelLocaleMgr();
skipping to change at line 462 skipping to change at line 466
// Init zodiacal light // Init zodiacal light
ZodiacalLight* zodiacal_light = new ZodiacalLight(); ZodiacalLight* zodiacal_light = new ZodiacalLight();
zodiacal_light->init(); zodiacal_light->init();
getModuleMgr().registerModule(zodiacal_light); getModuleMgr().registerModule(zodiacal_light);
// Init sky image manager // Init sky image manager
skyImageMgr = new StelSkyLayerMgr(); skyImageMgr = new StelSkyLayerMgr();
skyImageMgr->init(); skyImageMgr->init();
getModuleMgr().registerModule(skyImageMgr); getModuleMgr().registerModule(skyImageMgr);
// Toast surveys
ToastMgr* toasts = new ToastMgr();
toasts->init();
getModuleMgr().registerModule(toasts);
// 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* asterisms = new ConstellationMgr(hip_stars);
skipping to change at line 496 skipping to change at line 505
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();
// Init custom objects
CustomObjectMgr* custObj = new CustomObjectMgr();
custObj->init();
getModuleMgr().registerModule(custObj);
//Create the script manager here, maybe some modules/plugins may wan t to connect to it //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 //It has to be initialized later after all modules have been loaded by calling initScriptMgr
#ifndef DISABLE_SCRIPTING #ifndef DISABLE_SCRIPTING
scriptAPIProxy = new StelMainScriptAPIProxy(this); scriptAPIProxy = new StelMainScriptAPIProxy(this);
scriptMgr = new StelScriptMgr(this); scriptMgr = new StelScriptMgr(this);
#endif #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( ));
skipping to change at line 523 skipping to change at line 537
// Init actions. // Init actions.
actionMgr->addAction("actionShow_Night_Mode", N_("Display Options"), N_("Night mode"), this, "nightMode", "Ctrl+N"); 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());
setFlagSouthAzimuthUsage(confSettings->value("gui/flag_use_azimuth_f rom_south", false).toBool()); setFlagSouthAzimuthUsage(confSettings->value("gui/flag_use_azimuth_f rom_south", false).toBool());
// Animation // Animation
animationScale = confSettings->value("gui/pointer_animation_speed", 1.f).toFloat(); animationScale = confSettings->value("gui/pointer_animation_speed", 1.f).toFloat();
#ifdef ENABLE_SPOUT
//qDebug() << "Property spout is" << qApp->property("spout").toStrin
g();
//qDebug() << "Property spoutName is" << qApp->property("spoutName")
.toString();
if (qApp->property("spout").toString() != "none")
{
//if we are on windows and we have GLES, we are most likely
on ANGLE
bool isANGLE=QOpenGLContext::currentContext()->isOpenGLES();
if (isANGLE)
{
qCritical() << "SPOUT: Does not run in ANGLE/OpenGL
ES mode!";
}
else
{
// Create the SpoutSender object.
QString spoutName = qApp->property("spoutName").toSt
ring();
if(spoutName.isEmpty())
spoutName = "stellarium";
spoutSender = new SpoutSender(spoutName);
if (!spoutSender->isValid())
{
QMessageBox::warning(0, "Stellarium SPOUT",
q_("Cannot create Spout sender. See log for details."), QMessageBox::Ok);
delete spoutSender;
spoutSender = Q_NULLPTR;
qApp->setProperty("spout", "");
}
}
}
else
{
qApp->setProperty("spout", "");
}
#endif
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 546 skipping to change at line 597
if (m!=NULL) if (m!=NULL)
{ {
moduleMgr->registerModule(m, true); moduleMgr->registerModule(m, true);
m->init(); m->init();
} }
} }
} }
void StelApp::deinit() void StelApp::deinit()
{ {
#ifdef ENABLE_SPOUT
delete spoutSender;
spoutSender = Q_NULLPTR;
#endif
#ifndef DISABLE_SCRIPTING #ifndef DISABLE_SCRIPTING
if (scriptMgr->scriptIsRunning()) if (scriptMgr->scriptIsRunning())
scriptMgr->stopScript(); scriptMgr->stopScript();
#endif #endif
QCoreApplication::processEvents(); QCoreApplication::processEvents();
getModuleMgr().unloadAllPlugins(); getModuleMgr().unloadAllPlugins();
QCoreApplication::processEvents(); QCoreApplication::processEvents();
StelPainter::deinitGLShaders(); StelPainter::deinitGLShaders();
} }
StelProgressController* StelApp::addProgressBar() StelProgressController* StelApp::addProgressBar()
{ {
StelProgressController* p = new StelProgressController(); StelProgressController* p = new StelProgressController();
progressControllers.append(p); progressControllers.append(p);
emit(progressBarAdded(p)); emit(progressBarAdded(p));
return p; return p;
} }
skipping to change at line 614 skipping to change at line 668
{ {
StelProjector::StelProjectorParams params = core->getCurrent StelProjectorParams(); StelProjector::StelProjectorParams params = core->getCurrent StelProjectorParams();
int w = params.viewportXywh[2]; int w = params.viewportXywh[2];
int h = params.viewportXywh[3]; int h = params.viewportXywh[3];
viewportEffect = new StelViewportDistorterFisheyeToSphericMi rror(w, h); viewportEffect = new StelViewportDistorterFisheyeToSphericMi rror(w, h);
renderBuffer = new QOpenGLFramebufferObject(w, h, QOpenGLFra mebufferObject::CombinedDepthStencil); renderBuffer = new QOpenGLFramebufferObject(w, h, QOpenGLFra mebufferObject::CombinedDepthStencil);
} }
renderBuffer->bind(); renderBuffer->bind();
} }
void StelApp::applyRenderBuffer() void StelApp::applyRenderBuffer(int drawFbo)
{ {
if (!renderBuffer) return; if (!renderBuffer) return;
renderBuffer->release(); renderBuffer->release();
if (drawFbo) GL(glBindFramebuffer(GL_FRAMEBUFFER, drawFbo));
viewportEffect->paintViewportBuffer(renderBuffer); viewportEffect->paintViewportBuffer(renderBuffer);
} }
//! Main drawing function called at each frame //! Main drawing function called at each frame
void StelApp::draw() void StelApp::draw()
{ {
if (!initialized) if (!initialized)
return; return;
int drawFbo;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &drawFbo);
prepareRenderBuffer(); prepareRenderBuffer();
core->preDraw(); core->preDraw();
const QList<StelModule*> modules = moduleMgr->getCallOrders(StelModu le::ActionDraw); const QList<StelModule*> modules = moduleMgr->getCallOrders(StelModu le::ActionDraw);
foreach(StelModule* module, modules) foreach(StelModule* module, modules)
{ {
module->draw(core); module->draw(core);
} }
core->postDraw(); core->postDraw();
applyRenderBuffer(); #ifdef ENABLE_SPOUT
// At this point, the sky scene has been drawn, but no GUI panels.
if(spoutSender)
spoutSender->captureAndSendFrame(drawFbo);
#endif
applyRenderBuffer(drawFbo);
} }
/************************************************************************* /*************************************************************************
Call this when the size of the GL window has changed Call this when the size of the GL window has changed
*************************************************************************/ *************************************************************************/
void StelApp::glWindowHasBeenResized(float x, float y, float w, float h) void StelApp::glWindowHasBeenResized(float x, float y, float w, float h)
{ {
if (core) if (core)
core->windowHasBeenResized(x, y, w, h); core->windowHasBeenResized(x, y, w, h);
else else
{ {
saveProjW = w; saveProjW = w;
saveProjH = h; saveProjH = h;
} }
if (renderBuffer) if (renderBuffer)
{ {
delete renderBuffer; delete renderBuffer;
renderBuffer = NULL; renderBuffer = NULL;
} }
#ifdef ENABLE_SPOUT
if (spoutSender)
spoutSender->resize(w,h);
#endif
} }
// Handle mouse clics // Handle mouse clics
void StelApp::handleClick(QMouseEvent* inputEvent) void StelApp::handleClick(QMouseEvent* inputEvent)
{ {
QPointF pos = inputEvent->pos(); QPointF pos = inputEvent->pos();
float x, y; float x, y;
x = pos.x(); x = pos.x();
y = pos.y(); y = pos.y();
if (viewportEffect) if (viewportEffect)
skipping to change at line 867 skipping to change at line 936
Q_ASSERT(false); Q_ASSERT(false);
} }
} }
QString StelApp::getViewportEffect() const QString StelApp::getViewportEffect() const
{ {
if (viewportEffect) if (viewportEffect)
return viewportEffect->getName(); return viewportEffect->getName();
return "none"; return "none";
} }
// Diagnostics
void StelApp::dumpModuleActionPriorities(StelModule::StelModuleActionName a
ctionName)
{
const QList<StelModule*> modules = moduleMgr->getCallOrders(actionNa
me);
#if QT_VERSION >= 0x050500
QMetaEnum me = QMetaEnum::fromType<StelModule::StelModuleActionName>
();
qDebug() << "Module Priorities for action named" << me.valueToKey(ac
tionName);
#else
qDebug() << "Module Priorities for action named" << actionName;
#endif
foreach(StelModule* module, modules)
{
module->draw(core);
qDebug() << " -- " << module->getCallOrder(actionName) << "M
odule: " << module->objectName();
}
}
 End of changes. 23 change blocks. 
23 lines changed or deleted 99 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/