本文整理汇总了C++中RomInfo::SaveToDatabase方法的典型用法代码示例。如果您正苦于以下问题:C++ RomInfo::SaveToDatabase方法的具体用法?C++ RomInfo::SaveToDatabase怎么用?C++ RomInfo::SaveToDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RomInfo
的用法示例。
在下文中一共展示了RomInfo::SaveToDatabase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnGameSearchDone
void GameUI::OnGameSearchDone(MetadataLookup *lookup)
{
if (m_busyPopup)
{
m_busyPopup->Close();
m_busyPopup = NULL;
}
if (!lookup)
return;
MythGenericTree *node = qVariantValue<MythGenericTree *>(lookup->GetData());
if (!node)
return;
RomInfo *metadata = qVariantValue<RomInfo *>(node->GetData());
if (!metadata)
return;
metadata->setGamename(lookup->GetTitle());
metadata->setYear(QString::number(lookup->GetYear()));
metadata->setPlot(lookup->GetDescription());
metadata->setSystem(lookup->GetSystem());
QStringList coverart, fanart, screenshot;
// Imagery
ArtworkList coverartlist = lookup->GetArtwork(kArtworkCoverart);
for (ArtworkList::const_iterator p = coverartlist.begin();
p != coverartlist.end(); ++p)
{
coverart.prepend((*p).url);
}
ArtworkList fanartlist = lookup->GetArtwork(kArtworkFanart);
for (ArtworkList::const_iterator p = fanartlist.begin();
p != fanartlist.end(); ++p)
{
fanart.prepend((*p).url);
}
ArtworkList screenshotlist = lookup->GetArtwork(kArtworkScreenshot);
for (ArtworkList::const_iterator p = screenshotlist.begin();
p != screenshotlist.end(); ++p)
{
screenshot.prepend((*p).url);
}
StartGameImageSet(node, coverart, fanart, screenshot);
metadata->SaveToDatabase();
updateChangedNode(node, metadata);
}
示例2: handleDownloadedImages
void GameUI::handleDownloadedImages(MetadataLookup *lookup)
{
if (!lookup)
return;
MythGenericTree *node = qVariantValue<MythGenericTree *>(lookup->GetData());
if (!node)
return;
RomInfo *metadata = qVariantValue<RomInfo *>(node->GetData());
if (!metadata)
return;
DownloadMap downloads = lookup->GetDownloads();
if (downloads.isEmpty())
return;
for (DownloadMap::iterator i = downloads.begin();
i != downloads.end(); ++i)
{
VideoArtworkType type = i.key();
ArtworkInfo info = i.value();
QString filename = info.url;
if (type == kArtworkCoverart)
metadata->setBoxart(filename);
else if (type == kArtworkFanart)
metadata->setFanart(filename);
else if (type == kArtworkScreenshot)
metadata->setScreenshot(filename);
}
metadata->SaveToDatabase();
updateChangedNode(node, metadata);
}
示例3: 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)
//.........这里部分代码省略.........