source: src/mvc/event.h @ 1343ea4

qt5
Last change on this file since 1343ea4 was 1343ea4, checked in by Philipp Spitzer <philipp@…>, 5 years ago

Now the conflict severity is drawn.

  • Property mode set to 100644
File size: 4.4 KB
RevLine 
[ca90cb1]1/*
2 * Copyright (C) 2010 Ixonos Plc.
[4a87a3b]3 * Copyright (C) 2011-2015 Philipp Spitzer, gregor herrmann, Stefan Stahl
[ca90cb1]4 *
[6df32f2]5 * This file is part of ConfClerk.
[ca90cb1]6 *
[6df32f2]7 * ConfClerk is free software: you can redistribute it and/or modify it
[ca90cb1]8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 2 of the License, or (at your option)
10 * any later version.
11 *
[6df32f2]12 * ConfClerk is distributed in the hope that it will be useful, but
[ca90cb1]13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
[6df32f2]18 * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
[ca90cb1]19 */
[e5bc908]20#ifndef EVENT_H
21#define EVENT_H
22
23#include <QDateTime>
[5a73d27]24#include <QVector>
25#include <QStringList>
[e5bc908]26
[8d6798d]27#include "ormrecord.h"
[5a73d27]28
[0d995ed]29class Room;
30
[5a73d27]31/**
32  NoSuchEventException is thrown when required event does not exist.
33*/
34class NoSuchEventException
35{
36};
37
[3cd9fe6]38
39enum Favourite {Favourite_no=0, Favourite_weak=2, Favourite_strong=1};
40
41
[20a6010]42class Event : public OrmRecord<Event>
[e5bc908]43{
44public:
[a1755df]45    Event();
[64122f1]46    static const QSqlRecord sColumns;
[7d7659d]47    static QString const sTableName;
[5a73d27]48public:
[20a6010]49    static Event getById(int id, int conferenceId);
[64122f1]50    static QList<Event> getByDate(const QDate & date, int conferenceId, QString orderBy);
51    static QList<Event> getFavByDate(const QDate & date, int conferenceId); // get Favourities by Date
[e662750]52    static QList<Event> getSearchResultByDate(const QDate& date, int conferenceId, QString orderBy);
[005e2b7]53    static QList<Event> getByTrack(int id);
[7620de0]54    static QList<Event> getByDateAndRoom(const QDate& date, int conferenceId);
[d49254d]55    static QList<Event> conflictEvents(int aEventId, int conferenceId);
[3a09de6]56    static QList<Event> getImminentAlarmEvents(int maxSecToAlarm, int conferenceId);
[e5bc908]57public:
[46a5aba]58    int id() const { return value("id").toInt(); }
59    int conferenceId() const { return value("xid_conference").toInt(); }
[4693fa6]60    QDateTime start() const { return value("start").toDateTime(); }
[11d7ec5]61    /// duration of the event in seconds
[46a5aba]62    int duration() const { return value("duration").toInt(); }
[4693fa6]63    int trackId() const { return value("xid_track").toInt(); }
[46a5aba]64    QString type() const { return value("type").toString(); }
65    QString language() const { return value("language").toString(); }
[3cd9fe6]66    Favourite favourite() const { return static_cast<Favourite>(value("favourite").toInt()); }
[46a5aba]67    bool hasAlarm() const { return value("alarm").toBool(); }
[1343ea4]68    Favourite timeConflict() const;
[46a5aba]69    QString tag() const { return value("tag").toString(); }
70    QString title() const { return value("title").toString(); }
71    QString subtitle() const { return value("subtitle").toString(); }
72    QString abstract() const { return value("abstract").toString(); }
73    QString description() const { return value("description").toString(); }
[f9db452]74    // records from other tables associated with 'id'
[0d995ed]75    Room* room();
76    QString roomName();
[a1755df]77    int roomId();
[78e3575]78    QStringList persons();
[a1755df]79    QMap<QString,QString> links();
[20a6010]80
[46a5aba]81    void setId(int id) { setValue("id", id); }
82    void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
[4693fa6]83    void setStart(const QDateTime & start) { setValue("start", start); }
[46a5aba]84    void setDuration(int duration) { setValue("duration", duration); }
[4693fa6]85    void setTrackId(int trackId) { setValue("xid_track", trackId); }
[46a5aba]86    void setType(const QString & type) { setValue("type", type); }
87    void setLanguage(const QString & language) { setValue("language", language); }
[3cd9fe6]88    void setFavourite(Favourite favourite) { setValue("favourite", (int) favourite); }
[7b3cd0e]89    void cycleFavourite();
[46a5aba]90    void setHasAlarm(bool alarm) { setValue("alarm", (int)((alarm))); }
[c790268]91    void setTag(const QString& tag) { setValue("tag", tag); }
92    void setTitle(const QString& title) { setValue("title", title); }
93    void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
94    void setAbstract(const QString& abstract) { setValue("abstract", abstract); }
95    void setDescription(const QString& description) { setValue("description", description); }
[f9db452]96    // records from other tables associated with 'id'
97    void setRoom(const QString& room);
[395d6d3]98    void setPersons(const QStringList &persons);
[6123b48]99    void setLinks(const QMap<QString,QString> &aLinks);
[20a6010]100
101friend class EventTest;
[78e3575]102
103private:
[a1755df]104    QStringList mPersonsList;
105    QMap<QString,QString> mLinksList;
106    int mRoomId;
107    QString mRoomName;
[0d995ed]108    Room* room_;
[e5bc908]109};
110
111#endif // EVENT_H
[680a4da]112
Note: See TracBrowser for help on using the repository browser.