File: test.cpp

package info (click to toggle)
libqxt 0.6.1-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 19,004 kB
  • sloc: cpp: 57,512; xml: 296; sh: 251; makefile: 56; php: 14
file content (27 lines) | stat: -rw-r--r-- 964 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#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();
}