]> Shamusworld >> Repos - architektonas/blob - src/base/rs_system.h
Scrubbed out all references to RS2::qtToRsButton(). Gone!
[architektonas] / src / base / rs_system.h
1 #ifndef RS_SYSTEM_H
2 #define RS_SYSTEM_H
3
4 #include <iostream>
5 #include <QtCore>
6 #include "rs_debug.h"
7
8 #define RS_SYSTEM RS_System::instance()
9
10 /**
11  * Class for some system methods such as file system operations.
12  * Implemented as singleton. Use init to Initialize the class
13  * before you use it.
14  *
15  * @author Andrew Mustun
16  */
17 class RS_System
18 {
19         protected:
20                 RS_System();
21
22         public:
23                 static RS_System * instance();
24                 void init(const QString & appName, const QString & appVersion,
25                         const QString & appDirName, const QString & appDir = "");
26                 void initLanguageList();
27                 bool checkInit();
28                 bool createHomePath(const QString & p);
29                 QString getHomeDir();
30                 QString getCurrentDir();
31                 QString getAppDir();
32                 QStringList getFontList();
33                 QStringList getPatternList();
34                 QStringList getScriptList();
35                 QStringList getMachineList();
36                 QString getDocPath();
37                 QString getAppName();
38                 QString getAppVersion();
39                 QStringList getFileList(const QString & subDirectory, const QString & fileExtension);
40                 QStringList getDirectoryList(const QString& subDirectory);
41                 QStringList getLanguageList();
42
43                 static QString languageToSymbol(const QString & lang);
44                 static QString symbolToLanguage(const QString & symb);
45                 static QString getEncoding(const QString & str);
46
47                 void loadTranslation(const QString & lang, const QString & langCmd);
48                 static bool test();
49
50                 /** Returns ISO code for given locale. Needed for win32 to convert
51                 from system encodings. */
52                 static QString localeToISO(const QString & locale);
53
54         protected:
55                 static RS_System * uniqueInstance;
56
57                 QString appName;
58                 QString appVersion;
59                 QString appDirName;
60                 QString appDir;
61
62                 //! List of available translations
63                 QStringList languageList;
64
65                 bool initialized;
66 };
67
68 #endif