add more spacing
[personal-kdebase.git] / workspace / ksysguard / gui / SensorDisplayLib / SensorLogger.h
blob207e3cbab80f6d085f404117349cd5dc4c31b234
1 /*
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>
29 class LogSensorModel;
30 class QDomElement;
32 class LogSensor : public QObject, public KSGRD::SensorClient
34 Q_OBJECT
36 public:
37 explicit LogSensor( QObject *parent );
38 ~LogSensor();
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;
70 public Q_SLOTS:
71 void timerOff();
72 void timerOn();
74 void startLogging();
75 void stopLogging();
77 Q_SIGNALS:
78 void changed();
80 protected:
81 virtual void timerTick();
83 private:
84 QString mSensorName;
85 QString mHostName;
86 QString mFileName;
88 int mTimerInterval;
89 int mTimerID;
91 bool mLowerLimitActive;
92 bool mUpperLimitActive;
94 double mLowerLimit;
95 double mUpperLimit;
97 bool mLimitReached;
100 class LogSensorView : public QTreeView
102 Q_OBJECT
104 public:
105 LogSensorView( QWidget *parent = 0 );
107 Q_SIGNALS:
108 void contextMenuRequest( const QModelIndex &index, const QPoint &pos );
110 protected:
111 virtual void contextMenuEvent( QContextMenuEvent *event );
114 class SensorLogger : public KSGRD::SensorDisplay
116 Q_OBJECT
118 public:
119 SensorLogger( QWidget *parent, const QString& title, SharedSettings *workSheetSettings );
120 ~SensorLogger();
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
136 return true;
139 public Q_SLOTS:
140 void applyStyle();
141 void contextMenuRequest( const QModelIndex &index, const QPoint &pos );
143 private:
144 LogSensorModel *mModel;
145 LogSensorView *mView;
148 #endif