Enroute Flight Navigation
A navigation app for VFR pilots
Flightlog::Flight Class Reference

A single flight log entry. More...

#include <Flight.h>

Public Member Functions

 Flight ()
 Default constructor — generates a unique identity.
auto departureICAO () const -> QString
 Getter function for property of the same name.
auto arrivalICAO () const -> QString
 Getter function for property of the same name.
auto offBlockTime () const -> QDateTime
 Getter function for property of the same name.
auto startTime () const -> QDateTime
 Getter function for property of the same name.
auto landingTime () const -> QDateTime
 Getter function for property of the same name.
auto onBlockTime () const -> QDateTime
 Getter function for property of the same name.
auto pilotName () const -> QString
 Getter function for property of the same name.
auto aircraftCallsign () const -> QString
 Getter function for property of the same name.
auto comments () const -> QString
 Getter function for property of the same name.
auto landingCount () const -> int
 Getter function for property of the same name.
auto departureCoordinate () const -> QGeoCoordinate
 Coordinate of the departure airport.
auto arrivalCoordinate () const -> QGeoCoordinate
 Coordinate of the arrival airport.
auto hasTrack () const -> bool
 Check if this flight has a recorded GPS track.
auto trackFile () const -> QString
 Get the track file name.
void setDepartureICAO (const QString &icao)
 Setter function for property of the same name.
void setArrivalICAO (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 setStartTime (const QDateTime &dt)
 Setter function for property of the same name.
void setLandingTime (const QDateTime &dt)
 Setter function for property of the same name.
void setOnBlockTime (const QDateTime &dt)
 Setter function for property of the same name.
void setPilotName (const QString &name)
 Setter function for property of the same name.
void setAircraftCallsign (const QString &callsign)
 Setter function for property of the same name.
void setComments (const QString &text)
 Setter function for property of the same name.
void setLandingCount (int count)
 Setter function for property of the same name.
void setDepartureCoordinate (const QGeoCoordinate &coord)
 Set departure coordinate.
void setArrivalCoordinate (const QGeoCoordinate &coord)
 Set arrival coordinate.
void setTrackFile (const QString &fileName)
 Set the track file name.
Q_INVOKABLE Units::Distance distance () const
 Direct distance between departure and arrival airports.
Q_INVOKABLE QString flightTime () const
 Flight duration as a human-readable string (H:MM).
Q_INVOKABLE QString blockTime () const
 Block time as a formatted string.
Q_INVOKABLE qint64 flightTimeSeconds () const
 Flight duration in seconds.
auto toJSON () const -> QJsonObject
 Serialize to JSON.
Q_INVOKABLE bool operator== (const Flightlog::Flight &other) const
 Comparison operator.

Static Public Member Functions

static auto fromJSON (const QJsonObject &json) -> Flight
 Deserialize from JSON.

Properties

QUuid uuid
 Unique identity of this flight entry (stable across sorting and edits).
QString departureICAO
 ICAO code of the departure airport.
QString arrivalICAO
 ICAO code of the arrival airport.
QDateTime offBlockTime
 Off-block time in UTC (optional).
QDateTime startTime
 Start (takeoff) time in UTC.
QDateTime landingTime
 Landing time in UTC.
QDateTime onBlockTime
 On-block time in UTC (optional).
QString pilotName
 Pilot name (optional).
QString aircraftCallsign
 Aircraft callsign (e.g. D-KEBE, optional).
QString comments
 Free-text comments (optional).
int landingCount
 Number of landings (touch-and-goes + final landing).
bool hasTrack
 Whether this flight has a recorded track.
QString trackFile
 Filename of the track file (relative to tracks directory).

Detailed Description

A single flight log entry.

This class represents a single flight with departure/arrival airports, times, and optional metadata. It can compute the direct distance between departure and arrival, and the flight duration.

Definition at line 40 of file Flight.h.

Member Function Documentation

◆ aircraftCallsign()

auto Flightlog::Flight::aircraftCallsign ( ) const -> QString
inlinenodiscard

Getter function for property of the same name.

Returns
Property aircraftCallsign

Definition at line 140 of file Flight.h.

◆ arrivalCoordinate()

auto Flightlog::Flight::arrivalCoordinate ( ) const -> QGeoCoordinate
inlinenodiscard

Coordinate of the arrival airport.

Returns
The arrival airport coordinate, or an invalid coordinate if unknown

Definition at line 164 of file Flight.h.

◆ arrivalICAO()

auto Flightlog::Flight::arrivalICAO ( ) const -> QString
inlinenodiscard

Getter function for property of the same name.

Returns
Property arrivalICAO

Definition at line 104 of file Flight.h.

◆ blockTime()

Q_INVOKABLE QString Flightlog::Flight::blockTime ( ) const
nodiscard

Block time as a formatted string.

Returns the block time (off-block to on-block) formatted as h:mm. Returns an empty string if either time is invalid or if block time is negative.

Returns
Block time string, e.g. "1:23", or empty string

◆ comments()

auto Flightlog::Flight::comments ( ) const -> QString
inlinenodiscard

Getter function for property of the same name.

Returns
Property comments

Definition at line 146 of file Flight.h.

◆ departureCoordinate()

auto Flightlog::Flight::departureCoordinate ( ) const -> QGeoCoordinate
inlinenodiscard

Coordinate of the departure airport.

Returns
The departure airport coordinate, or an invalid coordinate if unknown

Definition at line 158 of file Flight.h.

◆ departureICAO()

auto Flightlog::Flight::departureICAO ( ) const -> QString
inlinenodiscard

Getter function for property of the same name.

Returns
Property departureICAO

Definition at line 98 of file Flight.h.

◆ distance()

Q_INVOKABLE Units::Distance Flightlog::Flight::distance ( ) const
nodiscard

Direct distance between departure and arrival airports.

Returns
The distance, or an invalid distance if coordinates are unknown

◆ flightTime()

Q_INVOKABLE QString Flightlog::Flight::flightTime ( ) const
nodiscard

Flight duration as a human-readable string (H:MM).

Returns
The flight time string, or an empty string if times are invalid

◆ flightTimeSeconds()

Q_INVOKABLE qint64 Flightlog::Flight::flightTimeSeconds ( ) const
nodiscard

Flight duration in seconds.

Returns
The duration in seconds, or -1 if times are invalid

◆ fromJSON()

auto Flightlog::Flight::fromJSON ( const QJsonObject & json) -> Flight
static

Deserialize from JSON.

Parameters
jsonThe JSON object to read from
Returns
A Flight constructed from the JSON data

◆ hasTrack()

auto Flightlog::Flight::hasTrack ( ) const -> bool
inlinenodiscard

Check if this flight has a recorded GPS track.

Returns
True if a track file is associated with this flight

Definition at line 170 of file Flight.h.

◆ landingCount()

auto Flightlog::Flight::landingCount ( ) const -> int
inlinenodiscard

Getter function for property of the same name.

Returns
Property landingCount

Definition at line 152 of file Flight.h.

◆ landingTime()

auto Flightlog::Flight::landingTime ( ) const -> QDateTime
inlinenodiscard

Getter function for property of the same name.

Returns
Property landingTime

Definition at line 122 of file Flight.h.

◆ offBlockTime()

auto Flightlog::Flight::offBlockTime ( ) const -> QDateTime
inlinenodiscard

Getter function for property of the same name.

Returns
Property offBlockTime

Definition at line 110 of file Flight.h.

◆ onBlockTime()

auto Flightlog::Flight::onBlockTime ( ) const -> QDateTime
inlinenodiscard

Getter function for property of the same name.

Returns
Property onBlockTime

Definition at line 128 of file Flight.h.

◆ operator==()

Q_INVOKABLE bool Flightlog::Flight::operator== ( const Flightlog::Flight & other) const

Comparison operator.

Parameters
otherFlight to compare with
Returns
True if both flights are equal

◆ pilotName()

auto Flightlog::Flight::pilotName ( ) const -> QString
inlinenodiscard

Getter function for property of the same name.

Returns
Property pilotName

Definition at line 134 of file Flight.h.

◆ setAircraftCallsign()

void Flightlog::Flight::setAircraftCallsign ( const QString & callsign)
inline

Setter function for property of the same name.

Parameters
callsignProperty aircraftCallsign

Definition at line 228 of file Flight.h.

◆ setArrivalCoordinate()

void Flightlog::Flight::setArrivalCoordinate ( const QGeoCoordinate & coord)
inline

Set arrival coordinate.

Parameters
coordThe arrival airport coordinate

Definition at line 252 of file Flight.h.

◆ setArrivalICAO()

void Flightlog::Flight::setArrivalICAO ( const QString & icao)
inline

Setter function for property of the same name.

Parameters
icaoProperty arrivalICAO

Definition at line 192 of file Flight.h.

◆ setComments()

void Flightlog::Flight::setComments ( const QString & text)
inline

Setter function for property of the same name.

Parameters
textProperty comments

Definition at line 234 of file Flight.h.

◆ setDepartureCoordinate()

void Flightlog::Flight::setDepartureCoordinate ( const QGeoCoordinate & coord)
inline

Set departure coordinate.

Parameters
coordThe departure airport coordinate

Definition at line 246 of file Flight.h.

◆ setDepartureICAO()

void Flightlog::Flight::setDepartureICAO ( const QString & icao)
inline

Setter function for property of the same name.

Parameters
icaoProperty departureICAO

Definition at line 186 of file Flight.h.

◆ setLandingCount()

void Flightlog::Flight::setLandingCount ( int count)
inline

Setter function for property of the same name.

Parameters
countProperty landingCount

Definition at line 240 of file Flight.h.

◆ setLandingTime()

void Flightlog::Flight::setLandingTime ( const QDateTime & dt)
inline

Setter function for property of the same name.

Parameters
dtProperty landingTime

Definition at line 210 of file Flight.h.

◆ setOffBlockTime()

void Flightlog::Flight::setOffBlockTime ( const QDateTime & dt)
inline

Setter function for property of the same name.

Parameters
dtProperty offBlockTime

Definition at line 198 of file Flight.h.

◆ setOnBlockTime()

void Flightlog::Flight::setOnBlockTime ( const QDateTime & dt)
inline

Setter function for property of the same name.

Parameters
dtProperty onBlockTime

Definition at line 216 of file Flight.h.

◆ setPilotName()

void Flightlog::Flight::setPilotName ( const QString & name)
inline

Setter function for property of the same name.

Parameters
nameProperty pilotName

Definition at line 222 of file Flight.h.

◆ setStartTime()

void Flightlog::Flight::setStartTime ( const QDateTime & dt)
inline

Setter function for property of the same name.

Parameters
dtProperty startTime

Definition at line 204 of file Flight.h.

◆ setTrackFile()

void Flightlog::Flight::setTrackFile ( const QString & fileName)
inline

Set the track file name.

Parameters
fileNameThe track file name (relative to tracks directory)

Definition at line 258 of file Flight.h.

◆ startTime()

auto Flightlog::Flight::startTime ( ) const -> QDateTime
inlinenodiscard

Getter function for property of the same name.

Returns
Property startTime

Definition at line 116 of file Flight.h.

◆ toJSON()

auto Flightlog::Flight::toJSON ( ) const -> QJsonObject
nodiscard

Serialize to JSON.

Returns
A JSON object representing this flight

◆ trackFile()

auto Flightlog::Flight::trackFile ( ) const -> QString
inlinenodiscard

Get the track file name.

Returns
The track file name (relative to tracks directory), or empty

Definition at line 176 of file Flight.h.


The documentation for this class was generated from the following file: