aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2010-06-27 02:40:17 +0000
committerjmarshallnz <jmarshallnz@svn>2010-06-27 02:40:17 +0000
commit3a269e3581dd9c6005bccc735da61b860331e3af (patch)
treeb385599604a9cd2dc879d870ae5624b251fbd1ff
parentfbd3b6d59106bc7b7ac079f9ff198e41b5da22b9 (diff)
added: default resolution to winxml and winxmldialog. Fixes $9464. Parameters are now xml_file,fallback_path,default_skin,default_res. default_res defaults to "720p"
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31434 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--xbmc/addons/Skin.cpp5
-rw-r--r--xbmc/addons/Skin.h2
-rw-r--r--xbmc/lib/libPython/xbmcmodule/winxml.cpp58
-rw-r--r--xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp60
4 files changed, 53 insertions, 72 deletions
diff --git a/xbmc/addons/Skin.cpp b/xbmc/addons/Skin.cpp
index ea799e38db..a7461cfb7c 100644
--- a/xbmc/addons/Skin.cpp
+++ b/xbmc/addons/Skin.cpp
@@ -41,6 +41,11 @@ boost::shared_ptr<ADDON::CSkinInfo> g_SkinInfo;
namespace ADDON
{
+CSkinInfo::CSkinInfo(const AddonProps &props, RESOLUTION res)
+ : CAddon(props), m_DefaultResolution(res), m_DefaultResolutionWide(res)
+{
+}
+
CSkinInfo::CSkinInfo(const cp_extension_t *ext)
: CAddon(ext)
{
diff --git a/xbmc/addons/Skin.h b/xbmc/addons/Skin.h
index 185e917513..99cdeec4ec 100644
--- a/xbmc/addons/Skin.h
+++ b/xbmc/addons/Skin.h
@@ -46,7 +46,7 @@ public:
};
//FIXME remove this, kept for current repo handling
- CSkinInfo(const ADDON::AddonProps &props) : CAddon(props) {}
+ CSkinInfo(const ADDON::AddonProps &props, RESOLUTION res = RES_HDTV_720p);
CSkinInfo(const cp_extension_t *ext);
virtual ~CSkinInfo();
diff --git a/xbmc/lib/libPython/xbmcmodule/winxml.cpp b/xbmc/lib/libPython/xbmcmodule/winxml.cpp
index cbcd8f38b7..f77943e3e7 100644
--- a/xbmc/lib/libPython/xbmcmodule/winxml.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/winxml.cpp
@@ -76,61 +76,49 @@ namespace PYXBMC
PyObject* pyOXMLname = NULL;
PyObject* pyOname = NULL;
PyObject* pyDName = NULL;
+ PyObject* pyRes = NULL;
char bForceDefaultSkin = false;
string strXMLname, strFallbackPath;
string strDefault = "Default";
+ string resolution = "720p";
- if (!PyArg_ParseTuple(args, (char*)"OO|Ob", &pyOXMLname, &pyOname, &pyDName, &bForceDefaultSkin )) return NULL;
+ if (!PyArg_ParseTuple(args, (char*)"OO|OOb", &pyOXMLname, &pyOname, &pyDName, &pyRes, &bForceDefaultSkin )) return NULL;
PyXBMCGetUnicodeString(strXMLname, pyOXMLname);
PyXBMCGetUnicodeString(strFallbackPath, pyOname);
if (pyDName) PyXBMCGetUnicodeString(strDefault, pyDName);
+ if (pyRes) PyXBMCGetUnicodeString(resolution, pyRes);
+ // Check to see if the XML file exists in current skin. If not use fallback path to find a skin for the script
RESOLUTION res;
- CStdString strSkinPath;
- if (!bForceDefaultSkin)
- {
- // Check to see if the XML file exists in current skin. If not use fallback path to find a skin for the script
- strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res);
+ CStdString strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res);
+ if (!XFILE::CFile::Exists(strSkinPath))
+ {
+ // Check for the matching folder for the skin in the fallback skins folder
+ CStdString fallbackPath = CUtil::AddFileToFolder(strFallbackPath, "resources");
+ fallbackPath = CUtil::AddFileToFolder(fallbackPath, "skins");
+ CStdString basePath = CUtil::AddFileToFolder(fallbackPath, g_SkinInfo->ID());
+ strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res, basePath);
if (!XFILE::CFile::Exists(strSkinPath))
{
- // Check for the matching folder for the skin in the fallback skins folder
- CStdString basePath;
- CUtil::AddFileToFolder(strFallbackPath, "resources", basePath);
- CUtil::AddFileToFolder(basePath, "skins", basePath);
- CUtil::AddFileToFolder(basePath, CUtil::GetFileName(g_SkinInfo->Path()), basePath);
- strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res, basePath);
+ // 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, str);
+ CSkinInfo skinInfo(props, CSkinInfo::TranslateResolution(resolution, RES_HDTV_720p));
+ basePath = CUtil::AddFileToFolder(fallbackPath, strDefault);
+
+ skinInfo.Start(basePath);
+ strSkinPath = skinInfo.GetSkinPath(strXMLname, &res, basePath);
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
- bForceDefaultSkin = true;
+ PyErr_SetString(PyExc_TypeError, "XML File for Window is missing");
+ return NULL;
}
}
}
- if (bForceDefaultSkin)
- {
- //FIXME make this static method of current skin?
- CStdString str("none");
- AddonProps props(str, ADDON_SKIN, str);
- CSkinInfo skinInfo(props);
- CStdString basePath;
- CUtil::AddFileToFolder(strFallbackPath, "resources", basePath);
- CUtil::AddFileToFolder(basePath, "skins", basePath);
- CUtil::AddFileToFolder(basePath, strDefault, basePath);
-
- skinInfo.Start(basePath);
- strSkinPath = skinInfo.GetSkinPath(strXMLname, &res, basePath);
-
- if (!XFILE::CFile::Exists(strSkinPath))
- {
- PyErr_SetString(PyExc_TypeError, "XML File for Window is missing");
- return NULL;
- }
- }
-
self->sFallBackPath = strFallbackPath;
self->sXMLFileName = strSkinPath;
self->bUsingXML = true;
diff --git a/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp b/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
index 3c2b10e07b..13dff967f3 100644
--- a/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
+++ b/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
@@ -76,61 +76,49 @@ namespace PYXBMC
PyObject* pyOXMLname = NULL;
PyObject* pyOname = NULL;
PyObject* pyDName = NULL;
- char bForceDefaultSkin = false;
+ PyObject* pyRes = NULL;
string strXMLname, strFallbackPath;
string strDefault = "Default";
+ string resolution = "720p";
- if (!PyArg_ParseTuple(args, (char*)"OO|Ob", &pyOXMLname, &pyOname, &pyDName, &bForceDefaultSkin )) return NULL;
+ if (!PyArg_ParseTuple(args, (char*)"OO|OO", &pyOXMLname, &pyOname, &pyDName, &pyRes)) return NULL;
PyXBMCGetUnicodeString(strXMLname, pyOXMLname);
PyXBMCGetUnicodeString(strFallbackPath, pyOname);
if (pyDName) PyXBMCGetUnicodeString(strDefault, pyDName);
+ if (pyRes) PyXBMCGetUnicodeString(resolution, pyRes);
+ // Check to see if the XML file exists in current skin. If not use fallback path to find a skin for the script
RESOLUTION res;
- CStdString strSkinPath;
- if (!bForceDefaultSkin)
- {
- // Check to see if the XML file exists in current skin. If not use fallback path to find a skin for the script
- strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res);
+ CStdString strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res);
+ if (!XFILE::CFile::Exists(strSkinPath))
+ {
+ // Check for the matching folder for the skin in the fallback skins folder
+ CStdString fallbackPath = CUtil::AddFileToFolder(strFallbackPath, "resources");
+ fallbackPath = CUtil::AddFileToFolder(fallbackPath, "skins");
+ CStdString basePath = CUtil::AddFileToFolder(fallbackPath, g_SkinInfo->ID());
+ strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res, basePath);
if (!XFILE::CFile::Exists(strSkinPath))
{
- // Check for the matching folder for the skin in the fallback skins folder
- CStdString basePath;
- CUtil::AddFileToFolder(strFallbackPath, "resources", basePath);
- CUtil::AddFileToFolder(basePath, "skins", basePath);
- CUtil::AddFileToFolder(basePath, CUtil::GetFileName(g_SkinInfo->Path()), basePath);
- strSkinPath = g_SkinInfo->GetSkinPath(strXMLname, &res, basePath);
+ // 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, str);
+ CSkinInfo skinInfo(props, CSkinInfo::TranslateResolution(resolution, RES_HDTV_720p));
+
+ CStdString basePath = CUtil::AddFileToFolder(fallbackPath, strDefault);
+ skinInfo.Start(basePath);
+ strSkinPath = skinInfo.GetSkinPath(strXMLname, &res, basePath);
+
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
- bForceDefaultSkin = true;
+ PyErr_SetString(PyExc_TypeError, "XML File for Window is missing");
+ return NULL;
}
}
}
- if (bForceDefaultSkin)
- {
- //FIXME make this static method of current skin?
- CStdString str("none");
- AddonProps props(str, ADDON_SKIN, str);
- CSkinInfo skinInfo(props);
- CStdString basePath;
- CUtil::AddFileToFolder(strFallbackPath, "resources", basePath);
- CUtil::AddFileToFolder(basePath, "skins", basePath);
- CUtil::AddFileToFolder(basePath, strDefault, basePath);
-
- skinInfo.Start(basePath);
- strSkinPath = skinInfo.GetSkinPath(strXMLname, &res, basePath);
-
- if (!XFILE::CFile::Exists(strSkinPath))
- {
- PyErr_SetString(PyExc_TypeError, "XML File for Window is missing");
- return NULL;
- }
- }
-
self->sFallBackPath = strFallbackPath;
self->sXMLFileName = strSkinPath;
self->bUsingXML = true;