本文整理汇总了C++中addon::AddonPtr类的典型用法代码示例。如果您正苦于以下问题:C++ AddonPtr类的具体用法?C++ AddonPtr怎么用?C++ AddonPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AddonPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ShowForAddon
bool CGUIDialogAddonSettings::ShowForAddon(const ADDON::AddonPtr &addon, bool saveToDisk /* = true */)
{
if (addon == nullptr)
return false;
if (!g_passwordManager.CheckMenuLock(WINDOW_ADDON_BROWSER))
return false;
if (!addon->HasSettings())
{
// addon does not support settings, inform user
CGUIDialogOK::ShowAndGetInput(CVariant{ 24000 }, CVariant{ 24030 });
return false;
}
// Create the dialog
CGUIDialogAddonSettings* dialog = g_windowManager.GetWindow<CGUIDialogAddonSettings>(WINDOW_DIALOG_ADDON_SETTINGS);
if (dialog == nullptr)
return false;
dialog->m_addon = addon;
dialog->Open();
if (!dialog->IsConfirmed())
return false;
if (saveToDisk)
addon->SaveSettings();
return true;
}
开发者ID:anaconda,项目名称:xbmc,代码行数:31,代码来源:GUIDialogAddonSettings.cpp
示例2: AddonHasSettings
bool AddonHasSettings(const std::string &condition, const std::string &value, const std::string &settingId)
{
if (settingId.empty())
return false;
CSettingAddon *setting = (CSettingAddon*)CSettings::Get().GetSetting(settingId);
if (setting == NULL)
return false;
ADDON::AddonPtr addon;
if (!ADDON::CAddonMgr::Get().GetAddon(setting->GetValue(), addon, setting->GetAddonType()) || addon == NULL)
return false;
return addon->HasSettings();
}
开发者ID:gmahieux,项目名称:xbmc,代码行数:15,代码来源:Settings.cpp
示例3: InstallModal
bool CAddonInstaller::InstallModal(const std::string &addonID, ADDON::AddonPtr &addon, bool promptForInstall /* = true */)
{
if (!g_passwordManager.CheckMenuLock(WINDOW_ADDON_BROWSER))
return false;
// we assume that addons that are enabled don't get to this routine (i.e. that GetAddon() has been called)
if (CAddonMgr::GetInstance().GetAddon(addonID, addon, ADDON_UNKNOWN, false))
return false; // addon is installed but disabled, and the user has specifically activated something that needs
// the addon - should we enable it?
// check we have it available
CAddonDatabase database;
database.Open();
if (!database.GetAddon(addonID, addon))
return false;
// if specified ask the user if he wants it installed
if (promptForInstall)
{
if (HELPERS::ShowYesNoDialogLines(CVariant{24076}, CVariant{24100}, CVariant{addon->Name()}, CVariant{24101}) !=
DialogResponse::YES)
{
return false;
}
}
if (!InstallOrUpdate(addonID, false, true))
return false;
return CAddonMgr::GetInstance().GetAddon(addonID, addon);
}
开发者ID:krattai,项目名称:sht_tv,代码行数:31,代码来源:AddonInstaller.cpp
示例4: CanHandleRequest
bool CHTTPPythonHandler::CanHandleRequest(const HTTPRequest &request)
{
ADDON::AddonPtr addon;
std::string path;
// try to resolve the addon as any python script must be part of a webinterface
if (!CHTTPWebinterfaceHandler::ResolveAddon(request.pathUrl, addon, path) ||
addon == NULL || addon->Type() != ADDON::ADDON_WEB_INTERFACE)
return false;
// static webinterfaces aren't allowed to run python scripts
ADDON::CWebinterface* webinterface = static_cast<ADDON::CWebinterface*>(addon.get());
if (webinterface->GetType() != ADDON::WebinterfaceTypeWsgi)
return false;
return true;
}
开发者ID:69thelememt,项目名称:xbmc,代码行数:16,代码来源:HTTPPythonHandler.cpp
示例5: ResolveUrl
int CHTTPWebinterfaceHandler::ResolveUrl(const std::string &url, std::string &path, ADDON::AddonPtr &addon)
{
// determine the addon and addon's path
if (!ResolveAddon(url, addon, path))
return MHD_HTTP_NOT_FOUND;
if (XFILE::CDirectory::Exists(path))
{
if (URIUtils::GetFileName(path).empty())
{
// determine the actual file path using the default entry point
if (addon != NULL && addon->Type() == ADDON::ADDON_WEB_INTERFACE)
path = std::dynamic_pointer_cast<ADDON::CWebinterface>(addon)->GetEntryPoint(path);
}
else
{
URIUtils::AddSlashAtEnd(path);
return MHD_HTTP_FOUND;
}
}
if (!XFILE::CFile::Exists(path))
return MHD_HTTP_NOT_FOUND;
// white/black list access check
if (!CFileUtils::ZebraListAccessCheck(path))
return MHD_HTTP_NOT_FOUND;
return MHD_HTTP_OK;
}
开发者ID:AndyPeterman,项目名称:mrmc,代码行数:30,代码来源:HTTPWebinterfaceHandler.cpp
示例6: ResolveAddon
bool CHTTPWebinterfaceHandler::ResolveAddon(const std::string &url, ADDON::AddonPtr &addon, std::string &addonPath)
{
std::string path = url;
// check if the URL references a specific addon
if (url.find("/addons/") == 0 && url.size() > 8)
{
std::vector<std::string> components;
StringUtils::Tokenize(path, components, WEBSERVER_DIRECTORY_SEPARATOR);
if (components.size() <= 1)
return false;
if (!ADDON::CAddonMgr::GetInstance().GetAddon(components.at(1), addon) || addon == NULL)
return false;
addonPath = addon->Path();
if (addon->Type() != ADDON::ADDON_WEB_INTERFACE) // No need to append /htdocs for web interfaces
addonPath = URIUtils::AddFileToFolder(addonPath, "/htdocs/");
// remove /addons/<addon-id> from the path
components.erase(components.begin(), components.begin() + 2);
// determine the path within the addon
path = StringUtils::Join(components, WEBSERVER_DIRECTORY_SEPARATOR);
}
else if (!ADDON::CAddonMgr::GetInstance().GetDefault(ADDON::ADDON_WEB_INTERFACE, addon) || addon == NULL)
return false;
// get the path of the addon
addonPath = addon->Path();
// add /htdocs/ to the addon's path if it's not a webinterface
if (addon->Type() != ADDON::ADDON_WEB_INTERFACE)
addonPath = URIUtils::AddFileToFolder(addonPath, "/htdocs/");
// append the path within the addon to the path of the addon
addonPath = URIUtils::AddFileToFolder(addonPath, path);
// ensure that we don't have a directory traversal hack here
// by checking if the resolved absolute path is inside the addon path
std::string realPath = URIUtils::GetRealPath(addonPath);
std::string realAddonPath = URIUtils::GetRealPath(addon->Path());
if (!URIUtils::IsInPath(realPath, realAddonPath))
return false;
return true;
}
开发者ID:AndyPeterman,项目名称:mrmc,代码行数:47,代码来源:HTTPWebinterfaceHandler.cpp
示例7: AddonHasSettings
bool AddonHasSettings(const std::string &condition, const std::string &value, SettingConstPtr setting, void *data)
{
if (setting == NULL)
return false;
std::shared_ptr<const CSettingAddon> settingAddon = std::dynamic_pointer_cast<const CSettingAddon>(setting);
if (settingAddon == NULL)
return false;
ADDON::AddonPtr addon;
if (!CServiceBroker::GetAddonMgr().GetAddon(settingAddon->GetValue(), addon, settingAddon->GetAddonType()) || addon == NULL)
return false;
if (addon->Type() == ADDON::ADDON_SKIN)
return ((ADDON::CSkinInfo*)addon.get())->HasSkinFile("SkinSettings.xml");
return addon->HasSettings();
}
开发者ID:AlwinEsch,项目名称:kodi,代码行数:18,代码来源:SettingConditions.cpp
示例8: getAddonModuleDeps
void CPythonInvoker::getAddonModuleDeps(const ADDON::AddonPtr& addon, std::set<std::string>& paths)
{
for (const auto& it : addon->GetDependencies())
{
//Check if dependency is a module addon
ADDON::AddonPtr dependency;
if (CServiceBroker::GetAddonMgr().GetAddon(it.id, dependency, ADDON::ADDON_SCRIPT_MODULE))
{
std::string path = CSpecialProtocol::TranslatePath(dependency->LibPath());
if (paths.find(path) == paths.end())
{
// add it and its dependencies
paths.insert(path);
getAddonModuleDeps(dependency, paths);
}
}
}
}
开发者ID:Montellese,项目名称:xbmc,代码行数:18,代码来源:PythonInvoker.cpp
示例9: OnDisable
void CAddonDatabase::OnDisable(const ADDON::AddonPtr &addon)
{
if (!addon)
return;
IAddonDatabaseCallback *cb = GetCallbackForType(addon->Type());
if (cb)
cb->AddonDisabled(addon);
}
开发者ID:pixl-project,项目名称:xbmc,代码行数:9,代码来源:AddonDatabase.cpp
示例10: GetXbmcApiVersionDependency
CStdString GetXbmcApiVersionDependency(ADDON::AddonPtr addon)
{
CStdString version("1.0");
if (addon.get() != NULL)
{
const ADDON::ADDONDEPS &deps = addon->GetDeps();
ADDON::ADDONDEPS::const_iterator it;
CStdString key("xbmc.python");
it = deps.find(key);
if (!(it == deps.end()))
{
const ADDON::AddonVersion * xbmcApiVersion = &(it->second.first);
version = xbmcApiVersion->c_str();
}
}
return version;
}
开发者ID:snikhil0,项目名称:xbmc,代码行数:18,代码来源:Addon.cpp
示例11: AddonHasSettings
bool AddonHasSettings(const std::string &condition, const std::string &value, const CSetting *setting, void *data)
{
if (setting == NULL)
return false;
const CSettingAddon *settingAddon = dynamic_cast<const CSettingAddon*>(setting);
if (settingAddon == NULL)
return false;
ADDON::AddonPtr addon;
if (!ADDON::CAddonMgr::GetInstance().GetAddon(settingAddon->GetValue(), addon, settingAddon->GetAddonType()) || addon == NULL)
return false;
if (addon->Type() == ADDON::ADDON_SKIN)
return ((ADDON::CSkinInfo*)addon.get())->HasSkinFile("SkinSettings.xml");
return addon->HasSettings();
}
开发者ID:Adeelb,项目名称:xbmc,代码行数:18,代码来源:SettingConditions.cpp
示例12: AddonHasSettings
bool AddonHasSettings(const std::string &condition, const std::string &value, const std::string &settingId)
{
if (settingId.empty())
return false;
CSettingAddon *setting = (CSettingAddon*)CSettings::Get().GetSetting(settingId);
if (setting == NULL)
return false;
ADDON::AddonPtr addon;
if (!ADDON::CAddonMgr::Get().GetAddon(setting->GetValue(), addon, setting->GetAddonType()) || addon == NULL)
return false;
if (addon->Type() == ADDON::ADDON_SKIN)
return ((ADDON::CSkinInfo*)addon.get())->HasSkinFile("SkinSettings.xml");
return addon->HasSettings();
}
开发者ID:Anankin,项目名称:xbmc,代码行数:18,代码来源:Settings.cpp
示例13: getAddonModuleDeps
void CPythonInvoker::getAddonModuleDeps(const ADDON::AddonPtr& addon, std::set<std::string>& paths)
{
ADDON::ADDONDEPS deps = addon->GetDeps();
for (ADDON::ADDONDEPS::const_iterator it = deps.begin(); it != deps.end(); ++it)
{
//Check if dependency is a module addon
ADDON::AddonPtr dependency;
if (ADDON::CAddonMgr::Get().GetAddon(it->first, dependency, ADDON::ADDON_SCRIPT_MODULE))
{
std::string path = CSpecialProtocol::TranslatePath(dependency->LibPath());
if (paths.find(path) == paths.end())
{
// add it and its dependencies
paths.insert(path);
getAddonModuleDeps(dependency, paths);
}
}
}
}
开发者ID:Jmend25,项目名称:boxeebox-xbmc,代码行数:19,代码来源:PythonInvoker.cpp
示例14: OnEnable
bool CAddonDatabase::OnEnable(const ADDON::AddonPtr &addon, bool bDisabled)
{
if (!addon)
return false;
IAddonDatabaseCallback *cb = GetCallbackForType(addon->Type());
if (cb)
return cb->AddonEnabled(addon, bDisabled);
return true;
}
开发者ID:pixl-project,项目名称:xbmc,代码行数:11,代码来源:AddonDatabase.cpp
示例15: IsStandaloneGame
bool CGameUtils::IsStandaloneGame(const ADDON::AddonPtr& addon)
{
using namespace ADDON;
switch (addon->Type())
{
case ADDON_GAMEDLL:
{
return std::static_pointer_cast<GAME::CGameClient>(addon)->SupportsStandalone();
}
case ADDON_SCRIPT:
{
return addon->IsType(ADDON_GAME);
}
default:
break;
}
return false;
}
开发者ID:Arcko,项目名称:xbmc,代码行数:20,代码来源:GameUtils.cpp
示例16: Update
void CGUIButtonSettingControl::Update()
{
CStdString strText = ((CSettingString *)m_pSetting)->GetData();
if (m_pSetting->GetType() == SETTINGS_TYPE_ADDON)
{
ADDON::AddonPtr addon;
if (ADDON::CAddonMgr::Get().GetAddon(strText, addon))
strText = addon->Name();
if (strText.IsEmpty())
strText = g_localizeStrings.Get(231); // None
}
else if (m_pSetting->GetControlType() == BUTTON_CONTROL_PATH_INPUT)
{
CStdString shortPath;
if (CUtil::MakeShortenPath(strText, shortPath, 30 ))
strText = shortPath;
}
else if (m_pSetting->GetControlType() == BUTTON_CONTROL_STANDARD)
return;
if (m_pButton)
m_pButton->SetLabel2(strText);
}
开发者ID:2BReality,项目名称:xbmc,代码行数:22,代码来源:GUISettingControls.cpp
示例17: GetAddonWithHash
bool CAddonInstallJob::GetAddonWithHash(const std::string& addonID, RepositoryPtr& repo,
ADDON::AddonPtr& addon, std::string& hash)
{
if (!CAddonMgr::GetInstance().FindInstallableById(addonID, addon))
return false;
AddonPtr tmp;
if (!CAddonMgr::GetInstance().GetAddon(addon->Origin(), tmp, ADDON_REPOSITORY))
return false;
repo = std::static_pointer_cast<CRepository>(tmp);
return repo->GetAddonHash(addon, hash);
}
开发者ID:Razzeee,项目名称:xbmc,代码行数:13,代码来源:AddonInstaller.cpp
示例18: Update
void CGUIControlButtonSetting::Update()
{
if (m_pButton == NULL)
return;
CGUIControlBaseSetting::Update();
if (m_pSetting->GetType() == SettingTypeString)
{
std::string strText = ((CSettingString *)m_pSetting)->GetValue();
switch (m_pSetting->GetControl().GetFormat())
{
case SettingControlFormatAddon:
{
ADDON::AddonPtr addon;
if (ADDON::CAddonMgr::Get().GetAddon(strText, addon))
strText = addon->Name();
if (strText.empty())
strText = g_localizeStrings.Get(231); // None
break;
}
case SettingControlFormatPath:
{
CStdString shortPath;
if (CUtil::MakeShortenPath(strText, shortPath, 30))
strText = shortPath;
break;
}
default:
return;
}
m_pButton->SetLabel2(strText);
}
}
开发者ID:Micromax-56,项目名称:xbmc,代码行数:37,代码来源:GUIControlSettings.cpp
示例19: InitializeInterpreter
void XBPython::InitializeInterpreter(ADDON::AddonPtr addon)
{
{
GilSafeSingleLock lock(m_critSection);
initModule_xbmcgui();
initModule_xbmc();
initModule_xbmcplugin();
initModule_xbmcaddon();
initModule_xbmcvfs();
}
CStdString addonVer = ADDON::GetXbmcApiVersionDependency(addon);
bool bwcompatMode = (addon.get() == NULL || (ADDON::AddonVersion(addonVer) <= ADDON::AddonVersion("1.0")));
const char* runscript = bwcompatMode ? RUNSCRIPT_BWCOMPATIBLE : RUNSCRIPT_COMPLIANT;
// redirecting default output to debug console
if (PyRun_SimpleString(runscript) == -1)
{
CLog::Log(LOGFATAL, "Python Initialize Error");
}
}
开发者ID:mikedoner,项目名称:xbmc,代码行数:21,代码来源:XBPython.cpp
示例20: OnContextButton
//.........这里部分代码省略.........
g_settings.Save();
return true;
case CONTEXT_BUTTON_GO_TO_ARTIST:
{
CStdString strPath;
CVideoDatabase database;
database.Open();
strPath.Format("videodb://3/4/%ld/",database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtist()));
g_windowManager.ActivateWindow(WINDOW_VIDEO_NAV,strPath);
return true;
}
case CONTEXT_BUTTON_PLAY_OTHER:
{
CVideoDatabase database;
database.Open();
CVideoInfoTag details;
database.GetMusicVideoInfo("",details,database.GetMatchingMusicVideo(item->GetMusicInfoTag()->GetArtist(),item->GetMusicInfoTag()->GetAlbum(),item->GetMusicInfoTag()->GetTitle()));
g_application.getApplicationMessenger().PlayFile(CFileItem(details));
return true;
}
case CONTEXT_BUTTON_MARK_WATCHED:
CGUIWindowVideoBase::MarkWatched(item,true);
CUtil::DeleteVideoDatabaseDirectoryCache();
Update(m_vecItems->GetPath());
return true;
case CONTEXT_BUTTON_MARK_UNWATCHED:
CGUIWindowVideoBase::MarkWatched(item,false);
CUtil::DeleteVideoDatabaseDirectoryCache();
Update(m_vecItems->GetPath());
return true;
case CONTEXT_BUTTON_RENAME:
CGUIWindowVideoBase::UpdateVideoTitle(item.get());
CUtil::DeleteVideoDatabaseDirectoryCache();
Update(m_vecItems->GetPath());
return true;
case CONTEXT_BUTTON_DELETE:
if (item->IsPlayList() || item->IsSmartPlayList())
{
item->m_bIsFolder = false;
CFileUtils::DeleteItem(item);
}
else
{
CGUIWindowVideoNav::DeleteItem(item.get());
CUtil::DeleteVideoDatabaseDirectoryCache();
}
Update(m_vecItems->GetPath());
return true;
case CONTEXT_BUTTON_SET_CONTENT:
{
bool bScan=false;
ADDON::ScraperPtr scraper;
CStdString path(item->GetPath());
CQueryParams params;
CDirectoryNode::GetDatabaseInfo(item->GetPath(), params);
CONTENT_TYPE content = CONTENT_ALBUMS;
if (params.GetAlbumId() != -1)
path.Format("musicdb://3/%i/",params.GetAlbumId());
else if (params.GetArtistId() != -1)
{
path.Format("musicdb://2/%i/",params.GetArtistId());
content = CONTENT_ARTISTS;
}
if (m_vecItems->GetPath().Equals("musicdb://1/") || item->GetPath().Equals("musicdb://2/"))
{
content = CONTENT_ARTISTS;
}
if (!m_musicdatabase.GetScraperForPath(path, scraper, ADDON::ScraperTypeFromContent(content)))
{
ADDON::AddonPtr defaultScraper;
if (ADDON::CAddonMgr::Get().GetDefault(ADDON::ScraperTypeFromContent(content), defaultScraper))
{
scraper = boost::dynamic_pointer_cast<ADDON::CScraper>(defaultScraper->Clone(defaultScraper));
}
}
if (CGUIDialogContentSettings::Show(scraper, bScan, content))
{
m_musicdatabase.SetScraperForPath(path,scraper);
if (bScan)
OnInfoAll(itemNumber,true);
}
return true;
}
default:
break;
}
return CGUIWindowMusicBase::OnContextButton(itemNumber, button);
}
开发者ID:AWilco,项目名称:xbmc,代码行数:101,代码来源:GUIWindowMusicNav.cpp
注:本文中的addon::AddonPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论