openPilotLog
newtaildialog.h
1 /*
2  *openPilotLog - A FOSS Pilot Logbook Application
3  *Copyright (C) 2020-2021 Felix Turowsky
4  *
5  *This program is free software: you can redistribute it and/or modify
6  *it under the terms of the GNU General Public License as published by
7  *the Free Software Foundation, either version 3 of the License, or
8  *(at your option) any later version.
9  *
10  *This program is distributed in the hope that it will be useful,
11  *but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *GNU General Public License for more details.
14  *
15  *You should have received a copy of the GNU General Public License
16  *along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 #ifndef NEWTAIL_H
19 #define NEWTAIL_H
20 
21 #include <QDialog>
22 #include <QCompleter>
23 #include <QMessageBox>
24 #include <QRegularExpression>
25 #include <QComboBox>
26 
27 #include "src/classes/asettings.h"
28 #include "src/functions/acalc.h"
29 #include "src/database/adatabase.h"
30 #include "src/classes/atailentry.h"
31 #include "src/classes/aaircraftentry.h"
32 
33 namespace Ui {
34 class NewTail;
35 }
61 class NewTailDialog : public QDialog
62 {
63  Q_OBJECT
64 
65 public:
70  explicit NewTailDialog(const QString& new_registration, QWidget *parent = nullptr);
75  explicit NewTailDialog(int row_id, QWidget *parent = nullptr);
76 
77  ~NewTailDialog();
78 private:
79 
80  Ui::NewTail *ui;
81 
82  ATailEntry entry;
83 
84  QStringList aircraftList;
85 
86  QHash<RowId_T, QString> idMap;
87 
88  void setupCompleter();
89  void setupValidators();
90  void fillForm(AEntry entry, bool is_template);
91  bool verify();
92  void submitForm();
93 
94 private slots:
95  void on_operationComboBox_currentIndexChanged(int index);
96  void on_ppTypeComboBox_currentIndexChanged(int index);
97  void on_ppNumberComboBox_currentIndexChanged(int index);
98  void on_weightComboBox_currentIndexChanged(int index);
99  void on_registrationLineEdit_textChanged(const QString &arg1);
100  void on_buttonBox_accepted();
101  void onSearchCompleterActivated();
102 
103 };
104 
105 #endif // NEWTAIL_H
The Entry class encapsulates table metadata(table name, row id) and data for new and existing entries...
Definition: aentry.h:33
The NewTailDialog enables adding new Tail entries to the database or editing existing ones.
Definition: newtaildialog.h:62
NewTailDialog(const QString &new_registration, QWidget *parent=nullptr)
NewTailDialog - create a new ATailEntry and submit it to the database.
Definition: newtaildialog.cpp:23
Definition: atailentry.h:24