Sun, 27 Jul 2014 04:25:50 +0300
- refactored up the configuration dialog. Instead of setting all configuration values one-by-one, dynamically fill in the values and save them into config based on widget names and data
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
844
11587d419d2f
- changed copyright lines to use my legal name instead of my nickname
Teemu Piippo <crimsondusk64@gmail.com>
parents:
806
diff
changeset
|
3 | * Copyright (C) 2013, 2014 Teemu Piippo |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #pragma once |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include <QString> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include <QVariant> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include <QKeySequence> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "macros.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include "basics.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | class QSettings; |
851
dbed6938238c
- refactored up the configuration dialog. Instead of setting all configuration values one-by-one, dynamically fill in the values and save them into config based on widget names and data
Teemu Piippo <crimsondusk64@gmail.com>
parents:
848
diff
changeset
|
27 | class AbstractConfigEntry; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | |
848 | 29 | #define CFGENTRY(T, NAME, DEFAULT) namespace cfg { AbstractConfigEntry::T##Type NAME; } |
30 | #define EXTERN_CFGENTRY(T, NAME) namespace cfg { extern AbstractConfigEntry::T##Type NAME; } | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
32 | namespace Config |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
33 | { |
848 | 34 | void Initialize(); |
35 | bool Load(); | |
36 | bool Save(); | |
37 | void ResetToDefaults(); | |
38 | QString DirectoryPath(); | |
39 | QString FilePath (QString file); | |
40 | QSettings* SettingsObject(); | |
851
dbed6938238c
- refactored up the configuration dialog. Instead of setting all configuration values one-by-one, dynamically fill in the values and save them into config based on widget names and data
Teemu Piippo <crimsondusk64@gmail.com>
parents:
848
diff
changeset
|
41 | QList<AbstractConfigEntry*> const& AllConfigEntries(); |
dbed6938238c
- refactored up the configuration dialog. Instead of setting all configuration values one-by-one, dynamically fill in the values and save them into config based on widget names and data
Teemu Piippo <crimsondusk64@gmail.com>
parents:
848
diff
changeset
|
42 | AbstractConfigEntry* FindByName (QString const& name); |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
43 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | |
848 | 45 | class AbstractConfigEntry |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
757
diff
changeset
|
47 | PROPERTY (private, QString, name, setName, STOCK_WRITE) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
49 | public: |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
50 | enum Type |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
51 | { |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
52 | EIntType, |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
53 | EStringType, |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
54 | EFloatType, |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
55 | EBoolType, |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
56 | EKeySequenceType, |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
57 | EListType, |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
58 | EVertexType, |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
59 | }; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
61 | using IntType = int; |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
757
diff
changeset
|
62 | using StringType = QString; |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
63 | using FloatType = float; |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
64 | using BoolType = bool; |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
65 | using KeySequenceType = QKeySequence; |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
66 | using ListType = QList<QVariant>; |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
67 | using VertexType = Vertex; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | |
848 | 69 | AbstractConfigEntry (QString name); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
71 | virtual QVariant getDefaultAsVariant() const = 0; |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
72 | virtual Type getType() const = 0; |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
73 | virtual bool isDefault() const = 0; |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
74 | virtual void loadFromVariant (const QVariant& val) = 0; |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
75 | virtual void resetValue() = 0; |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
76 | virtual QVariant toVariant() const = 0; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
79 | #define IMPLEMENT_CONFIG(NAME) \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
80 | public: \ |
848 | 81 | using ValueType = AbstractConfigEntry::NAME##Type; \ |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
82 | \ |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
757
diff
changeset
|
83 | NAME##ConfigEntry (ValueType* valueptr, QString name, ValueType def) : \ |
848 | 84 | AbstractConfigEntry (name), \ |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
85 | m_valueptr (valueptr), \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
86 | m_default (def) \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
87 | { \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
88 | *m_valueptr = def; \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
89 | } \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
90 | \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
91 | inline ValueType getValue() const \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
92 | { \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
93 | return *m_valueptr; \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
94 | } \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
95 | \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
96 | inline void setValue (ValueType val) \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
97 | { \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
98 | *m_valueptr = val; \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
99 | } \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
100 | \ |
848 | 101 | virtual AbstractConfigEntry::Type getType() const \ |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
102 | { \ |
848 | 103 | return AbstractConfigEntry::E##NAME##Type; \ |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
104 | } \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
105 | \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
106 | virtual void resetValue() \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
107 | { \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
108 | *m_valueptr = m_default; \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
109 | } \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
110 | \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
111 | virtual const ValueType& getDefault() const \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
112 | { \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
113 | return m_default; \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
114 | } \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
115 | \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
116 | virtual bool isDefault() const \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
117 | { \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
118 | return *m_valueptr == m_default; \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
119 | } \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
120 | \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
121 | virtual void loadFromVariant (const QVariant& val) \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
122 | { \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
123 | *m_valueptr = val.value<ValueType>(); \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
124 | } \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
125 | \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
126 | virtual QVariant toVariant() const \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
127 | { \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
128 | return QVariant::fromValue<ValueType> (*m_valueptr); \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
129 | } \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
130 | \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
131 | virtual QVariant getDefaultAsVariant() const \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
132 | { \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
133 | return QVariant::fromValue<ValueType> (m_default); \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
134 | } \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
135 | \ |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
757
diff
changeset
|
136 | static NAME##ConfigEntry* getByName (QString name); \ |
757
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
137 | \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
138 | private: \ |
8ab9fa53142b
- overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
139 | ValueType* m_valueptr; \ |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | ValueType m_default; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | |
848 | 142 | class IntConfigEntry : public AbstractConfigEntry |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | IMPLEMENT_CONFIG (Int) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | |
848 | 147 | class StringConfigEntry : public AbstractConfigEntry |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | IMPLEMENT_CONFIG (String) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
150 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | |
848 | 152 | class FloatConfigEntry : public AbstractConfigEntry |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
153 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | IMPLEMENT_CONFIG (Float) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
155 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | |
848 | 157 | class BoolConfigEntry : public AbstractConfigEntry |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | IMPLEMENT_CONFIG (Bool) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
160 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | |
848 | 162 | class KeySequenceConfigEntry : public AbstractConfigEntry |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | IMPLEMENT_CONFIG (KeySequence) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
166 | |
848 | 167 | class ListConfigEntry : public AbstractConfigEntry |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | IMPLEMENT_CONFIG (List) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
170 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | |
848 | 172 | class VertexConfigEntry : public AbstractConfigEntry |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
173 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | IMPLEMENT_CONFIG (Vertex) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | }; |