alarm.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           alarm.h  -  description
00003                              -------------------
00004     begin                : Mon Feb 4 2002
00005     copyright            : (C) 2002 by Martin Witte / Frank Schwanz
00006     email                : witte@kawo1.rwth-aachen.de / schwanz@fh-brandenburg.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
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 <qdatetime.h>
00026 #include <vector>
00027 
00032 class Alarm
00033 {
00034 public:
00035 
00036     enum AlarmType { StartPlaying, StopPlaying, StartRecording, StopRecording };
00037 
00038 protected:
00039     QDateTime     m_time;
00040 
00041     bool          m_daily;
00042     int           m_weekdayMask;
00043 
00044     bool          m_enabled;
00045     QString       m_stationID;
00046     float         m_volumePreset;  // < 0: disabled
00047 
00048     AlarmType     m_type;
00049 
00050     int           m_ID;
00051 
00052     static int    m_LastID;
00053 
00054 public:
00055     Alarm();
00056     Alarm(const QDateTime &time, bool daily, bool enabled);
00057     Alarm(const Alarm &);
00058     ~Alarm();
00059 
00060     bool           isEnabled() const            { return m_enabled;   }
00061     bool           isDaily() const              { return m_daily;     }
00062     int            weekdayMask() const          { return m_weekdayMask; }
00063     QDateTime      alarmTime () const           { return m_time;      }
00064     QDateTime      nextAlarm (bool ignoreEnable = false) const;
00065     const QString &stationID () const           { return m_stationID; }
00066     float          volumePreset () const        { return m_volumePreset; }
00067     AlarmType      alarmType() const            { return m_type; }
00068 
00069     int            ID() const                   { return m_ID; }
00070 
00071     void        setEnabled (bool enable = true) { m_enabled = enable; }
00072     void        setDaily (bool d = true)        { m_daily        = d; }
00073     void        setWeekdayMask(int m = 0x7F)    { m_weekdayMask  = m; }
00074     void        setDate (const QDate &d)        { m_time.setDate(d);  }
00075     void        setTime (const QTime &d)        { m_time.setTime(d);  }
00076     void        setVolumePreset(float v)        { m_volumePreset = v; }
00077     void        setStationID(const QString &id) { m_stationID    = id;}
00078     void        setAlarmType(AlarmType t)       { m_type         = t; }
00079 
00080 
00081     bool  operator == (const Alarm &x) const {
00082         return
00083             m_time         == x.m_time &&
00084             m_daily        == x.m_daily &&
00085             m_weekdayMask  == x.m_weekdayMask &&
00086             m_enabled      == x.m_enabled &&
00087             m_stationID    == x.m_stationID &&
00088             m_volumePreset == x.m_volumePreset &&
00089             m_type         == x.m_type &&
00090             m_ID           == x.m_ID;
00091     }
00092     bool  operator != (const Alarm &x) const { return ! operator == (x); }
00093 
00094 };
00095 
00096 using namespace std;
00097 
00098 typedef vector<Alarm>                  AlarmVector;
00099 typedef AlarmVector::iterator          iAlarmVector;
00100 typedef AlarmVector::const_iterator    ciAlarmVector;
00101 
00102 
00103 
00104 #endif

Generated on Fri Jan 28 16:28:08 2011 for kradio by  doxygen 1.4.7