1/*
2 * Copyright (C) 2012 Cutehacks AS. All rights reserved.
3 * info@cutehacks.com
4 * http://cutehacks.com
5 *
6 * This file is part of Fly.
7 *
8 * Fly is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * Fly is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with Fly. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#ifndef FLIGHTTIMES_H
23#define FLIGHTTIMES_H
24
25#include "xmldatasource.h"
26
27class FlightTimes : public XmlDataSource
28{
29 Q_OBJECT
30 Q_PROPERTY(int timeFrom READ timeFrom WRITE setTimeFrom NOTIFY timeFromChanged)
31 Q_PROPERTY(int timeTo READ timeTo WRITE setTimeTo NOTIFY timeToChanged)
32 Q_PROPERTY(QString airportCode READ airportCode WRITE setAirportCode NOTIFY airportCodeChanged)
33 Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged)
34 Q_PROPERTY(QString directionString READ directionString WRITE setDirectionString NOTIFY directionChanged)
35 Q_PROPERTY(QDateTime lastUpdate READ lastUpdate WRITE setLastUpdate NOTIFY lastUpdateChanged)
36
37public:
38
39 enum Direction { All, Departures, Arrivals };
40
41 FlightTimes(Direction direction = All, QObject *parent = 0);
42 ~FlightTimes();
43
44 int timeFrom() const;
45 void setTimeFrom(int time);
46
47 int timeTo() const;
48 void setTimeTo(int time);
49
50 QString airportCode() const;
51 void setAirportCode(const QString &code);
52
53 Direction direction() const;
54 void setDirection(Direction direction);
55
56 QString directionString() const;
57 void setDirectionString(const QString &direction);
58
59 QDateTime lastUpdate() const;
60 void setLastUpdate(const QDateTime &time);
61
62Q_SIGNALS:
63 void timeFromChanged();
64 void timeToChanged();
65 void airportCodeChanged();
66 void directionChanged();
67 void lastUpdateChanged();
68
69protected:
70 static QString toString(Direction direction);
71 static Direction fromString(const QString &direction);
72
73private:
74 int m_timeFrom;
75 int m_timeTo;
76 QString m_airportCode;
77 Direction m_direction;
78 QDateTime m_lastUpdate;
79};
80
81#endif
82