MeteorShowers.cpp   MeteorShowers.cpp 
skipping to change at line 221 skipping to change at line 221
{ {
if (ms->getNameI18n().toUpper() == nameI18n.toUpper( )) if (ms->getNameI18n().toUpper() == nameI18n.toUpper( ))
{ {
return qSharedPointerCast<StelObject>(ms); return qSharedPointerCast<StelObject>(ms);
} }
} }
} }
return NULL; return NULL;
} }
QStringList MeteorShowers::listMatchingObjectsI18n(const QString& objPrefix , int maxNbItem, bool useStartOfWords) const QStringList MeteorShowers::listMatchingObjects(const QString& objPrefix, in t maxNbItem, bool useStartOfWords, bool inEnglish) const
{ {
QStringList result; QStringList result;
if (!m_mgr->getEnablePlugin() || maxNbItem == 0) if (!m_mgr->getEnablePlugin() || maxNbItem <= 0)
{ {
return result; return result;
} }
QString sn;
bool found = false;
foreach(const MeteorShowerP& ms, m_meteorShowers) foreach(const MeteorShowerP& ms, m_meteorShowers)
{ {
if (ms->enabled()) QString name = inEnglish ? ms->getEnglishName() : ms->getNam
eI18n();
if (!ms->enabled() || !matchObjectName(name, objPrefix, useS
tartOfWords))
{ {
sn = ms->getNameI18n(); continue;
if (useStartOfWords)
{
found = sn.toUpper().left(objPrefix.length()
) == objPrefix.toUpper();
}
else
{
found = sn.contains(objPrefix, Qt::CaseInsen
sitive);
}
if (found)
{
result.append(sn);
}
} }
}
result.sort();
if (result.size() > maxNbItem)
{
result.erase(result.begin() + maxNbItem, result.end());
}
return result;
}
QStringList MeteorShowers::listMatchingObjects(const QString& objPrefix, in
t maxNbItem, bool useStartOfWords) const
{
QStringList result;
if (!m_mgr->getEnablePlugin() || maxNbItem == 0)
{
return result;
}
QString sn; result.append(name);
bool found = false; if (result.size() >= maxNbItem)
foreach(const MeteorShowerP& ms, m_meteorShowers)
{
if (ms->enabled())
{ {
sn = ms->getEnglishName(); break;
if (useStartOfWords)
{
found = objPrefix.toUpper()==sn.toUpper().le
ft(objPrefix.length());
}
else
{
found = sn.contains(objPrefix, Qt::CaseInsen
sitive);
}
if (found)
{
result.append(sn);
}
sn = ms->getDesignation();
if (useStartOfWords)
{
found = objPrefix.toUpper()==sn.toUpper().le
ft(objPrefix.length());
}
else
{
found = sn.contains(objPrefix, Qt::CaseInsen
sitive);
}
if (found)
{
result.append(sn);
}
} }
} }
result.sort(); result.sort();
if (result.size() > maxNbItem)
{
result.erase(result.begin() + maxNbItem, result.end());
}
return result; return result;
} }
QStringList MeteorShowers::listAllObjects(bool inEnglish) const QStringList MeteorShowers::listAllObjects(bool inEnglish) const
{ {
QStringList result; QStringList result;
if (!m_mgr->getEnablePlugin()) if (!m_mgr->getEnablePlugin())
{ {
return result; return result;
} }
 End of changes. 9 change blocks. 
80 lines changed or deleted 10 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/