blob: 557dcdf2d924c47e35d6296dc0cb9e49c99933cb [file] [log] [blame]
Edric Milaret627500d2015-03-27 16:41:40 -04001/***************************************************************************
Anthony LĂ©onard2fde81d2017-04-17 10:06:55 -04002 * Copyright (C) 2015-2017 by Savoir-faire Linux *
Edric Milaret627500d2015-03-27 16:41:40 -04003 * 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 Milaret5f316da2015-09-28 11:57:42 -040019#pragma once
Edric Milaret627500d2015-03-27 16:41:40 -040020
Edric Milaret2cf34292015-06-22 16:27:03 -040021#include "globalsystemtray.h"
22
Edric Milaret627500d2015-03-27 16:41:40 -040023#include <QMainWindow>
24#include <QMouseEvent>
Edric Milaret28290e32016-09-07 15:51:41 -040025#include <QNetworkConfigurationManager>
Edric Milaret627500d2015-03-27 16:41:40 -040026
27#include "navstack.h"
28
Edric Milareted0b2802015-10-01 15:10:02 -040029static constexpr char IDM_ABOUTBOX = 0x0010;
30
Edric Milaret627500d2015-03-27 16:41:40 -040031namespace Ui {
32class MainWindow;
33}
34
35class MainWindow : public QMainWindow
36{
37 Q_OBJECT
38
39public:
Edric Milaret9c3e7f72016-01-27 10:48:20 -050040 inline static MainWindow& instance() {
41 static auto instance = new MainWindow();
42 return *instance;
43 }
Edric Milaret2cf34292015-06-22 16:27:03 -040044 void createThumbBar();
Edric Milaret627500d2015-03-27 16:41:40 -040045
Edric Milareted0b2802015-10-01 15:10:02 -040046protected:
Edric Milaretdb818e52016-02-02 14:53:19 -050047 bool nativeEvent(const QByteArray& eventType, void* message, long* result);
48 void closeEvent(QCloseEvent* event);
Nicolas Jager97a21b42015-12-03 16:55:45 -050049
Edric Milaretfe390942015-08-04 13:41:03 -040050public slots:
51 void onRingEvent(const QString& uri);
52
Edric Milaret627500d2015-03-27 16:41:40 -040053private slots:
54 void trayActivated(QSystemTrayIcon::ActivationReason reason);
Edric Milaretdb818e52016-02-02 14:53:19 -050055 void onIncomingCall(Call* call);
Nicolas Jager97a21b42015-12-03 16:55:45 -050056 void switchNormalMaximize();
Edric Milaret568a0e52016-09-02 16:26:58 -040057 void notificationClicked();
Edric Milaret627500d2015-03-27 16:41:40 -040058
59private:
Edric Milaretdb818e52016-02-02 14:53:19 -050060 explicit MainWindow(QWidget* parent = 0);
Edric Milaret9c3e7f72016-01-27 10:48:20 -050061 ~MainWindow();
Nicolas Jager97a21b42015-12-03 16:55:45 -050062 Ui::MainWindow* ui;
Edric Milaret627500d2015-03-27 16:41:40 -040063 NavStack* navStack_;
Edric Milaret28290e32016-09-07 15:51:41 -040064 QNetworkConfigurationManager netManager_;
Edric Milaret627500d2015-03-27 16:41:40 -040065};