DTC::ChannelGroupList* Guide::GetChannelGroupList( bool bIncludeEmpty ) { ChannelGroupList list = ChannelGroup::GetChannelGroups(bIncludeEmpty); DTC::ChannelGroupList *pGroupList = new DTC::ChannelGroupList(); ChannelGroupList::iterator it; for (it = list.begin(); it < list.end(); ++it) { DTC::ChannelGroup *pGroup = pGroupList->AddNewChannelGroup(); FillChannelGroup(pGroup, (*it)); } return pGroupList; }
void ChannelGroupEditor::Load(void) { listbox->clearSelections(); ChannelGroupList changrplist; changrplist = ChannelGroup::GetChannelGroups(); ChannelGroupList::iterator it; for (it = changrplist.begin(); it < changrplist.end(); ++it) listbox->addSelection(it->name); listbox->addSelection(tr("(Create new group)"), "__CREATE_NEW_GROUP__"); listbox->setValue(lastValue); }
// Cycle through the available groups, then all channels // Will cycle through to end then return -1 // To signify all channels. int ChannelGroup::GetNextChannelGroup(const ChannelGroupList &sorted, int grpid) { // If no groups return -1 for all channels if (sorted.empty()) return -1; // If grpid is all channels (-1), then return the first grpid if (grpid == -1) return sorted[0].grpid; ChannelGroupList::const_iterator it = find(sorted.begin(), sorted.end(), grpid); // If grpid is not in the list, return -1 for all channels if (it == sorted.end()) return -1; ++it; // If we reached the end, the next option is all channels (-1) if (it == sorted.end()) return -1; return it->grpid; }