2
KSysGuard, the KDE System Guard
4
Copyright (c) 1999, 2000 Chris Schlaeger <cs@kde.org>
6
This program is free software; you can redistribute it and/or
7
modify it under the terms of version 2 of the GNU General Public
8
License as published by the Free Software Foundation.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
#ifndef KSG_SENSORMANAGER_H
22
#define KSG_SENSORMANAGER_H
29
#include <SensorAgent.h>
35
class SensorManagerIterator;
38
The SensorManager handles all interaction with the connected
39
hosts. Connections to a specific hosts are handled by
40
SensorAgents. Use engage() to establish a connection and
41
disengage() to terminate the connection. If you don't know if a
42
certain host is already connected use engageHost(). If there is no
43
connection yet or the hostname is empty, a dialog will be shown to
44
enter the connections details.
46
class KDE_EXPORT SensorManager : public QObject
50
friend class SensorManagerIterator;
56
bool engageHost( const QString &hostName );
57
bool engage( const QString &hostName, const QString &shell = "ssh",
58
const QString &command = "", int port = -1 );
60
void requestDisengage( const SensorAgent *agent );
61
bool disengage( const SensorAgent *agent );
62
bool disengage( const QString &hostName );
63
bool resynchronize( const QString &hostName );
64
void hostLost( const SensorAgent *agent );
65
void notify( const QString &msg ) const;
67
void setBroadcaster( QWidget *wdg );
69
virtual bool event( QEvent *event );
71
bool sendRequest( const QString &hostName, const QString &request,
72
SensorClient *client, int id = 0 );
74
const QString hostName( const SensorAgent *sensor ) const;
75
bool hostInfo( const QString &host, QString &shell,
76
QString &command, int &port );
78
const QString& translateUnit( const QString &unit ) const;
79
const QString& translateSensorPath( const QString &path ) const;
80
const QString& translateSensorType( const QString &type ) const;
81
QString translateSensor(const QString& u) const;
83
void readProperties( KConfig *cfg );
84
void saveProperties( KConfig *cfg );
86
void disconnectClient( SensorClient *client );
89
void reconfigure( const SensorAgent *agent );
93
void hostConnectionLost( const QString &hostName );
96
QDict<SensorAgent> mAgents;
100
These dictionary stores the localized versions of the sensor
101
descriptions and units.
103
QDict<QString> mDescriptions;
104
QDict<QString> mUnits;
105
QDict<QString> mDict;
106
QDict<QString> mTypes;
108
QWidget* mBroadcaster;
110
HostConnector* mHostConnector;
113
KDE_EXPORT extern SensorManager* SensorMgr;
115
class KDE_EXPORT SensorManagerIterator : public QDictIterator<SensorAgent>
118
SensorManagerIterator( const SensorManager *sm )
119
: QDictIterator<SensorAgent>( sm->mAgents ) { }
121
~SensorManagerIterator() { }