139 |
andreas |
1 |
/*
|
|
|
2 |
* Copyright (C) 2022 by Andreas Theofilu <andreas@theosys.at>
|
|
|
3 |
*
|
|
|
4 |
* This program is free software; you can redistribute it and/or modify
|
|
|
5 |
* it under the terms of the GNU General Public License as published by
|
|
|
6 |
* the Free Software Foundation; either version 3 of the License, or
|
|
|
7 |
* (at your option) any later version.
|
|
|
8 |
*
|
|
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
* GNU General Public License for more details.
|
|
|
13 |
*
|
|
|
14 |
* You should have received a copy of the GNU General Public License
|
|
|
15 |
* along with this program; if not, write to the Free Software Foundation,
|
|
|
16 |
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
17 |
*/
|
|
|
18 |
|
|
|
19 |
#ifndef __TQTPHONE_H__
|
|
|
20 |
#define __TQTPHONE_H__
|
|
|
21 |
|
|
|
22 |
#include <QDialog>
|
|
|
23 |
|
|
|
24 |
namespace Ui
|
|
|
25 |
{
|
|
|
26 |
class TQtPhone;
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
class TQtPhone : public QDialog
|
|
|
30 |
{
|
|
|
31 |
Q_OBJECT
|
|
|
32 |
|
|
|
33 |
public:
|
|
|
34 |
explicit TQtPhone(QWidget *parent = nullptr);
|
|
|
35 |
~TQtPhone();
|
|
|
36 |
|
|
|
37 |
void setScaleFactor(double sf) { mScaleFactor = sf; }
|
|
|
38 |
void doResize();
|
140 |
andreas |
39 |
void setPhoneNumber(const std::string& number);
|
|
|
40 |
void setPhoneStatus(const std::string& msg);
|
|
|
41 |
void setPhoneState(int state, int id);
|
139 |
andreas |
42 |
|
|
|
43 |
private slots:
|
|
|
44 |
void on_pushButton_0_clicked();
|
|
|
45 |
void on_pushButton_1_clicked();
|
|
|
46 |
void on_pushButton_2_clicked();
|
|
|
47 |
void on_pushButton_3_clicked();
|
|
|
48 |
void on_pushButton_4_clicked();
|
|
|
49 |
void on_pushButton_5_clicked();
|
|
|
50 |
void on_pushButton_6_clicked();
|
|
|
51 |
void on_pushButton_7_clicked();
|
|
|
52 |
void on_pushButton_8_clicked();
|
|
|
53 |
void on_pushButton_9_clicked();
|
|
|
54 |
void on_pushButton_Star_clicked();
|
|
|
55 |
void on_pushButton_Hash_clicked();
|
|
|
56 |
void on_pushButton_Clear_clicked();
|
|
|
57 |
void on_pushButton_Exit_clicked();
|
142 |
andreas |
58 |
void on_toolButton_Call_clicked();
|
139 |
andreas |
59 |
|
|
|
60 |
private:
|
140 |
andreas |
61 |
typedef enum SIP_STATE_t
|
|
|
62 |
{
|
|
|
63 |
SIP_NONE, // Undefined state (only valid on startup before initialisation)
|
|
|
64 |
SIP_IDLE, // Initialized but no event
|
|
|
65 |
SIP_CONNECTED, // Call is in progress
|
|
|
66 |
SIP_DISCONNECTED, // Call has ended
|
|
|
67 |
SIP_TRYING, // Trying to call someone
|
|
|
68 |
SIP_RINGING, // Phone is ringing (incoming call)
|
|
|
69 |
SIP_HOLD, // Active call is paused
|
|
|
70 |
SIP_REJECTED, // Outgoing call was rejected
|
|
|
71 |
SIP_ERROR // An error occured
|
|
|
72 |
}SIP_STATE_t;
|
|
|
73 |
|
139 |
andreas |
74 |
int scale(int value);
|
|
|
75 |
template <typename T>
|
|
|
76 |
void scaleObject(T *obj);
|
141 |
andreas |
77 |
std::string stateToString(SIP_STATE_t state);
|
139 |
andreas |
78 |
|
|
|
79 |
Ui::TQtPhone *ui{nullptr};
|
|
|
80 |
double mScaleFactor{1.0};
|
|
|
81 |
QString mNumber;
|
140 |
andreas |
82 |
std::map<unsigned int, SIP_STATE_t>mSIPstate; // <CALL ID, SIP STATE>
|
|
|
83 |
SIP_STATE_t mLastState{SIP_NONE};
|
139 |
andreas |
84 |
};
|
|
|
85 |
|
|
|
86 |
#endif
|