openPilotLog
newtaildialog.h
1 /*
2  *openPilotLog - A FOSS Pilot Logbook Application
3  *Copyright (C) 2020-2022 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/settings.h"
28 #include "src/functions/calc.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 
78 signals:
79  void tailDataChanged();
80 private:
81 
82  Ui::NewTail *ui;
83 
84  //ATailEntry entry;
85  OPL::TailEntry entry;
86 
87 
88  QStringList aircraftList;
89 
90  QHash<int, QString> idMap;
91 
92  void setupCompleter();
93  void setupValidators();
94  void fillForm(OPL::Row entry, bool is_template);
95  bool verify();
96  void submitForm();
97 
98 private slots:
99  void on_operationComboBox_currentIndexChanged(int index);
100  void on_ppTypeComboBox_currentIndexChanged(int index);
101  void on_ppNumberComboBox_currentIndexChanged(int index);
102  void on_weightComboBox_currentIndexChanged(int index);
103  void on_registrationLineEdit_textChanged(const QString &arg1);
104  void on_buttonBox_accepted();
105  void onSearchCompleterActivated();
106 
107 };
108 
109 #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:23
The Row class provides an interface for retreiving and submitting entries from the database.
Definition: row.h:46
A Row representing a Tail (Registration) entry. See Row class for details.
Definition: row.h:96