Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Related Pages

integrator.h

00001 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002 /* integrator.h: integrates D-BUS into Qt event loop
00003  *
00004  * Copyright (C) 2003  Zack Rusin <zack@kde.org>
00005  *
00006  * Licensed under the Academic Free License version 2.1
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 #ifndef DBUS_QT_INTEGRATOR_H
00024 #define DBUS_QT_INTEGRATOR_H
00025 
00026 #include <qobject.h>
00027 
00028 #include <qintdict.h>
00029 #include <qptrdict.h>
00030 
00031 #include "dbus/dbus.h"
00032 
00033 class QTimer;
00034 
00035 namespace DBusQt
00036 {
00037   class Connection;
00038 
00039   namespace Internal
00040   {
00041     struct Watch;
00042 
00043     class Timeout : public QObject
00044     {
00045       Q_OBJECT
00046     public:
00047       Timeout( QObject *parent, DBusTimeout *t );
00048     public:
00049       void start();
00050     signals:
00051       void timeout( DBusTimeout* );
00052     protected slots:
00053       void slotTimeout();
00054     private:
00055       QTimer *m_timer;
00056       DBusTimeout *m_timeout;
00057     };
00058 
00059     class Integrator : public QObject
00060     {
00061       Q_OBJECT
00062     public:
00063       Integrator( DBusConnection *connection, QObject *parent );
00064       Integrator( DBusServer *server, QObject *parent );
00065 
00066     signals:
00067       void readReady();
00068       void newConnection( Connection* );
00069 
00070     protected slots:
00071       void slotRead( int );
00072       void slotWrite( int );
00073       void slotTimeout( DBusTimeout *timeout );
00074 
00075     public:
00076       void addWatch( DBusWatch* );
00077       void removeWatch( DBusWatch* );
00078 
00079       void addTimeout( DBusTimeout* );
00080       void removeTimeout( DBusTimeout* );
00081 
00082       void handleConnection( DBusConnection* );
00083     private:
00084       QIntDict<Watch> m_watches;
00085       QPtrDict<Timeout> m_timeouts;
00086       DBusConnection *m_connection;
00087       DBusServer *m_server;
00088     };
00089   }
00090 }
00091 
00092 #endif

Generated on Tue Sep 13 01:28:08 2005 for D-BUS by  doxygen 1.4.4