本文整理汇总了C++中CPVRChannelGroupPtr::Persist方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelGroupPtr::Persist方法的具体用法?C++ CPVRChannelGroupPtr::Persist怎么用?C++ CPVRChannelGroupPtr::Persist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannelGroupPtr
的用法示例。
在下文中一共展示了CPVRChannelGroupPtr::Persist方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveList
void CGUIDialogPVRChannelManager::SaveList(void)
{
if (!m_bContainsChanges)
return;
/* display the progress dialog */
CGUIDialogProgress* pDlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
pDlgProgress->SetHeading(190);
pDlgProgress->SetLine(0, "");
pDlgProgress->SetLine(1, 328);
pDlgProgress->SetLine(2, "");
pDlgProgress->StartModal();
pDlgProgress->Progress();
pDlgProgress->SetPercentage(0);
/* persist all channels */
unsigned int iNextChannelNumber(0);
CPVRChannelGroupPtr group = g_PVRChannelGroups->GetGroupAll(m_bIsRadio);
if (!group)
return;
for (int iListPtr = 0; iListPtr < m_channelItems->Size(); iListPtr++)
{
CFileItemPtr pItem = m_channelItems->Get(iListPtr);
PersistChannel(pItem, group, &iNextChannelNumber);
pDlgProgress->SetPercentage(iListPtr * 100 / m_channelItems->Size());
}
group->SortAndRenumber();
group->Persist();
m_bContainsChanges = false;
SetItemsUnchanged();
pDlgProgress->Close();
}
示例2: Update
bool CPVRChannelGroups::Update(const CPVRChannelGroup &group, bool bUpdateFromClient /* = false */)
{
if (group.GroupName().empty() && group.GroupID() <= 0)
return true;
CPVRChannelGroupPtr updateGroup;
{
CSingleLock lock(m_critSection);
// There can be only one internal group! Make sure we never push a new one!
if (group.IsInternalGroup())
updateGroup = GetGroupAll();
// try to find the group by id
if (!updateGroup && group.GroupID() > 0)
updateGroup = GetById(group.GroupID());
// try to find the group by name if we didn't find it yet
if (!updateGroup)
updateGroup = GetByName(group.GroupName());
if (!updateGroup)
{
// create a new group if none was found. Copy the properties immediately
// so the group doesn't get flagged as "changed" further down.
updateGroup = CPVRChannelGroupPtr(new CPVRChannelGroup(group.IsRadio(), group.GroupID(), group.GroupName()));
m_groups.push_back(updateGroup);
}
updateGroup->SetRadio(group.IsRadio());
updateGroup->SetGroupID(group.GroupID());
updateGroup->SetGroupName(group.GroupName());
updateGroup->SetGroupType(group.GroupType());
updateGroup->SetPosition(group.GetPosition());
// don't override properties we only store locally in our PVR database
if (!bUpdateFromClient)
{
updateGroup->SetLastWatched(group.LastWatched());
updateGroup->SetHidden(group.IsHidden());
}
}
// sort groups
SortGroups();
// persist changes
if (bUpdateFromClient)
return updateGroup->Persist();
return true;
}
示例3: OpenLiveStream
bool CPVRManager::OpenLiveStream(const CFileItem &channel)
{
bool bReturn(false);
if (!channel.HasPVRChannelInfoTag())
return bReturn;
CLog::Log(LOGDEBUG,"PVRManager - %s - opening live stream on channel '%s'",
__FUNCTION__, channel.GetPVRChannelInfoTag()->ChannelName().c_str());
// check if we're allowed to play this file
if (IsParentalLocked(*channel.GetPVRChannelInfoTag()))
return bReturn;
CPVRChannelPtr playingChannel;
CPVRChannelGroupPtr group;
bool bPersistChanges(false);
if ((bReturn = m_addons->OpenStream(*channel.GetPVRChannelInfoTag(), false)) != false)
{
CSingleLock lock(m_critSection);
if(m_currentFile)
delete m_currentFile;
m_currentFile = new CFileItem(channel);
if (m_addons->GetPlayingChannel(playingChannel))
{
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
/* update last watched timestamp for channel */
playingChannel->SetLastWatched(tNow);
/* update last watched timestamp for group */
group = g_PVRManager.GetPlayingGroup(playingChannel->IsRadio());
group->SetLastWatched(tNow);
/* update last played group */
m_channelGroups->SetLastPlayedGroup(group);
bPersistChanges = true;
}
}
if (bPersistChanges)
{
playingChannel->Persist();
group->Persist();
}
return bReturn;
}
示例4: UpdateLastWatched
void CPVRManager::UpdateLastWatched(CPVRChannel &channel)
{
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
// update last watched timestamp for channel
// NOTE: method could be called with a fileitem copy as argument so we need to obtain the right channel instance
CPVRChannelPtr channelPtr = m_channelGroups->GetChannelById(channel.ChannelID());
channelPtr->SetLastWatched(tNow);
channelPtr->Persist();
// update last watched timestamp for group
CPVRChannelGroupPtr group = GetPlayingGroup(channel.IsRadio());
group->SetLastWatched(tNow);
group->Persist();
/* update last played group */
m_channelGroups->SetLastPlayedGroup(group);
}
示例5: SaveList
void CGUIDialogPVRChannelManager::SaveList(void)
{
if (!m_bContainsChanges)
return;
/* display the progress dialog */
CGUIDialogProgress* pDlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
pDlgProgress->SetHeading(CVariant{190});
pDlgProgress->SetLine(0, CVariant{""});
pDlgProgress->SetLine(1, CVariant{328});
pDlgProgress->SetLine(2, CVariant{""});
pDlgProgress->StartModal();
pDlgProgress->Progress();
pDlgProgress->SetPercentage(0);
/* persist all channels */
unsigned int iNextChannelNumber(0);
CPVRChannelGroupPtr group = g_PVRChannelGroups->GetGroupAll(m_bIsRadio);
if (!group)
return;
for (int iListPtr = 0; iListPtr < m_channelItems->Size(); iListPtr++)
{
CFileItemPtr pItem = m_channelItems->Get(iListPtr);
if (!pItem->HasPVRChannelInfoTag())
continue;
if (pItem->GetProperty("SupportsSettings").asBoolean())
RenameChannel(pItem);
PersistChannel(pItem, group, &iNextChannelNumber);
pDlgProgress->SetPercentage(iListPtr * 100 / m_channelItems->Size());
}
group->SortAndRenumber();
group->Persist();
m_bContainsChanges = false;
SetItemsUnchanged();
pDlgProgress->Close();
}
示例6: CloseStream
void CPVRManager::CloseStream(void)
{
CPVRChannelPtr channel;
CPVRChannelGroupPtr group;
bool bPersistChanges(false);
{
CSingleLock lock(m_critSection);
if (m_addons->GetPlayingChannel(channel))
{
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
/* update last watched timestamp for channel */
channel->SetLastWatched(tNow);
/* update last watched timestamp for group */
group = g_PVRManager.GetPlayingGroup(channel->IsRadio());
group->SetLastWatched(tNow);
/* update last played group */
m_channelGroups->SetLastPlayedGroup(group);
bPersistChanges = true;
// store channel settings
g_application.SaveFileState();
}
m_addons->CloseStream();
SAFE_DELETE(m_currentFile);
}
if (bPersistChanges)
{
channel->Persist();
group->Persist();
}
}
示例7: AddGroup
bool CPVRChannelGroups::AddGroup(const CStdString &strName)
{
bool bPersist(false);
CPVRChannelGroupPtr group;
{
CSingleLock lock(m_critSection);
// check if there's no group with the same name yet
group = GetByName(strName);
if (!group)
{
// create a new group
group = CPVRChannelGroupPtr(new CPVRChannelGroup(m_bRadio, -1, strName));
m_groups.push_back(group);
bPersist = true;
}
}
// persist in the db if a new group was added
return bPersist ? group->Persist() : true;
}
示例8: Update
bool CPVRChannelGroups::Update(const CPVRChannelGroup &group, bool bSaveInDb)
{
if (group.GroupName().empty() && group.GroupID() <= 0)
return true;
CPVRChannelGroupPtr updateGroup;
{
CSingleLock lock(m_critSection);
// try to find the group by id
if (group.GroupID() > 0)
updateGroup = GetById(group.GroupID());
// try to find the group by name if we didn't find it yet
if (!updateGroup)
updateGroup = GetByName(group.GroupName());
if (!updateGroup)
{
// create a new group if none was found
updateGroup = CPVRChannelGroupPtr(new CPVRChannelGroup(m_bRadio, group.GroupID(), group.GroupName()));
updateGroup->SetGroupType(group.GroupType());
updateGroup->SetLastWatched(group.LastWatched());
m_groups.push_back(updateGroup);
}
else
{
// update existing group
updateGroup->SetGroupID(group.GroupID());
updateGroup->SetGroupName(group.GroupName());
updateGroup->SetGroupType(group.GroupType());
}
}
// persist changes
if (bSaveInDb && updateGroup)
return updateGroup->Persist();
return true;
}
示例9: AddGroup
bool CPVRChannelGroups::AddGroup(const std::string &strName)
{
bool bPersist(false);
CPVRChannelGroupPtr group;
{
CSingleLock lock(m_critSection);
// check if there's no group with the same name yet
group = GetByName(strName);
if (!group)
{
// create a new group
group.reset(new CPVRChannelGroup(m_bRadio, CPVRChannelGroup::INVALID_GROUP_ID, strName, GetGroupAll()));
m_groups.push_back(group);
bPersist = true;
}
}
// persist in the db if a new group was added
return bPersist ? group->Persist() : true;
}