当前位置: 首页>>代码示例>>C++>>正文


C++ MythEvent::ExtraData方法代码示例

本文整理汇总了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();
        }
    }
}
开发者ID:DocOnDev,项目名称:mythtv,代码行数:48,代码来源:backendselect.cpp

示例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);
}
开发者ID:bwarden,项目名称:mythtv,代码行数:17,代码来源:channelbase.cpp

示例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);
}
开发者ID:bwarden,项目名称:mythtv,代码行数:21,代码来源:mythcontext.cpp

示例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);
//.........这里部分代码省略.........
开发者ID:Olti,项目名称:mythtv,代码行数:101,代码来源:previewgeneratorqueue.cpp

示例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;
}
开发者ID:Openivo,项目名称:mythtv,代码行数:70,代码来源:previewgenerator.cpp


注:本文中的MythEvent::ExtraData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。