Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qlinphone.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           qlinphone.h  -  description
00003                              -------------------
00004     begin                : sam mai 24 2003
00005     copyright            : (C) 2003 by Simon Morlat, 2004 Maximilian Reiss
00006     email                : simon.morlat@linphone.org, harlekin@handhelds.org
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifdef HAVE_CONFIG_H
00019 #include <config.h>
00020 #endif
00021 #include "mainwidget.h"
00022 #include <qobject.h>
00023 #include <qpushbutton.h>
00024 #include <qqueue.h>
00025 #include <pthread.h>
00026 
00027 class GuiTask {
00028 public:
00029     GuiTask(QWidget *w) {
00030         _w=w;
00031     }
00032     virtual void execute()=0;
00033     virtual ~GuiTask() {}
00034     ;
00035 protected:
00036     QWidget *_w;
00037 };
00038 
00039 class ShowTask: public GuiTask {
00040 public:
00041 ShowTask(QWidget *w) : GuiTask(w) {}
00042     ;
00043 private:
00044     void execute() {
00045         _w->show();
00046     }
00047 };
00048 
00049 class DisplaySomethingTask : public GuiTask {
00050 public:
00051 DisplaySomethingTask(QWidget* w,QString &msg): GuiTask(w) {
00052         _msg=msg;
00053     }
00054 protected:
00055     QString _msg;
00056 };
00057 
00058 class UpdateStatusBarTask : public DisplaySomethingTask {
00059 public:
00060 UpdateStatusBarTask(QWidget *w,QString &msg) :DisplaySomethingTask(w,msg) {}
00061     ;
00062 private:
00063     void execute();
00064 };
00065 
00066 class InviteReceivedTask : public DisplaySomethingTask {
00067 public:
00068 InviteReceivedTask(QWidget *w,QString &msg) :DisplaySomethingTask(w,msg) {}
00069     ;
00070 private:
00071     void execute();
00072 };
00073 
00074 class DisplayMessageTask : public DisplaySomethingTask {
00075 public:
00076     enum MessageType{Info,Warn};
00077 DisplayMessageTask(QWidget *w,QString &msg,MessageType type) : DisplaySomethingTask(w,msg) {
00078         _msgtype=type;
00079     };
00080 private:
00081     void execute();
00082     MessageType _msgtype;
00083 };
00084 
00085 
00086 
00087 typedef struct _LinphoneCore LinphoneCore;
00088 
00089 class MyMutex {
00090 public:
00091     MyMutex() {
00092         pthread_mutex_init(&_mutex,NULL);
00093     }
00094     void lock() {
00095         pthread_mutex_lock(&_mutex);
00096     }
00097     void unlock() {
00098         pthread_mutex_unlock(&_mutex);
00099     }
00100     ~MyMutex() {
00101         pthread_mutex_destroy(&_mutex);
00102     }
00103 private:
00104     pthread_mutex_t _mutex;
00105 };
00106 
00107 class QLinphoneMainWidget : public _QLinphoneMainWidget {
00108 
00109 Q_OBJECT
00110 
00111 public:
00112     QLinphoneMainWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
00113     ~QLinphoneMainWidget();
00114 
00115  
00116    void callOrAccept();
00117     void terminateCall();
00118     void inviteReceived(QString &from);
00119     void displayStatus(QString &status);
00120     void helpAbout();   
00121    // make it private
00122     void createLinphoneCore();
00123     void pushGuiTask(GuiTask* g);
00124 
00125 private slots:
00126     void slotHide( bool show );
00127 
00128 private:
00129     void readConfig();
00130     void writeConfig();
00131     void processGuiTasks();
00132     void timerEvent(QTimerEvent *);
00133     LinphoneCore *_core;
00134     QQueue<GuiTask> _actionq;
00135     MyMutex _mutex;
00136 };
00137 
00138 

Generated on Sat Nov 5 16:17:35 2005 for OPIE by  doxygen 1.4.2