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                : emw-kradio@nocabal.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 <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;  // < 0: disabled
00048 
00049     AlarmType     m_type;
00050 
00051     int           m_ID;
00052 
00053     static int    m_LastID;
00054 
00055 public:
00056     Alarm();
00057     Alarm(const QDateTime &time, bool daily, bool enabled);
00058     Alarm(const Alarm &);
00059     ~Alarm();
00060 
00061     bool           isEnabled() const            { return m_enabled;   }
00062     bool           isDaily() const              { return m_daily;     }
00063     int            weekdayMask() const          { return m_weekdayMask; }
00064     QDateTime      alarmTime () const           { return m_time;      }
00065     QDateTime      nextAlarm (bool ignoreEnable = false) const;
00066     const QString &stationID () const           { return m_stationID; }
00067     float          volumePreset () const        { return m_volumePreset; }
00068     AlarmType      alarmType() const            { return m_type; }
00069 
00070     int            ID() const                   { return m_ID; }
00071 
00072     void        setEnabled (bool enable = true) { m_enabled = enable; }
00073     void        setDaily (bool d = true)        { m_daily        = d; }
00074     void        setWeekdayMask(int m = 0x7F)    { m_weekdayMask  = m; }
00075     void        setDate (const QDate &d)        { m_time.setDate(d);  }
00076     void        setTime (const QTime &d)        { m_time.setTime(d);  }
00077     void        setVolumePreset(float v)        { m_volumePreset = v; }
00078     void        setStationID(const QString &id) { m_stationID    = id;}
00079     void        setAlarmType(AlarmType t)       { m_type         = t; }
00080 
00081 
00082     bool  operator == (const Alarm &x) const {
00083         return
00084             m_time         == x.m_time &&
00085             m_daily        == x.m_daily &&
00086             m_weekdayMask  == x.m_weekdayMask &&
00087             m_enabled      == x.m_enabled &&
00088             m_stationID    == x.m_stationID &&
00089             m_volumePreset == x.m_volumePreset &&
00090             m_type         == x.m_type &&
00091             m_ID           == x.m_ID;
00092     }
00093     bool  operator != (const Alarm &x) const { return ! operator == (x); }
00094 
00095 };
00096 
00097 //using namespace std;
00098 
00099 typedef QVector<Alarm>                 AlarmVector;
00100 typedef AlarmVector::iterator          iAlarmVector;
00101 typedef AlarmVector::const_iterator    ciAlarmVector;
00102 
00103 
00104 
00105 #endif

Generated on Tue Jun 2 19:19:57 2009 for kradio4 by  doxygen 1.5.8