openPilotLog
logbookwidget.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 LOGBOOKWIDGET_H
19 #define LOGBOOKWIDGET_H
20 
21 #include <QWidget>
22 #include <QItemSelection>
23 #include <QSqlTableModel>
24 #include <QMessageBox>
25 #include <QDebug>
26 #include <QMenu>
27 #include <QTableView>
28 
29 #include "src/classes/asettings.h"
30 #include "src/database/db.h"
31 #include "src/classes/flight.h"
32 #include "src/gui/dialogues/newflightdialog.h"
33 #include "src/experimental/aflightentry.h"
34 
35 namespace Ui {
36 class LogbookWidget;
37 }
38 
39 class LogbookWidget : public QWidget
40 {
41  Q_OBJECT
42 
43 public:
44  explicit LogbookWidget(QWidget *parent = nullptr);
45  ~LogbookWidget();
46 
47 private slots:
48  void on_newFlightButton_clicked();
49  void on_editFlightButton_clicked();
50  void on_deleteFlightPushButton_clicked();
51  void on_showAllButton_clicked();
52  void flightsTableView_selectionChanged();
53  void on_tableView_customContextMenuRequested(const QPoint &pos);
54  void on_actionDelete_Flight_triggered();
55  void on_actionEdit_Flight_triggered();
56  void on_tableView_doubleClicked();
57  void on_flightSearchLlineEdit_textChanged(const QString &arg1);
58  void on_flightSearchComboBox_currentIndexChanged(int);
59 
60 public slots:
61  void onDisplayModel_dataBaseUpdated();
62  void onLogbookWidget_viewSelectionChanged(int);
63 
64 private:
65  Ui::LogbookWidget *ui;
66 
67  QTableView* view;
68 
69  QSqlTableModel* displayModel;
70 
71  QItemSelectionModel* selectionModel;
72 
73  QMenu* menu;
74 
75  QMessageBox* messageBox;
76 
77  QVector<qint32> selectedFlights;
78 
79  void prepareModelAndView(int view_id);
80  void connectSignalsAndSlots();
81  void setupDefaultView();
82  void setupEasaView();
83 };
84 
85 #endif // LOGBOOKWIDGET_H
LogbookWidget
Definition: logbookwidget.h:40