openPilotLog
aircraftwidget.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 AIRCRAFTWIDGET_H
19 #define AIRCRAFTWIDGET_H
20 
21 #include <QWidget>
22 #include <QItemSelection>
23 #include <QSqlTableModel>
24 #include <QDebug>
25 #include <QTableView>
26 
27 #include "src/classes/asettings.h"
28 #include "src/gui/dialogues/newtaildialog.h"
29 //#include "src/classes/aircraft.h"
30 //#include "src/database/db.h"
31 #include "src/experimental/adatabase.h"
32 #include "src/experimental/atailentry.h"
33 #include "src/experimental/aflightentry.h"
34 
35 
36 namespace Ui {
37 class AircraftWidget;
38 }
39 
40 class AircraftWidget : public QWidget
41 {
42  Q_OBJECT
43 
44 public:
45  explicit AircraftWidget(QWidget *parent = nullptr);
46  ~AircraftWidget();
47 
48 private slots:
49  void tableView_selectionChanged();
50 
51  void tableView_headerClicked(int column);
52 
53  void on_deleteButton_clicked();
54 
55  void on_newAircraftButton_clicked();
56 
57  void acft_editing_finished();
58 
59  void on_aircraftSearchLineEdit_textChanged(const QString &arg1);
60 
61 public slots:
62  void onDisplayModel_dataBaseUpdated();
63 
64 private:
65  Ui::AircraftWidget *ui;
66 
67  QSqlTableModel *model;
68 
69  QTableView *view;
70 
71  QItemSelectionModel* selection;
72 
73  qint32 sortColumn;
74 
75  QVector<qint32> selectedTails;
76 
77  void setupModelAndView();
78 
79  void onDeleteUnsuccessful();
80 };
81 
82 #endif // AIRCRAFTWIDGET_H
AircraftWidget
Definition: aircraftwidget.h:41