Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 1 | /*************************************************************************** |
Edric Milaret | bab169d | 2016-01-07 15:13:33 -0500 | [diff] [blame] | 2 | * Copyright (C) 2015-2016 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 | |
| 21 | #include <QWidget> |
Edric Milaret | 67007d1 | 2015-05-07 09:40:09 -0400 | [diff] [blame] | 22 | #include <QVector> |
| 23 | #include <QString> |
Edric Milaret | 7d40a4a | 2015-05-13 13:01:15 -0400 | [diff] [blame] | 24 | #include <QMenu> |
Edric Milaret | 029b95a | 2015-06-09 09:51:44 -0400 | [diff] [blame] | 25 | #include <QItemSelection> |
Edric Milaret | c7ab550 | 2015-06-15 11:18:02 -0400 | [diff] [blame] | 26 | #include <QMovie> |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 27 | |
| 28 | #include "navwidget.h" |
Edric Milaret | cdc978b | 2015-06-04 11:25:12 -0400 | [diff] [blame] | 29 | #include "instantmessagingwidget.h" |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 30 | |
| 31 | #include "callmodel.h" |
| 32 | #include "video/renderer.h" |
| 33 | #include "video/previewmanager.h" |
Edric Milaret | e5afb07 | 2015-06-02 16:45:44 -0400 | [diff] [blame] | 34 | #include "accountmodel.h" |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 35 | #include "categorizedhistorymodel.h" |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 36 | |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 37 | class ContactDelegate; |
| 38 | class HistoryDelegate; |
| 39 | class SmartListDelegate; |
Edric Milaret | ab12d02 | 2015-12-04 16:09:44 -0500 | [diff] [blame] | 40 | class ImDelegate; |
Nicolas Jager | ca85029 | 2016-01-17 14:11:10 -0500 | [diff] [blame^] | 41 | class QPropertyAnimation; |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 42 | |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 43 | namespace Ui { |
| 44 | class CallWidget; |
| 45 | } |
| 46 | |
| 47 | class CallWidget : public NavWidget |
| 48 | { |
| 49 | Q_OBJECT |
| 50 | |
| 51 | public: |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 52 | explicit CallWidget(QWidget* parent = 0); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 53 | ~CallWidget(); |
| 54 | void atExit(); |
| 55 | |
Edric Milaret | 33cb483 | 2016-01-08 10:14:14 -0500 | [diff] [blame] | 56 | public slots: |
| 57 | void contactButton_clicked(bool checked); |
| 58 | void settingsButton_clicked(); |
| 59 | void historicButton_clicked(bool checked); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 60 | //UI SLOTS |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 61 | public slots: |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 62 | void on_ringContactLineEdit_returnPressed(); |
| 63 | void on_btnCall_clicked(); |
| 64 | void on_btnvideo_clicked(); |
Edric Milaret | a0ebd06 | 2016-01-13 12:18:23 -0500 | [diff] [blame] | 65 | void showIMOutOfCall(); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 66 | inline void on_entered(const QModelIndex& i){highLightedIndex_ = i;}; |
| 67 | |
| 68 | //UI SLOTS |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 69 | private slots: |
| 70 | void on_acceptButton_clicked(); |
| 71 | void on_refuseButton_clicked(); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 72 | void on_contactView_doubleClicked(const QModelIndex& index); |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 73 | void on_cancelButton_clicked(); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 74 | void on_smartList_doubleClicked(const QModelIndex& index); |
| 75 | void on_historyList_doubleClicked(const QModelIndex& index); |
Edric Milaret | ab12d02 | 2015-12-04 16:09:44 -0500 | [diff] [blame] | 76 | void on_sendButton_clicked(); |
| 77 | void on_messageEdit_returnPressed(); |
| 78 | void on_contactMethodComboBox_currentIndexChanged(const QString& number); |
Edric Milaret | fa05d97 | 2016-01-13 16:22:04 -0500 | [diff] [blame] | 79 | void on_ringContactLineEdit_textEdited(const QString& text); |
Edric Milaret | a0ebd06 | 2016-01-13 12:18:23 -0500 | [diff] [blame] | 80 | void on_imBackButton_clicked(); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 81 | |
| 82 | private slots: |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 83 | void callIncoming(Call* call); |
| 84 | void addedCall(Call* call, Call* parent); |
| 85 | void callStateChanged(Call* call, Call::State previousState); |
Edric Milaret | 67007d1 | 2015-05-07 09:40:09 -0400 | [diff] [blame] | 86 | void findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 87 | void smartListSelectionChanged(const QItemSelection& newSel, const QItemSelection& oldSel); |
Edric Milaret | ab12d02 | 2015-12-04 16:09:44 -0500 | [diff] [blame] | 88 | void slotAccountMessageReceived(const QMap<QString,QString> message,ContactMethod* cm,Media::Media::Direction dir); |
Edric Milaret | d8528fa | 2015-07-07 14:13:51 -0400 | [diff] [blame] | 89 | |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 90 | private: |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 91 | Ui::CallWidget* ui; |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 92 | Call* actualCall_; |
| 93 | Video::Renderer* videoRenderer_; |
| 94 | CallModel* callModel_; |
| 95 | int outputVolume_; |
| 96 | int inputVolume_; |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 97 | QMenu* menu_; |
| 98 | ContactDelegate* contactDelegate_; |
| 99 | HistoryDelegate* historyDelegate_; |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 100 | SmartListDelegate* smartListDelegate_; |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 101 | QModelIndex highLightedIndex_; |
Edric Milaret | ab12d02 | 2015-12-04 16:09:44 -0500 | [diff] [blame] | 102 | ImDelegate* imDelegate_; |
| 103 | QMetaObject::Connection imConnection_; |
Nicolas Jager | ca85029 | 2016-01-17 14:11:10 -0500 | [diff] [blame^] | 104 | QPropertyAnimation* messagingPageAnim_; |
| 105 | QPropertyAnimation* welcomePageAnim_; |
| 106 | |
| 107 | constexpr static int animDuration_ = 200; //msecs |
Edric Milaret | 01f2384 | 2015-06-22 14:46:01 -0400 | [diff] [blame] | 108 | |
Edric Milaret | 7d40a4a | 2015-05-13 13:01:15 -0400 | [diff] [blame] | 109 | private: |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 110 | void findRingAccount(); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 111 | void setActualCall(Call* value); |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 112 | void placeCall(); |
Edric Milaret | a0ebd06 | 2016-01-13 12:18:23 -0500 | [diff] [blame] | 113 | void setupOutOfCallIM(); |
| 114 | void setupSmartListMenu(); |
Nicolas Jager | ca85029 | 2016-01-17 14:11:10 -0500 | [diff] [blame^] | 115 | void slideToLeft(QPropertyAnimation* anim, QWidget* widget); |
| 116 | void slideToRight(QPropertyAnimation* anim, QWidget* widget); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 117 | }; |
| 118 | |