1 #include "mainapplication.h"
4 #include <QCoreApplication>
6 MainApplication::MainApplication(QObject
*parent
) :
9 raopService
= new RaopService(0);
10 dnssdService
= new DnssdService(0);
11 trayIconMenu
= new QMenu(0);
13 quitAction
= new QAction(tr("&Quit"), trayIconMenu
);
14 connect(quitAction
, SIGNAL(triggered()), this, SIGNAL(quitRequested()));
15 trayIconMenu
->addAction(quitAction
);
17 // Construct the actual system tray icon
18 trayIcon
= new QSystemTrayIcon(this);
19 trayIcon
->setContextMenu(trayIconMenu
);
20 trayIcon
->setIcon(QIcon(":icons/airtv.svg"));
23 MainApplication::~MainApplication()
25 trayIcon
->setContextMenu(0);
30 bool MainApplication::start()
32 // Initialize the service
33 bool initSuccess
= false;
34 initSuccess
= raopService
->init(10, &m_callbacks
);
36 qDebug() << "Error initializing raop service";
39 initSuccess
&= dnssdService
->init();
41 qDebug() << "Error initializing dnssd service";
45 char chwaddr
[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB };
46 QByteArray
hwaddr(chwaddr
, sizeof(chwaddr
));
48 raopService
->start(5000, hwaddr
);
49 dnssdService
->registerRaop("Shairplay", 5000, hwaddr
);
54 void MainApplication::stop()
56 dnssdService
->unregisterRaop();
61 void MainApplication::aboutToQuit()