defuze.me
Client
|
00001 #ifndef EVENTMODEL_HPP 00002 #define EVENTMODEL_HPP 00003 00004 #include <QString> 00005 #include <QLabel> 00006 #include <QMouseEvent> 00007 #include <QDebug> 00008 #include <QSqlQuery> 00009 00010 #include "guicore.hpp" 00011 #include "scheduler.hpp" 00012 #include "eventplaylistitem.hpp" 00013 00014 namespace Scheduler 00015 { 00016 00017 class SchedulerPlugin; 00018 00019 class EventModel : public QLabel 00020 { 00021 Q_OBJECT 00022 friend class EventWidget; 00023 00024 public: 00025 EventModel(SchedulerPlugin *scheduler, QString title, QString description, short day, int start, int duration, int id = 0); 00026 00027 int save(); 00028 void saveColor(int color); 00029 void savePlaylists(QList<int> playlists); 00030 00031 int getId() const; 00032 00033 QString getTitle() const; 00034 QString getDescription() const; 00035 00036 short getDay() const; 00037 int getStartTime() const; 00038 int getDuration() const; 00039 00040 QDateTime nextInstance() const; 00041 00042 const QString& getColor(); 00043 int getColorID(); 00044 static const QString& getColorByID(int colorID); 00045 QList<int> getPlaylists(); 00046 00047 // Event styles 00048 void focusIn(); 00049 void focusOut(); 00050 void setStyle(); 00051 00052 void remove(); 00053 00054 private: 00055 SchedulerPlugin *scheduler; 00056 00057 int id; 00058 00059 QString title; 00060 QString description; 00061 00062 short day; 00063 int start; 00064 int duration; 00065 int color; 00066 static QMap<int, QString> colors; 00067 00068 public slots: 00069 void eventClicked(); 00070 00071 signals: 00072 void clicked(); 00073 00074 protected: 00075 void mousePressEvent(QMouseEvent *); 00076 00077 }; 00078 00079 } 00080 00081 #endif // EVENTMODEL_HPP