Skip to content

Commit 4efbafd

Browse files
committed
Changed <version> theme tag to <formatVersion> to be more clear.
1 parent c3b394f commit 4efbafd

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

THEMES.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Here is a very simple theme that changes the description text's color:
4646

4747
```xml
4848
<theme>
49-
<version>3</version>
49+
<formatVersion>3</formatVersion>
5050
<view name="detailed">
5151
<text name="description">
5252
<color>00FF00</color>
@@ -66,7 +66,7 @@ How it works
6666

6767
Everything must be inside a `<theme>` tag.
6868

69-
**The `<version>` tag *must* be specified**. This is the version of the theming system the theme was designed for. The current version is 3.
69+
**The `<formatVersion>` tag *must* be specified**. This is the version of the theming system the theme was designed for. The current version is 3.
7070

7171

7272

@@ -121,7 +121,7 @@ You can include theme files within theme files, similar to `#include` in C (thou
121121
`~/.emulationstation/all_themes.xml`:
122122
```xml
123123
<theme>
124-
<version>3</version>
124+
<formatVersion>3</formatVersion>
125125
<view name="detailed">
126126
<text name="description">
127127
<fontPath>./all_themes/myfont.ttf</fontPath>
@@ -134,7 +134,7 @@ You can include theme files within theme files, similar to `#include` in C (thou
134134
`~/.emulationstation/snes/theme.xml`:
135135
```xml
136136
<theme>
137-
<version>3</version>
137+
<formatVersion>3</formatVersion>
138138
<include>./../all_themes.xml</include>
139139
<view name="detailed">
140140
<text name="description">
@@ -147,7 +147,7 @@ You can include theme files within theme files, similar to `#include` in C (thou
147147
Is equivalent to this `snes/theme.xml`:
148148
```xml
149149
<theme>
150-
<version>3</version>
150+
<formatVersion>3</formatVersion>
151151
<view name="detailed">
152152
<text name="description">
153153
<fontPath>./all_themes/myfont.ttf</fontPath>
@@ -157,7 +157,7 @@ Is equivalent to this `snes/theme.xml`:
157157
</theme>
158158
```
159159

160-
Notice that properties that were not specified got merged (`<fontPath>`) and the `snes/theme.xml` could overwrite the included files' values (`<color>`). Also notice the included file still needed the `<version>` tag.
160+
Notice that properties that were not specified got merged (`<fontPath>`) and the `snes/theme.xml` could overwrite the included files' values (`<color>`). Also notice the included file still needed the `<formatVersion>` tag.
161161

162162

163163

@@ -167,7 +167,7 @@ Sometimes you want to apply the same properties to the same elements across mult
167167

168168
```xml
169169
<theme>
170-
<version>3</version>
170+
<formatVersion>3</formatVersion>
171171
<view name="basic, grid, system">
172172
<image name="logo">
173173
<path>./snes_art/snes_header.png</path>
@@ -184,7 +184,7 @@ Sometimes you want to apply the same properties to the same elements across mult
184184
This is equivalent to:
185185
```xml
186186
<theme>
187-
<version>3</version>
187+
<formatVersion>3</formatVersion>
188188
<view name="basic">
189189
<image name="logo">
190190
<path>./snes_art/snes_header.png</path>
@@ -217,7 +217,7 @@ You can theme multiple elements *of the same type* simultaneously. The `name` a
217217

218218
```xml
219219
<theme>
220-
<version>3</version>
220+
<formatVersion>3</formatVersion>
221221
<view name="detailed">
222222
<!-- Weird spaces/newline on purpose! -->
223223
<text name="md_lbl_rating, md_lbl_releasedate, md_lbl_developer, md_lbl_publisher,
@@ -231,7 +231,7 @@ You can theme multiple elements *of the same type* simultaneously. The `name` a
231231
Which is equivalent to:
232232
```xml
233233
<theme>
234-
<version>3</version>
234+
<formatVersion>3</formatVersion>
235235
<view name="detailed">
236236
<text name="md_lbl_rating">
237237
<color>48474D</color>

src/ThemeData.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ std::map< std::string, ElementMapType > ThemeData::sElementMap = boost::assign::
8686

8787
namespace fs = boost::filesystem;
8888

89-
#define MINIMUM_THEME_VERSION 3
90-
#define CURRENT_THEME_VERSION 3
89+
#define MINIMUM_THEME_FORMAT_VERSION 3
90+
#define CURRENT_THEME_FORMAT_VERSION 3
9191

9292
// helper
9393
unsigned int getHexColor(const char* str)
@@ -164,12 +164,12 @@ void ThemeData::loadFile(const std::string& path)
164164
throw error << "Missing <theme> tag!";
165165

166166
// parse version
167-
mVersion = root.child("version").text().as_float(-404);
167+
mVersion = root.child("formatVersion").text().as_float(-404);
168168
if(mVersion == -404)
169-
throw error << "<version> tag missing!\n It's either out of date or you need to add <version>" << CURRENT_THEME_VERSION << "</version> inside your <theme> tag.";
169+
throw error << "<formatVersion> tag missing!\n It's either out of date or you need to add <formatVersion>" << CURRENT_THEME_FORMAT_VERSION << "</formatVersion> inside your <theme> tag.";
170170

171-
if(mVersion < MINIMUM_THEME_VERSION)
172-
throw error << "Theme is version " << mVersion << ". Minimum supported version is " << MINIMUM_THEME_VERSION << ".";
171+
if(mVersion < MINIMUM_THEME_FORMAT_VERSION)
172+
throw error << "Theme uses format version " << mVersion << ". Minimum supported version is " << MINIMUM_THEME_FORMAT_VERSION << ".";
173173

174174
parseIncludes(root);
175175
parseViews(root);

0 commit comments

Comments
 (0)