]> Shamusworld >> Repos - architektonas/blob - src/base/rs_settings.h.old
Scrubbed out all references to RS2::qtToRsButton(). Gone!
[architektonas] / src / base / rs_settings.h.old
1 #ifndef RS_SETTINGS_H
2 #define RS_SETTINGS_H
3
4 #include <QtCore>
5
6 #define RS_SETTINGS RS_Settings::instance()
7
8 /**
9  * This class can store and reload settings from a
10  * configuration file or the windoze registry.
11  * Please note that the Qt default implementation doesn't
12  * work as one would expect. That's why this class overwrites
13  * most of the default behaviour.
14  *
15  */
16 class RS_Settings
17 {
18         public:
19                 RS_Settings();
20                 ~RS_Settings();
21
22         public:
23                 // Class method
24                 static RS_Settings * instance();
25
26                 /**
27                  * Initialize the system.
28                  *
29                  * @param appName Application name
30                  * @param appDirName Application directory name used for
31                  *     subdirectories in /usr, /etc ~/.
32                  */
33                 void init(const QString & comp, const QString & app);
34
35                 void beginGroup(const QString & grp);
36                 void endGroup();
37
38                 bool writeEntry(const QString & key, int value);
39                 bool writeEntry(const QString & key, double value);
40                 bool writeEntry(const QString & key, const QString & value);
41                 QString readEntry(const QString & key, const QString & def = QString::null, bool * ok = 0);
42                 int readNumEntry(const QString & key, int def = 0, bool * ok = 0);
43
44                 QString readEntryCache(const QString & key);
45                 void addToCache(const QString & key, const QString & value);
46
47         protected:
48                 // Class variable
49                 static RS_Settings * uniqueInstance;
50
51 //              Q3Dict<QString> cache;
52                 QMultiHash<QString, QString *> cache;
53                 bool initialized;
54                 QString companyKey;
55                 QString appKey;
56                 QString group;
57 };
58
59 #endif