소스 검색

Refactoring of Row class

Refactored Row Subclasses into their own TU's.

Moved static strings containing sql column names into their respective row subclass instead of cluttering the OPL namespace

Added a virtual function getTableName() to row class, subclasses of row have to return their respective table name.
Felix Turowsky 1 년 전
부모
커밋
5e61a9a1aa
62개의 변경된 파일1375개의 추가작업 그리고 849개의 파일을 삭제
  1. 20 1
      CMakeLists.txt
  2. 6 0
      mainwindow.cpp
  3. 39 0
      src/database/aircraftentry.cpp
  4. 105 0
      src/database/aircraftentry.h
  5. 49 0
      src/database/airportentry.cpp
  6. 89 0
      src/database/airportentry.h
  7. 39 0
      src/database/currencyentry.cpp
  8. 53 0
      src/database/currencyentry.h
  9. 1 16
      src/database/database.cpp
  10. 7 0
      src/database/database.h
  11. 17 0
      src/database/databasecache.cpp
  12. 17 0
      src/database/databasecache.h
  13. 3 0
      src/database/dbsummary.cpp
  14. 1 2
      src/database/dbsummary.h
  15. 39 0
      src/database/flightentry.cpp
  16. 70 0
      src/database/flightentry.h
  17. 49 0
      src/database/pilotentry.cpp
  18. 80 0
      src/database/pilotentry.h
  19. 39 0
      src/database/previousexperienceentry.cpp
  20. 57 0
      src/database/previousexperienceentry.h
  21. 15 103
      src/database/row.cpp
  22. 49 102
      src/database/row.h
  23. 39 0
      src/database/simulatorentry.cpp
  24. 69 0
      src/database/simulatorentry.h
  25. 48 0
      src/database/tailentry.cpp
  26. 109 0
      src/database/tailentry.h
  27. 20 20
      src/functions/calc.cpp
  28. 0 1
      src/functions/readcsv.h
  29. 0 218
      src/functions/time.h
  30. 1 0
      src/gui/dialogues/exporttocsvdialog.cpp
  31. 9 9
      src/gui/dialogues/firstrundialog.cpp
  32. 15 15
      src/gui/dialogues/newairportdialog.cpp
  33. 61 60
      src/gui/dialogues/newflightdialog.cpp
  34. 1 1
      src/gui/dialogues/newflightdialog.h
  35. 1 1
      src/gui/dialogues/newpilotdialog.h
  36. 12 12
      src/gui/dialogues/newsimdialog.cpp
  37. 1 1
      src/gui/dialogues/newsimdialog.h
  38. 9 8
      src/gui/dialogues/newtaildialog.cpp
  39. 1 3
      src/gui/dialogues/newtaildialog.h
  40. 1 1
      src/gui/widgets/airportwidget.cpp
  41. 1 1
      src/gui/widgets/backupwidget.cpp
  42. 0 1
      src/gui/widgets/backupwidget.h
  43. 0 2
      src/gui/widgets/debugwidget.cpp
  44. 4 3
      src/gui/widgets/homewidget.cpp
  45. 1 3
      src/gui/widgets/homewidget.h
  46. 5 8
      src/gui/widgets/logbookwidget.cpp
  47. 1 2
      src/gui/widgets/logbookwidget.h
  48. 7 8
      src/gui/widgets/pilotswidget.cpp
  49. 3 2
      src/gui/widgets/pilotswidget.h
  50. 24 25
      src/gui/widgets/settingswidget.cpp
  51. 13 13
      src/gui/widgets/tailswidget.cpp
  52. 1 1
      src/gui/widgets/tailswidget.h
  53. 1 1
      src/gui/widgets/totalswidget.cpp
  54. 0 131
      src/opl.h
  55. 0 1
      src/testing/atimer.h
  56. 2 3
      src/testing/importCrewlounge/importcrewlounge.cpp
  57. 14 13
      src/testing/importCrewlounge/processaircraft.cpp
  58. 0 1
      src/testing/importCrewlounge/processaircraft.h
  59. 26 25
      src/testing/importCrewlounge/processflights.cpp
  60. 7 6
      src/testing/importCrewlounge/processpilots.cpp
  61. 18 19
      src/testing/randomgenerator.cpp
  62. 6 6
      src/testing/randomgenerator.h

+ 20 - 1
CMakeLists.txt

@@ -117,6 +117,25 @@ set(PROJECT_SOURCES
     src/classes/time.h
     src/classes/time.cpp
 
+    # Database Entries
+    src/database/flightentry.h
+    src/database/flightentry.cpp
+    src/database/aircraftentry.h
+    src/database/aircraftentry.cpp
+    src/database/tailentry.h
+    src/database/tailentry.cpp
+    src/database/airportentry.h
+    src/database/airportentry.cpp
+    src/database/pilotentry.h
+    src/database/pilotentry.cpp
+    src/database/simulatorentry.h
+    src/database/simulatorentry.cpp
+    src/database/currencyentry.h
+    src/database/currencyentry.cpp
+
+    src/database/previousexperienceentry.h
+    src/database/previousexperienceentry.cpp
+
     # Namespaces
     src/functions/calc.h
     src/functions/calc.cpp
@@ -127,7 +146,7 @@ set(PROJECT_SOURCES
     src/functions/statistics.cpp
     src/functions/datetime.h
     src/functions/datetime.cpp
-    src/functions/time.h
+
 
     # Database
     src/database/database.h

+ 6 - 0
mainwindow.cpp

@@ -25,6 +25,7 @@
 #include "src/gui/dialogues/newsimdialog.h"
 #include "src/gui/dialogues/newflightdialog.h"
 #include "src/database/databasecache.h"
+#include "src/classes/settings.h"
 // Quick and dirty Debug area
 void MainWindow::doDebugStuff()
 {
@@ -35,6 +36,11 @@ void MainWindow::doDebugStuff()
     xp = DB->getTotals(true);
     LOG << "Totals with previous:";
     LOG << xp;
+
+    OPL::FlightEntry fe = OPL::FlightEntry();
+    LOG << "FLIGHT table: " << fe.getTableName();
+    OPL::Row row = OPL::Row();
+    LOG << "ROW table: " << row.getTableName();
 }
 
 MainWindow::MainWindow(QWidget *parent)

+ 39 - 0
src/database/aircraftentry.cpp

@@ -0,0 +1,39 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#include "aircraftentry.h"
+
+namespace OPL {
+
+AircraftEntry::AircraftEntry()
+    : Row(DbTable::Aircraft, 0)
+{}
+
+AircraftEntry::AircraftEntry(const RowData_T &row_data)
+    : Row(DbTable::Aircraft, 0, row_data)
+{}
+
+AircraftEntry::AircraftEntry(int row_id, const RowData_T &row_data)
+    : Row(DbTable::Aircraft, row_id, row_data)
+{}
+
+const QString AircraftEntry::getTableName() const
+{
+    return TABLE_NAME;
+}
+
+} // namespace OPL

+ 105 - 0
src/database/aircraftentry.h

@@ -0,0 +1,105 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef AIRCRAFTENTRY_H
+#define AIRCRAFTENTRY_H
+#include "src/database/row.h"
+
+namespace OPL {
+
+/*!
+ * \brief A Row representing an Aircraft entry.
+ * \details
+ * In this context an aircraft refers to the aircraft TYPE (Boeing 737, Airbus A320,...) and
+ * could be seen as an analogy for a class. The aircraft 'instances' are called TAILS and are
+ * stored in the tails database (A Boeing 737 with registration (tail) LN-ENL for example).
+ *
+ * Aircraft = All aircraft with a common type that share its traits
+ * Tail - A specific aircraft of that type
+ *
+ * The aircraft table in the database contains templates of various aircraft types
+ * and is used to provide auto-completion when the user adds a new tail to the logbook.
+ */
+class AircraftEntry : public Row
+{
+    const static inline QString TABLE_NAME = QStringLiteral("aircraft");
+public:
+    AircraftEntry();
+    AircraftEntry(const RowData_T &row_data);
+    AircraftEntry(int row_id, const RowData_T &row_data);
+    const QString getTableName() const override;
+
+    /*!
+     * \brief The aircrafts manufacturer (Airbus, Boeing,...)
+     */
+    static const inline QString MAKE = QStringLiteral("make");
+    /*!
+     * \brief The aircraft model (A320, B737,...)
+     */
+    static const inline QString MODEL = QStringLiteral("model");
+    /*!
+     * \brief The aircraft variant( A320-<b>200<\b>, B737-<b>800<\b>)
+     */
+    static const inline QString VARIANT = QStringLiteral("variant");
+    /*!
+     * \brief (optional) The aircraft common name ("Beluga",...)
+     */
+    static const inline QString NAME = QStringLiteral("name");
+    /*!
+     * \brief The aircraft types iata code
+     */
+    static const inline QString IATA = QStringLiteral("iata");
+    /*!
+     * \brief The aircraft types icao code
+     */
+    static const inline QString ICAO = QStringLiteral("icao");
+    /*!
+     * \brief Wether the aircraft requires more than one pilot (stored in the database as boolean)
+     */
+    static const inline QString MULTI_PILOT = QStringLiteral("multipilot");
+    /*!
+     * \brief Wether the aircraft has more than one engine (stored in the database as a boolean)
+     */
+    static const inline QString MULTI_ENGINE = QStringLiteral("multiengine");
+    /*!
+     * \brief The aircrafts engine type. Stored in the database as an integer
+     * \details
+     * <ul>
+     * <li> 0 - Single Engine Piston <\li>
+     * <li> 1 - Multi Engine Piston <\li>
+     * <li> 2 - Turboprop <\li>
+     * <li> 3 - Jet <\li>
+     * <\ul>
+     */
+    static const inline QString ENGINE_TYPE = QStringLiteral("engineType");
+    /*!
+     * \brief The aircrafts weight class. Stored in the database as an integer
+     * \details
+     * <ul>
+     * <li> 0 - Light <\li>
+     * <li> 1 - Medium <\li>
+     * <li> 2 - Heavy <\li>
+     * <li> 3 - Super Heavy <\li>
+     * <\ul>
+     */
+    static const inline QString WEIGHT_CLASS = QStringLiteral("weightClass");
+};
+
+} // namespace OPL
+
+
+#endif // AIRCRAFTENTRY_H

+ 49 - 0
src/database/airportentry.cpp

@@ -0,0 +1,49 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#include "airportentry.h"
+
+namespace OPL {
+
+AirportEntry::AirportEntry()
+    : Row(DbTable::Airports, 0)
+{}
+
+AirportEntry::AirportEntry(const RowData_T &row_data)
+    : Row(DbTable::Airports, 0, row_data)
+{}
+
+AirportEntry::AirportEntry(int row_id, const RowData_T &row_data)
+    : Row(DbTable::Airports, row_id, row_data)
+{}
+
+const QString AirportEntry::getTableName() const
+{
+    return TABLE_NAME;
+}
+
+const QString AirportEntry::getIataCode() const
+{
+    return getData().value(IATA).toString();
+}
+
+const QString AirportEntry::getIcaoCode() const
+{
+    return getData().value(ICAO).toString();
+}
+
+} // namespace OPL

+ 89 - 0
src/database/airportentry.h

@@ -0,0 +1,89 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef AIRPORTENTRY_H
+#define AIRPORTENTRY_H
+#include "src/database/row.h"
+
+namespace OPL {
+
+/*!
+ * \brief A Row representing an Airport entry. See Row class for details.
+ */
+class AirportEntry : public Row
+{
+    const static inline QString TABLE_NAME = QStringLiteral("airports");
+public:
+    AirportEntry();
+    AirportEntry(const RowData_T &row_data);
+    AirportEntry(int row_id, const RowData_T &row_data);
+    const QString getTableName() const override;
+
+    /*!
+     * \brief return the airports IATA code (3-letter)
+     */
+    const QString getIataCode() const;
+
+    /*!
+     * \brief return the airports ICAO code (4-letter)
+     */
+    const QString getIcaoCode() const;
+
+    /*!
+     * \brief The ICAO code is a 4-letter alphanumeric identifier for airports
+     */
+    const static inline QString ICAO           = QStringLiteral("icao");
+    /*!
+     * \brief The IATA code is a 3-letter alphanumeric identifier for airports
+     */
+    const static inline QString IATA           = QStringLiteral("iata");
+    /*!
+     * \brief The airports common name
+     */
+    const static inline QString NAME           = QStringLiteral("name");
+    /*!
+     * \brief The airports latitude. Stored as a double
+     */
+    const static inline QString LAT            = QStringLiteral("lat");
+
+    /*!
+     * \brief The airports longitude. Stored as a double
+     */
+    const static inline QString LON            = QStringLiteral("long");
+
+    /*!
+     * \brief The country the airport is located in
+     */
+    const static inline QString COUNTRY        = QStringLiteral("country");
+    /*!
+     * \brief The altitude aboe mea sea level the airport is located at.
+     */
+    const static inline QString ALTITIDUE      = QStringLiteral("alt");
+
+    /*!
+     * \brief The airports timezone Offset from UTC
+     */
+    const static inline QString UTC_OFFSET     = QStringLiteral("utcoffset");
+    /*!
+     * \brief The timezone (Olson classification) the airport is situated in
+     */
+    const static inline QString TZ_OLSON       = QStringLiteral("tzolson");
+};
+
+} // namespace OPL
+
+#endif // AIRPORTENTRY_H

+ 39 - 0
src/database/currencyentry.cpp

@@ -0,0 +1,39 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#include "currencyentry.h"
+
+namespace OPL {
+
+CurrencyEntry::CurrencyEntry()
+    : Row(DbTable::Currencies, 0)
+{}
+
+CurrencyEntry::CurrencyEntry(const RowData_T &row_data)
+    : Row(DbTable::Currencies, 0, row_data)
+{}
+
+CurrencyEntry::CurrencyEntry(int row_id, const RowData_T &row_data)
+    : Row(DbTable::Currencies, row_id, row_data)
+{}
+
+const QString CurrencyEntry::getTableName() const
+{
+    return TABLE_NAME;
+}
+
+} // namespace OPL

+ 53 - 0
src/database/currencyentry.h

@@ -0,0 +1,53 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef CURRENCYENTRY_H
+#define CURRENCYENTRY_H
+#include "src/database/row.h"
+
+namespace OPL {
+
+/*!
+ * \brief A Row representing a Currency entry. See Row class for details.
+ * \details An Entry in the currencies table represents an item with an expiry date
+ * and is used to track those. Typical example would be medical licenses, type rating
+ * validations or route certifications.
+ */
+class CurrencyEntry : public Row
+{
+    const static inline QString TABLE_NAME = QStringLiteral("currencies");
+public:
+    CurrencyEntry();
+    CurrencyEntry(const RowData_T &row_data);
+    CurrencyEntry(int row_id, const RowData_T &row_data);
+
+    const QString getTableName() const override;
+
+
+    /*!
+    * \brief The sql column name for the expiry date
+    */
+    const static inline QString EXPIRYDATE  = QStringLiteral("expiryDate");
+    /*!
+     * \brief The sql column name for the currency name
+     */
+    const static inline QString CURRENCYNAME = QStringLiteral("currencyName");
+};
+
+} // namespace OPL
+
+#endif // CURRENCYENTRY_H

+ 1 - 16
src/database/database.cpp

@@ -636,22 +636,7 @@ QVector<QVariant> Database::customQuery(QString statement, int return_values)
 
 QVector<RowData_T> Database::getTable(OPL::DbTable table)
 {
-    auto query_str = QStringLiteral("SELECT * FROM ");
-    switch (table) {
-    case OPL::DbTable::Pilots:
-        query_str.append(OPL::Db::TABLE_PILOTS);
-        break;
-    case OPL::DbTable::Tails:
-        query_str.append(OPL::Db::TABLE_TAILS);
-        break;
-    case OPL::DbTable::Flights:
-        query_str.append(OPL::Db::TABLE_FLIGHTS);
-        break;
-    case OPL::DbTable::Currencies:
-        query_str.append(OPL::Db::TABLE_CURRENCIES);
-    default:
-        break;
-    }
+    const QString query_str = QStringLiteral("SELECT * FROM ") + GLOBALS->getDbTableName(table);
 
     QSqlQuery q;
     q.prepare(query_str);

+ 7 - 0
src/database/database.h

@@ -32,6 +32,13 @@
 #include <QSqlField>
 
 #include "src/classes/paths.h"
+#include "src/database/aircraftentry.h"
+#include "src/database/airportentry.h"
+#include "src/database/currencyentry.h"
+#include "src/database/flightentry.h"
+#include "src/database/pilotentry.h"
+#include "src/database/simulatorentry.h"
+#include "src/database/tailentry.h"
 #include "src/opl.h"
 #include "src/database/row.h"
 

+ 17 - 0
src/database/databasecache.cpp

@@ -1,3 +1,20 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
 #include "databasecache.h"
 #include "src/database/database.h"
 #include "src/opl.h"

+ 17 - 0
src/database/databasecache.h

@@ -1,3 +1,20 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
 #ifndef DATABASECACHE_H
 #define DATABASECACHE_H
 #include "src/opl.h"

+ 3 - 0
src/database/dbsummary.cpp

@@ -16,6 +16,9 @@
  *along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 #include "dbsummary.h"
+#include "QtCore/qstringliteral.h"
+#include "QtSql/qsqldatabase.h"
+#include "QtSql/qsqlquery.h"
 
 namespace OPL {
 

+ 1 - 2
src/database/dbsummary.h

@@ -17,8 +17,7 @@
  */
 #ifndef DBSUMMARY_H
 #define DBSUMMARY_H
-
-#include "src/database/database.h"
+#include <QtCore>
 
 namespace OPL {
 

+ 39 - 0
src/database/flightentry.cpp

@@ -0,0 +1,39 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#include "flightentry.h"
+
+namespace OPL {
+
+FlightEntry::FlightEntry()
+    : Row(DbTable::Flights, 0)
+{}
+
+FlightEntry::FlightEntry(const RowData_T &row_data)
+    : Row(DbTable::Flights, 0, row_data)
+{}
+
+FlightEntry::FlightEntry(int row_id, const RowData_T &row_data)
+    : Row(DbTable::Flights, row_id, row_data)
+{}
+
+const QString FlightEntry::getTableName() const
+{
+    return TABLE_NAME;
+}
+
+} // namespace OPL

+ 70 - 0
src/database/flightentry.h

@@ -0,0 +1,70 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef FLIGHTENTRY_H
+#define FLIGHTENTRY_H
+#include "src/database/row.h"
+
+
+namespace OPL {
+/*!
+ * \brief A Row representing a Flight entry. See Row class for details.
+ */
+class FlightEntry : public Row
+{
+    const static inline QString TABLE_NAME = QStringLiteral("flights");
+public:
+    FlightEntry();
+    FlightEntry(const RowData_T &row_data);
+    FlightEntry(int row_id, const RowData_T &row_data);
+
+    const QString getTableName() const override;
+
+    const static inline QString ROWID          = QStringLiteral("flight_id");
+    const static inline QString DOFT           = QStringLiteral("doft");
+    const static inline QString DEPT           = QStringLiteral("dept");
+    const static inline QString DEST           = QStringLiteral("dest");
+    const static inline QString TOFB           = QStringLiteral("tofb");
+    const static inline QString TONB           = QStringLiteral("tonb");
+    const static inline QString PIC            = QStringLiteral("pic");
+    const static inline QString ACFT           = QStringLiteral("acft");
+    const static inline QString TBLK           = QStringLiteral("tblk");
+    const static inline QString TSPSE          = QStringLiteral("tSPSE");
+    const static inline QString TSPME          = QStringLiteral("tSPME");
+    const static inline QString TMP            = QStringLiteral("tMP");
+    const static inline QString TNIGHT         = QStringLiteral("tNIGHT");
+    const static inline QString TIFR           = QStringLiteral("tIFR");
+    const static inline QString TPIC           = QStringLiteral("tPIC");
+    const static inline QString TPICUS         = QStringLiteral("tPICUS");
+    const static inline QString TSIC           = QStringLiteral("tSIC");
+    const static inline QString TDUAL          = QStringLiteral("tDUAL");
+    const static inline QString TFI            = QStringLiteral("tFI");
+    const static inline QString TSIM           = QStringLiteral("tSIM");
+    const static inline QString PILOTFLYING    = QStringLiteral("pilotFlying");
+    const static inline QString TODAY          = QStringLiteral("toDay");
+    const static inline QString TONIGHT        = QStringLiteral("toNight");
+    const static inline QString LDGDAY         = QStringLiteral("ldgDay");
+    const static inline QString LDGNIGHT       = QStringLiteral("ldgNight");
+    const static inline QString AUTOLAND       = QStringLiteral("autoland");
+    const static inline QString SECONDPILOT    = QStringLiteral("secondPilot");
+    const static inline QString THIRDPILOT     = QStringLiteral("thirdPilot");
+    const static inline QString APPROACHTYPE   = QStringLiteral("approachType");
+    const static inline QString FLIGHTNUMBER   = QStringLiteral("flightNumber");
+    const static inline QString REMARKS        = QStringLiteral("remarks");
+};
+} // namespace OPL
+#endif // FLIGHTENTRY_H

+ 49 - 0
src/database/pilotentry.cpp

@@ -0,0 +1,49 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#include "pilotentry.h"
+
+namespace OPL {
+
+PilotEntry::PilotEntry()
+    : Row(DbTable::Pilots, 0)
+{}
+
+PilotEntry::PilotEntry(const RowData_T &row_data)
+    : Row(DbTable::Pilots, 0, row_data)
+{}
+
+PilotEntry::PilotEntry(int row_id, const RowData_T &row_data)
+    : Row(DbTable::Pilots, row_id, row_data)
+{}
+
+const QString PilotEntry::getTableName() const
+{
+    return TABLE_NAME;
+}
+
+const QString PilotEntry::getLastName() const
+{
+    return getData().value(LASTNAME).toString();
+}
+
+const QString PilotEntry::getFirstName() const
+{
+    return getData().value(FIRSTNAME).toString();
+}
+
+} // namespace OPL

+ 80 - 0
src/database/pilotentry.h

@@ -0,0 +1,80 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef PILOTENTRY_H
+#define PILOTENTRY_H
+#include "src/database/row.h"
+
+namespace OPL {
+
+/*!
+ * \brief A Row representing a Pilot entry. See Row class for details.
+ */
+class PilotEntry : public Row
+{
+    const static inline QString TABLE_NAME = QStringLiteral("pilots");
+public:
+    PilotEntry();
+    PilotEntry(const RowData_T &row_data);
+    PilotEntry(int row_id, const RowData_T &row_data);
+    const QString getTableName() const override;
+
+    /*!
+     * \brief Return the pilots last name
+     */
+    const QString getLastName()  const;
+
+    /*!
+     * \brief Return the pilots first name
+     */
+    const QString getFirstName() const;
+
+    const static inline QString ROWID           = QStringLiteral("pilot_id");
+    /*!
+     * \brief The sql column name for the pilots last name
+     */
+    const static inline QString LASTNAME        = QStringLiteral("lastname");
+    /*!
+     * \brief The sql column name for the pilots first name
+     */
+    const static inline QString FIRSTNAME       = QStringLiteral("firstname");
+
+    /*!
+     * \brief The sql column name for an alias for the pilot
+     */
+    const static inline QString ALIAS           = QStringLiteral("alias");
+    /*!
+     * \brief The company the pilots works for
+     */
+    const static inline QString COMPANY         = QStringLiteral("company");
+    /*!
+     * \brief The sql column name for the pilots employee number
+     */
+    const static inline QString EMPLOYEEID      = QStringLiteral("employeeid");
+    /*!
+     * \brief The sql column name for a pilots phone number
+     */
+    const static inline QString PHONE           = QStringLiteral("phone");
+    /*!
+     * \brief the sql column name for a pilots email address
+     */
+    const static inline QString EMAIL           = QStringLiteral("email");
+};
+
+} // namespace OPL
+
+#endif // PILOTENTRY_H

+ 39 - 0
src/database/previousexperienceentry.cpp

@@ -0,0 +1,39 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#include "previousexperienceentry.h"
+
+namespace OPL {
+
+PreviousExperienceEntry::PreviousExperienceEntry()
+    : Row(DbTable::PreviousExperience, 0)
+{}
+
+PreviousExperienceEntry::PreviousExperienceEntry(const RowData_T &row_data)
+    : Row(DbTable::PreviousExperience, 0, row_data)
+{}
+
+PreviousExperienceEntry::PreviousExperienceEntry(int row_id, const RowData_T &row_data)
+    : Row(DbTable::PreviousExperience, row_id, row_data)
+{}
+
+const QString PreviousExperienceEntry::getTableName() const
+{
+    return TABLE_NAME;
+}
+
+} // namespace OPL

+ 57 - 0
src/database/previousexperienceentry.h

@@ -0,0 +1,57 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef PREVIOUSEXPERIENCEENTRY_H
+#define PREVIOUSEXPERIENCEENTRY_H
+#include "src/database/flightentry.h"
+#include "src/database/row.h"
+
+namespace OPL {
+
+/*!
+ * \brief A Row representing an Airport entry. See Row class for details.
+ */
+class PreviousExperienceEntry : public Row
+{
+    const static inline QString TABLE_NAME = QStringLiteral("previousExperience");
+public:
+    PreviousExperienceEntry();
+    PreviousExperienceEntry(const RowData_T &row_data);
+    PreviousExperienceEntry(int row_id, const RowData_T &row_data);
+    const QString getTableName() const override;
+
+    // these literals already exist in the FlightEntry class, so we can just copy them
+    const static inline QString TBLK           = OPL::FlightEntry::TBLK;
+    const static inline QString TSPSE          = OPL::FlightEntry::TSPSE;
+    const static inline QString TSPME          = OPL::FlightEntry::TSPME;
+    const static inline QString TMP            = OPL::FlightEntry::TMP;
+    const static inline QString TNIGHT         = OPL::FlightEntry::TNIGHT;
+    const static inline QString TIFR           = OPL::FlightEntry::TIFR;
+    const static inline QString TPIC           = OPL::FlightEntry::TPIC;
+    const static inline QString TPICUS         = OPL::FlightEntry::TPICUS;
+    const static inline QString TSIC           = OPL::FlightEntry::TSIC;
+    const static inline QString TDUAL          = OPL::FlightEntry::TDUAL;
+    const static inline QString TFI            = OPL::FlightEntry::TFI;
+    const static inline QString TSIM           = OPL::FlightEntry::TSIM;
+    const static inline QString TODAY          = OPL::FlightEntry::TODAY;
+    const static inline QString TONIGHT        = OPL::FlightEntry::TONIGHT;
+    const static inline QString LDGDAY         = OPL::FlightEntry::LDGDAY;
+    const static inline QString LDGNIGHT       = OPL::FlightEntry::LDGNIGHT;
+};
+
+} // namespace OPL
+#endif // PREVIOUSEXPERIENCEENTRY_H

+ 15 - 103
src/database/row.cpp

@@ -32,6 +32,11 @@ Row::Row(DbTable table_name)
     rowId = 0; // new entry
 };
 
+Row::Row()
+{
+    valid = false;
+}
+
 Row::Row(OPL::DbTable table_name, int row_id, const RowData_T &row_data)
     : table(table_name), rowId(row_id), rowData(row_data)
 {
@@ -64,18 +69,22 @@ OPL::DbTable Row::getTable() const
     return table;
 }
 
+const QString Row::getPosition() const
+{
+    return QString("Table: %1 / RowID: %2").arg(OPL::GLOBALS->getDbTableName(table), QString::number(rowId));
+}
+
 const QString Row::getTableName() const
 {
-    return OPL::GLOBALS->getDbTableName(table);
+    return {};
 }
 
-//TODO: Remove when tweaking for performance. Used for debugging
-const QString Row::getPosition() const
+bool Row::isValid() const
 {
-    return QString("Table: %1 / RowID: %2").arg(OPL::GLOBALS->getDbTableName(table), QString::number(rowId));
+    return hasData && valid;
 }
 
-//TODO: Remove when tweaking for performance. Used for debugging
+//Used for debugging
 OPL::Row::operator QString() const
 {
     if (!isValid()) {
@@ -122,102 +131,5 @@ OPL::Row::operator QString() const
     return QString();
 }
 
-AircraftEntry::AircraftEntry()
-    : Row(DbTable::Aircraft, 0)
-{}
-
-AircraftEntry::AircraftEntry(const RowData_T &row_data)
-    : Row(DbTable::Aircraft, 0, row_data)
-{}
-
-AircraftEntry::AircraftEntry(int row_id, const RowData_T &row_data)
-    : Row(DbTable::Aircraft, row_id, row_data)
-{}
-
-
-TailEntry::TailEntry()
-    : Row(DbTable::Tails, 0)
-{}
-
-TailEntry::TailEntry(const RowData_T &row_data)
-    : Row(DbTable::Tails, 0, row_data)
-{}
-
-TailEntry::TailEntry(int row_id, const RowData_T &row_data)
-    : Row(DbTable::Tails, row_id, row_data)
-{}
-
-PilotEntry::PilotEntry()
-    : Row(DbTable::Pilots, 0)
-{}
-
-PilotEntry::PilotEntry(const RowData_T &row_data)
-    : Row(DbTable::Pilots, 0, row_data)
-{}
-
-PilotEntry::PilotEntry(int row_id, const RowData_T &row_data)
-    : Row(DbTable::Pilots, row_id, row_data)
-{}
-
-
-SimulatorEntry::SimulatorEntry()
-    : Row(DbTable::Simulators, 0)
-{}
-
-SimulatorEntry::SimulatorEntry(const RowData_T &row_data)
-    : Row(DbTable::Simulators, 0, row_data)
-{}
-
-SimulatorEntry::SimulatorEntry(int row_id, const RowData_T &row_data)
-    : Row(DbTable::Simulators, row_id, row_data)
-{}
-
-FlightEntry::FlightEntry()
-    : Row(DbTable::Flights, 0)
-{}
-
-FlightEntry::FlightEntry(const RowData_T &row_data)
-    : Row(DbTable::Flights, 0, row_data)
-{}
-
-FlightEntry::FlightEntry(int row_id, const RowData_T &row_data)
-    : Row(DbTable::Flights, row_id, row_data)
-{}
-
-CurrencyEntry::CurrencyEntry()
-    : Row(DbTable::Currencies, 0)
-{}
-
-CurrencyEntry::CurrencyEntry(const RowData_T &row_data)
-    : Row(DbTable::Currencies, 0, row_data)
-{}
-
-CurrencyEntry::CurrencyEntry(int row_id, const RowData_T &row_data)
-    : Row(DbTable::Currencies, row_id, row_data)
-{}
-
-AirportEntry::AirportEntry()
-    : Row(DbTable::Airports, 0)
-{}
-
-AirportEntry::AirportEntry(const RowData_T &row_data)
-    : Row(DbTable::Airports, 0, row_data)
-{}
-
-AirportEntry::AirportEntry(int row_id, const RowData_T &row_data)
-    : Row(DbTable::Airports, row_id, row_data)
-{}
-
-PreviousExperienceEntry::PreviousExperienceEntry()
-    : Row(DbTable::PreviousExperience, 0)
-{}
-
-PreviousExperienceEntry::PreviousExperienceEntry(const RowData_T &row_data)
-    : Row(DbTable::PreviousExperience, 0, row_data)
-{}
-
-PreviousExperienceEntry::PreviousExperienceEntry(int row_id, const RowData_T &row_data)
-    : Row(DbTable::PreviousExperience, row_id, row_data)
-{}
-
 } // namespace OPL
+

+ 49 - 102
src/database/row.h

@@ -40,28 +40,73 @@ namespace OPL {
  * The Identifying information can be accessed with getRowId and getTable() / getTableName().
  *
  * For convenience and readabilty, subclasses exist that have the table property pre-set. These rows are then
- * referred to as entries. See AircraftEntry, FlightEntry etc.
+ * referred to as entries. See AircraftEntry, FlightEntry etc. These subclasses have public static members which
+ * hold the column names used in the sql database. These can be used to access the data held in the row by column.
  */
 class Row
 {
 public:
-    Row() { valid = false;} // Require specifying position
+
+    /*!
+     * \brief Create a new empty row entry
+     */
+    Row();
+    /*!
+     * \brief Create a row entry specifying its table, row id and row data.
+     */
     Row(OPL::DbTable table_name, int row_id, const RowData_T &row_data);
+    /*!
+     * \brief Create a row entry specifying its table and row id.
+     */
     Row(OPL::DbTable table_name, int row_id);
+
+    /*!
+     * \brief Create a row entry specifying its table name.
+     * \param table_name
+     */
     Row(OPL::DbTable table_name);
 
     Row(const Row&) = default;
     Row& operator=(const Row&) = default;
 
+    /*!
+     * \brief get the Row Data contained in the Row
+     * \details The row data is a Map where the sql column name is the key and its value is the value.
+     */
     const RowData_T& getData() const;
+
     void setData(const RowData_T &value);
+
+    /*!
+     * \brief Get the entries row id in the database
+     */
     int getRowId() const;
+
+    /*!
+     * \brief Set the entries row id in the database
+     */
     void setRowId(int value);
+
     OPL::DbTable getTable() const;
-    const QString getTableName() const;
+
+    /*!
+     * \brief returns a string representation of the entries position in the database (Table and Row ID)
+     */
     const QString getPosition() const;
 
-    bool isValid() const {return hasData && valid;}
+    /*!
+     * \brief get the name of the table in the sql database.
+     * \details This method has to be overwritten in any subclass to return the table name, this should be
+     * a purely virtual function but in order to be able to use row class instances this function is implemented
+     * to return an empty strring in the base class.
+     * \return The name of the table in the database containing a valid row, or an empty String
+     */
+    virtual const QString getTableName() const;
+
+    /*!
+     * \brief A Row entry is valid if its table and row are specified and if it contains row data.
+     */
+    bool isValid() const;
 
     /*!
      * \brief operator QString can be used for printing debug information to stdout
@@ -78,103 +123,5 @@ protected:
     bool valid = true;
 };
 
-/*!
- * \brief A Row representing an Aircraft entry. See Row class for details.
- */
-class AircraftEntry : public Row
-{
-public:
-    AircraftEntry();
-    AircraftEntry(const RowData_T &row_data);
-    AircraftEntry(int row_id, const RowData_T &row_data);
-};
-
-/*!
- * \brief A Row representing a Tail (Registration) entry. See Row class for details.
- */
-class TailEntry : public Row
-{
-public:
-    TailEntry();
-    TailEntry(const RowData_T &row_data);
-    TailEntry(int row_id, const RowData_T &row_data);
-
-    const QString registration() const { return getData().value(OPL::Db::TAILS_REGISTRATION).toString(); }
-    const QString type()         const { return getData().value(OPL::Db::TAILS_MAKE).toString(); } //TODO - Create String for make-model-variant
-};
-
-/*!
- * \brief A Row representing a Pilot entry. See Row class for details.
- */
-class PilotEntry : public Row
-{
-public:
-    PilotEntry();
-    PilotEntry(const RowData_T &row_data);
-    PilotEntry(int row_id, const RowData_T &row_data);
-
-    const QString lastName()  const { return getData().value(OPL::Db::PILOTS_LASTNAME).toString(); }
-    const QString firstName() const { return getData().value(OPL::Db::PILOTS_FIRSTNAME).toString(); }
-
-};
-
-/*!
- * \brief A Row representing a Simulator entry. See Row class for details.
- */
-class SimulatorEntry : public Row
-{
-public:
-    SimulatorEntry();
-    SimulatorEntry(const RowData_T &row_data);
-    SimulatorEntry(int row_id, const RowData_T &row_data);
-};
-
-/*!
- * \brief A Row representing a Flight entry. See Row class for details.
- */
-class FlightEntry : public Row
-{
-public:
-    FlightEntry();
-    FlightEntry(const RowData_T &row_data);
-    FlightEntry(int row_id, const RowData_T &row_data);
-};
-
-/*!
- * \brief A Row representing a Currency entry. See Row class for details.
- */
-class CurrencyEntry : public Row
-{
-public:
-    CurrencyEntry();
-    CurrencyEntry(const RowData_T &row_data);
-    CurrencyEntry(int row_id, const RowData_T &row_data);
-};
-
-/*!
- * \brief A Row representing an Airport entry. See Row class for details.
- */
-class AirportEntry : public Row
-{
-public:
-    AirportEntry();
-    AirportEntry(const RowData_T &row_data);
-    AirportEntry(int row_id, const RowData_T &row_data);
-
-    const QString iata() const { return getData().value(OPL::Db::AIRPORTS_IATA).toString(); }
-    const QString icao() const { return getData().value(OPL::Db::AIRPORTS_ICAO).toString(); }
-};
-
-/*!
- * \brief A Row representing an Airport entry. See Row class for details.
- */
-class PreviousExperienceEntry : public Row
-{
-public:
-    PreviousExperienceEntry();
-    PreviousExperienceEntry(const RowData_T &row_data);
-    PreviousExperienceEntry(int row_id, const RowData_T &row_data);
-};
-
 } // namespace OPL
 #endif // ROW_H

+ 39 - 0
src/database/simulatorentry.cpp

@@ -0,0 +1,39 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#include "simulatorentry.h"
+
+namespace OPL {
+
+SimulatorEntry::SimulatorEntry()
+    : Row(DbTable::Simulators, 0)
+{}
+
+SimulatorEntry::SimulatorEntry(const RowData_T &row_data)
+    : Row(DbTable::Simulators, 0, row_data)
+{}
+
+SimulatorEntry::SimulatorEntry(int row_id, const RowData_T &row_data)
+    : Row(DbTable::Simulators, row_id, row_data)
+{}
+
+const QString SimulatorEntry::getTableName() const
+{
+    return TABLE_NAME;
+}
+
+} // namespace OPL

+ 69 - 0
src/database/simulatorentry.h

@@ -0,0 +1,69 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef SIMULATORENTRY_H
+#define SIMULATORENTRY_H
+#include "src/database/row.h"
+
+namespace OPL {
+
+/*!
+ * \brief A Row representing a Simulator entry. See Row class for details.
+ */
+class SimulatorEntry : public Row
+{
+    const static inline QString TABLE_NAME = QStringLiteral("simulators");
+public:
+    SimulatorEntry();
+    SimulatorEntry(const RowData_T &row_data);
+    SimulatorEntry(int row_id, const RowData_T &row_data);
+
+    const QString getTableName() const override;
+
+    /*!
+     * \brief The sql column name for the row id
+     */
+    const static inline QString  ROWID       = QStringLiteral("session_id");
+    /*!
+     * \brief The sql column name for the date
+     */
+    const static inline QString  DATE        = QStringLiteral("date");
+    /*!
+     * \brief The sql column name for the total time
+     */
+    const static inline QString  TIME        = QStringLiteral("totalTime");
+    /*!
+     * \brief The sql column name for the simulator type (FNPT/FFS)
+     */
+    const static inline QString  TYPE        = QStringLiteral("deviceType");
+    /*!
+     * \brief The sql column name for the simulators aircraft type
+     */
+    const static inline QString  ACFT        = QStringLiteral("aircraftType");
+    /*!
+     * \brief The sql column name for the simulators registration
+     */
+    const static inline QString  REG         = QStringLiteral("registration");
+    /*!
+     * \brief The sql column name for remarks
+     */
+    const static inline QString  REMARKS     = QStringLiteral("remarks");
+};
+
+} // namespace OPL
+
+#endif // SIMULATORENTRY_H

+ 48 - 0
src/database/tailentry.cpp

@@ -0,0 +1,48 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#include "tailentry.h"
+
+namespace OPL {
+
+TailEntry::TailEntry()
+    : Row(DbTable::Tails, 0)
+{}
+
+TailEntry::TailEntry(const RowData_T &row_data)
+    : Row(DbTable::Tails, 0, row_data)
+{}
+
+TailEntry::TailEntry(int row_id, const RowData_T &row_data)
+    : Row(DbTable::Tails, row_id, row_data)
+{}
+
+const QString TailEntry::getTableName() const
+{
+    return TABLE_NAME;
+}
+
+const QString TailEntry::registration() const
+{
+    return getData().value(REGISTRATION).toString();
+}
+
+const QString TailEntry::type() const {
+    return getData().value(MAKE).toString();
+}
+
+} // namespace OPL

+ 109 - 0
src/database/tailentry.h

@@ -0,0 +1,109 @@
+/*
+ *openPilotLog - A FOSS Pilot Logbook Application
+ *Copyright (C) 2020-2023 Felix Turowsky
+ *
+ *This program is free software: you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation, either version 3 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License
+ *along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef TAILENTRY_H
+#define TAILENTRY_H
+#include "src/database/row.h"
+
+namespace OPL {
+
+/*!
+ * \brief A Row representing a Tail (Registration) entry.
+ * \details
+ * The tails table holds the various tails the user has added to his logbook.
+ * Within the program the term aircraft refers to an aircraft type and is stored
+ * in the aircraft database and is used as a template. A tail is a specific instance
+ * of an aircraft which is identified by its registration (tail).
+ */
+class TailEntry : public Row
+{
+    const static inline QString TABLE_NAME = QStringLiteral("tails");
+public:
+    TailEntry();
+    TailEntry(const RowData_T &row_data);
+    TailEntry(int row_id, const RowData_T &row_data);
+    const QString getTableName() const override;
+
+    /*!
+     * \brief Return the aircrafts registration
+     * \return
+     */
+    const QString registration() const;
+    /*!
+     * \brief Return the aircraft type
+     */
+    const QString type()         const; //TODO - Create String for make-model-variant
+
+    /*!
+     * \brief The entries row id in the database
+     */
+    const static inline QString ROWID            = QStringLiteral("tail_id");
+    /*!
+     * \brief The aircrafts registration ("LN-ENL", "D-ABCD")
+     */
+    const static inline QString REGISTRATION     = QStringLiteral("registration");
+    /*!
+     * \brief The company the aircraft is operated by
+     */
+    const static inline QString COMPANY          = QStringLiteral("company");
+    /*!
+     * \brief The aircrafts manufacturer
+     */
+    const static inline QString MAKE             = QStringLiteral("make");
+    /*!
+     * \brief The aircraft model
+     */
+    const static inline QString MODEL            = QStringLiteral("model");
+    /*!
+     * \brief The aircraft model variant
+     */
+    const static inline QString VARIANT          = QStringLiteral("variant");
+    /*!
+     * \brief Wether the aircraft requires more than one pilot (stored in the database as boolean)
+     */
+    static const inline QString MULTI_PILOT = QStringLiteral("multipilot");
+    /*!
+     * \brief Wether the aircraft has more than one engine (stored in the database as a boolean)
+     */
+    static const inline QString MULTI_ENGINE = QStringLiteral("multiengine");
+    /*!
+     * \brief The aircrafts engine type. Stored in the database as an integer
+     * \details
+     * <ul>
+     * <li> 0 - Single Engine Piston <\li>
+     * <li> 1 - Multi Engine Piston <\li>
+     * <li> 2 - Turboprop <\li>
+     * <li> 3 - Jet <\li>
+     * <\ul>
+     */
+    static const inline QString ENGINE_TYPE = QStringLiteral("engineType");
+    /*!
+     * \brief The aircrafts weight class. Stored in the database as an integer
+     * \details
+     * <ul>
+     * <li> 0 - Light <\li>
+     * <li> 1 - Medium <\li>
+     * <li> 2 - Heavy <\li>
+     * <li> 3 - Super Heavy <\li>
+     * <\ul>
+     */
+    static const inline QString WEIGHT_CLASS = QStringLiteral("weightClass");
+};
+
+} // namespace OPL
+
+#endif // TAILENTRY_H

+ 20 - 20
src/functions/calc.cpp

@@ -315,23 +315,23 @@ void OPL::Calc::updateAutoTimes(int acft_id)
         auto flight = DB->getFlightEntry(item.toInt());
         auto flight_data = flight.getData();
 
-        if(acft_data.value(OPL::Db::TAILS_MULTIPILOT).toInt() == 0
-                && acft_data.value(OPL::Db::TAILS_MULTIENGINE) == 0) {
+        if(acft_data.value(OPL::TailEntry::MULTI_PILOT).toInt() == 0
+            && acft_data.value(OPL::TailEntry::MULTI_ENGINE) == 0) {
             DEB << "SPSE";
-            flight_data.insert(OPL::Db::FLIGHTS_TSPSE, flight_data.value(OPL::Db::FLIGHTS_TBLK));
-            flight_data.insert(OPL::Db::FLIGHTS_TSPME, QString());
-            flight_data.insert(OPL::Db::FLIGHTS_TMP, QString());
-        } else if ((acft_data.value(OPL::Db::TAILS_MULTIPILOT) == 0
-                    && acft.getData().value(OPL::Db::TAILS_MULTIENGINE) == 1)) {
+            flight_data.insert(OPL::FlightEntry::TSPSE, flight_data.value(OPL::FlightEntry::TBLK));
+            flight_data.insert(OPL::FlightEntry::TSPME, QString());
+            flight_data.insert(OPL::FlightEntry::TMP, QString());
+        } else if ((acft_data.value(OPL::TailEntry::MULTI_PILOT) == 0
+                    && acft.getData().value(OPL::TailEntry::MULTI_ENGINE) == 1)) {
             DEB << "SPME";
-            flight_data.insert(OPL::Db::FLIGHTS_TSPME, flight_data.value(OPL::Db::FLIGHTS_TBLK));
-            flight_data.insert(OPL::Db::FLIGHTS_TSPSE, QString());
-            flight_data.insert(OPL::Db::FLIGHTS_TMP, QString());
-        } else if ((acft_data.value(OPL::Db::TAILS_MULTIPILOT) == 1)) {
+            flight_data.insert(OPL::FlightEntry::TSPME, flight_data.value(OPL::FlightEntry::TBLK));
+            flight_data.insert(OPL::FlightEntry::TSPSE, QString());
+            flight_data.insert(OPL::FlightEntry::TMP, QString());
+        } else if ((acft_data.value(OPL::TailEntry::MULTI_PILOT) == 1)) {
             DEB << "MPME";
-            flight_data.insert(OPL::Db::FLIGHTS_TMP, flight_data.value(OPL::Db::FLIGHTS_TBLK));
-            flight_data.insert(OPL::Db::FLIGHTS_TSPSE, QString());
-            flight_data.insert(OPL::Db::FLIGHTS_TSPME, QString());
+            flight_data.insert(OPL::FlightEntry::TMP, flight_data.value(OPL::FlightEntry::TBLK));
+            flight_data.insert(OPL::FlightEntry::TSPSE, QString());
+            flight_data.insert(OPL::FlightEntry::TSPME, QString());
         }
         flight.setData(flight_data);
         DB->commit(flight);
@@ -359,14 +359,14 @@ void OPL::Calc::updateNightTimes()
 
         auto flt = DB->getFlightEntry(item.toInt());
         auto data = flt.getData();
-        auto dateTime = QDateTime(QDate::fromString(data.value(OPL::Db::FLIGHTS_DOFT).toString(), Qt::ISODate),
-                                  QTime().addSecs(data.value(OPL::Db::FLIGHTS_TOFB).toInt() * 60),
+        auto dateTime = QDateTime(QDate::fromString(data.value(OPL::FlightEntry::DOFT).toString(), Qt::ISODate),
+                                  QTime().addSecs(data.value(OPL::FlightEntry::TOFB).toInt() * 60),
                                   Qt::UTC);
-        data.insert(OPL::Db::FLIGHTS_TNIGHT,
-                    calculateNightTime(data.value(OPL::Db::FLIGHTS_DEPT).toString(),
-                                       data.value(OPL::Db::FLIGHTS_DEST).toString(),
+        data.insert(OPL::FlightEntry::TNIGHT,
+                    calculateNightTime(data.value(OPL::FlightEntry::DEPT).toString(),
+                                       data.value(OPL::FlightEntry::DEST).toString(),
                                        dateTime,
-                                       data.value(OPL::Db::FLIGHTS_TBLK).toInt(),
+                                       data.value(OPL::FlightEntry::TBLK).toInt(),
                                        night_angle));
         flt.setData(data);
         DB->commit(flt);

+ 0 - 1
src/functions/readcsv.h

@@ -18,7 +18,6 @@
 #ifndef READCSV_H
 #define READCSV_H
 
-#include "src/opl.h"
 #include<QtCore>
 
 namespace CSV {

+ 0 - 218
src/functions/time.h

@@ -1,218 +0,0 @@
-/*
- *openPilotLog - A FOSS Pilot Logbook Application
- *Copyright (C) 2020-2023 Felix Turowsky
- *
- *This program is free software: you can redistribute it and/or modify
- *it under the terms of the GNU General Public License as published by
- *the Free Software Foundation, either version 3 of the License, or
- *(at your option) any later version.
- *
- *This program is distributed in the hope that it will be useful,
- *but WITHOUT ANY WARRANTY; without even the implied warranty of
- *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *GNU General Public License for more details.
- *
- *You should have received a copy of the GNU General Public License
- *along with this program.  If not, see <https://www.gnu.org/licenses/>.
- */
-#ifndef TIME_H
-#define TIME_H
-
-#include <QtCore>
-#include <QTime>
-#include "src/opl.h"
-
-//namespace OPL::Time {
-
-///*!
-// * \brief Converts a QTime to a String to be used in the UI
-// */
-//inline const QString toString(const QTime &time, OPL::FlightTimeFormat format = OPL::FlightTimeFormat::Default)
-//{
-//    switch (format) {
-//    case OPL::FlightTimeFormat::Default:
-//        return time.toString(QStringLiteral("hh:mm"));
-//        break;
-//    case OPL::FlightTimeFormat::Decimal:
-//        return QString::number(((time.hour() * 60 + time.minute() )/60.0), 'f', 2);
-//        break;
-//    default:
-//        return QString();
-//    }
-//}
-
-///*!
-// * \brief Converts an integer of minutes as received from the Datbase to a String
-// */
-//inline const QString toString(int minutes_in, OPL::FlightTimeFormat format = OPL::FlightTimeFormat::Default)
-//{
-//    switch (format) {
-//    case OPL::FlightTimeFormat::Default:
-//    {
-//        QString hour = QString::number(minutes_in / 60);
-//        if (hour.size() < 2) {
-//            hour.prepend(QStringLiteral("0"));
-//        }
-//        QString minute = QString::number(minutes_in % 60);
-//        if (minute.size() < 2) {
-//            minute.prepend(QStringLiteral("0"));
-//        }
-//        return hour + QLatin1Char(':') + minute;
-//    }
-//    case OPL::FlightTimeFormat::Decimal:
-//    {
-//        int hour = minutes_in / 60;
-//        double minute = (minutes_in % 60) / 60.0;
-//        return QString::number((hour + minute), 'f', 2);
-//    }
-//    default:
-//        return QString();
-//    }
-
-//}
-
-//inline double toDecimalHours(const QTime &time){
-//    return (time.hour() * 60 + time.minute()) / 60.0;
-//}
-
-//inline QTime qTimefromMinutes(int total_minutes)
-//{
-//    int minute = total_minutes % 60;
-//    int hour = total_minutes / 60;
-
-//    return QTime(hour, minute, 0);
-//}
-
-//inline const QTime fromString(QString time_string, OPL::FlightTimeFormat format = OPL::FlightTimeFormat::Default)
-//{
-//    switch (format) {
-//    case OPL::FlightTimeFormat::Default:
-//        return QTime::fromString(time_string, QStringLiteral("hh:mm"));
-//        break;
-//    case OPL::FlightTimeFormat::Decimal:
-//    {
-//        double decimal_time = time_string.toDouble();
-//        int hour = decimal_time;
-//        int minute = round((decimal_time - hour) * 60);
-//        return QTime(hour, minute, 0);
-//        break;
-//    }
-//    default:
-//        return QTime();
-//    }
-//}
-
-//inline const QTime fromString(const char* time_string, OPL::FlightTimeFormat format = OPL::FlightTimeFormat::Default)
-//{
-//    switch (format) {
-//    case OPL::FlightTimeFormat::Default:
-//        return QTime::fromString(time_string, QStringLiteral("hh:mm"));
-//        break;
-//    case OPL::FlightTimeFormat::Decimal:
-//    {
-//        double decimal_time = QString(time_string).toDouble();
-//        int hour = decimal_time;
-//        int minute = round((decimal_time - hour) * 60);
-//        return QTime(hour, minute, 0);
-//        break;
-//    }
-//    default:
-//        return QTime();
-//    }
-//}
-
-//inline int toMinutes(const QTime &time) {return time.hour() * 60 + time.minute();}
-//inline int toMinutes(const QString &time_string) {return toMinutes(fromString(time_string));}
-
-////inline QTime blocktime(const QTime &tofb, const QTime &tonb)
-////{
-////    QTime blocktime_out(0, 0); // initialise return value at midnight
-
-////    if (tonb > tofb) { // landing same day
-////        int block_seconds = tofb.secsTo(tonb);
-////        blocktime_out = blocktime_out.addSecs(block_seconds);
-////    } else { // landing next day
-////        QTime midnight(0, 0);
-////        int seconds = tofb.secsTo(midnight);
-////        blocktime_out = blocktime_out.addSecs(seconds);
-////        seconds = midnight.secsTo(tonb);
-////        blocktime_out = blocktime_out.addSecs(seconds);
-////    }
-////    return blocktime_out;
-////}
-
-////inline QTime blocktime(const QString& tofb, const QString& tonb)
-////{
-////    QTime t_tofb = OPL::Time::fromString(tofb);
-////    QTime t_tonb = OPL::Time::fromString(tonb);
-////    return blocktime(t_tofb, t_tonb);
-////}
-
-/////*!
-//// * \brief blockMinutes calculates the total amount of minutes elapsed between
-//// * tofb and tonb
-//// */
-////inline int blockMinutes(const QString& tofb, const QString& tonb)
-////{
-////    const QTime t_tofb = OPL::Time::fromString(tofb);
-////    const QTime t_tonb = OPL::Time::fromString(tonb);
-////    if (t_tofb.isValid() && t_tonb.isValid()) {
-////        const auto tblk = OPL::Time::blocktime(t_tofb, t_tonb);
-////        return OPL::Time::toMinutes(tblk);
-////    } else
-////        return 0;
-////}
-
-/////*!
-//// * \brief blockMinutes calculates the total amount of minutes elapsed between
-//// * tofb and tonb
-//// */
-////inline int blockMinutes(const QTime& tofb, const QTime& tonb)
-////{
-////    if (tofb.isValid() && tonb.isValid()) {
-////        const auto tblk = OPL::Time::blocktime(tofb, tonb);
-////        return OPL::Time::toMinutes(tblk);
-////    } else
-////        return 0;
-////}
-
-///*!
-// * \brief verifies user input and formats to hh:mm
-// * if the output is not a valid time, an empty string is returned. Accepts
-// * input as hh:mm, h:mm, hhmm or hmm.
-// * \param userinput from a QLineEdit
-// * \return formatted QString "hh:mm" or Empty String
-// */
-//QT_DEPRECATED
-//inline const QString formatTimeInput(QString user_input)
-//{
-//    LOG << "DEPRECATED";
-//    QTime temp_time; //empty time object is invalid by default
-
-//    bool contains_seperator = user_input.contains(':');
-//    if (user_input.length() == 4 && !contains_seperator) {
-//        temp_time = QTime::fromString(user_input, QStringLiteral("hhmm"));
-//    } else if (user_input.length() == 3 && !contains_seperator) {
-//        if (user_input.toInt() < 240) { //Qtime is invalid if time is between 000 and 240 for this case
-//            QString tempstring = user_input.prepend(QStringLiteral("0"));
-//            temp_time = QTime::fromString(tempstring, QStringLiteral("hhmm"));
-//        } else {
-//            temp_time = QTime::fromString(user_input, QStringLiteral("Hmm"));
-//        }
-//    } else if (user_input.length() == 4 && contains_seperator) {
-//        temp_time = QTime::fromString(user_input, QStringLiteral("h:mm"));
-//    } else if (user_input.length() == 5 && contains_seperator) {
-//        temp_time = QTime::fromString(user_input, QStringLiteral("hh:mm"));
-//    }
-
-//    auto output = temp_time.toString(QStringLiteral("hh:mm"));
-
-//    if (output.isEmpty()) {
-//        DEB << "Time input is invalid.";
-//    }
-//    return output;
-//}
-
-//} // namespace OPL::Time
-
-#endif // TIME_H

+ 1 - 0
src/gui/dialogues/exporttocsvdialog.cpp

@@ -3,6 +3,7 @@
 #include "QtSql/qsqlrecord.h"
 #include "QtSql/qsqltablemodel.h"
 #include "QtWidgets/qfiledialog.h"
+#include "src/opl.h"
 #include "ui_exporttocsvdialog.h"
 #include "src/functions/readcsv.h"
 

+ 9 - 9
src/gui/dialogues/firstrundialog.cpp

@@ -322,12 +322,12 @@ bool FirstRunDialog::setupDatabase()
 bool FirstRunDialog::createUserEntry()
 {
     QHash<QString, QVariant> data;
-    data.insert(OPL::Db::PILOTS_LASTNAME,   ui->lastnameLineEdit->text());
-    data.insert(OPL::Db::PILOTS_FIRSTNAME,  ui->firstnameLineEdit->text());
-    data.insert(OPL::Db::PILOTS_ALIAS,      QStringLiteral("self"));
-    data.insert(OPL::Db::PILOTS_EMPLOYEEID, ui->employeeidLineEdit->text());
-    data.insert(OPL::Db::PILOTS_PHONE,      ui->phoneLineEdit->text());
-    data.insert(OPL::Db::PILOTS_EMAIL,      ui->emailLineEdit->text());
+    data.insert(OPL::PilotEntry::LASTNAME,   ui->lastnameLineEdit->text());
+    data.insert(OPL::PilotEntry::FIRSTNAME,  ui->firstnameLineEdit->text());
+    data.insert(OPL::PilotEntry::ALIAS,      QStringLiteral("self"));
+    data.insert(OPL::PilotEntry::EMPLOYEEID, ui->employeeidLineEdit->text());
+    data.insert(OPL::PilotEntry::PHONE,      ui->phoneLineEdit->text());
+    data.insert(OPL::PilotEntry::EMAIL,      ui->emailLineEdit->text());
 
     auto pilot = OPL::PilotEntry(1, data);
 
@@ -358,11 +358,11 @@ bool FirstRunDialog::writeCurrencies()
         const auto enum_value = currencies_list.key(date_edit);
         // only write dates that have been edited
         if (date_edit->date() != today) {
-            OPL::RowData_T row_data = {{OPL::Db::CURRENCIES_EXPIRYDATE, date_edit->date().toString(Qt::ISODate)}};
+            OPL::RowData_T row_data = {{OPL::CurrencyEntry::EXPIRYDATE, date_edit->date().toString(Qt::ISODate)}};
             if (enum_value == OPL::CurrencyName::Custom1)
-                row_data.insert(OPL::Db::CURRENCIES_CURRENCYNAME, ui->currCustom1LineEdit->text());
+                row_data.insert(OPL::CurrencyEntry::CURRENCYNAME, ui->currCustom1LineEdit->text());
             else if(enum_value == OPL::CurrencyName::Custom2)
-                row_data.insert(OPL::Db::CURRENCIES_CURRENCYNAME, ui->currCustom2LineEdit->text());
+                row_data.insert(OPL::CurrencyEntry::CURRENCYNAME, ui->currCustom2LineEdit->text());
 
             Settings::write(settings_list.value(enum_value), true); // Show selected currency on Home Screen
             OPL::CurrencyEntry entry(static_cast<int>(enum_value), row_data);

+ 15 - 15
src/gui/dialogues/newairportdialog.cpp

@@ -51,14 +51,14 @@ void NewAirportDialog::loadAirportData(int row_id)
     //const auto airport_data = airport.getData();
     DEB << "Filling Airport Data: " << airport_data;
 
-    ui->nameLineEdit->setText(airport_data.value(OPL::Db::AIRPORTS_NAME).toString());
-    ui->icaoLineEdit->setText(airport_data.value(OPL::Db::AIRPORTS_ICAO).toString());
-    ui->iataLineEdit->setText(airport_data.value(OPL::Db::AIRPORTS_IATA).toString());
-    ui->latDoubleSpinBox->setValue(airport_data.value(OPL::Db::AIRPORTS_LAT).toDouble());
-    ui->lonDoubleSpinBox->setValue(airport_data.value(OPL::Db::AIRPORTS_LON).toDouble());
-    ui->countryLineEdit->setText(airport_data.value(OPL::Db::AIRPORTS_COUNTRY).toString());
-
-    const QString timezone = airport_data.value(OPL::Db::AIRPORTS_TZ_OLSON).toString();
+    ui->nameLineEdit->setText(airport_data.value(OPL::AirportEntry::NAME).toString());
+    ui->icaoLineEdit->setText(airport_data.value(OPL::AirportEntry::ICAO).toString());
+    ui->iataLineEdit->setText(airport_data.value(OPL::AirportEntry::IATA).toString());
+    ui->latDoubleSpinBox->setValue(airport_data.value(OPL::AirportEntry::LAT).toDouble());
+    ui->lonDoubleSpinBox->setValue(airport_data.value(OPL::AirportEntry::LON).toDouble());
+    ui->countryLineEdit->setText(airport_data.value(OPL::AirportEntry::COUNTRY).toString());
+
+    const QString timezone = airport_data.value(OPL::AirportEntry::TZ_OLSON).toString();
     DEB << "Timezone: " << timezone;
     if (timezone.isNull())
         WARN(tr("Unable to read timezone data for this airport. Please verify."));
@@ -109,13 +109,13 @@ void NewAirportDialog::on_buttonBox_accepted()
         return;
     // create Entry object
     OPL::RowData_T airport_data = {
-        {OPL::Db::AIRPORTS_NAME,     ui->nameLineEdit->text()},
-        {OPL::Db::AIRPORTS_ICAO,     ui->icaoLineEdit->text()},
-        {OPL::Db::AIRPORTS_IATA,     ui->iataLineEdit->text()},
-        {OPL::Db::AIRPORTS_LAT,      ui->latDoubleSpinBox->value()},
-        {OPL::Db::AIRPORTS_LON,      ui->lonDoubleSpinBox->value()},
-        {OPL::Db::AIRPORTS_TZ_OLSON, ui->timeZoneComboBox->currentText()},
-        {OPL::Db::AIRPORTS_COUNTRY,  ui->countryLineEdit->text()},
+        {OPL::AirportEntry::NAME,     ui->nameLineEdit->text()},
+        {OPL::AirportEntry::ICAO,     ui->icaoLineEdit->text()},
+        {OPL::AirportEntry::IATA,     ui->iataLineEdit->text()},
+        {OPL::AirportEntry::LAT,      ui->latDoubleSpinBox->value()},
+        {OPL::AirportEntry::LON,      ui->lonDoubleSpinBox->value()},
+        {OPL::AirportEntry::TZ_OLSON, ui->timeZoneComboBox->currentText()},
+        {OPL::AirportEntry::COUNTRY,  ui->countryLineEdit->text()},
     };
 
     OPL::AirportEntry entry(rowId, airport_data);

+ 61 - 60
src/gui/dialogues/newflightdialog.cpp

@@ -17,6 +17,7 @@
  */
 #include "newflightdialog.h"
 #include "src/classes/time.h"
+#include "src/database/database.h"
 #include "src/database/databasecache.h"
 #include "src/gui/verification/airportinput.h"
 #include "src/gui/verification/completerprovider.h"
@@ -184,50 +185,50 @@ void NewFlightDialog::fillWithEntryData()
     const auto &flight_data = flightEntry.getData();
 
     // Date of Flight
-    ui->doftLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_DOFT).toString());
+    ui->doftLineEdit->setText(flight_data.value(OPL::FlightEntry::DOFT).toString());
     // Location
-    ui->deptLocationLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_DEPT).toString());
-    ui->destLocationLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_DEST).toString());
+    ui->deptLocationLineEdit->setText(flight_data.value(OPL::FlightEntry::DEPT).toString());
+    ui->destLocationLineEdit->setText(flight_data.value(OPL::FlightEntry::DEST).toString());
     // Times
-    ui->tofbTimeLineEdit->setText(OPL::Time(flight_data.value(OPL::Db::FLIGHTS_TOFB).toInt()).toString());
-    ui->tonbTimeLineEdit->setText(OPL::Time(flight_data.value(OPL::Db::FLIGHTS_TONB).toInt()).toString());
-    ui->acftLineEdit->setText(DBCache->getTailsMap().value(flight_data.value(OPL::Db::FLIGHTS_ACFT).toInt()));
-    ui->picNameLineEdit->setText(DBCache->getPilotNamesMap().value(flight_data.value(OPL::Db::FLIGHTS_PIC).toInt()));
-    ui->sicNameLineEdit->setText(DBCache->getPilotNamesMap().value(flight_data.value(OPL::Db::FLIGHTS_SECONDPILOT).toInt()));
-    ui->thirdPilotNameLineEdit->setText(DBCache->getPilotNamesMap().value(flight_data.value(OPL::Db::FLIGHTS_THIRDPILOT).toInt()));
+    ui->tofbTimeLineEdit->setText(OPL::Time(flight_data.value(OPL::FlightEntry::TOFB).toInt()).toString());
+    ui->tonbTimeLineEdit->setText(OPL::Time(flight_data.value(OPL::FlightEntry::TONB).toInt()).toString());
+    ui->acftLineEdit->setText(DBCache->getTailsMap().value(flight_data.value(OPL::FlightEntry::ACFT).toInt()));
+    ui->picNameLineEdit->setText(DBCache->getPilotNamesMap().value(flight_data.value(OPL::FlightEntry::PIC).toInt()));
+    ui->sicNameLineEdit->setText(DBCache->getPilotNamesMap().value(flight_data.value(OPL::FlightEntry::SECONDPILOT).toInt()));
+    ui->thirdPilotNameLineEdit->setText(DBCache->getPilotNamesMap().value(flight_data.value(OPL::FlightEntry::THIRDPILOT).toInt()));
 
     //Function
     const QHash<int, QString> functions = {
-        {0, OPL::Db::FLIGHTS_TPIC},
-        {1, OPL::Db::FLIGHTS_TPICUS},
-        {2, OPL::Db::FLIGHTS_TSIC},
-        {3, OPL::Db::FLIGHTS_TDUAL},
-        {4, OPL::Db::FLIGHTS_TFI},
+        {0, OPL::FlightEntry::TPIC},
+        {1, OPL::FlightEntry::TPICUS},
+        {2, OPL::FlightEntry::TSIC},
+        {3, OPL::FlightEntry::TDUAL},
+        {4, OPL::FlightEntry::TFI},
     };
     for (int i = 0; i < 5; i++) { // QHash::iterator not guarenteed to be in ordetr
         if(flight_data.value(functions.value(i)).toInt() != 0)
             ui->functionComboBox->setCurrentIndex(i);
     }
     // Approach ComboBox
-    const QString& app = flight_data.value(OPL::Db::FLIGHTS_APPROACHTYPE).toString();
+    const QString& app = flight_data.value(OPL::FlightEntry::APPROACHTYPE).toString();
     if(app != QString()){
         ui->approachComboBox->setCurrentText(app);
     }
     // Flight Rules
-    bool time_ifr = flight_data.value(OPL::Db::FLIGHTS_TIFR).toBool();
+    bool time_ifr = flight_data.value(OPL::FlightEntry::TIFR).toBool();
     int rulesIndex = time_ifr ? 1 : 0;
     ui->flightRulesComboBox->setCurrentIndex(rulesIndex);
     // Take-Off and Landing
-    int takeOffCount =  flight_data.value(OPL::Db::FLIGHTS_TODAY).toInt()
-            + flight_data.value(OPL::Db::FLIGHTS_TONIGHT).toInt();
-    int landingCount = flight_data.value(OPL::Db::FLIGHTS_LDGDAY).toInt()
-            + flight_data.value(OPL::Db::FLIGHTS_LDGNIGHT).toInt();
+    int takeOffCount =  flight_data.value(OPL::FlightEntry::TODAY).toInt()
+            + flight_data.value(OPL::FlightEntry::TONIGHT).toInt();
+    int landingCount = flight_data.value(OPL::FlightEntry::LDGDAY).toInt()
+            + flight_data.value(OPL::FlightEntry::LDGNIGHT).toInt();
     ui->takeOffSpinBox->setValue(takeOffCount);
     ui->landingSpinBox->setValue(landingCount);
     // Remarks
-    ui->remarksLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_REMARKS).toString());
+    ui->remarksLineEdit->setText(flight_data.value(OPL::FlightEntry::REMARKS).toString());
     // Flight Number
-    ui->flightNumberLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_FLIGHTNUMBER).toString());
+    ui->flightNumberLineEdit->setText(flight_data.value(OPL::FlightEntry::FLIGHTNUMBER).toString());
 
     for(const auto &line_edit : *mandatoryLineEdits)
         emit line_edit->editingFinished();
@@ -376,51 +377,51 @@ OPL::RowData_T NewFlightDialog::prepareFlightEntryData()
     const auto night_time_data = OPL::Calc::NightTimeValues(ui->deptLocationLineEdit->text(), ui->destLocationLineEdit->text(),
                            departure_date_time, block_minutes, Settings::read(Settings::FlightLogging::NightAngle).toInt());
     // Mandatory data
-    new_data.insert(OPL::Db::FLIGHTS_DOFT, ui->doftLineEdit->text());
-    new_data.insert(OPL::Db::FLIGHTS_DEPT, ui->deptLocationLineEdit->text());
-    new_data.insert(OPL::Db::FLIGHTS_TOFB, tofb.toMinutes());
-    new_data.insert(OPL::Db::FLIGHTS_DEST, ui->destLocationLineEdit->text());
-    new_data.insert(OPL::Db::FLIGHTS_TONB, tonb.toMinutes());
-    new_data.insert(OPL::Db::FLIGHTS_TBLK, block_minutes);
+    new_data.insert(OPL::FlightEntry::DOFT, ui->doftLineEdit->text());
+    new_data.insert(OPL::FlightEntry::DEPT, ui->deptLocationLineEdit->text());
+    new_data.insert(OPL::FlightEntry::TOFB, tofb.toMinutes());
+    new_data.insert(OPL::FlightEntry::DEST, ui->destLocationLineEdit->text());
+    new_data.insert(OPL::FlightEntry::TONB, tonb.toMinutes());
+    new_data.insert(OPL::FlightEntry::TBLK, block_minutes);
     // Night
-    new_data.insert(OPL::Db::FLIGHTS_TNIGHT, night_time_data.nightMinutes);
+    new_data.insert(OPL::FlightEntry::TNIGHT, night_time_data.nightMinutes);
     // Aircraft
     int acft_id = DBCache->getTailsMap().key(ui->acftLineEdit->text());
-    new_data.insert(OPL::Db::FLIGHTS_ACFT, acft_id);
+    new_data.insert(OPL::FlightEntry::ACFT, acft_id);
     const OPL::TailEntry acft_data = DB->getTailEntry(acft_id);
-    bool multi_pilot = acft_data.getData().value(OPL::Db::TAILS_MULTIPILOT).toBool();
-    bool multi_engine = acft_data.getData().value(OPL::Db::TAILS_MULTIENGINE).toBool();
+    bool multi_pilot = acft_data.getData().value(OPL::TailEntry::MULTI_PILOT).toBool();
+    bool multi_engine = acft_data.getData().value(OPL::TailEntry::MULTI_ENGINE).toBool();
 
     if (multi_pilot) {
-        new_data.insert(OPL::Db::FLIGHTS_TMP, block_minutes);
-        new_data.insert(OPL::Db::FLIGHTS_TSPSE, QString());
-        new_data.insert(OPL::Db::FLIGHTS_TSPME, QString());
+        new_data.insert(OPL::FlightEntry::TMP, block_minutes);
+        new_data.insert(OPL::FlightEntry::TSPSE, QString());
+        new_data.insert(OPL::FlightEntry::TSPME, QString());
     } else if (!multi_pilot && !multi_engine) {
-        new_data.insert(OPL::Db::FLIGHTS_TMP, QString());
-        new_data.insert(OPL::Db::FLIGHTS_TSPSE, block_minutes);
-        new_data.insert(OPL::Db::FLIGHTS_TSPME, QString());
+        new_data.insert(OPL::FlightEntry::TMP, QString());
+        new_data.insert(OPL::FlightEntry::TSPSE, block_minutes);
+        new_data.insert(OPL::FlightEntry::TSPME, QString());
     } else if (!multi_pilot && multi_engine) {
-        new_data.insert(OPL::Db::FLIGHTS_TMP, QString());
-        new_data.insert(OPL::Db::FLIGHTS_TSPSE, QString());
-        new_data.insert(OPL::Db::FLIGHTS_TSPME, block_minutes);
+        new_data.insert(OPL::FlightEntry::TMP, QString());
+        new_data.insert(OPL::FlightEntry::TSPSE, QString());
+        new_data.insert(OPL::FlightEntry::TSPME, block_minutes);
     }
     // Pilots
-    new_data.insert(OPL::Db::FLIGHTS_PIC, DBCache->getPilotNamesMap().key(ui->picNameLineEdit->text()));
-    new_data.insert(OPL::Db::FLIGHTS_SECONDPILOT, DBCache->getPilotNamesMap().key(ui->sicNameLineEdit->text()));
-    new_data.insert(OPL::Db::FLIGHTS_THIRDPILOT, DBCache->getPilotNamesMap().key(ui->thirdPilotNameLineEdit->text()));
+    new_data.insert(OPL::FlightEntry::PIC, DBCache->getPilotNamesMap().key(ui->picNameLineEdit->text()));
+    new_data.insert(OPL::FlightEntry::SECONDPILOT, DBCache->getPilotNamesMap().key(ui->sicNameLineEdit->text()));
+    new_data.insert(OPL::FlightEntry::THIRDPILOT, DBCache->getPilotNamesMap().key(ui->thirdPilotNameLineEdit->text()));
     // IFR time
     if (ui->flightRulesComboBox->currentIndex() > 0) {
-        new_data.insert(OPL::Db::FLIGHTS_TIFR, block_minutes);
+        new_data.insert(OPL::FlightEntry::TIFR, block_minutes);
     } else {
-        new_data.insert(OPL::Db::FLIGHTS_TIFR, QString());
+        new_data.insert(OPL::FlightEntry::TIFR, QString());
     }
     // Function Times
     QStringList function_times = {
-        OPL::Db::FLIGHTS_TPIC,
-        OPL::Db::FLIGHTS_TPICUS,
-        OPL::Db::FLIGHTS_TSIC,
-        OPL::Db::FLIGHTS_TDUAL,
-        OPL::Db::FLIGHTS_TFI,
+        OPL::FlightEntry::TPIC,
+        OPL::FlightEntry::TPICUS,
+        OPL::FlightEntry::TSIC,
+        OPL::FlightEntry::TDUAL,
+        OPL::FlightEntry::TFI,
     };
 
     // Determine function times, zero out all values except one (use QString() iso 0 for correct handling of NULL in DB
@@ -452,21 +453,21 @@ OPL::RowData_T NewFlightDialog::prepareFlightEntryData()
     int ldgDay   = night_time_data.landingNight ? 0 : ui->landingSpinBox->value();
     int ldgNight = night_time_data.landingNight ? ui->landingSpinBox->value() : 0;
 
-    new_data.insert(OPL::Db::FLIGHTS_TODAY, toDay);
-    new_data.insert(OPL::Db::FLIGHTS_TONIGHT, toNight);
-    new_data.insert(OPL::Db::FLIGHTS_LDGDAY, ldgDay);
-    new_data.insert(OPL::Db::FLIGHTS_LDGNIGHT, ldgNight);
+    new_data.insert(OPL::FlightEntry::TODAY, toDay);
+    new_data.insert(OPL::FlightEntry::TONIGHT, toNight);
+    new_data.insert(OPL::FlightEntry::LDGDAY, ldgDay);
+    new_data.insert(OPL::FlightEntry::LDGNIGHT, ldgNight);
     if (ui->approachComboBox->currentText() == CAT_3) // ILS CAT III
-        new_data.insert(OPL::Db::FLIGHTS_AUTOLAND, ui->landingSpinBox->value());
+        new_data.insert(OPL::FlightEntry::AUTOLAND, ui->landingSpinBox->value());
 
     // Pilot flying / Pilot monitoring
     bool isPilotFlying = toDay + toNight + ldgDay + ldgNight > 0;
-    new_data.insert(OPL::Db::FLIGHTS_PILOTFLYING, isPilotFlying);
+    new_data.insert(OPL::FlightEntry::PILOTFLYING, isPilotFlying);
 
     // Additional Data
-    new_data.insert(OPL::Db::FLIGHTS_APPROACHTYPE, ui->approachComboBox->currentText());
-    new_data.insert(OPL::Db::FLIGHTS_FLIGHTNUMBER, ui->flightNumberLineEdit->text());
-    new_data.insert(OPL::Db::FLIGHTS_REMARKS, ui->remarksLineEdit->text());
+    new_data.insert(OPL::FlightEntry::APPROACHTYPE, ui->approachComboBox->currentText());
+    new_data.insert(OPL::FlightEntry::FLIGHTNUMBER, ui->flightNumberLineEdit->text());
+    new_data.insert(OPL::FlightEntry::REMARKS, ui->remarksLineEdit->text());
     return new_data;
 }
 

+ 1 - 1
src/gui/dialogues/newflightdialog.h

@@ -24,9 +24,9 @@
 #include <QList>
 #include <QBitArray>
 
+#include "src/database/flightentry.h"
 #include "src/gui/verification/userinput.h"
 #include "src/opl.h"
-#include "src/database/row.h"
 #include "src/gui/verification/validationstate.h"
 
 namespace Ui {

+ 1 - 1
src/gui/dialogues/newpilotdialog.h

@@ -23,7 +23,7 @@
 #include <QRegularExpression>
 #include <QRegularExpressionValidator>
 #include <QCompleter>
-#include "src/database/row.h"
+#include "src/database/pilotentry.h"
 
 namespace Ui {
 class NewPilot;

+ 12 - 12
src/gui/dialogues/newsimdialog.cpp

@@ -55,12 +55,12 @@ void NewSimDialog::init()
 void NewSimDialog::fillEntryData()
 {
     const auto& data = entry.getData();
-    ui->dateLineEdit->setText(data.value(OPL::Db::SIMULATORS_DATE).toString());
-    ui->totalTimeLineEdit->setText(OPL::Time(data.value(OPL::Db::SIMULATORS_TIME).toInt()).toString());
-    ui->deviceTypeComboBox->setCurrentIndex(data.value(OPL::Db::SIMULATORS_TYPE).toInt());
-    ui->aircraftTypeLineEdit->setText(data.value(OPL::Db::SIMULATORS_ACFT).toString());
-    ui->registrationLineEdit->setText(data.value(OPL::Db::SIMULATORS_REG).toString());
-    ui->remarksLineEdit->setText(data.value(OPL::Db::SIMULATORS_REMARKS).toString());
+    ui->dateLineEdit->setText(data.value(OPL::SimulatorEntry::DATE).toString());
+    ui->totalTimeLineEdit->setText(OPL::Time(data.value(OPL::SimulatorEntry::TIME).toInt()).toString());
+    ui->deviceTypeComboBox->setCurrentIndex(data.value(OPL::SimulatorEntry::TYPE).toInt());
+    ui->aircraftTypeLineEdit->setText(data.value(OPL::SimulatorEntry::ACFT).toString());
+    ui->registrationLineEdit->setText(data.value(OPL::SimulatorEntry::REG).toString());
+    ui->remarksLineEdit->setText(data.value(OPL::SimulatorEntry::REMARKS).toString());
 }
 
 NewSimDialog::~NewSimDialog()
@@ -159,19 +159,19 @@ OPL::RowData_T NewSimDialog::collectInput()
 {
     OPL::RowData_T new_entry;
     // Date
-    new_entry.insert(OPL::Db::SIMULATORS_DATE, ui->dateLineEdit->text());
+    new_entry.insert(OPL::SimulatorEntry::DATE, ui->dateLineEdit->text());
     // Time
-    new_entry.insert(OPL::Db::SIMULATORS_TIME, OPL::Time::fromString(ui->totalTimeLineEdit->text()).toMinutes());
+    new_entry.insert(OPL::SimulatorEntry::TIME, OPL::Time::fromString(ui->totalTimeLineEdit->text()).toMinutes());
     // Device Type
-    new_entry.insert(OPL::Db::SIMULATORS_TYPE, ui->deviceTypeComboBox->currentText());
+    new_entry.insert(OPL::SimulatorEntry::TYPE, ui->deviceTypeComboBox->currentText());
     // Aircraft Type
-    new_entry.insert(OPL::Db::SIMULATORS_ACFT, ui->aircraftTypeLineEdit->text());
+    new_entry.insert(OPL::SimulatorEntry::ACFT, ui->aircraftTypeLineEdit->text());
     // Registration
     if (!ui->registrationLineEdit->text().isEmpty())
-        new_entry.insert(OPL::Db::SIMULATORS_REG, ui->registrationLineEdit->text());
+        new_entry.insert(OPL::SimulatorEntry::REG, ui->registrationLineEdit->text());
     // Remarks
     if (!ui->remarksLineEdit->text().isEmpty())
-        new_entry.insert(OPL::Db::FLIGHTS_REMARKS, ui->remarksLineEdit->text());
+        new_entry.insert(OPL::SimulatorEntry::REMARKS, ui->remarksLineEdit->text());
 
     return new_entry;
 }

+ 1 - 1
src/gui/dialogues/newsimdialog.h

@@ -2,7 +2,7 @@
 #define NEWSIMDIALOG_H
 
 #include <QDialog>
-#include "src/database/row.h"
+#include "src/database/simulatorentry.h"
 
 namespace Ui {
 class NewSimDialog;

+ 9 - 8
src/gui/dialogues/newtaildialog.cpp

@@ -16,6 +16,7 @@
  *along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 #include "newtaildialog.h"
+#include "src/database/database.h"
 #include "src/database/databasecache.h"
 #include "ui_newtail.h"
 #include "src/opl.h"
@@ -121,10 +122,10 @@ void NewTailDialog::fillForm(OPL::Row entry, bool is_template)
         le->setText(data.value(key).toString());
     }
 
-    ui->operationComboBox->setCurrentIndex(data.value(OPL::Db::TAILS_MULTIPILOT).toInt() + 1);
-    ui->ppNumberComboBox ->setCurrentIndex(data.value(OPL::Db::TAILS_MULTIENGINE).toInt() + 1);
-    ui->ppTypeComboBox->setCurrentIndex(data.value(OPL::Db::TAILS_ENGINETYPE).toInt() + 1);
-    ui->weightComboBox->setCurrentIndex(data.value(OPL::Db::TAILS_WEIGHTCLASS).toInt() + 1);
+    ui->operationComboBox->setCurrentIndex(data.value(OPL::TailEntry::MULTI_PILOT).toInt() + 1);
+    ui->ppNumberComboBox ->setCurrentIndex(data.value(OPL::TailEntry::MULTI_ENGINE).toInt() + 1);
+    ui->ppTypeComboBox->setCurrentIndex(data.value(OPL::TailEntry::ENGINE_TYPE).toInt() + 1);
+    ui->weightComboBox->setCurrentIndex(data.value(OPL::TailEntry::WEIGHT_CLASS).toInt() + 1);
 }
 
 /*!
@@ -186,16 +187,16 @@ void NewTailDialog::submitForm()
     }
 
     if (ui->operationComboBox->currentIndex() != 0) { // bool Multipilot
-        new_data.insert(OPL::Db::TAILS_MULTIPILOT, ui->operationComboBox->currentIndex() - 1);
+        new_data.insert(OPL::TailEntry::MULTI_PILOT, ui->operationComboBox->currentIndex() - 1);
     }
     if (ui->ppNumberComboBox->currentIndex() != 0) { // bool MultiEngine
-        new_data.insert(OPL::Db::TAILS_MULTIENGINE, ui->ppNumberComboBox->currentIndex() - 1);
+        new_data.insert(OPL::TailEntry::MULTI_ENGINE, ui->ppNumberComboBox->currentIndex() - 1);
     }
     if (ui->ppTypeComboBox->currentIndex() != 0) { // int 0=unpowered,....4=jet
-        new_data.insert(OPL::Db::TAILS_ENGINETYPE, ui->ppTypeComboBox->currentIndex() - 1);
+        new_data.insert(OPL::TailEntry::ENGINE_TYPE, ui->ppTypeComboBox->currentIndex() - 1);
     }
     if (ui->weightComboBox->currentIndex() != 0) { // int 0=light...3=super
-        new_data.insert(OPL::Db::TAILS_WEIGHTCLASS, ui->weightComboBox->currentIndex() - 1);
+        new_data.insert(OPL::TailEntry::WEIGHT_CLASS, ui->weightComboBox->currentIndex() - 1);
     }
 
     //create db object

+ 1 - 3
src/gui/dialogues/newtaildialog.h

@@ -24,10 +24,8 @@
 #include <QRegularExpression>
 #include <QComboBox>
 
-#include "src/classes/settings.h"
-#include "src/functions/calc.h"
-#include "src/database/database.h"
 #include "src/database/row.h"
+#include "src/database/tailentry.h"
 
 namespace Ui {
 class NewTail;

+ 1 - 1
src/gui/widgets/airportwidget.cpp

@@ -91,7 +91,7 @@ void AirportWidget::on_deletePushButton_clicked()
         QStringList selected_airport_names;
         for (const auto row_id : qAsConst(selectedEntries)) {
             const auto data = DB->getRowData(OPL::DbTable::Airports, row_id);
-            selected_airport_names.append(data.value(OPL::Db::AIRPORTS_NAME).toString());
+            selected_airport_names.append(data.value(OPL::AirportEntry::NAME).toString());
         }
 
         QString selected_airports_string;

+ 1 - 1
src/gui/widgets/backupwidget.cpp

@@ -88,7 +88,7 @@ const QString BackupWidget::backupName()
     auto owner = DB->getPilotEntry(1);
     return  QString("logbook_backup_%1_%2.db").arg(
                 OPL::DateTime::dateTimeToString(QDateTime::currentDateTime(), OPL::DateTimeFormat::Backup),
-                owner.lastName()
+                                                  owner.getLastName()
                 );
 }
 

+ 0 - 1
src/gui/widgets/backupwidget.h

@@ -18,7 +18,6 @@
 #ifndef BACKUPWIDGET_H
 #define BACKUPWIDGET_H
 
-#include "src/classes/paths.h"
 
 #include <QWidget>
 #include <QStandardItemModel>

+ 0 - 2
src/gui/widgets/debugwidget.cpp

@@ -28,9 +28,7 @@
 #include "src/classes/downloadhelper.h"
 #include "src/functions/readcsv.h"
 #include "src/database/database.h"
-#include "src/database/row.h"
 #include "src/testing/atimer.h"
-#include "src/functions/log.h"
 void DebugWidget::on_debugPushButton_clicked()
 {
     auto rawCsvData = CSV::readCsvAsRows("/home/felix/git/importMCC/assets/data/felix.csv");

+ 4 - 3
src/gui/widgets/homewidget.cpp

@@ -16,6 +16,7 @@
  *along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 #include "homewidget.h"
+#include "src/functions/statistics.h"
 #include "src/gui/widgets/totalswidget.h"
 #include "ui_homewidget.h"
 #include "src/database/database.h"
@@ -109,14 +110,14 @@ void HomeWidget::fillCurrency(OPL::CurrencyName currency_name, QLabel* display_l
     const auto currency_entry = DB->getCurrencyEntry(static_cast<int>(currency_name));
 
     if (currency_name == OPL::CurrencyName::Custom1) {
-        ui->currCustom1Label->setText(currency_entry.getData().value(OPL::Db::CURRENCIES_CURRENCYNAME).toString());
+        ui->currCustom1Label->setText(currency_entry.getData().value(OPL::CurrencyEntry::CURRENCYNAME).toString());
     } else if (currency_name == OPL::CurrencyName::Custom2) {
-        ui->currCustom2Label->setText(currency_entry.getData().value(OPL::Db::CURRENCIES_CURRENCYNAME).toString());
+        ui->currCustom2Label->setText(currency_entry.getData().value(OPL::CurrencyEntry::CURRENCYNAME).toString());
     }
 
     if (currency_entry.isValid()) {
         const auto currency_date = QDate::fromString(currency_entry.getData().value(
-                                               OPL::Db::CURRENCIES_EXPIRYDATE).toString(),
+                                               OPL::CurrencyEntry::EXPIRYDATE).toString(),
                                                Qt::ISODate);
         display_label->setText(currency_date.toString(Qt::TextDate));
         setLabelColour(display_label, Colour::None);

+ 1 - 3
src/gui/widgets/homewidget.h

@@ -23,9 +23,7 @@
 #include <QLabel>
 #include <QLineEdit>
 #include <QSettings>
-#include "src/functions/statistics.h"
 #include "src/database/database.h"
-#include "src/classes/settings.h"
 
 namespace Ui {
 class HomeWidget;
@@ -96,7 +94,7 @@ private:
     /*!
      * \brief Retreives the users first name from the database.
      */
-    const inline QString userName() { return DB->getPilotEntry(1).firstName(); }
+    const inline QString userName() { return DB->getPilotEntry(1).getFirstName(); }
 
 public slots:
     void refresh();

+ 5 - 8
src/gui/widgets/logbookwidget.cpp

@@ -24,9 +24,6 @@
 #include "src/classes/settings.h"
 #include "src/gui/dialogues/newflightdialog.h"
 #include "src/gui/dialogues/newsimdialog.h"
-#include "src/functions/time.h"
-
-
 
 LogbookWidget::LogbookWidget(QWidget *parent) :
     QWidget(parent),
@@ -97,13 +94,13 @@ const QString LogbookWidget::getFlightSummary(const OPL::FlightEntry &flight) co
     auto tableData = flight.getData();
     QString flight_summary;
     auto space = QLatin1Char(' ');
-    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DOFT).toString() + space);
-    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEPT).toString() + space);
-    flight_summary.append(OPL::Time(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt()).toString()
+    flight_summary.append(tableData.value(OPL::FlightEntry::DOFT).toString() + space);
+    flight_summary.append(tableData.value(OPL::FlightEntry::DEPT).toString() + space);
+    flight_summary.append(OPL::Time(tableData.value(OPL::FlightEntry::TOFB).toInt()).toString()
                           + space);
-    flight_summary.append(OPL::Time(tableData.value(OPL::Db::FLIGHTS_TONB).toInt()).toString()
+    flight_summary.append(OPL::Time(tableData.value(OPL::FlightEntry::TONB).toInt()).toString()
                           + space);
-    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEST).toString());
+    flight_summary.append(tableData.value(OPL::FlightEntry::DEST).toString());
 
     return flight_summary;
 }

+ 1 - 2
src/gui/widgets/logbookwidget.h

@@ -25,9 +25,8 @@
 #include <QDebug>
 #include <QMenu>
 #include <QTableView>
-#include "src/database/row.h"
+#include "src/database/flightentry.h"
 #include "src/gui/widgets/settingswidget.h"
-#include "src/opl.h"
 
 namespace Ui {
 class LogbookWidget;

+ 7 - 8
src/gui/widgets/pilotswidget.cpp

@@ -238,13 +238,12 @@ void PilotsWidget::repopulateModel()
     connectSignalsAndSlots();
 }
 
-const QString PilotsWidget::getPilotName(const OPL::PilotEntry &pilot)
+const QString PilotsWidget::getPilotName(const OPL::PilotEntry &pilot) const
 {
     if (!pilot.isValid())
         return QString();
 
-    return pilot.getData().value(OPL::Db::PILOTS_LASTNAME).toString() + QLatin1String(", ")
-            + pilot.getData().value(OPL::Db::PILOTS_FIRSTNAME).toString();
+    return pilot.getLastName() + QLatin1String(", ") + pilot.getFirstName();
 }
 
 const QString PilotsWidget::getFlightSummary(const OPL::FlightEntry &flight) const
@@ -256,13 +255,13 @@ const QString PilotsWidget::getFlightSummary(const OPL::FlightEntry &flight) con
     auto tableData = flight.getData();
     QString flight_summary;
     auto space = QLatin1Char(' ');
-    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DOFT).toString() + space);
-    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEPT).toString() + space);
-    flight_summary.append(OPL::Time(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt()).toString()
+    flight_summary.append(tableData.value(OPL::FlightEntry::DOFT).toString() + space);
+    flight_summary.append(tableData.value(OPL::FlightEntry::DEPT).toString() + space);
+    flight_summary.append(OPL::Time(tableData.value(OPL::FlightEntry::TOFB).toInt()).toString()
                           + space);
-    flight_summary.append(OPL::Time(tableData.value(OPL::Db::FLIGHTS_TONB).toInt()).toString()
+    flight_summary.append(OPL::Time(tableData.value(OPL::FlightEntry::TONB).toInt()).toString()
                           + space);
-    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEST).toString());
+    flight_summary.append(tableData.value(OPL::FlightEntry::DEST).toString());
 
     return flight_summary;
 

+ 3 - 2
src/gui/widgets/pilotswidget.h

@@ -22,7 +22,8 @@
 #include <QItemSelection>
 #include <QSqlTableModel>
 #include <QTableView>
-#include "src/database/row.h"
+#include "src/database/flightentry.h"
+#include "src/database/pilotentry.h"
 #include "src/gui/widgets/settingswidget.h"
 
 namespace Ui {
@@ -93,7 +94,7 @@ private:
 
     QVector<qint32> selectedPilots;
 
-    const QString getPilotName(const OPL::PilotEntry &pilot);
+    const QString getPilotName(const OPL::PilotEntry &pilot) const;
 
     const QString getFlightSummary(const OPL::FlightEntry &flight) const;
 

+ 24 - 25
src/gui/widgets/settingswidget.cpp

@@ -22,7 +22,6 @@
 #include "src/classes/style.h"
 #include "src/classes/settings.h"
 #include "src/database/database.h"
-#include "src/database/row.h"
 #include "src/opl.h"
 #include "src/functions/datetime.h"
 #include "src/gui/widgets/backupwidget.h"
@@ -91,7 +90,7 @@ void SettingsWidget::setupDateEdits()
         const auto entry = DB->getCurrencyEntry(static_cast<int>(pair.first));
         if (entry.isValid()) { // set date
             const auto date = QDate::fromString(
-                        entry.getData().value(OPL::Db::CURRENCIES_EXPIRYDATE).toString(),
+                entry.getData().value(OPL::CurrencyEntry::EXPIRYDATE).toString(),
                         Qt::ISODate);
             if(date.isValid())
                 pair.second->setDate(date);
@@ -124,12 +123,12 @@ void SettingsWidget::readSettings()
 
     // Personal Data Tab
     auto user_data = DB->getPilotEntry(1).getData();
-    ui->lastnameLineEdit->setText(user_data.value(OPL::Db::PILOTS_LASTNAME).toString());
-    ui->firstnameLineEdit->setText(user_data.value(OPL::Db::PILOTS_FIRSTNAME).toString());
-    ui->companyLineEdit->setText(user_data.value(OPL::Db::PILOTS_COMPANY).toString());
-    ui->employeeidLineEdit->setText(user_data.value(OPL::Db::PILOTS_EMPLOYEEID).toString());
-    ui->phoneLineEdit->setText(user_data.value(OPL::Db::PILOTS_PHONE).toString());
-    ui->emailLineEdit->setText(user_data.value(OPL::Db::PILOTS_EMAIL).toString());
+    ui->lastnameLineEdit->setText(user_data.value(OPL::PilotEntry::LASTNAME).toString());
+    ui->firstnameLineEdit->setText(user_data.value(OPL::PilotEntry::FIRSTNAME).toString());
+    ui->companyLineEdit->setText(user_data.value(OPL::PilotEntry::COMPANY).toString());
+    ui->employeeidLineEdit->setText(user_data.value(OPL::PilotEntry::EMPLOYEEID).toString());
+    ui->phoneLineEdit->setText(user_data.value(OPL::PilotEntry::PHONE).toString());
+    ui->emailLineEdit->setText(user_data.value(OPL::PilotEntry::EMAIL).toString());
 
     // FLight Logging Tab
     ui->functionComboBox->setCurrentIndex(Settings::read(Settings::FlightLogging::Function).toInt());
@@ -187,10 +186,10 @@ void SettingsWidget::updatePersonalDetails()
     OPL::RowData_T user_data;
     switch (ui->aliasComboBox->currentIndex()) {
     case 0:
-        user_data.insert(OPL::Db::PILOTS_ALIAS, QStringLiteral("self"));
+        user_data.insert(OPL::PilotEntry::ALIAS, QStringLiteral("self"));
         break;
     case 1:
-        user_data.insert(OPL::Db::PILOTS_ALIAS, QStringLiteral("SELF"));
+        user_data.insert(OPL::PilotEntry::ALIAS, QStringLiteral("SELF"));
         break;
     case 2:{
         QString name;
@@ -198,18 +197,18 @@ void SettingsWidget::updatePersonalDetails()
         name.append(QLatin1String(", "));
         name.append(ui->firstnameLineEdit->text().at(0));
         name.append(QLatin1Char('.'));
-        user_data.insert(OPL::Db::PILOTS_ALIAS, name);
+        user_data.insert(OPL::PilotEntry::ALIAS, name);
     }
         break;
     default:
         break;
     }
-    user_data.insert(OPL::Db::PILOTS_LASTNAME, ui->lastnameLineEdit->text());
-    user_data.insert(OPL::Db::PILOTS_FIRSTNAME, ui->firstnameLineEdit->text());
-    user_data.insert(OPL::Db::PILOTS_COMPANY, ui->companyLineEdit->text());
-    user_data.insert(OPL::Db::PILOTS_EMPLOYEEID, ui->employeeidLineEdit->text());
-    user_data.insert(OPL::Db::PILOTS_PHONE, ui->phoneLineEdit->text());
-    user_data.insert(OPL::Db::PILOTS_EMAIL, ui->emailLineEdit->text());
+    user_data.insert(OPL::PilotEntry::LASTNAME, ui->lastnameLineEdit->text());
+    user_data.insert(OPL::PilotEntry::FIRSTNAME, ui->firstnameLineEdit->text());
+    user_data.insert(OPL::PilotEntry::COMPANY, ui->companyLineEdit->text());
+    user_data.insert(OPL::PilotEntry::EMPLOYEEID, ui->employeeidLineEdit->text());
+    user_data.insert(OPL::PilotEntry::PHONE, ui->phoneLineEdit->text());
+    user_data.insert(OPL::PilotEntry::EMAIL, ui->emailLineEdit->text());
 
     auto user = OPL::PilotEntry(1, user_data);
 
@@ -500,7 +499,7 @@ void SettingsWidget::on_resetStylePushButton_clicked()
 
 void SettingsWidget::on_currLicDateEdit_userDateChanged(const QDate &date)
 {
-    const OPL::RowData_T row_data = {{OPL::Db::CURRENCIES_EXPIRYDATE, date.toString(Qt::ISODate)}};
+    const OPL::RowData_T row_data = {{OPL::CurrencyEntry::EXPIRYDATE, date.toString(Qt::ISODate)}};
     const OPL::CurrencyEntry entry(static_cast<int>(OPL::CurrencyName::Licence), row_data);
     if (!DB->commit(entry))
         WARN(tr("Unable to update currency. The following error has ocurred:<br>%1").arg(DB->lastError.text()));
@@ -510,7 +509,7 @@ void SettingsWidget::on_currLicDateEdit_userDateChanged(const QDate &date)
 
 void SettingsWidget::on_currTrDateEdit_userDateChanged(const QDate &date)
 {
-    const OPL::RowData_T row_data = {{OPL::Db::CURRENCIES_EXPIRYDATE, date.toString(Qt::ISODate)}};
+    const OPL::RowData_T row_data = {{OPL::CurrencyEntry::EXPIRYDATE, date.toString(Qt::ISODate)}};
     const OPL::CurrencyEntry entry(static_cast<int>(OPL::CurrencyName::TypeRating), row_data);
     if (!DB->commit(entry))
         WARN(tr("Unable to update currency. The following error has ocurred:<br>%1").arg(DB->lastError.text()));
@@ -520,7 +519,7 @@ void SettingsWidget::on_currTrDateEdit_userDateChanged(const QDate &date)
 
 void SettingsWidget::on_currLckDateEdit_userDateChanged(const QDate &date)
 {
-    const OPL::RowData_T row_data = {{OPL::Db::CURRENCIES_EXPIRYDATE, date.toString(Qt::ISODate)}};
+    const OPL::RowData_T row_data = {{OPL::CurrencyEntry::EXPIRYDATE, date.toString(Qt::ISODate)}};
     const OPL::CurrencyEntry entry(static_cast<int>(OPL::CurrencyName::LineCheck), row_data);
     if (!DB->commit(entry))
         WARN(tr("Unable to update currency. The following error has ocurred:<br>%1").arg(DB->lastError.text()));
@@ -530,7 +529,7 @@ void SettingsWidget::on_currLckDateEdit_userDateChanged(const QDate &date)
 
 void SettingsWidget::on_currMedDateEdit_userDateChanged(const QDate &date)
 {
-    const OPL::RowData_T row_data = {{OPL::Db::CURRENCIES_EXPIRYDATE, date.toString(Qt::ISODate)}};
+    const OPL::RowData_T row_data = {{OPL::CurrencyEntry::EXPIRYDATE, date.toString(Qt::ISODate)}};
     const OPL::CurrencyEntry entry(static_cast<int>(OPL::CurrencyName::Medical), row_data);
     if (!DB->commit(entry))
         WARN(tr("Unable to update currency. The following error has ocurred:<br>%1").arg(DB->lastError.text()));
@@ -540,8 +539,8 @@ void SettingsWidget::on_currMedDateEdit_userDateChanged(const QDate &date)
 
 void SettingsWidget::on_currCustom1DateEdit_userDateChanged(const QDate &date)
 {
-    const OPL::RowData_T row_data = {{OPL::Db::CURRENCIES_EXPIRYDATE, date.toString(Qt::ISODate)},
-                                {OPL::Db::CURRENCIES_CURRENCYNAME, ui->currCustom1LineEdit->text()}};
+    const OPL::RowData_T row_data = {{OPL::CurrencyEntry::EXPIRYDATE, date.toString(Qt::ISODate)},
+                                {OPL::CurrencyEntry::CURRENCYNAME, ui->currCustom1LineEdit->text()}};
     const OPL::CurrencyEntry entry(static_cast<int>(OPL::CurrencyName::Custom1), row_data);
     DEB << entry;
     if (!DB->commit(entry))
@@ -552,8 +551,8 @@ void SettingsWidget::on_currCustom1DateEdit_userDateChanged(const QDate &date)
 
 void SettingsWidget::on_currCustom2DateEdit_userDateChanged(const QDate &date)
 {
-    const OPL::RowData_T row_data = {{OPL::Db::CURRENCIES_EXPIRYDATE, date.toString(Qt::ISODate)},
-                                {OPL::Db::CURRENCIES_CURRENCYNAME, ui->currCustom2LineEdit->text()}};
+    const OPL::RowData_T row_data = {{OPL::CurrencyEntry::EXPIRYDATE, date.toString(Qt::ISODate)},
+                                {OPL::CurrencyEntry::CURRENCYNAME, ui->currCustom2LineEdit->text()}};
     const OPL::CurrencyEntry entry(static_cast<int>(OPL::CurrencyName::Custom2), row_data);
     if (!DB->commit(entry))
         WARN(tr("Unable to update currency. The following error has ocurred:<br><br>%1").arg(DB->lastError.text()));

+ 13 - 13
src/gui/widgets/tailswidget.cpp

@@ -16,11 +16,11 @@
  *along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 #include "tailswidget.h"
+#include "src/classes/time.h"
 #include "ui_aircraftwidget.h"
 #include "src/opl.h"
 #include "src/classes/settings.h"
 #include "src/database/database.h"
-#include "src/database/row.h"
 #include "src/gui/dialogues/newtaildialog.h"
 
 
@@ -182,7 +182,7 @@ void TailsWidget::on_deleteAircraftButton_clicked()
         message_box.setWindowTitle(tr("Delete Aircraft"));
         message_box.setText(tr("You are deleting the following aircraft:<br><br><b><tt>"
                                "%1 - (%2)</b></tt><br><br>Are you sure?"
-                               ).arg(entry.getData().value(OPL::Db::TAILS_REGISTRATION).toString(),
+                               ).arg(entry.getData().value(OPL::TailEntry::REGISTRATION).toString(),
                                      getAircraftTypeString(entry)));
 
         if (message_box.exec() == QMessageBox::Yes) {
@@ -264,12 +264,12 @@ void TailsWidget::repopulateModel()
 const QString TailsWidget::getAircraftTypeString(const OPL::Row &row) const
 {
     QString type_string;
-    if (!row.getData().value(OPL::Db::TAILS_MAKE).toString().isEmpty())
-        type_string.append(row.getData().value(OPL::Db::TAILS_MAKE).toString() + QLatin1Char(' '));
-    if (!row.getData().value(OPL::Db::TAILS_MODEL).toString().isEmpty())
-        type_string.append(row.getData().value(OPL::Db::TAILS_MODEL).toString());
-    if (!row.getData().value(OPL::Db::TAILS_VARIANT).toString().isEmpty())
-        type_string.append(QLatin1Char('-') + row.getData().value(OPL::Db::TAILS_VARIANT).toString());
+    if (!row.getData().value(OPL::TailEntry::MAKE).toString().isEmpty())
+        type_string.append(row.getData().value(OPL::TailEntry::MAKE).toString() + QLatin1Char(' '));
+    if (!row.getData().value(OPL::TailEntry::MODEL).toString().isEmpty())
+        type_string.append(row.getData().value(OPL::TailEntry::MODEL).toString());
+    if (!row.getData().value(OPL::TailEntry::VARIANT).toString().isEmpty())
+        type_string.append(QLatin1Char('-') + row.getData().value(OPL::TailEntry::VARIANT).toString());
 
     return type_string;
 }
@@ -282,13 +282,13 @@ const QString TailsWidget::getFlightSummary(const OPL::FlightEntry &flight) cons
     auto tableData = flight.getData();
     QString flight_summary;
     auto space = QLatin1Char(' ');
-    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DOFT).toString() + space);
-    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEPT).toString() + space);
-    flight_summary.append(OPL::Time(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt()).toString()
+    flight_summary.append(tableData.value(OPL::FlightEntry::DOFT).toString() + space);
+    flight_summary.append(tableData.value(OPL::FlightEntry::DEPT).toString() + space);
+    flight_summary.append(OPL::Time(tableData.value(OPL::FlightEntry::TOFB).toInt()).toString()
                           + space);
-    flight_summary.append(OPL::Time(tableData.value(OPL::Db::FLIGHTS_TONB).toInt()).toString()
+    flight_summary.append(OPL::Time(tableData.value(OPL::FlightEntry::TONB).toInt()).toString()
                           + space);
-    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEST).toString());
+    flight_summary.append(tableData.value(OPL::FlightEntry::DEST).toString());
 
     return flight_summary;
 }

+ 1 - 1
src/gui/widgets/tailswidget.h

@@ -22,7 +22,7 @@
 #include <QItemSelection>
 #include <QSqlTableModel>
 #include <QTableView>
-#include "src/database/row.h"
+#include "src/database/flightentry.h"
 #include "src/gui/widgets/settingswidget.h"
 
 namespace Ui {

+ 1 - 1
src/gui/widgets/totalswidget.cpp

@@ -18,9 +18,9 @@
 #include "totalswidget.h"
 #include "QtWidgets/qlineedit.h"
 #include "src/database/database.h"
+#include "src/database/previousexperienceentry.h"
 #include "src/opl.h"
 #include "src/classes/time.h"
-#include "src/database/row.h"
 #include "ui_totalswidget.h"
 
 TotalsWidget::TotalsWidget(WidgetType widgetType, QWidget *parent) :

+ 0 - 131
src/opl.h

@@ -310,137 +310,6 @@ private:
 //Make available as a global static
 Q_GLOBAL_STATIC(OplGlobals, GLOBALS)
 
-/*!
- *  The OPL::Db namespace provides string literals to programatically access the database
- *
- *  Example usage, do:
- *  newData.insert(OPL::Db::FLIGHTS_DEP, ui->deptLocLineEdit->text());
- *  newData.value(OPL::Db::AIRCRAFT_MULTIPILOT);
- *
- *  instead of:
- *  newData.insert("dept", ui->deptLocLineEdit->text());
- *  newData.value("multipilot");
- *
- *  Declaring these literals here avoids memory allocation at runtime for construction of temporary
- *  qstrings like ("dept").
- */
-namespace Db {
-
-
-// Table names
-const inline auto TABLE_FLIGHTS         = QStringLiteral("flights");
-const inline auto TABLE_PILOTS          = QStringLiteral("pilots");
-const inline auto TABLE_TAILS           = QStringLiteral("tails");
-const inline auto TABLE_AIRCRAFT        = QStringLiteral("aircraft");
-const inline auto TABLE_AIRPORTS        = QStringLiteral("airports");
-const inline auto TABLE_CURRENCIES  	= QStringLiteral("currencies");
-const inline auto TABLE_SIMULATORS      = QStringLiteral("simulators");
-const inline auto TABLE_PREVIOUS_EXP	= QStringLiteral("previousExperience");
-
-// Flights table columns
-const inline auto FLIGHTS_ROWID          = QStringLiteral("flight_id");
-const inline auto FLIGHTS_DOFT           = QStringLiteral("doft");
-const inline auto FLIGHTS_DEPT           = QStringLiteral("dept");
-const inline auto FLIGHTS_DEST           = QStringLiteral("dest");
-const inline auto FLIGHTS_TOFB           = QStringLiteral("tofb");
-const inline auto FLIGHTS_TONB           = QStringLiteral("tonb");
-const inline auto FLIGHTS_PIC            = QStringLiteral("pic");
-const inline auto FLIGHTS_ACFT           = QStringLiteral("acft");
-const inline auto FLIGHTS_TBLK           = QStringLiteral("tblk");
-const inline auto FLIGHTS_TSPSE          = QStringLiteral("tSPSE");
-const inline auto FLIGHTS_TSPME          = QStringLiteral("tSPME");
-const inline auto FLIGHTS_TMP            = QStringLiteral("tMP");
-const inline auto FLIGHTS_TNIGHT         = QStringLiteral("tNIGHT");
-const inline auto FLIGHTS_TIFR           = QStringLiteral("tIFR");
-const inline auto FLIGHTS_TPIC           = QStringLiteral("tPIC");
-const inline auto FLIGHTS_TPICUS         = QStringLiteral("tPICUS");
-const inline auto FLIGHTS_TSIC           = QStringLiteral("tSIC");
-const inline auto FLIGHTS_TDUAL          = QStringLiteral("tDUAL");
-const inline auto FLIGHTS_TFI            = QStringLiteral("tFI");
-const inline auto FLIGHTS_TSIM           = QStringLiteral("tSIM");
-const inline auto FLIGHTS_PILOTFLYING    = QStringLiteral("pilotFlying");
-const inline auto FLIGHTS_TODAY          = QStringLiteral("toDay");
-const inline auto FLIGHTS_TONIGHT        = QStringLiteral("toNight");
-const inline auto FLIGHTS_LDGDAY         = QStringLiteral("ldgDay");
-const inline auto FLIGHTS_LDGNIGHT       = QStringLiteral("ldgNight");
-const inline auto FLIGHTS_AUTOLAND       = QStringLiteral("autoland");
-const inline auto FLIGHTS_SECONDPILOT    = QStringLiteral("secondPilot");
-const inline auto FLIGHTS_THIRDPILOT     = QStringLiteral("thirdPilot");
-const inline auto FLIGHTS_APPROACHTYPE   = QStringLiteral("approachType");
-const inline auto FLIGHTS_FLIGHTNUMBER   = QStringLiteral("flightNumber");
-const inline auto FLIGHTS_REMARKS        = QStringLiteral("remarks");
-
-// tails table
-
-const inline auto TAILS_ROWID            = QStringLiteral("tail_id");
-const inline auto TAILS_REGISTRATION     = QStringLiteral("registration");
-const inline auto TAILS_COMPANY          = QStringLiteral("company");
-const inline auto TAILS_MAKE             = QStringLiteral("make");
-const inline auto TAILS_MODEL            = QStringLiteral("model");
-const inline auto TAILS_VARIANT          = QStringLiteral("variant");
-const inline auto TAILS_MULTIPILOT       = QStringLiteral("multipilot");
-const inline auto TAILS_MULTIENGINE      = QStringLiteral("multiengine");
-const inline auto TAILS_ENGINETYPE       = QStringLiteral("engineType");
-const inline auto TAILS_WEIGHTCLASS      = QStringLiteral("weightClass");
-
-// pilots table
-
-const inline auto  PILOTS_ROWID           = QStringLiteral("pilot_id");
-const inline auto  PILOTS_LASTNAME        = QStringLiteral("lastname");
-const inline auto  PILOTS_FIRSTNAME       = QStringLiteral("firstname");
-const inline auto  PILOTS_ALIAS           = QStringLiteral("alias");
-const inline auto  PILOTS_COMPANY         = QStringLiteral("company");
-const inline auto  PILOTS_EMPLOYEEID      = QStringLiteral("employeeid");
-const inline auto  PILOTS_PHONE           = QStringLiteral("phone");
-const inline auto  PILOTS_EMAIL           = QStringLiteral("email");
-
-// Currencies table
-const inline auto  CURRENCIES_EXPIRYDATE  = QStringLiteral("expiryDate");
-const inline auto  CURRENCIES_CURRENCYNAME = QStringLiteral("currencyName");
-
-// Simulators table
-const inline auto  SIMULATORS_ROWID       = QStringLiteral("session_id");
-const inline auto  SIMULATORS_DATE        = QStringLiteral("date");
-const inline auto  SIMULATORS_TIME        = QStringLiteral("totalTime");
-const inline auto  SIMULATORS_TYPE        = QStringLiteral("deviceType");
-const inline auto  SIMULATORS_ACFT        = QStringLiteral("aircraftType");
-const inline auto  SIMULATORS_REG         = QStringLiteral("registration");
-const inline auto  SIMULATORS_REMARKS     = QStringLiteral("remarks");
-
-// Airports table
-const inline auto AIRPORTS_ICAO           = QStringLiteral("icao");
-const inline auto AIRPORTS_IATA           = QStringLiteral("iata");
-const inline auto AIRPORTS_NAME           = QStringLiteral("name");
-const inline auto AIRPORTS_LAT            = QStringLiteral("lat");
-const inline auto AIRPORTS_LON            = QStringLiteral("long");
-const inline auto AIRPORTS_COUNTRY        = QStringLiteral("country");
-const inline auto AIRPORTS_ALTITIDUE      = QStringLiteral("alt");
-const inline auto AIRPORTS_UTC_OFFSET     = QStringLiteral("utcoffset");
-const inline auto AIRPORTS_TZ_OLSON       = QStringLiteral("tzolson");
-
-// Previous Experience table
-const inline auto PREVXP_TBLK           = &FLIGHTS_TBLK;
-const inline auto PREVXP_TSPSE          = &FLIGHTS_TSPSE;
-const inline auto PREVXP_TSPME          = &FLIGHTS_TSPME;
-const inline auto PREVXP_TMP            = &FLIGHTS_TMP;
-const inline auto PREVXP_TNIGHT         = &FLIGHTS_TNIGHT;
-const inline auto PREVXP_TIFR           = &FLIGHTS_TIFR;
-const inline auto PREVXP_TPIC           = &FLIGHTS_TPIC;
-const inline auto PREVXP_TPICUS         = &FLIGHTS_TPICUS;
-const inline auto PREVXP_TSIC           = &FLIGHTS_TSIC;
-const inline auto PREVXP_TDUAL          = &FLIGHTS_TDUAL;
-const inline auto PREVXP_TFI            = &FLIGHTS_TFI;
-const inline auto PREVXP_TSIM           = &FLIGHTS_TSIM;
-const inline auto PREVXP_TODAY          = &FLIGHTS_TODAY;
-const inline auto PREVXP_TONIGHT        = &FLIGHTS_TONIGHT;
-const inline auto PREVXP_LDGDAY         = &FLIGHTS_LDGDAY;
-const inline auto PREVXP_LDGNIGHT       = &FLIGHTS_LDGNIGHT;
-
-// all tables
-const inline auto  ROWID                  = QStringLiteral("rowid");
-const inline auto  NULL_TIME_hhmm         = QStringLiteral("00:00");
-
-} // namespace OPL::db
 
 namespace Assets {
 

+ 0 - 1
src/testing/atimer.h

@@ -21,7 +21,6 @@
 #include <QObject>
 #include <chrono>
 #include <QDebug>
-#include "src/functions/log.h"
 
 /*!
  * \brief The ATimer class provides an easy to use performance timer.

+ 2 - 3
src/testing/importCrewlounge/importcrewlounge.cpp

@@ -1,7 +1,6 @@
 #include "importcrewlounge.h"
 #include "src/database/database.h"
 #include "src/opl.h"
-#include "src/database/row.h"
 #include "src/testing/importCrewlounge/processpilots.h"
 #include "src/testing/importCrewlounge/processaircraft.h"
 #include "src/testing/importCrewlounge/processflights.h"
@@ -30,7 +29,7 @@ void exec(const QString &csv_file_path)
     const auto p_maps = proc_pilots.getProcessedPilotMaps();
 
     for (const auto & pilot_data : p_maps) {
-        OPL::PilotEntry pe(pilot_data.value(OPL::Db::PILOTS_ROWID).toInt(), pilot_data);
+        OPL::PilotEntry pe(pilot_data.value(OPL::PilotEntry::ROWID).toInt(), pilot_data);
         DB->commit(pe);
     }
 
@@ -40,7 +39,7 @@ void exec(const QString &csv_file_path)
     const auto t_maps = proc_tails.getProcessedTailMaps();
 
     for (const auto& tail_data : t_maps) {
-        OPL::TailEntry te(tail_data.value(OPL::Db::PILOTS_ROWID).toInt(), tail_data);
+        OPL::TailEntry te(tail_data.value(OPL::PilotEntry::ROWID).toInt(), tail_data);
         DB->commit(te);
     }
 

+ 14 - 13
src/testing/importCrewlounge/processaircraft.cpp

@@ -1,4 +1,5 @@
 #include "processaircraft.h"
+#include "src/database/tailentry.h"
 
 void ProcessAircraft::parseRawData()
 {
@@ -23,31 +24,31 @@ void ProcessAircraft::processParsedData()
 
     QHash<QString, QVariant> new_tail_data;
     for (const auto &list : qAsConst(unique_tails)) {
-        new_tail_data.insert(OPL::Db::TAILS_REGISTRATION, list[0]);
-        new_tail_data.insert(OPL::Db::TAILS_COMPANY, list[1]);
-        new_tail_data.insert(OPL::Db::TAILS_MAKE, list[2]);
-        new_tail_data.insert(OPL::Db::TAILS_MODEL, list[3]);
-        new_tail_data.insert(OPL::Db::TAILS_VARIANT, list[4]);
+        new_tail_data.insert(OPL::TailEntry::REGISTRATION, list[0]);
+        new_tail_data.insert(OPL::TailEntry::COMPANY, list[1]);
+        new_tail_data.insert(OPL::TailEntry::MAKE, list[2]);
+        new_tail_data.insert(OPL::TailEntry::MODEL, list[3]);
+        new_tail_data.insert(OPL::TailEntry::VARIANT, list[4]);
 
         if (list[5] == "TRUE")
-            new_tail_data.insert(OPL::Db::TAILS_MULTIPILOT, 1);
+            new_tail_data.insert(OPL::TailEntry::MULTI_PILOT, 1);
         else
-            new_tail_data.insert(OPL::Db::TAILS_MULTIPILOT, 0);
+            new_tail_data.insert(OPL::TailEntry::MULTI_PILOT, 0);
 
         if (list[6] == "TRUE")
-            new_tail_data.insert(OPL::Db::TAILS_MULTIENGINE, 1);
+            new_tail_data.insert(OPL::TailEntry::MULTI_ENGINE, 1);
         else
-            new_tail_data.insert(OPL::Db::TAILS_MULTIENGINE, 0);
+            new_tail_data.insert(OPL::TailEntry::MULTI_ENGINE, 0);
 
         if (list[7] == "Piston") // other values need to be added as needed, do later
-            new_tail_data.insert(OPL::Db::TAILS_ENGINETYPE, 1);
+            new_tail_data.insert(OPL::TailEntry::ENGINE_TYPE, 1);
         else if (list[7] == "Turbine (jet-fan)")
-            new_tail_data.insert(OPL::Db::TAILS_ENGINETYPE, 3);
+            new_tail_data.insert(OPL::TailEntry::ENGINE_TYPE, 3);
 
         if (list[8] == "TRUE") // this is a above 7.5t switch in MCC, so default to medium for now
-            new_tail_data.insert(OPL::Db::TAILS_WEIGHTCLASS, 1);
+            new_tail_data.insert(OPL::TailEntry::WEIGHT_CLASS, 1);
         else
-            new_tail_data.insert(OPL::Db::TAILS_WEIGHTCLASS, 0);
+            new_tail_data.insert(OPL::TailEntry::WEIGHT_CLASS, 0);
 
         new_tail_data.insert(QStringLiteral("tail_id"), unique_tail_id);
 

+ 0 - 1
src/testing/importCrewlounge/processaircraft.h

@@ -1,7 +1,6 @@
 #ifndef PROCESSAIRCRAFT_H
 #define PROCESSAIRCRAFT_H
 #include <QtCore>
-#include "src/opl.h"
 
 class ProcessAircraft
 {

+ 26 - 25
src/testing/importCrewlounge/processflights.cpp

@@ -1,5 +1,6 @@
 #include "processflights.h"
 #include "src/classes/time.h"
+#include "src/database/flightentry.h"
 
 void ProcessFlights::parseRawData()
 {
@@ -23,57 +24,57 @@ void ProcessFlights::processParsedData()
 
     for (const auto &row : qAsConst(rawFlightData)) {
         // insert values that don't require editing
-        new_flight_data.insert(OPL::Db::FLIGHTS_FLIGHTNUMBER, row[1]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_DEPT, row[2]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_DEST, row[3]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_TBLK, row[6]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_TPIC, row[7]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_TSIC, row[8]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_TDUAL, row[9]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_TPICUS, row[10]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_TFI, row[11]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_TNIGHT, row[12]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_TODAY, row[16]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_TONIGHT, row[17]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_LDGDAY, row[18]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_LDGNIGHT, row[19]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_APPROACHTYPE, row[21]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_REMARKS, row[22]);
+        new_flight_data.insert(OPL::FlightEntry::FLIGHTNUMBER, row[1]);
+        new_flight_data.insert(OPL::FlightEntry::DEPT, row[2]);
+        new_flight_data.insert(OPL::FlightEntry::DEST, row[3]);
+        new_flight_data.insert(OPL::FlightEntry::TBLK, row[6]);
+        new_flight_data.insert(OPL::FlightEntry::TPIC, row[7]);
+        new_flight_data.insert(OPL::FlightEntry::TSIC, row[8]);
+        new_flight_data.insert(OPL::FlightEntry::TDUAL, row[9]);
+        new_flight_data.insert(OPL::FlightEntry::TPICUS, row[10]);
+        new_flight_data.insert(OPL::FlightEntry::TFI, row[11]);
+        new_flight_data.insert(OPL::FlightEntry::TNIGHT, row[12]);
+        new_flight_data.insert(OPL::FlightEntry::TODAY, row[16]);
+        new_flight_data.insert(OPL::FlightEntry::TONIGHT, row[17]);
+        new_flight_data.insert(OPL::FlightEntry::LDGDAY, row[18]);
+        new_flight_data.insert(OPL::FlightEntry::LDGNIGHT, row[19]);
+        new_flight_data.insert(OPL::FlightEntry::APPROACHTYPE, row[21]);
+        new_flight_data.insert(OPL::FlightEntry::REMARKS, row[22]);
 
         // PF
         if (row[20] == QLatin1String("TRUE"))
-            new_flight_data.insert(OPL::Db::FLIGHTS_PILOTFLYING, 1);
+            new_flight_data.insert(OPL::FlightEntry::PILOTFLYING, 1);
         else
-            new_flight_data.insert(OPL::Db::FLIGHTS_PILOTFLYING, 0);
+            new_flight_data.insert(OPL::FlightEntry::PILOTFLYING, 0);
 
         // Convert Date and Time
         const QDate doft = QDate::fromString(row[0],QStringLiteral("dd/MM/yyyy"));
-        new_flight_data.insert(OPL::Db::FLIGHTS_DOFT, doft.toString(Qt::ISODate));
+        new_flight_data.insert(OPL::FlightEntry::DOFT, doft.toString(Qt::ISODate));
 
         auto time_off = QTime::fromString(row[4], QStringLiteral("hh:mm"));
         if (!time_off.isValid())
             time_off = QTime::fromString(row[4], QStringLiteral("h:mm"));
         int tofb = OPL::Time::fromString(time_off.toString()).toMinutes();
-        new_flight_data.insert(OPL::Db::FLIGHTS_TOFB, tofb);
+        new_flight_data.insert(OPL::FlightEntry::TOFB, tofb);
 
         auto time_on = QTime::fromString(row[5], QStringLiteral("hh:mm"));
         if (!time_on.isValid())
             time_on = QTime::fromString(row[5], QStringLiteral("h:mm"));
 
         int tonb = OPL::Time::fromString(time_on.toString()).toMinutes();
-        new_flight_data.insert(OPL::Db::FLIGHTS_TONB, tonb);
+        new_flight_data.insert(OPL::FlightEntry::TONB, tonb);
 
         // map pilots
         int pic = processedPilotsIds.value(row[13]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_PIC, pic);
+        new_flight_data.insert(OPL::FlightEntry::PIC, pic);
         int second_pilot = processedPilotsIds.value(row[14]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_SECONDPILOT, second_pilot);
+        new_flight_data.insert(OPL::FlightEntry::SECONDPILOT, second_pilot);
         int third_pilot = processedPilotsIds.value(row[15]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_THIRDPILOT, third_pilot);
+        new_flight_data.insert(OPL::FlightEntry::THIRDPILOT, third_pilot);
 
         // map tail
         int acft = processedTailsIds.value(row[23]);
-        new_flight_data.insert(OPL::Db::FLIGHTS_ACFT, acft);
+        new_flight_data.insert(OPL::FlightEntry::ACFT, acft);
 
         // set id, fix opl to include alias
         new_flight_data.insert(QStringLiteral("flight_id"), flight_id);

+ 7 - 6
src/testing/importCrewlounge/processpilots.cpp

@@ -1,4 +1,5 @@
 #include "processpilots.h"
+#include "src/database/pilotentry.h"
 
 void ProcessPilots::parseRawData()
 {
@@ -51,19 +52,19 @@ void ProcessPilots::processParsedData()
         // process name [1]
         auto temp_list = pair.first[1].split(QLatin1Char(' '));
         if (!temp_list.isEmpty()) {
-            new_pilot_data.insert(OPL::Db::PILOTS_LASTNAME, temp_list.first());
+            new_pilot_data.insert(OPL::PilotEntry::LASTNAME, temp_list.first());
             temp_list.pop_front();
 
             if (!temp_list.isEmpty())
-                new_pilot_data.insert(OPL::Db::PILOTS_FIRSTNAME, temp_list.join(QLatin1Char(' ')));
+                new_pilot_data.insert(OPL::PilotEntry::FIRSTNAME, temp_list.join(QLatin1Char(' ')));
         } else {
-            new_pilot_data.insert(OPL::Db::PILOTS_LASTNAME, QStringLiteral("UNKNOWN"));
+            new_pilot_data.insert(OPL::PilotEntry::LASTNAME, QStringLiteral("UNKNOWN"));
         }
 
         // add additional data
-        new_pilot_data.insert(OPL::Db::PILOTS_EMPLOYEEID, pair.first[0]);
-        new_pilot_data.insert(OPL::Db::PILOTS_PHONE, pair.first[2]);
-        new_pilot_data.insert(OPL::Db::PILOTS_EMAIL, pair.first[3]);
+        new_pilot_data.insert(OPL::PilotEntry::EMPLOYEEID, pair.first[0]);
+        new_pilot_data.insert(OPL::PilotEntry::PHONE, pair.first[2]);
+        new_pilot_data.insert(OPL::PilotEntry::EMAIL, pair.first[3]);
 
         // add pilot_id (workaround with literal until OPL::Db is updated)
         new_pilot_data.insert(QStringLiteral("pilot_id"), pair.second);

+ 18 - 19
src/testing/randomgenerator.cpp

@@ -2,7 +2,6 @@
 #include "src/database/database.h"
 #include "src/functions/calc.h"
 #include "src/opl.h"
-#include "src/functions/time.h"
 
 namespace OPL {
 
@@ -33,39 +32,39 @@ const FlightEntry RandomGenerator::randomFlight()
     int tNight = OPL::Calc::calculateNightTime(dept, dest, dept_dt, tblk, 6);
 
     auto flt_data = OPL::RowData_T();
-    flt_data.insert(OPL::Db::FLIGHTS_DOFT, doft);
-    flt_data.insert(OPL::Db::FLIGHTS_DEPT, dept);
-    flt_data.insert(OPL::Db::FLIGHTS_DEST, dest);
-    flt_data.insert(OPL::Db::FLIGHTS_PIC, pic);
-    flt_data.insert(OPL::Db::FLIGHTS_ACFT, acft);
-    flt_data.insert(OPL::Db::FLIGHTS_TOFB, tofb.toMinutes());
-    flt_data.insert(OPL::Db::FLIGHTS_TONB, tonb.toMinutes());
-    flt_data.insert(OPL::Db::FLIGHTS_TBLK, tblk);
+    flt_data.insert(OPL::FlightEntry::DOFT, doft);
+    flt_data.insert(OPL::FlightEntry::DEPT, dept);
+    flt_data.insert(OPL::FlightEntry::DEST, dest);
+    flt_data.insert(OPL::FlightEntry::PIC, pic);
+    flt_data.insert(OPL::FlightEntry::ACFT, acft);
+    flt_data.insert(OPL::FlightEntry::TOFB, tofb.toMinutes());
+    flt_data.insert(OPL::FlightEntry::TONB, tonb.toMinutes());
+    flt_data.insert(OPL::FlightEntry::TBLK, tblk);
 
-    if (tNight > 0) flt_data.insert(OPL::Db::FLIGHTS_TNIGHT, tNight);
+    if (tNight > 0) flt_data.insert(OPL::FlightEntry::TNIGHT, tNight);
 
     bool pf = randomBool(); // Pilot Flying
 
     // Take-Off and Landing
     if (pf) {
-        flt_data.insert(OPL::Db::FLIGHTS_PILOTFLYING, 1);
+        flt_data.insert(OPL::FlightEntry::PILOTFLYING, 1);
         if (OPL::Calc::isNight(dept, dept_dt, 6))
-            flt_data.insert(OPL::Db::FLIGHTS_TONIGHT, 1);
+            flt_data.insert(OPL::FlightEntry::TONIGHT, 1);
         else
-            flt_data.insert(OPL::Db::FLIGHTS_TODAY, 1);
+            flt_data.insert(OPL::FlightEntry::TODAY, 1);
         if (OPL::Calc::isNight(dest, dest_dt, 6))
-            flt_data.insert(OPL::Db::FLIGHTS_LDGNIGHT, 1);
+            flt_data.insert(OPL::FlightEntry::LDGNIGHT, 1);
         else
-            flt_data.insert(OPL::Db::FLIGHTS_LDGDAY, 1);
+            flt_data.insert(OPL::FlightEntry::LDGDAY, 1);
     }
 
     int function;
     if (pic == 1) {
-        flt_data.insert(OPL::Db::FLIGHTS_TPIC, tblk);
-        flt_data.insert(OPL::Db::FLIGHTS_SECONDPILOT, randomPilot());
+        flt_data.insert(OPL::FlightEntry::TPIC, tblk);
+        flt_data.insert(OPL::FlightEntry::SECONDPILOT, randomPilot());
     } else {
         function = QRandomGenerator::global()->bounded(1,4);
-        flt_data.insert(OPL::Db::FLIGHTS_SECONDPILOT, 1);
+        flt_data.insert(OPL::FlightEntry::SECONDPILOT, 1);
         flt_data.insert(m_function_times[function], tblk);
     }
 
@@ -100,7 +99,7 @@ const QDateTime RandomGenerator::randomDateTime()
 
 const QString RandomGenerator::randomAirport()
 {
-    return DB->getAirportEntry(QRandomGenerator::global()->bounded(1, m_numberOfAirports)).icao();
+    return DB->getAirportEntry(QRandomGenerator::global()->bounded(1, m_numberOfAirports)).getIcaoCode();
 }
 
 const int RandomGenerator::randomPilot()

+ 6 - 6
src/testing/randomgenerator.h

@@ -1,7 +1,7 @@
 #ifndef RANDOMGENERATOR_H
 #define RANDOMGENERATOR_H
 
-#include "src/database/row.h"
+#include "src/database/flightentry.h"
 namespace OPL {
 
 /*!
@@ -30,11 +30,11 @@ public:
 private:
     bool safeMode = false;
     const static inline QStringList m_function_times = {
-        OPL::Db::FLIGHTS_TPIC,
-        OPL::Db::FLIGHTS_TPICUS,
-        OPL::Db::FLIGHTS_TSIC,
-        OPL::Db::FLIGHTS_TDUAL,
-        OPL::Db::FLIGHTS_TFI,
+        OPL::FlightEntry::TPIC,
+        OPL::FlightEntry::TPICUS,
+        OPL::FlightEntry::TSIC,
+        OPL::FlightEntry::TDUAL,
+        OPL::FlightEntry::TFI,
     };
 
     int m_numberOfPilots;