4 * Copyright (C) 2005-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
24 #include "guilib/GraphicContext.h" // needed for the RESOLUTION members
25 #include "guilib/GUIIncludes.h" // needed for the GUIInclude member
26 #define CREDIT_LINE_LENGTH 50
33 class CSkinInfo : public CAddon
39 CStartupWindow(int id, const CStdString &name)
41 m_id = id; m_name = name;
47 //FIXME remove this, kept for current repo handling
48 CSkinInfo(const ADDON::AddonProps &props, const RESOLUTION_INFO &res = RESOLUTION_INFO());
49 CSkinInfo(const cp_extension_t *ext);
52 /*! \brief Load resultion information from directories in Path().
56 bool HasSkinFile(const CStdString &strFile) const;
58 /*! \brief Get the full path to the specified file in the skin
59 We search for XML files in the skin folder that best matches the current resolution.
60 \param file XML file to look for
61 \param res [out] If non-NULL, the resolution that the returned XML file is in is returned. Defaults to NULL.
62 \param baseDir [in] If non-empty, the given directory is searched instead of the skin's directory. Defaults to empty.
63 \return path to the XML file
65 CStdString GetSkinPath(const CStdString& file, RESOLUTION_INFO *res = NULL, const CStdString& baseDir = "") const;
67 double GetVersion() const { return m_Version; };
69 /*! \brief Return whether skin debugging is enabled
70 \return true if skin debugging (set via <debugging>true</debugging> in skin.xml) is enabled.
72 bool IsDebugging() const { return m_debugging; };
74 /*! \brief Get the id of the first window to load
75 The first window is generally Startup.xml unless it doesn't exist or if the skinner
76 has specified which start windows they support and the user is going to somewhere other
78 \return id of the first window to load
80 int GetFirstWindow() const;
82 /*! \brief Get the id of the window the user wants to start in after any skin animation
83 \return id of the start window
85 int GetStartWindow() const;
87 /*! \brief Translate a resolution string
88 \param name the string to translate
89 \param res [out] the resolution structure if name is valid
90 \return true if the resolution is valid, false otherwise
92 static bool TranslateResolution(const CStdString &name, RESOLUTION_INFO &res);
94 void ResolveIncludes(TiXmlElement *node, std::map<int, bool>* xmlIncludeConditions = NULL);
96 float GetEffectsSlowdown() const { return m_effectsSlowDown; };
98 const std::vector<CStartupWindow> &GetStartupWindows() const { return m_startupWindows; };
100 /*! \brief Retrieve the skin paths to search for skin XML files
101 \param paths [out] vector of paths to search, in order.
103 void GetSkinPaths(std::vector<CStdString> &paths) const;
105 bool IsInUse() const;
107 const CStdString& GetCurrentAspect() const { return m_currentAspect; }
109 // static bool Check(const CStdString& strSkinDir); // checks if everything is present and accounted for without loading the skin
110 static double GetMinVersion();
112 const INFO::CSkinVariableString* CreateSkinVariable(const CStdString& name, int context);
114 /*! \brief Given a resolution, retrieve the corresponding directory name
115 \param res RESOLUTION to translate
116 \return directory name for res
118 CStdString GetDirFromRes(RESOLUTION res) const;
120 /*! \brief grab a resolution tag from a skin's configuration data
121 \param props passed addoninfo structure to check for resolution
122 \param tag name of the tag to look for
123 \param res resolution to return
124 \return true if we find a valid resolution, false otherwise
126 void GetDefaultResolution(const cp_extension_t *ext, const char *tag, RESOLUTION &res, const RESOLUTION &def) const;
128 bool LoadStartupWindows(const cp_extension_t *ext);
130 RESOLUTION_INFO m_defaultRes;
131 std::vector<RESOLUTION_INFO> m_resolutions;
135 float m_effectsSlowDown;
136 CGUIIncludes m_includes;
137 CStdString m_currentAspect;
139 std::vector<CStartupWindow> m_startupWindows;
140 bool m_onlyAnimateToHome;
144 } /*namespace ADDON*/
146 extern boost::shared_ptr<ADDON::CSkinInfo> g_SkinInfo;