]> Shamusworld >> Repos - architektonas/blob - src/base/system.h
Fixed thumbnail rendering in LibraryWidget and DXF detection.
[architektonas] / src / base / system.h
1 #ifndef __SYSTEM_H__
2 #define __SYSTEM_H__
3
4 #include <iostream>
5 #include <QtCore>
6 #include "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. (LAME! It should detect this condition transparently!)
14  *
15  * @author James Hammons
16  * @author Andrew Mustun
17  */
18 class RS_System
19 {
20         protected:
21                 RS_System();
22
23         public:
24                 static RS_System * instance();
25                 void init(const QString & appName, const QString & appVersion,
26                         const QString & appDirName, const QString & appDir = "");
27                 void initLanguageList();
28                 bool checkInit();
29                 bool createHomePath(const QString & p);
30                 QString getHomeDir();
31                 QString getCurrentDir();
32                 QString getAppDir();
33                 QStringList getFontList();
34                 QStringList getPatternList();
35                 QStringList getScriptList();
36                 QStringList getMachineList();
37                 QString getDocPath();
38                 QString getAppName();
39                 QString getAppVersion();
40                 QStringList getFileList(const QString & subDirectory, const QString & fileExtension);
41                 QStringList getDirectoryList(const QString& subDirectory);
42                 QStringList getLanguageList();
43
44                 static QString languageToSymbol(const QString & lang);
45                 static QString symbolToLanguage(const QString & symb);
46                 static QString getEncoding(const QString & str);
47
48                 void loadTranslation(const QString & lang, const QString & langCmd);
49                 static bool test();
50
51                 /** Returns ISO code for given locale. Needed for win32 to convert
52                 from system encodings. */
53                 static QString localeToISO(const QString & locale);
54
55         protected:
56                 static RS_System * uniqueInstance;
57
58                 QString appName;
59                 QString appVersion;
60                 QString appDirName;
61                 QString appDir;
62
63                 //! List of available translations
64                 QStringList languageList;
65
66                 bool initialized;
67 };
68
69 #endif  // __SYSTEM_H__