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/database.h"
30 #include "src/database/row.h"
31 
32 namespace Ui {
33 class NewTail;
34 }
60 class NewTailDialog : public QDialog
61 {
62  Q_OBJECT
63 
64 public:
69  explicit NewTailDialog(const QString& new_registration, QWidget *parent = nullptr);
74  explicit NewTailDialog(int row_id, QWidget *parent = nullptr);
75 
76  ~NewTailDialog();
77 private:
78 
79  Ui::NewTail *ui;
80 
81  //ATailEntry entry;
82  OPL::TailEntry entry;
83 
84 
85  QStringList aircraftList;
86 
87  QHash<int, QString> idMap;
88 
89  void setupCompleter();
90  void setupValidators();
91  void fillForm(OPL::Row entry, bool is_template);
92  bool verify();
93  void submitForm();
94 
95 private slots:
96  void on_operationComboBox_currentIndexChanged(int index);
97  void on_ppTypeComboBox_currentIndexChanged(int index);
98  void on_ppNumberComboBox_currentIndexChanged(int index);
99  void on_weightComboBox_currentIndexChanged(int index);
100  void on_registrationLineEdit_textChanged(const QString &arg1);
101  void on_buttonBox_accepted();
102  void onSearchCompleterActivated();
103 
104 };
105 
106 #endif // NEWTAIL_H
The NewTailDialog enables adding new Tail entries to the database or editing existing ones.
Definition: newtaildialog.h:61
NewTailDialog(const QString &new_registration, QWidget *parent=nullptr)
NewTailDialog - create a new ATailEntry and submit it to the database.
Definition: newtaildialog.cpp:24
The Row class provides an interface for retreiving and submitting entries from the database....
Definition: row.h:13
Definition: row.h:53