blob: 54c19fa4dd266cf236bf3c6cde148fb8a8d0ced3 [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
Olivier SOLDANOc1ca2df2017-09-06 16:01:46 -040027#include "navwidget.h"
28
29// LRC
30#include "call.h"
Edric Milaret627500d2015-03-27 16:41:40 -040031
Edric Milareted0b2802015-10-01 15:10:02 -040032static constexpr char IDM_ABOUTBOX = 0x0010;
33
Edric Milaret627500d2015-03-27 16:41:40 -040034namespace Ui {
35class MainWindow;
36}
37
38class MainWindow : public QMainWindow
39{
40 Q_OBJECT
41
42public:
Edric Milaret9c3e7f72016-01-27 10:48:20 -050043 inline static MainWindow& instance() {
44 static auto instance = new MainWindow();
45 return *instance;
46 }
Edric Milaret2cf34292015-06-22 16:27:03 -040047 void createThumbBar();
Olivier SOLDANO2100f1c2017-09-06 16:45:20 -040048 bool init();
Edric Milaret627500d2015-03-27 16:41:40 -040049
Edric Milareted0b2802015-10-01 15:10:02 -040050protected:
Edric Milaretdb818e52016-02-02 14:53:19 -050051 bool nativeEvent(const QByteArray& eventType, void* message, long* result);
52 void closeEvent(QCloseEvent* event);
Nicolas Jager97a21b42015-12-03 16:55:45 -050053
Edric Milaretfe390942015-08-04 13:41:03 -040054public slots:
55 void onRingEvent(const QString& uri);
56
Edric Milaret627500d2015-03-27 16:41:40 -040057private slots:
58 void trayActivated(QSystemTrayIcon::ActivationReason reason);
Edric Milaretdb818e52016-02-02 14:53:19 -050059 void onIncomingCall(Call* call);
Nicolas Jager97a21b42015-12-03 16:55:45 -050060 void switchNormalMaximize();
Edric Milaret568a0e52016-09-02 16:26:58 -040061 void notificationClicked();
Edric Milaret627500d2015-03-27 16:41:40 -040062
63private:
Edric Milaretdb818e52016-02-02 14:53:19 -050064 explicit MainWindow(QWidget* parent = 0);
Edric Milaret9c3e7f72016-01-27 10:48:20 -050065 ~MainWindow();
Nicolas Jager97a21b42015-12-03 16:55:45 -050066 Ui::MainWindow* ui;
Edric Milaret28290e32016-09-07 15:51:41 -040067 QNetworkConfigurationManager netManager_;
Edric Milaret627500d2015-03-27 16:41:40 -040068};