logbookwidget.h 2.3 KB

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