コード例 #1
0
void PublicService::publishAsync()
{
    if(d->isRunning())
        stop();
#ifdef HAVE_DNSSD
    if(ServiceBrowser::isAvailable() == ServiceBrowser::Working)
    {
        TXTRecordRef txt;
        TXTRecordCreate(&txt, 0, 0);
        QMap< QString, QString >::ConstIterator itEnd = m_textData.end();
        for(QMap< QString, QString >::ConstIterator it = m_textData.begin(); it != itEnd; ++it)
        {
            QCString value = it.data().utf8();
            if(TXTRecordSetValue(&txt, it.key().utf8(), value.length(), value) != kDNSServiceErr_NoError)
            {
                TXTRecordDeallocate(&txt);
                emit published(false);
                return;
            }
        }
        DNSServiceRef ref;
        if(DNSServiceRegister(&ref, 0, 0, m_serviceName.utf8(), m_type.ascii(), domainToDNS(m_domain), NULL, htons(m_port), TXTRecordGetLength(&txt),
                              TXTRecordGetBytesPtr(&txt), publish_callback, reinterpret_cast< void * >(this))
           == kDNSServiceErr_NoError)
            d->setRef(ref);
        TXTRecordDeallocate(&txt);
    }
#endif
    if(!d->isRunning())
        emit published(false);
}
コード例 #2
0
void PublicService::customEvent(QCustomEvent *event)
{
    if(event->type() == QEvent::User + SD_ERROR)
    {
        stop();
        emit published(false);
    }
    if(event->type() == QEvent::User + SD_PUBLISH)
    {
        d->m_published = true;
        emit published(true);
        m_serviceName = static_cast< PublishEvent * >(event)->m_name;
    }
}
コード例 #3
0
ファイル: entry.cpp プロジェクト: pvuorela/kcalcore
QString Entry::debugInfo() const
{
    QString info;
    info += QLatin1String("### Entry: ###################\n");
    if (!title().isEmpty())
        info += QLatin1String("title: #") + title() + QLatin1String("#\n");
    if (!summary().isEmpty())
        info += QLatin1String("summary: #") + summary() + QLatin1String("#\n");
    if (!id().isEmpty())
        info += QLatin1String("id: #") + id() + QLatin1String("#\n");
    if (!content().isNull())
        info += content().debugInfo();
    
    if (!rights().isEmpty())
        info += QLatin1String("rights: #") + rights() + QLatin1String("#\n");
    
    
    QString dupdated = dateTimeToString(updated());
    if (!dupdated.isNull())
        info += QLatin1String("updated: #") + dupdated + QLatin1String("#\n");
    
    QString dpublished = dateTimeToString(published());
    if (!dpublished.isNull())
        info += QLatin1String("published: #") + dpublished + QLatin1String("#\n");
    
    QList<Link> dlinks = links();
    QList<Link>::ConstIterator endlinks = dlinks.constEnd();
    for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it)
        info += (*it).debugInfo();
    
    QList<Category> dcats = categories();
    QList<Category>::ConstIterator endcats = dcats.constEnd();
    for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it)
        info += (*it).debugInfo();

    info += QLatin1String("### Authors: ###################\n");
    
    QList<Person> dauthors = authors();
    QList<Person>::ConstIterator endauthors = dauthors.constEnd();
    for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it)
        info += (*it).debugInfo();

    info += QLatin1String("### Contributors: ###################\n");
    
    QList<Person> dcontri = contributors();
    QList<Person>::ConstIterator endcontri = dcontri.constEnd();
    for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it)
        info += (*it).debugInfo();
    
    if (!source().isNull())
        info += source().debugInfo();
    
    info += QLatin1String("### Entry end ################\n");

    return info;
}
コード例 #4
0
// Call frequency: ~93Hz
void ServerDriver::RunFrame() {
	for (int i = 0; i < vr::k_unMaxTrackedDeviceCount; ++i) {
		auto vd = m_virtualDevices[i];
		if (vd && vd->published() && vd->periodicPoseUpdates()) {
			vd->sendPoseUpdate();
		}
	}
	for (auto d : _deviceManipulationHandles) {
		d.second->RunFrame();
	}
	m_motionCompensation.runFrame();
}
コード例 #5
0
void PublicService::publishAsync()
{
	K_D;
	if (d->isRunning()) stop();
	TXTRecordRef txt;
	TXTRecordCreate(&txt,0,0);
	QMap<QString,QByteArray>::ConstIterator itEnd = d->m_textData.end();
	for (QMap<QString,QByteArray>::ConstIterator it = d->m_textData.begin(); it!=itEnd ; ++it) {
		if (TXTRecordSetValue(&txt,it.key().toUtf8(),it.value().length(),it.value())!=kDNSServiceErr_NoError) {
			TXTRecordDeallocate(&txt);
			emit published(false);
			return;
		}
	}
	DNSServiceRef ref;
	QString fullType=d->m_type;
	Q_FOREACH(const QString &subtype, d->m_subtypes) fullType+=','+subtype;
	if (DNSServiceRegister(&ref,0,0,d->m_serviceName.toUtf8(),fullType.toAscii().constData(),domainToDNS(d->m_domain),NULL,
	    htons(d->m_port),TXTRecordGetLength(&txt),TXTRecordGetBytesPtr(&txt),publish_callback,
	    reinterpret_cast<void*>(d)) == kDNSServiceErr_NoError) d->setRef(ref);
	TXTRecordDeallocate(&txt);
	if (!d->isRunning()) emit published(false);
}
コード例 #6
0
ファイル: QPubNub.cpp プロジェクト: SebastianVoigt/PubNub4Qt
void QPubNub::publishFinished() {
  QNetworkReply * reply = qobject_cast<QNetworkReply*>(sender());
  QJsonArray response;
  if (handleResponse(reply, response)) {
    return;
  }
  if (response.size() >= 2) {
    const QJsonValue statusCode(response[0]);
    if ((int)statusCode.toDouble() == 0) {
      emit error(response[1].toString(), 0);
    } else {
      emit published(response[2].toString());
    }
  } else {
    emit error("Response array is too small", 0);
  }
}
コード例 #7
0
RequestDetailsDlg::RequestDetailsDlg(Request* request, QWidget *parent)
    : QDialog(parent)
    ,m_request(request)
    ,m_gist(new Gist(parent))
{
    connect(m_gist, SIGNAL(published(QString)), this, SLOT(slotGistUrl(QString)));
    QGridLayout *gridLayout = new QGridLayout(this);

    QHBoxLayout *phLayout = new QHBoxLayout;

    QPushButton *cliboard = new QPushButton(QIcon(":/clipboard_32.png"), "", this);
    cliboard->setAutoDefault(false);
    cliboard->setToolTip(tr("Copy details of request/response to clipboard"));
    cliboard->setWhatsThis(tr("Send request/response to cliboard"));
    connect(cliboard, SIGNAL(clicked()), this, SLOT(slotSendToBuffer()));

    QPushButton *share = new QPushButton(QIcon(":/cloud302_32.png"), "", this);
    share->setAutoDefault(false);
    share->setToolTip(tr("Share request at gist"));
    share->setWhatsThis(tr("Share request at gist"));
    connect(share, SIGNAL(clicked()), this, SLOT(slotSendToGist()));

    phLayout->addWidget(cliboard);
    phLayout->addSpacing(2);
    phLayout->addWidget(share);

    m_viewRequest = new QTextEdit(this);
    m_viewRequest->setFont(QFont("Monospace"));
    m_viewRequest->setReadOnly(true);
    m_viewRequest->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    m_viewRequest->setHtml(m_request->requestToHtml());

    m_viewResponse = new QTextEdit(this);
    m_viewResponse->setFont(QFont("Monospace"));
    m_viewResponse->setReadOnly(true);
    m_viewResponse->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    m_viewResponse->setHtml(m_request->responseToHtml());

    gridLayout->addItem(phLayout, 0, 0, 1, 2, Qt::AlignLeft);
    gridLayout->addWidget(m_viewRequest, 1, 0, 1, 1);
    gridLayout->addWidget(m_viewResponse, 1, 1, 1, 1);
    gridLayout->setContentsMargins(0,0,0,0);
    gridLayout->setMargin(0);
    resize(900, 500);
}
コード例 #8
0
int32_t ServerDriver::virtualDevices_publishDevice(uint32_t emulatedDeviceId, bool notify) {
	LOG(TRACE) << "CServerDriver::publishTrackedDevice( " << emulatedDeviceId << " )";
	std::lock_guard<std::recursive_mutex> lock(_virtualDevicesMutex);
	if (emulatedDeviceId >= m_virtualDeviceCount) {
		return -1;
	} else if (!m_virtualDevices[emulatedDeviceId]) {
		return -2;
	} else {
		auto device = m_virtualDevices[emulatedDeviceId].get();
		if (device->published()) {
			return -3;
		}
		try {
			device->publish();
			LOG(INFO) << "Published tracked controller: virtualDeviceId " << emulatedDeviceId;
		} catch (std::exception& e) {
			LOG(ERROR) << "Error while publishing controller " << emulatedDeviceId << ": " << e.what();
			return -4;
		}
		return 0;
	}
}
コード例 #9
0
ファイル: dummy-publicservice.cpp プロジェクト: KDE/kdnssd
void PublicService::publishAsync()
{
    emit published(false);
}
コード例 #10
0
ファイル: qmqtt_client.cpp プロジェクト: ehntoo/qmqtt
quint16 Client::publish(Message &message)
{
    quint16 msgid = pd_func()->sendPublish(message);
    emit published(message);
    return msgid;
}