本文整理汇总了C++中MetadataLookupList::takeFirst方法的典型用法代码示例。如果您正苦于以下问题:C++ MetadataLookupList::takeFirst方法的具体用法?C++ MetadataLookupList::takeFirst怎么用?C++ MetadataLookupList::takeFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataLookupList
的用法示例。
在下文中一共展示了MetadataLookupList::takeFirst方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: customEvent
void MetadataFactory::customEvent(QEvent *levent)
{
if (levent->type() == MetadataLookupEvent::kEventType)
{
MetadataLookupEvent *lue = (MetadataLookupEvent *)levent;
MetadataLookupList lul = lue->lookupList;
if (lul.isEmpty())
return;
if (m_sync)
{
m_returnList = lul;
}
else if (lul.count() == 1)
{
OnSingleResult(lul.takeFirst());
}
else
{
OnMultiResult(lul);
}
}
else if (levent->type() == MetadataLookupFailure::kEventType)
{
MetadataLookupFailure *luf = (MetadataLookupFailure *)levent;
MetadataLookupList lul = luf->lookupList;
if (lul.isEmpty())
return;
if (m_sync)
{
m_returnList = MetadataLookupList();
m_sync = false;
}
if (lul.size())
{
OnNoResult(lul.takeFirst());
}
}
else if (levent->type() == ImageDLEvent::kEventType)
{
ImageDLEvent *ide = (ImageDLEvent *)levent;
MetadataLookup *lookup = ide->item;
if (!lookup)
return;
if (m_scanning)
OnVideoResult(lookup);
else
OnImageResult(lookup);
}
else if (levent->type() == VideoScanChanges::kEventType)
{
VideoScanChanges *vsc = (VideoScanChanges *)levent;
if (!vsc)
return;
QList<int> additions = vsc->additions;
QList<int> moves = vsc->moved;
QList<int> deletions = vsc->deleted;
if (!m_scanning)
{
LOG(VB_GENERAL, LOG_INFO,
QString("Video Scan Complete: a(%1) m(%2) d(%3)")
.arg(additions.count()).arg(moves.count())
.arg(deletions.count()));
if (m_parent)
QCoreApplication::postEvent(m_parent,
new MetadataFactoryVideoChanges(additions, moves,
deletions));
}
else
{
LOG(VB_GENERAL, LOG_INFO,
QString("Video Scan Complete: a(%1) m(%2) d(%3)")
.arg(additions.count()).arg(moves.count())
.arg(deletions.count()));
VideoMetadataListManager::metadata_list ml;
VideoMetadataListManager::loadAllFromDatabase(ml);
m_mlm->setList(ml);
for (QList<int>::const_iterator it = additions.begin();
it != additions.end(); ++it)
{
VideoMetadata *metadata = m_mlm->byID(*it).get();
if (metadata);
Lookup(metadata, true, true);
}
}
//.........这里部分代码省略.........
示例2: run
void MetadataDownload::run()
{
RunProlog();
MetadataLookup* lookup;
while ((lookup = moreWork()) != NULL)
{
MetadataLookupList list;
// Go go gadget Metadata Lookup
if (lookup->GetType() == kMetadataVideo)
{
if (lookup->GetSubtype() == kProbableTelevision)
list = handleTelevision(lookup);
else if (lookup->GetSubtype() == kProbableMovie)
list = handleMovie(lookup);
else
list = handleVideoUndetermined(lookup);
if (!list.size() &&
lookup->GetSubtype() == kUnknownVideo)
{
list = handleMovie(lookup);
}
}
else if (lookup->GetType() == kMetadataRecording)
{
if (lookup->GetSubtype() == kProbableTelevision)
{
if (lookup->GetSeason() > 0 || lookup->GetEpisode() > 0)
list = handleTelevision(lookup);
else if (!lookup->GetSubtitle().isEmpty())
list = handleVideoUndetermined(lookup);
if (!list.size())
list = handleRecordingGeneric(lookup);
}
else if (lookup->GetSubtype() == kProbableMovie)
{
list = handleMovie(lookup);
if (lookup->GetInetref().isEmpty())
list.append(handleRecordingGeneric(lookup));
}
else
{
list = handleRecordingGeneric(lookup);
if (lookup->GetInetref().isEmpty())
list.append(handleMovie(lookup));
}
}
else if (lookup->GetType() == kMetadataGame)
list = handleGame(lookup);
// inform parent we have lookup ready for it
if (m_parent && list.count() >= 1)
{
// If there's only one result, don't bother asking
// our parent about it, just add it to the back of
// the queue in kLookupData mode.
if (list.count() == 1 && list.at(0)->GetStep() == kLookupSearch)
{
MetadataLookup *newlookup = list.takeFirst();
newlookup->SetStep(kLookupData);
prependLookup(newlookup);
continue;
}
// If we're in automatic mode, we need to make
// these decisions on our own. Pass to title match.
if (list.at(0)->GetAutomatic() && list.count() > 1)
{
if (!findBestMatch(list, lookup->GetTitle()))
QCoreApplication::postEvent(m_parent,
new MetadataLookupFailure(MetadataLookupList() << lookup));
continue;
}
LOG(VB_GENERAL, LOG_INFO,
QString("Returning Metadata Results: %1 %2 %3")
.arg(lookup->GetTitle()).arg(lookup->GetSeason())
.arg(lookup->GetEpisode()));
QCoreApplication::postEvent(m_parent,
new MetadataLookupEvent(list));
}
else
{
list.append(lookup);
QCoreApplication::postEvent(m_parent,
new MetadataLookupFailure(list));
}
}
RunEpilog();
}
示例3: customEvent
void LookerUpper::customEvent(QEvent *levent)
{
if (levent->type() == MetadataFactoryMultiResult::kEventType)
{
MetadataFactoryMultiResult *mfmr = dynamic_cast<MetadataFactoryMultiResult*>(levent);
if (!mfmr)
return;
MetadataLookupList list = mfmr->results;
if (list.count() > 1)
{
int yearindex = -1;
for (int p = 0; p != list.size(); ++p)
{
ProgramInfo *pginfo = qVariantValue<ProgramInfo *>(list[p]->GetData());
if (pginfo && !pginfo->GetSeriesID().isEmpty() &&
pginfo->GetSeriesID() == (list[p])->GetTMSref())
{
MetadataLookup *lookup = list.takeAt(p);
if (!lookup->GetSubtype() == kProbableGenericTelevision)
pginfo->SaveSeasonEpisode(lookup->GetSeason(), lookup->GetEpisode());
pginfo->SaveInetRef(lookup->GetInetref());
m_busyRecList.removeAll(pginfo);
qDeleteAll(list);
return;
}
else if (pginfo && pginfo->GetYearOfInitialRelease() != 0 &&
(list[p])->GetYear() != 0 &&
pginfo->GetYearOfInitialRelease() == (list[p])->GetYear())
{
if (yearindex != -1)
{
LOG(VB_GENERAL, LOG_INFO, "Multiple results matched on year. No definite "
"match could be found.");
m_busyRecList.removeAll(pginfo);
qDeleteAll(list);
return;
}
else
{
LOG(VB_GENERAL, LOG_INFO, "Matched from multiple results based on year. ");
yearindex = p;
}
}
}
if (yearindex > -1)
{
MetadataLookup *lookup = list.takeAt(yearindex);
ProgramInfo *pginfo = qVariantValue<ProgramInfo *>(lookup->GetData());
if (!lookup->GetSubtype() == kProbableGenericTelevision)
pginfo->SaveSeasonEpisode(lookup->GetSeason(), lookup->GetEpisode());
pginfo->SaveInetRef(lookup->GetInetref());
m_busyRecList.removeAll(pginfo);
qDeleteAll(list);
return;
}
LOG(VB_GENERAL, LOG_INFO, "Unable to match this title, too many possible matches. "
"You may wish to manually set the season, episode, and "
"inetref in the 'Watch Recordings' screen.");
ProgramInfo *pginfo = qVariantValue<ProgramInfo *>(list.takeFirst()->GetData());
qDeleteAll(list);
if (pginfo)
{
m_busyRecList.removeAll(pginfo);
}
}
}
else if (levent->type() == MetadataFactorySingleResult::kEventType)
{
MetadataFactorySingleResult *mfsr =
dynamic_cast<MetadataFactorySingleResult*>(levent);
if (!mfsr)
return;
MetadataLookup *lookup = mfsr->result;
if (!lookup)
return;
ProgramInfo *pginfo = qVariantValue<ProgramInfo *>(lookup->GetData());
// This null check could hang us as this pginfo would then never be
// removed
if (!pginfo)
return;
LOG(VB_GENERAL, LOG_DEBUG, "I found the following data:");
LOG(VB_GENERAL, LOG_DEBUG,
QString(" Input Title: %1").arg(pginfo->GetTitle()));
LOG(VB_GENERAL, LOG_DEBUG,
//.........这里部分代码省略.........
示例4: customEvent
void GameUI::customEvent(QEvent *event)
{
if (event->type() == DialogCompletionEvent::kEventType)
{
DialogCompletionEvent *dce = (DialogCompletionEvent*)(event);
QString resultid = dce->GetId();
QString resulttext = dce->GetResultText();
if (resultid == "showMenuPopup")
{
if (resulttext == tr("Edit Details"))
{
edit();
}
if (resulttext == tr("Scan For Changes"))
{
doScan();
}
else if (resulttext == tr("Show Information"))
{
showInfo();
}
else if (resulttext == tr("Make Favorite") ||
resulttext == tr("Remove Favorite"))
{
toggleFavorite();
}
else if (resulttext == tr("Retrieve Details"))
{
gameSearch();
}
}
else if (resultid == "chooseSystemPopup")
{
if (!resulttext.isEmpty() && resulttext != tr("Cancel"))
{
MythGenericTree *node = m_gameUITree->GetCurrentNode();
RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData());
GameHandler::Launchgame(romInfo, resulttext);
}
}
else if (resultid == "editMetadata")
{
MythGenericTree *node = m_gameUITree->GetCurrentNode();
RomInfo *oldRomInfo = qVariantValue<RomInfo *>(node->GetData());
delete oldRomInfo;
RomInfo *romInfo = qVariantValue<RomInfo *>(dce->GetData());
node->SetData(qVariantFromValue(romInfo));
node->SetText(romInfo->Gamename());
romInfo->SaveToDatabase();
updateChangedNode(node, romInfo);
}
else if (resultid == "detailsPopup")
{
// Play button pushed
itemClicked(0);
}
}
if (event->type() == MetadataLookupEvent::kEventType)
{
MetadataLookupEvent *lue = (MetadataLookupEvent *)event;
MetadataLookupList lul = lue->lookupList;
if (m_busyPopup)
{
m_busyPopup->Close();
m_busyPopup = NULL;
}
if (lul.isEmpty())
return;
if (lul.count() == 1)
{
OnGameSearchDone(lul.takeFirst());
}
else
{
MetadataResultsDialog *resultsdialog =
new MetadataResultsDialog(m_popupStack, lul);
connect(resultsdialog, SIGNAL(haveResult(MetadataLookup*)),
SLOT(OnGameSearchListSelection(MetadataLookup*)),
Qt::QueuedConnection);
if (resultsdialog->Create())
m_popupStack->AddScreen(resultsdialog);
}
}
else if (event->type() == MetadataLookupFailure::kEventType)
{
MetadataLookupFailure *luf = (MetadataLookupFailure *)event;
MetadataLookupList lul = luf->lookupList;
if (m_busyPopup)
//.........这里部分代码省略.........