• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libplasma

signalplotter.h

Go to the documentation of this file.
00001 /*
00002  *   KSysGuard, the KDE System Guard
00003  *
00004  *   Copyright 1999 - 2001 Chris Schlaeger <cs@kde.org>
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU Library General Public License as
00008  *   published by the Free Software Foundation; either version 2, or
00009  *   (at your option) any later version.
00010 
00011  *
00012  *   This program is distributed in the hope that it will be useful,
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *   GNU General Public License for more details.
00016  *
00017  *   You should have received a copy of the GNU General Public License
00018  *   along with this program; if not, write to the Free Software
00019  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00020  */
00021 
00022 #ifndef PLASMA_SIGNALPLOTTER_H
00023 #define PLASMA_SIGNALPLOTTER_H
00024 
00025 #include <QtGui/QFont>
00026 #include <QtGui/QGraphicsWidget>
00027 #include <plasma/plasma_export.h>
00028 
00029 namespace Plasma
00030 {
00031 
00032 class SignalPlotterPrivate;
00033 
00034 struct PlotColor
00035 {
00036     QColor color;
00037     QColor darkColor;
00038 };
00039 
00040 class PLASMA_EXPORT SignalPlotter : public QGraphicsWidget
00041 {
00042     Q_OBJECT
00043     Q_PROPERTY( QString title READ title WRITE setTitle )
00044     Q_PROPERTY( QString unit READ unit WRITE setUnit )
00045     Q_PROPERTY( qreal scale READ scaledBy WRITE scale ) // Note: The naming of the functions here is poor
00046     Q_PROPERTY( bool useAutoRange READ useAutoRange WRITE setUseAutoRange )
00047     Q_PROPERTY( uint horizontalScale READ horizontalScale WRITE setHorizontalScale )
00048     Q_PROPERTY( bool showVerticalLines READ showVerticalLines WRITE setShowVerticalLines )
00049     Q_PROPERTY( QColor verticalLinesColor READ verticalLinesColor WRITE setVerticalLinesColor )
00050     Q_PROPERTY( uint verticalLinesDistance READ verticalLinesDistance WRITE setVerticalLinesDistance )
00051     Q_PROPERTY( bool verticalLinesScroll READ verticalLinesScroll WRITE setVerticalLinesScroll )
00052     Q_PROPERTY( bool showHorizontalLines READ showHorizontalLines WRITE setShowHorizontalLines )
00053     Q_PROPERTY( QColor horizontalLinesColor READ horizontalLinesColor WRITE setHorizontalLinesColor )
00054     Q_PROPERTY( QColor fontColor READ fontColor WRITE setFontColor )
00055     Q_PROPERTY( QFont font READ font WRITE setFont )
00056     Q_PROPERTY( uint horizontalLinesCount READ horizontalLinesCount WRITE setHorizontalLinesCount )
00057     Q_PROPERTY( bool showLabels READ showLabels WRITE setShowLabels )
00058     Q_PROPERTY( bool showTopBar READ showTopBar WRITE setShowTopBar )
00059     Q_PROPERTY( QColor backgroundColor READ backgroundColor WRITE setBackgroundColor )
00060     Q_PROPERTY( QString svgBackground READ svgBackground WRITE setSvgBackground )
00061     Q_PROPERTY( bool thinFrame WRITE setThinFrame )
00062     Q_PROPERTY( bool stackPlots READ stackPlots WRITE setStackPlots )
00063 
00064 public:
00065     SignalPlotter(QGraphicsItem *parent = 0);
00066     ~SignalPlotter();
00067 
00074     void addPlot(const QColor &color);
00075 
00082     void addSample(const QList<double> &samples);
00083 
00097     void reorderPlots(const QList<uint>& newOrder);
00098 
00103     void removePlot(uint pos);
00104 
00110     QList<PlotColor> &plotColors();
00111 
00116     void setTitle(const QString &title);
00117 
00122     QString title() const;
00123 
00129     void setUnit(const QString &unit);
00130 
00135     QString unit() const;
00136 
00144     void scale(qreal delta);
00145 
00150     qreal scaledBy() const;
00151 
00158     void setUseAutoRange(bool value);
00159 
00165     bool useAutoRange() const;
00166 
00180     void setVerticalRange(double min, double max);
00181 
00186     double verticalMinValue() const;
00187 
00192     double verticalMaxValue() const;
00193 
00198     void setHorizontalScale(uint scale);
00199 
00204     uint horizontalScale() const;
00205 
00210     void setShowVerticalLines(bool value);
00211 
00216     bool showVerticalLines() const;
00217 
00222     void setVerticalLinesColor(const QColor &color);
00223 
00228     QColor verticalLinesColor() const;
00229 
00234     void setVerticalLinesDistance(uint distance);
00235 
00240     uint verticalLinesDistance() const;
00241 
00246     void setVerticalLinesScroll(bool value);
00247 
00252     bool verticalLinesScroll() const;
00253 
00258     void setShowHorizontalLines(bool value);
00263     bool showHorizontalLines() const;
00264 
00269     void setHorizontalLinesColor(const QColor &color);
00270 
00275     QColor horizontalLinesColor() const;
00276 
00281     void setFontColor(const QColor &color);
00282 
00287     QColor fontColor() const;
00288 
00293     void setFont(const QFont &font);
00294 
00299     QFont font() const;
00300 
00306     void setHorizontalLinesCount(uint count);
00307 
00313     uint horizontalLinesCount() const;
00314 
00319     void setShowLabels(bool value);
00320 
00325     bool showLabels() const;
00326 
00332     void setShowTopBar(bool value);
00333 
00339     bool showTopBar() const;
00340 
00346     void setBackgroundColor(const QColor &color);
00347 
00353     QColor backgroundColor() const;
00354 
00360     void setSvgBackground(const QString &filename);
00361 
00367     QString svgBackground();
00368 
00374     double lastValue(uint i) const;
00375 
00381     QString lastValueAsString(uint i) const;
00382 
00388     void setThinFrame(bool set);
00389 
00396     void setStackPlots(bool stack);
00397 
00402     bool stackPlots() const;
00403 
00412     QPixmap getSnapshotImage(uint width, uint height);
00413 
00418     virtual void setGeometry(const QRectF &geometry);
00419 
00420 protected:
00421     void updateDataBuffers();
00422     void calculateNiceRange();
00423 
00424     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
00425 
00426     void drawWidget(QPainter *p, uint w, uint height, int horizontalScale);
00427     void drawBackground(QPainter *p, int w, int h);
00428     void drawThinFrame(QPainter *p, int w, int h);
00429     void drawTopBarFrame(QPainter *p, int separatorX, int height);
00430     void drawTopBarContents(QPainter *p, int x, int width, int height);
00431     void drawVerticalLines(QPainter *p, int top, int w, int h);
00432     void drawPlots(QPainter *p, int top, int w, int h, int horizontalScale);
00433     void drawAxisText(QPainter *p, int top, int h);
00434     void drawHorizontalLines(QPainter *p, int top, int w, int h);
00435 
00436 private:
00437     SignalPlotterPrivate *const d;
00438 };
00439 
00440 } // Plasma namespace
00441 
00442 #endif

libplasma

Skip menu "libplasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal