Stellarium 0.15.0
StelSkyCultureMgr.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2006 Fabien Chereau
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _STELSKYCULTUREMGR_HPP_
21 #define _STELSKYCULTUREMGR_HPP_
22 
23 #include <QObject>
24 #include <QMap>
25 #include <QString>
26 #include <QStringList>
27 
31 {
32 public:
34  QString englishName;
36  QString author;
37 };
38 
47 class StelSkyCultureMgr : public QObject
48 {
49  Q_OBJECT
50  Q_PROPERTY(QString currentSkyCultureID
54 
55 public:
58 
62  void init();
63 
65  StelSkyCulture getSkyCulture() const {return currentSkyCulture;}
66 
67 public slots:
69  QString getCurrentSkyCultureEnglishName() const;
71  QString getCurrentSkyCultureNameI18() const;
74  bool setCurrentSkyCultureNameI18(const QString& cultureName) {return setCurrentSkyCultureID(skyCultureI18ToDirectory(cultureName));}
75 
77  QString getCurrentSkyCultureID() const {return currentSkyCultureDir;}
81  bool setCurrentSkyCultureID(const QString& id);
82 
86 
88  QString getDefaultSkyCultureID() {return defaultSkyCultureID;}
92  bool setDefaultSkyCultureID(const QString& id);
93 
96  QString getSkyCultureListEnglish(void);
97 
100  QStringList getSkyCultureListI18(void);
101 
103  QStringList getSkyCultureListIDs(void);
104 
106  QMap<QString, StelSkyCulture> getDirToNameMap() const { return dirToNameEnglish; }
107 
108 signals:
111  void defaultSkyCultureChanged(const QString& id);
112 
114  void currentSkyCultureChanged(const QString& id);
115 
116 private:
120  QString directoryToSkyCultureEnglish(const QString& directory);
121 
126  QString directoryToSkyCultureI18(const QString& directory) const;
127 
131  QString skyCultureI18ToDirectory(const QString& cultureName) const;
132 
133  QMap<QString, StelSkyCulture> dirToNameEnglish;
134 
135  // The directory containing data for the culture used for constellations, etc..
136  QString currentSkyCultureDir;
137  StelSkyCulture currentSkyCulture;
138 
139  QString defaultSkyCultureID;
140 };
141 
142 #endif // _STELSKYCULTUREMGR_HPP_
QString getCurrentSkyCultureID() const
Get the current sky culture ID.
QStringList getSkyCultureListIDs(void)
Get a list of sky culture IDs.
QString getCurrentSkyCultureNameI18() const
Get the current sky culture translated name.
QString englishName
English name.
QString getCurrentSkyCultureEnglishName() const
Get the current sky culture English name.
bool setDefaultSkyCultureID(const QString &id)
Set the default sky culture from the ID.
void currentSkyCultureChanged(const QString &id)
Emitted when the current sky culture changes.
void defaultSkyCultureChanged(const QString &id)
Emitted whenever the default sky culture changed.
StelSkyCulture getSkyCulture() const
Get the current sky culture.
bool setCurrentSkyCultureID(const QString &id)
Set the current sky culture from the ID.
QString getCurrentSkyCultureHtmlDescription() const
Returns a localized HTML description for the current sky culture.
Manage sky cultures for stellarium.
Store basic info about a sky culture for stellarium.
void init()
Initialize the StelSkyCultureMgr object.
QString getSkyCultureListEnglish(void)
Get a list of sky culture names in English.
QMap< QString, StelSkyCulture > getDirToNameMap() const
Returns a map from sky culture IDs/folders to sky culture names.
QString getDefaultSkyCultureID()
Get the default sky culture ID.
QStringList getSkyCultureListI18(void)
Get a list of sky culture names in the current language.
bool setCurrentSkyCultureNameI18(const QString &cultureName)
Set the sky culture from i18n name.
QString author
Name of the author.