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


C++ CGUIDialogSelect::SetButtonLabel方法代码示例

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


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

示例1: DownloadArtistInfo

bool CMusicInfoScanner::DownloadArtistInfo(const CStdString& strPath, const CStdString& strArtist, CGUIDialogProgress* pDialog)
{
  DIRECTORY::MUSICDATABASEDIRECTORY::CQueryParams params;
  DIRECTORY::MUSICDATABASEDIRECTORY::CDirectoryNode::GetDatabaseInfo(strPath, params);
  CArtist artist;
  m_musicDatabase.Open();
  if (m_musicDatabase.GetArtistInfo(params.GetArtistId(),artist)) // already got the info
    return true;

  // find artist info
  SScraperInfo info;
  if (!m_musicDatabase.GetScraperForPath(strPath,info))
  {
    m_musicDatabase.Close();
    return false;
  }

  if (m_pObserver)
  {
    m_pObserver->OnStateChanged(DOWNLOADING_ARTIST_INFO);
    m_pObserver->OnDirectoryChanged(strArtist);  
  }

  CMusicInfoScraper scraper(info);
  // handle nfo files
  CStdString strArtistPath, strNfo;
  m_musicDatabase.GetArtistPath(params.GetArtistId(),strArtistPath);
  CUtil::AddFileToFolder(strArtistPath,"artist.nfo",strNfo);
  if (XFILE::CFile::Exists(strNfo))
  {
    CLog::Log(LOGDEBUG,"Found matching nfo file: %s", strNfo.c_str());
    CNfoFile nfoReader("albums");
    if (nfoReader.Create(strNfo) == S_OK)
    {
      if (nfoReader.m_strScraper == "NFO")
      {
        CLog::Log(LOGDEBUG, "%s Got details from nfo", __FUNCTION__);
        CArtist artist;
        nfoReader.GetDetails(artist);
        m_musicDatabase.SetArtistInfo(params.GetArtistId(), artist);
        m_musicDatabase.Close();
        return true;
      }
      else
      {
        CScraperUrl scrUrl(nfoReader.m_strImDbUrl); 
        CMusicArtistInfo artist("nfo",scrUrl);
        scraper.GetArtists().push_back(artist);
      }
    }
    else
      CLog::Log(LOGERROR,"Unable to find an url in nfo file: %s", strNfo.c_str());
  }

  if (!scraper.GetArtistCount())
    scraper.FindArtistinfo(strArtist);

  while (!scraper.Completed())
  {
    if (m_bStop)
    {
      scraper.Cancel();
      break;
    }
    Sleep(1);
  }

  if (scraper.Successfull() && scraper.GetArtistCount() >= 1)
  {
    int iSelectedArtist = 0;
    // now load the first match
    if (pDialog && scraper.GetArtistCount() > 1)
    {
      // if we found more then 1 album, let user choose one
      CGUIDialogSelect *pDlg = (CGUIDialogSelect*)m_gWindowManager.GetWindow(WINDOW_DIALOG_SELECT);
      if (pDlg)
      {
        pDlg->SetHeading(g_localizeStrings.Get(21890));
        pDlg->Reset();
        pDlg->EnableButton(true);
        pDlg->SetButtonLabel(413); // manual

        for (int i = 0; i < scraper.GetArtistCount(); ++i)
        {
          // set the label to artist
          CFileItem item(scraper.GetArtist(i).GetArtist());
          CStdString strTemp=scraper.GetArtist(i).GetArtist().strArtist;
          if (!scraper.GetArtist(i).GetArtist().strBorn.IsEmpty())
            strTemp += " ("+scraper.GetArtist(i).GetArtist().strBorn+")";
          if (!scraper.GetArtist(i).GetArtist().strGenre.IsEmpty())
            strTemp.Format("[%s] %s",scraper.GetArtist(i).GetArtist().strGenre.c_str(),strTemp.c_str());
          item.SetLabel(strTemp);
          item.m_idepth = i; // use this to hold the index of the album in the scraper
          pDlg->Add(&item);
        }
        pDlg->DoModal();

        // and wait till user selects one
        if (pDlg->GetSelectedLabel() < 0) 
        { // none chosen
//.........这里部分代码省略.........
开发者ID:jeppster,项目名称:xbmc-fork,代码行数:101,代码来源:MusicInfoScanner.cpp


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