14 * |
14 * |
15 * You should have received a copy of the GNU General Public License |
15 * You should have received a copy of the GNU General Public License |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 */ |
17 */ |
18 |
18 |
19 #ifndef LDFORGE_CONFIG_H |
19 #pragma once |
20 #define LDFORGE_CONFIG_H |
|
21 |
|
22 #include "PropertyMacro.h" |
|
23 #include "Types.h" |
|
24 |
|
25 // ============================================================================= |
|
26 #include <QString> |
20 #include <QString> |
27 #include <QVariant> |
21 #include <QVariant> |
28 #include <QKeySequence> |
22 #include <QKeySequence> |
|
23 #include "Macros.h" |
|
24 #include "Types.h" |
|
25 |
29 class QSettings; |
26 class QSettings; |
30 |
27 |
31 #define MAX_INI_LINE 512 |
28 #define MAX_INI_LINE 512 |
32 #define MAX_CONFIG 512 |
29 #define MAX_CONFIG 512 |
33 |
30 |
38 #define extern_cfg(T, NAME) extern Config::T##Type NAME; |
35 #define extern_cfg(T, NAME) extern Config::T##Type NAME; |
39 |
36 |
40 // ========================================================= |
37 // ========================================================= |
41 class Config |
38 class Config |
42 { |
39 { |
43 PROPERTY (private, QString, Name, STR_OPS, STOCK_WRITE) |
40 PROPERTY (private, QString, name, setName, STOCK_WRITE) |
44 |
41 |
45 public: |
42 public: |
46 enum Type |
43 enum Type |
47 { |
44 { |
48 EIntType, |
45 EIntType, |
146 private: \ |
143 private: \ |
147 ValueType* m_valueptr; \ |
144 ValueType* m_valueptr; \ |
148 ValueType m_default; |
145 ValueType m_default; |
149 |
146 |
150 // ============================================================================= |
147 // ============================================================================= |
|
148 // |
151 class IntConfig : public Config |
149 class IntConfig : public Config |
152 { |
150 { |
153 IMPLEMENT_CONFIG (Int) |
151 IMPLEMENT_CONFIG (Int) |
154 }; |
152 }; |
155 |
153 |
156 // ============================================================================= |
154 // ============================================================================= |
|
155 // |
157 class StringConfig : public Config |
156 class StringConfig : public Config |
158 { |
157 { |
159 IMPLEMENT_CONFIG (String) |
158 IMPLEMENT_CONFIG (String) |
160 }; |
159 }; |
161 |
160 |
162 // ============================================================================= |
161 // ============================================================================= |
|
162 // |
163 class FloatConfig : public Config |
163 class FloatConfig : public Config |
164 { |
164 { |
165 IMPLEMENT_CONFIG (Float) |
165 IMPLEMENT_CONFIG (Float) |
166 }; |
166 }; |
167 |
167 |
168 // ============================================================================= |
168 // ============================================================================= |
|
169 // |
169 class BoolConfig : public Config |
170 class BoolConfig : public Config |
170 { |
171 { |
171 IMPLEMENT_CONFIG (Bool) |
172 IMPLEMENT_CONFIG (Bool) |
172 }; |
173 }; |
173 |
174 |
174 // ============================================================================= |
175 // ============================================================================= |
|
176 // |
175 class KeySequenceConfig : public Config |
177 class KeySequenceConfig : public Config |
176 { |
178 { |
177 IMPLEMENT_CONFIG (KeySequence) |
179 IMPLEMENT_CONFIG (KeySequence) |
178 }; |
180 }; |
179 |
181 |
180 // ============================================================================= |
182 // ============================================================================= |
|
183 // |
181 class ListConfig : public Config |
184 class ListConfig : public Config |
182 { |
185 { |
183 IMPLEMENT_CONFIG (List) |
186 IMPLEMENT_CONFIG (List) |
184 }; |
187 }; |
185 |
188 |
186 // ============================================================================= |
189 // ============================================================================= |
|
190 // |
187 class VertexConfig : public Config |
191 class VertexConfig : public Config |
188 { |
192 { |
189 IMPLEMENT_CONFIG (Vertex) |
193 IMPLEMENT_CONFIG (Vertex) |
190 }; |
194 }; |
191 |
|
192 #endif // LDFORGE_CONFIG_H |
|