Skip to content

Commit

Permalink
Fixed: Thoroughly search an addon's fallback skin folder for the clos…
Browse files Browse the repository at this point in the history
…est skin resolution.

Before, if
1. 720p is the current resolution and skin.id is the current skin
2. addon.id/skins/skin.id/720p/script-window.xml doesn't exist
3. addon.id/skins/skin.id/ntsc/script-window.xml exists
then #3 would be skipped and the addon would instead be loaded from the default skin folder (i.e. addon.id/skins/default/...).

This commit fixes this behavior; XBMC will attempt to load the closest resolution from the folder of the current skin (if it exists) instead of skipping to the default.
  • Loading branch information
garbear committed Oct 11, 2011
1 parent 1c7da39 commit 8c2249e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
19 changes: 14 additions & 5 deletions xbmc/interfaces/python/xbmcmodule/winxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,27 @@ namespace PYXBMC

if (!XFILE::CFile::Exists(strSkinPath))
{
// Check for the matching folder for the skin in the fallback skins folder
CStdString str("none");
AddonProps props(str, ADDON_SKIN, "", "");
CSkinInfo::TranslateResolution(resolution, res);

CStdString fallbackPath = URIUtils::AddFileToFolder(strFallbackPath, "resources");
fallbackPath = URIUtils::AddFileToFolder(fallbackPath, "skins");
CStdString basePath = URIUtils::AddFileToFolder(fallbackPath, g_SkinInfo->ID());
strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res, basePath);

// Check for the matching folder for the skin in the fallback skins folder (if it exists)
if (XFILE::CFile::Exists(basePath))
{
props.path = basePath;
CSkinInfo skinInfo(props, res);
skinInfo.Start();
strSkinPath = skinInfo.GetSkinPath(strXMLname, &res);
}

if (!XFILE::CFile::Exists(strSkinPath))
{
// Finally fallback to the DefaultSkin as it didn't exist in either the XBMC Skin folder or the fallback skin folder
CStdString str("none");
AddonProps props(str, ADDON_SKIN, "", "");
props.path = URIUtils::AddFileToFolder(fallbackPath, strDefault);
CSkinInfo::TranslateResolution(resolution, res);
CSkinInfo skinInfo(props, res);

skinInfo.Start();
Expand Down
21 changes: 15 additions & 6 deletions xbmc/interfaces/python/xbmcmodule/winxmldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,31 @@ namespace PYXBMC

if (!XFILE::CFile::Exists(strSkinPath))
{
// Check for the matching folder for the skin in the fallback skins folder
CStdString str("none");
AddonProps props(str, ADDON_SKIN, "", "");
CSkinInfo::TranslateResolution(resolution, res);

CStdString fallbackPath = URIUtils::AddFileToFolder(strFallbackPath, "resources");
fallbackPath = URIUtils::AddFileToFolder(fallbackPath, "skins");
CStdString basePath = URIUtils::AddFileToFolder(fallbackPath, g_SkinInfo->ID());
strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res, basePath);

// Check for the matching folder for the skin in the fallback skins folder (if it exists)
if (XFILE::CFile::Exists(basePath))
{
props.path = basePath;
CSkinInfo skinInfo(props, res);
skinInfo.Start();
strSkinPath = skinInfo.GetSkinPath(strXMLname, &res);
}

if (!XFILE::CFile::Exists(strSkinPath))
{
// Finally fallback to the DefaultSkin as it didn't exist in either the XBMC Skin folder or the fallback skin folder
CStdString str("none");
AddonProps props(str, ADDON_SKIN, "", "");
props.path = URIUtils::AddFileToFolder(fallbackPath, strDefault);
CSkinInfo::TranslateResolution(resolution, res);
CSkinInfo skinInfo(props, res);

skinInfo.Start();
strSkinPath = skinInfo.GetSkinPath(strXMLname, &res);
strSkinPath = skinInfo.GetSkinPath(strXMLname, &res);
if (!XFILE::CFile::Exists(strSkinPath))
{
PyErr_SetString(PyExc_TypeError, "XML File for Window is missing");
Expand Down

0 comments on commit 8c2249e

Please sign in to comment.