本文整理汇总了C++中MythEvent::ExtraDataCount方法的典型用法代码示例。如果您正苦于以下问题:C++ MythEvent::ExtraDataCount方法的具体用法?C++ MythEvent::ExtraDataCount怎么用?C++ MythEvent::ExtraDataCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythEvent
的用法示例。
在下文中一共展示了MythEvent::ExtraDataCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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;
}