blob: 952260a26b916dffa3e7ca561b25fa6aa86d1457 [file] [log] [blame]
taylorchuc27dd482014-05-17 20:06:49 -07001/* -*- 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
Alexander Afanasyev4086d512014-07-11 15:56:33 -070031#include <QtQml/QQmlContext>
32
taylorchuc27dd482014-05-17 20:06:49 -070033namespace ndn {
34
35class TrayMenu : public QWidget
36{
37 Q_OBJECT
38
39signals:
40 void
41 showApp();
42
43 void
44 nfdActivityUpdate(bool isActive);
45
46public:
Alexander Afanasyev4086d512014-07-11 15:56:33 -070047 explicit
48 TrayMenu(QQmlContext* context);
taylorchuc27dd482014-05-17 20:06:49 -070049
50 ~TrayMenu();
51
52 Q_INVOKABLE void
Alexander Afanasyev4086d512014-07-11 15:56:33 -070053 autoConfig();
taylorchuc27dd482014-05-17 20:06:49 -070054
55 Q_INVOKABLE void
Alexander Afanasyev4086d512014-07-11 15:56:33 -070056 startStopNfd();
taylorchuc27dd482014-05-17 20:06:49 -070057
susmit4fe3cb92016-03-20 17:08:41 -070058 Q_INVOKABLE void
59 addDeleteRoute();
60
61 Q_INVOKABLE void
62 addRoute();
63
64 Q_INVOKABLE void
65 deleteRoute();
66
taylorchuc27dd482014-05-17 20:06:49 -070067private slots:
68
69 void
70 quitApp();
71
72 void
73 iconActivated(QSystemTrayIcon::ActivationReason reason);
74
75 void
76 startNfd();
77
78 void
79 stopNfd();
80
susmit4fe3cb92016-03-20 17:08:41 -070081
taylorchuc27dd482014-05-17 20:06:49 -070082 void
83 updateNfdActivityIcon(bool isActive);
84
85private:
Alexander Afanasyev4086d512014-07-11 15:56:33 -070086 QQmlContext* m_context;
87 bool m_isNfdRunning;
Yingdi Yu53c11c12016-03-20 12:56:49 -070088 QSystemTrayIcon* m_tray;
89 QMenu* m_menu;
90 QAction* m_entryPref;
91 QAction* m_entrySec;
92 QAction* m_entryQuit;
taylorchuc27dd482014-05-17 20:06:49 -070093};
94
95} // namespace ndn
96
97#endif // NCC_TRAY_MENU_HPP