author | harlekin <harlekin> | 2004-02-22 23:38:58 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-02-22 23:38:58 (UTC) |
commit | 666a49773d06ac94c19996d763854725c2f7a578 (patch) (unidiff) | |
tree | c886c9373ed967ed5dfe468ac6260d4c5218c4d1 /noncore/net/linphone/qlinphone.h | |
parent | 2fc1e609a40a47df6a38256faccfee7916b59bbd (diff) | |
download | opie-666a49773d06ac94c19996d763854725c2f7a578.zip opie-666a49773d06ac94c19996d763854725c2f7a578.tar.gz opie-666a49773d06ac94c19996d763854725c2f7a578.tar.bz2 |
initial checkin of opie linphone, not really usefull yet, just to make sure I dont loose any data
Diffstat (limited to 'noncore/net/linphone/qlinphone.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/linphone/qlinphone.h | 138 |
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 | |||
27 | class GuiTask { | ||
28 | public: | ||
29 | GuiTask(QWidget *w) { | ||
30 | _w=w; | ||
31 | } | ||
32 | virtual void execute()=0; | ||
33 | virtual ~GuiTask() {} | ||
34 | ; | ||
35 | protected: | ||
36 | QWidget *_w; | ||
37 | }; | ||
38 | |||
39 | class ShowTask: public GuiTask { | ||
40 | public: | ||
41 | ShowTask(QWidget *w) : GuiTask(w) {} | ||
42 | ; | ||
43 | private: | ||
44 | void execute() { | ||
45 | _w->show(); | ||
46 | } | ||
47 | }; | ||
48 | |||
49 | class DisplaySomethingTask : public GuiTask { | ||
50 | public: | ||
51 | DisplaySomethingTask(QWidget* w,QString &msg): GuiTask(w) { | ||
52 | _msg=msg; | ||
53 | } | ||
54 | protected: | ||
55 | QString _msg; | ||
56 | }; | ||
57 | |||
58 | class UpdateStatusBarTask : public DisplaySomethingTask { | ||
59 | public: | ||
60 | UpdateStatusBarTask(QWidget *w,QString &msg) :DisplaySomethingTask(w,msg) {} | ||
61 | ; | ||
62 | private: | ||
63 | void execute(); | ||
64 | }; | ||
65 | |||
66 | class InviteReceivedTask : public DisplaySomethingTask { | ||
67 | public: | ||
68 | InviteReceivedTask(QWidget *w,QString &msg) :DisplaySomethingTask(w,msg) {} | ||
69 | ; | ||
70 | private: | ||
71 | void execute(); | ||
72 | }; | ||
73 | |||
74 | class DisplayMessageTask : public DisplaySomethingTask { | ||
75 | public: | ||
76 | enum MessageType{Info,Warn}; | ||
77 | DisplayMessageTask(QWidget *w,QString &msg,MessageType type) : DisplaySomethingTask(w,msg) { | ||
78 | _msgtype=type; | ||
79 | }; | ||
80 | private: | ||
81 | void execute(); | ||
82 | MessageType _msgtype; | ||
83 | }; | ||
84 | |||
85 | |||
86 | |||
87 | typedef struct _LinphoneCore LinphoneCore; | ||
88 | |||
89 | class MyMutex { | ||
90 | public: | ||
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 | } | ||
103 | private: | ||
104 | pthread_mutex_t _mutex; | ||
105 | }; | ||
106 | |||
107 | class QLinphoneMainWidget : public _QLinphoneMainWidget { | ||
108 | |||
109 | Q_OBJECT | ||
110 | |||
111 | public: | ||
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 | |||
125 | private slots: | ||
126 | void slotHide( bool show ); | ||
127 | |||
128 | private: | ||
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 | |||