openPilotLog
pilotswidget.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 PILOTSWIDGET_H
19 #define PILOTSWIDGET_H
20 
21 #include <QWidget>
22 #include <QItemSelection>
23 #include <QSqlTableModel>
24 #include <QDebug>
25 #include <QTableView>
26 #include "src/classes/asettings.h"
27 #include "src/classes/pilot.h"
28 #include "src/gui/dialogues/newpilotdialog.h"
29 
30 namespace Ui {
31 class PilotsWidget;
32 }
33 
34 class PilotsWidget : public QWidget
35 {
36  Q_OBJECT
37 
38 public:
39  explicit PilotsWidget(QWidget *parent = nullptr);
40  ~PilotsWidget();
41 
42 private slots:
43  void tableView_selectionChanged();
44  void tableView_headerClicked(int);
45  void on_newPilotButton_clicked();
46  void on_deletePilotButton_clicked();
47  void onDeleteUnsuccessful();
48  void pilot_editing_finished();
49  void on_pilotSearchLineEdit_textChanged(const QString &arg1);
50 
51 public slots:
52  void onDisplayModel_dataBaseUpdated();
53 
54 private:
55  Ui::PilotsWidget *ui;
56 
57  QSqlTableModel *model;
58 
59  QTableView *view;
60 
61  QItemSelectionModel* selectionModel;
62 
63  qint32 sortColumn;
64 
65  QVector<qint32> selectedPilots;
66 
67  void setupModelAndView();
68 };
69 
70 #endif // PILOTSWIDGET_H
PilotsWidget
Definition: pilotswidget.h:35