diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-05-24 01:57:13 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-05-24 01:57:13 +0000 |
commit | 8c86aeeb779ea74cde7b326c0677cf3a730bdfe4 (patch) | |
tree | 9e9325d236065d6c146c746326372580f5ccf203 | |
parent | 0e5671cd85055607922daff63505c4ec4ccbb8b0 (diff) |
cleanup: Get rid of some more old non-cpluff stuff. Should also fix addon strings.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@30495 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | xbmc/addons/AddonManager.cpp | 75 | ||||
-rw-r--r-- | xbmc/addons/AddonManager.h | 2 |
2 files changed, 21 insertions, 56 deletions
diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp index 8c7daf2cda..512b335040 100644 --- a/xbmc/addons/AddonManager.cpp +++ b/xbmc/addons/AddonManager.cpp @@ -249,29 +249,16 @@ void CAddonMgr::DeInit() bool CAddonMgr::HasAddons(const TYPE &type, const CONTENT_TYPE &content/*= CONTENT_NONE*/, bool enabledOnly/*= true*/) { - if (type == ADDON_SCREENSAVER || type == ADDON_SKIN || type == ADDON_VIZ || type == ADDON_SCRIPT || type == ADDON_REPOSITORY || type == ADDON_SCRAPER) - { - cp_status_t status; - int num; - CStdString ext_point(TranslateType(type)); - cp_extension_t **exts = m_cpluff->get_extensions_info(m_cp_context, ext_point.c_str(), &status, &num); - m_cpluff->release_info(m_cp_context, exts); - if (status == CP_OK) - return (num > 0); - } - - if (m_addons.empty()) - { - VECADDONS add; - GetAllAddons(add,false); - } - - if (content == CONTENT_NONE) - return (m_addons.find(type) != m_addons.end()); - - VECADDONS addons; - return GetAddons(type, addons, content, enabledOnly); + cp_status_t status; + int num; + CStdString ext_point(TranslateType(type)); + cp_extension_t **exts = m_cpluff->get_extensions_info(m_cp_context, ext_point.c_str(), &status, &num); + m_cpluff->release_info(m_cp_context, exts); + if (status != CP_OK || num <= 0) + return false; + // FIXME: Support content checking + return true; } bool CAddonMgr::GetAllAddons(VECADDONS &addons, bool enabledOnly/*= true*/) @@ -296,38 +283,18 @@ bool CAddonMgr::GetAddons(const TYPE &type, VECADDONS &addons, const CONTENT_TYP { CSingleLock lock(m_critSection); addons.clear(); - if (type == ADDON_SCREENSAVER || type == ADDON_SKIN || type == ADDON_VIZ || type == ADDON_REPOSITORY || type == ADDON_SCRIPT || type == ADDON_SCRAPER) - { - cp_status_t status; - int num; - CStdString ext_point(TranslateType(type)); - cp_extension_t **exts = m_cpluff->get_extensions_info(m_cp_context, ext_point.c_str(), &status, &num); - for(int i=0; i <num; i++) - { - AddonPtr addon(Factory(exts[i])); - if (addon && (content == CONTENT_NONE || addon->Supports(content))) - addons.push_back(addon); - } - m_cpluff->release_info(m_cp_context, exts); - return addons.size() > 0; - } - - if (m_addons.find(type) != m_addons.end()) + cp_status_t status; + int num; + CStdString ext_point(TranslateType(type)); + cp_extension_t **exts = m_cpluff->get_extensions_info(m_cp_context, ext_point.c_str(), &status, &num); + for(int i=0; i <num; i++) { - IVECADDONS itr = m_addons[type].begin(); - while (itr != m_addons[type].end()) - { // filter out what we're not looking for - if ((enabledOnly && !(*itr)->Enabled()) - || (content != CONTENT_NONE && !(*itr)->Supports(content))) - { - ++itr; - continue; - } - addons.push_back(*itr); - ++itr; - } + AddonPtr addon(Factory(exts[i])); + if (addon && (content == CONTENT_NONE || addon->Supports(content))) + addons.push_back(addon); } - return !addons.empty(); + m_cpluff->release_info(m_cp_context, exts); + return addons.size() > 0; } bool CAddonMgr::GetAddon(const CStdString &str, AddonPtr &addon, const TYPE &type/*=ADDON_UNKNOWN*/, bool enabledOnly/*= true*/) @@ -391,8 +358,8 @@ bool CAddonMgr::GetDefault(const TYPE &type, AddonPtr &addon, const CONTENT_TYPE CStdString CAddonMgr::GetString(const CStdString &id, const int number) { - AddonPtr addon = m_idMap[id]; - if (addon) + AddonPtr addon; + if (GetAddon(id, addon)) return addon->GetString(number); return ""; diff --git a/xbmc/addons/AddonManager.h b/xbmc/addons/AddonManager.h index 1fa8d133a8..e6a427b3ab 100644 --- a/xbmc/addons/AddonManager.h +++ b/xbmc/addons/AddonManager.h @@ -145,9 +145,7 @@ namespace ADDON virtual ~CAddonMgr(); static std::map<TYPE, IAddonMgrCallback*> m_managers; - MAPADDONS m_addons; CStopWatch m_watch; - std::map<CStdString, AddonPtr> m_idMap; CCriticalSection m_critSection; }; |