2 KSysGuard, the KDE System Guard
4 Copyright (c) 2001 Tobias Koenig <tokoe@kde.org>
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef SENSORLOGGER_H
23 #define SENSORLOGGER_H
25 #include <QtGui/QTreeView>
27 #include <SensorDisplay.h>
32 class LogSensor
: public QObject
, public KSGRD::SensorClient
37 explicit LogSensor( QObject
*parent
);
40 virtual void answerReceived( int id
, const QList
<QByteArray
>&answer
);
42 void setHostName( const QString
& name
);
43 QString
hostName() const;
45 void setSensorName( const QString
& name
);
46 QString
sensorName() const;
48 void setFileName( const QString
& name
);
49 QString
fileName() const;
51 void setUpperLimitActive( bool value
);
52 bool upperLimitActive() const;
54 void setLowerLimitActive( bool value
);
55 bool lowerLimitActive() const;
57 void setUpperLimit( double value
);
58 double upperLimit() const;
60 void setLowerLimit( double value
);
61 double lowerLimit() const;
63 void setTimerInterval( int interval
);
64 int timerInterval() const;
66 bool isLogging() const;
68 bool limitReached() const;
81 virtual void timerTick();
91 bool mLowerLimitActive
;
92 bool mUpperLimitActive
;
100 class LogSensorView
: public QTreeView
105 LogSensorView( QWidget
*parent
= 0 );
108 void contextMenuRequest( const QModelIndex
&index
, const QPoint
&pos
);
111 virtual void contextMenuEvent( QContextMenuEvent
*event
);
114 class SensorLogger
: public KSGRD::SensorDisplay
119 SensorLogger( QWidget
*parent
, const QString
& title
, SharedSettings
*workSheetSettings
);
122 bool addSensor( const QString
& hostName
, const QString
& sensorName
,
123 const QString
& sensorType
, const QString
& sensorDescr
);
125 bool editSensor( LogSensor
* );
127 virtual void answerReceived( int, const QList
<QByteArray
>& );
129 bool restoreSettings( QDomElement
& );
130 bool saveSettings( QDomDocument
&, QDomElement
& );
132 void configureSettings();
134 virtual bool hasSettingsDialog() const
141 void contextMenuRequest( const QModelIndex
&index
, const QPoint
&pos
);
144 LogSensorModel
*mModel
;
145 LogSensorView
*mView
;