• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

superkaramba

  • sources
  • kde-4.12
  • kdeutils
  • superkaramba
  • src
  • sensors
sensor.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2003 by Hans Karlsson *
3  * karlsson.h@home.se *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  ***************************************************************************/
10 
11 #include "sensor.h"
12 
13 Sensor::Sensor(int iMsec)
14 {
15  objList = new QList<QObject*>();
16  msec = iMsec;
17 }
18 
19 void Sensor::start()
20 {
21  if (!timer.isActive()) {
22  connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
23  if (msec >= 0)
24  timer.start((msec == 0) ? 1000 : msec);
25  }
26 }
27 
28 Sensor::~Sensor()
29 {
30  timer.stop();
31 
32  while (!objList->isEmpty())
33  delete objList->takeFirst();
34 
35  delete objList;
36 }
37 
38 void Sensor::addMeter(SensorParams *sp)
39 {
40  objList->append(sp);
41 }
42 
43 SensorParams* Sensor::hasMeter(const Meter *meter) const
44 {
45  QObject *it;
46  foreach(it, *objList) {
47  if ((qobject_cast<SensorParams*>(it))->getMeter() == meter) {
48  return qobject_cast<SensorParams*>(it);
49  }
50  }
51 
52  return 0;
53 }
54 
55 void Sensor::deleteMeter(Meter *meter)
56 {
57  SensorParams* sp = hasMeter(meter);
58 
59  if (sp) {
60  objList->removeAll(sp);
61  delete sp;
62  }
63 }
64 
65 void Sensor::setMaxValue(SensorParams*)
66 {}
67 
68 #include "sensor.moc"
Sensor::Sensor
Sensor(int msec=1000)
Definition: sensor.cpp:13
Sensor::start
void start()
Definition: sensor.cpp:19
QObject
Sensor::hasMeter
SensorParams * hasMeter(const Meter *meter) const
Definition: sensor.cpp:43
Sensor::deleteMeter
void deleteMeter(Meter *meter)
Definition: sensor.cpp:55
sensor.h
SensorParams
Hans Karlsson.
Definition: sensorparams.h:30
Sensor::update
virtual void update()=0
getMeter
long getMeter(long widget, char *name)
Definition: python/meter.cpp:147
Sensor::setMaxValue
virtual void setMaxValue(SensorParams *s)
Definition: sensor.cpp:65
Sensor::~Sensor
virtual ~Sensor()
Definition: sensor.cpp:28
Meter
Definition: meters/meter.h:23
Sensor::objList
QList< QObject * > * objList
Definition: sensor.h:39
Sensor::addMeter
void addMeter(SensorParams *s)
Definition: sensor.cpp:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

superkaramba

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

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • kremotecontrol
  • ktimer
  • kwallet
  • superkaramba
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal