StelSkyCultureMgr.cpp   StelSkyCultureMgr.cpp 
skipping to change at line 33 skipping to change at line 33
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelIniParser.hpp" #include "StelIniParser.hpp"
#include <QSettings> #include <QSettings>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QVariant> #include <QVariant>
#include <QDebug> #include <QDebug>
#include <QMap> #include <QMap>
#include <QMapIterator> #include <QMapIterator>
#include <QDir>
StelSkyCultureMgr::StelSkyCultureMgr() StelSkyCultureMgr::StelSkyCultureMgr()
{ {
QSet<QString> cultureDirNames; QSet<QString> cultureDirNames;
try try
{ {
cultureDirNames = StelFileMgr::listContents("skycultures",St elFileMgr::Directory); cultureDirNames = StelFileMgr::listContents("skycultures",St elFileMgr::Directory);
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
skipping to change at line 57 skipping to change at line 58
foreach (const QString& dir, cultureDirNames) foreach (const QString& dir, cultureDirNames)
{ {
try try
{ {
QSettings pd(StelFileMgr::findFile("skycultures/" + dir + "/info.ini"), StelIniFormat); QSettings pd(StelFileMgr::findFile("skycultures/" + dir + "/info.ini"), StelIniFormat);
dirToNameEnglish[dir].englishName = pd.value("info/n ame").toString(); dirToNameEnglish[dir].englishName = pd.value("info/n ame").toString();
dirToNameEnglish[dir].author = pd.value("info/author ").toString(); dirToNameEnglish[dir].author = pd.value("info/author ").toString();
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qWarning() << "WARNING: unable to successfully read info.ini file from skyculture dir" << dir; qWarning() << "WARNING: unable to successfully read info.ini file from skyculture dir" << QDir::toNativeSeparators(dir);
} }
} }
} }
StelSkyCultureMgr::~StelSkyCultureMgr() StelSkyCultureMgr::~StelSkyCultureMgr()
{ {
} }
//! Init itself from a config file. //! Init itself from a config file.
void StelSkyCultureMgr::init() void StelSkyCultureMgr::init()
skipping to change at line 79 skipping to change at line 80
defaultSkyCultureID = StelApp::getInstance().getSettings()->value("l ocalization/sky_culture", "western").toString(); defaultSkyCultureID = StelApp::getInstance().getSettings()->value("l ocalization/sky_culture", "western").toString();
setCurrentSkyCultureID(defaultSkyCultureID); setCurrentSkyCultureID(defaultSkyCultureID);
} }
//! Set the current sky culture from the passed directory //! Set the current sky culture from the passed directory
bool StelSkyCultureMgr::setCurrentSkyCultureID(const QString& cultureDir) bool StelSkyCultureMgr::setCurrentSkyCultureID(const QString& cultureDir)
{ {
// make sure culture definition exists before attempting or will die // make sure culture definition exists before attempting or will die
if (directoryToSkyCultureEnglish(cultureDir) == "") if (directoryToSkyCultureEnglish(cultureDir) == "")
{ {
qWarning() << "Invalid sky culture directory: " << cultureDi r; qWarning() << "Invalid sky culture directory: " << QDir::toN ativeSeparators(cultureDir);
return false; return false;
} }
currentSkyCultureDir = cultureDir; currentSkyCultureDir = cultureDir;
currentSkyCulture = dirToNameEnglish[cultureDir]; currentSkyCulture = dirToNameEnglish[cultureDir];
StelApp::getInstance().updateSkyCulture(); StelApp::getInstance().updateSkyCulture();
return true; return true;
} }
// Set the default sky culture from the ID. // Set the default sky culture from the ID.
bool StelSkyCultureMgr::setDefaultSkyCultureID(const QString& id) bool StelSkyCultureMgr::setDefaultSkyCultureID(const QString& id)
skipping to change at line 150 skipping to change at line 151
{ {
return dirToNameEnglish[directory].englishName; return dirToNameEnglish[directory].englishName;
} }
QString StelSkyCultureMgr::directoryToSkyCultureI18(const QString& director y) const QString StelSkyCultureMgr::directoryToSkyCultureI18(const QString& director y) const
{ {
QString culture = dirToNameEnglish[directory].englishName; QString culture = dirToNameEnglish[directory].englishName;
if (culture=="") if (culture=="")
{ {
qWarning() << "WARNING: StelSkyCultureMgr::directoryToSkyCul tureI18(\"" qWarning() << "WARNING: StelSkyCultureMgr::directoryToSkyCul tureI18(\""
<< directory << "\"): could not find directory"; << QDir::toNativeSeparators(directory) << "\"): c ould not find directory";
return ""; return "";
} }
return q_(culture); return q_(culture);
} }
QString StelSkyCultureMgr::skyCultureI18ToDirectory(const QString& cultureN ame) const QString StelSkyCultureMgr::skyCultureI18ToDirectory(const QString& cultureN ame) const
{ {
QMapIterator<QString, StelSkyCulture> i(dirToNameEnglish); QMapIterator<QString, StelSkyCulture> i(dirToNameEnglish);
while (i.hasNext()) while (i.hasNext())
{ {
 End of changes. 4 change blocks. 
3 lines changed or deleted 4 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/