taylorchu | c27dd48 | 2014-05-17 20:06:49 -0700 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2013-2014, Regents of the University of California, |
| 4 | * |
| 5 | * This file is part of NFD Control Center. See AUTHORS.md for complete list of NFD |
| 6 | * authors and contributors. |
| 7 | * |
| 8 | * NFD Control Center is free software: you can redistribute it and/or modify it under the |
| 9 | * terms of the GNU General Public License as published by the Free Software Foundation, |
| 10 | * either version 3 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * NFD Control Center is distributed in the hope that it will be useful, but WITHOUT ANY |
| 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 14 | * PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along with NFD |
| 17 | * Control Center, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #ifndef NCC_TRAY_MENU_HPP |
| 21 | #define NCC_TRAY_MENU_HPP |
| 22 | |
| 23 | #include <QtCore/QObject> |
| 24 | #include <QtCore/QProcess> |
| 25 | #include <QtCore/QCoreApplication> |
| 26 | |
| 27 | #include <QtWidgets/QSystemTrayIcon> |
| 28 | #include <QtWidgets/QAction> |
| 29 | #include <QtWidgets/QMenu> |
| 30 | |
| 31 | namespace ndn { |
| 32 | |
| 33 | class TrayMenu : public QWidget |
| 34 | { |
| 35 | Q_OBJECT |
| 36 | |
| 37 | signals: |
| 38 | void |
| 39 | showApp(); |
| 40 | |
| 41 | void |
| 42 | nfdActivityUpdate(bool isActive); |
| 43 | |
| 44 | public: |
| 45 | TrayMenu(); |
| 46 | |
| 47 | ~TrayMenu(); |
| 48 | |
| 49 | Q_INVOKABLE void |
| 50 | checkNfdRunning(); |
| 51 | |
| 52 | Q_INVOKABLE void |
| 53 | autoConfig(); |
| 54 | |
| 55 | private slots: |
| 56 | |
| 57 | void |
| 58 | quitApp(); |
| 59 | |
| 60 | void |
| 61 | iconActivated(QSystemTrayIcon::ActivationReason reason); |
| 62 | |
| 63 | void |
| 64 | startNfd(); |
| 65 | |
| 66 | void |
| 67 | stopNfd(); |
| 68 | |
| 69 | void |
| 70 | updateNfdActivityIcon(bool isActive); |
| 71 | |
| 72 | private: |
| 73 | QSystemTrayIcon *tray; |
| 74 | QMenu* menu; |
| 75 | QAction* pref; |
| 76 | QAction* quit; |
| 77 | // QAction* start; |
| 78 | // QAction* stop; |
| 79 | }; |
| 80 | |
| 81 | } // namespace ndn |
| 82 | |
| 83 | #endif // NCC_TRAY_MENU_HPP |