Supernovae.cpp   Supernovae.cpp 
skipping to change at line 283 skipping to change at line 283
{ {
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, bool useStartOfWords) const
{
QStringList result;
if (maxNbItem==0)
return result;
QString snn;
bool find;
foreach(const SupernovaP& sn, snstar)
{
snn = sn->getNameI18n();
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.sort();
if (result.size()>maxNbItem)
result.erase(result.begin()+maxNbItem, result.end());
return result;
}
QStringList Supernovae::listMatchingObjects(const QString& objPrefix, int m
axNbItem, bool useStartOfWords) const
{
QStringList result;
if (maxNbItem==0)
return result;
QString snn;
bool find;
foreach(const SupernovaP& sn, snstar)
{
snn = sn->getEnglishName();
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.sort();
if (result.size()>maxNbItem)
result.erase(result.begin()+maxNbItem, result.end());
return result;
}
QStringList Supernovae::listAllObjects(bool inEnglish) const QStringList Supernovae::listAllObjects(bool inEnglish) const
{ {
QStringList result; QStringList result;
if (inEnglish) if (inEnglish)
{ {
foreach (const SupernovaP& sn, snstar) foreach (const SupernovaP& sn, snstar)
{ {
result << sn->getEnglishName(); result << sn->getEnglishName();
} }
} }
skipping to change at line 731 skipping to change at line 661
QList<double> vals = snlist.values(); QList<double> vals = snlist.values();
qSort(vals); qSort(vals);
foreach(double val, vals) foreach(double val, vals)
{ {
StelUtils::getDateFromJulianDay(val, &year, &month, &day); StelUtils::getDateFromJulianDay(val, &year, &month, &day);
out << QString("%1 (%2 %3)").arg(snlist.key(val)).arg(day).a rg(smonth[month-1]); out << QString("%1 (%2 %3)").arg(snlist.key(val)).arg(day).a rg(smonth[month-1]);
} }
return out.join(", "); return out.join(", ");
} }
void Supernovae::reloadCatalog(void)
{
bool hasSelection = false;
StelObjectMgr* objMgr = GETSTELMODULE(StelObjectMgr);
// Whether any supernova are selected? Save the current selection...
const QList<StelObjectP> selectedObject = objMgr->getSelectedObject(
"Supernova");
if (!selectedObject.isEmpty())
{
// ... unselect current supernova.
hasSelection = true;
objMgr->unSelect();
}
readJsonFile();
if (hasSelection)
{
// Restore selection...
objMgr->setSelectedObject(selectedObject);
}
}
 End of changes. 2 change blocks. 
74 lines changed or deleted 0 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/