blob: 9e78abc6801b949686cd3975db57665cb2434c5e [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
Yingdi Yu1f824642016-03-20 17:07:22 -070033#include "key-viewer-dialog.hpp"
34
taylorchuc27dd482014-05-17 20:06:49 -070035namespace ndn {
36
37class TrayMenu : public QWidget
38{
39 Q_OBJECT
40
41signals:
42 void
43 showApp();
44
45 void
46 nfdActivityUpdate(bool isActive);
47
48public:
Alexander Afanasyev4086d512014-07-11 15:56:33 -070049 explicit
50 TrayMenu(QQmlContext* context);
taylorchuc27dd482014-05-17 20:06:49 -070051
52 ~TrayMenu();
53
54 Q_INVOKABLE void
Alexander Afanasyev4086d512014-07-11 15:56:33 -070055 autoConfig();
taylorchuc27dd482014-05-17 20:06:49 -070056
57 Q_INVOKABLE void
Alexander Afanasyev4086d512014-07-11 15:56:33 -070058 startStopNfd();
taylorchuc27dd482014-05-17 20:06:49 -070059
susmit4fe3cb92016-03-20 17:08:41 -070060 Q_INVOKABLE void
61 addDeleteRoute();
62
63 Q_INVOKABLE void
64 addRoute();
65
66 Q_INVOKABLE void
67 deleteRoute();
68
taylorchuc27dd482014-05-17 20:06:49 -070069private slots:
70
71 void
72 quitApp();
73
74 void
75 iconActivated(QSystemTrayIcon::ActivationReason reason);
76
77 void
78 startNfd();
79
80 void
81 stopNfd();
82
susmit4fe3cb92016-03-20 17:08:41 -070083
taylorchuc27dd482014-05-17 20:06:49 -070084 void
85 updateNfdActivityIcon(bool isActive);
86
87private:
Alexander Afanasyev4086d512014-07-11 15:56:33 -070088 QQmlContext* m_context;
89 bool m_isNfdRunning;
Yingdi Yu53c11c12016-03-20 12:56:49 -070090 QSystemTrayIcon* m_tray;
91 QMenu* m_menu;
92 QAction* m_entryPref;
93 QAction* m_entrySec;
94 QAction* m_entryQuit;
Yingdi Yu1f824642016-03-20 17:07:22 -070095
96 ncc::KeyViewerDialog* m_keyViewerDialog;
taylorchuc27dd482014-05-17 20:06:49 -070097};
98
99} // namespace ndn
100
101#endif // NCC_TRAY_MENU_HPP