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


C++ MythEvent类代码示例

本文整理汇总了C++中MythEvent的典型用法代码示例。如果您正苦于以下问题:C++ MythEvent类的具体用法?C++ MythEvent怎么用?C++ MythEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MythEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: customEvent

void WebSocketMythEvent::customEvent(QEvent* event)
{
    if (event->type() == MythEvent::MythEventMessage)
    {
        if (!m_sendEvents)
            return;

        MythEvent *me = static_cast<MythEvent *>(event);
        QString message = me->Message();

        if (message.startsWith("SYSTEM_EVENT"))
            message.remove(0, 13); // Strip SYSTEM_EVENT from the frontend, it's not useful

        QStringList tokens = message.split(" ", QString::SkipEmptyParts);

        if (tokens.isEmpty())
            return;

        // If no-one is listening for this event, then ignore it
        if (!m_filters.contains("ALL") && !m_filters.contains(tokens[0]))
            return;

        SendTextMessage(message);
    }
}
开发者ID:garybuhrmaster,项目名称:mythtv,代码行数:25,代码来源:websocket_mythevent.cpp

示例2: customEvent

void HouseKeeper::customEvent(QEvent *e)
{
    if ((MythEvent::Type)(e->type()) == MythEvent::MythEventMessage)
    {
        MythEvent *me = (MythEvent*)e;
        if (me->Message().left(20) == "HOUSE_KEEPER_RUNNING")
        {
            QStringList tokens = me->Message()
                                 .split(" ", QString::SkipEmptyParts);
            if (tokens.size() != 4)
                return;

            QString hostname = tokens[1];
            QString tag = tokens[2];
            QDateTime last = MythDate::fromString(tokens[3]);

            QMutexLocker mapLock(&m_mapLock);
            if (m_taskMap.contains(tag))
            {
                if ((m_taskMap[tag]->GetScope() == kHKGlobal) ||
                        ((m_taskMap[tag]->GetScope() == kHKLocal) &&
                         (gCoreContext->GetHostName() == hostname)))
                    // task being run in the same scope as us.
                    // update the run time so we don't attempt to run
                    //      it ourselves
                    m_taskMap[tag]->SetLastRun(last);
            }
        }
    }
}
开发者ID:paradoxbound,项目名称:mythtv,代码行数:30,代码来源:housekeeper.cpp

示例3: customEvent

/** \fn MythSystemEventHandler::customEvent(QEvent *e)
 *  \brief Custom Event handler for receiving and processing System Events
 *  \sa MythSystemEventHandler::SubstituteMatches(const QStringList &tokens,
                                                  QString &command)
 *      MythSystemEventHandler::EventNameToSetting(const QString &name)
 *
 *  This function listens for SYSTEM_EVENT messages and fires off any
 *  necessary event handler commands.  In addition to SYSTEM_EVENT messages,
 *  this code also forwards GLOBAL_SYSTEM_EVENT which may have been sent
 *  by the local system via code that does not have access to the master
 *  backend connection to send events on its own.  One example is the
 *  code that sends KEY_xx system events.
 *
 *  \param e Pointer to QEvent containing event to handle
 */
void MythSystemEventHandler::customEvent(QEvent *e)
{
    if ((MythEvent::Type)(e->type()) == MythEvent::MythEventMessage)
    {
        MythEvent *me = (MythEvent *)e;
        QString msg = me->Message().simplified();

        if (msg == "CLEAR_SETTINGS_CACHE")
            msg = "SYSTEM_EVENT SETTINGS_CACHE_CLEARED";

        // Listen for any GLOBAL_SYSTEM_EVENT messages and resend to
        // the master backend as regular SYSTEM_EVENT messages.
        if (msg.startsWith("GLOBAL_SYSTEM_EVENT "))
        {
            gCoreContext->SendMessage(msg.mid(7) +
                QString(" SENDER %1").arg(gCoreContext->GetHostName()));
            return;
        }

        if ((!msg.startsWith("SYSTEM_EVENT ")) &&
            (!msg.startsWith("LOCAL_SYSTEM_EVENT ")))
            return;

        QStringList tokens = msg.split(' ', QString::SkipEmptyParts);

        // Return if this event is for another host
        if ((tokens.size() >= 4) &&
            (tokens[2] == "HOST") &&
            (tokens[3] != gCoreContext->GetHostName()))
            return;

        QString cmd;

        // See if this system has a command that runs for all system events
        cmd = gCoreContext->GetSetting("EventCmdAll");
        if (!cmd.isEmpty())
        {
            SubstituteMatches(tokens, cmd);

            SystemEventThread *eventThread = new SystemEventThread(cmd);
            MThreadPool::globalInstance()->startReserved(
                eventThread, "SystemEvent");
        }

        // Check for an EventCmd for this particular event
        cmd = gCoreContext->GetSetting(EventNameToSetting(tokens[1]));
        if (!cmd.isEmpty())
        {
            SubstituteMatches(tokens, cmd);

            SystemEventThread *eventThread =
                new SystemEventThread(cmd, tokens[1]);
            MThreadPool::globalInstance()->startReserved(
                eventThread, "SystemEvent");
        }
    }
}
开发者ID:DaveDaCoda,项目名称:mythtv,代码行数:72,代码来源:mythsystemevent.cpp

示例4: customEvent

void MediaServer::customEvent( QEvent *e )
{
    if (MythEvent::Type(e->type()) == MythEvent::MythEventMessage)
    {
        MythEvent *me = (MythEvent *)e;
        QString message = me->Message();

        //-=>TODO: Need to handle events to notify clients of changes
    }
}
开发者ID:dreamcat4,项目名称:mythtv,代码行数:10,代码来源:mediaserver.cpp

示例5: customEvent

void VideoSetupWizard::customEvent(QEvent *e)
{
    if ((MythEvent::Type)(e->type()) == MythEvent::MythEventMessage)
    {
        MythEvent *me = (MythEvent *)e;
        QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts);

        if (tokens.isEmpty())
            return;

        if (tokens[0] == "DOWNLOAD_FILE")
        {
            QStringList args = me->ExtraDataList();
            if ((tokens.size() != 2) ||
                (args[1] != m_downloadFile))
                return;

            if (tokens[1] == "UPDATE")
            {
                QString message = tr("Downloading Video Sample...\n"
                                     "(%1 of %2 MB)")
                                     .arg(QString::number(args[2].toInt() / 1024.0 / 1024.0, 'f', 2))
                                     .arg(QString::number(args[3].toInt() / 1024.0 / 1024.0, 'f', 2));
                m_progressDialog->SetMessage(message);
                m_progressDialog->SetTotal(args[3].toInt());
                m_progressDialog->SetProgress(args[2].toInt());
            }
            else if (tokens[1] == "FINISHED")
            {
                int fileSize  = args[2].toInt();
                int errorCode = args[4].toInt();

                if (m_progressDialog)
                    m_progressDialog->Close();

                QFileInfo file(m_downloadFile);
                if ((m_downloadFile.startsWith("myth://")))
                {
                    if ((errorCode == 0) &&
                        (fileSize > 0))
                    {
                        if (m_testType == ttHighDefinition)
                            testHDVideo();
                        else if (m_testType == ttStandardDefinition)
                            testSDVideo();
                    }
                    else
                    {
                        ShowOkPopup(tr("Error downloading sample to backend."));
                    }
                }
            }
        }
    }
}
开发者ID:Olti,项目名称:mythtv,代码行数:55,代码来源:setupwizard_video.cpp

示例6: customEvent

void NetSearch::customEvent(QEvent *event)
{
    if (event->type() == MythEvent::MythEventMessage)
    {
        MythEvent *me = (MythEvent *)event;

        if (me->Message().left(17) == "DOWNLOAD_COMPLETE")
        {
            QStringList tokens = me->Message()
                .split(" ", QString::SkipEmptyParts);

            if (tokens.size() != 2)
            {
                VERBOSE(VB_IMPORTANT, "Bad DOWNLOAD_COMPLETE message");
                return;
            }

            GetMythMainWindow()->HandleMedia("Internal", tokens.takeAt(1));
        }
    }
    else if (event->type() == ThumbnailDLEvent::kEventType)
    {
        ThumbnailDLEvent *tde = (ThumbnailDLEvent *)event;

        if (!tde)
            return;

        ThumbnailData *data = tde->thumb;

        if (!data)
            return;

        QString title = data->title;
        QString file = data->url;
        uint pos = qVariantValue<uint>(data->data);

        if (file.isEmpty() || !((uint)m_searchResultList->GetCount() >= pos))
        {
            delete data;
            return;
        }

        MythUIButtonListItem *item =
                  m_searchResultList->GetItemAt(pos);

        if (item && item->GetText() == title)
        {
            item->SetImage(file);
        }

        delete data;
    }
}
开发者ID:afljafa,项目名称:mythtv,代码行数:53,代码来源:netsearch.cpp

示例7: incomingCustomEvent

static void incomingCustomEvent(QEvent* e)
{
    if ((MythEvent::Type)(e->type()) == MythEvent::MythEventMessage)
    {
        MythEvent *me = (MythEvent *)e;
        QString message = me->Message();

        message = message.simplified();
        QStringList tokens = message.split(" ", QString::SkipEmptyParts);

        LOG(VB_COMMFLAG, LOG_INFO,
            QString("mythcommflag: Received Event: '%1'") .arg(message));

        if ((watchingRecording) && (tokens.size() >= 3) &&
            (tokens[0] == "DONE_RECORDING"))
        {
            int cardnum = tokens[1].toInt();
            int filelen = tokens[2].toInt();

            message = QString("mythcommflag: Received a "
                              "DONE_RECORDING event for card %1.  ")
                              .arg(cardnum);

            if (recorderNum != -1 && cardnum == recorderNum)
            {
                commDetector->recordingFinished(filelen);
                watchingRecording = false;
                message += "Informed CommDetector that recording has finished.";
                LOG(VB_COMMFLAG, LOG_INFO, message);
            }
        }

        if ((tokens.size() >= 2) && (tokens[0] == "COMMFLAG_REQUEST"))
        {
            uint chanid = 0;
            QDateTime recstartts;
            ProgramInfo::ExtractKey(tokens[1], chanid, recstartts);

            message = QString("mythcommflag: Received a "
                              "COMMFLAG_REQUEST event for chanid %1 @ %2.  ")
                .arg(chanid).arg(recstartts.toString(Qt::ISODate));

            if ((global_program_info->GetChanID()             == chanid) &&
                (global_program_info->GetRecordingStartTime() == recstartts))
            {
                commDetector->requestCommBreakMapUpdate();
                message += "Requested CommDetector to generate new break list.";
                LOG(VB_COMMFLAG, LOG_INFO, message);
            }
        }
    }
}
开发者ID:JGunning,项目名称:OpenAOL-TV,代码行数:52,代码来源:main.cpp

示例8: RemoteSendEvent

void RemoteSendEvent(const MythEvent &event)
{
    if (gCoreContext->IsBackend())
    {
        gCoreContext->dispatch(event);
        return;
    }

    QStringList strlist( "MESSAGE" );
    strlist << event.Message();
    strlist << event.ExtraDataList();

    gCoreContext->SendReceiveStringList(strlist);
}
开发者ID:microe,项目名称:mythtv,代码行数:14,代码来源:remoteutil.cpp

示例9: 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

示例10: dispatch

void DecoderHandler::customEvent(QEvent *event)
{
    if (DecoderHandlerEvent *dhe = dynamic_cast<DecoderHandlerEvent*>(event))
    {
        // Proxy all DecoderHandlerEvents
        return dispatch(*dhe);
    }
    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 downloadUrl = 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("DecoderHandler: failed to download playlist from '%1'")
                        .arg(downloadUrl));
                    QUrl url(downloadUrl);
                    m_state = STOPPED;
                    doOperationStop();
                    doFailed(url, "Could not get playlist");
                }
                else
                {
                    QUrl fileUrl(filename);
                    createPlaylistFromFile(fileUrl);
                }
            }
        }
    }
}
开发者ID:rjmorse,项目名称:mythtv,代码行数:47,代码来源:decoderhandler.cpp

示例11: dispatch

/** \brief Dispatch an event to all listeners
 *
 *  Makes a copy of the event on the heap by calling
 *  MythEvent::clone() and dispatches is by calling
 *  QCoreApplication::postEvent().
 *
 *  \param event MythEvent to dispatch.
 */
void MythObservable::dispatch(const MythEvent &event)
{
    QMutexLocker locker(m_lock);

    QSet<QObject*>::const_iterator it = m_listeners.begin();
    for (; it != m_listeners.end() ; ++it)
        QCoreApplication::postEvent(*it, event.clone());
}
开发者ID:DaveDaCoda,项目名称:mythtv,代码行数:16,代码来源:mythobservable.cpp

示例12: 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

示例13: customEvent

/**
 *  \brief  Handle custom events
 *  \param  event The custom event
 */
void GallerySlideView::customEvent(QEvent *event)
{
    if ((MythEvent::Type)(event->type()) == MythEvent::MythEventMessage)
    {
        MythEvent *me      = (MythEvent *)event;
        QString    message = me->Message();

        QStringList extra = me->ExtraDataList();

        if (message == "IMAGE_METADATA" && !extra.isEmpty())
        {
            int id = extra[0].toInt();
            ImagePtrK selected = m_view->GetSelected();

            if (selected && selected->m_id == id)
                m_infoList.Display(*selected, extra.mid(1));
        }
        else if (message == "THUMB_AVAILABLE")
        {
            if (!extra.isEmpty() && m_view->Update(extra[0].toInt()))
                ShowSlide(0);
        }
    }
    else if (event->type() == DialogCompletionEvent::kEventType)
    {
        DialogCompletionEvent *dce = (DialogCompletionEvent *)(event);

        QString resultid  = dce->GetId();
        int     buttonnum = dce->GetResult();

        if (resultid == "metadatamenu")
        {
            switch (buttonnum)
            {
            case 0: Transform(kRotateCW); break;
            case 1: Transform(kRotateCCW); break;
            case 2: Transform(kFlipHorizontal); break;
            case 3: Transform(kFlipVertical); break;
            case 4: Transform(kResetToExif); break;
            case 5: Zoom(10); break;
            case 6: Zoom(-10); break;
            }
        }
    }
}
开发者ID:dragonian,项目名称:mythtv,代码行数:49,代码来源:galleryslideview.cpp

示例14: customEvent

void ZMMiniPlayer::customEvent (QEvent* event)
{
    if (event->type() == MythEvent::MythEventMessage)
    {
        MythEvent *me = static_cast<MythEvent*>(event);

        if (!me)
            return;

        if (me->Message().startsWith("ZONEMINDER_NOTIFICATION"))
        {
            QStringList list = me->Message().simplified().split(' ');

            if (list.size() < 2)
                return;

            int monID = list[1].toInt();
            if (monID != m_alarmMonitor)
            {
                m_alarmMonitor = monID;

                m_frameTimer->stop();

                Monitor *mon = ZMClient::get()->getMonitorByID(monID);

                if (mon)
                {
                    m_players->at(0)->setMonitor(mon);
                    m_players->at(0)->updateCamera();
                }

                m_frameTimer->start(FRAME_UPDATE_TIME);
            }

            // restart the display timer on any notification messages if it is active
            if (m_displayTimer->isActive())
                m_displayTimer->start(10000);
        }
    }

    // Parent MythUIType handler always returns false. (Shouldn't it
    // call up?)  Continue to call QObject as before.
    QObject::customEvent(event);
}
开发者ID:garybuhrmaster,项目名称:mythtv,代码行数:44,代码来源:zmminiplayer.cpp

示例15: customEvent

void BrowserApi::customEvent(QEvent *e)
{
    if ((MythEvent::Type)(e->type()) == MythEvent::MythEventMessage)
    {
        MythEvent *me = (MythEvent *)e;
        QString message = me->Message();

        if (message.left(13) != "MUSIC_CONTROL")
            return;

        QStringList tokens = message.simplified().split(" ");
        if ((tokens.size() >= 4) && (tokens[1] == "ANSWER") 
            && (tokens[2] == gCoreContext->GetHostName()))
        {
            m_answer = tokens[3];
            for (int i = 4; i < tokens.size(); i++)
                m_answer += QString(" ") + tokens[i];
            m_gotAnswer = true;
        }
    }
}
开发者ID:bwarden,项目名称:mythtv,代码行数:21,代码来源:mythuiwebbrowser.cpp


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