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.

95 lines
2.3KB

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