فهرست منبع

Replaced Entry Class

Replaced the entry-based subclasses with row-based subclasses
Felix Turo 2 سال پیش
والد
کامیت
4b459a7c4f
40فایلهای تغییر یافته به همراه428 افزوده شده و 278 حذف شده
  1. 0 16
      CMakeLists.txt
  2. 0 0
      deprecated/aentry.cpp
  3. 0 0
      deprecated/aentry.h
  4. 0 27
      deprecated/aflightentry.cpp
  5. 1 17
      deprecated/aflightentry.h
  6. 0 0
      deprecated/apilotentry.cpp
  7. 0 0
      deprecated/apilotentry.h
  8. 0 0
      deprecated/asimulatorentry.cpp
  9. 0 0
      deprecated/asimulatorentry.h
  10. 0 0
      deprecated/atailentry.cpp
  11. 0 0
      deprecated/atailentry.h
  12. 0 1
      mainwindow.cpp
  13. 74 4
      src/classes/acurrencyentry.cpp
  14. 33 1
      src/classes/acurrencyentry.h
  15. 0 17
      src/classes/aircraftentry.cpp
  16. 0 19
      src/classes/aircraftentry.h
  17. 62 0
      src/classes/row.cpp
  18. 49 0
      src/classes/row.h
  19. 0 37
      src/classes/tailentry.cpp
  20. 0 23
      src/classes/tailentry.h
  21. 22 22
      src/database/adatabase.cpp
  22. 16 14
      src/database/adatabase.h
  23. 4 4
      src/functions/acalc.cpp
  24. 2 3
      src/gui/dialogues/firstrundialog.cpp
  25. 23 21
      src/gui/dialogues/newflightdialog.cpp
  26. 2 4
      src/gui/dialogues/newflightdialog.h
  27. 6 6
      src/gui/dialogues/newpilotdialog.cpp
  28. 2 2
      src/gui/dialogues/newpilotdialog.h
  29. 3 3
      src/gui/dialogues/newsimdialog.cpp
  30. 2 2
      src/gui/dialogues/newsimdialog.h
  31. 1 5
      src/gui/dialogues/newtaildialog.h
  32. 37 6
      src/gui/widgets/aircraftwidget.cpp
  33. 4 0
      src/gui/widgets/aircraftwidget.h
  34. 1 2
      src/gui/widgets/debugwidget.h
  35. 23 4
      src/gui/widgets/logbookwidget.cpp
  36. 2 0
      src/gui/widgets/logbookwidget.h
  37. 34 4
      src/gui/widgets/pilotswidget.cpp
  38. 5 0
      src/gui/widgets/pilotswidget.h
  39. 13 6
      src/gui/widgets/settingswidget.cpp
  40. 7 8
      src/testing/importCrewlounge/importcrewlounge.cpp

+ 0 - 16
CMakeLists.txt

@@ -80,10 +80,6 @@ set(PROJECT_SOURCES
     # Classes
     src/classes/row.h
     src/classes/row.cpp
-    src/classes/tailentry.h
-    src/classes/tailentry.cpp
-    src/classes/aircraftentry.h
-    src/classes/aircraftentry.cpp
     src/classes/acompletiondata.h
     src/classes/acompletiondata.cpp
     src/classes/acurrencyentry.h
@@ -92,30 +88,18 @@ set(PROJECT_SOURCES
     src/classes/astyle.cpp
     src/classes/astandardpaths.h
     src/classes/astandardpaths.cpp
-    src/classes/aaircraftentry.h
-    src/classes/aaircraftentry.cpp
     src/classes/adownload.h
     src/classes/adownload.cpp
-    src/classes/aentry.h
-    src/classes/aentry.cpp
-    src/classes/aflightentry.h
-    src/classes/aflightentry.cpp
-    src/classes/apilotentry.h
-    src/classes/apilotentry.cpp
     src/classes/arunguard.h
     src/classes/arunguard.cpp
     src/classes/asettings.h
     src/classes/asettings.cpp
-    src/classes/atailentry.h
-    src/classes/atailentry.cpp
     src/classes/atranslator.h
     src/classes/atranslator.cpp
     src/classes/ajson.h
     src/classes/ajson.cpp
     src/classes/ahash.h
     src/classes/ahash.cpp
-    src/classes/asimulatorentry.h
-    src/classes/asimulatorentry.cpp
 
     # Namespaces
     src/functions/acalc.h

+ 0 - 0
src/classes/aentry.cpp → deprecated/aentry.cpp


+ 0 - 0
src/classes/aentry.h → deprecated/aentry.h


+ 0 - 27
src/classes/aflightentry.cpp → deprecated/aflightentry.cpp

@@ -50,30 +50,3 @@ const QString AFlightEntry::summary()
 
     return flight_summary;
 }
-
-//const QString AFlightEntry::getRegistration()
-//{
-//    ATailEntry acft = aDB->resolveForeignTail(tableData.value(OPL::Db::FLIGHTS_ACFT).toInt());
-//    return acft.registration();
-//}
-
-const QString AFlightEntry::getPilotName(pilotPosition pilot_)
-{
-    switch (pilot_) {
-    case pilotPosition::pic: {
-        auto foreign_pilot = aDB->resolveForeignPilot(tableData.value(OPL::Db::FLIGHTS_PIC).toInt());
-        return foreign_pilot.name();
-        break;
-    }
-    case pilotPosition::secondPilot: {
-        auto foreign_pilot = aDB->resolveForeignPilot(tableData.value(OPL::Db::FLIGHTS_SECONDPILOT).toInt());
-        return foreign_pilot.name();
-    }
-    case pilotPosition::thirdPilot: {
-        auto foreign_pilot = aDB->resolveForeignPilot(tableData.value(OPL::Db::FLIGHTS_THIRDPILOT).toInt());
-        return foreign_pilot.name();
-        break;
-    } // case scope
-    } // switch (pilot_)
-    return QString();
-}

+ 1 - 17
src/classes/aflightentry.h → deprecated/aflightentry.h

@@ -26,28 +26,12 @@ public:
     AFlightEntry(RowId_T row_id);
     AFlightEntry(RowData_T table_data);
 
-    AFlightEntry(const AFlightEntry& pe) = default;
-    AFlightEntry& operator=(const AFlightEntry& pe) = default;
-
-
-    enum class pilotPosition { pic, secondPilot, thirdPilot };
-
     /*!
      * \brief Returs a summary of the flight data, if struct holds data
      * \return "doft, dept, tofb, dest, tonb"
      */
     const QString summary();
-    /*!
-     * \brief Returns the tails' registration from the database.
-     */
-    //const QString getRegistration();
-    /*!
-     * \brief Returns the pilots name from the Database
-     *
-     * \param pilot_number - 1=pic, 2=second Pilot, 3 = third Pilot
-     * \return "Lastname, Firstname"
-     */
-    const QString getPilotName(pilotPosition);
+
 };
 
 #endif // AFLIGHTENTRY_H

+ 0 - 0
src/classes/apilotentry.cpp → deprecated/apilotentry.cpp


+ 0 - 0
src/classes/apilotentry.h → deprecated/apilotentry.h


+ 0 - 0
src/classes/asimulatorentry.cpp → deprecated/asimulatorentry.cpp


+ 0 - 0
src/classes/asimulatorentry.h → deprecated/asimulatorentry.h


+ 0 - 0
src/classes/atailentry.cpp → deprecated/atailentry.cpp


+ 0 - 0
src/classes/atailentry.h → deprecated/atailentry.h


+ 0 - 1
mainwindow.cpp

@@ -24,7 +24,6 @@
 #include "src/gui/dialogues/firstrundialog.h"
 #include "src/gui/dialogues/newflightdialog.h"
 #include "src/functions/adatetime.h"
-#include "src/classes/aentry.h"
 #include "src/classes/row.h"
 #include "src/gui/dialogues/newsimdialog.h"
 // Quick and dirty Debug area

+ 74 - 4
src/classes/acurrencyentry.cpp

@@ -1,10 +1,80 @@
 #include "acurrencyentry.h"
 #include "src/opl.h"
 
-//ACurrencyEntry::ACurrencyEntry()
-//{
-//
-//}
+AEntry::AEntry(DataPosition position_)
+    : position(position_)
+{}
+
+AEntry::AEntry(RowData_T table_data)
+    : tableData(table_data)
+{}
+
+AEntry::AEntry(DataPosition position_, RowData_T table_data)
+    : position(position_), tableData(table_data)
+{}
+
+void AEntry::setData(RowData_T table_data)
+{
+    tableData = table_data;
+}
+
+void AEntry::setPosition(DataPosition position_)
+{
+    position = position_;
+}
+
+const DataPosition& AEntry::getPosition() const
+{
+    return position;
+}
+
+const RowData_T& AEntry::getData() const
+{
+    return tableData;
+}
+
+AEntry::operator QString() const
+{
+    QString out("\033[32m[Entry Data]:\t\033[m\n");
+    int item_count = 0;
+    QHash<ColName_T, ColData_T>::const_iterator i;
+    for (i = tableData.constBegin(); i!= tableData.constEnd(); ++i) {
+        QString spacer(":");
+        int spaces = (14 - i.key().length());
+        if (spaces > 0)
+            for (int i = 0; i < spaces ; i++)
+                spacer += QLatin1Char(' ');
+        if (i.value().toString().isEmpty()) {
+            out.append(QLatin1String("\t\033[m") + i.key()
+                       + spacer
+                       + QLatin1String("\033[35m----"));
+            spaces = (14 - i.value().toString().length());
+            spacer = QString();
+            if (spaces > 0)
+                for (int i = 0; i < spaces ; i++)
+                    spacer += QLatin1Char(' ');
+            out.append(spacer);
+        } else {
+            out.append(QLatin1String("\t\033[m") + i.key()
+                       + spacer
+                       + QLatin1String("\033[35m")
+                       + i.value().toString());
+
+            spaces = (14 - i.value().toString().length());
+            spacer = QString();
+            if (spaces > 0)
+                for (int i = 0; i < spaces ; i++)
+                    spacer += QLatin1Char(' ');
+            out.append(spacer);
+        }
+        item_count ++;
+        if (item_count % 4 == 0)
+            out.append(QLatin1String("\n"));
+    }
+    out.append(QLatin1String("\n"));
+    QTextStream(stdout) << out;
+    return QString();
+}
 /*!
  * \brief ACurrencyEntry::ACurrencyEntry Creates an ACurrenyEntry object.
  *

+ 33 - 1
src/classes/acurrencyentry.h

@@ -1,9 +1,41 @@
 #ifndef ACURRENCYENTRY_H
 #define ACURRENCYENTRY_H
 
-#include "src/classes/aentry.h"
 #include "src/database/adatabasetypes.h"
 
+/*!
+ * \brief The Entry class encapsulates table metadata(table name, row id)
+ *  and data for new and existing entries in the database to operate on.
+ */
+class AEntry {
+protected:
+    DataPosition position;
+public:
+    RowData_T tableData;
+public:
+    AEntry() = delete;
+    AEntry(const AEntry&) = default;
+    AEntry& operator=(const AEntry&) = default;
+    AEntry(DataPosition position_);
+    AEntry(RowData_T table_data);
+    AEntry(DataPosition position_, RowData_T table_data);
+
+    void setData(RowData_T table_data);
+    void setPosition(DataPosition position_);
+
+    const DataPosition& getPosition() const;
+    const TableName_T &getTableName() const { return position.tableName; }
+    const RowId_T &getRowId() const { return position.rowId; }
+    const RowData_T& getData() const;
+
+    /*!
+     * \brief operator QString provides compatibilty with QDebug() - prints
+     * the tableData in a readable formatting to stdout
+     */
+    operator QString() const;
+
+};
+
 struct ACurrencyEntry : public AEntry
 {
 public:

+ 0 - 17
src/classes/aircraftentry.cpp

@@ -1,17 +0,0 @@
-#include "aircraftentry.h"
-
-namespace OPL {
-
-AircraftEntry::AircraftEntry()
-    : Row(DbTable::Aircraft, 0)
-{}
-
-OPL::AircraftEntry::AircraftEntry(const RowData_T &row_data)
-    : Row(DbTable::Aircraft, 0, row_data)
-{}
-
-OPL::AircraftEntry::AircraftEntry(int row_id, const RowData_T &row_data)
-    : Row(DbTable::Aircraft, row_id, row_data)
-{}
-
-} // namespace OPL

+ 0 - 19
src/classes/aircraftentry.h

@@ -1,19 +0,0 @@
-#ifndef AIRCRAFTENTRY_H
-#define AIRCRAFTENTRY_H
-
-#include "row.h"
-
-namespace OPL {
-
-class AircraftEntry : public Row
-{
-public:
-    AircraftEntry();
-    AircraftEntry(const RowData_T &row_data);
-    AircraftEntry(int row_id, const RowData_T &row_data);
-};
-
-} // namespace OPL
-
-
-#endif // AIRCRAFTENTRY_H

+ 62 - 0
src/classes/row.cpp

@@ -93,4 +93,66 @@ 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)
+{}
+
 } // namespace OPL

+ 49 - 0
src/classes/row.h

@@ -35,9 +35,58 @@ private:
     OPL::DbTable table;
     int rowId;
     RowData_T rowData;
+protected:
     bool hasData;
     bool valid = true;
 };
 
+
+class AircraftEntry : public Row
+{
+public:
+    AircraftEntry();
+    AircraftEntry(const RowData_T &row_data);
+    AircraftEntry(int row_id, const RowData_T &row_data);
+};
+
+
+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;
+    const QString type() const;
+};
+
+
+class PilotEntry : public Row
+{
+public:
+    PilotEntry();
+    PilotEntry(const RowData_T &row_data);
+    PilotEntry(int row_id, const RowData_T &row_data);
+
+};
+
+class SimulatorEntry : public Row
+{
+public:
+    SimulatorEntry();
+    SimulatorEntry(const RowData_T &row_data);
+    SimulatorEntry(int row_id, const RowData_T &row_data);
+};
+
+class FlightEntry : public Row
+{
+public:
+    FlightEntry();
+    FlightEntry(const RowData_T &row_data);
+    FlightEntry(int row_id, const RowData_T &row_data);
+
+};
+
 } // namespace OPL
 #endif // ROW_H

+ 0 - 37
src/classes/tailentry.cpp

@@ -1,37 +0,0 @@
-#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::registration() const
-{
-    return getRowData().value(OPL::Db::TAILS_REGISTRATION).toString();
-}
-
-const QString TailEntry::type() const
-{
-    QString type_string;
-    if (!getRowData().value(OPL::Db::TAILS_MAKE).toString().isEmpty())
-        type_string.append(getRowData().value(OPL::Db::TAILS_MAKE).toString() + QLatin1Char(' '));
-    if (!getRowData().value(OPL::Db::TAILS_MODEL).toString().isEmpty())
-        type_string.append(getRowData().value(OPL::Db::TAILS_MODEL).toString());
-    if (!getRowData().value(OPL::Db::TAILS_VARIANT).toString().isEmpty())
-        type_string.append(QLatin1Char('-') + getRowData().value(OPL::Db::TAILS_VARIANT).toString());
-
-    return type_string;
-}
-
-} // namespace OPL
-
-

+ 0 - 23
src/classes/tailentry.h

@@ -1,23 +0,0 @@
-#ifndef TAILENTRY_H
-#define TAILENTRY_H
-
-#include "row.h"
-
-namespace OPL {
-
-class TailEntry : public Row
-{
-public:
-    TailEntry();
-    TailEntry(const RowData_T &row_data); // create a new entry from scratch
-    TailEntry(int row_id, const RowData_T &row_data); // create an existing entry (retreived from DB)
-
-    const QString registration() const;
-    const QString type() const;
-};
-
-}
-
-
-
-#endif // TAILENTRY_H

+ 22 - 22
src/database/adatabase.cpp

@@ -794,12 +794,12 @@ RowData_T ADatabase::getRowData(const OPL::DbTable table, const int row_id)
     return entry_data;
 }
 
-APilotEntry ADatabase::getPilotEntry(RowId_T row_id)
-{
-    APilotEntry pilot_entry(row_id);
-    pilot_entry.setData(getEntryData(pilot_entry.getPosition()));
-    return pilot_entry;
-}
+//OPL::PilotEntry ADatabase::getPilotEntry(RowId_T row_id)
+//{
+//    APilotEntry pilot_entry(row_id);
+//    pilot_entry.setData(getEntryData(pilot_entry.getPosition()));
+//    return pilot_entry;
+//}
 
 //OPL::TailEntry ADatabase::getTailEntry(RowId_T row_id)
 //{
@@ -815,19 +815,19 @@ APilotEntry ADatabase::getPilotEntry(RowId_T row_id)
 //    return aircraft_entry;
 //}
 
-AFlightEntry ADatabase::getFlightEntry(RowId_T row_id)
-{
-    AFlightEntry flight_entry(row_id);
-    flight_entry.setData(getEntryData(flight_entry.getPosition()));
-    return flight_entry;
-}
+//AFlightEntry ADatabase::getFlightEntry(RowId_T row_id)
+//{
+//    AFlightEntry flight_entry(row_id);
+//    flight_entry.setData(getEntryData(flight_entry.getPosition()));
+//    return flight_entry;
+//}
 
-ASimulatorEntry ADatabase::getSimEntry(RowId_T row_id)
-{
-    ASimulatorEntry sim_entry(row_id);
-    sim_entry.setData(getEntryData(sim_entry.getPosition()));
-    return sim_entry;
-}
+//ASimulatorEntry ADatabase::getSimEntry(RowId_T row_id)
+//{
+//    ASimulatorEntry sim_entry(row_id);
+//    sim_entry.setData(getEntryData(sim_entry.getPosition()));
+//    return sim_entry;
+//}
 
 ACurrencyEntry ADatabase::getCurrencyEntry(const ACurrencyEntry::CurrencyName &currency_name)
 {
@@ -997,10 +997,10 @@ QList<RowId_T> ADatabase::getForeignKeyConstraints(RowId_T foreign_row_id, AData
     return row_ids;
 }
 
-APilotEntry ADatabase::resolveForeignPilot(RowId_T foreign_key)
-{
-    return aDB->getPilotEntry(foreign_key);
-}
+//APilotEntry ADatabase::resolveForeignPilot(RowId_T foreign_key)
+//{
+//    return aDB->getPilotEntry(foreign_key);
+//}
 
 //ATailEntry ADatabase::resolveForeignTail(RowId_T foreign_key)
 //{

+ 16 - 14
src/database/adatabase.h

@@ -32,20 +32,10 @@
 #include <QSqlField>
 
 #include "src/database/adatabasetypes.h"
-#include "src/classes/aentry.h"
-#include "src/classes/apilotentry.h"
-#include "src/classes/atailentry.h"
-
 #include "src/classes/row.h"
-#include "src/classes/tailentry.h"
-#include "src/classes/aircraftentry.h"
 
-#include "src/classes/aaircraftentry.h"
-#include "src/classes/aflightentry.h"
 #include "src/classes/astandardpaths.h"
 #include "src/classes/acurrencyentry.h"
-#include "src/classes/asimulatorentry.h"
-#include "src/classes/row.h"
 
 #define SQLITE_DRIVER QStringLiteral("QSQLITE")
 
@@ -333,7 +323,11 @@ public:
      * instead of an Entry. It allows for easy access to a pilot entry
      * with only the RowId required as input.
      */
-    APilotEntry getPilotEntry(RowId_T row_id);
+    inline OPL::PilotEntry getPilotEntry(RowId_T row_id)
+    {
+        const auto data = getRowData(OPL::DbTable::Pilots, row_id);
+        return OPL::PilotEntry(row_id, data);
+    }
 
     /*!
      * \brief retreives a TailEntry from the database.
@@ -371,7 +365,11 @@ public:
      * instead of an AEntry. It allows for easy access to a flight entry
      * with only the RowId required as input.
      */
-    AFlightEntry getFlightEntry(RowId_T row_id);
+    inline OPL::FlightEntry getFlightEntry(RowId_T row_id)
+    {
+        const auto data = getRowData(OPL::DbTable::Flights, row_id);
+        return OPL::FlightEntry(row_id, data);
+    }
 
     /*!
      * \brief retreives a Simulator entry from the database.
@@ -381,7 +379,11 @@ public:
      * instead of an AEntry. It allows for easy access to a Simulator entry
      * with only the RowId required as input.
      */
-    ASimulatorEntry getSimEntry(RowId_T row_id);
+    inline OPL::SimulatorEntry getSimEntry(RowId_T row_id)
+    {
+        const auto data = getRowData(OPL::DbTable::Simulators, row_id);
+        return OPL::SimulatorEntry(row_id, data);
+    }
 
     /*!
      * \brief Retreives a currency entry from the database.
@@ -415,7 +417,7 @@ public:
      * \brief Resolves the foreign key in a flight entry
      * \return The Pilot Entry referencted by the foreign key.
      */
-    APilotEntry resolveForeignPilot(RowId_T foreign_key);
+    //APilotEntry resolveForeignPilot(RowId_T foreign_key);
 
     /*!
      * \brief Resolves the foreign key in a flight entry

+ 4 - 4
src/functions/acalc.cpp

@@ -317,7 +317,7 @@ void ACalc::updateAutoTimes(int acft_id)
     auto acft_data = acft.getRowData();
     for (const auto& item : flight_list) {
         auto flight = aDB->getFlightEntry(item.toInt());
-        auto flight_data = flight.getData();
+        auto flight_data = flight.getRowData();
 
         if(acft_data.value(OPL::Db::TAILS_MULTIPILOT).toInt() == 0
                 && acft_data.value(OPL::Db::TAILS_MULTIENGINE) == 0) {
@@ -337,7 +337,7 @@ void ACalc::updateAutoTimes(int acft_id)
             flight_data.insert(OPL::Db::FLIGHTS_TSPSE, QString());
             flight_data.insert(OPL::Db::FLIGHTS_TSPME, QString());
         }
-        flight.setData(flight_data);
+        flight.setRowData(flight_data);
         aDB->commit(flight);
     }
 }
@@ -362,7 +362,7 @@ void ACalc::updateNightTimes()
     for (const auto& item : flight_list) {
 
         auto flt = aDB->getFlightEntry(item.toInt());
-        auto data = flt.getData();
+        auto data = flt.getRowData();
         auto dateTime = QDateTime(QDate::fromString(data.value(OPL::Db::FLIGHTS_DOFT).toString(), Qt::ISODate),
                                   QTime().addSecs(data.value(OPL::Db::FLIGHTS_TOFB).toInt() * 60),
                                   Qt::UTC);
@@ -372,7 +372,7 @@ void ACalc::updateNightTimes()
                                        dateTime,
                                        data.value(OPL::Db::FLIGHTS_TBLK).toInt(),
                                        night_angle));
-        flt.setData(data);
+        flt.setRowData(data);
         aDB->commit(flt);
     }
 }

+ 2 - 3
src/gui/dialogues/firstrundialog.cpp

@@ -21,7 +21,7 @@
 #include "src/functions/alog.h"
 #include "src/database/adatabase.h"
 #include "src/gui/widgets/backupwidget.h"
-#include "src/classes/apilotentry.h"
+#include "src/classes/row.h"
 #include "src/classes/adownload.h"
 #include "src/classes/asettings.h"
 #include "src/functions/adate.h"
@@ -324,8 +324,7 @@ bool FirstRunDialog::createUserEntry()
     data.insert(OPL::Db::PILOTS_PHONE,      ui->phoneLineEdit->text());
     data.insert(OPL::Db::PILOTS_EMAIL,      ui->emailLineEdit->text());
 
-    auto pilot = APilotEntry(1);
-    pilot.setData(data);
+    auto pilot = OPL::PilotEntry(1, data);
 
     return aDB->commit(pilot);
 }

+ 23 - 21
src/gui/dialogues/newflightdialog.cpp

@@ -38,7 +38,7 @@ NewFlightDialog::NewFlightDialog(ACompletionData &completion_data,
       completionData(completion_data)
 {
     init();
-    flightEntry = AFlightEntry();
+    //flightEntry = AFlightEntry();
     // Set up UI (New Flight)
     LOG << ASettings::read(ASettings::FlightLogging::Function);
     if(ASettings::read(ASettings::FlightLogging::Function).toInt() == static_cast<int>(OPL::PilotFunction::PIC)){
@@ -197,18 +197,20 @@ void NewFlightDialog::fillWithEntryData()
     DEB << "Restoring Flight: ";
     DEB << flightEntry;
 
+    const auto &flight_data = flightEntry.getRowData();
+
     // Date of Flight
-    ui->doftLineEdit->setText(flightEntry.getData().value(OPL::Db::FLIGHTS_DOFT).toString());
+    ui->doftLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_DOFT).toString());
     // Location
-    ui->deptLocationLineEdit->setText(flightEntry.getData().value(OPL::Db::FLIGHTS_DEPT).toString());
-    ui->destLocationLineEdit->setText(flightEntry.getData().value(OPL::Db::FLIGHTS_DEST).toString());
+    ui->deptLocationLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_DEPT).toString());
+    ui->destLocationLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_DEST).toString());
     // Times
-    ui->tofbTimeLineEdit->setText(ATime::toString(flightEntry.getData().value(OPL::Db::FLIGHTS_TOFB).toInt()));
-    ui->tonbTimeLineEdit->setText(ATime::toString(flightEntry.getData().value(OPL::Db::FLIGHTS_TONB).toInt()));
-    ui->acftLineEdit->setText(completionData.tailsIdMap.value(flightEntry.getData().value(OPL::Db::FLIGHTS_ACFT).toInt()));
-    ui->picNameLineEdit->setText(completionData.pilotsIdMap.value(flightEntry.getData().value(OPL::Db::FLIGHTS_PIC).toInt()));
-    ui->sicNameLineEdit->setText(completionData.pilotsIdMap.value(flightEntry.getData().value(OPL::Db::FLIGHTS_SECONDPILOT).toInt()));
-    ui->thirdPilotNameLineEdit->setText(completionData.pilotsIdMap.value(flightEntry.getData().value(OPL::Db::FLIGHTS_THIRDPILOT).toInt()));
+    ui->tofbTimeLineEdit->setText(ATime::toString(flight_data.value(OPL::Db::FLIGHTS_TOFB).toInt()));
+    ui->tonbTimeLineEdit->setText(ATime::toString(flight_data.value(OPL::Db::FLIGHTS_TONB).toInt()));
+    ui->acftLineEdit->setText(completionData.tailsIdMap.value(flight_data.value(OPL::Db::FLIGHTS_ACFT).toInt()));
+    ui->picNameLineEdit->setText(completionData.pilotsIdMap.value(flight_data.value(OPL::Db::FLIGHTS_PIC).toInt()));
+    ui->sicNameLineEdit->setText(completionData.pilotsIdMap.value(flight_data.value(OPL::Db::FLIGHTS_SECONDPILOT).toInt()));
+    ui->thirdPilotNameLineEdit->setText(completionData.pilotsIdMap.value(flight_data.value(OPL::Db::FLIGHTS_THIRDPILOT).toInt()));
 
     //Function
     const QHash<int, QString> functions = {
@@ -219,31 +221,31 @@ void NewFlightDialog::fillWithEntryData()
         {4, OPL::Db::FLIGHTS_TFI},
     };
     for (int i = 0; i < 5; i++) { // QHash::iterator not guarenteed to be in ordetr
-        if(flightEntry.getData().value(functions.value(i)).toInt() != 0)
+        if(flight_data.value(functions.value(i)).toInt() != 0)
             ui->functionComboBox->setCurrentIndex(i);
     }
     // Approach ComboBox
-    const QString& app = flightEntry.getData().value(OPL::Db::FLIGHTS_APPROACHTYPE).toString();
+    const QString& app = flight_data.value(OPL::Db::FLIGHTS_APPROACHTYPE).toString();
     if(app != QString()){
         ui->approachComboBox->setCurrentText(app);
     }
     // Task
-    bool PF = flightEntry.getData().value(OPL::Db::FLIGHTS_PILOTFLYING).toBool();
+    bool PF = flight_data.value(OPL::Db::FLIGHTS_PILOTFLYING).toBool();
     ui->pilotFlyingCheckBox->setChecked(PF);
     // Flight Rules
-    bool time_ifr = flightEntry.getData().value(OPL::Db::FLIGHTS_TIFR).toBool();
+    bool time_ifr = flight_data.value(OPL::Db::FLIGHTS_TIFR).toBool();
     ui->ifrCheckBox->setChecked(time_ifr);
     // Take-Off and Landing
-    int TO = flightEntry.getData().value(OPL::Db::FLIGHTS_TODAY).toInt()
-            + flightEntry.getData().value(OPL::Db::FLIGHTS_TONIGHT).toInt();
-    int LDG = flightEntry.getData().value(OPL::Db::FLIGHTS_LDGDAY).toInt()
-            + flightEntry.getData().value(OPL::Db::FLIGHTS_LDGNIGHT).toInt();
+    int TO =  flight_data.value(OPL::Db::FLIGHTS_TODAY).toInt()
+            + flight_data.value(OPL::Db::FLIGHTS_TONIGHT).toInt();
+    int LDG = flight_data.value(OPL::Db::FLIGHTS_LDGDAY).toInt()
+            + flight_data.value(OPL::Db::FLIGHTS_LDGNIGHT).toInt();
     ui->takeOffSpinBox->setValue(TO);
     ui->landingSpinBox->setValue(LDG);
     // Remarks
-    ui->remarksLineEdit->setText(flightEntry.getData().value(OPL::Db::FLIGHTS_REMARKS).toString());
+    ui->remarksLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_REMARKS).toString());
     // Flight Number
-    ui->flightNumberLineEdit->setText(flightEntry.getData().value(OPL::Db::FLIGHTS_FLIGHTNUMBER).toString());
+    ui->flightNumberLineEdit->setText(flight_data.value(OPL::Db::FLIGHTS_FLIGHTNUMBER).toString());
 
     for(const auto &line_edit : *mandatoryLineEdits)
         emit line_edit->editingFinished();
@@ -774,7 +776,7 @@ void NewFlightDialog::on_buttonBox_accepted()
     DEB << flightEntry;
 
     //DEB << "Setting Data for flightEntry...";
-    flightEntry.setData(newData);
+    flightEntry.setRowData(newData);
     DEB << "Committing: ";
     DEB << flightEntry;
     if (!aDB->commit(flightEntry)) {

+ 2 - 4
src/gui/dialogues/newflightdialog.h

@@ -26,11 +26,9 @@
 
 #include "src/functions/atime.h"
 #include "src/classes/acompletiondata.h"
-#include "src/classes/aflightentry.h"
-#include "src/classes/apilotentry.h"
-#include "src/classes/atailentry.h"
 #include "src/database/adatabase.h"
 #include "src/opl.h"
+#include "src/classes/row.h"
 
 /*!
  * \brief The ValidationItem enum contains the items that are mandatory for logging a flight:
@@ -133,7 +131,7 @@ private:
      * from an old entry, is used to fill the form for editing an entry, or is
      * filled with new data for adding a new entry to the logbook.
      */
-    AFlightEntry flightEntry;
+    OPL::FlightEntry flightEntry;
 
     /*!
      * \brief timeLineEdits - Line Edits for time Off Blocks and Time On Blocks

+ 6 - 6
src/gui/dialogues/newpilotdialog.cpp

@@ -20,7 +20,7 @@
 #include "src/opl.h"
 
 #include "src/database/adatabase.h"
-#include "src/classes/aentry.h"
+#include "src/classes/row.h"
 #include "src/functions/alog.h"
 
 /*!
@@ -32,7 +32,7 @@ NewPilotDialog::NewPilotDialog(QWidget *parent) :
 {
     setup();
 
-    pilotEntry = APilotEntry();
+    //pilotEntry = APilotEntry();
     ui->lastnameLineEdit->setFocus();
 }
 
@@ -84,7 +84,7 @@ void NewPilotDialog::formFiller()
 
     for (const auto &le : line_edits) {
         auto key = le->objectName().remove(QStringLiteral("LineEdit"));
-        le->setText(pilotEntry.getData().value(key).toString());
+        le->setText(pilotEntry.getRowData().value(key).toString());
     }
 }
 
@@ -98,9 +98,9 @@ void NewPilotDialog::submitForm()
         new_data.insert(key, value);
     }
 
-    pilotEntry.setData(new_data);
-    DEB << "Pilot entry position: " << pilotEntry.getPosition().tableName << pilotEntry.getPosition().rowId;
-    DEB << "entry data: " << pilotEntry;
+    pilotEntry.setRowData(new_data);
+    DEB << "Submitting Pilot:";
+    DEB << pilotEntry;
     if (!aDB->commit(pilotEntry)) {
         QMessageBox message_box(this);
         message_box.setText(tr("The following error has ocurred:"

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

@@ -23,7 +23,7 @@
 #include <QRegularExpression>
 #include <QRegularExpressionValidator>
 #include <QCompleter>
-#include "src/classes/apilotentry.h"
+#include "src/classes/row.h"
 
 namespace Ui {
 class NewPilot;
@@ -54,7 +54,7 @@ private slots:
 private:
     Ui::NewPilot *ui;
 
-    APilotEntry pilotEntry;
+    OPL::PilotEntry pilotEntry;
 
     inline void setup();
 

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

@@ -11,7 +11,7 @@ NewSimDialog::NewSimDialog(QWidget *parent) :
     QDialog(parent),
     ui(new Ui::NewSimDialog)
 {
-    entry = ASimulatorEntry();
+    //entry = ASimulatorEntry();
     ui->setupUi(this);
     ui->dateLineEdit->setText(ADate::currentDate());
     init();
@@ -51,7 +51,7 @@ void NewSimDialog::init()
  */
 void NewSimDialog::fillEntryData()
 {
-    const auto& data = entry.getData();
+    const auto& data = entry.getRowData();
     ui->dateLineEdit->setText(data.value(OPL::Db::SIMULATORS_DATE).toString());
     ui->totalTimeLineEdit->setText(ATime::toString(data.value(OPL::Db::SIMULATORS_TIME).toInt()));
     ui->deviceTypeComboBox->setCurrentIndex(data.value(OPL::Db::SIMULATORS_TYPE).toInt());
@@ -176,7 +176,7 @@ void NewSimDialog::on_buttonBox_accepted()
         return;
     }
 
-    entry.setData(collectInput());
+    entry.setRowData(collectInput());
 
     DEB << entry;
 

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

@@ -2,7 +2,7 @@
 #define NEWSIMDIALOG_H
 
 #include <QDialog>
-#include "src/classes/asimulatorentry.h"
+#include "src/classes/row.h"
 #include "src/database/adatabase.h"
 #include "src/classes/acompletiondata.h"
 
@@ -46,7 +46,7 @@ private:
     bool verifyInput(QString &error_msg);
     RowData_T collectInput();
 
-    ASimulatorEntry entry;
+    OPL::SimulatorEntry entry;
 };
 
 #endif // NEWSIMDIALOG_H

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

@@ -27,11 +27,7 @@
 #include "src/classes/asettings.h"
 #include "src/functions/acalc.h"
 #include "src/database/adatabase.h"
-
-#include "src/classes/atailentry.h"
-#include "src/classes/tailentry.h"
-
-#include "src/classes/aaircraftentry.h"
+#include "src/classes/row.h"
 
 namespace Ui {
 class NewTail;

+ 37 - 6
src/gui/widgets/aircraftwidget.cpp

@@ -20,8 +20,7 @@
 #include "src/opl.h"
 #include "src/classes/asettings.h"
 #include "src/database/adatabase.h"
-#include "src/classes/atailentry.h"
-#include "src/classes/aflightentry.h"
+#include "src/classes/row.h"
 #include "src/functions/alog.h"
 
 AircraftWidget::AircraftWidget(QWidget *parent) :
@@ -189,8 +188,8 @@ void AircraftWidget::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.registration(),
-                                     entry.type()));
+                               ).arg(entry.getRowData().value(OPL::Db::TAILS_REGISTRATION).toString(),
+                                     getAircraftTypeString(entry)));
 
         if (message_box.exec() == QMessageBox::Yes) {
             if(!aDB->remove(entry))
@@ -215,7 +214,7 @@ void AircraftWidget::onDeleteUnsuccessful()
 {
     QList<int> foreign_key_constraints = aDB->getForeignKeyConstraints(selectedTails.first(),
                                                                        ADatabaseTable::tails);
-    QList<AFlightEntry> constrained_flights;
+    QList<OPL::FlightEntry> constrained_flights;
     for (const auto &row_id : qAsConst(foreign_key_constraints)) {
         constrained_flights.append(aDB->getFlightEntry(row_id));
     }
@@ -229,7 +228,7 @@ void AircraftWidget::onDeleteUnsuccessful()
     } else {
         QString constrained_flights_string;
         for (int i=0; i<constrained_flights.length(); i++) {
-            constrained_flights_string.append(constrained_flights[i].summary() + QLatin1String("&nbsp;&nbsp;&nbsp;&nbsp;<br>"));
+            constrained_flights_string.append(getFlightSummary(constrained_flights[i]) + QLatin1String("&nbsp;&nbsp;&nbsp;&nbsp;<br>"));
             if (i>10) {
                 constrained_flights_string.append(QLatin1String("<br>[...]<br>"));
                 break;
@@ -258,3 +257,35 @@ void AircraftWidget::repopulateModel()
     setupModelAndView();
     connectSignalsAndSlots();
 }
+
+const QString AircraftWidget::getAircraftTypeString(const OPL::Row &row) const
+{
+    QString type_string;
+    if (!row.getRowData().value(OPL::Db::TAILS_MAKE).toString().isEmpty())
+        type_string.append(row.getRowData().value(OPL::Db::TAILS_MAKE).toString() + QLatin1Char(' '));
+    if (!row.getRowData().value(OPL::Db::TAILS_MODEL).toString().isEmpty())
+        type_string.append(row.getRowData().value(OPL::Db::TAILS_MODEL).toString());
+    if (!row.getRowData().value(OPL::Db::TAILS_VARIANT).toString().isEmpty())
+        type_string.append(QLatin1Char('-') + row.getRowData().value(OPL::Db::TAILS_VARIANT).toString());
+
+    return type_string;
+}
+
+const QString AircraftWidget::getFlightSummary(const OPL::FlightEntry &flight) const
+{
+    if(!flight.isValid())
+        return QString();
+
+    auto tableData = flight.getRowData();
+    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(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt())
+                          + space);
+    flight_summary.append(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TONB).toInt())
+                          + space);
+    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEST).toString());
+
+    return flight_summary;
+}

+ 4 - 0
src/gui/widgets/aircraftwidget.h

@@ -102,6 +102,10 @@ private:
      */
     QVector<qint32> selectedTails;
 
+    const QString getAircraftTypeString(const OPL::Row &row) const;
+
+    const QString getFlightSummary(const OPL::FlightEntry &flight) const;
+
     void setupModelAndView();
 
     void connectSignalsAndSlots();

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

@@ -29,8 +29,7 @@
 #include "src/functions/areadcsv.h"
 
 #include "src/database/adatabase.h"
-#include "src/classes/aentry.h"
-#include "src/classes/apilotentry.h"
+#include "src/classes/row.h"
 
 #include "src/testing/atimer.h"
 #include "src/functions/alog.h"

+ 23 - 4
src/gui/widgets/logbookwidget.cpp

@@ -18,7 +18,7 @@
 #include "logbookwidget.h"
 #include "ui_logbookwidget.h"
 
-#include "src/classes/aflightentry.h"
+#include "src/classes/row.h"
 #include "src/database/adatabase.h"
 #include "src/classes/asettings.h"
 #include "src/gui/dialogues/newflightdialog.h"
@@ -97,6 +97,25 @@ void LogbookWidget::connectSignalsAndSlots()
                      this, &LogbookWidget::flightsTableView_selectionChanged);
 }
 
+const QString LogbookWidget::getFlightSummary(const OPL::FlightEntry &flight) const
+{
+    if(!flight.isValid())
+        return QString();
+
+    auto tableData = flight.getRowData();
+    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(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt())
+                          + space);
+    flight_summary.append(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TONB).toInt())
+                          + space);
+    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEST).toString());
+
+    return flight_summary;
+}
+
 void LogbookWidget::changeEvent(QEvent *event)
 {
     if (event != nullptr)
@@ -134,7 +153,7 @@ void LogbookWidget::on_actionDelete_Flight_triggered()
         WARN(tr("<br>No flight selected.<br>"));
         return;
     } else if (selectedEntries.length() > 0 && selectedEntries.length() <= 10) {
-        QVector<AFlightEntry> flights_list;
+        QVector<OPL::FlightEntry> flights_list;
 
         for (const auto &flight_id : qAsConst(selectedEntries)) {
             flights_list.append(aDB->getFlightEntry(flight_id));
@@ -143,7 +162,7 @@ void LogbookWidget::on_actionDelete_Flight_triggered()
         QString flights_list_string;
 
         for (auto &flight : flights_list) {
-            flights_list_string.append(flight.summary());
+            flights_list_string.append(getFlightSummary(flight));
             flights_list_string.append(QStringLiteral("&nbsp;&nbsp;&nbsp;&nbsp;<br>"));
         }
 
@@ -158,7 +177,7 @@ void LogbookWidget::on_actionDelete_Flight_triggered()
                            ).arg(flights_list_string));
         if (confirm.exec() == QMessageBox::Yes) {
             for (auto& flight : flights_list) {
-                DEB << "Deleting flight: " << flight.summary();
+                DEB << "Deleting flight: " << flight;
                 if(!aDB->remove(flight)) {
                     WARN(tr("<br>Unable to delete.<br><br>The following error has ocurred: %1"
                                        ).arg(aDB->lastError.text()));

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

@@ -87,6 +87,8 @@ private:
     void setupModelAndView(int view_id);
     void connectSignalsAndSlots();
 
+    const QString getFlightSummary(const OPL::FlightEntry &flight) const;
+
     ACompletionData completionData;
 
     /*!

+ 34 - 4
src/gui/widgets/pilotswidget.cpp

@@ -20,7 +20,7 @@
 #include "src/opl.h"
 #include "src/functions/alog.h"
 #include "src/database/adatabase.h"
-#include "src/classes/apilotentry.h"
+#include "src/classes/row.h"
 
 PilotsWidget::PilotsWidget(QWidget *parent) :
     QWidget(parent),
@@ -173,7 +173,7 @@ void PilotsWidget::on_deletePilotButton_clicked()
         confirm.setWindowTitle(tr("Delete Pilot"));
 
         confirm.setText(tr("You are deleting the following pilot:<br><br><b><tt>"
-                               "%1</b></tt><br><br>Are you sure?").arg(entry.name()));
+                               "%1</b></tt><br><br>Are you sure?").arg(getPilotName(entry)));
         if (confirm.exec() == QMessageBox::Yes) {
             if(!aDB->remove(entry))
                 onDeleteUnsuccessful();
@@ -197,7 +197,7 @@ void PilotsWidget::onDeleteUnsuccessful()
 {
     const QList<int> foreign_key_constraints = aDB->getForeignKeyConstraints(selectedPilots.first(),
                                                                        ADatabaseTable::pilots);
-    QList<AFlightEntry> constrained_flights;
+    QList<OPL::FlightEntry> constrained_flights;
     for (const auto &row_id : foreign_key_constraints) {
         constrained_flights.append(aDB->getFlightEntry(row_id));
     }
@@ -209,7 +209,7 @@ void PilotsWidget::onDeleteUnsuccessful()
     } else {
         QString constrained_flights_string;
         for (int i=0; i<constrained_flights.length(); i++) {
-            constrained_flights_string.append(constrained_flights[i].summary() + QStringLiteral("&nbsp;&nbsp;&nbsp;&nbsp;<br>"));
+            constrained_flights_string.append(getFlightSummary(constrained_flights[i]) + QStringLiteral("&nbsp;&nbsp;&nbsp;&nbsp;<br>"));
             if (i>10) {
                 constrained_flights_string.append("<br>[...]<br>");
                 break;
@@ -237,3 +237,33 @@ void PilotsWidget::repopulateModel()
     setupModelAndView();
     connectSignalsAndSlots();
 }
+
+const QString PilotsWidget::getPilotName(const OPL::PilotEntry &pilot)
+{
+    if (!pilot.isValid())
+        return QString();
+
+    return pilot.getRowData().value(OPL::Db::PILOTS_LASTNAME).toString() + QLatin1String(", ")
+            + pilot.getRowData().value(OPL::Db::PILOTS_FIRSTNAME).toString();
+}
+
+const QString PilotsWidget::getFlightSummary(const OPL::FlightEntry &flight) const
+{
+
+    if(!flight.isValid())
+        return QString();
+
+    auto tableData = flight.getRowData();
+    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(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TOFB).toInt())
+                          + space);
+    flight_summary.append(ATime::toString(tableData.value(OPL::Db::FLIGHTS_TONB).toInt())
+                          + space);
+    flight_summary.append(tableData.value(OPL::Db::FLIGHTS_DEST).toString());
+
+    return flight_summary;
+
+}

+ 5 - 0
src/gui/widgets/pilotswidget.h

@@ -25,6 +25,7 @@
 #include "src/classes/asettings.h"
 #include "src/gui/dialogues/newpilotdialog.h"
 #include "src/gui/widgets/settingswidget.h"
+#include "src/functions/acalc.h"
 
 namespace Ui {
 class PilotsWidget;
@@ -95,6 +96,10 @@ private:
 
     QVector<qint32> selectedPilots;
 
+    const QString getPilotName(const OPL::PilotEntry &pilot);
+
+    const QString getFlightSummary(const OPL::FlightEntry &flight) const;
+
     void setupModelAndView();
 
     void connectSignalsAndSlots();

+ 13 - 6
src/gui/widgets/settingswidget.cpp

@@ -21,7 +21,7 @@
 #include "src/classes/astyle.h"
 #include "src/classes/asettings.h"
 #include "src/database/adatabase.h"
-#include "src/classes/apilotentry.h"
+#include "src/classes/row.h"
 #include "src/opl.h"
 #include "src/functions/adate.h"
 
@@ -104,7 +104,7 @@ void SettingsWidget::readSettings()
     //const QSignalBlocker blocker(this); // don't emit editing finished for setting these values
 
     // Personal Data Tab
-    auto user_data = aDB->getPilotEntry(1).getData();
+    auto user_data = aDB->getPilotEntry(1).getRowData();
     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());
@@ -191,7 +191,7 @@ void SettingsWidget::updatePersonalDetails()
         QString name;
         name.append(ui->lastnameLineEdit->text());
         name.append(QLatin1String(", "));
-        name.append(ui->firstnameLineEdit->text().left(1));
+        name.append(ui->firstnameLineEdit->text().at(0));
         name.append(QLatin1Char('.'));
         user_data.insert(OPL::Db::PILOTS_ALIAS, name);
     }
@@ -206,10 +206,17 @@ void SettingsWidget::updatePersonalDetails()
     user_data.insert(OPL::Db::PILOTS_PHONE, ui->phoneLineEdit->text());
     user_data.insert(OPL::Db::PILOTS_EMAIL, ui->emailLineEdit->text());
 
-    auto user = APilotEntry(1);
-    user.setData(user_data);
+    auto user = OPL::PilotEntry(1, user_data);
+
+    TODO << "Changing DB does not currently refresh logbook view";
+    TODO << "Check for empty line edits (First, last name should not be empty...validators not a good way because it gives no user feedback)";
+
+    if(!aDB->commit(user))
+        WARN(tr("Unable to update Database:<br>") + aDB->lastError.text());
+    else
+        LOG << "User updated successfully.";
+
 
-    aDB->commit(user);
 }
 
 /*

+ 7 - 8
src/testing/importCrewlounge/importcrewlounge.cpp

@@ -1,6 +1,7 @@
 #include "importcrewlounge.h"
 #include "src/database/adatabase.h"
 #include "src/opl.h"
+#include "src/classes/row.h"
 #include "src/testing/importCrewlounge/processpilots.h"
 #include "src/testing/importCrewlounge/processaircraft.h"
 #include "src/testing/importCrewlounge/processflights.h"
@@ -28,9 +29,8 @@ void exec(const QString &csv_file_path)
     proc_pilots.init();
     const auto p_maps = proc_pilots.getProcessedPilotMaps();
 
-    for (const auto & pilot : p_maps) {
-        APilotEntry pe(pilot);
-        pe.setPosition(DataPosition(OPL::Db::TABLE_PILOTS, pilot.value(OPL::Db::PILOTS_ROWID).toInt()));
+    for (const auto & pilot_data : p_maps) {
+        OPL::PilotEntry pe(pilot_data.value(OPL::Db::PILOTS_ROWID).toInt(), pilot_data);
         aDB->commit(pe);
     }
 
@@ -39,9 +39,8 @@ void exec(const QString &csv_file_path)
     proc_tails.init();
     const auto t_maps = proc_tails.getProcessedTailMaps();
 
-    for (const auto& tail : t_maps) {
-        ATailEntry te(tail);
-        te.setPosition(DataPosition(OPL::Db::TABLE_TAILS, tail.value(OPL::Db::PILOTS_ROWID).toInt()));
+    for (const auto& tail_data : t_maps) {
+        OPL::TailEntry te(tail_data.value(OPL::Db::PILOTS_ROWID).toInt(), tail_data);
         aDB->commit(te);
     }
 
@@ -53,8 +52,8 @@ void exec(const QString &csv_file_path)
 
 
 
-    for (const auto &flight : flights) {
-        AFlightEntry fe(flight);
+    for (const auto &flight_data : flights) {
+        OPL::FlightEntry fe(flight_data);
         aDB->commit(fe);
     }