This repository has been archived by the owner on Apr 15, 2023. It is now read-only.
/
Skin.h
137 lines (112 loc) · 4.83 KB
/
Skin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#pragma once
/*
* Copyright (C) 2005-2008 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "Addon.h"
#include "GraphicContext.h" // needed for the RESOLUTION members
#include "GUIIncludes.h" // needed for the GUIInclude member
#define CREDIT_LINE_LENGTH 50
class TiXmlNode;
namespace ADDON
{
class CSkinInfo : public CAddon
{
public:
class CStartupWindow
{
public:
CStartupWindow(int id, const CStdString &name)
{
m_id = id; m_name = name;
};
int m_id;
CStdString m_name;
};
//FIXME remove this, kept for current repo handling
CSkinInfo(const ADDON::AddonProps &props) : CAddon(props) {}
CSkinInfo(cp_plugin_info_t *props);
virtual ~CSkinInfo();
/*! \brief Load information regarding the skin from the given skin directory
\param skinDir folder of the skin to load (defaults to this skin's basedir)
*/
void Start(const CStdString& skinDir = "");
bool HasSkinFile(const CStdString &strFile) const;
/*! \brief Get the full path to the specified file in the skin
We search for XML files in the skin folder that best matches the current resolution.
\param file XML file to look for
\param res [out] If non-NULL, the resolution that the returned XML file is in is returned. Defaults to NULL.
\param baseDir [in] If non-empty, the given directory is searched instead of the skin's directory. Defaults to empty.
\return path to the XML file
*/
CStdString GetSkinPath(const CStdString& file, RESOLUTION *res = NULL, const CStdString& baseDir = "") const;
double GetVersion() const { return m_Version; };
/*! \brief Return whether skin debugging is enabled
\return true if skin debugging (set via <debugging>true</debugging> in skin.xml) is enabled.
*/
bool IsDebugging() const { return m_debugging; };
/*! \brief Get the id of the first window to load
The first window is generally Startup.xml unless it doesn't exist or if the skinner
has specified which start windows they support and the user is going to somewhere other
than the home screen.
\return id of the first window to load
*/
int GetFirstWindow() const;
/*! \brief Get the id of the window the user wants to start in after any skin animation
\return id of the start window
*/
int GetStartWindow() const;
void ResolveIncludes(TiXmlElement *node, const CStdString &type = "");
bool ResolveConstant(const CStdString &constant, float &value) const;
bool ResolveConstant(const CStdString &constant, unsigned int &value) const;
float GetEffectsSlowdown() const { return m_effectsSlowDown; };
const std::vector<CStartupWindow> &GetStartupWindows() const { return m_startupWindows; };
/*! \brief Retrieve the skin paths to search for skin XML files
\param paths [out] vector of paths to search, in order.
*/
void GetSkinPaths(std::vector<CStdString> &paths) const;
// static bool Check(const CStdString& strSkinDir); // checks if everything is present and accounted for without loading the skin
static double GetMinVersion();
protected:
/*! \brief Given a resolution, retrieve the corresponding directory name
\param res RESOLUTION to translate
\return directory name for res
*/
CStdString GetDirFromRes(RESOLUTION res) const;
/*! \brief grab a resolution tag from a skin's configuration data
\param props passed addoninfo structure to check for resolution
\param tag name of the tag to look for
\param res resolution to return
\return true if we find a valid resolution, false otherwise
*/
void GetDefaultResolution(cp_plugin_info_t *props, const char *tag, RESOLUTION &res, const RESOLUTION &def) const;
void LoadIncludes();
bool LoadStartupWindows(cp_plugin_info_t *startup);
bool IsWide(RESOLUTION res) const;
RESOLUTION m_DefaultResolution; // default resolution for the skin in 4:3 modes
RESOLUTION m_DefaultResolutionWide; // default resolution for the skin in 16:9 modes
double m_Version;
float m_effectsSlowDown;
CGUIIncludes m_includes;
std::vector<CStartupWindow> m_startupWindows;
bool m_onlyAnimateToHome;
bool m_debugging;
};
} /*namespace ADDON*/
extern boost::shared_ptr<ADDON::CSkinInfo> g_SkinInfo;