temp.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright 2015 Malte Veerman <malte.veerman@gmail.com>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of
  7. * the License or (at your option) version 3 or any later version
  8. * accepted by the membership of KDE e.V. (or its successor approved
  9. * by the membership of KDE e.V.), which shall act as a proxy
  10. * defined in Section 14 of version 3 of the license.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. #ifndef TEMP_H
  22. #define TEMP_H
  23. #include "sensor.h"
  24. class QTextStream;
  25. namespace Fancontrol
  26. {
  27. class Temp : public Sensor
  28. {
  29. Q_OBJECT
  30. Q_PROPERTY(QString label READ label NOTIFY labelChanged)
  31. Q_PROPERTY(int value READ value NOTIFY valueChanged)
  32. public:
  33. explicit Temp(uint index, Hwmon *parent = Q_NULLPTR);
  34. virtual ~Temp();
  35. QString label() const { return m_label; }
  36. int value() const { return m_value; }
  37. QString name() const Q_DECL_OVERRIDE;
  38. void setName(const QString &name) Q_DECL_OVERRIDE;
  39. void toDefault() Q_DECL_OVERRIDE;
  40. bool isValid() const Q_DECL_OVERRIDE;
  41. public slots:
  42. void update() Q_DECL_OVERRIDE;
  43. signals:
  44. void labelChanged();
  45. void valueChanged();
  46. protected:
  47. QTextStream *m_valueStream;
  48. private:
  49. QString m_label;
  50. int m_value;
  51. };
  52. }
  53. #endif // TEMP_H