/* Init our module */ void Exoplanets::init() { try { StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir()+"/modules/Exoplanets"); // If no settings in the main config file, create with defaults if (!conf->childGroups().contains("Exoplanets")) { qDebug() << "Exoplanets::init no Exoplanets section exists in main config file - creating with defaults"; restoreDefaultConfigIni(); } // populate settings from main config file. readSettingsFromConfig(); jsonCatalogPath = StelFileMgr::findFile("modules/Exoplanets", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/exoplanets.json"; // key bindings and other actions StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); GlowIcon = new QPixmap(":/graphicsGui/glow32x32.png"); OnIcon = new QPixmap(":/Exoplanets/btExoplanets-on.png"); OffIcon = new QPixmap(":/Exoplanets/btExoplanets-off.png"); gui->getGuiAction("actionShow_Exoplanets")->setChecked(flagShowExoplanets); toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, gui->getGuiAction("actionShow_Exoplanets")); gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup"); connect(gui->getGuiAction("actionShow_Exoplanets_ConfigDialog"), SIGNAL(toggled(bool)), exoplanetsConfigDialog, SLOT(setVisible(bool))); connect(exoplanetsConfigDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Exoplanets_ConfigDialog"), SLOT(setChecked(bool))); connect(gui->getGuiAction("actionShow_Exoplanets"), SIGNAL(toggled(bool)), this, SLOT(setFlagShowExoplanets(bool))); } catch (std::runtime_error &e) { qWarning() << "Exoplanets::init error: " << e.what(); return; } // A timer for hiding alert messages messageTimer = new QTimer(this); messageTimer->setSingleShot(true); // recurring check for update messageTimer->setInterval(9000); // 6 seconds should be enough time messageTimer->stop(); connect(messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout())); // If the json file does not already exist, create it from the resource in the Qt resource if(QFileInfo(jsonCatalogPath).exists()) { if (getJsonFileVersion() < CATALOG_FORMAT_VERSION) { restoreDefaultJsonFile(); } } else { qDebug() << "Exoplanets::init catalog.json does not exist - copying default file to " << jsonCatalogPath; restoreDefaultJsonFile(); } qDebug() << "Exoplanets::init using catalog.json file: " << jsonCatalogPath; readJsonFile(); // Set up download manager and the update schedule downloadMgr = new QNetworkAccessManager(this); connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(QNetworkReply*))); updateState = CompleteNoUpdates; updateTimer = new QTimer(this); updateTimer->setSingleShot(false); // recurring check for update updateTimer->setInterval(13000); // check once every 13 seconds to see if it is time for an update connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdate())); updateTimer->start(); GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); }
/* Init our module */ void Novae::init() { try { StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir()+"/modules/Novae"); // If no settings in the main config file, create with defaults if (!conf->childGroups().contains("Novae")) { qDebug() << "Novae: no Novae section exists in main config file - creating with defaults"; restoreDefaultConfigIni(); } // populate settings from main config file. readSettingsFromConfig(); novaeJsonPath = StelFileMgr::findFile("modules/Novae", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/novae.json"; if (novaeJsonPath.isEmpty()) return; texPointer = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur2.png"); addAction("actionShow_Novae_ConfigDialog", N_("Bright Novae"), N_("Bright Novae configuration window"), configDialog, "visible"); } catch (std::runtime_error &e) { qWarning() << "Novae: init error:" << e.what(); return; } // A timer for hiding alert messages messageTimer = new QTimer(this); messageTimer->setSingleShot(true); // recurring check for update messageTimer->setInterval(9000); // 6 seconds should be enough time messageTimer->stop(); connect(messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout())); // If the json file does not already exist, create it from the resource in the Qt resource if(QFileInfo(novaeJsonPath).exists()) { if (!checkJsonFileFormat() || getJsonFileVersion()<CATALOG_FORMAT_VERSION) { restoreDefaultJsonFile(); } } else { qDebug() << "Novae: novae.json does not exist - copying default file to" << QDir::toNativeSeparators(novaeJsonPath); restoreDefaultJsonFile(); } qDebug() << "Novae: loading catalog file:" << QDir::toNativeSeparators(novaeJsonPath); readJsonFile(); // Set up download manager and the update schedule downloadMgr = new QNetworkAccessManager(this); connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(QNetworkReply*))); updateState = CompleteNoUpdates; updateTimer = new QTimer(this); updateTimer->setSingleShot(false); // recurring check for update updateTimer->setInterval(13000); // check once every 13 seconds to see if it is time for an update connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdate())); updateTimer->start(); GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); }
/* Init our module */ void Supernovae::init() { try { StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir()+"/modules/Supernovae"); // If no settings in the main config file, create with defaults if (!conf->childGroups().contains("Supernovae")) { qDebug() << "Supernovae::init no Supernovae section exists in main config file - creating with defaults"; restoreDefaultConfigIni(); } // populate settings from main config file. readSettingsFromConfig(); sneJsonPath = StelFileMgr::findFile("modules/Supernovae", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/supernovae.json"; // key bindings and other actions StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); connect(gui->getGuiAction("actionShow_Supernovae_ConfigDialog"), SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool))); connect(configDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Supernovae_ConfigDialog"), SLOT(setChecked(bool))); } catch (std::runtime_error &e) { qWarning() << "Supernovas::init error: " << e.what(); return; } // A timer for hiding alert messages messageTimer = new QTimer(this); messageTimer->setSingleShot(true); // recurring check for update messageTimer->setInterval(9000); // 6 seconds should be enough time messageTimer->stop(); connect(messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout())); // If the json file does not already exist, create it from the resource in the Qt resource if(QFileInfo(sneJsonPath).exists()) { if (!checkJsonFileFormat() || getJsonFileVersion()<CATALOG_FORMAT_VERSION) { restoreDefaultJsonFile(); } } else { qDebug() << "Supernovae::init supernovae.json does not exist - copying default file to " << QDir::toNativeSeparators(sneJsonPath); restoreDefaultJsonFile(); } qDebug() << "Supernovae::init using file: " << QDir::toNativeSeparators(sneJsonPath); readJsonFile(); // Set up download manager and the update schedule downloadMgr = new QNetworkAccessManager(this); connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(QNetworkReply*))); updateState = CompleteNoUpdates; updateTimer = new QTimer(this); updateTimer->setSingleShot(false); // recurring check for update updateTimer->setInterval(13000); // check once every 13 seconds to see if it is time for an update connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdate())); updateTimer->start(); GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); }