OLD | NEW |
1 {% from "macros.tmpl" import license %} | 1 {% from "macros.tmpl" import license %} |
2 {{ license() }} | 2 {{ license() }} |
3 | 3 |
4 #ifndef SettingsMacros_h | 4 #ifndef SettingsMacros_h |
5 #define SettingsMacros_h | 5 #define SettingsMacros_h |
6 | 6 |
7 #define SETTINGS_GETTERS_AND_SETTERS \ | 7 #define SETTINGS_GETTERS_AND_SETTERS \ |
8 {% for setting in settings %} | 8 {% for setting in settings %} |
9 {{setting.type|to_passing_type}} {{setting.name}}() const { return m_{{setti
ng.name}}; } \ | 9 {{setting.type|to_passing_type}} {{setting.name}}() const { return m_{{setti
ng.name}}; } \ |
10 void set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{sett
ing.name}}); \ | 10 void set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{sett
ing.name}}); \ |
(...skipping 27 matching lines...) Expand all Loading... |
38 return; \ | 38 return; \ |
39 m_{{setting.name}} = {{setting.name}}; \ | 39 m_{{setting.name}} = {{setting.name}}; \ |
40 {% if setting.invalidate %} | 40 {% if setting.invalidate %} |
41 invalidate(SettingsDelegate::{{setting.invalidate}}Change); \ | 41 invalidate(SettingsDelegate::{{setting.invalidate}}Change); \ |
42 {% endif %} | 42 {% endif %} |
43 } \ | 43 } \ |
44 {% endfor %} | 44 {% endfor %} |
45 void Settings::setFromStrings(const String& name, const String& value) \ | 45 void Settings::setFromStrings(const String& name, const String& value) \ |
46 { \ | 46 { \ |
47 {% for setting in settings %} | 47 {% for setting in settings %} |
48 if (equalIgnoringCase(name, "{{setting.name}}")) { \ | 48 if (name == "{{setting.name}}") { \ |
49 set{{setting.name|upper_first}}( \ | 49 set{{setting.name|upper_first}}( \ |
50 {% if setting.type == 'String' %} | 50 {% if setting.type == 'String' %} |
51 value \ | 51 value \ |
52 {% elif setting.type == 'bool' %} | 52 {% elif setting.type == 'bool' %} |
53 value.isEmpty() || equalIgnoringCase(value, "true") \ | 53 value.isEmpty() || value == "true" \ |
54 {% elif setting.type == 'int' %} | 54 {% elif setting.type == 'int' %} |
55 value.toInt() \ | 55 value.toInt() \ |
56 {% elif setting.type == 'float' %} | 56 {% elif setting.type == 'float' %} |
57 value.toFloat() \ | 57 value.toFloat() \ |
58 {% elif setting.type == 'double' %} | 58 {% elif setting.type == 'double' %} |
59 value.toDouble() \ | 59 value.toDouble() \ |
60 {% else %} | 60 {% else %} |
61 static_cast<{{setting.type}}>(value.toInt()) \ | 61 static_cast<{{setting.type}}>(value.toInt()) \ |
62 {% endif %} | 62 {% endif %} |
63 ); \ | 63 ); \ |
64 return; \ | 64 return; \ |
65 } \ | 65 } \ |
66 {% endfor %} | 66 {% endfor %} |
67 } | 67 } |
68 // End of SETTINGS_SETTER_BODIES. | 68 // End of SETTINGS_SETTER_BODIES. |
69 | 69 |
70 #endif // SettingsMacros_h | 70 #endif // SettingsMacros_h |
OLD | NEW |