blob: 1cc27462f00025ecdeaacbff387ac1cfdbb000b4 [file] [log] [blame]
Tristan Matthews0a329cc2013-07-17 13:20:14 -04001/* $Id$ */
2/*
3 * Copyright (C) 2011-2011 Teluu Inc. (http://www.teluu.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 2 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, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef VIDGUI_H_
20#define VIDGUI_H_
21
22#include <QApplication>
23#include <QCheckBox>
24#include <QFont>
25#include <QLabel>
26#include <QLineEdit>
27#include <QMainWindow>
28#include <QObject>
29#include <QPushButton>
30#include <QStatusBar>
31#include <QTextEdit>
32#include <QVBoxLayout>
33#include <QWidget>
34
35#include <pjsua.h>
36
37class VidWin;
38
39class MainWin : public QWidget
40{
41 Q_OBJECT
42
43public:
44 MainWin(QWidget *parent = 0);
45 virtual ~MainWin();
46
47 static MainWin *instance();
48
49 bool initStack();
50 void showError(const char *title, pj_status_t status);
51 void showStatus(const char *msg);
52
53 void on_reg_state(pjsua_acc_id acc_id);
54 void on_call_state(pjsua_call_id call_id, pjsip_event *e);
55 void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata);
56 void on_call_media_state(pjsua_call_id call_id);
57
58signals:
59 void signalNewCall(int, bool);
60 void signalCallReleased();
61 void signalInitVideoWindow();
62 void signalShowStatus(const QString&);
63
64public slots:
65 void preview();
66 void call();
67 void hangup();
68 void quit();
69 void onVidEnabledChanged(int state);
70
71 void onNewCall(int cid, bool incoming);
72 void onCallReleased();
73 void initVideoWindow();
74 void doShowStatus(const QString& msg);
75
76private:
77 static MainWin *theInstance_;
78 pjsua_acc_id accountId_;
79 pjsua_call_id currentCall_;
80 bool preview_on;
81
82private:
83 QPushButton *callButton_,
84 *hangupButton_,
85 *quitButton_,
86 *previewButton_;
87 QCheckBox *vidEnabled_;
88 QLineEdit *url_;
89 VidWin *video_;
90 VidWin *video_prev_;
91 //QStatusBar *statusBar_;
92 QLabel *statusBar_;
93 QLabel *localUri_;
94
95 QVBoxLayout *vbox_left;
96
97 void initLayout();
98};
99
100
101
102#endif /* VIDGUI_H_ */