本文整理汇总了C++中CPVRTimerInfoTagPtr类的典型用法代码示例。如果您正苦于以下问题:C++ CPVRTimerInfoTagPtr类的具体用法?C++ CPVRTimerInfoTagPtr怎么用?C++ CPVRTimerInfoTagPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPVRTimerInfoTagPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
bool CPVRTimers::UpdateFromClient(const CPVRTimerInfoTag &timer)
{
CSingleLock lock(m_critSection);
CPVRTimerInfoTagPtr tag = GetByClient(timer.m_iClientId, timer.m_iClientIndex);
if (!tag)
{
tag = CPVRTimerInfoTagPtr(new CPVRTimerInfoTag());
vector<CPVRTimerInfoTagPtr>* addEntry = NULL;
map<CDateTime, vector<CPVRTimerInfoTagPtr>* >::iterator itr = m_tags.find(timer.StartAsUTC());
if (itr == m_tags.end())
{
addEntry = new vector<CPVRTimerInfoTagPtr>;
m_tags.insert(make_pair(timer.StartAsUTC(), addEntry));
}
else
{
addEntry = itr->second;
}
addEntry->push_back(tag);
}
UpdateEpgEvent(tag);
return tag->UpdateEntry(timer);
}
示例2: epgTag
CFileItemPtr CPVRTimers::GetTimerForEpgTag(const CFileItem *item) const
{
if (item && item->HasEPGInfoTag() && item->GetEPGInfoTag()->ChannelTag())
{
const CEpgInfoTagPtr epgTag(item->GetEPGInfoTag());
const CPVRChannelPtr channel(epgTag->ChannelTag());
CSingleLock lock(m_critSection);
for (MapTags::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it)
{
for (VecTimerInfoTag::const_iterator timerIt = it->second->begin(); timerIt != it->second->end(); ++timerIt)
{
CPVRTimerInfoTagPtr timer = *timerIt;
if (timer->GetEpgInfoTag() == epgTag ||
(timer->m_iClientChannelUid == channel->UniqueID() &&
timer->m_bIsRadio == channel->IsRadio() &&
timer->StartAsUTC() <= epgTag->StartAsUTC() &&
timer->EndAsUTC() >= epgTag->EndAsUTC()))
{
CFileItemPtr fileItem(new CFileItem(timer));
return fileItem;
}
}
}
}
CFileItemPtr fileItem;
return fileItem;
}
示例3: ShowNewTimerDialog
bool CGUIWindowPVRTimersBase::ActionShowTimer(CFileItem *item)
{
if (!g_PVRClients->SupportsTimers())
{
CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19215}); // "Information", "The PVR backend does not support timers."
return false;
}
bool bReturn = false;
/* Check if "Add timer..." entry is pressed by OK, if yes
create a new timer and open settings dialog, otherwise
open settings for selected timer entry */
if (URIUtils::PathEquals(item->GetPath(), CPVRTimersPath::PATH_ADDTIMER))
{
bReturn = ShowNewTimerDialog();
}
else
{
const CPVRTimerInfoTagPtr tag(item->GetPVRTimerInfoTag());
if (ShowTimerSettings(tag) && !tag->GetTimerType()->IsReadOnly())
{
/* Update timer on pvr backend */
bReturn = g_PVRTimers->UpdateTimer(tag);
}
}
return bReturn;
}
示例4: GetActiveRecordings
void CPVRGUIInfo::TimerInfo::UpdateTimersToggle()
{
if (!TimerInfoToggle())
return;
std::string strActiveTimerTitle;
std::string strActiveTimerChannelName;
std::string strActiveTimerChannelIcon;
std::string strActiveTimerTime;
/* safe to fetch these unlocked, since they're updated from the same thread as this one */
if (m_iRecordingTimerAmount > 0)
{
std::vector<CFileItemPtr> activeTags = GetActiveRecordings();
if (m_iTimerInfoToggleCurrent < activeTags.size() && activeTags.at(m_iTimerInfoToggleCurrent)->HasPVRTimerInfoTag())
{
CPVRTimerInfoTagPtr tag = activeTags.at(m_iTimerInfoToggleCurrent)->GetPVRTimerInfoTag();
strActiveTimerTitle = StringUtils::Format("%s", tag->Title().c_str());
strActiveTimerChannelName = StringUtils::Format("%s", tag->ChannelName().c_str());
strActiveTimerChannelIcon = StringUtils::Format("%s", tag->ChannelIcon().c_str());
strActiveTimerTime = StringUtils::Format("%s", tag->StartAsLocalTime().GetAsLocalizedDateTime(false, false).c_str());
}
}
CSingleLock lock(m_critSection);
m_strActiveTimerTitle = strActiveTimerTitle;
m_strActiveTimerChannelName = strActiveTimerChannelName;
m_strActiveTimerChannelIcon = strActiveTimerChannelIcon;
m_strActiveTimerTime = strActiveTimerTime;
}
示例5: iRemoved
int EpgSearchFilter::FilterTimers(CFileItemList &results)
{
int iRemoved(0);
if (!g_PVRManager.IsStarted())
return iRemoved;
std::vector<CFileItemPtr> timers = g_PVRTimers->GetActiveTimers();
// TODO inefficient!
for (unsigned int iTimerPtr = 0; iTimerPtr < timers.size(); iTimerPtr++)
{
CFileItemPtr fileItem = timers.at(iTimerPtr);
if (!fileItem || !fileItem->HasPVRTimerInfoTag())
continue;
CPVRTimerInfoTagPtr timer = fileItem->GetPVRTimerInfoTag();
if (!timer)
continue;
for (int iResultPtr = 0; iResultPtr < results.Size(); iResultPtr++)
{
const CEpgInfoTagPtr epgentry(results.Get(iResultPtr)->GetEPGInfoTag());
if (!epgentry ||
*epgentry->ChannelTag() != *timer->ChannelTag() ||
epgentry->StartAsUTC() < timer->StartAsUTC() ||
epgentry->EndAsUTC() > timer->EndAsUTC())
continue;
results.Remove(iResultPtr);
iResultPtr--;
++iRemoved;
}
}
return iRemoved;
}
示例6: GetTimerRule
CFileItemPtr CPVRTimers::GetTimerRule(const CFileItem *item) const
{
CPVRTimerInfoTagPtr timer;
if (item && item->HasEPGInfoTag())
timer = item->GetEPGInfoTag()->Timer();
else if (item && item->HasPVRTimerInfoTag())
timer = item->GetPVRTimerInfoTag();
if (timer)
{
unsigned int iRuleId = timer->GetTimerRuleId();
if (iRuleId != PVR_TIMER_NO_PARENT)
{
int iClientId = timer->m_iClientId;
CSingleLock lock(m_critSection);
for (const auto &tagsEntry : m_tags)
{
for (const auto &timersEntry : *tagsEntry.second)
{
if (timersEntry->m_iClientId == iClientId && timersEntry->m_iClientIndex == iRuleId)
return CFileItemPtr(new CFileItem(timersEntry));
}
}
}
}
return CFileItemPtr();
}
示例7: UpdateEpgEvent
void CPVRTimers::UpdateEpgEvent(CPVRTimerInfoTagPtr timer)
{
CSingleLock lock(timer->m_critSection);
/* already got an epg event set */
if (timer->m_epgTag)
return;
/* try to get the channel */
CPVRChannelPtr channel = g_PVRChannelGroups->GetByUniqueID(timer->m_iClientChannelUid, timer->m_iClientId);
if (!channel)
return;
/* try to get the EPG table */
CEpg *epg = channel->GetEPG();
if (!epg)
return;
/* try to set the timer on the epg tag that matches with a 2 minute margin */
CEpgInfoTagPtr epgTag = epg->GetTagBetween(timer->StartAsUTC() - CDateTimeSpan(0, 0, 2, 0), timer->EndAsUTC() + CDateTimeSpan(0, 0, 2, 0));
if (!epgTag)
epgTag = epg->GetTagAround(timer->StartAsUTC());
if (epgTag)
{
timer->m_epgTag = epgTag;
timer->m_genre = epgTag->Genre();
timer->m_iGenreType = epgTag->GenreType();
timer->m_iGenreSubType = epgTag->GenreSubType();
epgTag->SetTimer(timer);
}
}
示例8: lock
bool CPVRTimers::UpdateFromClient(const CPVRTimerInfoTagPtr &timer)
{
CSingleLock lock(m_critSection);
CPVRTimerInfoTagPtr tag = GetByClient(timer->m_iClientId, timer->m_iClientIndex);
if (!tag)
{
tag = CPVRTimerInfoTagPtr(new CPVRTimerInfoTag());
VecTimerInfoTag* addEntry = NULL;
MapTags::iterator itr = m_tags.find(timer->StartAsUTC());
if (itr == m_tags.end())
{
addEntry = new VecTimerInfoTag;
m_tags.insert(std::make_pair(timer->StartAsUTC(), addEntry));
}
else
{
addEntry = itr->second;
}
tag->m_iTimerId = ++m_iLastId;
addEntry->push_back(tag);
}
UpdateEpgEvent(tag);
return tag->UpdateEntry(timer);
}
示例9: OnContextButtonActivate
bool CGUIWindowPVRTimers::OnContextButtonActivate(CFileItem *item, CONTEXT_BUTTON button)
{
bool bReturn = false;
if (button == CONTEXT_BUTTON_ACTIVATE)
{
bReturn = true;
if (!item->HasPVRTimerInfoTag())
return bReturn;
CPVRTimerInfoTagPtr timer = item->GetPVRTimerInfoTag();
int iLabelId;
if (timer->IsActive())
{
timer->m_state = PVR_TIMER_STATE_CANCELLED;
iLabelId = 13106;
}
else
{
timer->m_state = PVR_TIMER_STATE_SCHEDULED;
iLabelId = 305;
}
CGUIDialogOK::ShowAndGetInput(19033, 19040, 0, iLabelId);
g_PVRTimers->UpdateTimer(*item);
}
return bReturn;
}
示例10: lock
bool CPVRTimers::DeleteTimersOnChannel(const CPVRChannel &channel, bool bDeleteRepeating /* = true */, bool bCurrentlyActiveOnly /* = false */)
{
bool bReturn = false;
CSingleLock lock(m_critSection);
for (map<CDateTime, vector<CPVRTimerInfoTagPtr>* >::reverse_iterator it = m_tags.rbegin(); it != m_tags.rend(); it++)
{
for (vector<CPVRTimerInfoTagPtr>::iterator timerIt = it->second->begin(); timerIt != it->second->end(); timerIt++)
{
CPVRTimerInfoTagPtr timer = (*timerIt);
if (bCurrentlyActiveOnly &&
(CDateTime::GetCurrentDateTime() < timer->StartAsLocalTime() ||
CDateTime::GetCurrentDateTime() > timer->EndAsLocalTime()))
continue;
if (!bDeleteRepeating && timer->m_bIsRepeating)
continue;
if (timer->ChannelNumber() == channel.ChannelNumber() && timer->m_bIsRadio == channel.IsRadio())
{
bReturn = timer->DeleteFromClient(true) || bReturn;
it->second->erase(timerIt);
}
}
}
return bReturn;
}
示例11: ConfirmDeleteTimer
bool CPVRGUIActions::ConfirmDeleteTimer(const CPVRTimerInfoTagPtr &timer, bool &bDeleteRule) const
{
bool bConfirmed(false);
if (timer->GetTimerRuleId() != PVR_TIMER_NO_PARENT)
{
// timer was scheduled by a timer rule. prompt user for confirmation for deleting the timer rule, including scheduled timers.
bool bCancel(false);
bDeleteRule = CGUIDialogYesNo::ShowAndGetInput(CVariant{122}, // "Confirm delete"
CVariant{840}, // "Do you want to delete only this timer or also the timer rule that has scheduled it?"
CVariant{""},
CVariant{timer->Title()},
bCancel,
CVariant{841}, // "Only this"
CVariant{593}, // "All"
0); // no autoclose
bConfirmed = !bCancel;
}
else
{
bDeleteRule = false;
// prompt user for confirmation for deleting the timer
bConfirmed = CGUIDialogYesNo::ShowAndGetInput(CVariant{122}, // "Confirm delete"
timer->IsTimerRule()
? CVariant{845} // "Are you sure you want to delete this timer rule and all timers it has scheduled?"
: CVariant{846}, // "Are you sure you want to delete this timer?"
CVariant{""},
CVariant{timer->Title()});
}
return bConfirmed;
}
示例12: DeleteTimer
bool CPVRTimers::DeleteTimer(const CFileItem &item, bool bForce /* = false */, bool bDeleteSchedule /* = false */)
{
/* Check if a CPVRTimerInfoTag is inside file item */
if (!item.IsPVRTimer())
{
CLog::Log(LOGERROR, "PVRTimers - %s - no TimerInfoTag given", __FUNCTION__);
return false;
}
CPVRTimerInfoTagPtr tag = item.GetPVRTimerInfoTag();
if (!tag)
return false;
if (bDeleteSchedule)
{
/* delete the repeating timer that scheduled this timer. */
tag = g_PVRTimers->GetByClient(tag->m_iClientId, tag->GetTimerScheduleId());
if (!tag)
{
CLog::Log(LOGERROR, "PVRTimers - %s - unable to obtain parent timer for given timer", __FUNCTION__);
return false;
}
}
return tag->DeleteFromClient(bForce);
}
示例13: ClearTimer
void CEpgInfoTag::ClearTimer(void)
{
CPVRTimerInfoTagPtr previousTag;
previousTag = m_timer;
CPVRTimerInfoTagPtr empty;
m_timer = empty;
if (previousTag)
previousTag->ClearEpgTag();
}
示例14: DeleteTimer
bool CGUIWindowPVRBase::DeleteTimer(CFileItem *item, bool bIsRecording, bool bDeleteRule)
{
CPVRTimerInfoTagPtr timer;
if (item->IsPVRTimer())
{
timer = item->GetPVRTimerInfoTag();
}
else if (item->IsEPG())
{
timer = item->GetEPGInfoTag()->Timer();
}
else if (item->IsPVRChannel())
{
const CEpgInfoTagPtr epgTag(item->GetPVRChannelInfoTag()->GetEPGNow());
if (epgTag)
timer = epgTag->Timer(); // cheap method, but not reliable as timers get set at epg tags asychrounously
if (!timer)
timer = g_PVRTimers->GetActiveTimerForChannel(item->GetPVRChannelInfoTag()); // more expensive, but reliable and works even for channels with no epg data
}
if (!timer)
{
CLog::Log(LOGERROR, "CGUIWindowPVRBase - %s - no timer!", __FUNCTION__);
return false;
}
if (bDeleteRule && !timer->IsRepeating())
timer = g_PVRTimers->GetTimerRule(timer);
if (!timer)
{
CLog::Log(LOGERROR, "CGUIWindowPVRBase - %s - no timer rule!", __FUNCTION__);
return false;
}
if (bIsRecording)
{
if (ConfirmStopRecording(timer))
return g_PVRTimers->DeleteTimer(timer, true, false);
}
else if (timer->HasTimerType() && timer->GetTimerType()->IsReadOnly())
{
return false;
}
else
{
bool bAlsoDeleteRule(false);
if (ConfirmDeleteTimer(timer, bAlsoDeleteRule))
return g_PVRTimers->DeleteTimer(timer, false, bAlsoDeleteRule);
}
return false;
}
示例15: lock
bool CPVRTimersContainer::UpdateFromClient(const CPVRTimerInfoTagPtr &timer)
{
CSingleLock lock(m_critSection);
CPVRTimerInfoTagPtr tag = GetByClient(timer->m_iClientId, timer->m_iClientIndex);
if (!tag)
{
tag.reset(new CPVRTimerInfoTag());
tag->m_iTimerId = ++m_iLastId;
InsertTimer(tag);
}
return tag->UpdateEntry(timer);
}