MeteorShowers.cpp   MeteorShowers.cpp 
skipping to change at line 98 skipping to change at line 98
, updatesEnabled(false) , updatesEnabled(false)
, updateFrequencyHours(0) , updateFrequencyHours(0)
, enableAtStartup(false) , enableAtStartup(false)
, flagShowARG(true) , flagShowARG(true)
, flagShowARR(true) , flagShowARR(true)
, flagShowIR(true) , flagShowIR(true)
{ {
setObjectName("MeteorShowers"); setObjectName("MeteorShowers");
configDialog = new MeteorShowerDialog(); configDialog = new MeteorShowerDialog();
conf = StelApp::getInstance().getSettings(); conf = StelApp::getInstance().getSettings();
qsrand(QDateTime::currentMSecsSinceEpoch());
} }
/* /*
Destructor Destructor
*/ */
MeteorShowers::~MeteorShowers() MeteorShowers::~MeteorShowers()
{ {
delete configDialog; delete configDialog;
if (GlowIcon) if (GlowIcon)
skipping to change at line 166 skipping to change at line 167
showersJsonPath = StelFileMgr::findFile("modules/MeteorShowe rs", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/showers.json"; showersJsonPath = StelFileMgr::findFile("modules/MeteorShowe rs", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/showers.json";
texPointer = StelApp::getInstance().getTextureManager().crea teTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur5.png"); texPointer = StelApp::getInstance().getTextureManager().crea teTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur5.png");
MeteorShower::radiantTexture = StelApp::getInstance().getTex tureManager().createTexture(":/MeteorShowers/radiant.png"); MeteorShower::radiantTexture = StelApp::getInstance().getTex tureManager().createTexture(":/MeteorShowers/radiant.png");
// key bindings and other actions // key bindings and other actions
QString msGroup = N_("Meteor Showers"); QString msGroup = N_("Meteor Showers");
addAction("actionShow_MeteorShower", msGroup, N_("Show meteo r showers"), "msVisible", "Ctrl+Alt+M"); addAction("actionShow_MeteorShower", msGroup, N_("Show meteo r showers"), "msVisible", "Ctrl+Alt+M");
addAction("actionShow_radiant_Labels", msGroup, N_("Radiant labels"), "labelsVisible", "Shift+M"); addAction("actionShow_radiant_Labels", msGroup, N_("Radiant labels"), "labelsVisible", "Shift+M");
addAction("actionShow_MeteorShower_ConfigDialog", msGroup, N _("Meteor Shower configuration window"), configDialog, "visible", "Alt+M"); addAction("actionShow_MeteorShower_ConfigDialog", msGroup, N _("Meteor Shower configuration window"), configDialog, "visible", "Ctrl+Shi ft+M");
GlowIcon = new QPixmap(":/graphicGui/glow32x32.png"); GlowIcon = new QPixmap(":/graphicGui/glow32x32.png");
OnIcon = new QPixmap(":/MeteorShowers/btMS-on.png"); OnIcon = new QPixmap(":/MeteorShowers/btMS-on.png");
OffIcon = new QPixmap(":/MeteorShowers/btMS-off.png"); OffIcon = new QPixmap(":/MeteorShowers/btMS-off.png");
setFlagShowMSButton(flagShowMSButton); setFlagShowMSButton(flagShowMSButton);
setFlagShowMS(getEnableAtStartup()); setFlagShowMS(getEnableAtStartup());
} }
catch(std::runtime_error &e) catch(std::runtime_error &e)
{ {
skipping to change at line 191 skipping to change at line 192
// A timer for hiding alert messages // A timer for hiding alert messages
messageTimer = new QTimer(this); messageTimer = new QTimer(this);
messageTimer->setSingleShot(true); // recurring check for update messageTimer->setSingleShot(true); // recurring check for update
messageTimer->setInterval(9000); // 6 seconds should be enough time messageTimer->setInterval(9000); // 6 seconds should be enough time
messageTimer->stop(); messageTimer->stop();
connect(messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout() )); connect(messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout() ));
// If the json file does not already exist, create it from the resou rce in the QT resource // If the json file does not already exist, create it from the resou rce in the QT resource
if (!QFileInfo(showersJsonPath).exists()) if (!QFileInfo(showersJsonPath).exists())
{ {
if (!checkJsonFileFormat() || getJsonFileFormatVersion()<CAT qDebug() << "MeteorShowers: showers.json does not exist - co
ALOG_FORMAT_VERSION) pying default file to" << QDir::toNativeSeparators(showersJsonPath);
{ restoreDefaultJsonFile();
displayMessage(q_("The old showers.json file is no l }
onger compatible - using default file"), "#bb0000"); // Validate JSON format and data
restoreDefaultJsonFile(); if (!checkJsonFileFormat() || getJsonFileFormatVersion()<CATALOG_FOR
} MAT_VERSION)
else {
{ displayMessage(q_("The old showers.json file is no longer co
qDebug() << "MeteorShowers: showers.json does not ex mpatible - using default file"), "#bb0000");
ist - copying default file to" << QDir::toNativeSeparators(showersJsonPath) restoreDefaultJsonFile();
;
restoreDefaultJsonFile();
}
} }
qDebug() << "MeteorShowers: loading catalog file:" << QDir::toNative Separators(showersJsonPath); qDebug() << "MeteorShowers: loading catalog file:" << QDir::toNative Separators(showersJsonPath);
// create meteor Showers according to content os Showers.json file // create meteor Showers according to content os Showers.json file
readJsonFile(); readJsonFile();
// Set up download manager and the update schedule // Set up download manager and the update schedule
downloadMgr = new QNetworkAccessManager(this); downloadMgr = new QNetworkAccessManager(this);
connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(up dateDownloadComplete(QNetworkReply*))); connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(up dateDownloadComplete(QNetworkReply*)));
skipping to change at line 615 skipping to change at line 614
// determine average meteors per frame needing to be created // determine average meteors per frame needing to be created
int mpf = (int)((double)ZHR*zhrToWsr*deltaTime/1000.0 + 0.5) ; int mpf = (int)((double)ZHR*zhrToWsr*deltaTime/1000.0 + 0.5) ;
if (mpf<1) if (mpf<1)
{ {
mpf = 1; mpf = 1;
} }
for (int i=0; i<mpf; ++i) for (int i=0; i<mpf; ++i)
{ {
// start new meteor based on ZHR time probability // start new meteor based on ZHR time probability
double prob = ((double)rand())/RAND_MAX; double prob = ((double)qrand())/RAND_MAX;
if (ZHR>0 && prob<((double)ZHR*zhrToWsr*deltaTime/10 00.0/(double)mpf)) if (ZHR>0 && prob<((double)ZHR*zhrToWsr*deltaTime/10 00.0/(double)mpf))
{ {
MeteorStream *m = new MeteorStream(core, MeteorStream *m = new MeteorStream(core,
current.s peed, current.s peed,
current.r adiantAlpha, current.r adiantAlpha,
current.r adiantDelta, current.r adiantDelta,
current.p idx, current.p idx,
current.c olors); current.c olors);
active[index].push_back(m); active[index].push_back(m);
} }
skipping to change at line 926 skipping to change at line 925
readSettingsFromConfig(); readSettingsFromConfig();
} }
void MeteorShowers::restoreDefaultConfigIni(void) void MeteorShowers::restoreDefaultConfigIni(void)
{ {
conf->beginGroup("MeteorShowers"); conf->beginGroup("MeteorShowers");
// delete all existing MeteorShower settings... // delete all existing MeteorShower settings...
conf->remove(""); conf->remove("");
conf->setValue("enable_at_startup", false); conf->setValue("enable_at_startup", true);
conf->setValue("updates_enabled", true); conf->setValue("updates_enabled", true);
conf->setValue("url", "http://stellarium.org/json/showers.json"); conf->setValue("url", "http://stellarium.org/json/showers.json");
conf->setValue("update_frequency_hours", 100); conf->setValue("update_frequency_hours", 100);
conf->setValue("flag_show_ms_button", true); conf->setValue("flag_show_ms_button", true);
conf->setValue("flag_show_radiants", true); conf->setValue("flag_show_radiants", true);
conf->setValue("flag_active_radiants", false); conf->setValue("flag_active_radiants", true);
conf->setValue("colorARG", "0, 255, 240"); conf->setValue("colorARG", "0, 255, 240");
conf->setValue("colorARR", "255, 240, 0"); conf->setValue("colorARR", "255, 240, 0");
conf->setValue("colorIR", "255, 255, 255"); conf->setValue("colorIR", "255, 255, 255");
conf->setValue("show_radiant_labels", true); conf->setValue("show_radiant_labels", true);
conf->endGroup(); conf->endGroup();
} }
skipping to change at line 1060 skipping to change at line 1059
} }
void MeteorShowers::readSettingsFromConfig(void) void MeteorShowers::readSettingsFromConfig(void)
{ {
conf->beginGroup("MeteorShowers"); conf->beginGroup("MeteorShowers");
updateUrl = conf->value("url", "http://stellarium.org/json/showers.j son").toString(); updateUrl = conf->value("url", "http://stellarium.org/json/showers.j son").toString();
updateFrequencyHours = conf->value("update_frequency_hours", 720).to Int(); updateFrequencyHours = conf->value("update_frequency_hours", 720).to Int();
lastUpdate = QDateTime::fromString(conf->value("last_update", "2013- 12-10T12:00:00").toString(), Qt::ISODate); lastUpdate = QDateTime::fromString(conf->value("last_update", "2013- 12-10T12:00:00").toString(), Qt::ISODate);
updatesEnabled = conf->value("updates_enabled", true).toBool(); updatesEnabled = conf->value("updates_enabled", true).toBool();
enableAtStartup = conf->value("enable_at_startup", false).toBool(); enableAtStartup = conf->value("enable_at_startup", true).toBool();
flagShowMSButton = conf->value("flag_show_ms_button", true).toBool() ; flagShowMSButton = conf->value("flag_show_ms_button", true).toBool() ;
setFlagRadiant(conf->value("flag_show_radiants", true).toBool()); setFlagRadiant(conf->value("flag_show_radiants", true).toBool());
setFlagActiveRadiant(conf->value("flag_active_radiants", false).toBo ol()); setFlagActiveRadiant(conf->value("flag_active_radiants", true).toBoo l());
Vec3f color; Vec3f color;
color = StelUtils::strToVec3f(conf->value("colorARG", "0, 255, 240") .toString()); color = StelUtils::strToVec3f(conf->value("colorARG", "0, 255, 240") .toString());
colorARG = QColor(color[0],color[1],color[2]); colorARG = QColor(color[0],color[1],color[2]);
color = StelUtils::strToVec3f(conf->value("colorARR", "255, 240, 0") .toString()); color = StelUtils::strToVec3f(conf->value("colorARR", "255, 240, 0") .toString());
colorARR = QColor(color[0],color[1],color[2]); colorARR = QColor(color[0],color[1],color[2]);
color = StelUtils::strToVec3f(conf->value("colorIR", "255, 255, 255" ).toString()); color = StelUtils::strToVec3f(conf->value("colorIR", "255, 255, 255" ).toString());
colorIR = QColor(color[0],color[1],color[2]); colorIR = QColor(color[0],color[1],color[2]);
MeteorShower::showLabels = conf->value("show_radiant_labels", true). toBool(); MeteorShower::showLabels = conf->value("show_radiant_labels", true). toBool();
 End of changes. 8 change blocks. 
20 lines changed or deleted 18 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/