本文整理汇总了C++中MythEvent::ExtraData方法的典型用法代码示例。如果您正苦于以下问题:C++ MythEvent::ExtraData方法的具体用法?C++ MythEvent::ExtraData怎么用?C++ MythEvent::ExtraData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythEvent
的用法示例。
在下文中一共展示了MythEvent::ExtraData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: customEvent
void BackendSelection::customEvent(QEvent *event)
{
if (((MythEvent::Type)(event->type())) == MythEvent::MythEventMessage)
{
MythEvent *me = (MythEvent *)event;
QString message = me->Message();
QString URI = me->ExtraData(0);
QString URN = me->ExtraData(1);
QString URL = me->ExtraData(2);
VERBOSE(VB_UPNP, QString("BackendSelection::customEvent(%1, %2, %3, %4)")
.arg(message).arg(URI).arg(URN).arg(URL));
if (message.startsWith("SSDP_ADD") &&
URI.startsWith("urn:schemas-mythtv-org:device:MasterMediaServer:"))
{
DeviceLocation *devLoc = SSDP::Instance()->Find(URI, URN);
if (devLoc)
{
devLoc->AddRef();
AddItem(devLoc); // this does a Release()
}
}
else if (message.startsWith("SSDP_REMOVE"))
{
//-=>Note: This code will never get executed until
// SSDPCache is changed to handle NotifyRemove correctly
RemoveItem(URN);
}
}
else if (event->type() == DialogCompletionEvent::kEventType)
{
DialogCompletionEvent *dce = dynamic_cast<DialogCompletionEvent*>(event);
if (!dce)
return;
QString resultid = dce->GetId();
if (resultid == "password")
{
m_pinCode = dce->GetResultText();
Accept();
}
}
}
示例2: event
bool ProcessThread::event(QEvent *e)
{
if (MythEvent::MythEventMessage == e->type())
{
MythEvent *me = static_cast<MythEvent*>(e);
if (me->Message() == "CreateProcess")
{
QMutexLocker locker(&m_lock);
m_proc = new QProcess();
m_proc->start(me->ExtraData(0));
m_wait.wakeOne();
return true;
}
}
return QThread::event(e);
}
示例3: event
bool MythContextPrivate::event(QEvent *e)
{
if (e->type() == (QEvent::Type) MythEvent::MythEventMessage)
{
if (disableeventpopup)
return true;
MythEvent *me = (MythEvent*)e;
if (me->Message() == "VERSION_MISMATCH" && (1 == me->ExtraDataCount()))
ShowVersionMismatchPopup(me->ExtraData(0).toUInt());
else if (me->Message() == "CONNECTION_FAILURE")
ShowConnectionFailurePopup(false);
else if (me->Message() == "PERSISTENT_CONNECTION_FAILURE")
ShowConnectionFailurePopup(true);
else if (me->Message() == "CONNECTION_RESTABLISHED")
HideConnectionFailurePopup();
return true;
}
return QObject::event(e);
}
示例4: event
bool PreviewGeneratorQueue::event(QEvent *e)
{
if (e->type() != (QEvent::Type) MythEvent::MythEventMessage)
return QObject::event(e);
MythEvent *me = (MythEvent*)e;
if (me->Message() == "GET_PREVIEW")
{
const QStringList list = me->ExtraDataList();
QStringList::const_iterator it = list.begin();
ProgramInfo evinfo(it, list.end());
QString token;
QSize outputsize;
QString outputfile;
long long time = -1LL;
bool time_fmt_sec;
if (it != list.end())
token = (*it++);
if (it != list.end())
outputsize.setWidth((*it++).toInt());
if (it != list.end())
outputsize.setHeight((*it++).toInt());
if (it != list.end())
outputfile = (*it++);
if (it != list.end())
time = (*it++).toLongLong();
QString fn;
if (it != list.end())
{
time_fmt_sec = (*it++).toInt() != 0;
fn = GeneratePreviewImage(evinfo, outputsize, outputfile,
time, time_fmt_sec, token);
}
return true;
}
else if (me->Message() == "PREVIEW_SUCCESS" ||
me->Message() == "PREVIEW_FAILED")
{
QString pginfokey = me->ExtraData(0); // pginfo->MakeUniqueKey()
QString filename = me->ExtraData(1); // outFileName
QString msg = me->ExtraData(2);
QString datetime = me->ExtraData(3);
QString token = me->ExtraData(4);
{
QMutexLocker locker(&m_lock);
QMap<QString,QString>::iterator kit = m_tokenToKeyMap.find(token);
if (kit == m_tokenToKeyMap.end())
{
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Failed to find token %1 in map.").arg(token));
return true;
}
PreviewMap::iterator it = m_previewMap.find(*kit);
if (it == m_previewMap.end())
{
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Failed to find key %1 in map.").arg(*kit));
return true;
}
if ((*it).gen)
(*it).gen->deleteLater();
(*it).gen = NULL;
(*it).genStarted = false;
if (me->Message() == "PREVIEW_SUCCESS")
{
(*it).attempts = 0;
(*it).lastBlockTime = 0;
(*it).blockRetryUntil = QDateTime();
}
else
{
(*it).lastBlockTime =
max(m_minBlockSeconds, (*it).lastBlockTime * 2);
(*it).blockRetryUntil =
MythDate::current().addSecs((*it).lastBlockTime);
}
QStringList list;
list.push_back(pginfokey);
list.push_back(filename);
list.push_back(msg);
list.push_back(datetime);
QSet<QString>::const_iterator tit = (*it).tokens.begin();
for (; tit != (*it).tokens.end(); ++tit)
{
kit = m_tokenToKeyMap.find(*tit);
if (kit != m_tokenToKeyMap.end())
m_tokenToKeyMap.erase(kit);
list.push_back(*tit);
}
if (list.size() > 4)
{
QSet<QObject*>::iterator sit = m_listeners.begin();
for (; sit != m_listeners.end(); ++sit)
{
MythEvent *e = new MythEvent(me->Message(), list);
QCoreApplication::postEvent(*sit, e);
//.........这里部分代码省略.........
示例5: event
bool PreviewGenerator::event(QEvent *e)
{
if (e->type() != (QEvent::Type) MythEvent::MythEventMessage)
return QObject::event(e);
MythEvent *me = (MythEvent*)e;
if (me->Message() != "GENERATED_PIXMAP" || me->ExtraDataCount() < 3)
return QObject::event(e);
bool ok = me->ExtraData(0) == "OK";
bool ours = false;
uint i = ok ? 4 : 3;
for (; i < (uint) me->ExtraDataCount() && !ours; i++)
ours |= me->ExtraData(i) == token;
if (!ours)
return false;
QString pginfokey = me->ExtraData(1);
QMutexLocker locker(&previewLock);
gotReply = true;
pixmapOk = ok;
if (!ok)
{
LOG(VB_GENERAL, LOG_ERR, LOC + pginfokey + ": " + me->ExtraData(2));
previewWaitCondition.wakeAll();
return true;
}
if (me->ExtraDataCount() < 5)
{
pixmapOk = false;
previewWaitCondition.wakeAll();
return true; // could only happen with very broken client...
}
QDateTime datetime = QDateTime::fromString(me->ExtraData(3), Qt::ISODate);
if (!datetime.isValid())
{
pixmapOk = false;
LOG(VB_GENERAL, LOG_ERR, LOC + pginfokey + "Got invalid date");
previewWaitCondition.wakeAll();
return false;
}
size_t length = me->ExtraData(4).toULongLong();
quint16 checksum16 = me->ExtraData(5).toUInt();
QByteArray data = QByteArray::fromBase64(me->ExtraData(6).toAscii());
if ((size_t) data.size() < length)
{ // (note data.size() may be up to 3
// bytes longer after decoding
LOG(VB_GENERAL, LOG_ERR, LOC +
QString("Preview size check failed %1 < %2")
.arg(data.size()).arg(length));
data.clear();
}
data.resize(length);
if (checksum16 != qChecksum(data.constData(), data.size()))
{
LOG(VB_GENERAL, LOG_ERR, LOC + "Preview checksum failed");
data.clear();
}
pixmapOk = (data.isEmpty()) ? false : SaveOutFile(data, datetime);
previewWaitCondition.wakeAll();
return true;
}