File indexing completed on 2024-04-28 05:52:07
0001 /* 0002 SPDX-FileCopyrightText: 2007-2009 Stefan Böhmann <kde@hilefoks.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #ifndef TEA_H 0007 #define TEA_H 0008 0009 #include <QString> 0010 0011 0012 /** 0013 * @short this class represent a tea. 0014 * 0015 * @author Stefan Böhmann <kde@hilefoks.org> 0016 */ 0017 class Tea { 0018 public: 0019 /** 0020 * Constructs an tea. 0021 * @param name the name of this tea. 0022 * @param time the tea time in seconds. 0023 */ 0024 explicit Tea(const QString &name = QString(), const unsigned time = 180); 0025 0026 /** 0027 * Returns the name of this tea. 0028 * 0029 * @return the name of this tea. 0030 */ 0031 QString name() const; 0032 0033 /** 0034 * Set the name of this the. 0035 * @param name the new name for this tea. 0036 */ 0037 void setName(const QString &name); 0038 0039 /** 0040 * Returns the time for this tea in seconds. 0041 * 0042 * @return the time for this tea in seconds. 0043 */ 0044 unsigned time() const; 0045 0046 /** 0047 * Set the time of this tea. 0048 * @param time the new time for this tea in seconds. 0049 */ 0050 void setTime(const unsigned time); 0051 0052 /** 0053 * Returns the time for this tea as a @ref QString. 0054 * @param longdesc if true return long names like "5 minutes 30 seconds", else returns a short form like "5 min 30 s". 0055 * 0056 * @return the time for this tea as a @ref QString. 0057 */ 0058 QString timeToString(const bool longdesc = false) const; 0059 0060 0061 /** 0062 * Returns a formatted @ref QString for the given time. 0063 * @param time the time in seconds. 0064 * @param longdesc if true return long names like "5 minutes 30 seconds", else returns a short form like "5 min 30 s". 0065 * 0066 * @return the formatted @ref QString. 0067 */ 0068 static QString int2time(const int time, const bool longdesc=false); 0069 0070 private: 0071 QString m_name; 0072 unsigned m_time; 0073 }; 0074 0075 #endif 0076 0077 // kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; replace-tabs on; space-indent on; 0078 // vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1: 0079