Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KRADIO_ALARM_H
00019 #define KRADIO_ALARM_H
00020
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024
00025 #include <QtCore/QDateTime>
00026 #include <QtCore/QVector>
00027 #include <kdemacros.h>
00028
00033 class KDE_EXPORT Alarm
00034 {
00035 public:
00036
00037 enum AlarmType { StartPlaying, StopPlaying, StartRecording, StopRecording };
00038
00039 protected:
00040 QDateTime m_time;
00041
00042 bool m_daily;
00043 int m_weekdayMask;
00044
00045 bool m_enabled;
00046 QString m_stationID;
00047 float m_volumePreset;
00048
00049 AlarmType m_type;
00050 QString m_recordingTemplate;
00051
00052 int m_ID;
00053
00054 static int m_LastID;
00055
00056 public:
00057 Alarm();
00058 Alarm(const QDateTime &time, bool daily, bool enabled);
00059 Alarm(const Alarm &);
00060 ~Alarm();
00061
00062 bool isEnabled() const { return m_enabled; }
00063 bool isDaily() const { return m_daily; }
00064 int weekdayMask() const { return m_weekdayMask; }
00065 QDateTime alarmTime () const { return m_time; }
00066 QDateTime nextAlarm (bool ignoreEnable = false) const;
00067 const QString &stationID () const { return m_stationID; }
00068 float volumePreset () const { return m_volumePreset; }
00069 AlarmType alarmType() const { return m_type; }
00070 const QString &recordingTemplate() const { return m_recordingTemplate; }
00071
00072 int ID() const { return m_ID; }
00073
00074 void setEnabled (bool enable = true) { m_enabled = enable; }
00075 void setDaily (bool d = true) { m_daily = d; }
00076 void setWeekdayMask(int m = 0x7F) { m_weekdayMask = m; }
00077 void setDate (const QDate &d) { m_time.setDate(d); }
00078 void setTime (const QTime &d) { m_time.setTime(d); }
00079 void setVolumePreset(float v) { m_volumePreset = v; }
00080 void setStationID(const QString &id) { m_stationID = id; }
00081 void setAlarmType(AlarmType t) { m_type = t; }
00082 void setRecordingTemplate(const QString & t) { m_recordingTemplate = t; }
00083
00084
00085 bool operator == (const Alarm &x) const {
00086 return
00087 m_time == x.m_time &&
00088 m_daily == x.m_daily &&
00089 m_weekdayMask == x.m_weekdayMask &&
00090 m_enabled == x.m_enabled &&
00091 m_stationID == x.m_stationID &&
00092 m_volumePreset == x.m_volumePreset &&
00093 m_type == x.m_type &&
00094 m_recordingTemplate == x.m_recordingTemplate &&
00095 m_ID == x.m_ID;
00096 }
00097 bool operator != (const Alarm &x) const { return ! operator == (x); }
00098
00099 };
00100
00101
00102
00103 typedef QVector<Alarm> AlarmVector;
00104 typedef AlarmVector::iterator iAlarmVector;
00105 typedef AlarmVector::const_iterator ciAlarmVector;
00106
00107
00108
00109 #endif