Olivier SOLDANO | 47aa97f | 2017-04-04 10:40:00 -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 * |
Olivier SOLDANO | 47aa97f | 2017-04-04 10:40:00 -0400 | [diff] [blame] | 3 | * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>* |
| 4 | * Author: Anthony Léonard <anthony.leonard@savoirfairelinux.com> * |
| 5 | * Author: Olivier Soldano <olivier.soldano@savoirfairelinux.com> * |
| 6 | * * |
| 7 | * This program is free software; you can redistribute it and/or modify * |
| 8 | * it under the terms of the GNU General Public License as published by * |
| 9 | * the Free Software Foundation; either version 3 of the License, or * |
| 10 | * (at your option) any later version. * |
| 11 | * * |
| 12 | * This program is distributed in the hope that it will be useful, * |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 15 | * GNU General Public License for more details. * |
| 16 | * * |
| 17 | * You should have received a copy of the GNU General Public License * |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * |
| 19 | **************************************************************************/ |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 20 | |
Edric Milaret | 5f316da | 2015-09-28 11:57:42 -0400 | [diff] [blame] | 21 | #pragma once |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 22 | |
| 23 | #include <QWidget> |
Edric Milaret | 67007d1 | 2015-05-07 09:40:09 -0400 | [diff] [blame] | 24 | #include <QVector> |
| 25 | #include <QString> |
Edric Milaret | 7d40a4a | 2015-05-13 13:01:15 -0400 | [diff] [blame] | 26 | #include <QMenu> |
Edric Milaret | 029b95a | 2015-06-09 09:51:44 -0400 | [diff] [blame] | 27 | #include <QItemSelection> |
Edric Milaret | c7ab550 | 2015-06-15 11:18:02 -0400 | [diff] [blame] | 28 | #include <QMovie> |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 29 | |
| 30 | #include "navwidget.h" |
Edric Milaret | cdc978b | 2015-06-04 11:25:12 -0400 | [diff] [blame] | 31 | #include "instantmessagingwidget.h" |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 32 | |
| 33 | #include "callmodel.h" |
| 34 | #include "video/renderer.h" |
| 35 | #include "video/previewmanager.h" |
Edric Milaret | e5afb07 | 2015-06-02 16:45:44 -0400 | [diff] [blame] | 36 | #include "accountmodel.h" |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 37 | #include "categorizedhistorymodel.h" |
Edric Milaret | 00a3225 | 2016-01-19 10:37:13 -0500 | [diff] [blame] | 38 | #include "media/textrecording.h" |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 39 | |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 40 | class SmartListDelegate; |
Edric Milaret | ab12d02 | 2015-12-04 16:09:44 -0500 | [diff] [blame] | 41 | class ImDelegate; |
Nicolas Jager | ca85029 | 2016-01-17 14:11:10 -0500 | [diff] [blame] | 42 | class QPropertyAnimation; |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 43 | |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 44 | namespace Ui { |
| 45 | class CallWidget; |
| 46 | } |
| 47 | |
| 48 | class CallWidget : public NavWidget |
| 49 | { |
| 50 | Q_OBJECT |
| 51 | |
| 52 | public: |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 53 | explicit CallWidget(QWidget* parent = 0); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 54 | ~CallWidget(); |
| 55 | void atExit(); |
Anthony Léonard | 314c2a4 | 2016-10-20 10:39:56 -0400 | [diff] [blame] | 56 | void findRingAccount(); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 57 | |
Edric Milaret | 33cb483 | 2016-01-08 10:14:14 -0500 | [diff] [blame] | 58 | public slots: |
Nicolas Jager | 74fe46f | 2016-02-29 14:55:09 -0500 | [diff] [blame] | 59 | void settingsButtonClicked(); |
Nicolas Jager | 74fe46f | 2016-02-29 14:55:09 -0500 | [diff] [blame] | 60 | void showIMOutOfCall(const QModelIndex& nodeIdx); |
Olivier SOLDANO | dd87866 | 2017-03-27 16:00:06 -0400 | [diff] [blame] | 61 | void configureSendCRPageButton(const QModelIndex& nodeIdx); |
Nicolas Jager | 74fe46f | 2016-02-29 14:55:09 -0500 | [diff] [blame] | 62 | void btnComBarVideoClicked(); |
| 63 | |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 64 | //UI SLOTS |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 65 | public slots: |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 66 | void on_ringContactLineEdit_returnPressed(); |
Olivier SOLDANO | 47aa97f | 2017-04-04 10:40:00 -0400 | [diff] [blame] | 67 | inline void on_entered(const QModelIndex& i){highLightedIndex_ = i;} |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 68 | |
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(); |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 72 | void on_cancelButton_clicked(); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 73 | void on_smartList_doubleClicked(const QModelIndex& index); |
Edric Milaret | 6a785af | 2016-03-07 15:39:30 -0500 | [diff] [blame] | 74 | void on_sendIMButton_clicked(); |
| 75 | void on_imMessageEdit_returnPressed(); |
Edric Milaret | ab12d02 | 2015-12-04 16:09:44 -0500 | [diff] [blame] | 76 | void on_contactMethodComboBox_currentIndexChanged(const QString& number); |
Edric Milaret | 8001f6f | 2016-01-27 09:55:12 -0500 | [diff] [blame] | 77 | void on_ringContactLineEdit_textChanged(const QString& text); |
Edric Milaret | a0ebd06 | 2016-01-13 12:18:23 -0500 | [diff] [blame] | 78 | void on_imBackButton_clicked(); |
Edric Milaret | 7cf39e2 | 2016-02-02 12:44:03 -0500 | [diff] [blame] | 79 | void on_copyCMButton_clicked(); |
Olivier SOLDANO | dd87866 | 2017-03-27 16:00:06 -0400 | [diff] [blame] | 80 | void on_sendContactRequestPageButton_clicked(); |
| 81 | void on_sendCRBackButton_clicked(); |
Edric Milaret | 6b68a48 | 2016-02-01 15:23:44 -0500 | [diff] [blame] | 82 | void on_smartList_clicked(const QModelIndex &index); |
Edric Milaret | 1e59859 | 2016-09-02 10:10:01 -0400 | [diff] [blame] | 83 | void on_qrButton_toggled(bool checked); |
Edric Milaret | 4097d2f | 2016-02-09 14:41:50 -0500 | [diff] [blame] | 84 | void on_shareButton_clicked(); |
Anthony Léonard | d47179c | 2017-03-28 10:39:10 -0400 | [diff] [blame] | 85 | void on_pendingCRBackButton_clicked(); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 86 | |
| 87 | private slots: |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 88 | void callIncoming(Call* call); |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 89 | void callStateChanged(Call* call, Call::State previousState); |
Olivier SOLDANO | 61065ec | 2016-11-11 16:31:34 -0500 | [diff] [blame] | 90 | void smartListCurrentChanged(const QModelIndex ¤tIdx, const QModelIndex &previousIdx); |
Anthony Léonard | d47179c | 2017-03-28 10:39:10 -0400 | [diff] [blame] | 91 | void contactReqListCurrentChanged(const QModelIndex ¤tIdx, const QModelIndex &previousIdx); |
Edric Milaret | ab12d02 | 2015-12-04 16:09:44 -0500 | [diff] [blame] | 92 | void slotAccountMessageReceived(const QMap<QString,QString> message,ContactMethod* cm,Media::Media::Direction dir); |
Edric Milaret | 00a3225 | 2016-01-19 10:37:13 -0500 | [diff] [blame] | 93 | void onIncomingMessage(::Media::TextRecording* t, ContactMethod* cm); |
Edric Milaret | 00d34f2 | 2016-05-09 16:30:29 -0400 | [diff] [blame] | 94 | void callChangedSlot(); |
Anthony Léonard | d47179c | 2017-03-28 10:39:10 -0400 | [diff] [blame] | 95 | void contactLineEdit_registeredNameFound(Account *account, NameDirectory::LookupStatus status, const QString& address, const QString& name); |
Olivier SOLDANO | 47aa97f | 2017-04-04 10:40:00 -0400 | [diff] [blame] | 96 | void searchBtnClicked(); |
Anthony Léonard | d47179c | 2017-03-28 10:39:10 -0400 | [diff] [blame] | 97 | void selectedAccountChanged(const QModelIndex ¤t, const QModelIndex &previous); |
Edric Milaret | d8528fa | 2015-07-07 14:13:51 -0400 | [diff] [blame] | 98 | |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 99 | private: |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 100 | Ui::CallWidget* ui; |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 101 | Call* actualCall_; |
| 102 | Video::Renderer* videoRenderer_; |
| 103 | CallModel* callModel_; |
| 104 | int outputVolume_; |
| 105 | int inputVolume_; |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 106 | QMenu* menu_; |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 107 | SmartListDelegate* smartListDelegate_; |
Edric Milaret | 6b68a48 | 2016-02-01 15:23:44 -0500 | [diff] [blame] | 108 | QPersistentModelIndex highLightedIndex_; |
Edric Milaret | ab12d02 | 2015-12-04 16:09:44 -0500 | [diff] [blame] | 109 | ImDelegate* imDelegate_; |
| 110 | QMetaObject::Connection imConnection_; |
Edric Milaret | 4913047 | 2016-01-22 10:39:37 -0500 | [diff] [blame] | 111 | QMetaObject::Connection imVisibleConnection_; |
Edric Milaret | 00d34f2 | 2016-05-09 16:30:29 -0400 | [diff] [blame] | 112 | QMetaObject::Connection callChangedConnection_; |
Edric Milaret | 70ae878 | 2016-04-18 16:10:44 -0400 | [diff] [blame] | 113 | QMetaObject::Connection imClickedConnection_; |
Anthony Léonard | d47179c | 2017-03-28 10:39:10 -0400 | [diff] [blame] | 114 | QMetaObject::Connection crListSelectionConnection_; |
Edric Milaret | 6b68a48 | 2016-02-01 15:23:44 -0500 | [diff] [blame] | 115 | QPropertyAnimation* pageAnim_; |
Edric Milaret | e19c4cd | 2016-02-12 10:19:44 -0500 | [diff] [blame] | 116 | QMenu* shareMenu_; |
Nicolas Jager | ca85029 | 2016-01-17 14:11:10 -0500 | [diff] [blame] | 117 | |
| 118 | constexpr static int animDuration_ = 200; //msecs |
Edric Milaret | 6d0e531 | 2016-04-04 16:30:22 -0400 | [diff] [blame] | 119 | constexpr static int qrSize_ = 200; |
Edric Milaret | 01f2384 | 2015-06-22 14:46:01 -0400 | [diff] [blame] | 120 | |
Edric Milaret | 7d40a4a | 2015-05-13 13:01:15 -0400 | [diff] [blame] | 121 | private: |
Nicolas Jager | 97a21b4 | 2015-12-03 16:55:45 -0500 | [diff] [blame] | 122 | void setActualCall(Call* value); |
Edric Milaret | ed0b280 | 2015-10-01 15:10:02 -0400 | [diff] [blame] | 123 | void placeCall(); |
Edric Milaret | a0ebd06 | 2016-01-13 12:18:23 -0500 | [diff] [blame] | 124 | void setupOutOfCallIM(); |
| 125 | void setupSmartListMenu(); |
Edric Milaret | 6b68a48 | 2016-02-01 15:23:44 -0500 | [diff] [blame] | 126 | void slidePage(QWidget* widget, bool toRight = false); |
| 127 | void callStateToView(Call* value); |
Anthony Léonard | a86a897 | 2016-12-15 10:33:47 -0500 | [diff] [blame] | 128 | void setupQRCode(QString ringID); |
Anthony Léonard | aa90e1a | 2016-10-12 11:24:17 -0400 | [diff] [blame] | 129 | void searchContactLineEditEntry(const URI &uri); |
Olivier SOLDANO | dd87866 | 2017-03-27 16:00:06 -0400 | [diff] [blame] | 130 | bool uriNeedNameLookup(const URI uri_passed); |
Olivier SOLDANO | 47aa97f | 2017-04-04 10:40:00 -0400 | [diff] [blame] | 131 | void processContactLineEdit(); |
Edric Milaret | 627500d | 2015-03-27 16:41:40 -0400 | [diff] [blame] | 132 | }; |