* Fix a typo in the dpkg changelog.
[deb_shairplay.git] / mainapplication.cpp
... / ...
CommitLineData
1#include "mainapplication.h"
2
3#include <QDebug>
4
5MainApplication::MainApplication(QObject *parent) :
6 QObject(parent)
7{
8 raopService = new RaopService(0);
9 trayIconMenu = new QMenu(0);
10
11 // Initialize the service
12 raopService->init();
13
14 quitAction = new QAction(tr("&Quit"), trayIconMenu);
15 connect(quitAction, SIGNAL(triggered()), this, SIGNAL(quitRequested()));
16 trayIconMenu->addAction(quitAction);
17
18 // Construct the actual system tray icon
19 trayIcon = new QSystemTrayIcon(this);
20 trayIcon->setContextMenu(trayIconMenu);
21 trayIcon->setIcon(QIcon(":icons/airtv.svg"));
22}
23
24MainApplication::~MainApplication()
25{
26 trayIcon->setContextMenu(0);
27 delete trayIconMenu;
28 delete raopService;
29}
30
31void MainApplication::start()
32{
33 raopService->start();
34 trayIcon->show();
35}
36
37void MainApplication::stop()
38{
39 raopService->stop();
40 trayIcon->hide();
41}
42
43void MainApplication::aboutToQuit()
44{
45 this->stop();
46}