本文整理汇总了C++中MythUIButtonListItem::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ MythUIButtonListItem::GetData方法的具体用法?C++ MythUIButtonListItem::GetData怎么用?C++ MythUIButtonListItem::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythUIButtonListItem
的用法示例。
在下文中一共展示了MythUIButtonListItem::GetData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doGetRecording
void ImportFile::doGetRecording(void)
{
MythUIButtonListItem *item = m_recordingButtonList->GetItemCurrent();
if (!item)
return;
ImportItem *i = item->GetData().value<ImportItem *>();
if (!i)
return;
uint duration = 60; //i->actualDuration;
QString videoFile = getTempDirectory() + "work/video.ts";
QString mxmlFile = getTempDirectory() + "work/video.mxml";
// record the mp4 video stream
QString recCommand = QString("mythffmpeg -y -i %1 -t %2 -acodec copy -vcodec copy %3")
.arg(STREAMURL).arg(duration).arg(videoFile);
QScopedPointer<MythSystem> cmd(MythSystem::Create(recCommand, kMSRunShell));
cmd->Wait(0);
if (cmd.data()->GetExitCode() != GENERIC_EXIT_OK)
{
LOG(VB_GENERAL, LOG_ERR, QString("ERROR - ffmpeg exited with result: %1").arg(cmd.data()->GetExitCode()));
return;
}
// create a mxml file with the metadata for this recording
QStringList categories(i->category.split(','));
MetadataLookup *lookup = new MetadataLookup(kMetadataVideo, kProbableTelevision, QVariant(), kLookupSearch, false, false, false, false, false,
"", videoFile, i->title, categories, 0.0, i->subtitle, "", i->description, i->season, i->episode,
i->startTime, 0, i->chanNo, i->chanSign, i->chanName,
i->certification, i->startTime.date().year(), i->startTime.date(), i->duration / 60, i->duration,
"", PeopleMap(), "", ArtworkMap(), DownloadMap());
if (i->category == "Movies")
lookup->SetVideoContentType(kContentMovie);
else
lookup->SetVideoContentType(kContentTelevision);
QDomDocument mxmlDoc = CreateMetadataXML(lookup);
// save the mxml to the file
QFile f(mxmlFile);
if (!f.open(QIODevice::WriteOnly))
{
LOG(VB_GENERAL, LOG_ERR, QString("ImportFile: Failed to open mxml file for writing - %1").arg(mxmlFile));
return;
}
QTextStream t(&f);
t << mxmlDoc.toString(4);
f.close();
// workout where to save the file in the Video storage group
QString dstFile = filenameFromMetadataLookup(lookup);
QString saveFilename;
// copy the recording to the Video storage group
saveFilename = gCoreContext->GenMythURL(gCoreContext->GetMasterHostName(), 0, dstFile + ".mp4", "Videos");
bool result = RemoteFile::CopyFile(videoFile, saveFilename);
if (!result)
{
LOG(VB_GENERAL, LOG_ERR, QString("ImportFile: Failed to copy video file to %1").arg(saveFilename));
return;
}
// copy the metadata xml file to the Video storage group
saveFilename = gCoreContext->GenMythURL(gCoreContext->GetMasterHostName(), 0, dstFile + ".mxml", "Videos");
result = RemoteFile::CopyFile(mxmlFile, saveFilename);
if (!result)
{
LOG(VB_GENERAL, LOG_ERR, QString("ImportFile: Failed to copy xml file to %1").arg(saveFilename));
return;
}
}
示例2: updateTracksList
void SearchView::updateTracksList(void)
{
m_tracksList->Reset();
MythUIButtonListItem *item = m_fieldList->GetItemCurrent();
if (!item)
return;
QString searchStr = m_criteriaEdit->GetText();
int field = item->GetData().toInt();
QString sql;
MSqlQuery query(MSqlQuery::InitCon());
if (searchStr.isEmpty())
{
sql = "SELECT song_id "
"FROM music_songs ";
query.prepare(sql);
}
else
{
switch(field)
{
case 1: // artist
{
sql = "SELECT song_id "
"FROM music_songs "
"LEFT JOIN music_artists ON "
" music_songs.artist_id=music_artists.artist_id "
"WHERE music_artists.artist_name LIKE '%" + searchStr + "%' ";
query.prepare(sql);
break;
}
case 2: // album
{
sql = "SELECT song_id "
"FROM music_songs "
"LEFT JOIN music_albums ON music_songs.album_id=music_albums.album_id "
"WHERE music_albums.album_name LIKE '%" + searchStr + "%' ";
query.prepare(sql);
break;
}
case 3: // title
{
sql = "SELECT song_id "
"FROM music_songs "
"WHERE music_songs.name LIKE '%" + searchStr + "%' ";
query.prepare(sql);
break;
}
case 4: // genre
{
sql = "SELECT song_id "
"FROM music_songs "
"LEFT JOIN music_genres ON music_songs.genre_id=music_genres.genre_id "
"WHERE music_genres.genre LIKE '%" + searchStr + "%' ";
query.prepare(sql);
break;
}
case 5: // tags
{
//TODO add tag query
}
case 0: // all fields
default:
{
sql = "SELECT song_id "
"FROM music_songs "
"LEFT JOIN music_artists ON "
" music_songs.artist_id=music_artists.artist_id "
"LEFT JOIN music_albums ON music_songs.album_id=music_albums.album_id "
"LEFT JOIN music_artists AS music_comp_artists ON "
" music_albums.artist_id=music_comp_artists.artist_id "
"LEFT JOIN music_genres ON music_songs.genre_id=music_genres.genre_id "
"WHERE music_songs.name LIKE '%" + searchStr + "%' "
"OR music_artists.artist_name LIKE '%" + searchStr + "%' "
"OR music_albums.album_name LIKE '%" + searchStr + "%' "
"OR music_genres.genre LIKE '%" + searchStr + "%' ";
query.prepare(sql);
}
}
}
if (!query.exec() || !query.isActive())
{
MythDB::DBError("Search music database", query);
return;
}
while (query.next())
{
int trackid = query.value(0).toInt();
Metadata *mdata = gMusicData->all_music->getMetadata(trackid);
if (mdata)
{
//.........这里部分代码省略.........
示例3: customEvent
void SearchView::customEvent(QEvent *event)
{
bool handled = false;
if (event->type() == MusicPlayerEvent::TrackRemovedEvent ||
event->type() == MusicPlayerEvent::TrackAddedEvent)
{
MusicPlayerEvent *mpe = dynamic_cast<MusicPlayerEvent *>(event);
if (!mpe)
return;
int trackID = mpe->TrackID;
for (int x = 0; x < m_tracksList->GetCount(); x++)
{
MythUIButtonListItem *item = m_tracksList->GetItemAt(x);
MusicMetadata *mdata = item->GetData().value<MusicMetadata*>();
if (mdata && (mdata->ID() == (MusicMetadata::IdType) trackID || trackID == -1))
{
if (gPlayer->getCurrentPlaylist() && gPlayer->getCurrentPlaylist()->checkTrack(mdata->ID()))
item->DisplayState("on", "selectedstate");
else
item->DisplayState("off", "selectedstate");
}
}
// call the default handler in MusicCommon so the playlist and UI is updated
MusicCommon::customEvent(event);
handled = true;
if (m_playTrack)
{
m_playTrack = false;
if (event->type() == MusicPlayerEvent::TrackAddedEvent)
{
// make the added track current and play it
m_currentPlaylist->SetItemCurrent(m_currentPlaylist->GetCount() - 1);
playlistItemClicked(m_currentPlaylist->GetItemCurrent());
}
}
}
else if (event->type() == MusicPlayerEvent::AllTracksRemovedEvent)
{
for (int x = 0; x < m_tracksList->GetCount(); x++)
{
MythUIButtonListItem *item = m_tracksList->GetItemAt(x);
if (item)
item->DisplayState("off", "selectedstate");
}
}
else if (event->type() == MusicPlayerEvent::MetadataChangedEvent)
{
MusicPlayerEvent *mpe = dynamic_cast<MusicPlayerEvent *>(event);
if (!mpe)
return;
uint trackID = mpe->TrackID;
for (int x = 0; x < m_tracksList->GetCount(); x++)
{
MythUIButtonListItem *item = m_tracksList->GetItemAt(x);
MusicMetadata *mdata = item->GetData().value<MusicMetadata*>();
if (mdata && mdata->ID() == trackID)
{
InfoMap metadataMap;
mdata->toMap(metadataMap);
item->SetTextFromMap(metadataMap);
}
}
// if (trackID == gPlayer->getCurrentMetadata()->ID())
// updateTrackInfo(gPlayer->getCurrentMetadata());
}
else if (event->type() == DialogCompletionEvent::kEventType)
{
DialogCompletionEvent *dce = static_cast<DialogCompletionEvent *>(event);
// make sure the user didn't ESCAPE out of the menu
if (dce->GetResult() < 0)
return;
QString resultid = dce->GetId();
QString resulttext = dce->GetResultText();
if (resultid == "searchviewmenu")
{
if (resulttext == tr("Add To Playlist") || resulttext == tr("Remove From Playlist"))
{
if (GetFocusWidget() == m_tracksList)
{
MythUIButtonListItem *item = m_tracksList->GetItemCurrent();
if (item)
{
m_playTrack = false;
trackClicked(item);
}
}
}
//.........这里部分代码省略.........
示例4: LoadList
void ViewScheduled::LoadList(bool useExistingData)
{
if (m_inFill)
return;
m_inFill = true;
MythUIButtonListItem *currentItem = m_schedulesList->GetItemCurrent();
QString callsign;
QDateTime startts, recstartts;
if (currentItem)
{
ProgramInfo *currentpginfo = qVariantValue<ProgramInfo*>
(currentItem->GetData());
if (currentpginfo)
{
callsign = currentpginfo->GetChannelSchedulingID();
startts = currentpginfo->GetScheduledStartTime();
recstartts = currentpginfo->GetRecordingStartTime();
}
}
QDateTime now = QDateTime::currentDateTime();
QMap<int, int> toomanycounts;
m_schedulesList->Reset();
if (m_groupList)
m_groupList->Reset();
m_recgroupList.clear();
if (!useExistingData)
LoadFromScheduler(m_recList, m_conflictBool);
ProgramList::iterator pit = m_recList.begin();
QString currentDate;
m_recgroupList[m_defaultGroup] = ProgramList(false);
m_recgroupList[m_defaultGroup].setAutoDelete(false);
while (pit != m_recList.end())
{
ProgramInfo *pginfo = *pit;
const RecStatusType recstatus = pginfo->GetRecordingStatus();
if ((pginfo->GetRecordingEndTime() >= now ||
pginfo->GetScheduledEndTime() >= now) &&
(m_showAll ||
recstatus <= rsWillRecord ||
recstatus == rsDontRecord ||
(recstatus == rsTooManyRecordings &&
++toomanycounts[pginfo->GetRecordingRuleID()] <= 1) ||
(recstatus > rsTooManyRecordings &&
recstatus != rsRepeat &&
recstatus != rsNeverRecord)))
{
m_cardref[pginfo->GetCardID()]++;
if (pginfo->GetCardID() > m_maxcard)
m_maxcard = pginfo->GetCardID();
m_inputref[pginfo->GetInputID()]++;
if (pginfo->GetInputID() > m_maxinput)
m_maxinput = pginfo->GetInputID();
QDate date = (pginfo->GetRecordingStartTime()).date();
m_recgroupList[date].push_back(pginfo);
m_recgroupList[date].setAutoDelete(false);
m_recgroupList[m_defaultGroup].push_back(pginfo);
++pit;
}
else
{
pit = m_recList.erase(pit);
continue;
}
}
if (m_groupList)
{
QString label;
QMap<QDate,ProgramList>::iterator dateit = m_recgroupList.begin();
while (dateit != m_recgroupList.end())
{
if (dateit.key().isNull())
label = tr("All");
else
label = MythDateToString(dateit.key(), kDateFull | kSimplify);
new MythUIButtonListItem(m_groupList, label,
qVariantFromValue(dateit.key()));
++dateit;
}
if (!m_recgroupList.contains(m_currentGroup))
m_groupList->SetValueByData(qVariantFromValue(m_currentGroup));
}
FillList();
//.........这里部分代码省略.........
示例5: showPopupMenu
void ThemeChooser::showPopupMenu(void)
{
if (m_popupMenu)
return;
MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
QString label = tr("Theme Chooser Menu");
m_popupMenu =
new MythDialogBox(label, popupStack, "themechoosermenupopup");
connect(m_popupMenu, SIGNAL(Closed(QString, int)), SLOT(popupClosed(QString, int)));
if (m_popupMenu->Create())
popupStack->AddScreen(m_popupMenu);
else
{
delete m_popupMenu;
m_popupMenu = NULL;
return;
}
m_popupMenu->SetReturnEvent(this, "popupmenu");
if (m_fullPreviewStateType)
{
if (m_fullPreviewShowing)
m_popupMenu->AddButton(tr("Hide Fullscreen Preview"),
SLOT(toggleFullscreenPreview()));
else
m_popupMenu->AddButton(tr("Show Fullscreen Preview"),
SLOT(toggleFullscreenPreview()));
}
m_popupMenu->AddButton(tr("Refresh Downloadable Themes"),
SLOT(refreshDownloadableThemes()));
MythUIButtonListItem *current = m_themes->GetItemCurrent();
if (current)
{
ThemeInfo *info = qVariantValue<ThemeInfo *>(current->GetData());
if (info)
{
m_popupMenu->AddButton(tr("Select Theme"),
SLOT(saveAndReload()));
QString themeDir = GetConfDir() + "/themes/";
if (info->GetPreviewPath().startsWith(themeDir))
m_popupMenu->AddButton(tr("Delete Theme"),
SLOT(removeTheme()));
}
}
if (gCoreContext->GetNumSetting("ThemeUpdateNofications", 1))
m_popupMenu->AddButton(tr("Disable Theme Update Notifications"),
SLOT(toggleThemeUpdateNotifications()));
else
m_popupMenu->AddButton(tr("Enable Theme Update Notifications"),
SLOT(toggleThemeUpdateNotifications()));
}
示例6: createConfigFile
void MythBurn::createConfigFile(const QString &filename)
{
QDomDocument doc("mythburn");
QDomElement root = doc.createElement("mythburn");
doc.appendChild(root);
QDomElement job = doc.createElement("job");
job.setAttribute("theme", m_theme);
root.appendChild(job);
QDomElement media = doc.createElement("media");
job.appendChild(media);
// now loop though selected archive items and add them to the xml file
ArchiveItem *a;
MythUIButtonListItem *item;
for (int x = 0; x < m_archiveButtonList->GetCount(); x++)
{
item = m_archiveButtonList->GetItemAt(x);
if (!item)
continue;
a = qVariantValue<ArchiveItem *>(item->GetData());
if (!a)
continue;
QDomElement file = doc.createElement("file");
file.setAttribute("type", a->type.toLower() );
file.setAttribute("usecutlist", a->useCutlist);
file.setAttribute("filename", a->filename);
file.setAttribute("encodingprofile", a->encoderProfile->name);
if (a->editedDetails)
{
QDomElement details = doc.createElement("details");
file.appendChild(details);
details.setAttribute("title", a->title);
details.setAttribute("subtitle", a->subtitle);
details.setAttribute("startdate", a->startDate);
details.setAttribute("starttime", a->startTime);
QDomText desc = doc.createTextNode(a->description);
details.appendChild(desc);
}
if (a->thumbList.size() > 0)
{
QDomElement thumbs = doc.createElement("thumbimages");
file.appendChild(thumbs);
for (int x = 0; x < a->thumbList.size(); x++)
{
QDomElement thumb = doc.createElement("thumb");
thumbs.appendChild(thumb);
ThumbImage *thumbImage = a->thumbList.at(x);
thumb.setAttribute("caption", thumbImage->caption);
thumb.setAttribute("filename", thumbImage->filename);
thumb.setAttribute("frame", (int) thumbImage->frame);
}
}
media.appendChild(file);
}
// add the options to the xml file
QDomElement options = doc.createElement("options");
options.setAttribute("createiso", m_bCreateISO);
options.setAttribute("doburn", m_bDoBurn);
options.setAttribute("mediatype", m_archiveDestination.type);
options.setAttribute("dvdrsize", (qint64)m_archiveDestination.freeSpace);
options.setAttribute("erasedvdrw", m_bEraseDvdRw);
options.setAttribute("savefilename", m_saveFilename);
job.appendChild(options);
// finally save the xml to the file
QFile f(filename);
if (!f.open(QIODevice::WriteOnly))
{
LOG(VB_GENERAL, LOG_ERR,
QString("MythBurn::createConfigFile: "
"Failed to open file for writing - %1") .arg(filename));
return;
}
QTextStream t(&f);
t << doc.toString(4);
f.close();
}
示例7: customEvent
//.........这里部分代码省略.........
}
else if (event->type() == OutputEvent::Buffering)
{
}
else if (event->type() == MythEvent::MythEventMessage)
{
MythEvent *me = (MythEvent *)event;
QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts);
if (tokens.isEmpty())
return;
if (tokens[0] == "DOWNLOAD_FILE")
{
QStringList args = me->ExtraDataList();
if (tokens[1] == "UPDATE")
{
}
else if (tokens[1] == "FINISHED")
{
QString url = args[0];
int fileSize = args[2].toInt();
int errorCode = args[4].toInt();
QString filename = args[1];
if ((errorCode != 0) || (fileSize == 0))
LOG(VB_GENERAL, LOG_ERR, QString("StreamView: failed to download radio icon from '%1'").arg(url));
else
{
for (int x = 0; x < m_streamList->GetCount(); x++)
{
MythUIButtonListItem *item = m_streamList->GetItemAt(x);
Metadata *mdata = qVariantValue<Metadata*> (item->GetData());
if (mdata && mdata->LogoUrl() == url)
item->SetImage(filename);
}
}
}
}
}
else if (event->type() == DecoderHandlerEvent::OperationStart)
{
DecoderHandlerEvent *dhe = dynamic_cast<DecoderHandlerEvent*>(event);
if (!dhe)
return;
if (dhe->getMessage() && m_bufferStatus)
{
m_bufferStatus->SetText(*dhe->getMessage());
}
}
else if (event->type() == DecoderHandlerEvent::BufferStatus)
{
DecoderHandlerEvent *dhe = dynamic_cast<DecoderHandlerEvent*>(event);
if (!dhe)
return;
int available, maxSize;
dhe->getBufferStatus(&available, &maxSize);
if (m_bufferStatus)
{
QString status = QString("%1%").arg((int)(100.0 / ((double)maxSize / (double)available)));
m_bufferStatus->SetText(status);
}