Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 4442dd9bdde98a1d9ca2177557e87d7d > files > 398

libqxt-devel-0.6.1-3.fc15.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();
}