~ubuntu-branches/ubuntu/precise/stellarium/precise

« back to all changes in this revision

Viewing changes to src/StelSkyCultureMgr.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Cédric Delfosse
  • Date: 2008-05-19 21:28:23 UTC
  • mfrom: (3.1.5 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080519212823-m5nfiuntxstxzxj7
Tags: 0.9.1-4
Add libxcursor-dev, libxfixes-dev, libxinerama-dev, libqt4-opengl-dev to
build-deps (Closes: #479906)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
18
 */
 
19
 
 
20
#ifndef STELSKYCULTUREMGR_H
 
21
#define STELSKYCULTUREMGR_H
 
22
 
 
23
#include <map>
 
24
#include <string>
 
25
#include <QString>
 
26
 
 
27
using namespace std;
 
28
 
 
29
class InitParser;
 
30
 
 
31
//! @class StelSkyCultureMgr
 
32
//! Manage sky cultures for stellarium.
 
33
//! Different human cultures have used different names for stars, and visualised
 
34
//! different constellations in the sky (and in different parts of the sky). The
 
35
//! StelSkyCultureMgr class handles the different sky cultures.
 
36
//! @author Fabien Chereau
 
37
class StelSkyCultureMgr{
 
38
public:
 
39
        StelSkyCultureMgr();
 
40
        ~StelSkyCultureMgr();
 
41
        
 
42
        //! Initialize the StelSkyCultureMgr object.
 
43
        //! Gets the default sky culture name from the ini parser object and 
 
44
        //! sets that sky culture by calling setSkyCultureDir().
 
45
        //! @param conf The ini parser object which contains the default sky 
 
46
        //! culture setting.
 
47
        void init(const InitParser& conf);
 
48
        
 
49
        //! Set the sky culture from i18n name.
 
50
        //! @return true on success; false and doesn't change if skyculture is invalid.
 
51
        bool setSkyCulture(const wstring& cultureName) {return setSkyCultureDir(skyCultureToDirectory(cultureName));}
 
52
        
 
53
        //! Get the current sky culture i18n name.
 
54
        wstring getSkyCulture() const;
 
55
        
 
56
        //! Set the current sky culture from the passed directory.
 
57
        //! In in the installatiom data directory and user data directory, 
 
58
        //! we have the "skycultures" sub-directory. Inside this there is
 
59
        //! one sub-directory per sky culture. This sub-directory name
 
60
        //! is that we refer to here.
 
61
        //! @param cultureDir The sub-directory name inside the "skycultures" 
 
62
        //! directory.
 
63
        //! @return true on success; else false.
 
64
        bool setSkyCultureDir(const QString& cultureDir);
 
65
        
 
66
        //! Get the current sky culture directory name.  
 
67
        QString getSkyCultureDir() {return skyCultureDir;}
 
68
        
 
69
        //! Get a hash of translated culture names and directories.
 
70
        //! @return A newline delimited list of translated culture names and directories
 
71
        //! e.g. "name1\ndir1\name2\ndir2".
 
72
        wstring getSkyCultureHash() const;      
 
73
        
 
74
        //! Get a list of sky culture names in English.
 
75
        //! @return A new-line delimited list of English sky culture names.
 
76
        string getSkyCultureListEnglish(void);
 
77
        
 
78
        //! Get a list of sky culture names in the current language.
 
79
        //! @return A new-line delimited list of translated sky culture names.
 
80
        wstring getSkyCultureListI18(void);
 
81
        
 
82
        //! Get the culture name in English associated with a specified directory.
 
83
        //! @param directory The directory name.
 
84
        //! @return The English name for the culture associated with directory.
 
85
        string directoryToSkyCultureEnglish(const QString& directory);
 
86
        
 
87
        //! Get the culture name translated to current language associated with 
 
88
        //! a specified directory.
 
89
        //! @param directory The directory name.
 
90
        //! @return The translated name for the culture associated with directory.
 
91
        wstring directoryToSkyCultureI18(const QString& directory) const;
 
92
        
 
93
        //! Get the directory associated with a specified translated culture name.
 
94
        //! @param cultureName The culture name in the current language.
 
95
        //! @return The directory assocuated with cultureName.
 
96
        QString skyCultureToDirectory(const wstring& cultureName);
 
97
        
 
98
private:
 
99
        map<QString, string> dirToNameEnglish;
 
100
        
 
101
        // The directory containing data for the culture used for constellations, etc.. 
 
102
        QString skyCultureDir;
 
103
};
 
104
 
 
105
#endif