logbookwidget.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 LOGBOOKWIDGET_H
  19. #define LOGBOOKWIDGET_H
  20. #include <QWidget>
  21. #include <QItemSelection>
  22. #include <QSqlTableModel>
  23. #include <QMessageBox>
  24. #include <QDebug>
  25. #include <QMenu>
  26. #include <QTableView>
  27. namespace Ui {
  28. class LogbookWidget;
  29. }
  30. class LogbookWidget : public QWidget
  31. {
  32. Q_OBJECT
  33. public:
  34. explicit LogbookWidget(QWidget *parent = nullptr);
  35. ~LogbookWidget();
  36. private slots:
  37. void on_newFlightButton_clicked();
  38. void on_editFlightButton_clicked();
  39. void on_deleteFlightPushButton_clicked();
  40. void on_showAllButton_clicked();
  41. void flightsTableView_selectionChanged();
  42. void on_tableView_customContextMenuRequested(const QPoint &pos);
  43. void on_actionDelete_Flight_triggered();
  44. void on_actionEdit_Flight_triggered();
  45. void on_tableView_doubleClicked();
  46. void on_flightSearchLlineEdit_textChanged(const QString &arg1);
  47. void on_flightSearchComboBox_currentIndexChanged(int);
  48. public slots:
  49. void onDisplayModel_dataBaseUpdated();
  50. void onLogbookWidget_viewSelectionChanged(int);
  51. private:
  52. Ui::LogbookWidget *ui;
  53. QTableView* view;
  54. QSqlTableModel* displayModel;
  55. QItemSelectionModel* selectionModel;
  56. QMenu* menu;
  57. QMessageBox* messageBox;
  58. QVector<qint32> selectedFlights;
  59. void prepareModelAndView(int view_id);
  60. void connectSignalsAndSlots();
  61. void setupDefaultView();
  62. void setupEasaView();
  63. };
  64. #endif // LOGBOOKWIDGET_H