2
0

NewFlightDialog.3 5.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. .TH "NewFlightDialog" 3 "Tue Aug 9 2022" "openPilotLog" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. NewFlightDialog \- The \fBNewFlightDialog\fP is used to add or edit entries from the flights table in the database\&.
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .PP
  10. \fC#include <newflightdialog\&.h>\fP
  11. .PP
  12. Inherits QDialog\&.
  13. .SS "Public Member Functions"
  14. .in +1c
  15. .ti -1c
  16. .RI "\fBNewFlightDialog\fP (\fBOPL::DbCompletionData\fP &completion_data, QWidget *parent=nullptr)"
  17. .br
  18. .RI "\fBNewFlightDialog\fP - Creates a \fBNewFlightDialog\fP that can be used to add a new flight entry to the logbook\&. "
  19. .ti -1c
  20. .RI "\fBNewFlightDialog\fP (\fBOPL::DbCompletionData\fP &completion_data, int row_id, QWidget *parent=nullptr)"
  21. .br
  22. .RI "\fBNewFlightDialog\fP - Creates a \fBNewFlightDialog\fP that can be used to edit an existing entry in the logbook\&. "
  23. .in -1c
  24. .SS "Protected Member Functions"
  25. .in +1c
  26. .ti -1c
  27. .RI "bool \fBeventFilter\fP (QObject *object, QEvent *event) override"
  28. .br
  29. .RI "\fBNewFlightDialog::eventFilter\fP invalidates mandatory line edits on focus in\&. "
  30. .in -1c
  31. .SH "Detailed Description"
  32. .PP
  33. The \fBNewFlightDialog\fP is used to add or edit entries from the flights table in the database\&.
  34. \fBNewFlightDialog\fP offers two constructors, one is used to create a new flight entry from scratch, where the other one is used to edit an existing entry\&. This entry is identified by its ROW ID, which is used to retreive the entry data and pre-populate the user interface with the data from the database\&.
  35. .PP
  36. The flights table is the core of the application's database and care needs to be taken when interfacing with it\&.
  37. .PP
  38. To ensure only good data is written to the database, the \fBValidationState\fP class is used\&. It contains a QBitArray with each bit representing a mandatory data point\&. The array is initialized to all false and progressively changed to true as entry data is validated\&. An entry can only be submitted if all the verification bits are set\&.
  39. .PP
  40. Inputs from the user are verified with a two-step process\&. The first level of verification is accomplished by QRegularExpressionValidator, which limits the user to only inputting generally acceptable data (like numbers for date or time, or characters for airport identifiers)\&. If the input passes this sanity check, the line edits emit the editingFinished() signal, which triggers a more granular and sophisticated set of input verification, broadly based on cross-checking the entered data against known good values\&. The ACompletionData class is used to provide QHashs of known good values from the database and their respective ROW_IDs\&. If user-entered data has been matched to a known good database value, the data is considered acceptable\&. This means that in order to, for example, log a flight with a certain Pilot, that this pilot already has to exist in the pilots table\&. If this is not the case, the user is prompted to add a new pilot (or aircraft) to the database before proceeding\&. In order to make this matching process seamless for the user, the completionData also contains a set of QStringLists for each of the database tables which are used to create QCompleters that provide pop-up completion on the respective QLineEdits\&.
  41. .PP
  42. Once the user is satisfied with his entries, a final set of input verification is triggered and the entry is submitted to the database, see on_buttonBox_accepted() and Database::commit()
  43. .SH "Constructor & Destructor Documentation"
  44. .PP
  45. .SS "NewFlightDialog::NewFlightDialog (\fBOPL::DbCompletionData\fP & completion_data, QWidget * parent = \fCnullptr\fP)\fC [explicit]\fP"
  46. .PP
  47. \fBNewFlightDialog\fP - Creates a \fBNewFlightDialog\fP that can be used to add a new flight entry to the logbook\&.
  48. .PP
  49. \fBParameters\fP
  50. .RS 4
  51. \fIcompletion_data\fP - contains QStringLists for the QCompleter to autocomplete Airport Codes, Pilot Names and aircraft registrationsn
  52. .RE
  53. .PP
  54. .SS "NewFlightDialog::NewFlightDialog (\fBOPL::DbCompletionData\fP & completion_data, int row_id, QWidget * parent = \fCnullptr\fP)\fC [explicit]\fP"
  55. .PP
  56. \fBNewFlightDialog\fP - Creates a \fBNewFlightDialog\fP that can be used to edit an existing entry in the logbook\&.
  57. .PP
  58. \fBParameters\fP
  59. .RS 4
  60. \fIcompletion_data\fP - contains QStringLists for the QCompleter to autocomplete Airport Codes, Pilot Names and aircraft registrationsn
  61. .br
  62. \fIrow_id\fP - The database ROW ID of the entry to be edited
  63. .RE
  64. .PP
  65. .SH "Member Function Documentation"
  66. .PP
  67. .SS "bool NewFlightDialog::eventFilter (QObject * object, QEvent * event)\fC [override]\fP, \fC [protected]\fP"
  68. .PP
  69. \fBNewFlightDialog::eventFilter\fP invalidates mandatory line edits on focus in\&. Some of the QLineEdits have validators set that provide raw input validation\&. These validators have the side effect that if an input does not meet the raw input validation criteria, onEditingFinished() is not emitted when the line edit loses focus\&. This could lead to a line edit that previously had good input to be changed to bad input without the validation bit in validationState being unset, because the second step of input validation is only triggered when editingFinished() is emitted\&.
  70. .SH "Author"
  71. .PP
  72. Generated automatically by Doxygen for openPilotLog from the source code\&.