~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to ksysguard/gui/SensorDisplayLib/BarGraph.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    KSysGuard, the KDE System Guard
 
3
 
 
4
    Copyright (c) 1999 - 2001 Chris Schlaeger <cs@kde.org>
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
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.
 
19
 
 
20
*/
 
21
 
 
22
#ifndef KSG_BARGRAPH_H
 
23
#define KSG_BARGRAPH_H
 
24
 
 
25
#include <QWidget>
 
26
#include <QPaintEvent>
 
27
 
 
28
class BarGraph : public QWidget
 
29
{
 
30
  Q_OBJECT
 
31
 
 
32
  friend class DancingBars;
 
33
 
 
34
  public:
 
35
    explicit BarGraph( QWidget *parent );
 
36
    ~BarGraph();
 
37
 
 
38
    bool addBar( const QString &footer );
 
39
    bool removeBar( uint idx );
 
40
 
 
41
    void updateSamples( const QVector<double> &newSamples );
 
42
 
 
43
    double getMin() const
 
44
    {
 
45
      return minValue;
 
46
    }
 
47
 
 
48
    double getMax() const
 
49
    {
 
50
      return maxValue;
 
51
    }
 
52
 
 
53
    void getLimits( double &l, bool &la, double &u, bool &ua ) const
 
54
    {
 
55
      l = lowerLimit;
 
56
      la = lowerLimitActive;
 
57
      u = upperLimit;
 
58
      ua = upperLimitActive;
 
59
    }
 
60
 
 
61
    void setLimits( double l, bool la, double u, bool ua )
 
62
    {
 
63
      lowerLimit = l;
 
64
      lowerLimitActive = la;
 
65
      upperLimit = u;
 
66
      upperLimitActive = ua;
 
67
    }
 
68
 
 
69
    void changeRange( double min, double max );
 
70
 
 
71
  protected:
 
72
    virtual void paintEvent( QPaintEvent* );
 
73
 
 
74
  private:
 
75
    double minValue;
 
76
    double maxValue;
 
77
    double lowerLimit;
 
78
    double lowerLimitActive;
 
79
    double upperLimit;
 
80
    bool upperLimitActive;
 
81
    bool autoRange;
 
82
    QVector<double> samples;
 
83
    QStringList footers;
 
84
    uint bars;
 
85
    QColor normalColor;
 
86
    QColor alarmColor;
 
87
    QColor mBackgroundColor;
 
88
    int fontSize;
 
89
};
 
90
 
 
91
#endif