Commit 4efbafda authored by Aloshi's avatar Aloshi

Changed <version> theme tag to <formatVersion> to be more clear.

parent c3b394f1
...@@ -46,7 +46,7 @@ Here is a very simple theme that changes the description text's color: ...@@ -46,7 +46,7 @@ Here is a very simple theme that changes the description text's color:
```xml ```xml
<theme> <theme>
<version>3</version> <formatVersion>3</formatVersion>
<view name="detailed"> <view name="detailed">
<text name="description"> <text name="description">
<color>00FF00</color> <color>00FF00</color>
...@@ -66,7 +66,7 @@ How it works ...@@ -66,7 +66,7 @@ How it works
Everything must be inside a `<theme>` tag. Everything must be inside a `<theme>` tag.
**The `<version>` tag *must* be specified**. This is the version of the theming system the theme was designed for. The current version is 3. **The `<formatVersion>` tag *must* be specified**. This is the version of the theming system the theme was designed for. The current version is 3.
...@@ -121,7 +121,7 @@ You can include theme files within theme files, similar to `#include` in C (thou ...@@ -121,7 +121,7 @@ You can include theme files within theme files, similar to `#include` in C (thou
`~/.emulationstation/all_themes.xml`: `~/.emulationstation/all_themes.xml`:
```xml ```xml
<theme> <theme>
<version>3</version> <formatVersion>3</formatVersion>
<view name="detailed"> <view name="detailed">
<text name="description"> <text name="description">
<fontPath>./all_themes/myfont.ttf</fontPath> <fontPath>./all_themes/myfont.ttf</fontPath>
...@@ -134,7 +134,7 @@ You can include theme files within theme files, similar to `#include` in C (thou ...@@ -134,7 +134,7 @@ You can include theme files within theme files, similar to `#include` in C (thou
`~/.emulationstation/snes/theme.xml`: `~/.emulationstation/snes/theme.xml`:
```xml ```xml
<theme> <theme>
<version>3</version> <formatVersion>3</formatVersion>
<include>./../all_themes.xml</include> <include>./../all_themes.xml</include>
<view name="detailed"> <view name="detailed">
<text name="description"> <text name="description">
...@@ -147,7 +147,7 @@ You can include theme files within theme files, similar to `#include` in C (thou ...@@ -147,7 +147,7 @@ You can include theme files within theme files, similar to `#include` in C (thou
Is equivalent to this `snes/theme.xml`: Is equivalent to this `snes/theme.xml`:
```xml ```xml
<theme> <theme>
<version>3</version> <formatVersion>3</formatVersion>
<view name="detailed"> <view name="detailed">
<text name="description"> <text name="description">
<fontPath>./all_themes/myfont.ttf</fontPath> <fontPath>./all_themes/myfont.ttf</fontPath>
...@@ -157,7 +157,7 @@ Is equivalent to this `snes/theme.xml`: ...@@ -157,7 +157,7 @@ Is equivalent to this `snes/theme.xml`:
</theme> </theme>
``` ```
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. 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.
...@@ -167,7 +167,7 @@ Sometimes you want to apply the same properties to the same elements across mult ...@@ -167,7 +167,7 @@ Sometimes you want to apply the same properties to the same elements across mult
```xml ```xml
<theme> <theme>
<version>3</version> <formatVersion>3</formatVersion>
<view name="basic, grid, system"> <view name="basic, grid, system">
<image name="logo"> <image name="logo">
<path>./snes_art/snes_header.png</path> <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 ...@@ -184,7 +184,7 @@ Sometimes you want to apply the same properties to the same elements across mult
This is equivalent to: This is equivalent to:
```xml ```xml
<theme> <theme>
<version>3</version> <formatVersion>3</formatVersion>
<view name="basic"> <view name="basic">
<image name="logo"> <image name="logo">
<path>./snes_art/snes_header.png</path> <path>./snes_art/snes_header.png</path>
...@@ -217,7 +217,7 @@ You can theme multiple elements *of the same type* simultaneously. The `name` a ...@@ -217,7 +217,7 @@ You can theme multiple elements *of the same type* simultaneously. The `name` a
```xml ```xml
<theme> <theme>
<version>3</version> <formatVersion>3</formatVersion>
<view name="detailed"> <view name="detailed">
<!-- Weird spaces/newline on purpose! --> <!-- Weird spaces/newline on purpose! -->
<text name="md_lbl_rating, md_lbl_releasedate, md_lbl_developer, md_lbl_publisher, <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 ...@@ -231,7 +231,7 @@ You can theme multiple elements *of the same type* simultaneously. The `name` a
Which is equivalent to: Which is equivalent to:
```xml ```xml
<theme> <theme>
<version>3</version> <formatVersion>3</formatVersion>
<view name="detailed"> <view name="detailed">
<text name="md_lbl_rating"> <text name="md_lbl_rating">
<color>48474D</color> <color>48474D</color>
......
...@@ -86,8 +86,8 @@ std::map< std::string, ElementMapType > ThemeData::sElementMap = boost::assign:: ...@@ -86,8 +86,8 @@ std::map< std::string, ElementMapType > ThemeData::sElementMap = boost::assign::
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
#define MINIMUM_THEME_VERSION 3 #define MINIMUM_THEME_FORMAT_VERSION 3
#define CURRENT_THEME_VERSION 3 #define CURRENT_THEME_FORMAT_VERSION 3
// helper // helper
unsigned int getHexColor(const char* str) unsigned int getHexColor(const char* str)
...@@ -164,12 +164,12 @@ void ThemeData::loadFile(const std::string& path) ...@@ -164,12 +164,12 @@ void ThemeData::loadFile(const std::string& path)
throw error << "Missing <theme> tag!"; throw error << "Missing <theme> tag!";
// parse version // parse version
mVersion = root.child("version").text().as_float(-404); mVersion = root.child("formatVersion").text().as_float(-404);
if(mVersion == -404) if(mVersion == -404)
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."; 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.";
if(mVersion < MINIMUM_THEME_VERSION) if(mVersion < MINIMUM_THEME_FORMAT_VERSION)
throw error << "Theme is version " << mVersion << ". Minimum supported version is " << MINIMUM_THEME_VERSION << "."; throw error << "Theme uses format version " << mVersion << ". Minimum supported version is " << MINIMUM_THEME_FORMAT_VERSION << ".";
parseIncludes(root); parseIncludes(root);
parseViews(root); parseViews(root);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment