blob: ae28f4aab0549af1ea4b45d249ecd67aa5d74638 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/***************************************************************************
alarm.h - description
-------------------
begin : Mon Feb 4 2002
copyright : (C) 2002 by Martin Witte / Frank Schwanz
email : [email protected] / [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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 <kdemacros.h>
#include <vector>
/**
*@author Martin Witte
*/
class KDE_EXPORT 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
|