author | harlekin <harlekin> | 2004-02-22 23:38:58 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-02-22 23:38:58 (UTC) |
commit | 666a49773d06ac94c19996d763854725c2f7a578 (patch) (side-by-side diff) | |
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 @@ +/*************************************************************************** + qlinphone.h - description + ------------------- + begin : sam mai 24 2003 + copyright : (C) 2003 by Simon Morlat, 2004 Maximilian Reiss + email : simon.morlat@linphone.org, harlekin@handhelds.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include "mainwidget.h" +#include <qobject.h> +#include <qpushbutton.h> +#include <qqueue.h> +#include <pthread.h> + +class GuiTask { +public: + GuiTask(QWidget *w) { + _w=w; + } + virtual void execute()=0; + virtual ~GuiTask() {} + ; +protected: + QWidget *_w; +}; + +class ShowTask: public GuiTask { +public: +ShowTask(QWidget *w) : GuiTask(w) {} + ; +private: + void execute() { + _w->show(); + } +}; + +class DisplaySomethingTask : public GuiTask { +public: +DisplaySomethingTask(QWidget* w,QString &msg): GuiTask(w) { + _msg=msg; + } +protected: + QString _msg; +}; + +class UpdateStatusBarTask : public DisplaySomethingTask { +public: +UpdateStatusBarTask(QWidget *w,QString &msg) :DisplaySomethingTask(w,msg) {} + ; +private: + void execute(); +}; + +class InviteReceivedTask : public DisplaySomethingTask { +public: +InviteReceivedTask(QWidget *w,QString &msg) :DisplaySomethingTask(w,msg) {} + ; +private: + void execute(); +}; + +class DisplayMessageTask : public DisplaySomethingTask { +public: + enum MessageType{Info,Warn}; +DisplayMessageTask(QWidget *w,QString &msg,MessageType type) : DisplaySomethingTask(w,msg) { + _msgtype=type; + }; +private: + void execute(); + MessageType _msgtype; +}; + + + +typedef struct _LinphoneCore LinphoneCore; + +class MyMutex { +public: + MyMutex() { + pthread_mutex_init(&_mutex,NULL); + } + void lock() { + pthread_mutex_lock(&_mutex); + } + void unlock() { + pthread_mutex_unlock(&_mutex); + } + ~MyMutex() { + pthread_mutex_destroy(&_mutex); + } +private: + pthread_mutex_t _mutex; +}; + +class QLinphoneMainWidget : public _QLinphoneMainWidget { + +Q_OBJECT + +public: + QLinphoneMainWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~QLinphoneMainWidget(); + + + void callOrAccept(); + void terminateCall(); + void inviteReceived(QString &from); + void displayStatus(QString &status); + void helpAbout(); + // make it private + void createLinphoneCore(); + void pushGuiTask(GuiTask* g); + +private slots: + void slotHide( bool show ); + +private: + void readConfig(); + void writeConfig(); + void processGuiTasks(); + void timerEvent(QTimerEvent *); + LinphoneCore *_core; + QQueue<GuiTask> _actionq; + MyMutex _mutex; +}; + + |