本文整理汇总了C++中RecordingRule类的典型用法代码示例。如果您正苦于以下问题:C++ RecordingRule类的具体用法?C++ RecordingRule怎么用?C++ RecordingRule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RecordingRule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCurrent
void ProgLister::ShowDeleteRuleMenu(void)
{
ProgramInfo *pi = GetCurrent();
if (!pi || !pi->GetRecordingRuleID())
return;
RecordingRule *record = new RecordingRule();
if (!record->LoadByProgram(pi))
{
delete record;
return;
}
QString message = tr("Delete '%1' %2 rule?").arg(record->m_title)
.arg(toString(pi->GetRecordingRuleType()));
MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
MythConfirmationDialog *okPopup = new MythConfirmationDialog(
popupStack, message, true);
okPopup->SetReturnEvent(this, "deleterule");
okPopup->SetData(qVariantFromValue(record));
if (okPopup->Create())
popupStack->AddScreen(okPopup);
else
delete okPopup;
}
示例2: SameTimeslot
bool RecordingRule::SameTimeslot(RecordingRule &rule) const
{
time_t starttime = StartTime();
time_t rStarttime = rule.StartTime();
switch (rule.Type())
{
case MythTimer::NotRecording:
case MythTimer::SingleRecord:
case MythTimer::OverrideRecord:
case MythTimer::DontRecord:
return rStarttime == starttime && rule.EndTime() == EndTime() && rule.ChannelID() == ChannelID();
case MythTimer::FindDailyRecord:
case MythTimer::FindWeeklyRecord:
case MythTimer::FindOneRecord:
return rule.Title(false) == Title(false);
case MythTimer::TimeslotRecord:
return rule.Title(false) == Title(false) && daytime(&starttime) == daytime(&rStarttime) && rule.ChannelID() == ChannelID();
case MythTimer::ChannelRecord:
return rule.Title(false) == Title(false) && rule.ChannelID() == ChannelID(); //TODO: dup
case MythTimer::AllRecord:
return rule.Title(false) == Title(false); //TODO: dup
case MythTimer::WeekslotRecord:
return rule.Title(false) == Title(false) && daytime(&starttime) == daytime(&rStarttime) && weekday(&starttime) == weekday(&rStarttime) && rule.ChannelID() == ChannelID();
}
return false;
}
示例3: RecordingRule
/**
* \brief Creates a dialog for editing an override recording schedule
*/
void ScheduleCommon::MakeOverride(RecordingInfo *recinfo, bool startActive)
{
if (!recinfo || !recinfo->GetRecordingRuleID())
return;
RecordingRule *recrule = new RecordingRule();
if (!recrule->LoadByProgram(static_cast<ProgramInfo*>(recinfo)))
VERBOSE(VB_IMPORTANT, QString("Failed to load by program info"));
if (!recrule->MakeOverride())
{
VERBOSE(VB_IMPORTANT, QString("Failed to make Override"));
delete recrule;
return;
}
if (startActive)
recrule->m_type = kOverrideRecord;
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
ScheduleEditor *schededit = new ScheduleEditor(mainStack, recrule);
if (schededit->Create())
mainStack->AddScreen(schededit);
else
delete schededit;
}
示例4: LOG
void ManualSchedule::recordClicked(void)
{
QDateTime endts = m_startDateTime
.addSecs(max(m_durationSpin->GetIntValue() * 60, 60));
if (m_channelList->GetCurrentPos() >= m_chanids.size())
{
LOG(VB_GENERAL, LOG_ERR, "Channel out of range.");
return; // this can happen if there are no channels..
}
ProgramInfo p(m_titleEdit->GetText().trimmed(),
m_chanids[m_channelList->GetCurrentPos()],
m_startDateTime, endts);
RecordingRule *record = new RecordingRule();
record->LoadByProgram(&p);
record->m_searchType = kManualSearch;
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
ScheduleEditor *schededit = new ScheduleEditor(mainStack, record);
if (schededit->Create())
{
mainStack->AddScreen(schededit);
connect(schededit, SIGNAL(ruleSaved(int)), SLOT(scheduleCreated(int)));
}
else
delete schededit;
}
示例5: RecordingRule
void ProgramRecPriority::edit(MythUIButtonListItem *item)
{
if (!item)
return;
ProgramRecPriorityInfo *pgRecInfo =
item->GetData().value<ProgramRecPriorityInfo*>();
if (!pgRecInfo)
return;
RecordingRule *record = new RecordingRule();
record->m_recordID = pgRecInfo->GetRecordingRuleID();
if (record->m_searchType == kNoSearch)
record->LoadByProgram(pgRecInfo);
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
ScheduleEditor *schededit = new ScheduleEditor(mainStack, record);
if (schededit->Create())
{
mainStack->AddScreen(schededit);
connect(schededit, SIGNAL(ruleSaved(int)), SLOT(scheduleChanged(int)));
connect(schededit, SIGNAL(ruleDeleted(int)), SLOT(scheduleChanged(int)));
}
else
delete schededit;
}
示例6: RecordingRule
void ViewScheduled::deleteRule()
{
MythUIButtonListItem *item = m_schedulesList->GetItemCurrent();
if (!item)
return;
ProgramInfo *pginfo = qVariantValue<ProgramInfo*>(item->GetData());
if (!pginfo)
return;
RecordingRule *record = new RecordingRule();
if (!record->LoadByProgram(pginfo))
{
delete record;
return;
}
QString message = tr("Delete '%1' %2 rule?").arg(record->m_title)
.arg(toString(pginfo->GetRecordingRuleType()));
MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
MythConfirmationDialog *okPopup = new MythConfirmationDialog(popupStack,
message, true);
okPopup->SetReturnEvent(this, "deleterule");
okPopup->SetData(qVariantFromValue(record));
if (okPopup->Create())
popupStack->AddScreen(okPopup);
else
delete okPopup;
}
示例7: LoadFromRecorded
void LookerUpper::CopyRuleInetrefsToRecordings()
{
QMap< QString, ProgramInfo* > recMap;
QMap< QString, uint32_t > inUseMap = ProgramInfo::QueryInUseMap();
QMap< QString, bool > isJobRunning = ProgramInfo::QueryJobsRunning(JOB_COMMFLAG);
ProgramList progList;
LoadFromRecorded( progList, false, inUseMap, isJobRunning, recMap, -1 );
for( int n = 0; n < (int)progList.size(); n++)
{
ProgramInfo *pginfo = new ProgramInfo(*(progList[n]));
if (pginfo && pginfo->GetInetRef().isEmpty())
{
RecordingRule *rule = new RecordingRule();
rule->m_recordID = pginfo->GetRecordingRuleID();
rule->Load();
if (!rule->m_inetref.isEmpty())
{
QString msg = QString("%1").arg(pginfo->GetTitle());
if (!pginfo->GetSubtitle().isEmpty())
msg += QString(": %1").arg(pginfo->GetSubtitle());
msg += " has no inetref, but its recording rule does. Copying...";
LOG(VB_GENERAL, LOG_INFO, msg);
pginfo->SaveInetRef(rule->m_inetref);
}
delete rule;
}
delete pginfo;
}
}
示例8: RecordingRule
/**
* \brief Creates a dialog for editing an override recording schedule
*/
void ScheduleCommon::MakeOverride(RecordingInfo *recinfo)
{
if (!recinfo || !recinfo->GetRecordingRuleID())
return;
RecordingRule *recrule = new RecordingRule();
if (!recrule->LoadByProgram(static_cast<ProgramInfo*>(recinfo)))
LOG(VB_GENERAL, LOG_ERR, "Failed to load by program info");
if (!recrule->MakeOverride())
{
LOG(VB_GENERAL, LOG_ERR, "Failed to make Override");
delete recrule;
return;
}
recrule->m_type = kOverrideRecord;
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
ScheduleEditor *schededit = new ScheduleEditor(mainStack, recrule);
if (schededit->Create())
mainStack->AddScreen(schededit);
else
delete schededit;
}
示例9: throw
bool Dvr::RemoveRecordSchedule ( uint nRecordId )
{
bool bResult = false;
if (nRecordId <= 0 )
throw( QString("Record ID appears invalid."));
RecordingRule *pRule = new RecordingRule();
pRule->m_recordID = nRecordId;
bResult = pRule->Delete();
return bResult;
}
示例10: QString
bool Dvr::RemoveRecordSchedule ( uint nRecordId )
{
bool bResult = false;
if (nRecordId <= 0 )
throw QString("Record ID does not exist.");
RecordingRule pRule;
pRule.m_recordID = nRecordId;
bResult = pRule.Delete();
return bResult;
}
示例11: GuessLookupType
LookupType GuessLookupType(ProgramInfo *pginfo)
{
LookupType ret = GuessLookupType(pginfo->GetInetRef());
if (ret != kUnknownVideo)
return ret;
ProgramInfo::CategoryType catType = pginfo->GetCategoryType();
if (catType == ProgramInfo::kCategoryNone)
catType = pginfo->QueryCategoryType();
if ((!pginfo->GetSubtitle().isEmpty() || pginfo->GetEpisode() > 0) &&
(catType == ProgramInfo::kCategorySeries ||
catType == ProgramInfo::kCategoryTVShow))
ret = kProbableTelevision;
else if (catType == ProgramInfo::kCategoryMovie)
ret = kProbableMovie;
else if (pginfo->GetSeason() > 0 || pginfo->GetEpisode() > 0 ||
!pginfo->GetSubtitle().isEmpty())
ret = kProbableTelevision;
else
{
// Before committing to something being a movie, we
// want to check its rule. If the rule has a season
// or episode number, but the recording doesn't,
// and the rec doesn't have a subtitle, this is a
// generic recording. If neither the rule nor the
// recording have an inetref, season, episode, or
// subtitle, it's *probably* a movie. If it's some
// weird combination of both, we've got to try everything.
RecordingRule *rule = new RecordingRule();
rule->m_recordID = pginfo->GetRecordingRuleID();
rule->Load();
int ruleepisode = rule->m_episode;
delete rule;
if (ruleepisode == 0 && pginfo->GetEpisode() == 0 &&
pginfo->GetSubtitle().isEmpty())
ret = kProbableMovie;
else if (ruleepisode > 0 && pginfo->GetSubtitle().isEmpty())
ret = kProbableGenericTelevision;
else
ret = kUnknownVideo;
}
return ret;
}
示例12: RemoteGetAllScheduledRecordings
DTC::RecRuleList* Dvr::GetRecordScheduleList( int nStartIndex,
int nCount )
{
vector<ProgramInfo *> infoList;
RemoteGetAllScheduledRecordings(infoList);
// ----------------------------------------------------------------------
// Build Response
// ----------------------------------------------------------------------
DTC::RecRuleList *pRecRules = new DTC::RecRuleList();
nStartIndex = min( nStartIndex, (int)infoList.size() );
nCount = (nCount > 0) ? min( nCount, (int)infoList.size() ) : infoList.size();
int nEndIndex = min((nStartIndex + nCount), (int)infoList.size() );
for( int n = nStartIndex; n < nEndIndex; n++)
{
RecordingRule *rule = new RecordingRule();
ProgramInfo *pInfo = infoList[ n ];
rule->LoadByProgram(pInfo);
if (pInfo != NULL)
{
DTC::RecRule *pRecRule = pRecRules->AddNewRecRule();
FillRecRuleInfo( pRecRule, rule );
delete rule;
delete pInfo;
}
}
// ----------------------------------------------------------------------
pRecRules->setStartIndex ( nStartIndex );
pRecRules->setCount ( nCount );
pRecRules->setTotalAvailable( infoList.size() );
pRecRules->setAsOf ( QDateTime::currentDateTime() );
pRecRules->setVersion ( MYTH_BINARY_VERSION );
pRecRules->setProtoVer ( MYTH_PROTO_VERSION );
return pRecRules;
}
示例13: QString
DTC::RecRule* Dvr::GetRecordSchedule( uint nRecordId,
QString sTemplate,
int nChanId,
QDateTime dStartTimeRaw,
bool bMakeOverride )
{
RecordingRule rule;
QDateTime dStartTime = dStartTimeRaw.toUTC();
if (nRecordId > 0)
{
rule.m_recordID = nRecordId;
if (!rule.Load())
throw QString("Record ID does not exist.");
}
else if (!sTemplate.isEmpty())
{
if (!rule.LoadTemplate(sTemplate))
throw QString("Template does not exist.");
}
else if (nChanId > 0 && dStartTime.isValid())
{
RecordingInfo::LoadStatus status;
RecordingInfo info(nChanId, dStartTime, false, 0, &status);
if (status != RecordingInfo::kFoundProgram)
throw QString("Program does not exist.");
RecordingRule *pRule = info.GetRecordingRule();
if (bMakeOverride && rule.m_type != kSingleRecord &&
rule.m_type != kOverrideRecord && rule.m_type != kDontRecord)
pRule->MakeOverride();
rule = *pRule;
}
else
{
throw QString("Invalid request.");
}
DTC::RecRule *pRecRule = new DTC::RecRule();
FillRecRuleInfo( pRecRule, &rule );
return pRecRule;
}
示例14: edit
void ProgramRecPriority::newTemplate(QString category)
{
category = category.trimmed();
if (category.isEmpty())
return;
// Try to find an existing template and use it.
QMap<int, ProgramRecPriorityInfo>::Iterator it;
for (it = m_programData.begin(); it != m_programData.end(); ++it)
{
ProgramRecPriorityInfo *progInfo = &(*it);
if (progInfo->GetRecordingRuleType() == kTemplateRecord &&
category.compare(progInfo->GetCategory(),
Qt::CaseInsensitive) == 0)
{
m_programList->SetValueByData(qVariantFromValue(progInfo));
edit(m_programList->GetItemCurrent());
return;
}
}
RecordingRule *record = new RecordingRule();
if (!record)
return;
record->MakeTemplate(category);
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
ScheduleEditor *schededit = new ScheduleEditor(mainStack, record);
if (schededit->Create())
{
mainStack->AddScreen(schededit);
connect(schededit, SIGNAL(ruleSaved(int)), SLOT(scheduleChanged(int)));
connect(schededit, SIGNAL(ruleDeleted(int)), SLOT(scheduleChanged(int)));
}
else
delete schededit;
}
示例15: switch
void ProgLister::customEvent(QEvent *event)
{
bool needUpdate = false;
if (event->type() == DialogCompletionEvent::kEventType)
{
DialogCompletionEvent *dce = (DialogCompletionEvent*)(event);
QString resultid = dce->GetId();
QString resulttext = dce->GetResultText();
int buttonnum = dce->GetResult();
if (resultid == "sortmenu")
{
switch (buttonnum)
{
case 0:
m_reverseSort = !m_reverseSort;
needUpdate = true;
break;
case 1:
m_titleSort = true;
m_reverseSort = false;
needUpdate = true;
break;
case 2:
m_titleSort = false;
m_reverseSort = (m_type == plPreviouslyRecorded);
needUpdate = true;
break;
}
}
else if (resultid == "deletemenu")
{
switch (buttonnum)
{
case 0:
{
ProgramInfo *pi = GetCurrent();
if (pi)
{
RecordingInfo ri(*pi);
if (ri.IsDuplicate())
ri.ForgetHistory();
else
ri.SetDupHistory();
*pi = ri;
}
break;
}
case 1:
ShowDeleteOldEpisodeMenu();
break;
case 2:
ShowDeleteOldSeriesMenu();
break;
}
}
else if (resultid == "deleterule")
{
RecordingRule *record =
qVariantValue<RecordingRule *>(dce->GetData());
if (record && buttonnum > 0 && !record->Delete())
{
LOG(VB_GENERAL, LOG_ERR, LOC +
"Failed to delete recording rule");
}
if (record)
delete record;
}
else
{
ScheduleCommon::customEvent(event);
}
}
else if (event->type() == ScreenLoadCompletionEvent::kEventType)
{
ScreenLoadCompletionEvent *slce = (ScreenLoadCompletionEvent*)(event);
QString id = slce->GetId();
if (id == objectName())
{
CloseBusyPopup(); // opened by LoadInBackground()
UpdateDisplay();
if (m_curView < 0 && m_type != plPreviouslyRecorded)
ShowChooseViewMenu();
}
}
else if ((MythEvent::Type)(event->type()) == MythEvent::MythEventMessage)
{
MythEvent *me = (MythEvent *)event;
QString message = me->Message();
if (message == "CHOOSE_VIEW")
ShowChooseViewMenu();
else if (message == "SCHEDULE_CHANGE")
needUpdate = true;
}
//.........这里部分代码省略.........