当前位置: 首页>>代码示例>>C++>>正文


C++ addon::AddonPtr类代码示例

本文整理汇总了C++中addon::AddonPtr的典型用法代码示例。如果您正苦于以下问题:C++ AddonPtr类的具体用法?C++ AddonPtr怎么用?C++ AddonPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AddonPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的addon::AddonPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。