File indexing completed on 2024-03-24 17:24:46
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 #include "timermodel.h" 0010 0011 TimerModel::TimerModel() = default; 0012 0013 TimerModel::TimerModel(const QString &text, int duration) 0014 : m_text{text}, 0015 m_duration{duration} 0016 { 0017 } 0018 0019 bool TimerModel::operator==(const TimerModel &other) const 0020 { 0021 return (m_text == other.m_text) 0022 && (m_duration == other.m_duration); 0023 } 0024 0025 bool TimerModel::operator!=(const TimerModel &other) const 0026 { 0027 return !(*this == other); 0028 } 0029 0030 QString TimerModel::text() const 0031 { 0032 return m_text; 0033 } 0034 0035 int TimerModel::duration() const 0036 { 0037 return m_duration; 0038 } 0039 0040 TimerModel::Type TimerModel::type() const 0041 { 0042 return m_duration < 0 ? Invalid 0043 : m_duration == 0 ? Stopwatch 0044 : Countdown; 0045 } 0046 0047 bool TimerModel::isValid() const 0048 { 0049 return type() != Invalid; 0050 }