StelLocaleMgr.cpp   StelLocaleMgr.cpp 
skipping to change at line 64 skipping to change at line 64
QDataStream in(&file); // read the data serialized from the file QDataStream in(&file); // read the data serialized from the file
in.setVersion(QDataStream::Qt_5_2); in.setVersion(QDataStream::Qt_5_2);
in >> countryCodeToStringMap; in >> countryCodeToStringMap;
file.close(); file.close();
} }
} }
StelLocaleMgr::~StelLocaleMgr() StelLocaleMgr::~StelLocaleMgr()
{ {
delete skyTranslator; delete skyTranslator;
skyTranslator=0; skyTranslator=NULL;
} }
// Mehtod which generates and save the map between 2 letters country code a nd english country names // Mehtod which generates and save the map between 2 letters country code a nd english country names
void StelLocaleMgr::generateCountryList() void StelLocaleMgr::generateCountryList()
{ {
// Load ISO 3166-1 two-letter country codes from file (slow) // Load ISO 3166-1 two-letter country codes from file (slow)
// The format is "[code][tab][country name containing spaces][newlin e]" // The format is "[code][tab][country name containing spaces][newlin e]"
qWarning() << "Generating a country list..."; qWarning() << "Generating a country list...";
QFile textFile(StelFileMgr::findFile("data/iso3166.tab")); QFile textFile(StelFileMgr::findFile("data/iso3166.tab"));
if(textFile.open(QFile::ReadOnly | QFile::Text)) if(textFile.open(QFile::ReadOnly | QFile::Text))
skipping to change at line 286 skipping to change at line 286
timeZoneST = qc_("LTST", "solar time"); timeZoneST = qc_("LTST", "solar time");
} }
float shift = core->getUTCOffset(JD); float shift = core->getUTCOffset(JD);
QTime tz = QTime(0, 0, 0).addSecs(3600*qAbs(shift)); QTime tz = QTime(0, 0, 0).addSecs(3600*qAbs(shift));
if(shift<0.0f) if(shift<0.0f)
timeZone.append("-" + tz.toString("hh:mm")); timeZone.append("-" + tz.toString("hh:mm"));
else else
timeZone.append("+" + tz.toString("hh:mm")); timeZone.append("+" + tz.toString("hh:mm"));
if (!timeZoneST.isEmpty()) if (!timeZoneST.isEmpty() && !core->getUseCustomTimeZone())
timeZone.append(" (" + timeZoneST + ")"); timeZone.append(" (" + timeZoneST + ")");
return timeZone; return timeZone;
} }
else else
return QString(); return QString();
} }
// Convert the time format enum to its associated string and reverse // Convert the time format enum to its associated string and reverse
StelLocaleMgr::STimeFormat StelLocaleMgr::stringToSTimeFormat(const QString & tf) const StelLocaleMgr::STimeFormat StelLocaleMgr::stringToSTimeFormat(const QString & tf) const
skipping to change at line 364 skipping to change at line 364
return dfmt; return dfmt;
} }
// Convert a 2 letter country code to string // Convert a 2 letter country code to string
QString StelLocaleMgr::countryCodeToString(const QString& countryCode) QString StelLocaleMgr::countryCodeToString(const QString& countryCode)
{ {
QMap<QString, QString>::ConstIterator i = countryCodeToStringMap.fin d(countryCode); QMap<QString, QString>::ConstIterator i = countryCodeToStringMap.fin d(countryCode);
return (i!=countryCodeToStringMap.constEnd()) ? i.value() : QString( ); return (i!=countryCodeToStringMap.constEnd()) ? i.value() : QString( );
} }
// Convert a string to 2 letter country code
QString StelLocaleMgr::countryNameToCode(const QString& countryName)
{
return countryCodeToStringMap.key(countryName, "??");
}
// Return a list of all the known country names // Return a list of all the known country names
QStringList StelLocaleMgr::getAllCountryNames() QStringList StelLocaleMgr::getAllCountryNames()
{ {
QStringList res; QStringList res;
for (QMap<QString, QString>::ConstIterator i = countryCodeToStringMa p.constBegin();i!=countryCodeToStringMap.constEnd();++i) for (QMap<QString, QString>::ConstIterator i = countryCodeToStringMa p.constBegin();i!=countryCodeToStringMap.constEnd();++i)
res.append(i.value()); res.append(i.value());
res.sort(); res.sort();
return res; return res;
} }
 End of changes. 3 change blocks. 
2 lines changed or deleted 8 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/