Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 1 | /*************************************************************************** |
Anthony LĂ©onard | 2fde81d | 2017-04-17 10:06:55 -0400 | [diff] [blame] | 2 | * Copyright (C) 2015-2017 by Savoir-faire Linux * |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 3 | * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* |
| 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 as published by * |
| 7 | * the Free Software Foundation; either version 3 of the License, or * |
| 8 | * (at your option) any later version. * |
| 9 | * * |
| 10 | * This program is distributed in the hope that it will be useful, * |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 | * GNU General Public License for more details. * |
| 14 | * * |
| 15 | * You should have received a copy of the GNU General Public License * |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * |
| 17 | **************************************************************************/ |
| 18 | |
Edric Milaret | 5f316da | 2015-09-28 11:57:42 -0400 | [diff] [blame] | 19 | #pragma once |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 20 | |
Edric Milaret | 2cf3429 | 2015-06-22 16:27:03 -0400 | [diff] [blame] | 21 | #include "globalsystemtray.h" |
| 22 | |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 23 | #include <QMainWindow> |
| 24 | #include <QMouseEvent> |
Edric Milaret | 28290e3 | 2016-09-07 15:51:41 -0400 | [diff] [blame] | 25 | #include <QNetworkConfigurationManager> |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 26 | |
| 27 | #include "navstack.h" |
| 28 | |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 29 | static constexpr char IDM_ABOUTBOX = 0x0010; |
| 30 | |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 31 | namespace Ui { |
| 32 | class MainWindow; |
| 33 | } |
| 34 | |
| 35 | class MainWindow : public QMainWindow |
| 36 | { |
| 37 | Q_OBJECT |
| 38 | |
| 39 | public: |
Edric Milaret | 9c3e7f7 | 2016-01-27 10:48:20 -0500 | [diff] [blame] | 40 | inline static MainWindow& instance() { |
| 41 | static auto instance = new MainWindow(); |
| 42 | return *instance; |
| 43 | } |
Edric Milaret | 2cf3429 | 2015-06-22 16:27:03 -0400 | [diff] [blame] | 44 | void createThumbBar(); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 45 | |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 46 | protected: |
Edric Milaret | db818e5 | 2016-02-02 14:53:19 -0500 | [diff] [blame] | 47 | bool nativeEvent(const QByteArray& eventType, void* message, long* result); |
| 48 | void closeEvent(QCloseEvent* event); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 49 | |
Edric Milaret | fe39094 | 2015-08-04 13:41:03 -0400 | [diff] [blame] | 50 | public slots: |
| 51 | void onRingEvent(const QString& uri); |
| 52 | |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 53 | private slots: |
| 54 | void trayActivated(QSystemTrayIcon::ActivationReason reason); |
Edric Milaret | db818e5 | 2016-02-02 14:53:19 -0500 | [diff] [blame] | 55 | void onIncomingCall(Call* call); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 56 | void switchNormalMaximize(); |
Edric Milaret | 568a0e5 | 2016-09-02 16:26:58 -0400 | [diff] [blame] | 57 | void notificationClicked(); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 58 | |
| 59 | private: |
Edric Milaret | db818e5 | 2016-02-02 14:53:19 -0500 | [diff] [blame] | 60 | explicit MainWindow(QWidget* parent = 0); |
Edric Milaret | 9c3e7f7 | 2016-01-27 10:48:20 -0500 | [diff] [blame] | 61 | ~MainWindow(); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 62 | Ui::MainWindow* ui; |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 63 | NavStack* navStack_; |
Edric Milaret | 28290e3 | 2016-09-07 15:51:41 -0400 | [diff] [blame] | 64 | QNetworkConfigurationManager netManager_; |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 65 | }; |