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


C++ CGUIDialogExtendedProgressBar::SetProgress方法代码示例

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


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

示例1: UpdateEPG

bool CEpgContainer::UpdateEPG(bool bShowProgress /* = false */)
{
  CSingleLock lock(m_critSection);
  unsigned int iEpgCount = size();
  lock.Leave();

  long iStartTime                         = CTimeUtils::GetTimeMS();
  bool bUpdateSuccess                     = true;
  CGUIDialogExtendedProgressBar *progress = NULL;

  if (!m_bDatabaseLoaded)
    CLog::Log(LOGNOTICE, "EpgContainer - %s - loading EPG entries for %i tables from the database",
        __FUNCTION__, iEpgCount);
  else
    CLog::Log(LOGNOTICE, "EpgContainer - %s - starting EPG update for %i tables (update time = %d)",
        __FUNCTION__, iEpgCount, m_iUpdateTime);

  /* set start and end time */
  time_t start;
  time_t end;
  CDateTime::GetCurrentDateTime().GetAsTime(start); // NOTE: XBMC stores the EPG times as local time
  end = start;
  start -= g_advancedSettings.m_iEpgLingerTime * 60;
  end += m_iDisplayTime;

  /* open the database */
  if (!m_database.Open())
  {
    CLog::Log(LOGERROR, "EpgContainer - %s - could not open the database", __FUNCTION__);
    return false;
  }

  /* show the progress bar */
  if (bShowProgress)
  {
    progress = (CGUIDialogExtendedProgressBar *)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);
    progress->Show();
    progress->SetHeader(g_localizeStrings.Get(19004));
  }

  int iUpdatedTables = 0;

  /* load or update all EPG tables */
  for (unsigned int iEpgPtr = 0; iEpgPtr < iEpgCount; iEpgPtr++)
  {
    /* interrupt the update on exit or when livetv is playing */
    if (m_bStop || (CPVRManager::Get()->IsStarted() && CPVRManager::GetClients()->IsPlaying()))
    {
      CLog::Log(LOGNOTICE, "EpgContainer - %s - EPG load/update interrupted", __FUNCTION__);
      bUpdateSuccess = false;
      break;
    }

    CEpg *epg = GetByIndex(iEpgPtr);
    if (!epg)
      continue;

    if (m_bDatabaseLoaded)
      at(iEpgPtr)->Cleanup();

    bool bCurrent = m_bDatabaseLoaded || m_bIgnoreDbForClient ?
        at(iEpgPtr)->Update(start, end, m_iUpdateTime) :
        at(iEpgPtr)->Load() && bUpdateSuccess;

    /* try to update the table from clients if nothing was loaded from the db */
    if (!m_bDatabaseLoaded && !m_bIgnoreDbForClient && !bCurrent)
      bCurrent = at(iEpgPtr)->Update(start, end, m_iUpdateTime);

    if (!bCurrent && m_bDatabaseLoaded)
      CLog::Log(LOGERROR, "EpgContainer - %s - failed to update table '%s'",
          __FUNCTION__, at(iEpgPtr)->Name().c_str());

    bUpdateSuccess = bCurrent && bUpdateSuccess;
    if (bCurrent)
      ++iUpdatedTables;

    if (bShowProgress)
    {
      /* update the progress bar */
      progress->SetProgress(iEpgPtr, iEpgCount);
      progress->SetTitle(at(iEpgPtr)->Name());
      progress->UpdateState();
    }

    if (m_bDatabaseLoaded)
      Sleep(50); /* give other threads a chance to get a lock on tables */
  }

  CDateTime::GetCurrentDateTime().GetAsTime(m_iLastEpgUpdate);
  /* update the last scan time if we did a full update */
  if (bUpdateSuccess && m_bDatabaseLoaded && !m_bIgnoreDbForClient)
      m_database.PersistLastEpgScanTime(0);
  m_database.Close();

  if (bShowProgress)
    progress->Close();

  long lUpdateTime = CTimeUtils::GetTimeMS() - iStartTime;
  CLog::Log(LOGINFO, "EpgContainer - %s - finished %s %d EPG tables after %li.%li seconds",
      __FUNCTION__, m_bDatabaseLoaded ? "updating" : "loading", iEpgCount, lUpdateTime / 1000, lUpdateTime % 1000);
//.........这里部分代码省略.........
开发者ID:RoboSK,项目名称:xbmc,代码行数:101,代码来源:EpgContainer.cpp


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