-
Notifications
You must be signed in to change notification settings - Fork 0
/
callwidget.h
128 lines (112 loc) · 3.74 KB
/
callwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* $Id: callwidget.h */
/*
* Copyright (C) 2012-2014 Dmytro Mishchenko <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CALLWIDGET_H
#define CALLWIDGET_H
#include "cdr.h"
#include "ui_call.h"
#include <QWidget>
class QTimer;
namespace Ui {
class CallWidget;
}
class CallWidget : public QWidget
{
Q_OBJECT
public:
// Invite session state, as in enum pjsip_inv_state
enum CallState {
INV_NULL,
INV_CALLING,
INV_INCOMING,
INV_EARLY,
INV_CONNECTING,
INV_CONFIRMED,
INV_DISCONNECTED
};
explicit CallWidget(int call_id, int transfereeCallId, const QString &state,
const QString &contactName, const QString &contactNumber,
const QString &contactIcon,
QWidget *parent = 0);
~CallWidget();
QString getNumber() const;
int getCallId() const { return callId; }
int getTransfereeCallId() const { return transfereeCallId; }
void setCallId(int id) { callId = id; }
protected:
void mouseReleaseEvent (QMouseEvent *event);
void mousePressEvent (QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
private:
Ui::CallWidget *ui;
CallState callState;
QString name;
QString number;
QString iconPath;
int callId;
int transfereeCallId;
QTimer *durationTimer;
Cdr cdr;
bool isEarlyRing;
bool isMuted;
bool isOnHold;
bool isActive;
bool isInConf;
bool isRecorded;
bool autoRecord;
bool isOnSpeaker;
// member variable to store click position
QPoint m_lastPoint;
// member variable - flag of click beginning
bool m_mouseClick;
bool dtmfSent;
void applyPropery(QWidget *w, const char *name, const QVariant &value);
void setHangupBtnState();
void setBtnState();
void setCallStatusMsg();
void setCallStatusMsg(const QString msg, const QString &logLevel);
void setName(const QString &n);
void setNumber(const QString &num);
signals:
void callBtnClicked(const QString &btnName, int id);
void sendDTMF(int callId, const QString &key);
void callEnd(const Cdr &);
void mouseClickEvent();
void callSelected(int);
void addToConf(int, int);
void redial();
public slots:
void buttonClicked();
void buttonClicked(const QString &btn);
void setPjCallState(int call_id, const QString &state,
const QString &last_status,
const QString &last_status_text,
bool ring);
void setPjMediaState(int call_id, int);
void updateDuration();
void onCallActivate(int);
void onCallInConf(int call_id, bool inConf);
void onCallRecorded(int call_id, const QString &fn, bool rec);
void onZrtpStatusSecureOn(int call_id, const QString &cipher);
void onZrtpStatusSecureOff(int call_id);
void onZrtpStatusShowSas(int call_id, const QString &sas, int verified);
};
#endif // CALLWIDGET_H