24#include <QGeoCoordinate>
29#include "units/Distance.h"
43 QML_VALUE_TYPE(flight)
86 Flight() : m_id(QUuid::createUuid()) {}
92 [[nodiscard]]
auto uuid() const -> QUuid {
return m_id; }
98 [[nodiscard]]
auto departureICAO() const -> QString {
return m_departureICAO; }
104 [[nodiscard]]
auto arrivalICAO() const -> QString {
return m_arrivalICAO; }
110 [[nodiscard]]
auto offBlockTime() const -> QDateTime {
return m_offBlockTime; }
116 [[nodiscard]]
auto startTime() const -> QDateTime {
return m_startTime; }
122 [[nodiscard]]
auto landingTime() const -> QDateTime {
return m_landingTime; }
128 [[nodiscard]]
auto onBlockTime() const -> QDateTime {
return m_onBlockTime; }
134 [[nodiscard]]
auto pilotName() const -> QString {
return m_pilotName; }
146 [[nodiscard]]
auto comments() const -> QString {
return m_comments; }
152 [[nodiscard]]
auto landingCount() const ->
int {
return m_landingCount; }
170 [[nodiscard]]
auto hasTrack() const ->
bool {
return !m_trackFile.isEmpty(); }
176 [[nodiscard]]
auto trackFile() const -> QString {
return m_trackFile; }
297 [[nodiscard]]
auto toJSON() const -> QJsonObject;
311 Q_INVOKABLE
bool operator==(const Flightlog::
Flight& other) const;
314 QString m_departureICAO;
315 QString m_arrivalICAO;
316 QDateTime m_offBlockTime;
317 QDateTime m_startTime;
318 QDateTime m_landingTime;
319 QDateTime m_onBlockTime;
321 QString m_aircraftCallsign;
323 int m_landingCount {0};
324 QGeoCoordinate m_departureCoordinate;
325 QGeoCoordinate m_arrivalCoordinate;
auto pilotName() const -> QString
Getter function for property of the same name.
auto arrivalCoordinate() const -> QGeoCoordinate
Coordinate of the arrival airport.
void setArrivalICAO(const QString &icao)
Setter function for property of the same name.
auto toJSON() const -> QJsonObject
Serialize to JSON.
void setLandingTime(const QDateTime &dt)
Setter function for property of the same name.
QDateTime landingTime
Landing time in UTC.
Q_INVOKABLE QString blockTime() const
Block time as a formatted string.
auto landingTime() const -> QDateTime
Getter function for property of the same name.
QUuid uuid
Unique identity of this flight entry (stable across sorting and edits).
void setPilotName(const QString &name)
Setter function for property of the same name.
auto aircraftCallsign() const -> QString
Getter function for property of the same name.
auto trackFile() const -> QString
Get the track file name.
QString trackFile
Filename of the track file (relative to tracks directory).
QDateTime startTime
Start (takeoff) time in UTC.
auto departureCoordinate() const -> QGeoCoordinate
Coordinate of the departure airport.
Flight()
Default constructor — generates a unique identity.
auto onBlockTime() const -> QDateTime
Getter function for property of the same name.
QString arrivalICAO
ICAO code of the arrival airport.
auto arrivalICAO() const -> QString
Getter function for property of the same name.
auto landingCount() const -> int
Getter function for property of the same name.
auto startTime() const -> QDateTime
Getter function for property of the same name.
QDateTime onBlockTime
On-block time in UTC (optional).
void setAircraftCallsign(const QString &callsign)
Setter function for property of the same name.
void setArrivalCoordinate(const QGeoCoordinate &coord)
Set arrival coordinate.
QString aircraftCallsign
Aircraft callsign (e.g. D-KEBE, optional).
Q_INVOKABLE Units::Distance distance() const
Direct distance between departure and arrival airports.
void setComments(const QString &text)
Setter function for property of the same name.
QString comments
Free-text comments (optional).
Q_INVOKABLE QString flightTime() const
Flight duration as a human-readable string (H:MM).
auto comments() const -> QString
Getter function for property of the same name.
auto departureICAO() const -> QString
Getter function for property of the same name.
int landingCount
Number of landings (touch-and-goes + final landing).
QDateTime offBlockTime
Off-block time in UTC (optional).
void setDepartureICAO(const QString &icao)
Setter function for property of the same name.
void setOffBlockTime(const QDateTime &dt)
Setter function for property of the same name.
void setDepartureCoordinate(const QGeoCoordinate &coord)
Set departure coordinate.
void setStartTime(const QDateTime &dt)
Setter function for property of the same name.
void setOnBlockTime(const QDateTime &dt)
Setter function for property of the same name.
auto hasTrack() const -> bool
Check if this flight has a recorded GPS track.
void setLandingCount(int count)
Setter function for property of the same name.
static auto fromJSON(const QJsonObject &json) -> Flight
Deserialize from JSON.
QString departureICAO
ICAO code of the departure airport.
QString pilotName
Pilot name (optional).
bool hasTrack
Whether this flight has a recorded track.
auto offBlockTime() const -> QDateTime
Getter function for property of the same name.
void setTrackFile(const QString &fileName)
Set the track file name.
Q_INVOKABLE qint64 flightTimeSeconds() const
Flight duration in seconds.
Convenience class for distance computations.