summaryrefslogtreecommitdiffstats
path: root/src/include/alarm.h
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2022-05-30 19:40:31 +0900
committerMichele Calgaro <[email protected]>2022-05-31 01:17:58 +0900
commitd95a4fea540b371fa86493d069fdbd54f33c5b40 (patch)
tree079b038ab559439eb7ded40a07bd79fd92926b3b /src/include/alarm.h
parente54890e0480e5adee69f5220a7c6dd072bbd75ea (diff)
downloadtderadio-d95a4fea540b371fa86493d069fdbd54f33c5b40.tar.gz
tderadio-d95a4fea540b371fa86493d069fdbd54f33c5b40.zip
Standardize folder structure.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/include/alarm.h')
-rw-r--r--src/include/alarm.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/include/alarm.h b/src/include/alarm.h
new file mode 100644
index 0000000..14b4abc
--- /dev/null
+++ b/src/include/alarm.h
@@ -0,0 +1,104 @@
+/***************************************************************************
+ alarm.h - description
+ -------------------
+ begin : Mon Feb 4 2002
+ copyright : (C) 2002 by Martin Witte / Frank Schwanz
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KRADIO_ALARM_H
+#define KRADIO_ALARM_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tqdatetime.h>
+#include <vector>
+
+/**
+ *@author Martin Witte
+ */
+
+class Alarm
+{
+public:
+
+ enum AlarmType { StartPlaying, StopPlaying, StartRecording, StopRecording };
+
+protected:
+ TQDateTime m_time;
+
+ bool m_daily;
+ int m_weekdayMask;
+
+ bool m_enabled;
+ TQString m_stationID;
+ float m_volumePreset; // < 0: disabled
+
+ AlarmType m_type;
+
+ int m_ID;
+
+ static int m_LastID;
+
+public:
+ Alarm();
+ Alarm(const TQDateTime &time, bool daily, bool enabled);
+ Alarm(const Alarm &);
+ ~Alarm();
+
+ bool isEnabled() const { return m_enabled; }
+ bool isDaily() const { return m_daily; }
+ int weekdayMask() const { return m_weekdayMask; }
+ TQDateTime alarmTime () const { return m_time; }
+ TQDateTime nextAlarm (bool ignoreEnable = false) const;
+ const TQString &stationID () const { return m_stationID; }
+ float volumePreset () const { return m_volumePreset; }
+ AlarmType alarmType() const { return m_type; }
+
+ int ID() const { return m_ID; }
+
+ void setEnabled (bool enable = true) { m_enabled = enable; }
+ void setDaily (bool d = true) { m_daily = d; }
+ void setWeekdayMask(int m = 0x7F) { m_weekdayMask = m; }
+ void setDate (const TQDate &d) { m_time.setDate(d); }
+ void setTime (const TQTime &d) { m_time.setTime(d); }
+ void setVolumePreset(float v) { m_volumePreset = v; }
+ void setStationID(const TQString &id) { m_stationID = id;}
+ void setAlarmType(AlarmType t) { m_type = t; }
+
+
+ bool operator == (const Alarm &x) const {
+ return
+ m_time == x.m_time &&
+ m_daily == x.m_daily &&
+ m_weekdayMask == x.m_weekdayMask &&
+ m_enabled == x.m_enabled &&
+ m_stationID == x.m_stationID &&
+ m_volumePreset == x.m_volumePreset &&
+ m_type == x.m_type &&
+ m_ID == x.m_ID;
+ }
+ bool operator != (const Alarm &x) const { return ! operator == (x); }
+
+};
+
+using namespace std;
+
+typedef vector<Alarm> AlarmVector;
+typedef AlarmVector::iterator iAlarmVector;
+typedef AlarmVector::const_iterator ciAlarmVector;
+
+
+
+#endif