Original DBUS bindings for TQt
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.2 KiB

  1. /* integrator.h: integrates D-BUS into TQt event loop
  2. *
  3. * Copyright (C) 2003 Zack Rusin <zack@kde.org>
  4. *
  5. * Licensed under the Academic Free License version 2.1
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. #ifndef DBUS_TQT_INTEGRATOR_H
  23. #define DBUS_TQT_INTEGRATOR_H
  24. #include <tqobject.h>
  25. #include <tqintdict.h>
  26. #include <tqptrdict.h>
  27. #include "dbus/dbus.h"
  28. class TQTimer;
  29. namespace DBusQt
  30. {
  31. class Connection;
  32. namespace Internal
  33. {
  34. struct Watch;
  35. class Timeout : public TQObject
  36. {
  37. Q_OBJECT
  38. public:
  39. Timeout( TQObject *parent, DBusTimeout *t );
  40. public:
  41. void start();
  42. signals:
  43. void timeout( DBusTimeout* );
  44. protected slots:
  45. void slotTimeout();
  46. private:
  47. TQTimer *m_timer;
  48. DBusTimeout *m_timeout;
  49. };
  50. class Integrator : public TQObject
  51. {
  52. Q_OBJECT
  53. public:
  54. Integrator( DBusConnection *connection, TQObject *parent );
  55. Integrator( DBusServer *server, TQObject *parent );
  56. signals:
  57. void readReady();
  58. void newConnection( Connection* );
  59. protected slots:
  60. void slotRead( int );
  61. void slotWrite( int );
  62. void slotTimeout( DBusTimeout *timeout );
  63. public:
  64. void addWatch( DBusWatch* );
  65. void removeWatch( DBusWatch* );
  66. void addTimeout( DBusTimeout* );
  67. void removeTimeout( DBusTimeout* );
  68. void handleConnection( DBusConnection* );
  69. private:
  70. TQIntDict<Watch> m_watches;
  71. TQPtrDict<Timeout> m_timeouts;
  72. DBusConnection *m_connection;
  73. DBusServer *m_server;
  74. };
  75. }
  76. }
  77. #endif