| 1 | /** |
| 2 | * Copyright (C) 2011-2012 Juho Vähä-Herttua |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2.1 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | */ |
| 14 | |
| 15 | #include <QtGui> |
| 16 | #include <QtSingleApplication> |
| 17 | |
| 18 | #include "mainapplication.h" |
| 19 | #include "videowidget.h" |
| 20 | #include "raopservice.h" |
| 21 | |
| 22 | int main(int argc, char *argv[]) |
| 23 | { |
| 24 | QtSingleApplication a(argc, argv); |
| 25 | if (a.isRunning()) { |
| 26 | return 0; |
| 27 | } |
| 28 | a.setApplicationName("AirTV"); |
| 29 | |
| 30 | if (!QSystemTrayIcon::isSystemTrayAvailable()) { |
| 31 | QMessageBox::critical(0, QObject::tr("Systray"), |
| 32 | QObject::tr("I couldn't detect any system tray " |
| 33 | "on this system.")); |
| 34 | return 1; |
| 35 | } |
| 36 | QApplication::setQuitOnLastWindowClosed(false); |
| 37 | |
| 38 | MainApplication m; |
| 39 | QObject::connect(&m, SIGNAL(quitRequested()), &a, SLOT(quit())); |
| 40 | QObject::connect(&a, SIGNAL(aboutToQuit()), &m, SLOT(aboutToQuit())); |
| 41 | |
| 42 | if(m.start()) { |
| 43 | return a.exec(); |
| 44 | } else { |
| 45 | return EXIT_FAILURE; |
| 46 | } |
| 47 | } |