summaryrefslogtreecommitdiff
path: root/noncore/net/linphone/qlinphone.h
Unidiff
Diffstat (limited to 'noncore/net/linphone/qlinphone.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/linphone/qlinphone.h138
1 files changed, 138 insertions, 0 deletions
diff --git a/noncore/net/linphone/qlinphone.h b/noncore/net/linphone/qlinphone.h
new file mode 100644
index 0000000..4192a4c
--- a/dev/null
+++ b/noncore/net/linphone/qlinphone.h
@@ -0,0 +1,138 @@
1/***************************************************************************
2 qlinphone.h - description
3 -------------------
4 begin : sam mai 24 2003
5 copyright : (C) 2003 by Simon Morlat, 2004 Maximilian Reiss
6 email : simon.morlat@linphone.org, harlekin@handhelds.org
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifdef HAVE_CONFIG_H
19#include <config.h>
20#endif
21#include "mainwidget.h"
22#include <qobject.h>
23#include <qpushbutton.h>
24#include <qqueue.h>
25#include <pthread.h>
26
27class GuiTask {
28public:
29 GuiTask(QWidget *w) {
30 _w=w;
31 }
32 virtual void execute()=0;
33 virtual ~GuiTask() {}
34 ;
35protected:
36 QWidget *_w;
37};
38
39class ShowTask: public GuiTask {
40public:
41ShowTask(QWidget *w) : GuiTask(w) {}
42 ;
43private:
44 void execute() {
45 _w->show();
46 }
47};
48
49class DisplaySomethingTask : public GuiTask {
50public:
51DisplaySomethingTask(QWidget* w,QString &msg): GuiTask(w) {
52 _msg=msg;
53 }
54protected:
55 QString _msg;
56};
57
58class UpdateStatusBarTask : public DisplaySomethingTask {
59public:
60UpdateStatusBarTask(QWidget *w,QString &msg) :DisplaySomethingTask(w,msg) {}
61 ;
62private:
63 void execute();
64};
65
66class InviteReceivedTask : public DisplaySomethingTask {
67public:
68InviteReceivedTask(QWidget *w,QString &msg) :DisplaySomethingTask(w,msg) {}
69 ;
70private:
71 void execute();
72};
73
74class DisplayMessageTask : public DisplaySomethingTask {
75public:
76 enum MessageType{Info,Warn};
77DisplayMessageTask(QWidget *w,QString &msg,MessageType type) : DisplaySomethingTask(w,msg) {
78 _msgtype=type;
79 };
80private:
81 void execute();
82 MessageType _msgtype;
83};
84
85
86
87typedef struct _LinphoneCore LinphoneCore;
88
89class MyMutex {
90public:
91 MyMutex() {
92 pthread_mutex_init(&_mutex,NULL);
93 }
94 void lock() {
95 pthread_mutex_lock(&_mutex);
96 }
97 void unlock() {
98 pthread_mutex_unlock(&_mutex);
99 }
100 ~MyMutex() {
101 pthread_mutex_destroy(&_mutex);
102 }
103private:
104 pthread_mutex_t _mutex;
105};
106
107class QLinphoneMainWidget : public _QLinphoneMainWidget {
108
109Q_OBJECT
110
111public:
112 QLinphoneMainWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
113 ~QLinphoneMainWidget();
114
115
116 void callOrAccept();
117 void terminateCall();
118 void inviteReceived(QString &from);
119 void displayStatus(QString &status);
120 void helpAbout();
121 // make it private
122 void createLinphoneCore();
123 void pushGuiTask(GuiTask* g);
124
125private slots:
126 void slotHide( bool show );
127
128private:
129 void readConfig();
130 void writeConfig();
131 void processGuiTasks();
132 void timerEvent(QTimerEvent *);
133 LinphoneCore *_core;
134 QQueue<GuiTask> _actionq;
135 MyMutex _mutex;
136};
137
138