Supernovae.cpp   Supernovae.cpp 
skipping to change at line 75 skipping to change at line 75
StelPluginInfo SupernovaeStelPluginInterface::getPluginInfo() const StelPluginInfo SupernovaeStelPluginInterface::getPluginInfo() const
{ {
Q_INIT_RESOURCE(Supernovae); Q_INIT_RESOURCE(Supernovae);
StelPluginInfo info; StelPluginInfo info;
info.id = "Supernovae"; info.id = "Supernovae";
info.displayedName = N_("Historical Supernovae"); info.displayedName = N_("Historical Supernovae");
info.authors = "Alexander Wolf"; info.authors = "Alexander Wolf";
info.contact = "alex.v.wolf@gmail.com"; info.contact = "alex.v.wolf@gmail.com";
info.description = N_("A plugin that shows some historical supernova e brighter than 10 visual magnitude."); info.description = N_("This plugin allows you to see some bright his torical supernovae.");
return info; return info;
} }
Q_EXPORT_PLUGIN2(Supernovae, SupernovaeStelPluginInterface) Q_EXPORT_PLUGIN2(Supernovae, SupernovaeStelPluginInterface)
/* /*
Constructor Constructor
*/ */
Supernovae::Supernovae() Supernovae::Supernovae()
: texPointer(NULL) : texPointer(NULL)
skipping to change at line 287 skipping to change at line 287
{ {
foreach(const SupernovaP& sn, snstar) foreach(const SupernovaP& sn, snstar)
{ {
if (sn->getNameI18n().toUpper() == nameI18n.toUpper()) if (sn->getNameI18n().toUpper() == nameI18n.toUpper())
return qSharedPointerCast<StelObject>(sn); return qSharedPointerCast<StelObject>(sn);
} }
return NULL; return NULL;
} }
QStringList Supernovae::listMatchingObjectsI18n(const QString& objPrefix, i nt maxNbItem) const QStringList Supernovae::listMatchingObjectsI18n(const QString& objPrefix, i nt maxNbItem, bool useStartOfWords) const
{ {
QStringList result; QStringList result;
if (maxNbItem==0) if (maxNbItem==0)
return result; return result;
QString snn; QString snn;
bool find;
foreach(const SupernovaP& sn, snstar) foreach(const SupernovaP& sn, snstar)
{ {
snn = sn->getNameI18n(); snn = sn->getNameI18n();
if (snn.contains(objPrefix, Qt::CaseInsensitive)) find = false;
if (useStartOfWords)
{
if (objPrefix.toUpper()==snn.toUpper().left(objPrefi
x.length()))
find = true;
}
else
{
if (snn.contains(objPrefix, Qt::CaseInsensitive))
find = true;
}
if (find)
{ {
result << snn; result << snn;
} }
} }
result.sort(); result.sort();
if (result.size()>maxNbItem) if (result.size()>maxNbItem)
result.erase(result.begin()+maxNbItem, result.end()); result.erase(result.begin()+maxNbItem, result.end());
return result; return result;
} }
QStringList Supernovae::listMatchingObjects(const QString& objPrefix, int m axNbItem) const QStringList Supernovae::listMatchingObjects(const QString& objPrefix, int m axNbItem, bool useStartOfWords) const
{ {
QStringList result; QStringList result;
if (maxNbItem==0) if (maxNbItem==0)
return result; return result;
QString snn; QString snn;
bool find;
foreach(const SupernovaP& sn, snstar) foreach(const SupernovaP& sn, snstar)
{ {
snn = sn->getEnglishName(); snn = sn->getEnglishName();
if (snn.contains(objPrefix, Qt::CaseInsensitive)) find = false;
if (useStartOfWords)
{
if (objPrefix.toUpper()==snn.toUpper().left(objPrefi
x.length()))
find = true;
}
else
{
if (snn.contains(objPrefix, Qt::CaseInsensitive))
find = true;
}
if (find)
{ {
result << snn; result << snn;
} }
} }
result.sort(); result.sort();
if (result.size()>maxNbItem) if (result.size()>maxNbItem)
result.erase(result.begin()+maxNbItem, result.end()); result.erase(result.begin()+maxNbItem, result.end());
return result; return result;
skipping to change at line 489 skipping to change at line 513
if (map.contains("version")) if (map.contains("version"))
{ {
jsonVersion = map.value("version").toInt(); jsonVersion = map.value("version").toInt();
} }
sneJsonFile.close(); sneJsonFile.close();
qDebug() << "Supernovae::getJsonFileVersion() version from file:" << jsonVersion; qDebug() << "Supernovae::getJsonFileVersion() version from file:" << jsonVersion;
return jsonVersion; return jsonVersion;
} }
float Supernovae::getLowerLimitBrightness()
{
float lowerLimit = 10.f;
QFile sneJsonFile(sneJsonPath);
if (!sneJsonFile.open(QIODevice::ReadOnly))
{
qWarning() << "Supernovae::init cannot open " << QDir::toNat
iveSeparators(sneJsonPath);
return lowerLimit;
}
QVariantMap map;
map = StelJsonParser::parse(&sneJsonFile).toMap();
if (map.contains("limit"))
{
lowerLimit = map.value("limit").toFloat();
}
sneJsonFile.close();
return lowerLimit;
}
SupernovaP Supernovae::getByID(const QString& id) SupernovaP Supernovae::getByID(const QString& id)
{ {
foreach(const SupernovaP& sn, snstar) foreach(const SupernovaP& sn, snstar)
{ {
if (sn->initialized && sn->designation == id) if (sn->initialized && sn->designation == id)
return sn; return sn;
} }
return SupernovaP(); return SupernovaP();
} }
 End of changes. 8 change blocks. 
5 lines changed or deleted 53 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/