Jared Lindblom | 06405c4 | 2013-01-17 20:48:39 -0800 | [diff] [blame^] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2012-2013 University of California, Los Angeles |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program 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 |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Jared Lindblom <lindblom@cs.ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #ifndef CHRONOSHAREGUI_H |
| 22 | #define CHRONOSHAREGUI_H |
| 23 | |
| 24 | #include <QWidget> |
| 25 | #include <QSystemTrayIcon> |
| 26 | #include <QMenu> |
| 27 | #include <QCloseEvent> |
| 28 | #include <QDebug> |
| 29 | #include <QProcess> |
| 30 | |
| 31 | class ChronoShareGui : public QWidget |
| 32 | { |
| 33 | Q_OBJECT |
| 34 | |
| 35 | public: |
| 36 | // constructor |
| 37 | ChronoShareGui(QString dirPath, QWidget* parent = 0); |
| 38 | |
| 39 | // destructor |
| 40 | ~ChronoShareGui(); |
| 41 | |
| 42 | private slots: |
| 43 | // handle left click of tray icon |
| 44 | void trayIconClicked(QSystemTrayIcon::ActivationReason reason); |
| 45 | |
| 46 | private: |
| 47 | // create actions that result from clicking a menu option |
| 48 | void createActions(); |
| 49 | |
| 50 | // create tray icon |
| 51 | void createTrayIcon(); |
| 52 | |
| 53 | // set icon image |
| 54 | void setIcon(); |
| 55 | |
| 56 | // open the shared folder |
| 57 | void openSharedFolder(); |
| 58 | |
| 59 | private: |
| 60 | QSystemTrayIcon* m_trayIcon; // tray icon |
| 61 | QMenu* m_trayIconMenu; // tray icon menu |
| 62 | |
| 63 | QAction* m_openFolder; // open the shared folder action |
| 64 | QAction* m_quitProgram; // quit program action |
| 65 | |
| 66 | QString m_dirPath; // shared directory |
| 67 | }; |
| 68 | |
| 69 | #endif // CHRONOSHAREGUI_H |