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.
 Flight (const QUuid &uuid)
 Construct with a specific 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.
Q_INVOKABLE bool operator== (const Flightlog::Flight &other) const
 Comparison operator.

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 39 of file Flight.h.

Constructor & Destructor Documentation

◆ Flight()

Flightlog::Flight::Flight ( const QUuid & uuid)
inlineexplicit

Construct with a specific identity.

Used when restoring a flight whose identity must be preserved, e.g. when reading a row back from a storage backend. Unlike the default constructor, this does not generate a fresh identity — except as a fallback if uuid is null.

Parameters
uuidThe identity to use

Definition at line 96 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 150 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 174 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 114 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 156 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 168 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 108 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

◆ 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 180 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 162 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 132 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 120 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 138 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 144 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 238 of file Flight.h.

◆ setArrivalCoordinate()

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

Set arrival coordinate.

Parameters
coordThe arrival airport coordinate

Definition at line 262 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 202 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 244 of file Flight.h.

◆ setDepartureCoordinate()

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

Set departure coordinate.

Parameters
coordThe departure airport coordinate

Definition at line 256 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 196 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 250 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 220 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 208 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 226 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 232 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 214 of file Flight.h.

◆ setTrackFile()

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

Set the track file name.

Rejects non-empty values containing a path separator ('/' or '\'), guarding against path traversal when this name is later combined with the tracks directory to build a file path (e.g. in FlightRecorder). Such a value is silently ignored, leaving the track file unchanged. An empty value is always accepted, since that's how callers clear a previously-set track file.

Parameters
fileNameThe track file name (relative to tracks directory), or empty to clear it

Definition at line 276 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 126 of file Flight.h.

◆ 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 186 of file Flight.h.


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