openPilotLog
NewFlightDialog Class Reference
Inheritance diagram for NewFlightDialog:

Public Member Functions

 NewFlightDialog (QWidget *parent=nullptr)
 NewFlightDialog create a new flight and add it to the logbook. More...
 
 NewFlightDialog (int row_id, QWidget *parent=nullptr)
 NewFlightDialog Edit an existing logbook entry.
 

Constructor & Destructor Documentation

◆ NewFlightDialog()

NewFlightDialog::NewFlightDialog ( QWidget *  parent = nullptr)
explicit

NewFlightDialog create a new flight and add it to the logbook.

Construction ///.

[F] The general idea for this dialog is this:

  • Most line edits have validators and completers.
  • Validators are based on regular expressions, serving as raw input validation
  • The Completers are based off the database and provide auto-completion
  • mandatory line edits only emit editing finished if their content has passed raw input validation or focus is lost.
  • Editing finished triggers validating inputs by mapping them to Database values where required and results in either pass or fail.
  • A QBitArray is mainained containing the state of validity of the mandatory line edits
  • The deducted entries are automatically filled if all mandatory entries are valid.
  • Comitting an entry to the database is only allowed if all mandatory inputs are valid.

if the user presses "OK", check if all mandatory inputs are valid, check if optional user inputs are valid and commit.

For the completion and mapping, I have settled on a more low-level approach using Completers based on QStringLists and mapping with QMaps.

I implemented the Completers and mapping based on a QSqlTableModel which would have been quite nice, since it would keep all data in one place, providing both completion and mapping in one model. But as we have seen before with the more high-level qt classes, they are quite slow on execution when used for tasks they were probably not designed to do. Mapping a registration to an ID for example took around 300ms, which is very noticeable in the UI and not an acceptable user experience. Using QStringLists and QMaps this goes down to around 5ms.


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