本文整理汇总了C++中ProgramList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgramList::end方法的具体用法?C++ ProgramList::end怎么用?C++ ProgramList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgramList
的用法示例。
在下文中一共展示了ProgramList::end方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: countMatches
void ProgramRecPriority::countMatches()
{
m_listMatch.clear();
m_conMatch.clear();
m_nowMatch.clear();
m_recMatch.clear();
ProgramList schedList;
LoadFromScheduler(schedList);
QDateTime now = MythDate::current();
ProgramList::const_iterator it = schedList.begin();
for (; it != schedList.end(); ++it)
{
const RecStatus::Type recstatus = (**it).GetRecordingStatus();
const uint recordid = (**it).GetRecordingRuleID();
if ((**it).GetRecordingEndTime() > now && recstatus != RecStatus::NotListed)
{
m_listMatch[recordid]++;
if (recstatus == RecStatus::Conflict || recstatus == RecStatus::Offline)
m_conMatch[recordid]++;
else if (recstatus == RecStatus::WillRecord)
m_recMatch[recordid]++;
else if (recstatus == RecStatus::Recording)
{
m_nowMatch[recordid]++;
m_recMatch[recordid]++;
}
}
}
}
示例2: GetProgramDetailList
bool GetProgramDetailList(
QDateTime &nextRecordingStart, bool *hasConflicts, ProgramDetailList *list)
{
nextRecordingStart = QDateTime();
bool dummy;
bool *conflicts = (hasConflicts) ? hasConflicts : &dummy;
ProgramList progList;
if (!LoadFromScheduler(progList, *conflicts))
return false;
// find the earliest scheduled recording
ProgramList::const_iterator it = progList.begin();
for (; it != progList.end(); ++it)
{
if (((*it)->GetRecordingStatus() == rsWillRecord) &&
(nextRecordingStart.isNull() ||
nextRecordingStart > (*it)->GetRecordingStartTime()))
{
nextRecordingStart = (*it)->GetRecordingStartTime();
}
}
if (!list)
return true;
// save the details of the earliest recording(s)
for (it = progList.begin(); it != progList.end(); ++it)
{
if (((*it)->GetRecordingStatus() == rsWillRecord) &&
((*it)->GetRecordingStartTime() == nextRecordingStart))
{
ProgramDetail prog;
prog.channame = (*it)->GetChannelName();
prog.title = (*it)->GetTitle();
prog.subtitle = (*it)->GetSubtitle();
prog.startTime = (*it)->GetRecordingStartTime();
prog.endTime = (*it)->GetRecordingEndTime();
list->push_back(prog);
}
}
return true;
}
示例3: addProgram
void
MidiDevice::mergeProgramList(const ProgramList &programList)
{
ProgramList::const_iterator it;
ProgramList::iterator oIt;
bool clash = false;
for (it = programList.begin(); it != programList.end(); ++it)
{
for (oIt = m_programList.begin(); oIt != m_programList.end(); ++oIt)
{
if (*it == *oIt)
{
clash = true;
break;
}
}
if (clash == false)
addProgram(*it);
else
clash = false;
}
}
示例4: setEnabled
void
MidiProgramsEditor::populate(QTreeWidgetItem* item)
{
RG_DEBUG << "MidiProgramsEditor::populate\n";
MidiBankTreeWidgetItem* bankItem = dynamic_cast<MidiBankTreeWidgetItem*>(item);
if (!bankItem) {
RG_DEBUG << "MidiProgramsEditor::populate : not a bank item - returning\n";
return ;
}
DeviceId deviceId = bankItem->getDeviceId();
m_device = m_bankEditor->getMidiDevice(deviceId);
if (!m_device)
return ;
setEnabled(true);
setBankName(item->text(0));
RG_DEBUG << "MidiProgramsEditor::populate : bankItem->getBank = "
<< bankItem->getBank() << endl;
m_currentBank = &(m_bankList[bankItem->getBank()]); // m_device->getBankByIndex(bankItem->getBank());
blockAllSignals(true);
// set the bank values
m_percussion->setChecked(m_currentBank->isPercussion());
m_msb->setValue(m_currentBank->getMSB());
m_lsb->setValue(m_currentBank->getLSB());
m_oldBank = *m_currentBank;
// Librarian details
//
m_librarian->setText(strtoqstr(m_device->getLibrarianName()));
m_librarianEmail->setText(strtoqstr(m_device->getLibrarianEmail()));
ProgramList programSubset = getBankSubset(*m_currentBank);
ProgramList::iterator it;
QPixmap noKeyPixmap, keyPixmap;
IconLoader il;
noKeyPixmap = il.loadPixmap("key-white");
keyPixmap = il.loadPixmap("key-green");
bool haveKeyMappings = m_device->getKeyMappings().size() > 0;
for (unsigned int i = 0; i < (unsigned int)m_names.size(); i++) {
m_names[i]->clear();
getKeyMapButton(i)->setEnabled(haveKeyMappings);
getKeyMapButton(i)->setIcon(QIcon(noKeyPixmap));
// QToolTip::remove
// ( getKeyMapButton(i) );
getKeyMapButton(i)->setToolTip(QString("")); //@@@ Usefull ?
getKeyMapButton(i)->setMaximumHeight( 12 );
for (it = programSubset.begin(); it != programSubset.end(); ++it) {
if (it->getProgram() == i) {
// zero in on "Harpsichord" vs. "Coupled Harpsichord to cut down
// on noise (0-based)
// if (i == 6) std::cout << "it->getName(): " << it->getName() << std::endl;
QString programName = strtoqstr(it->getName());
m_completions << programName;
m_names[i]->setText(programName);
if (m_device->getKeyMappingForProgram(*it)) {
getKeyMapButton(i)->setIcon(QIcon(keyPixmap));
getKeyMapButton(i)->setToolTip
(tr("Key Mapping: %1")
.arg(strtoqstr(m_device->getKeyMappingForProgram(*it)->getName())));
}
break;
}
}
// show start of label
m_names[i]->setCursorPosition(0);
}
blockAllSignals(false);
}
示例5: FillList
void ViewScheduled::FillList()
{
m_schedulesList->Reset();
MythUIText *norecordingText = dynamic_cast<MythUIText*>
(GetChild("norecordings_info"));
if (norecordingText)
norecordingText->SetVisible(m_recList.empty());
if (m_recList.empty())
return;
ProgramList plist;
if (!m_recgroupList.contains(m_currentGroup))
m_currentGroup = m_defaultGroup;
plist = m_recgroupList[m_currentGroup];
ProgramList::iterator pit = plist.begin();
while (pit != plist.end())
{
ProgramInfo *pginfo = *pit;
if (!pginfo)
{
++pit;
continue;
}
QString state;
const RecStatusType recstatus = pginfo->GetRecordingStatus();
if (recstatus == rsRecording)
state = "running";
else if (recstatus == rsConflict ||
recstatus == rsOffLine ||
recstatus == rsTunerBusy ||
recstatus == rsFailed ||
recstatus == rsAborted ||
recstatus == rsMissed)
state = "error";
else if (recstatus == rsWillRecord)
{
if ((m_curcard == 0 && m_curinput == 0) ||
pginfo->GetCardID() == m_curcard ||
pginfo->GetInputID() == m_curinput)
{
if (pginfo->GetRecordingPriority2() < 0)
state = "warning";
else
state = "normal";
}
}
else if (recstatus == rsRepeat ||
recstatus == rsOtherShowing ||
recstatus == rsNeverRecord ||
recstatus == rsDontRecord ||
(recstatus != rsDontRecord &&
recstatus <= rsEarlierShowing))
state = "disabled";
else
state = "warning";
MythUIButtonListItem *item =
new MythUIButtonListItem(m_schedulesList,"",
qVariantFromValue(pginfo));
InfoMap infoMap;
pginfo->ToMap(infoMap);
item->SetTextFromMap(infoMap, state);
QString rating = QString::number(pginfo->GetStars(10));
item->DisplayState(rating, "ratingstate");
item->DisplayState(state, "status");
++pit;
}
MythUIText *statusText = dynamic_cast<MythUIText*>(GetChild("status"));
if (statusText)
{
if (m_conflictBool)
{
// Find first conflict and store in m_conflictDate field
ProgramList::const_iterator it = plist.begin();
for (; it != plist.end(); ++it)
{
ProgramInfo &p = **it;
if (p.GetRecordingStatus() == rsConflict)
{
m_conflictDate = p.GetRecordingStartTime().date();
break;
}
}
// figure out caption based on m_conflictDate
QString cstring = tr("Time Conflict");
QDate now = QDate::currentDate();
int daysToConflict = now.daysTo(m_conflictDate);
//.........这里部分代码省略.........
示例6: FillList
void ViewScheduled::FillList()
{
m_schedulesList->Reset();
MythUIText *norecordingText = dynamic_cast<MythUIText*>
(GetChild("norecordings_info"));
if (norecordingText)
norecordingText->SetVisible(m_recList.empty());
if (m_recList.empty())
return;
ProgramList plist;
if (!m_recgroupList.contains(m_currentGroup))
m_currentGroup = m_defaultGroup;
plist = m_recgroupList[m_currentGroup];
ProgramList::iterator pit = plist.begin();
while (pit != plist.end())
{
ProgramInfo *pginfo = *pit;
if (!pginfo)
{
++pit;
continue;
}
QString state;
const RecStatus::Type recstatus = pginfo->GetRecordingStatus();
if (recstatus == RecStatus::Recording ||
recstatus == RecStatus::Tuning)
state = "running";
else if (recstatus == RecStatus::Conflict ||
recstatus == RecStatus::Offline ||
recstatus == RecStatus::TunerBusy ||
recstatus == RecStatus::Failed ||
recstatus == RecStatus::Failing ||
recstatus == RecStatus::Aborted ||
recstatus == RecStatus::Missed)
state = "error";
else if (recstatus == RecStatus::WillRecord ||
recstatus == RecStatus::Pending)
{
if (m_curinput == 0 || pginfo->GetInputID() == m_curinput)
{
if (pginfo->GetRecordingPriority2() < 0)
state = "warning";
else
state = "normal";
}
}
else if (recstatus == RecStatus::Repeat ||
recstatus == RecStatus::NeverRecord ||
recstatus == RecStatus::DontRecord ||
(recstatus != RecStatus::DontRecord &&
recstatus <= RecStatus::EarlierShowing))
state = "disabled";
else
state = "warning";
MythUIButtonListItem *item =
new MythUIButtonListItem(m_schedulesList,"",
qVariantFromValue(pginfo));
InfoMap infoMap;
pginfo->ToMap(infoMap);
item->SetTextFromMap(infoMap, state);
QString rating = QString::number(pginfo->GetStars(10));
item->DisplayState(rating, "ratingstate");
item->DisplayState(state, "status");
++pit;
}
MythUIText *statusText = dynamic_cast<MythUIText*>(GetChild("status"));
if (statusText)
{
if (m_conflictBool)
{
// Find first conflict and store in m_conflictDate field
ProgramList::const_iterator it = plist.begin();
for (; it != plist.end(); ++it)
{
ProgramInfo &p = **it;
if (p.GetRecordingStatus() == RecStatus::Conflict)
{
m_conflictDate = p.GetRecordingStartTime()
.toLocalTime().date();
break;
}
}
// TODO: This can be templated instead of hardcoding
// Conflict/No Conflict
QString cstring = tr("Conflict %1")
//.........这里部分代码省略.........
示例7: throw
DTC::ProgramGuide *Guide::GetProgramGuide( const QDateTime &rawStartTime ,
const QDateTime &rawEndTime ,
bool bDetails,
int nChannelGroupId,
int nStartIndex,
int nCount)
{
if (!rawStartTime.isValid())
throw( "StartTime is invalid" );
if (!rawEndTime.isValid())
throw( "EndTime is invalid" );
QDateTime dtStartTime = rawStartTime.toUTC();
QDateTime dtEndTime = rawEndTime.toUTC();
if (dtEndTime < dtStartTime)
throw( "EndTime is before StartTime");
if (nStartIndex <= 0)
nStartIndex = 0;
if (nCount <= 0)
nCount = 20000;
// ----------------------------------------------------------------------
// Load the channel list
// ----------------------------------------------------------------------
uint nTotalAvailable = 0;
ChannelInfoList chanList = ChannelUtil::LoadChannels(nStartIndex, nCount,
nTotalAvailable, true,
ChannelUtil::kChanOrderByChanNum,
ChannelUtil::kChanGroupByCallsign,
0,
nChannelGroupId);
// ----------------------------------------------------------------------
// Build SQL statement for Program Listing
// ----------------------------------------------------------------------
ProgramList schedList;
MSqlBindings bindings;
QString sWhere = "program.chanid = :CHANID "
"AND program.endtime >= :STARTDATE "
"AND program.starttime < :ENDDATE "
"AND program.starttime >= :STARTDATELIMIT "
"AND program.manualid = 0"; // Omit 'manual' recordings scheds
QString sGroupBy = "program.starttime, channel.channum,"
"channel.callsign, program.title";
QString sOrderBy = "program.starttime";
bindings[":STARTDATE" ] = dtStartTime;
bindings[":STARTDATELIMIT"] = dtStartTime.addDays(-1);
bindings[":ENDDATE" ] = dtEndTime;
// ----------------------------------------------------------------------
// Get all Pending Scheduled Programs
// ----------------------------------------------------------------------
// NOTE: Fetching this information directly from the schedule is
// significantly faster than using ProgramInfo::LoadFromScheduler()
Scheduler *scheduler = dynamic_cast<Scheduler*>(gCoreContext->GetScheduler());
if (scheduler)
scheduler->GetAllPending(schedList);
// ----------------------------------------------------------------------
// Build Response
// ----------------------------------------------------------------------
DTC::ProgramGuide *pGuide = new DTC::ProgramGuide();
ChannelInfoList::iterator chan_it;
for (chan_it = chanList.begin(); chan_it != chanList.end(); ++chan_it)
{
// Create ChannelInfo Object
DTC::ChannelInfo *pChannel = NULL;
pChannel = pGuide->AddNewChannel();
FillChannelInfo( pChannel, (*chan_it), bDetails );
// Load the list of programmes for this channel
ProgramList progList;
bindings[":CHANID"] = (*chan_it).chanid;
LoadFromProgram( progList, sWhere, sOrderBy, sOrderBy, bindings,
schedList );
// Create Program objects and add them to the channel object
ProgramList::iterator progIt;
for( progIt = progList.begin(); progIt != progList.end(); ++progIt)
{
DTC::Program *pProgram = pChannel->AddNewProgram();
FillProgramInfo( pProgram, *progIt, false, bDetails, false ); // No cast info
}
}
// ----------------------------------------------------------------------
//.........这里部分代码省略.........
示例8: doScheduleStatus
void StatusBox::doScheduleStatus()
{
if (m_iconState)
m_iconState->DisplayState("schedule");
m_logList->Reset();
QString helpmsg(tr("Schedule Status shows current statistics "
"from the scheduler."));
if (m_helpText)
m_helpText->SetText(helpmsg);
if (m_justHelpText)
m_justHelpText->SetText(helpmsg);
MSqlQuery query(MSqlQuery::InitCon());
query.prepare("SELECT COUNT(*) FROM record WHERE search = 0");
if (query.exec() && query.next())
{
QString rules = tr("%n standard rule(s) (is) defined", "",
query.value(0).toInt());
AddLogLine(rules, helpmsg);
}
else
{
MythDB::DBError("StatusBox::doScheduleStatus()", query);
return;
}
query.prepare("SELECT COUNT(*) FROM record WHERE search > 0");
if (query.exec() && query.next())
{
QString rules = tr("%n search rule(s) are defined", "",
query.value(0).toInt());
AddLogLine(rules, helpmsg);
}
else
{
MythDB::DBError("StatusBox::doScheduleStatus()", query);
return;
}
QMap<RecStatusType, int> statusMatch;
QMap<RecStatusType, QString> statusText;
QMap<int, int> sourceMatch;
QMap<int, QString> sourceText;
QMap<int, int> inputMatch;
QMap<int, QString> inputText;
QString tmpstr;
int maxSource = 0;
int maxInput = 0;
int lowerpriority = 0;
int hdflag = 0;
query.prepare("SELECT MAX(sourceid) FROM videosource");
if (query.exec())
{
if (query.next())
maxSource = query.value(0).toInt();
}
query.prepare("SELECT sourceid,name FROM videosource");
if (query.exec())
{
while (query.next())
sourceText[query.value(0).toInt()] = query.value(1).toString();
}
query.prepare("SELECT MAX(cardinputid) FROM cardinput");
if (query.exec())
{
if (query.next())
maxInput = query.value(0).toInt();
}
query.prepare("SELECT cardinputid,cardid,inputname,displayname "
"FROM cardinput");
if (query.exec())
{
while (query.next())
{
if (!query.value(3).toString().isEmpty())
inputText[query.value(0).toInt()] = query.value(3).toString();
else
inputText[query.value(0).toInt()] = QString("%1: %2")
.arg(query.value(1).toInt())
.arg(query.value(2).toString());
}
}
ProgramList schedList;
LoadFromScheduler(schedList);
tmpstr = tr("%n matching showing(s)", "", schedList.size());
AddLogLine(tmpstr, helpmsg);
ProgramList::const_iterator it = schedList.begin();
for (; it != schedList.end(); ++it)
{
const ProgramInfo *s = *it;
const RecStatusType recstatus = s->GetRecordingStatus();
//.........这里部分代码省略.........
示例9: getSelectedInstrument
void
MIDIInstrumentParameterPanel::updateProgramComboBox()
{
RG_DEBUG << "updateProgramComboBox()";
if (!getSelectedInstrument())
return;
MidiDevice *md =
dynamic_cast<MidiDevice *>(getSelectedInstrument()->getDevice());
if (!md) {
std::cerr << "WARNING: MIDIInstrumentParameterPanel::updateProgramComboBox(): No MidiDevice for Instrument " << getSelectedInstrument()->getId() << '\n';
return;
}
RG_DEBUG << "updateProgramComboBox(): variation type is " << md->getVariationType();
MidiBank bank = getSelectedInstrument()->getProgram().getBank();
ProgramList programs =
md->getPrograms0thVariation(getSelectedInstrument()->isPercussion(), bank);
// Remove the programs that have no name.
programs.erase(std::remove_if(programs.begin(), programs.end(),
MIDIInstrumentParameterPanel::hasNoName),
programs.end());
// If we've got programs, show the Program widgets.
// Why not "show = (programs.size()>1)"? Because that would hide the
// program checkbox which would take away the user's ability to
// enable/disable program changes. If we do away with the checkbox
// in the future, we should re-evaluate this decision.
bool show = !programs.empty();
m_programLabel->setVisible(show);
m_programCheckBox->setVisible(show);
m_programComboBox->setVisible(show);
int currentProgram = -1;
// Compute the current program.
for (unsigned i = 0; i < programs.size(); ++i) {
// If the program change is the same...
if (getSelectedInstrument()->getProgram().getProgram() == programs[i].getProgram()) {
currentProgram = i;
break;
}
}
// If the programs have changed, we need to repopulate the combobox.
if (!partialCompareWithName(programs, m_programs))
{
// Update the cache.
m_programs = programs;
// Copy from m_programs to m_programComboBox.
m_programComboBox->clear();
for (unsigned i = 0; i < m_programs.size(); ++i) {
m_programComboBox->addItem(QObject::tr("%1. %2")
.arg(m_programs[i].getProgram() + 1)
.arg(QObject::tr(m_programs[i].getName().c_str())));
}
}
m_programComboBox->setEnabled(getSelectedInstrument()->sendsProgramChange());
#if 0
// ??? This is a pretty nifty idea, but unfortunately, it requires
// that we maintain a bogus combobox entry. For now, we'll go
// with the simpler "unselected" approach.
// If the current program was not found...
if (currentProgram < 0 && !m_programs.empty()) {
// Format program change and add to combobox.
MidiByte programChange = getSelectedInstrument()->getProgram().getProgram();
m_programComboBox.addItem(QString::number(programChange + 1));
currentProgram = programs.size();
}
#endif
// Display the current program.
m_programComboBox->setCurrentIndex(currentProgram);
}