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


C++ CFileItemList::SetLabel方法代码示例

本文整理汇总了C++中CFileItemList::SetLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemList::SetLabel方法的具体用法?C++ CFileItemList::SetLabel怎么用?C++ CFileItemList::SetLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileItemList的用法示例。


在下文中一共展示了CFileItemList::SetLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetDirectory

bool CVideoDatabaseDirectory::GetDirectory(const CURL& url, CFileItemList &items)
{
  std::string path = CLegacyPathTranslation::TranslateVideoDbPath(url);
  items.SetPath(path);
  items.m_dwSize = -1;  // No size
  std::unique_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(path));

  if (!pNode.get())
    return false;

  bool bResult = pNode->GetChilds(items);
  for (int i=0;i<items.Size();++i)
  {
    CFileItemPtr item = items[i];
    if (item->m_bIsFolder && !item->HasIcon() && !item->HasArt("thumb"))
    {
      std::string strImage = GetIcon(item->GetPath());
      if (!strImage.empty() && g_TextureManager.HasTexture(strImage))
        item->SetIconImage(strImage);
    }
    if (item->GetVideoInfoTag())
    {
      item->SetDynPath(item->GetVideoInfoTag()->GetPath());
    }
  }
  items.SetLabel(pNode->GetLocalizedName());

  return bResult;
}
开发者ID:intrcomp,项目名称:xbmc,代码行数:29,代码来源:VideoDatabaseDirectory.cpp

示例2: GetDirectory

bool CGUIWindowGames::GetDirectory(const std::string &strDirectory, CFileItemList& items)
{
  if (!CGUIMediaWindow::GetDirectory(strDirectory, items))
    return false;

  // Set label
  std::string label;
  if (items.GetLabel().empty())
  {
    std::string source;
    if (m_rootDir.IsSource(items.GetPath(), CMediaSourceSettings::GetInstance().GetSources("games"), &source))
      label = std::move(source);
  }

  if (!label.empty())
    items.SetLabel(label);

  // Set content
  std::string content;
  if (items.GetContent().empty())
  {
    if (!items.IsVirtualDirectoryRoot() && // Don't set content for root directory
        !items.IsPlugin())                 // Don't set content for plugins
    {
      content = "games";
    }
  }

  if (!content.empty())
    items.SetContent(content);

  return true;
}
开发者ID:IchabodFletchman,项目名称:xbmc,代码行数:33,代码来源:GUIWindowGames.cpp

示例3: GetScriptsAndPlugins

bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items)
{
  items.Clear();

  VECADDONS addons;
  if (!GetScriptsAndPlugins(content, addons))
    return false;

  for (unsigned i=0; i<addons.size(); i++)
  {
    CFileItemPtr item(FileItemFromAddon(addons[i], 
                      addons[i]->Type()==ADDON_PLUGIN?"plugin://":"script://",
                      addons[i]->Type() == ADDON_PLUGIN));
    PluginPtr plugin = boost::dynamic_pointer_cast<CPluginSource>(addons[i]);
    if (plugin->ProvidesSeveral())
    {
      CURL url = item->GetAsUrl();
      CStdString opt;
      opt.Format("?content_type=%s",content.c_str());
      url.SetOptions(opt);
      item->SetPath(url.Get());
    }
    items.Add(item);
  }

  items.Add(GetMoreItem(content));

  items.SetContent("addons");
  items.SetLabel(g_localizeStrings.Get(24001)); // Add-ons

  return items.Size() > 0;
}
开发者ID:AFFLUENTSOCIETY,项目名称:SPMC,代码行数:32,代码来源:AddonsDirectory.cpp

示例4: GetDirectory

bool CMusicSearchDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
  // break up our path
  // format is:  musicsearch://<url encoded search string>
  CURL url(strPath);
  CStdString search(url.GetHostName());

  if (search.IsEmpty())
    return false;

  // and retrieve the search details
  items.SetPath(strPath);
  //spotify perform a search in spotify.
  //TODO search all addons providing search functionality
  g_spotify->Search(search, items);
  unsigned int time = XbmcThreads::SystemClockMillis();
  CMusicDatabase db;
  db.Open();
  db.Search(search, items);
  db.Close();
  CLog::Log(LOGDEBUG, "%s (%s) took %u ms",
            __FUNCTION__, strPath.c_str(), XbmcThreads::SystemClockMillis() - time);
  items.SetLabel(g_localizeStrings.Get(137)); // Search
  return true;
}
开发者ID:Alxandr,项目名称:spotyxbmc2,代码行数:25,代码来源:MusicSearchDirectory.cpp

示例5: GetDirectory

bool CGUIWindowPictures::GetDirectory(const CStdString &strDirectory, CFileItemList& items)
{
  if (!CGUIMediaWindow::GetDirectory(strDirectory, items))
    return false;

  CStdString label;
  if (items.GetLabel().empty() && m_rootDir.IsSource(items.GetPath(), CMediaSourceSettings::Get().GetSources("pictures"), &label)) 
    items.SetLabel(label);

  return true;
}
开发者ID:CybeSystems,项目名称:XBMCPortable,代码行数:11,代码来源:GUIWindowPictures.cpp

示例6: GetDirectory

bool CGUIWindowPictures::GetDirectory(const CStdString &strDirectory, CFileItemList& items)
{
  if (!CGUIMediaWindow::GetDirectory(strDirectory, items))
    return false;

  CStdString label;
  if (items.GetLabel().IsEmpty() && m_rootDir.IsSource(items.m_strPath, g_settings.GetSourcesFromType("pictures"), &label)) 
    items.SetLabel(label);

  return true;
}
开发者ID:Saddamisalami,项目名称:xbmc,代码行数:11,代码来源:GUIWindowPictures.cpp

示例7: GetDirectory

bool CGUIWindowJukeboxSongs::GetDirectory(const CStdString &strDirectory, CFileItemList &items) {
  if (!CGUIWindowJukeboxBase::GetDirectory(strDirectory, items))
    return false;

  // check for .CUE files here.
  items.FilterCueItems();

  CStdString label;
  if (items.GetLabel().IsEmpty() && m_rootDir.IsSource(items.GetPath(), g_settings.GetSourcesFromType("music"), &label))
    items.SetLabel(label);

  return true;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例8: GetDirectory

bool CGUIWindowPictures::GetDirectory(const std::string &strDirectory, CFileItemList& items)
{
  if (!CGUIMediaWindow::GetDirectory(strDirectory, items))
    return false;

  std::string label;
  if (items.GetLabel().empty() && m_rootDir.IsSource(items.GetPath(), CMediaSourceSettings::GetInstance().GetSources("pictures"), &label))
    items.SetLabel(label);

  if (items.GetContent().empty() && !items.IsVirtualDirectoryRoot() && !items.IsPlugin())
    items.SetContent("images");
  return true;
}
开发者ID:mojo-hakase,项目名称:xbmc,代码行数:13,代码来源:GUIWindowPictures.cpp

示例9: GetDirectory

bool CGUIWindowMusicSongs::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
  if (!CGUIWindowMusicBase::GetDirectory(strDirectory, items))
    return false;

  // check for .CUE files here.
  items.FilterCueItems();

  CStdString label;
  if (items.GetLabel().empty() && m_rootDir.IsSource(items.GetPath(), CMediaSourceSettings::Get().GetSources("music"), &label)) 
    items.SetLabel(label);

  return true;
}
开发者ID:CaptainRewind,项目名称:xbmc,代码行数:14,代码来源:GUIWindowMusicSongs.cpp

示例10: GetDirectory

bool CVideoDatabaseDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
  auto_ptr<CDirectoryNode> pNode(CDirectoryNode::ParseURL(strPath));

  if (!pNode.get())
    return false;

  bool bResult = pNode->GetChilds(items);
  for (int i=0;i<items.Size();++i)
  {
    CFileItemPtr item = items[i];
    if (item->m_bIsFolder && !item->HasIcon() && !item->HasThumbnail())
    {
      CStdString strImage = GetIcon(item->GetPath());
      if (!strImage.IsEmpty() && g_TextureManager.HasTexture(strImage))
        item->SetIconImage(strImage);
    }
  }
  items.SetLabel(pNode->GetLocalizedName());

  return bResult;
}
开发者ID:JohnsonAugustine,项目名称:xbmc-rbp,代码行数:22,代码来源:VideoDatabaseDirectory.cpp

示例11: GetScriptsAndPlugins

bool CAddonsDirectory::GetScriptsAndPlugins(const CStdString &content, CFileItemList &items)
{
  items.Clear();

  VECADDONS addons;
  if (!GetScriptsAndPlugins(content, addons))
    return false;

  for (unsigned i=0; i<addons.size(); i++)
  {
    if (addons[i]->Type() == ADDON_PLUGIN)
      items.Add(FileItemFromAddon(addons[i], "plugin://", true));
    else
      items.Add(FileItemFromAddon(addons[i], "script://", false));
  }

  items.Add(GetMoreItem(content));

  items.SetContent("addons");
  items.SetLabel(g_localizeStrings.Get(24001)); // Add-ons

  return items.Size() > 0;
}
开发者ID:AWilco,项目名称:xbmc,代码行数:23,代码来源:AddonsDirectory.cpp

示例12: Update

// \brief Set window to a specific directory
// \param strDirectory The directory to be displayed in list/thumb control
// This function calls OnPrepareFileItems() and OnFinalizeFileItems()
bool CGUIMediaWindow::Update(const CStdString &strDirectory)
{
  // TODO: OnInitWindow calls Update() before window path has been set properly.
  if (strDirectory == "?")
    return false;

  // get selected item
  int iItem = m_viewControl.GetSelectedItem();
  CStdString strSelectedItem = "";
  if (iItem >= 0 && iItem < m_vecItems->Size())
  {
    CFileItemPtr pItem = m_vecItems->Get(iItem);
    if (!pItem->IsParentFolder())
    {
      GetDirectoryHistoryString(pItem.get(), strSelectedItem);
    }
  }

  CStdString strOldDirectory = m_vecItems->GetPath();

  m_history.SetSelectedItem(strSelectedItem, strOldDirectory);

  CFileItemList items;
  if (!GetDirectory(strDirectory, items))
  {
    CLog::Log(LOGERROR,"CGUIMediaWindow::GetDirectory(%s) failed", strDirectory.c_str());
    // if the directory is the same as the old directory, then we'll return
    // false.  Else, we assume we can get the previous directory
    if (strDirectory.Equals(strOldDirectory))
      return false;

    // We assume, we can get the parent
    // directory again, but we have to
    // return false to be able to eg. show
    // an error message.
    CStdString strParentPath = m_history.GetParentPath();
    m_history.RemoveParentPath();
    Update(strParentPath);
    return false;
  }

  if (items.GetLabel().IsEmpty())
    items.SetLabel(CUtil::GetTitleFromPath(items.GetPath(), true));

  ClearFileItems();
  m_vecItems->Copy(items);

  // if we're getting the root source listing
  // make sure the path history is clean
  if (strDirectory.IsEmpty())
    m_history.ClearPathHistory();

  int iWindow = GetID();
  int showLabel = 0;
  if (strDirectory.IsEmpty() && (iWindow == WINDOW_MUSIC_FILES ||
                                 iWindow == WINDOW_FILES ||
                                 iWindow == WINDOW_PICTURES ||
                                 iWindow == WINDOW_PROGRAMS))
    showLabel = 1026;
  if (strDirectory.Equals("sources://video/"))
    showLabel = 999;
  if (showLabel && (m_vecItems->Size() == 0 || !m_guiState->DisableAddSourceButtons())) // add 'add source button'
  {
    CStdString strLabel = g_localizeStrings.Get(showLabel);
    CFileItemPtr pItem(new CFileItem(strLabel));
    pItem->SetPath("add");
    pItem->SetIconImage("DefaultAddSource.png");
    pItem->SetLabel(strLabel);
    pItem->SetLabelPreformated(true);
    pItem->m_bIsFolder = true;
    pItem->SetSpecialSort(SORT_ON_BOTTOM);
    m_vecItems->Add(pItem);
  }
  m_iLastControl = GetFocusedControlID();

  //  Ask the derived class if it wants to load additional info
  //  for the fileitems like media info or additional
  //  filtering on the items, setting thumbs.
  OnPrepareFileItems(*m_vecItems);

  // The idea here is to ensure we have something to focus if our file list
  // is empty.  As such, this check MUST be last and ignore the hide parent
  // fileitems settings.
  if (m_vecItems->IsEmpty())
  {
    CFileItemPtr pItem(new CFileItem(".."));
    pItem->SetPath(m_history.GetParentPath());
    pItem->m_bIsFolder = true;
    pItem->m_bIsShareOrDrive = false;
    m_vecItems->AddFront(pItem, 0);
  }

  m_vecItems->FillInDefaultIcons();

  m_guiState.reset(CGUIViewState::GetViewState(GetID(), *m_vecItems));

  FormatAndSort(*m_vecItems);
//.........这里部分代码省略.........
开发者ID:SirTomselon,项目名称:xbmc,代码行数:101,代码来源:GUIMediaWindow.cpp

示例13: GetDirectory


//.........这里部分代码省略.........

        // store the smartplaylist as JSON in the URL as well
        CStdString xsp;
        if (!playlist.IsEmpty(filter))
        {
          if (!playlist.SaveAsJson(xsp, !filter))
            return false;
        }
        musicUrl.AddOption(option, xsp);

        CDatabase::Filter dbfilter;
        success = db.GetArtistsNav(musicUrl.ToString(), items, !g_guiSettings.GetBool("musiclibrary.showcompilationartists"), -1, -1, -1, dbfilter, sorting);
        db.Close();
        items.SetContent("artists");
        items.SetProperty(PROPERTY_PATH_DB, musicUrl.ToString());
      }
    }

    if (playlist.GetType().Equals("songs") || playlist.GetType().Equals("mixed") || playlist.GetType().IsEmpty())
    {
      CMusicDatabase db;
      if (db.Open())
      {
        CSmartPlaylist songPlaylist(playlist);
        if (playlist.GetType().IsEmpty() || playlist.GetType().Equals("mixed"))
          songPlaylist.SetType("songs");
        
        CMusicDbUrl musicUrl;
        if (!musicUrl.FromString(!strBaseDir.empty() ? strBaseDir : "musicdb://4/"))
          return false;

        // store the smartplaylist as JSON in the URL as well
        CStdString xsp;
        if (!songPlaylist.IsEmpty(filter))
        {
          if (!songPlaylist.SaveAsJson(xsp, !filter))
            return false;
        }
        musicUrl.AddOption(option, xsp);

        CDatabase::Filter dbfilter;
        success = db.GetSongsByWhere(musicUrl.ToString(), dbfilter, items, sorting);
        db.Close();
        items.SetContent("songs");
        items.SetProperty(PROPERTY_PATH_DB, musicUrl.ToString());
      }
    }
    if (playlist.GetType().Equals("musicvideos") || playlist.GetType().Equals("mixed"))
    {
      CVideoDatabase db;
      if (db.Open())
      {
        CSmartPlaylist mvidPlaylist(playlist);
        if (playlist.GetType().Equals("mixed"))
          mvidPlaylist.SetType("musicvideos");

        CVideoDbUrl videoUrl;
        if (!videoUrl.FromString(!strBaseDir.empty() ? strBaseDir : "videodb://3/2/"))
          return false;

        // store the smartplaylist as JSON in the URL as well
        CStdString xsp;
        if (!mvidPlaylist.IsEmpty(filter))
        {
          if (!mvidPlaylist.SaveAsJson(xsp, !filter))
            return false;
        }
        videoUrl.AddOption(option, xsp);
        
        CFileItemList items2;
        success2 = db.GetSortedVideos(MediaTypeMusicVideo, videoUrl.ToString(), sorting, items2);
        db.Close();

        items.Append(items2);
        if (items2.Size())
        {
          if (items.Size() > items2.Size())
            items.SetContent("mixed");
          else
            items.SetContent("musicvideos");
        }
        items.SetProperty(PROPERTY_PATH_DB, videoUrl.ToString());
      }
    }
    items.SetLabel(playlist.GetName());

    // go through and set the playlist order
    for (int i = 0; i < items.Size(); i++)
    {
      CFileItemPtr item = items[i];
      item->m_iprogramCount = i;  // hack for playlist order
    }

    if (playlist.GetType().Equals("mixed"))
      return success || success2;
    else if (playlist.GetType().Equals("musicvideos"))
      return success2;
    else
      return success;
  }
开发者ID:schererANGEL,项目名称:xbmc,代码行数:101,代码来源:SmartPlaylistDirectory.cpp

示例14: GetDirectory

bool CGUIWindowMusicBase::GetDirectory(const std::string &strDirectory, CFileItemList &items)
{
  items.ClearArt();
  bool bResult = CGUIMediaWindow::GetDirectory(strDirectory, items);
  if (bResult)
  {
    CMusicThumbLoader loader;
    loader.FillThumb(items);

    CQueryParams params;
    CDirectoryNode::GetDatabaseInfo(items.GetPath(), params);

    if (params.GetAlbumId() > 0)
    {
      std::map<std::string, std::string> artistArt;
      if (m_musicdatabase.GetArtistArtForItem(params.GetAlbumId(), MediaTypeAlbum, artistArt))
        items.AppendArt(artistArt, MediaTypeArtist);

      std::map<std::string, std::string> albumArt;
      if (m_musicdatabase.GetArtForItem(params.GetAlbumId(), MediaTypeAlbum, albumArt))
        items.AppendArt(albumArt, MediaTypeAlbum);
    }
    if (params.GetArtistId() > 0)
    {
      std::map<std::string, std::string> artistArt;
      if (m_musicdatabase.GetArtForItem(params.GetArtistId(), "artist", artistArt))
        items.AppendArt(artistArt, MediaTypeArtist);
    }

    // add in the "New Playlist" item if we're in the playlists folder
    if ((items.GetPath() == "special://musicplaylists/") && !items.Contains("newplaylist://"))
    {
      CFileItemPtr newPlaylist(new CFileItem(CProfilesManager::GetInstance().GetUserDataItem("PartyMode.xsp"),false));
      newPlaylist->SetLabel(g_localizeStrings.Get(16035));
      newPlaylist->SetLabelPreformated(true);
      newPlaylist->m_bIsFolder = true;
      items.Add(newPlaylist);

      newPlaylist.reset(new CFileItem("newplaylist://", false));
      newPlaylist->SetLabel(g_localizeStrings.Get(525));
      newPlaylist->SetLabelPreformated(true);
      newPlaylist->SetSpecialSort(SortSpecialOnBottom);
      newPlaylist->SetCanQueue(false);
      items.Add(newPlaylist);

      newPlaylist.reset(new CFileItem("newsmartplaylist://music", false));
      newPlaylist->SetLabel(g_localizeStrings.Get(21437));
      newPlaylist->SetLabelPreformated(true);
      newPlaylist->SetSpecialSort(SortSpecialOnBottom);
      newPlaylist->SetCanQueue(false);
      items.Add(newPlaylist);
    }

    // check for .CUE files here.
    items.FilterCueItems();

    std::string label;
    if (items.GetLabel().empty() && m_rootDir.IsSource(items.GetPath(), CMediaSourceSettings::GetInstance().GetSources("music"), &label))
      items.SetLabel(label);
  }

  return bResult;
}
开发者ID:pollonamid,项目名称:xbmc,代码行数:63,代码来源:GUIWindowMusicBase.cpp

示例15: GetDirectory

bool CLibraryDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
{
  std::string libNode = GetNode(strPath);
  if (libNode.empty())
    return false;

  if (URIUtils::HasExtension(libNode, ".xml"))
  { // a filter or folder node
    TiXmlElement *node = LoadXML(libNode);
    if (node)
    {
      CStdString type = node->Attribute("type");
      if (type == "filter")
      {
        CSmartPlaylist playlist;
        CStdString type, label;
        XMLUtils::GetString(node, "content", type);
        if (type.IsEmpty())
        {
          CLog::Log(LOGERROR, "<content> tag must not be empty for type=\"filter\" node '%s'", libNode.c_str());
          return false;
        }
        if (XMLUtils::GetString(node, "label", label))
          label = CGUIControlFactory::FilterLabel(label);
        playlist.SetType(type);
        playlist.SetName(label);
        if (playlist.LoadFromXML(node) &&
            CSmartPlaylistDirectory::GetDirectory(playlist, items))
        {
          items.SetProperty("library.filter", "true");
          items.SetPath(items.GetProperty("path.db").asString());
          return true;
        }
      }
      else if (type == "folder")
      {
        CStdString path;
        XMLUtils::GetPath(node, "path", path);
        if (!path.IsEmpty())
        {
          URIUtils::AddSlashAtEnd(path);
          return CDirectory::GetDirectory(path, items, m_strFileMask, m_flags);
        }
      }
    }
    return false;
  }

  // just a plain node - read the folder for XML nodes and other folders
  CFileItemList nodes;
  if (!CDirectory::GetDirectory(libNode, nodes, ".xml", DIR_FLAG_NO_FILE_DIRS))
    return false;

  // iterate over our nodes
  for (int i = 0; i < nodes.Size(); i++)
  {
    const TiXmlElement *node = NULL;
    CStdString xml = nodes[i]->GetPath();
    if (nodes[i]->m_bIsFolder)
      node = LoadXML(URIUtils::AddFileToFolder(xml, "index.xml"));
    else
    {
      node = LoadXML(xml);
      if (node && URIUtils::GetFileName(xml).Equals("index.xml"))
      { // set the label on our items
        CStdString label;
        if (XMLUtils::GetString(node, "label", label))
          label = CGUIControlFactory::FilterLabel(label);
        items.SetLabel(label);
        continue;
      }
    }
    if (node)
    {
      CStdString label, icon;
      if (XMLUtils::GetString(node, "label", label))
        label = CGUIControlFactory::FilterLabel(label);
      XMLUtils::GetString(node, "icon", icon);
      int order = 0;
      node->Attribute("order", &order);

      // create item
      URIUtils::RemoveSlashAtEnd(xml);
      CStdString folder = URIUtils::GetFileName(xml);
      CFileItemPtr item(new CFileItem(URIUtils::AddFileToFolder(strPath, folder), true));

      item->SetLabel(label);
      if (!icon.IsEmpty() && g_TextureManager.HasTexture(icon))
        item->SetIconImage(icon);
      item->m_iprogramCount = order;
      items.Add(item);
    }
  }
  items.Sort(SortByPlaylistOrder, SortOrderAscending);
  return true;
}
开发者ID:Greihawk,项目名称:boxeebox-xbmc,代码行数:96,代码来源:LibraryDirectory.cpp


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