File indexing completed on 2024-06-16 05:22:24
0001 /* 0002 * Copyright 2020-2021 Devin Lin <devin@kde.org> 0003 * Copyright 2021 Boris Petrov <boris.v.petrov@protonmail.com> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include <QObject> 0011 0012 class Timer; 0013 0014 class TimerModel : public QObject 0015 { 0016 Q_OBJECT 0017 Q_CLASSINFO("D-Bus Interface", "org.kde.kclock.TimerModel") 0018 0019 public: 0020 static TimerModel *instance(); 0021 0022 void load(); 0023 void save(); 0024 Q_SCRIPTABLE QStringList timers() const; 0025 Q_SCRIPTABLE void addTimer(int length, const QString &label, const QString &commandTimeout, bool running); 0026 Q_SCRIPTABLE void removeTimer(const QString &uuid); 0027 0028 Q_SIGNALS: 0029 Q_SCRIPTABLE void timerAdded(const QString &); 0030 Q_SCRIPTABLE void timerRemoved(const QString &); 0031 0032 private: 0033 void remove(int index); 0034 0035 explicit TimerModel(); 0036 0037 QList<Timer *> m_timerList; 0038 };