| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
#ifndef VIDGUI_H_ |
| 19 |
#define VIDGUI_H_ |
| 20 |
|
| 21 |
#include <QApplication> |
| 22 |
#include <QCheckBox> |
| 23 |
#include <QFont> |
| 24 |
#include <QLabel> |
| 25 |
#include <QLineEdit> |
| 26 |
#include <QMainWindow> |
| 27 |
#include <QObject> |
| 28 |
#include <QPushButton> |
| 29 |
#include <QStatusBar> |
| 30 |
#include <QTextEdit> |
| 31 |
#include <QVBoxLayout> |
| 32 |
#include <QWidget> |
| 33 |
|
| 34 |
#include <pjsua.h> |
| 35 |
|
| 36 |
class VidWin; |
| 37 |
|
| 38 |
class MainWin : public QWidget |
| 39 |
{ |
| 40 |
Q_OBJECT |
| 41 |
|
| 42 |
public: |
| 43 |
MainWin(QWidget *parent = 0); |
| 44 |
virtual ~MainWin(); |
| 45 |
|
| 46 |
static MainWin *instance(); |
| 47 |
|
| 48 |
bool initStack(); |
| 49 |
void showError(const char *title, pj_status_t status); |
| 50 |
void showStatus(const char *msg); |
| 51 |
|
| 52 |
void on_reg_state(pjsua_acc_id acc_id); |
| 53 |
void on_call_state(pjsua_call_id call_id, pjsip_event *e); |
| 54 |
void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata); |
| 55 |
void on_call_media_state(pjsua_call_id call_id); |
| 56 |
|
| 57 |
signals: |
| 58 |
void signalNewCall(int, bool); |
| 59 |
void signalCallReleased(); |
| 60 |
void signalInitVideoWindow(); |
| 61 |
void signalShowStatus(const QString&); |
| 62 |
|
| 63 |
public slots: |
| 64 |
void preview(); |
| 65 |
void call(); |
| 66 |
void hangup(); |
| 67 |
void quit(); |
| 68 |
void onVidEnabledChanged(int state); |
| 69 |
|
| 70 |
void onNewCall(int cid, bool incoming); |
| 71 |
void onCallReleased(); |
| 72 |
void initVideoWindow(); |
| 73 |
void doShowStatus(const QString& msg); |
| 74 |
|
| 75 |
private: |
| 76 |
static MainWin *theInstance_; |
| 77 |
pjsua_acc_id accountId_; |
| 78 |
pjsua_call_id currentCall_; |
| 79 |
bool preview_on; |
| 80 |
|
| 81 |
private: |
| 82 |
QPushButton *callButton_, |
| 83 |
*hangupButton_, |
| 84 |
*quitButton_, |
| 85 |
*previewButton_; |
| 86 |
QCheckBox *vidEnabled_; |
| 87 |
QLineEdit *url_; |
| 88 |
VidWin *video_; |
| 89 |
VidWin *video_prev_; |
| 90 |
|
| 91 |
QLabel *statusBar_; |
| 92 |
QLabel *localUri_; |
| 93 |
|
| 94 |
QVBoxLayout *vbox_left; |
| 95 |
|
| 96 |
void initLayout(); |
| 97 |
}; |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
#endif |