openPilotLog
newtaildialog.h
1 /*
2  *openPilot Log - A FOSS Pilot Logbook Application
3  *Copyright (C) 2020 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 
26 #include "src/classes/asettings.h"
27 #include "src/classes/aircraft.h"
28 #include "src/functions/acalc.h"
29 #include "src/experimental/adatabase.h"
30 #include "src/experimental/atailentry.h"
31 #include "src/experimental/aaircraftentry.h"
32 
33 namespace Ui {
34 class NewTail;
35 }
43 class NewTailDialog : public QDialog
44 {
45  Q_OBJECT
46 
47 public:
48  // experimental create new tail
49  explicit NewTailDialog(QString new_registration, QWidget *parent = nullptr);
50  // experimental edit existing tail
51  explicit NewTailDialog(int row_id, QWidget *parent = nullptr);
52 
53  ~NewTailDialog();
54 private:
55 
56  Ui::NewTail *ui;
57 
59 
60  QStringList aircraftList;
61 
62  QMap<QString, int> idMap;
63 
64  void setupCompleter();
65  void setupValidators();
66  void fillForm(experimental::AEntry entry, bool is_template);
67  bool verify();
68  void submitForm();
69 
70 private slots:
71  void on_operationComboBox_currentIndexChanged(int index);
72  void on_ppTypeComboBox_currentIndexChanged(int index);
73  void on_ppNumberComboBox_currentIndexChanged(int index);
74  void on_weightComboBox_currentIndexChanged(int index);
75  void on_registrationLineEdit_textChanged(const QString &arg1);
76  void on_buttonBox_accepted();
77  void onSearchCompleterActivated();
78 
79 };
80 
81 #endif // NEWTAIL_H
NewTailDialog
The NewTail class is a dialog for adding a new tail to the database or editing an existing one.
Definition: newtaildialog.h:44
experimental::AEntry
The Entry class encapsulates table metadata(table name, row id) and data for new and existing entries...
Definition: aentry.h:42
experimental::ATailEntry
Definition: atailentry.h:27