summaryrefslogtreecommitdiffstats
path: root/src/gui/mphoneform.h
blob: 508072d5e26df74c6774a5ce559de1c90e5b221e (plain)
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#ifndef MPHONEFORM_UI_H
#define MPHONEFORM_UI_H
#include <QMainWindow>
#include "ui_mphoneform.h"
#include "phone.h"
#include "dtmfform.h"
#include "inviteform.h"
#include "redirectform.h"
#include "termcapform.h"
#include "srvredirectform.h"
#include "userprofileform.h"
#include "transferform.h"
#include "syssettingsform.h"
#include "logviewform.h"
#include "historyform.h"
#include "selectuserform.h"
#include "selectprofileform.h"
#include <QEvent>
#include <QMenu>
#include <QSystemTrayIcon>
#include "im/msg_session.h"
#include "messageformview.h"
#include "buddylistview.h"
#include "diamondcard.h"

class t_phone;
extern t_phone *phone;

class OSD;
class IncomingCallPopup;

class MphoneForm : public QMainWindow, public Ui::MphoneForm
{
Q_OBJECT
public:
    MphoneForm(QWidget* parent = 0);
	~MphoneForm();

public:
	QString getMWIStatus( const t_mwi & mwi, bool & msg_waiting ) const;
	QSystemTrayIcon * getSysTray();
	bool getViewDisplay();
	bool getViewBuddyList();
	bool getViewCompactLineStatus();
protected:
	virtual void closeEvent( QCloseEvent * e ) override;
	virtual bool event(QEvent * event) override;
public slots:
	void fileExit();
	void display( const QString & s );
	void displayHeader();
	void showLineTimer( int line );
	void showLineTimer1();
	void showLineTimer2();
	void updateLineTimer( int line );
	void updateLineEncryptionState( int line );
	void updateLineStatus( int line );
	void updateState();
	void updateRegStatus();
	void flashMWI();
	void updateMwi();
	void updateServicesStatus();
	void updateMissedCallStatus( int num_missed_calls );
	void updateSysTrayStatus();
	void updateMenuStatus();
	void updateDiamondcardMenu();
    void removeDiamondcardAction( QAction* & id );
    void removeDiamondcardMenu( QMenu * & menu );
	void phoneRegister();
	void do_phoneRegister( list<t_user *> user_list );
	void phoneDeregister();
	void do_phoneDeregister( list<t_user *> user_list );
	void phoneDeregisterAll();
	void do_phoneDeregisterAll( list<t_user *> user_list );
	void phoneShowRegistrations();
	void phoneInvite( t_user * user_config, const QString & dest, const QString & subject, bool anonymous );
	void phoneInvite( const QString & dest, const QString & subject, bool anonymous );
	void phoneInvite();
	void do_phoneInvite( t_user * user_config, const QString & display, const t_url & destination, const QString & subject, bool anonymous );
	void phoneRedial( void );
	void phoneAnswer();
	void phoneAnswerFromSystrayPopup();
	void phoneBye();
	void phoneReject();
	void phoneRejectFromSystrayPopup();
	void phoneRedirect( const list<string> & contacts );
	void phoneRedirect();
	void do_phoneRedirect( const list<t_display_url> & destinations );
	void phoneTransfer( const string & dest, t_transfer_type transfer_type );
	void phoneTransfer();
	void do_phoneTransfer( const t_display_url & destination, t_transfer_type transfer_type );
	void do_phoneTransferLine();
	void phoneHold( bool on );
	void phoneConference();
	void phoneMute( bool on );
	void phoneTermCap( const QString & dest );
	void phoneTermCap();
	void do_phoneTermCap( t_user * user_config, const t_url & destination );
	void phoneDTMF();
	void sendDTMF( const QString & digits );
	void startMessageSession( void );
	void startMessageSession( t_buddy * buddy );
	void phoneConfirmZrtpSas( int line );
	void phoneConfirmZrtpSas();
	void phoneResetZrtpSasConfirmation( int line );
	void phoneResetZrtpSasConfirmation();
	void phoneEnableZrtp( bool on );
	void phoneZrtpGoClearOk( unsigned short line );
	void line1rbChangedState( bool on );
	void line2rbChangedState( bool on );
	void actionLine1Toggled( bool on );
	void actionLine2Toggled( bool on );
	void srvDnd( bool on );
	void srvDnd();
	void do_srvDnd_enable( list<t_user *> user_list );
	void do_srvDnd_disable( list<t_user *> user_list );
	void srvAutoAnswer( bool on );
	void srvAutoAnswer();
	void do_srvAutoAnswer_enable( list<t_user *> user_list );
	void do_srvAutoAnswer_disable( list<t_user *> user_list );
	void srvRedirect();
	void do_srvRedirect( t_user * user_config, const list<t_display_url> & always, const list<t_display_url> & busy, const list<t_display_url> & noanswer );
	void about();
	void aboutQt();
	void manual();
	void editUserProfile();
	void editSysSettings();
	void selectProfile();
	void newUsers( const list<string> & profiles );
	void updateUserComboBox();
	void updateSipUdpPort();
	void updateRtpPorts();
	void updateStunSettings( t_user * user_config );
	void updateAuthCache( t_user * user_config, const string & realm );
	void unsubscribeMWI( t_user * user_config );
	void subscribeMWI( t_user * user_config );
	void viewLog();
	void updateLog( bool log_zapped );
	void viewHistory();
	void updateCallHistory();
	void quickCall();
	void addToCallComboBox( const QString & destination );
	void showAddressBook();
	void selectedAddress( const QString & address );
	void enableCallOptions( bool enable );
	virtual void keyPressEvent( QKeyEvent * e ) override;
	virtual void mouseReleaseEvent( QMouseEvent * e ) override;
	void processLeftMouseButtonRelease( QMouseEvent * e );
	void processRightMouseButtonRelease( QMouseEvent * e );
	void processCryptLabelClick( int line );
	void popupMenuVoiceMail( const QPoint & pos );
	void popupMenuVoiceMail( void );
	void showDisplay( bool on );
	void showBuddyList( bool on );
	void showCompactLineStatus( bool on );
	void populateBuddyList();
    void showBuddyListPopupMenu( const QPoint & pos );
	void doCallBuddy();
    void doMessageBuddy( QTreeWidgetItem * qitem );
	void doMessageBuddy();
	void doEditBuddy();
	void doDeleteBuddy();
	void doAddBuddy();
	void doAvailabilityOffline();
	void doAvailabilityOnline();
	void DiamondcardSignUp();
	void newDiamondcardUser( const QString & filename );
	void DiamondcardAction( t_dc_action action, int userIdx );
    void DiamondcardRecharge();
    void DiamondcardBalanceHistory();
    void DiamondcardCallHistory();
    void DiamondcardAdminCenter();
    void whatsThis();
	void sysTrayIconClicked(QSystemTrayIcon::ActivationReason);
	void toggleWindow();
	void updateTrayIconMenu();

	void osdMuteClicked();

private:
	void init();
	void destroy();
	bool shouldDisplayOSD();
	void updateOSD();
	QString lineSubstate2str( int line );

private:
	QTimer tmrFlashMWI;
	GetAddressForm *getAddressForm;
	SelectProfileForm *selectProfileForm;
	SelectUserForm *selectUserForm;
	HistoryForm *historyForm;
	TransferForm *transferForm;
	UserProfileForm *userProfileForm;
	SrvRedirectForm *srvRedirectForm;
	TermCapForm *termCapForm;
	RedirectForm *redirectForm;
	InviteForm *inviteForm;
	DtmfForm *dtmfForm;
	SysSettingsForm *sysSettingsForm;
	QStringList displayContents;
	LogViewForm *logViewForm;
	QSystemTrayIcon *sysTray;
	QTimer *lineTimer1;
	QTimer *lineTimer2;
	QTimer *hideLineTimer1;
	QTimer *hideLineTimer2;
	bool viewDisplay;
	bool viewCompactLineStatus;
	bool mwiFlashStatus;
    QMenu *buddyPopupMenu;
    QMenu *buddyListPopupMenu;
    QMenu *changeAvailabilityPopupMenu;
	bool viewBuddyList;
	OSD	*osdWindow;
	IncomingCallPopup *incomingCallPopup;
};

#endif