22 #include <QRegularExpression>
23 #include <QMessageBox>
26 #include <QStringList>
27 #include <QButtonGroup>
30 #include <QCalendarWidget>
34 #include "src/functions/atime.h"
36 #include "src/classes/aflightentry.h"
37 #include "src/classes/apilotentry.h"
38 #include "src/classes/atailentry.h"
39 #include "src/database/adatabase.h"
61 void onToUpperTriggered_textChanged(
const QString&);
62 void onPilotNameLineEdit_editingFinished();
63 void onLocationEditingFinished(QLineEdit*, QLabel*);
64 void onTimeLineEdit_editingFinished();
65 void onCompleter_highlighted(
const QString&);
66 void onCompleter_activated(
const QString &);
67 void onCalendarWidget_clicked(
const QDate &date);
68 void on_doftLineEdit_editingFinished();
69 void on_cancelButton_clicked();
70 void on_submitButton_clicked();
71 void on_setAsDefaultButton_clicked();
72 void on_restoreDefaultButton_clicked();
73 void on_PilotFlyingCheckBox_stateChanged(
int arg1);
74 void on_IfrCheckBox_stateChanged(
int);
75 void on_manualEditingCheckBox_stateChanged(
int arg1);
76 void on_ApproachComboBox_currentTextChanged(
const QString &arg1);
77 void on_FunctionComboBox_currentIndexChanged(
int index);
78 void on_deptLocLineEdit_editingFinished();
79 void on_destLocLineEdit_editingFinished();
80 void on_acftLineEdit_editingFinished();
81 void on_deptTZComboBox_currentIndexChanged(
int index);
82 void on_destTZComboBox_currentIndexChanged(
int index);
84 void on_calendarPushButton_clicked();
101 struct MandatoryLineEdits {
102 QVector<QLineEdit*> lineEdits;
103 QBitArray lineEditsValid;
105 MandatoryLineEdits() =
default;
106 MandatoryLineEdits(std::initializer_list<QLineEdit*> init_list);
107 void operator= (std::initializer_list<QLineEdit*> init_list);
109 bool contains(QLineEdit* line_edit);
110 void validate(QLineEdit* line_edit);
111 void unvalidate(QLineEdit* line_edit);
114 bool validAt(
int idx);
116 QLineEdit* operator[] (
int idx);
118 } mandatoryLineEdits;
120 QVector<QLineEdit*> primaryTimeLineEdits;
121 QVector<QLineEdit*> pilotsLineEdits;
126 QStringList pilotList;
127 QStringList tailsList;
128 QStringList airportList;
133 QMap<PilotName_T, PilotRowId_T> pilotsIdMap;
134 QMap<TailRegistration_T, TailId_T> tailsIdMap;
135 QMap<AirportICAO_T, AirportId_T> airportIcaoIdMap;
136 QMap<AirportIATA_T, AirportId_T> airportIataIdMap;
137 QMap<AirportName_T, AirportId_T> airportNameIdMap;
139 Opl::Time::FlightTimeFormat flightTimeFormat;
149 void writeSettings();
150 void setupButtonGroups();
151 void setupRawInputValidation();
152 void setupSignalsAndSlots();
154 void fillDeductibleData();
156 void onMandatoryLineEditsFilled();
157 void onGoodInputReceived(QLineEdit*);
158 void onBadInputReceived(QLineEdit *);
159 bool eventFilter(QObject *
object, QEvent *event);
160 bool isLessOrEqualThanBlockTime(
const QString time_string);
162 void addNewTail(QLineEdit*);
163 void addNewPilot(QLineEdit *);
165 RowData_T collectInput();
171 inline int stringToMinutes(
const QString &time_string, Opl::Time::FlightTimeFormat format)
173 return ATime::toMinutes(ATime::fromString(time_string, format));
180 inline QString minutesToString(
const int minutes, Opl::Time::FlightTimeFormat format)
182 return ATime::toString(ATime::fromMinutes(minutes), format);
187 #endif // NEWFLIGHT_H