KNemo – network interfaces monitor for systray
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.
 
 
 
 
 
 

124 lines
3.4 KiB

  1. /* This file is part of KNemo
  2. Copyright (C) 2004, 2006 Percy Leonhardt <percy@eris23.de>
  3. KNemo is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of
  6. the License, or (at your option) any later version.
  7. KNemo is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. Boston, MA 02110-1301, USA.
  15. */
  16. #ifndef KNEMODAEMON_H
  17. #define KNEMODAEMON_H
  18. #include <tqdict.h>
  19. #include <tqcolor.h>
  20. #include <tqcstring.h>
  21. #include <tqdatetime.h>
  22. #include <kdedmodule.h>
  23. #include <knotifyclient.h>
  24. #include "data.h"
  25. #include "global.h"
  26. class TQTimer;
  27. class TDEInstance;
  28. class Interface;
  29. class BackendBase;
  30. namespace KNotifyClient {
  31. class Instance;
  32. }
  33. /**
  34. * This class is the main entry point of KNemo. It reads the configuration,
  35. * creates the logical interfaces and starts an interface updater. It also
  36. * takes care of configuration changes by the user.
  37. *
  38. * @short KNemos main entry point
  39. * @author Percy Leonhardt <percy@eris23.de>
  40. */
  41. class KNemoDaemon : public KDEDModule
  42. {
  43. K_DCOP
  44. Q_OBJECT
  45. //
  46. public:
  47. /**
  48. * Default Constructor
  49. */
  50. KNemoDaemon( const TQCString& name );
  51. /**
  52. * Default Destructor
  53. */
  54. virtual ~KNemoDaemon();
  55. // tell the control center module which interface the user selected
  56. static TQString sSelectedInterface;
  57. k_dcop:
  58. /*
  59. * Called from the control center module when the user changed
  60. * the settings. It updates the internal list of interfaces
  61. * that should be monitored.
  62. */
  63. virtual void reparseConfiguration();
  64. /* When the user selects 'Configure KNemo...' from the context
  65. * menus this functions gets called from the control center
  66. * module. This way the module knows for which interface the
  67. * user opened the dialog and can preselect the appropriate
  68. * interface in the list.
  69. */
  70. virtual TQString getSelectedInterface();
  71. private:
  72. /*
  73. * Read the configuration on startup
  74. */
  75. void readConfig();
  76. private slots:
  77. /**
  78. * trigger the backend to update the interface informations
  79. */
  80. void updateInterfaces();
  81. private:
  82. TQColor mColorVLines;
  83. TQColor mColorHLines;
  84. TQColor mColorIncoming;
  85. TQColor mColorOutgoing;
  86. TQColor mColorBackground;
  87. // every time this timer expires we will
  88. // gather new informations from the backend
  89. TQTimer* mPollTimer;
  90. // our own instance
  91. TDEInstance* mInstance;
  92. // needed so that KNotifyClient::event will work
  93. KNotifyClient::Instance* mNotifyInstance;
  94. // application wide settings are stored here
  95. GeneralData mGeneralData;
  96. // settings for the traffic plotter are stored here
  97. PlotterSettings mPlotterSettings;
  98. // the name of backend we currently use
  99. TQString mBackendName;
  100. // the backend used to update the interface informations
  101. BackendBase* mBackend;
  102. // a list of all interfaces the user wants to monitor
  103. TQDict<Interface> mInterfaceDict;
  104. };
  105. #endif // KNEMODAEMON_H