pwmfanmodel.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * <one line to give the library's name and an idea of what it does.>
  3. * Copyright 2015 Malte Veerman maldela@halloarsch.de
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License or (at your option) version 3 or any later version
  9. * accepted by the membership of KDE e.V. (or its successor approved
  10. * by the membership of KDE e.V.), which shall act as a proxy
  11. * defined in Section 14 of version 3 of the license.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #ifndef PWMFANMODEL_H
  23. #define PWMFANMODEL_H
  24. #include <QtCore/QStringListModel>
  25. namespace Fancontrol {
  26. class PwmFan;
  27. class PwmFanModel : public QStringListModel
  28. {
  29. Q_OBJECT
  30. Q_PROPERTY(QList<QObject *> fans READ fans NOTIFY fansChanged)
  31. Q_PROPERTY(int count READ count NOTIFY fansChanged)
  32. public:
  33. PwmFanModel(QObject *parent = Q_NULLPTR);
  34. void setPwmFans(const QList<PwmFan *> &fans);
  35. void addPwmFans(const QList<PwmFan *> &fans);
  36. QList<QObject *> fans() const;
  37. int count() const { return m_fans.size(); }
  38. public slots:
  39. void updateFan(PwmFan *fan);
  40. private slots:
  41. void updateFan();
  42. signals:
  43. void fansChanged();
  44. private:
  45. QList<PwmFan *> m_fans;
  46. };
  47. }
  48. #endif //PWMFANMODEL_H