NebulaMgr.cpp   NebulaMgr.cpp 
skipping to change at line 399 skipping to change at line 399
} }
// Read the names of the NGC objects // Read the names of the NGC objects
QString name, record; QString name, record;
int totalRecords=0; int totalRecords=0;
int lineNumber=0; int lineNumber=0;
int readOk=0; int readOk=0;
int nb; int nb;
NebulaP e; NebulaP e;
QRegExp commentRx("^(\\s*#.*|\\s*)$"); QRegExp commentRx("^(\\s*#.*|\\s*)$");
QRegExp transRx("_[(]\"(.*)\"[)]");
while (!ngcNameFile.atEnd()) while (!ngcNameFile.atEnd())
{ {
record = QString::fromUtf8(ngcNameFile.readLine()); record = QString::fromUtf8(ngcNameFile.readLine());
lineNumber++; lineNumber++;
if (commentRx.exactMatch(record)) if (commentRx.exactMatch(record))
continue; continue;
totalRecords++; totalRecords++;
nb = record.mid(38,4).toInt(); nb = record.mid(38,4).toInt();
if (record[37] == 'I') if (record[37] == 'I')
skipping to change at line 426 skipping to change at line 427
// get name, trimmed of whitespace // get name, trimmed of whitespace
name = record.left(36).trimmed(); name = record.left(36).trimmed();
if (e) if (e)
{ {
// If the name is not a messier number perhaps one i s already // If the name is not a messier number perhaps one i s already
// defined for this object // defined for this object
if (name.left(2).toUpper() != "M ") if (name.left(2).toUpper() != "M ")
{ {
e->englishName = name; if (transRx.exactMatch(name)) {
e->englishName = transRx.capturedTex
ts().at(1).trimmed();
}
else
{
e->englishName = name;
}
} }
else else
{ {
// If it's a messiernumber, we will call it a messier if there is no better name // If it's a messiernumber, we will call it a messier if there is no better name
name = name.mid(2); // remove "M " name = name.mid(2); // remove "M "
// read the Messier number // read the Messier number
QTextStream istr(&name); QTextStream istr(&name);
int num; int num;
istr >> num; istr >> num;
skipping to change at line 462 skipping to change at line 469
ngcNameFile.close(); ngcNameFile.close();
qDebug() << "Loaded" << readOk << "/" << totalRecords << "NGC name r ecords successfully"; qDebug() << "Loaded" << readOk << "/" << totalRecords << "NGC name r ecords successfully";
return true; return true;
} }
void NebulaMgr::updateI18n() void NebulaMgr::updateI18n()
{ {
StelTranslator trans = StelApp::getInstance().getLocaleMgr().getSkyT ranslator(); StelTranslator trans = StelApp::getInstance().getLocaleMgr().getSkyT ranslator();
foreach (NebulaP n, nebArray) foreach (NebulaP n, nebArray)
n->translateName(trans); n->translateName(trans);
} }
//! Return the matching Nebula object's pointer if exists or NULL //! Return the matching Nebula object's pointer if exists or NULL
StelObjectP NebulaMgr::searchByNameI18n(const QString& nameI18n) const StelObjectP NebulaMgr::searchByNameI18n(const QString& nameI18n) const
{ {
QString objw = nameI18n.toUpper(); QString objw = nameI18n.toUpper();
// Search by NGC numbers (possible formats are "NGC31" or "NGC 31") // Search by NGC numbers (possible formats are "NGC31" or "NGC 31")
if (objw.mid(0, 3) == "NGC") if (objw.mid(0, 3) == "NGC")
{ {
 End of changes. 3 change blocks. 
2 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/