StelLocaleMgr.cpp   StelLocaleMgr.cpp 
skipping to change at line 37 skipping to change at line 37
#include <QSettings> #include <QSettings>
#include <QString> #include <QString>
#include <QTextStream> #include <QTextStream>
#include <QFile> #include <QFile>
#include <ctime> #include <ctime>
QMap<QString, QString> StelLocaleMgr::countryCodeToStringMap; QMap<QString, QString> StelLocaleMgr::countryCodeToStringMap;
StelLocaleMgr::StelLocaleMgr() StelLocaleMgr::StelLocaleMgr()
: skyTranslator(NULL) : skyTranslator(Q_NULLPTR)
, timeFormat() , timeFormat()
, dateFormat() , dateFormat()
{ {
core = StelApp::getInstance().getCore(); core = StelApp::getInstance().getCore();
// Load from file // Load from file
QString path = StelFileMgr::findFile("data/countryCodes.dat"); QString path = StelFileMgr::findFile("data/countryCodes.dat");
if (path.isEmpty()) if (path.isEmpty())
{ {
qWarning() << "ERROR - could not find country code data file ."; qWarning() << "ERROR - could not find country code data file .";
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=NULL; skyTranslator=Q_NULLPTR;
} }
// 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 263 skipping to change at line 263
default: default:
qWarning() << "WARNING: unknown time format, fallbac k to system default"; qWarning() << "WARNING: unknown time format, fallbac k to system default";
return t.toString(Qt::LocaleDate); return t.toString(Qt::LocaleDate);
} }
} }
QString StelLocaleMgr::getPrintableTimeZoneLocal(double JD) const QString StelLocaleMgr::getPrintableTimeZoneLocal(double JD) const
{ {
if (core->getCurrentLocation().planetName=="Earth") if (core->getCurrentLocation().planetName=="Earth")
{ {
QString timeZone = "UTC"; QString timeZone = "";
QString currTZ = core->getCurrentTimeZone(); QString currTZ = core->getCurrentTimeZone();
QString timeZoneST = ""; QString timeZoneST = "";
if (JD<=StelCore::TZ_ERA_BEGINNING || currTZ.contains("auto" ) || currTZ.contains("LMST")) if (JD<=StelCore::TZ_ERA_BEGINNING || currTZ.contains("auto" ) || currTZ.contains("LMST"))
{ {
// TRANSLATORS: Local Mean Solar Time. Please use ab breviation. // TRANSLATORS: Local Mean Solar Time. Please use ab breviation.
timeZoneST = qc_("LMST", "solar time"); timeZoneST = qc_("LMST", "solar time");
} }
if (currTZ.contains("LTST")) if (currTZ.contains("LTST"))
{ {
// TRANSLATORS: Local True Solar Time. Please use ab breviation. // TRANSLATORS: Local True Solar Time. Please use ab breviation.
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 = QString("UTC-%1").arg(tz.toString("hh:mm" ));
else else
timeZone.append("+" + tz.toString("hh:mm")); timeZone = QString("UTC+%1").arg(tz.toString("hh:mm" ));
if (!timeZoneST.isEmpty() && !core->getUseCustomTimeZone()) if (!timeZoneST.isEmpty() && !core->getUseCustomTimeZone())
timeZone.append(" (" + timeZoneST + ")"); timeZone = QString("%1 (%2)").arg(timeZone, timeZone ST);
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
{ {
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 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/