blob: 10f45c3286ddabfc3d077079e7430898ff92d34d [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
58private slots:
59
60 void
61 quitApp();
62
63 void
64 iconActivated(QSystemTrayIcon::ActivationReason reason);
65
66 void
67 startNfd();
68
69 void
70 stopNfd();
71
72 void
73 updateNfdActivityIcon(bool isActive);
74
75private:
Alexander Afanasyev4086d512014-07-11 15:56:33 -070076 QQmlContext* m_context;
77 bool m_isNfdRunning;
taylorchuc27dd482014-05-17 20:06:49 -070078 QSystemTrayIcon *tray;
79 QMenu* menu;
80 QAction* pref;
81 QAction* quit;
taylorchuc27dd482014-05-17 20:06:49 -070082};
83
84} // namespace ndn
85
86#endif // NCC_TRAY_MENU_HPP