File indexing completed on 2024-04-21 16:32:06
0001 /* This file is part of Kairo Timer 0002 0003 SPDX-FileCopyrightText: 2016 (c) Kevin Ottens <ervin@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 0007 */ 0008 0009 #ifndef TIMERMODEL_H 0010 #define TIMERMODEL_H 0011 0012 #include <QMetaType> 0013 #include <QString> 0014 0015 class TimerModel 0016 { 0017 Q_GADGET 0018 Q_PROPERTY(QString text READ text) 0019 Q_PROPERTY(int duration READ duration) 0020 Q_PROPERTY(Type type READ type) 0021 Q_PROPERTY(bool valid READ isValid) 0022 public: 0023 enum Type { 0024 Invalid, 0025 Countdown, 0026 Stopwatch 0027 }; 0028 Q_ENUM(Type) 0029 0030 TimerModel(); 0031 TimerModel(const QString &text, int duration = 0); 0032 0033 bool operator==(const TimerModel &other) const; 0034 bool operator!=(const TimerModel &other) const; 0035 0036 QString text() const; 0037 int duration() const; 0038 Type type() const; 0039 0040 bool isValid() const; 0041 0042 private: 0043 QString m_text = {}; 0044 int m_duration = -1; 0045 }; 0046 0047 Q_DECLARE_METATYPE(TimerModel) 0048 0049 #endif