add more spacing
[personal-kdebase.git] / workspace / ksysguard / gui / SensorDisplayLib / FancyPlotter.h
bloba654dabbae0819a2fc0b5a36f9a6914996869b0f
1 /*
2 KSysGuard, the KDE System Guard
4 Copyright (c) 1999 - 2001 Chris Schlaeger <cs@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 version 2 or at your option version 3 as published by
9 the Free Software Foundation.
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 KSG_FANCYPLOTTER_H
23 #define KSG_FANCYPLOTTER_H
25 #include <SensorDisplay.h>
26 #include <QList>
28 #include "SignalPlotter.h"
29 #include "SharedSettings.h"
31 class FancyPlotterSettings;
32 class QLabel;
33 class SensorToAdd;
34 class FancyPlotterLabel;
36 class FPSensorProperties : public KSGRD::SensorProperties
38 public:
39 FPSensorProperties();
40 FPSensorProperties( const QString &hostName, const QString &name,
41 const QString &type, const QString &description,
42 const QColor &color, const QString &regexpName = QString(),
43 int beamId = -1, const QString &summationName = QString());
44 ~FPSensorProperties();
46 void setColor( const QColor &color );
47 QColor color() const;
48 int beamId;
49 QString summationName;
50 double maxValue;
51 double lastValue;
53 private:
54 QColor mColor;
57 class FancyPlotter : public KSGRD::SensorDisplay
59 Q_OBJECT
61 public:
62 FancyPlotter( QWidget* parent, const QString& title, SharedSettings *workSheetSettings);
63 virtual ~FancyPlotter();
65 void configureSettings();
67 bool addSensor( const QString &hostName, const QString &name,
68 const QString &type, const QString &title );
69 bool addSensor( const QString &hostName, const QString &name,
70 const QString &type, const QString &title,
71 const QColor &color, const QString &regexpName = QString(),
72 int sumToSensor = -1, const QString &summationName = QString());
74 bool removeSensor( uint pos );
76 virtual void setTitle( const QString &title );
78 virtual void answerReceived( int id, const QList<QByteArray> &answerlist );
80 virtual bool restoreSettings( QDomElement &element );
81 virtual bool saveSettings( QDomDocument &doc, QDomElement &element );
83 virtual bool hasSettingsDialog() const;
85 public Q_SLOTS:
86 virtual void applyStyle();
87 private Q_SLOTS:
88 void settingsFinished();
89 void applySettings();
90 void plotterAxisScaleChanged();
92 protected:
93 /** When we receive a timer tick, draw the beams and request new information to update the beams*/
94 virtual void timerTick( );
95 virtual bool eventFilter( QObject*, QEvent* );
96 void setTooltip();
98 private:
99 uint mBeams;
100 /** Number of beams we've received an answer from since asking last */
101 uint mNumAccountedFor;
103 /** When we talk to the sensor, it tells us a range. Record the max here. equals 0 until we have an answer from it */
104 double mSensorReportedMax;
105 /** When we talk to the sensor, it tells us a range. Record the min here. equals 0 until we have an answer from it */
106 double mSensorReportedMin;
108 /** The widget that actually draws the beams */
109 KSignalPlotter* mPlotter;
112 The sample buffer and the flags are needed to store the incoming
113 samples for each beam until all samples of the period have been
114 received. The flags variable is used to ensure that all samples have
115 been received.
117 QList<double> mSampleBuf;
119 FancyPlotterSettings* mSettingsDialog;
120 QLabel *mHeading;
122 QString mUnit;
124 QList<SensorToAdd *> mSensorsToAdd;
125 QBoxLayout *mLabelLayout;
126 QChar mIndicatorSymbol;
129 #endif