void FActionMappingsNodeBuilder::GenerateChildContent( IDetailChildrenBuilder& ChildrenBuilder ) { RebuildGroupedMappings(); for (int32 Index = 0; Index < GroupedMappings.Num(); ++Index) { FMappingSet& MappingSet = GroupedMappings[Index]; FString GroupNameString(TEXT("ActionMappings.")); MappingSet.SharedName.AppendString(GroupNameString); FName GroupName(*GroupNameString); IDetailGroup& ActionMappingGroup = ChildrenBuilder.AddChildGroup(GroupName, FText::FromName(MappingSet.SharedName)); MappingSet.DetailGroup = &ActionMappingGroup; TSharedRef<SWidget> AddButton = PropertyCustomizationHelpers::MakeAddButton(FSimpleDelegate::CreateSP(this, &FActionMappingsNodeBuilder::AddActionMappingToGroupButton_OnClick, MappingSet), LOCTEXT("AddActionMappingToGroupToolTip", "Adds Action Mapping to Group")); TSharedRef<SWidget> RemoveButton = PropertyCustomizationHelpers::MakeDeleteButton(FSimpleDelegate::CreateSP(this, &FActionMappingsNodeBuilder::RemoveActionMappingGroupButton_OnClick, MappingSet), LOCTEXT("RemoveActionMappingGroupToolTip", "Removes Action Mapping Group")); ActionMappingGroup.HeaderRow() [ SNew( SHorizontalBox ) + SHorizontalBox::Slot() .AutoWidth() [ SNew(SBox) .WidthOverride( InputConstants::TextBoxWidth ) [ SNew(SEditableTextBox) .Padding(2.0f) .Text(FText::FromName(MappingSet.SharedName)) .OnTextCommitted(FOnTextCommitted::CreateSP(this, &FActionMappingsNodeBuilder::OnActionMappingNameCommitted, MappingSet)) .Font(IDetailLayoutBuilder::GetDetailFont()) ] ] +SHorizontalBox::Slot() .Padding(InputConstants::PropertyPadding) .HAlign(HAlign_Center) .VAlign(VAlign_Center) .AutoWidth() [ AddButton ] +SHorizontalBox::Slot() .Padding(InputConstants::PropertyPadding) .HAlign(HAlign_Center) .VAlign(VAlign_Center) .AutoWidth() [ RemoveButton ] ]; for (int32 MappingIndex = 0; MappingIndex < MappingSet.Mappings.Num(); ++MappingIndex) { ActionMappingGroup.AddPropertyRow(MappingSet.Mappings[MappingIndex]).ShowPropertyButtons(false); } } }
void ON_Group::Dump( ON_TextLog& dump ) const { const wchar_t* name = GroupName(); if ( !name ) name = L""; dump.Print("group index = %d\n",m_group_index); dump.Print("group name = \"%ls\"\n",name); }
bool CPVRChannelGroupInternal::Persist(void) { bool bReturn(true); CSingleLock lock(m_critSection); bool bHasNewChannels = HasNewChannels(); bool bHasChangedChannels = HasChangedChannels(); if (bHasNewChannels || bHasChangedChannels) CLog::Log(LOGDEBUG, "CPVRChannelGroupInternal - %s - persisting %d channels", __FUNCTION__, (int) size()); if (bHasNewChannels) { CLog::Log(LOGDEBUG, "CPVRChannelGroupInternal - %s - group '%s' has new channels. writing changes directly", __FUNCTION__, GroupName().c_str()); /* write directly to get channel ids */ for (unsigned int iChannelPtr = 0; iChannelPtr < size(); iChannelPtr++) { if (!at(iChannelPtr).channel->Persist()) { CLog::Log(LOGERROR, "CPVRChannelGroupInternal - %s - failed to persist channel '%s'", __FUNCTION__, at(iChannelPtr).channel->ChannelName().c_str()); bReturn = false; } } } else if (bHasChangedChannels) { /* open the database */ CPVRDatabase *database = g_PVRManager.GetTVDatabase(); if (!database || !database->Open()) { CLog::Log(LOGERROR, "CPVRChannelGroupInternal - %s - failed to open the database", __FUNCTION__); return false; } /* queue queries */ for (unsigned int iChannelPtr = 0; iChannelPtr < size(); iChannelPtr++) at(iChannelPtr).channel->Persist(true); /* and commit them */ bReturn = database->CommitInsertQueries(); if (!bReturn) CLog::Log(LOGERROR, "CPVRChannelGroupInternal - %s - failed to persist channels", __FUNCTION__); database->Close(); } if (bReturn) bReturn = CPVRChannelGroup::Persist(); return bReturn; }
bool CPVRChannelGroup::Persist(void) { CSingleLock lock(m_critSection); if (!HasChanges()) return true; CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase(); if (database && database->Open()) { CLog::Log(LOGDEBUG, "CPVRChannelGroup - %s - persisting channel group '%s' with %d channels", __FUNCTION__, GroupName().c_str(), (int) size()); database->Persist(this); database->Close(); m_bChanged = false; return true; } return false; }
bool CPVRChannelGroup::UpdateGroupEntries(const CPVRChannelGroup &channels) { bool bChanged(false); CSingleLock lock(m_critSection); int iCurSize = size(); CPVRDatabase *database = CPVRManager::Get()->GetTVDatabase(); if (!database || !database->Open()) return false; /* go through the channel list and check for updated or new channels */ for (unsigned int iChannelPtr = 0; iChannelPtr < channels.size(); iChannelPtr++) { CPVRChannel *channel = channels.at(iChannelPtr).channel; int iChannelNumber = channels.at(iChannelPtr).iChannelNumber; if (!channel) continue; CPVRChannel *realChannel = (CPVRChannel *) CPVRManager::GetChannelGroups()->GetGroupAll(m_bRadio)->GetByClient(channel->UniqueID(), channel->ClientID()); if (!realChannel) continue; if (!IsGroupMember(realChannel)) { AddToGroup(realChannel, iChannelNumber, false); bChanged = true; m_bChanged = true; CLog::Log(LOGINFO,"PVRChannelGroup - %s - added %s channel '%s' at position %d in group '%s'", __FUNCTION__, m_bRadio ? "radio" : "TV", realChannel->ChannelName().c_str(), iChannelNumber, GroupName().c_str()); } } /* check for deleted channels */ unsigned int iSize = size(); for (unsigned int iChannelPtr = 0; iChannelPtr < iSize; iChannelPtr++) { CPVRChannel *channel = (CPVRChannel *) GetByIndex(iChannelPtr); if (!channel) continue; if (channels.GetByClient(channel->UniqueID(), channel->ClientID()) == NULL) { /* channel was not found */ CLog::Log(LOGINFO,"PVRChannelGroup - %s - deleted %s channel '%s' from group '%s'", __FUNCTION__, m_bRadio ? "radio" : "TV", channel->ChannelName().c_str(), GroupName().c_str()); /* remove this channel from all non-system groups */ RemoveFromGroup(channel); m_bChanged = true; bChanged = true; iChannelPtr--; iSize--; } } if (bChanged) { /* sort by client channel number if this is the first time */ if (iCurSize == 0) SortByClientChannelNumber(); /* renumber to make sure all channels have a channel number. new channels were added at the back, so they'll get the highest numbers */ Renumber(); return Persist(); } return true; }