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


C++ CPVRTimerInfoTag::GetNotificationText方法代码示例

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


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

示例1: UpdateEntries

bool CPVRTimers::UpdateEntries(CPVRTimers *timers)
{
  bool bChanged(false);
  bool bAddedOrDeleted(false);
  vector<CStdString> timerNotifications;

  CSingleLock lock(m_critSection);

  /* go through the timer list and check for updated or new timers */
  for (map<CDateTime, vector<CPVRTimerInfoTag *>* >::iterator it = timers->m_tags.begin(); it != timers->m_tags.end(); it++)
  {
    vector<CPVRTimerInfoTag*> *entry = it->second;
    for (unsigned int iTagPtr = 0; iTagPtr < entry->size(); iTagPtr++)
    {
      const CPVRTimerInfoTag *timer = entry->at(iTagPtr);

      /* check if this timer is present in this container */
      CPVRTimerInfoTag *existingTimer = (CPVRTimerInfoTag *) GetByClient(timer->m_iClientId, timer->m_iClientIndex);
      if (existingTimer)
      {
        /* if it's present, update the current tag */
        bool bStateChanged(existingTimer->m_state != timer->m_state);
        if (existingTimer->UpdateEntry(*timer))
        {
          bChanged = true;

          if (bStateChanged && g_PVRManager.IsStarted())
          {
            CStdString strMessage;
            existingTimer->GetNotificationText(strMessage);
            timerNotifications.push_back(strMessage);
          }

          CLog::Log(LOGDEBUG,"PVRTimers - %s - updated timer %d on client %d",
              __FUNCTION__, timer->m_iClientIndex, timer->m_iClientId);
        }
      }
      else
      {
        /* new timer */
        CPVRTimerInfoTag *newTimer = new CPVRTimerInfoTag;
        newTimer->UpdateEntry(*timer);

        vector<CPVRTimerInfoTag *>* addEntry = NULL;
        map<CDateTime, vector<CPVRTimerInfoTag *>* >::iterator itr = m_tags.find(newTimer->StartAsUTC());
        if (itr == m_tags.end())
        {
          addEntry = new vector<CPVRTimerInfoTag *>;
          m_tags.insert(make_pair(newTimer->StartAsUTC(), addEntry));
        }
        else
        {
          addEntry = itr->second;
        }

        addEntry->push_back(newTimer);
        bChanged = true;
        bAddedOrDeleted = true;

        if (g_PVRManager.IsStarted())
        {
          CStdString strMessage;
          newTimer->GetNotificationText(strMessage);
          timerNotifications.push_back(strMessage);
        }

        CLog::Log(LOGDEBUG,"PVRTimers - %s - added timer %d on client %d",
            __FUNCTION__, timer->m_iClientIndex, timer->m_iClientId);
      }
    }
  }

  /* to collect timer with changed starting time */
  vector<CPVRTimerInfoTag *> timersToMove;
  
  /* check for deleted timers */
  for (map<CDateTime, vector<CPVRTimerInfoTag *>* >::iterator it = m_tags.begin(); it != m_tags.end();)
  {
    vector<CPVRTimerInfoTag*> *entry = it->second;
    for (int iTagPtr = entry->size() - 1; iTagPtr >= 0; iTagPtr--)
    {
      CPVRTimerInfoTag *timer = entry->at(iTagPtr);
      if (!timer)
        continue;
        
      if (timers->GetByClient(timer->m_iClientId, timer->m_iClientIndex) == NULL)
      {
        /* timer was not found */
        CLog::Log(LOGDEBUG,"PVRTimers - %s - deleted timer %d on client %d",
            __FUNCTION__, timer->m_iClientIndex, timer->m_iClientId);

        if (g_PVRManager.IsStarted())
        {
          CStdString strMessage;
          strMessage.Format("%s: '%s'", (timer->EndAsUTC() <= CDateTime::GetCurrentDateTime().GetAsUTCDateTime()) ? g_localizeStrings.Get(19227) : g_localizeStrings.Get(19228), timer->m_strTitle.c_str());
          timerNotifications.push_back(strMessage);
        }

        delete entry->at(iTagPtr);
        entry->erase(entry->begin() + iTagPtr);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: UpdateEntries

bool CPVRTimers::UpdateEntries(CPVRTimers *timers)
{
  bool bChanged(false);
  bool bAddedOrDeleted(false);
  vector<CStdString> timerNotifications;

  CSingleLock lock(m_critSection);

  /* go through the timer list and check for updated or new timers */
  for (unsigned int iTimerPtr = 0; iTimerPtr < timers->size(); iTimerPtr++)
  {
    const CPVRTimerInfoTag *timer = timers->at(iTimerPtr);

    /* check if this timer is present in this container */
    CPVRTimerInfoTag *existingTimer = (CPVRTimerInfoTag *) GetByClient(timer->m_iClientId, timer->m_iClientIndex);
    if (existingTimer)
    {
      /* if it's present, update the current tag */
      bool bStateChanged(existingTimer->m_state != timer->m_state);
      if (existingTimer->UpdateEntry(*timer))
      {
        bChanged = true;

        if (bStateChanged && g_PVRManager.IsStarted())
        {
          CStdString strMessage;
          existingTimer->GetNotificationText(strMessage);
          timerNotifications.push_back(strMessage);
        }

        CLog::Log(LOGINFO,"PVRTimers - %s - updated timer %d on client %d",
            __FUNCTION__, timer->m_iClientIndex, timer->m_iClientId);
      }
    }
    else
    {
      /* new timer */
      CPVRTimerInfoTag *newTimer = new CPVRTimerInfoTag;
      newTimer->UpdateEntry(*timer);
      push_back(newTimer);
      bChanged = true;
      bAddedOrDeleted = true;

      if (g_PVRManager.IsStarted())
      {
        CStdString strMessage;
        newTimer->GetNotificationText(strMessage);
        timerNotifications.push_back(strMessage);
      }

      CLog::Log(LOGINFO,"PVRTimers - %s - added timer %d on client %d",
          __FUNCTION__, timer->m_iClientIndex, timer->m_iClientId);
    }
  }

  /* check for deleted timers */
  unsigned int iSize = size();
  for (unsigned int iTimerPtr = 0; iTimerPtr < iSize; iTimerPtr++)
  {
    CPVRTimerInfoTag *timer = (CPVRTimerInfoTag *) at(iTimerPtr);
    if (!timer)
      continue;
    if (timers->GetByClient(timer->m_iClientId, timer->m_iClientIndex) == NULL)
    {
      /* timer was not found */
      CLog::Log(LOGINFO,"PVRTimers - %s - deleted timer %d on client %d",
          __FUNCTION__, timer->m_iClientIndex, timer->m_iClientId);

      if (g_PVRManager.IsStarted())
      {
        CStdString strMessage;
        strMessage.Format("%s: '%s'", g_localizeStrings.Get(19228), timer->m_strTitle.c_str());
        timerNotifications.push_back(strMessage);
      }

      CPVREpgInfoTag *epgTag = (CPVREpgInfoTag *) at(iTimerPtr)->m_epgInfo;
      if (epgTag)
        epgTag->SetTimer(NULL);

      delete at(iTimerPtr);
      erase(begin() + iTimerPtr);
      iTimerPtr--;
      iSize--;
      bChanged = true;
      bAddedOrDeleted = true;
    }
  }

  m_bIsUpdating = false;
  if (bChanged)
  {
    Sort();
    SetChanged();
    lock.Leave();

    NotifyObservers(bAddedOrDeleted ? "timers-reset" : "timers", false);

    if (g_guiSettings.GetBool("pvrrecord.timernotifications"))
    {
      /* queue notifications */
//.........这里部分代码省略.........
开发者ID:chris-magic,项目名称:xbmc_dualaudio_pvr,代码行数:101,代码来源:PVRTimers.cpp


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