bool CGUIDialogPVRGroupManager::ActionButtonNewGroup(CGUIMessage &message)
{
  bool bReturn = false;
  unsigned int iControl = message.GetSenderId();

  if (iControl == BUTTON_NEWGROUP)
  {
    CStdString strGroupName = "";
    /* prompt for a group name */
    if (CGUIDialogKeyboard::ShowAndGetInput(strGroupName, g_localizeStrings.Get(19139), false))
    {
      if (strGroupName != "")
      {
        /* add the group if it doesn't already exist */
        CPVRChannelGroups *groups = ((CPVRChannelGroups *) g_PVRChannelGroups->Get(m_bIsRadio));
        if (groups->AddGroup(strGroupName))
        {
          m_iSelectedChannelGroup = groups->size() - 1;
          Update();
        }
      }
    }
    bReturn = true;
  }

  return bReturn;
}
bool CPVRChannels::GetGroupsDirectory(const CStdString &strBase, CFileItemList *results, bool bRadio)
{
  CPVRChannels *     channels      = bRadio ? &PVRChannelsRadio : &PVRChannelsTV;
  CPVRChannelGroups *channelGroups = bRadio ? &PVRChannelGroupsRadio : &PVRChannelGroupsTV;
  CFileItemPtr item;

  item.reset(new CFileItem(strBase + "/all/", true));
  item->SetLabel(g_localizeStrings.Get(593));
  item->SetLabelPreformated(true);
  results->Add(item);

  /* container has hidden channels */
  if (channels->GetNumHiddenChannels() > 0)
  {
    item.reset(new CFileItem(strBase + "/.hidden/", true));
    item->SetLabel(g_localizeStrings.Get(19022));
    item->SetLabelPreformated(true);
    results->Add(item);
  }

  /* add all groups */
  for (unsigned int ptr = 0; ptr < channelGroups->size(); ptr++)
  {
    CPVRChannelGroup group = channelGroups->at(ptr);
    CStdString strGroup = strBase + "/" + group.GroupName() + "/";
    item.reset(new CFileItem(strGroup, true));
    item->SetLabel(group.GroupName());
    item->SetLabelPreformated(true);
    results->Add(item);
  }

  return true;
}
Exemple #3
0
bool CPVRChannelGroups::UpdateGroupsEntries(const CPVRChannelGroups &groups)
{
  CSingleLock lock(m_critSection);
  /* go through groups list and check for deleted groups */
  for (int iGroupPtr = size() - 1; iGroupPtr >= 0; iGroupPtr--)
  {
    CPVRChannelGroup existingGroup(*at(iGroupPtr));
    if (!existingGroup.IsInternalGroup())
    {
      CPVRChannelGroup *group = (CPVRChannelGroup *) groups.GetByName(existingGroup.GroupName());
      if (group == NULL)
      {
        CLog::Log(LOGDEBUG, "PVRChannelGroups - %s - user defined group %s with ID '%u' does not exist on the client anymore. deleting",
            __FUNCTION__, existingGroup.GroupName().c_str(), existingGroup.GroupID());
        DeleteGroup(*at(iGroupPtr));
      }
    }
  }
  /* go through the groups list and check for new groups */
  for (unsigned int iGroupPtr = 0; iGroupPtr < groups.size(); iGroupPtr++)
  {
    CPVRChannelGroup *group = groups.at(iGroupPtr);

    /* check if this group is present in this container */
    CPVRChannelGroup *existingGroup = (CPVRChannelGroup *) GetByName(group->GroupName());
    if (existingGroup == NULL)
    {
      CPVRChannelGroup *newGroup = new CPVRChannelGroup(m_bRadio);
      newGroup->SetGroupName(group->GroupName());
      push_back(newGroup);
    }
  }

  return true;
}
Exemple #4
0
bool CPVRChannelGroups::UpdateGroupsEntries(const CPVRChannelGroups &groups)
{
  /* go through the groups list and check for new groups */
  for (unsigned int iGroupPtr = 0; iGroupPtr < groups.size(); iGroupPtr++)
  {
    CPVRChannelGroup *group = groups.at(iGroupPtr);

    /* check if this group is present in this container */
    CPVRChannelGroup *existingGroup = (CPVRChannelGroup *) GetByName(group->GroupName());
    if (existingGroup == NULL)
    {
      CPVRChannelGroup *newGroup = new CPVRChannelGroup(m_bRadio);
      newGroup->SetGroupName(group->GroupName());
      push_back(newGroup);
    }
  }

  return true;
}