blob: 8f25f7c7f67aa37f6b1e05732d5888e72d814ee6 [file] [log] [blame]
Edric Milaret627500d2015-03-27 16:41:40 -04001/***************************************************************************
Edric Milaretbab169d2016-01-07 15:13:33 -05002 * Copyright (C) 2015-2016 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
21#include <QWidget>
Edric Milaret67007d12015-05-07 09:40:09 -040022#include <QVector>
23#include <QString>
Edric Milaret7d40a4a2015-05-13 13:01:15 -040024#include <QMenu>
Edric Milaret029b95a2015-06-09 09:51:44 -040025#include <QItemSelection>
Edric Milaretc7ab5502015-06-15 11:18:02 -040026#include <QMovie>
Edric Milaret627500d2015-03-27 16:41:40 -040027
28#include "navwidget.h"
Edric Milaretcdc978b2015-06-04 11:25:12 -040029#include "instantmessagingwidget.h"
Edric Milaret627500d2015-03-27 16:41:40 -040030
31#include "callmodel.h"
32#include "video/renderer.h"
33#include "video/previewmanager.h"
Edric Milarete5afb072015-06-02 16:45:44 -040034#include "accountmodel.h"
Edric Milaret627500d2015-03-27 16:41:40 -040035#include "categorizedhistorymodel.h"
Edric Milaret627500d2015-03-27 16:41:40 -040036
Edric Milareted0b2802015-10-01 15:10:02 -040037class ContactDelegate;
38class HistoryDelegate;
39class SmartListDelegate;
Edric Milaretab12d022015-12-04 16:09:44 -050040class ImDelegate;
Edric Milareted0b2802015-10-01 15:10:02 -040041
Edric Milaret627500d2015-03-27 16:41:40 -040042namespace Ui {
43class CallWidget;
44}
45
46class CallWidget : public NavWidget
47{
48 Q_OBJECT
49
50public:
Nicolas Jager97a21b42015-12-03 16:55:45 -050051 explicit CallWidget(QWidget* parent = 0);
Edric Milaret627500d2015-03-27 16:41:40 -040052 ~CallWidget();
53 void atExit();
54
Edric Milaret33cb4832016-01-08 10:14:14 -050055public slots:
56 void contactButton_clicked(bool checked);
57 void settingsButton_clicked();
58 void historicButton_clicked(bool checked);
Edric Milaret627500d2015-03-27 16:41:40 -040059//UI SLOTS
Nicolas Jager97a21b42015-12-03 16:55:45 -050060public slots:
Nicolas Jager97a21b42015-12-03 16:55:45 -050061 void on_ringContactLineEdit_returnPressed();
62 void on_btnCall_clicked();
63 void on_btnvideo_clicked();
Edric Milaretab12d022015-12-04 16:09:44 -050064 void on_btnchat_clicked();
Nicolas Jager97a21b42015-12-03 16:55:45 -050065 inline void on_entered(const QModelIndex& i){highLightedIndex_ = i;};
66
67//UI SLOTS
Edric Milaret627500d2015-03-27 16:41:40 -040068private slots:
69 void on_acceptButton_clicked();
70 void on_refuseButton_clicked();
Nicolas Jager97a21b42015-12-03 16:55:45 -050071 void on_contactView_doubleClicked(const QModelIndex& index);
Edric Milareted0b2802015-10-01 15:10:02 -040072 void on_cancelButton_clicked();
Nicolas Jager97a21b42015-12-03 16:55:45 -050073 void on_smartList_doubleClicked(const QModelIndex& index);
74 void on_historyList_doubleClicked(const QModelIndex& index);
Edric Milaretab12d022015-12-04 16:09:44 -050075 void on_sendButton_clicked();
76 void on_messageEdit_returnPressed();
77 void on_contactMethodComboBox_currentIndexChanged(const QString& number);
Edric Milaretfa05d972016-01-13 16:22:04 -050078 void on_ringContactLineEdit_textEdited(const QString& text);
Edric Milaret627500d2015-03-27 16:41:40 -040079
80private slots:
Nicolas Jager97a21b42015-12-03 16:55:45 -050081 void callIncoming(Call* call);
82 void addedCall(Call* call, Call* parent);
83 void callStateChanged(Call* call, Call::State previousState);
Edric Milaret67007d12015-05-07 09:40:09 -040084 void findRingAccount(QModelIndex idx1, QModelIndex idx2, QVector<int> vec);
Nicolas Jager97a21b42015-12-03 16:55:45 -050085 void smartListSelectionChanged(const QItemSelection& newSel, const QItemSelection& oldSel);
Edric Milaretab12d022015-12-04 16:09:44 -050086 void slotAccountMessageReceived(const QMap<QString,QString> message,ContactMethod* cm,Media::Media::Direction dir);
Edric Milaretd8528fa2015-07-07 14:13:51 -040087
Edric Milaret627500d2015-03-27 16:41:40 -040088private:
Nicolas Jager97a21b42015-12-03 16:55:45 -050089 Ui::CallWidget* ui;
Edric Milaret627500d2015-03-27 16:41:40 -040090 Call* actualCall_;
91 Video::Renderer* videoRenderer_;
92 CallModel* callModel_;
93 int outputVolume_;
94 int inputVolume_;
Nicolas Jager97a21b42015-12-03 16:55:45 -050095 QMenu* menu_;
96 ContactDelegate* contactDelegate_;
97 HistoryDelegate* historyDelegate_;
Edric Milareted0b2802015-10-01 15:10:02 -040098 SmartListDelegate* smartListDelegate_;
Nicolas Jager97a21b42015-12-03 16:55:45 -050099 QModelIndex highLightedIndex_;
Edric Milaretab12d022015-12-04 16:09:44 -0500100 ImDelegate* imDelegate_;
101 QMetaObject::Connection imConnection_;
Edric Milaret01f23842015-06-22 14:46:01 -0400102
Edric Milaret7d40a4a2015-05-13 13:01:15 -0400103private:
Edric Milaret627500d2015-03-27 16:41:40 -0400104 void findRingAccount();
Nicolas Jager97a21b42015-12-03 16:55:45 -0500105 void setActualCall(Call* value);
Edric Milareted0b2802015-10-01 15:10:02 -0400106 void placeCall();
Edric Milaret627500d2015-03-27 16:41:40 -0400107};
108