Sophie

Sophie

distrib > Fedora > 16 > x86_64 > by-pkgid > 1a5ff7250cfe3a3ad76e36e17c69f8b0 > files > 398

libqxt-devel-0.6.2-1.fc16.i686.rpm

#include "foo.h"
#include <qxtdiscoverableservice.h>
#include <qxtservicebrowser.h>
#include <QxtSignalWaiter>
#include <QCoreApplication>
#include <QtDebug>

int main(int argc, char** argv) {
    QCoreApplication app(argc, argv);
    QxtDiscoverableService svc("daap");
    svc.setPort(9123);
    Foo foo;
    QObject::connect(&svc, SIGNAL(registered()), &foo, SLOT(ok()));
    QObject::connect(&svc, SIGNAL(registrationError(int)), &foo, SLOT(err(int)));
    qDebug() << "registering...";
    svc.registerService(true);
    qDebug() << "registerService invoked";

    QxtServiceBrowser browser("daap");
    foo.browser = &browser;
    QObject::connect(&browser, SIGNAL(browsingFailed(int)), &foo, SLOT(err(int)));
    QObject::connect(&browser, SIGNAL(serviceAdded(QString,QString)), &foo, SLOT(add(QString,QString)));
    QObject::connect(&browser, SIGNAL(serviceRemoved(QString,QString)), &foo, SLOT(remove(QString)));
    browser.browse();

    app.exec();
}