Browse Source

Renamed opl namespace to Opl

Capitalization of Opl namespace

Unified Handling of Approach Type. Instead of hardcoded entries in the comboboxes, now read from const qstringlist in FirstRunDialog, NewFilghtDialog and SettingsWidget.
Felix 4 years ago
parent
commit
56980d9589

+ 1 - 1
src/classes/aaircraftentry.cpp

@@ -23,7 +23,7 @@ AAircraftEntry::AAircraftEntry()
 {}
 
 AAircraftEntry::AAircraftEntry(RowId row_id)
-    : AEntry::AEntry(DataPosition(opl::db::TABLE_AIRCRAFT, row_id))
+    : AEntry::AEntry(DataPosition(Opl::Db::TABLE_AIRCRAFT, row_id))
 {}
 
 AAircraftEntry::AAircraftEntry(RowData table_data)

+ 10 - 10
src/classes/aflightentry.cpp

@@ -26,7 +26,7 @@ AFlightEntry::AFlightEntry()
 {}
 
 AFlightEntry::AFlightEntry(RowId row_id)
-    : AEntry::AEntry(DataPosition(opl::db::TABLE_FLIGHTS, row_id))
+    : AEntry::AEntry(DataPosition(Opl::Db::TABLE_FLIGHTS, row_id))
 {}
 
 AFlightEntry::AFlightEntry(RowData table_data)
@@ -40,20 +40,20 @@ const QString AFlightEntry::summary()
 
     QString flight_summary;
     auto space = QStringLiteral(" ");
-    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())
+    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())
+    flight_summary.append(ATime::toString(tableData.value(Opl::Db::FLIGHTS_TONB).toInt())
                           + space);
-    flight_summary.append(tableData.value(opl::db::FLIGHTS_DEST).toString());
+    flight_summary.append(tableData.value(Opl::Db::FLIGHTS_DEST).toString());
 
     return flight_summary;
 }
 
 const QString AFlightEntry::getRegistration()
 {
-    ATailEntry acft = aDB->resolveForeignTail(tableData.value(opl::db::FLIGHTS_ACFT).toInt());
+    ATailEntry acft = aDB->resolveForeignTail(tableData.value(Opl::Db::FLIGHTS_ACFT).toInt());
     return acft.registration();
 }
 
@@ -61,16 +61,16 @@ const QString AFlightEntry::getPilotName(pilotPosition pilot_)
 {
     switch (pilot_) {
     case pilotPosition::pic: {
-        auto foreign_pilot = aDB->resolveForeignPilot(tableData.value(opl::db::FLIGHTS_PIC).toInt());
+        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());
+        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());
+        auto foreign_pilot = aDB->resolveForeignPilot(tableData.value(Opl::Db::FLIGHTS_THIRDPILOT).toInt());
         return foreign_pilot.name();
         break;
     } // case scope

+ 3 - 3
src/classes/apilotentry.cpp

@@ -23,7 +23,7 @@ APilotEntry::APilotEntry()
 {}
 
 APilotEntry::APilotEntry(RowId row_id)
-    : AEntry::AEntry(DataPosition(opl::db::TABLE_PILOTS, row_id))
+    : AEntry::AEntry(DataPosition(Opl::Db::TABLE_PILOTS, row_id))
 {}
 
 APilotEntry::APilotEntry(RowData table_data)
@@ -35,6 +35,6 @@ const QString APilotEntry::name()
     if (tableData.isEmpty())
         return QString();
 
-    return tableData.value(opl::db::PILOTS_LASTNAME).toString() + ','
-           +tableData.value(opl::db::PILOTS_FIRSTNAME).toString().left(1) + '.';
+    return tableData.value(Opl::Db::PILOTS_LASTNAME).toString() + ','
+           +tableData.value(Opl::Db::PILOTS_FIRSTNAME).toString().left(1) + '.';
 }

+ 0 - 3
src/classes/astyle.cpp

@@ -5,8 +5,6 @@
 #include "src/testing/adebug.h"
 #include "src/classes/asettings.h"
 
-// this was throwing hundreds of warnings on 5.9.5, fusion is a good default for all platforms, let's
-// stick with that for now.
 const QString AStyle::defaultStyle = QStringLiteral("Fusion");
 
 const QString AStyle::defaultStyleSheet = QStringLiteral("");
@@ -72,7 +70,6 @@ void AStyle::setStyle(const QString style)
 
 void AStyle::setStyleSheet(const StyleSheet stylesheet)
 {
-    // [F]: qt 5.9.5 compatibility
     DEB << "Setting stylesheet to:" << defaultStyleSheets[stylesheet].baseName();
     qApp->setStyleSheet(read_stylesheet(stylesheet));
     ASettings::write(ASettings::Main::StyleSheet, stylesheet);

+ 8 - 8
src/classes/atailentry.cpp

@@ -23,7 +23,7 @@ ATailEntry::ATailEntry()
 {}
 
 ATailEntry::ATailEntry(RowId row_id)
-    : AEntry::AEntry(DataPosition(opl::db::TABLE_TAILS, row_id))
+    : AEntry::AEntry(DataPosition(Opl::Db::TABLE_TAILS, row_id))
 {}
 
 ATailEntry::ATailEntry(RowData table_data)
@@ -32,18 +32,18 @@ ATailEntry::ATailEntry(RowData table_data)
 
 const QString ATailEntry::registration()
 {
-    return getData().value(opl::db::TAILS_REGISTRATION).toString();
+    return getData().value(Opl::Db::TAILS_REGISTRATION).toString();
 }
 
 const QString ATailEntry::type()
 {
     QString type_string;
-    if (!tableData.value(opl::db::TAILS_MAKE).toString().isEmpty())
-        type_string.append(getData().value(opl::db::TAILS_MAKE).toString() + ' ');
-    if (!tableData.value(opl::db::TAILS_MODEL).toString().isEmpty())
-        type_string.append(getData().value(opl::db::TAILS_MODEL).toString());
-    if (!tableData.value(opl::db::TAILS_VARIANT).toString().isEmpty())
-        type_string.append('-' + getData().value(opl::db::TAILS_VARIANT).toString() + ' ');
+    if (!tableData.value(Opl::Db::TAILS_MAKE).toString().isEmpty())
+        type_string.append(getData().value(Opl::Db::TAILS_MAKE).toString() + ' ');
+    if (!tableData.value(Opl::Db::TAILS_MODEL).toString().isEmpty())
+        type_string.append(getData().value(Opl::Db::TAILS_MODEL).toString());
+    if (!tableData.value(Opl::Db::TAILS_VARIANT).toString().isEmpty())
+        type_string.append('-' + getData().value(Opl::Db::TAILS_VARIANT).toString() + ' ');
 
     return type_string;
 }

+ 3 - 3
src/database/adatabase.cpp

@@ -545,13 +545,13 @@ int ADatabase::getLastEntry(ADatabaseTarget target)
 
     switch (target) {
     case ADatabaseTarget::pilots:
-        statement.append(opl::db::TABLE_PILOTS);
+        statement.append(Opl::Db::TABLE_PILOTS);
         break;
     case ADatabaseTarget::aircraft:
-        statement.append(opl::db::TABLE_AIRCRAFT);
+        statement.append(Opl::Db::TABLE_AIRCRAFT);
         break;
     case ADatabaseTarget::tails:
-        statement.append(opl::db::TABLE_TAILS);
+        statement.append(Opl::Db::TABLE_TAILS);
         break;
     default:
         DEB << "Not a valid completer target for this function.";

+ 1 - 1
src/database/adatabasesetup.cpp

@@ -305,7 +305,7 @@ bool ADataBaseSetup::backupOldData()
     }
 
     auto date_string = ADateTime::toString(QDateTime::currentDateTime(),
-                                           opl::datetime::Backup);
+                                           Opl::Datetime::Backup);
     auto backup_dir = QDir(AStandardPaths::absPathOf(AStandardPaths::DatabaseBackup));
     auto backup_name = database_file.baseName() + "_bak_" + date_string + ".db";
     QFile file(aDB->databaseFile.absoluteFilePath());

+ 4 - 4
src/database/declarations.h

@@ -43,9 +43,9 @@ struct DataPosition {
 };
 
 // Default Positions
-static auto const DEFAULT_FLIGHT_POSITION   = DataPosition(opl::db::TABLE_FLIGHTS, 0);
-static auto const DEFAULT_PILOT_POSITION    = DataPosition(opl::db::TABLE_PILOTS, 0);
-static auto const DEFAULT_TAIL_POSITION     = DataPosition(opl::db::TABLE_TAILS, 0);
-static auto const DEFAULT_AIRCRAFT_POSITION = DataPosition(opl::db::TABLE_AIRCRAFT, 0);
+static auto const DEFAULT_FLIGHT_POSITION   = DataPosition(Opl::Db::TABLE_FLIGHTS, 0);
+static auto const DEFAULT_PILOT_POSITION    = DataPosition(Opl::Db::TABLE_PILOTS, 0);
+static auto const DEFAULT_TAIL_POSITION     = DataPosition(Opl::Db::TABLE_TAILS, 0);
+static auto const DEFAULT_AIRCRAFT_POSITION = DataPosition(Opl::Db::TABLE_AIRCRAFT, 0);
 
 #endif // DECLARATIONS_H

+ 20 - 20
src/functions/acalc.cpp

@@ -277,23 +277,23 @@ void ACalc::updateAutoTimes(int acft_id)
         auto flight = aDB->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::Db::TAILS_MULTIPILOT).toInt() == 0
+                && acft_data.value(Opl::Db::TAILS_MULTIENGINE) == 0) {
             DEB << "SPSE";
-            flight_data.insert(opl::db::FLIGHTS_TSPSE, flight_data.value(opl::db::FLIGHTS_TBLK));
-            flight_data.insert(opl::db::FLIGHTS_TSPME, QStringLiteral(""));
-            flight_data.insert(opl::db::FLIGHTS_TMP, QStringLiteral(""));
-        } else if ((acft_data.value(opl::db::TAILS_MULTIPILOT) == 0
-                    && acft.getData().value(opl::db::TAILS_MULTIENGINE) == 1)) {
+            flight_data.insert(Opl::Db::FLIGHTS_TSPSE, flight_data.value(Opl::Db::FLIGHTS_TBLK));
+            flight_data.insert(Opl::Db::FLIGHTS_TSPME, QStringLiteral(""));
+            flight_data.insert(Opl::Db::FLIGHTS_TMP, QStringLiteral(""));
+        } else if ((acft_data.value(Opl::Db::TAILS_MULTIPILOT) == 0
+                    && acft.getData().value(Opl::Db::TAILS_MULTIENGINE) == 1)) {
             DEB << "SPME";
-            flight_data.insert(opl::db::FLIGHTS_TSPME, flight_data.value(opl::db::FLIGHTS_TBLK));
-            flight_data.insert(opl::db::FLIGHTS_TSPSE, QStringLiteral(""));
-            flight_data.insert(opl::db::FLIGHTS_TMP, QStringLiteral(""));
-        } else if ((acft_data.value(opl::db::TAILS_MULTIPILOT) == 1)) {
+            flight_data.insert(Opl::Db::FLIGHTS_TSPME, flight_data.value(Opl::Db::FLIGHTS_TBLK));
+            flight_data.insert(Opl::Db::FLIGHTS_TSPSE, QStringLiteral(""));
+            flight_data.insert(Opl::Db::FLIGHTS_TMP, QStringLiteral(""));
+        } else if ((acft_data.value(Opl::Db::TAILS_MULTIPILOT) == 1)) {
             DEB << "MPME";
-            flight_data.insert(opl::db::FLIGHTS_TMP, flight_data.value(opl::db::FLIGHTS_TBLK));
-            flight_data.insert(opl::db::FLIGHTS_TSPSE, QStringLiteral(""));
-            flight_data.insert(opl::db::FLIGHTS_TSPME, QStringLiteral(""));
+            flight_data.insert(Opl::Db::FLIGHTS_TMP, flight_data.value(Opl::Db::FLIGHTS_TBLK));
+            flight_data.insert(Opl::Db::FLIGHTS_TSPSE, QStringLiteral(""));
+            flight_data.insert(Opl::Db::FLIGHTS_TSPME, QStringLiteral(""));
         }
         flight.setData(flight_data);
         aDB->commit(flight);
@@ -321,14 +321,14 @@ void ACalc::updateNightTimes()
 
         auto flt = aDB->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::Db::FLIGHTS_DOFT).toString(), Qt::ISODate),
+                                  QTime().addSecs(data.value(Opl::Db::FLIGHTS_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::Db::FLIGHTS_TNIGHT,
+                    calculateNightTime(data.value(Opl::Db::FLIGHTS_DEPT).toString(),
+                                       data.value(Opl::Db::FLIGHTS_DEST).toString(),
                                        dateTime,
-                                       data.value(opl::db::FLIGHTS_TBLK).toInt(),
+                                       data.value(Opl::Db::FLIGHTS_TBLK).toInt(),
                                        night_angle));
         flt.setData(data);
         aDB->commit(flt);

+ 3 - 3
src/functions/adatetime.h

@@ -9,11 +9,11 @@ namespace ADateTime {
  * \brief toString formats a QDateTime object into a string in a uniform way.
  * \return
  */
-inline const QString toString (const QDateTime date_time, opl::datetime::DateTimeFormat format) {
+inline const QString toString (const QDateTime date_time, Opl::Datetime::DateTimeFormat format) {
     switch (format) {
-    case opl::datetime::Default:
+    case Opl::Datetime::Default:
         return date_time.toString(Qt::ISODate);
-    case opl::datetime::Backup:
+    case Opl::Datetime::Backup:
         return date_time.toString(QStringLiteral("yyyy_MM_dd_T_hh_mm"));
     default:
         return QString();

+ 12 - 12
src/functions/atime.h

@@ -11,13 +11,13 @@ namespace ATime {
 /*!
  * \brief Converts a QTime to a String to be used in the UI
  */
-inline const QString toString(const QTime &time, opl::time::FlightTimeFormat format = opl::time::Default)
+inline const QString toString(const QTime &time, Opl::Time::FlightTimeFormat format = Opl::Time::Default)
 {
     switch (format) {
-    case opl::time::Default:
+    case Opl::Time::Default:
         return time.toString(QStringLiteral("hh:mm"));
         break;
-    case opl::time::Decimal:
+    case Opl::Time::Decimal:
         return QString::number(((time.hour() * 60 + time.minute() )/60.0), 'f', 2);
         break;
     default:
@@ -28,10 +28,10 @@ inline const QString toString(const QTime &time, opl::time::FlightTimeFormat for
 /*!
  * \brief Converts an integer of minutes as received from the Datbase to a String
  */
-inline const QString toString(int minutes_in, opl::time::FlightTimeFormat format = opl::time::Default)
+inline const QString toString(int minutes_in, Opl::Time::FlightTimeFormat format = Opl::Time::Default)
 {
     switch (format) {
-    case opl::time::Default:
+    case Opl::Time::Default:
     {
         QString hour = QString::number(minutes_in / 60);
         if (hour.size() < 2) {
@@ -43,7 +43,7 @@ inline const QString toString(int minutes_in, opl::time::FlightTimeFormat format
         }
         return hour + ':' + minute;
     }
-    case opl::time::Decimal:
+    case Opl::Time::Decimal:
     {
         int hour = minutes_in / 60;
         double minute = (minutes_in % 60) / 60.0;
@@ -69,13 +69,13 @@ inline QTime fromMinutes(int total_minutes)
     return QTime(hour, minute, 0);
 }
 
-inline const QTime fromString(QString time_string, opl::time::FlightTimeFormat format = opl::time::Default)
+inline const QTime fromString(QString time_string, Opl::Time::FlightTimeFormat format = Opl::Time::Default)
 {
     switch (format) {
-    case opl::time::Default:
+    case Opl::Time::Default:
         return QTime::fromString(time_string, QStringLiteral("hh:mm"));
         break;
-    case opl::time::Decimal:
+    case Opl::Time::Decimal:
     {
         double decimal_time = time_string.toDouble();
         int hour = decimal_time;
@@ -88,13 +88,13 @@ inline const QTime fromString(QString time_string, opl::time::FlightTimeFormat f
     }
 }
 
-inline const QTime fromString(const char* time_string, opl::time::FlightTimeFormat format = opl::time::Default)
+inline const QTime fromString(const char* time_string, Opl::Time::FlightTimeFormat format = Opl::Time::Default)
 {
     switch (format) {
-    case opl::time::Default:
+    case Opl::Time::Default:
         return QTime::fromString(time_string, QStringLiteral("hh:mm"));
         break;
-    case opl::time::Decimal:
+    case Opl::Time::Decimal:
     {
         double decimal_time = QString(time_string).toDouble();
         int hour = decimal_time;

+ 11 - 7
src/gui/dialogues/firstrundialog.cpp

@@ -20,6 +20,10 @@ FirstRunDialog::FirstRunDialog(QWidget *parent) :
     ui->previousPushButton->setEnabled(false);
     ui->nightComboBox->setCurrentIndex(1);
 
+    for (const auto &approach : Opl::ApproachTypes){
+        ui->approachComboBox->addItem(approach);
+    }
+
 //    auto *themeGroup = new QButtonGroup;
 //    themeGroup->addButton(ui->systemThemeCheckBox, 0);
 //    themeGroup->addButton(ui->lightThemeCheckBox, 1);
@@ -97,16 +101,16 @@ bool FirstRunDialog::finish()
     ASettings::write(ASettings::FlightLogging::NumberLandings, 1);
     ASettings::write(ASettings::FlightLogging::PopupCalendar, true);
     ASettings::write(ASettings::FlightLogging::PilotFlying, true);
-    ASettings::write(ASettings::FlightLogging::FlightTimeFormat, opl::time::Default);
+    ASettings::write(ASettings::FlightLogging::FlightTimeFormat, Opl::Time::Default);
 
     QMap<QString, QVariant> data;
     ASettings::write(ASettings::UserData::DisplaySelfAs, ui->aliasComboBox->currentIndex());
-    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::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());
 
     QMessageBox db_fail_msg_box(QMessageBox::Critical, QStringLiteral("Database setup failed"),
                                        QStringLiteral("Errors have ocurred creating the database."

+ 2 - 108
src/gui/dialogues/firstrundialog.ui

@@ -31,7 +31,7 @@
    <item row="0" column="0" colspan="2">
     <widget class="QStackedWidget" name="stackedWidget">
      <property name="currentIndex">
-      <number>2</number>
+      <number>1</number>
      </property>
      <widget class="QWidget" name="stackedWidgetPage1">
       <layout class="QGridLayout" name="gridLayout_2">
@@ -242,113 +242,7 @@
         </widget>
        </item>
        <item row="4" column="1">
-        <widget class="QComboBox" name="approachComboBox">
-         <item>
-          <property name="text">
-           <string>VISUAL</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>ILS CAT I</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>ILS CAT II</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>ILS CAT III</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>GLS</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>MLS</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>LOC</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>LOC/DME</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (LNAV)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (LNAV/VNAV)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (LPV)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (RNP)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (RNP-AR)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>VOR</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>VOR/DME</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>NDB</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>NDB/DME</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>TACAN</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>SRA</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>PAR</string>
-          </property>
-         </item>
-        </widget>
+        <widget class="QComboBox" name="approachComboBox"/>
        </item>
        <item row="5" column="0">
         <widget class="QLabel" name="nightLabel">

+ 2 - 67
src/gui/dialogues/newflight.ui

@@ -17,7 +17,7 @@
    <item row="0" column="0" colspan="2">
     <widget class="QTabWidget" name="flightDataTabWidget">
      <property name="currentIndex">
-      <number>0</number>
+      <number>1</number>
      </property>
      <widget class="QWidget" name="flightDataTab">
       <attribute name="title">
@@ -987,73 +987,8 @@
           </size>
          </property>
          <property name="currentText">
-          <string>ILS CAT I</string>
+          <string/>
          </property>
-         <item>
-          <property name="text">
-           <string>ILS CAT I</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>ILS CAT II</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>ILS CAT III</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>Visual</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (RNP)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (RNP AR)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>VOR</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>NDB</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>LOC</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>GLS</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>MLS</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>SRA</string>
-          </property>
-         </item>
         </widget>
        </item>
        <item row="1" column="4">

+ 100 - 88
src/gui/dialogues/newflightdialog.cpp

@@ -129,6 +129,9 @@ NewFlightDialog::~NewFlightDialog()
 
 void NewFlightDialog::setup()
 {
+    for (const auto & approach : Opl::ApproachTypes){
+        ui->ApproachComboBox->addItem(approach);
+    }
     updateEnabled = true;
     setupButtonGroups();
     setupRawInputValidation();
@@ -173,9 +176,9 @@ void NewFlightDialog::readSettings()
     ui->calendarCheckBox->setChecked(ASettings::read(ASettings::FlightLogging::PopupCalendar).toBool());
 
     // Debug
-    ASettings::write(ASettings::FlightLogging::FlightTimeFormat, opl::time::Default);
+    ASettings::write(ASettings::FlightLogging::FlightTimeFormat, Opl::Time::Default);
     //[F]: Support for Decimal Logging is not implemented yet.
-    flightTimeFormat = static_cast<opl::time::FlightTimeFormat>(
+    flightTimeFormat = static_cast<Opl::Time::FlightTimeFormat>(
                 ASettings::read(ASettings::FlightLogging::FlightTimeFormat).toInt());
 
 
@@ -394,7 +397,7 @@ void NewFlightDialog::fillDeductibleData()
     QList<QLabel*>      LB = {ui->tSPSELabel, ui->tSPMELabel,  ui->tMPLabel,  ui->tIFRLabel,  ui->tNIGHTLabel,
                               ui->tPICLabel,  ui->tPICUSLabel, ui->tSICLabel, ui->tDUALLabel, ui->tFILabel};
     for(const auto& widget : LE) {widget->setText(EMPTY_STRING);}
-    for(const auto& widget : LB) {widget->setText(opl::db::NULL_TIME_hhmm);}
+    for(const auto& widget : LB) {widget->setText(Opl::Db::NULL_TIME_hhmm);}
     //Calculate block time
     const auto tofb = ATime::fromString(ui->tofbTimeLineEdit->text());
     const auto tonb = ATime::fromString(ui->tonbTimeLineEdit->text());
@@ -410,19 +413,19 @@ void NewFlightDialog::fillDeductibleData()
 
 
     // SP SE
-    if(acft.getData().value(opl::db::TAILS_MULTIPILOT).toInt() == 0
-            && acft.getData().value(opl::db::TAILS_MULTIENGINE).toInt() == 0){
+    if(acft.getData().value(Opl::Db::TAILS_MULTIPILOT).toInt() == 0
+            && acft.getData().value(Opl::Db::TAILS_MULTIENGINE).toInt() == 0){
         ui->tSPSETimeLineEdit->setText(block_time_string);
         ui->tSPSELabel->setText(block_time_string);
     }
     // SP ME
-    if(acft.getData().value(opl::db::TAILS_MULTIPILOT).toInt() == 0
-            && acft.getData().value(opl::db::TAILS_MULTIENGINE).toInt() == 1){
+    if(acft.getData().value(Opl::Db::TAILS_MULTIPILOT).toInt() == 0
+            && acft.getData().value(Opl::Db::TAILS_MULTIENGINE).toInt() == 1){
         ui->tSPMETimeLineEdit->setText(block_time_string);
         ui->tSPMELabel->setText(block_time_string);
     }
     // MP
-    if(acft.getData().value(opl::db::TAILS_MULTIPILOT).toInt() == 1){
+    if(acft.getData().value(Opl::Db::TAILS_MULTIPILOT).toInt() == 1){
         ui->tMPTimeLineEdit->setText(block_time_string);
         ui->tMPLabel->setText(block_time_string);
     }
@@ -490,38 +493,38 @@ RowData NewFlightDialog::collectInput()
     const auto tblk = ATime::blocktime(tofb, tonb);
     const auto block_minutes = ATime::toMinutes(tblk);
     // Mandatory data
-    newData.insert(opl::db::FLIGHTS_DOFT, ui->doftLineEdit->text());
-    newData.insert(opl::db::FLIGHTS_DEPT, ui->deptLocLineEdit->text());
-    newData.insert(opl::db::FLIGHTS_TOFB, ATime::toMinutes(tofb));
-    newData.insert(opl::db::FLIGHTS_DEST, ui->destLocLineEdit->text());
-    newData.insert(opl::db::FLIGHTS_TONB, ATime::toMinutes(tonb));
-    newData.insert(opl::db::FLIGHTS_TBLK, block_minutes);
+    newData.insert(Opl::Db::FLIGHTS_DOFT, ui->doftLineEdit->text());
+    newData.insert(Opl::Db::FLIGHTS_DEPT, ui->deptLocLineEdit->text());
+    newData.insert(Opl::Db::FLIGHTS_TOFB, ATime::toMinutes(tofb));
+    newData.insert(Opl::Db::FLIGHTS_DEST, ui->destLocLineEdit->text());
+    newData.insert(Opl::Db::FLIGHTS_TONB, ATime::toMinutes(tonb));
+    newData.insert(Opl::Db::FLIGHTS_TBLK, block_minutes);
     // Aircraft
-    newData.insert(opl::db::FLIGHTS_ACFT, tailsIdMap.value(ui->acftLineEdit->text()));
+    newData.insert(Opl::Db::FLIGHTS_ACFT, tailsIdMap.value(ui->acftLineEdit->text()));
     // Pilots
-    newData.insert(opl::db::FLIGHTS_PIC, pilotsIdMap.value(ui->picNameLineEdit->text()));
-    newData.insert(opl::db::FLIGHTS_SECONDPILOT, pilotsIdMap.value(ui->secondPilotNameLineEdit->text()));
-    newData.insert(opl::db::FLIGHTS_THIRDPILOT, pilotsIdMap.value(ui->thirdPilotNameLineEdit->text()));
+    newData.insert(Opl::Db::FLIGHTS_PIC, pilotsIdMap.value(ui->picNameLineEdit->text()));
+    newData.insert(Opl::Db::FLIGHTS_SECONDPILOT, pilotsIdMap.value(ui->secondPilotNameLineEdit->text()));
+    newData.insert(Opl::Db::FLIGHTS_THIRDPILOT, pilotsIdMap.value(ui->thirdPilotNameLineEdit->text()));
 
     // Extra Times
     ui->tSPSETimeLineEdit->text().isEmpty() ?
-                newData.insert(opl::db::FLIGHTS_TSPSE, EMPTY_STRING)
-              : newData.insert(opl::db::FLIGHTS_TSPSE, stringToMinutes(
+                newData.insert(Opl::Db::FLIGHTS_TSPSE, EMPTY_STRING)
+              : newData.insert(Opl::Db::FLIGHTS_TSPSE, stringToMinutes(
                                    ui->tSPSETimeLineEdit->text(), flightTimeFormat));
 
     ui->tSPMETimeLineEdit->text().isEmpty() ?
-                newData.insert(opl::db::FLIGHTS_TSPME, EMPTY_STRING)
-              : newData.insert(opl::db::FLIGHTS_TSPME, stringToMinutes(
+                newData.insert(Opl::Db::FLIGHTS_TSPME, EMPTY_STRING)
+              : newData.insert(Opl::Db::FLIGHTS_TSPME, stringToMinutes(
                                    ui->tSPMETimeLineEdit->text(), flightTimeFormat));
     ui->tMPTimeLineEdit->text().isEmpty() ?
-                newData.insert(opl::db::FLIGHTS_TMP, EMPTY_STRING)
-              : newData.insert(opl::db::FLIGHTS_TMP, stringToMinutes(
+                newData.insert(Opl::Db::FLIGHTS_TMP, EMPTY_STRING)
+              : newData.insert(Opl::Db::FLIGHTS_TMP, stringToMinutes(
                                    ui->tMPTimeLineEdit->text(), flightTimeFormat));
 
     if (ui->IfrCheckBox->isChecked()) {
-        newData.insert(opl::db::FLIGHTS_TIFR, block_minutes);
+        newData.insert(Opl::Db::FLIGHTS_TIFR, block_minutes);
     } else {
-        newData.insert(opl::db::FLIGHTS_TIFR, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TIFR, EMPTY_STRING);
     }
     // Night
     const auto dept_date = ui->doftLineEdit->text() + 'T'
@@ -535,97 +538,97 @@ RowData NewFlightDialog::collectInput()
                                              block_minutes,
                                              night_angle));
     const auto night_minutes = ATime::toMinutes(night_time);
-    newData.insert(opl::db::FLIGHTS_TNIGHT, night_minutes);
+    newData.insert(Opl::Db::FLIGHTS_TNIGHT, night_minutes);
 
     // Function times - This is a little explicit but these are mutually exclusive so its better to be safe than sorry here.
     switch (ui->FunctionComboBox->currentIndex()) {
     case 0://PIC
-        newData.insert(opl::db::FLIGHTS_TPIC, block_minutes);
-        newData.insert(opl::db::FLIGHTS_TPICUS, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TSIC, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TDUAL, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TFI, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TPIC, block_minutes);
+        newData.insert(Opl::Db::FLIGHTS_TPICUS, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TSIC, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TDUAL, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TFI, EMPTY_STRING);
         break;
     case 1://PICUS
-        newData.insert(opl::db::FLIGHTS_TPIC, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TPICUS, block_minutes);
-        newData.insert(opl::db::FLIGHTS_TSIC, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TDUAL, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TFI, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TPIC, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TPICUS, block_minutes);
+        newData.insert(Opl::Db::FLIGHTS_TSIC, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TDUAL, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TFI, EMPTY_STRING);
         break;
     case 2://Co-Pilot
-        newData.insert(opl::db::FLIGHTS_TPIC, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TPICUS, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TSIC, block_minutes);
-        newData.insert(opl::db::FLIGHTS_TDUAL, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TFI, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TPIC, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TPICUS, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TSIC, block_minutes);
+        newData.insert(Opl::Db::FLIGHTS_TDUAL, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TFI, EMPTY_STRING);
         break;
     case 3://Dual
-        newData.insert(opl::db::FLIGHTS_TPIC, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TPICUS, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TSIC, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TDUAL, block_minutes);
-        newData.insert(opl::db::FLIGHTS_TFI, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TPIC, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TPICUS, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TSIC, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TDUAL, block_minutes);
+        newData.insert(Opl::Db::FLIGHTS_TFI, EMPTY_STRING);
         break;
     case 4://Instructor
-        newData.insert(opl::db::FLIGHTS_TPIC, block_minutes);
-        newData.insert(opl::db::FLIGHTS_TPICUS, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TSIC, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TDUAL, EMPTY_STRING);
-        newData.insert(opl::db::FLIGHTS_TFI, block_minutes);
+        newData.insert(Opl::Db::FLIGHTS_TPIC, block_minutes);
+        newData.insert(Opl::Db::FLIGHTS_TPICUS, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TSIC, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TDUAL, EMPTY_STRING);
+        newData.insert(Opl::Db::FLIGHTS_TFI, block_minutes);
     }
     // Pilot Flying
-    newData.insert(opl::db::FLIGHTS_PILOTFLYING, ui->PilotFlyingCheckBox->isChecked());
+    newData.insert(Opl::Db::FLIGHTS_PILOTFLYING, ui->PilotFlyingCheckBox->isChecked());
     // TO and LDG - again a bit explicit, but we  need to check for both night to day as well as day to night transitions.
     if (ui->TakeoffCheckBox->isChecked()) {
         if (night_minutes == 0) { // all day
-            newData.insert(opl::db::FLIGHTS_TODAY, ui->TakeoffSpinBox->value());
-            newData.insert(opl::db::FLIGHTS_TONIGHT, 0);
+            newData.insert(Opl::Db::FLIGHTS_TODAY, ui->TakeoffSpinBox->value());
+            newData.insert(Opl::Db::FLIGHTS_TONIGHT, 0);
         } else if (night_minutes == block_minutes) { // all night
-            newData.insert(opl::db::FLIGHTS_TODAY, 0);
-            newData.insert(opl::db::FLIGHTS_TONIGHT, ui->TakeoffSpinBox->value());
+            newData.insert(Opl::Db::FLIGHTS_TODAY, 0);
+            newData.insert(Opl::Db::FLIGHTS_TONIGHT, ui->TakeoffSpinBox->value());
         } else {
             if(ACalc::isNight(ui->deptLocLineEdit->text(), dept_date_time,  night_angle)) {
-                newData.insert(opl::db::FLIGHTS_TODAY, 0);
-                newData.insert(opl::db::FLIGHTS_TONIGHT, ui->TakeoffSpinBox->value());
+                newData.insert(Opl::Db::FLIGHTS_TODAY, 0);
+                newData.insert(Opl::Db::FLIGHTS_TONIGHT, ui->TakeoffSpinBox->value());
             } else {
-                newData.insert(opl::db::FLIGHTS_TODAY, ui->TakeoffSpinBox->value());
-                newData.insert(opl::db::FLIGHTS_TONIGHT, 0);
+                newData.insert(Opl::Db::FLIGHTS_TODAY, ui->TakeoffSpinBox->value());
+                newData.insert(Opl::Db::FLIGHTS_TONIGHT, 0);
             }
         }
     } else {
-        newData.insert(opl::db::FLIGHTS_TODAY, 0);
-        newData.insert(opl::db::FLIGHTS_TONIGHT, 0);
+        newData.insert(Opl::Db::FLIGHTS_TODAY, 0);
+        newData.insert(Opl::Db::FLIGHTS_TONIGHT, 0);
     }
 
     if (ui->LandingCheckBox->isChecked()) {
         if (night_minutes == 0) { // all day
-            newData.insert(opl::db::FLIGHTS_LDGDAY, ui->LandingSpinBox->value());
-            newData.insert(opl::db::FLIGHTS_LDGNIGHT, 0);
+            newData.insert(Opl::Db::FLIGHTS_LDGDAY, ui->LandingSpinBox->value());
+            newData.insert(Opl::Db::FLIGHTS_LDGNIGHT, 0);
         } else if (night_minutes == block_minutes) { // all night
-            newData.insert(opl::db::FLIGHTS_LDGDAY, 0);
-            newData.insert(opl::db::FLIGHTS_LDGNIGHT, ui->LandingSpinBox->value());
+            newData.insert(Opl::Db::FLIGHTS_LDGDAY, 0);
+            newData.insert(Opl::Db::FLIGHTS_LDGNIGHT, ui->LandingSpinBox->value());
         } else { //check
             const auto dest_date = ui->doftLineEdit->text() + 'T'
                     + ATime::toString(tonb);
             const auto dest_date_time = QDateTime::fromString(dest_date, QStringLiteral("yyyy-MM-ddThh:mm"));
             if (ACalc::isNight(ui->destLocLineEdit->text(), dest_date_time,  night_angle)) {
-                newData.insert(opl::db::FLIGHTS_LDGDAY, 0);
-                newData.insert(opl::db::FLIGHTS_LDGNIGHT, ui->LandingSpinBox->value());
+                newData.insert(Opl::Db::FLIGHTS_LDGDAY, 0);
+                newData.insert(Opl::Db::FLIGHTS_LDGNIGHT, ui->LandingSpinBox->value());
             } else {
-                newData.insert(opl::db::FLIGHTS_LDGDAY, ui->LandingSpinBox->value());
-                newData.insert(opl::db::FLIGHTS_LDGNIGHT, 0);
+                newData.insert(Opl::Db::FLIGHTS_LDGDAY, ui->LandingSpinBox->value());
+                newData.insert(Opl::Db::FLIGHTS_LDGNIGHT, 0);
             }
         }
     } else {
-        newData.insert(opl::db::FLIGHTS_LDGDAY, 0);
-        newData.insert(opl::db::FLIGHTS_LDGNIGHT, 0);
+        newData.insert(Opl::Db::FLIGHTS_LDGDAY, 0);
+        newData.insert(Opl::Db::FLIGHTS_LDGNIGHT, 0);
     }
 
-    newData.insert(opl::db::FLIGHTS_AUTOLAND, ui->AutolandSpinBox->value());
-    newData.insert(opl::db::FLIGHTS_APPROACHTYPE, ui->ApproachComboBox->currentText());
-    newData.insert(opl::db::FLIGHTS_FLIGHTNUMBER, ui->FlightNumberLineEdit->text());
-    newData.insert(opl::db::FLIGHTS_REMARKS, ui->RemarksLineEdit->text());
+    newData.insert(Opl::Db::FLIGHTS_AUTOLAND, ui->AutolandSpinBox->value());
+    newData.insert(Opl::Db::FLIGHTS_APPROACHTYPE, ui->ApproachComboBox->currentText());
+    newData.insert(Opl::Db::FLIGHTS_FLIGHTNUMBER, ui->FlightNumberLineEdit->text());
+    newData.insert(Opl::Db::FLIGHTS_REMARKS, ui->RemarksLineEdit->text());
 
     DEB << "New Flight Data: " << newData;
 
@@ -710,18 +713,18 @@ void NewFlightDialog::formFiller()
         }
     }
     // Approach Combo Box
-    const QString& app = flightEntry.getData().value(opl::db::FLIGHTS_APPROACHTYPE).toString();
+    const QString& app = flightEntry.getData().value(Opl::Db::FLIGHTS_APPROACHTYPE).toString();
     if(app != EMPTY_STRING){
         ui->ApproachComboBox->setCurrentText(app);
     }
     // Task and Rules
-    qint8 PF = flightEntry.getData().value(opl::db::FLIGHTS_PILOTFLYING).toInt();
+    qint8 PF = flightEntry.getData().value(Opl::Db::FLIGHTS_PILOTFLYING).toInt();
     if (PF > 0) {
         ui->PilotFlyingCheckBox->setChecked(true);
     } else {
         ui->PilotMonitoringCheckBox->setChecked(true);
     }
-    qint8 FR = flightEntry.getData().value(opl::db::FLIGHTS_TIFR).toInt();
+    qint8 FR = flightEntry.getData().value(Opl::Db::FLIGHTS_TIFR).toInt();
     if (FR > 0) {
         ui->IfrCheckBox->setChecked(true);
     } else {
@@ -729,10 +732,10 @@ void NewFlightDialog::formFiller()
         ui->VfrCheckBox->setChecked(true);
     }
     // Take Off and Landing
-    qint8 TO = flightEntry.getData().value(opl::db::FLIGHTS_TODAY).toInt()
-            + flightEntry.getData().value(opl::db::FLIGHTS_TONIGHT).toInt();
-    qint8 LDG = flightEntry.getData().value(opl::db::FLIGHTS_LDGDAY).toInt()
-            + flightEntry.getData().value(opl::db::FLIGHTS_LDGNIGHT).toInt();
+    qint8 TO = flightEntry.getData().value(Opl::Db::FLIGHTS_TODAY).toInt()
+            + flightEntry.getData().value(Opl::Db::FLIGHTS_TONIGHT).toInt();
+    qint8 LDG = flightEntry.getData().value(Opl::Db::FLIGHTS_LDGDAY).toInt()
+            + flightEntry.getData().value(Opl::Db::FLIGHTS_LDGNIGHT).toInt();
     if(TO > 0) {
         ui->TakeoffCheckBox->setChecked(true);
         ui->TakeoffSpinBox->setValue(TO);
@@ -747,7 +750,7 @@ void NewFlightDialog::formFiller()
         ui->LandingCheckBox->setChecked(false);
         ui->LandingSpinBox->setValue(0);
     }
-    qint8 AL = flightEntry.getData().value(opl::db::FLIGHTS_AUTOLAND).toInt();
+    qint8 AL = flightEntry.getData().value(Opl::Db::FLIGHTS_AUTOLAND).toInt();
     if(AL > 0) {
         ui->AutolandCheckBox->setChecked(true);
         ui->AutolandSpinBox->setValue(AL);
@@ -1186,7 +1189,7 @@ void NewFlightDialog::onPilotNameLineEdit_editingFinished()
         DEB << "self recognized.";
         line_edit->setText(pilotsIdMap.key(1));
         auto pilot = aDB->getPilotEntry(1);
-        ui->picCompanyLabel->setText(pilot.getData().value(opl::db::TAILS_COMPANY).toString());
+        ui->picCompanyLabel->setText(pilot.getData().value(Opl::Db::TAILS_COMPANY).toString());
         onGoodInputReceived(line_edit);
         return;
     }
@@ -1194,7 +1197,7 @@ void NewFlightDialog::onPilotNameLineEdit_editingFinished()
     if(pilotsIdMap.value(line_edit->text()) != 0) {
         DEB << "Mapped: " << line_edit->text() << pilotsIdMap.value(line_edit->text());
         auto pilot = aDB->getPilotEntry(pilotsIdMap.value(line_edit->text()));
-        ui->picCompanyLabel->setText(pilot.getData().value(opl::db::TAILS_COMPANY).toString());
+        ui->picCompanyLabel->setText(pilot.getData().value(Opl::Db::TAILS_COMPANY).toString());
         onGoodInputReceived(line_edit);
         return;
     }
@@ -1288,13 +1291,22 @@ void NewFlightDialog::on_manualEditingCheckBox_stateChanged(int arg1)
 
 void NewFlightDialog::on_ApproachComboBox_currentTextChanged(const QString &arg1)
 {
-    if(arg1 == "ILS CAT III"){  //for a CAT III approach an Autoland is mandatory, so we can preselect it.
+    if(arg1 == QStringLiteral("ILS CAT III")){  //for a CAT III approach an Autoland is mandatory, so we can preselect it.
         ui->AutolandCheckBox->setCheckState(Qt::Checked);
         ui->AutolandSpinBox->setValue(1);
     }else{
         ui->AutolandCheckBox->setCheckState(Qt::Unchecked);
         ui->AutolandSpinBox->setValue(0);
     }
+
+    if (arg1 != QStringLiteral("VISUAL"))
+        ui->IfrCheckBox->setChecked(true);
+
+    if (arg1 == QStringLiteral("OTHER")) {
+        QMessageBox message_box(this);
+        message_box.setText(QStringLiteral("You can specify the approach type in the Remarks field."));
+        message_box.exec();
+    }
 }
 
 void NewFlightDialog::on_FunctionComboBox_currentIndexChanged(int)

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

@@ -118,7 +118,7 @@ private:
     QMap<QString, int> airportIataIdMap;
     QMap<QString, int> airportNameIdMap;
 
-    opl::time::FlightTimeFormat flightTimeFormat;
+    Opl::Time::FlightTimeFormat flightTimeFormat;
 
     /*!
      * \brief If the user elects to manually edit function times, automatic updating
@@ -151,7 +151,7 @@ private:
      * \brief converts a time string as used in the UI to an integer of minutes for
      * use in the database based on the format in use in the Dialog
      */
-    inline int stringToMinutes(const QString &time_string, opl::time::FlightTimeFormat format)
+    inline int stringToMinutes(const QString &time_string, Opl::Time::FlightTimeFormat format)
     {
         return ATime::toMinutes(ATime::fromString(time_string, format));
     }
@@ -160,7 +160,7 @@ private:
      * \brief minutesToString converts an integer of minutes as received from the database
      * to a String to be displayed in the UI, based on the format in use in the Dialog.
      */
-    inline QString minutesToString(const int minutes, opl::time::FlightTimeFormat format)
+    inline QString minutesToString(const int minutes, Opl::Time::FlightTimeFormat format)
     {
         return ATime::toString(ATime::fromMinutes(minutes), format);
     }

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

@@ -128,10 +128,10 @@ void NewTailDialog::fillForm(AEntry 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::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);
 }
 
 /*!
@@ -194,16 +194,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::Db::TAILS_MULTIPILOT, 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::Db::TAILS_MULTIENGINE, 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::Db::TAILS_ENGINETYPE, 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::Db::TAILS_WEIGHTCLASS, ui->weightComboBox->currentIndex() - 1);
     }
 
     //create db object

+ 1 - 8
src/gui/widgets/debugwidget.cpp

@@ -4,6 +4,7 @@
 #include "src/gui/widgets/logbookwidget.h"
 #include "src/gui/widgets/pilotswidget.h"
 #include "src/gui/widgets/aircraftwidget.h"
+#include "src/gui/dialogues/firstrundialog.h"
 #include <QtGlobal>
 #include "src/functions/atime.h"
 
@@ -166,14 +167,6 @@ void DebugWidget::on_importCsvPushButton_clicked()
 
 void DebugWidget::on_debugPushButton_clicked()
 {
-    QTime time(13,47,0);
-    int minutes = 143;
-
-
-    DEB << ATime::toString(time);
-    DEB << ATime::toString(time, opl::time::Decimal);
-    DEB << ATime::toString(minutes);
-    DEB << ATime::toString(minutes, opl::time::Decimal);
     // debug space
 }
 

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

@@ -54,6 +54,19 @@ SettingsWidget::SettingsWidget(QWidget *parent) :
     ui->setupUi(this);
     ui->tabWidget->setCurrentIndex(0);
 
+    setupComboBoxes();
+    setupValidators();
+    readSettings();
+}
+
+
+SettingsWidget::~SettingsWidget()
+{
+    delete ui;
+}
+
+void SettingsWidget::setupComboBoxes(){
+    // Style Combo Box
     auto styles = AStyle::styles;
     auto current_style = AStyle::style();
     ui->styleComboBox->addItem(current_style);
@@ -65,15 +78,10 @@ SettingsWidget::SettingsWidget(QWidget *parent) :
 
     if(ASettings::read(ASettings::Main::StyleSheet).toUInt() == AStyle::Dark)
         ui->darkStyleCheckBox->setCheckState(Qt::Checked);
-
-    readSettings();
-    setupValidators();
-}
-
-
-SettingsWidget::~SettingsWidget()
-{
-    delete ui;
+    // Approach Combo Box
+    for (const auto &approach : Opl::ApproachTypes) {
+        ui->approachComboBox->addItem(approach);
+    }
 }
 
 void SettingsWidget::readSettings()
@@ -84,12 +92,12 @@ void SettingsWidget::readSettings()
     {
         const QSignalBlocker blocker(this); // don't emit editing finished for setting these values
         auto user_data = aDB->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::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());
     }
 
     /*
@@ -131,10 +139,10 @@ void SettingsWidget::updatePersonalDetails()
     RowData user_data;
     switch (ui->aliasComboBox->currentIndex()) {
     case 0:
-        user_data.insert(opl::db::PILOTS_ALIAS, QStringLiteral("self"));
+        user_data.insert(Opl::Db::PILOTS_ALIAS, QStringLiteral("self"));
         break;
     case 1:
-        user_data.insert(opl::db::PILOTS_ALIAS, QStringLiteral("SELF"));
+        user_data.insert(Opl::Db::PILOTS_ALIAS, QStringLiteral("SELF"));
         break;
     case 2:{
         QString name;
@@ -142,18 +150,18 @@ void SettingsWidget::updatePersonalDetails()
         name.append(QLatin1String(", "));
         name.append(ui->firstnameLineEdit->text().left(1));
         name.append(QLatin1Char('.'));
-        user_data.insert(opl::db::PILOTS_ALIAS, name);
+        user_data.insert(Opl::Db::PILOTS_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::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());
 
     auto user = APilotEntry(1);
     user.setData(user_data);

+ 3 - 0
src/gui/widgets/settingswidget.h

@@ -67,7 +67,10 @@ private:
 
     void setupValidators();
 
+    void setupComboBoxes();
+
     void updatePersonalDetails();
+
 signals:
     void viewSelectionChanged(int view_id);
 };

+ 2 - 108
src/gui/widgets/settingswidget.ui

@@ -17,7 +17,7 @@
    <item row="0" column="1">
     <widget class="QTabWidget" name="tabWidget">
      <property name="currentIndex">
-      <number>2</number>
+      <number>1</number>
      </property>
      <widget class="QWidget" name="personalTab">
       <attribute name="title">
@@ -282,113 +282,7 @@
         </widget>
        </item>
        <item row="3" column="2">
-        <widget class="QComboBox" name="approachComboBox">
-         <item>
-          <property name="text">
-           <string>VISUAL</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>ILS CAT I</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>ILS CAT II</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>ILS CAT III</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>GLS</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>MLS</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>LOC</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>LOC/DME</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (LNAV)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (LNAV/VNAV)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (LPV)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (RNP)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>RNAV (RNP-AR)</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>VOR</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>VOR/DME</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>NDB</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>NDB/DME</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>TACAN</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>SRA</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>PAR</string>
-          </property>
-         </item>
-        </widget>
+        <widget class="QComboBox" name="approachComboBox"/>
        </item>
        <item row="3" column="3">
         <spacer name="horizontalSpacer_4">

+ 31 - 6
src/oplconstants.h

@@ -17,21 +17,46 @@
  *  The db namespace contains constants for programatically accessing the database in a fast
  *  and uniform manner.
  */
-namespace opl {
-
-namespace date {
+namespace Opl {
+
+static const auto ApproachTypes = QStringList{
+        QStringLiteral("VISUAL"),
+        QStringLiteral("ILS CAT I"),
+        QStringLiteral("ILS CAT II"),
+        QStringLiteral("ILS CAT III"),
+        QStringLiteral("GLS"),
+        QStringLiteral("MLS"),
+        QStringLiteral("LOC"),
+        QStringLiteral("LOC/DME"),
+        QStringLiteral("RNAV"),
+        QStringLiteral("RNAV (LNAV)"),
+        QStringLiteral("RNAV (LNAV/VNAV)"),
+        QStringLiteral("RNAV (LPV)"),
+        QStringLiteral("RNAV (RNP)"),
+        QStringLiteral("RNAV (RNP-AR)"),
+        QStringLiteral("VOR"),
+        QStringLiteral("VOR/DME"),
+        QStringLiteral("NDB"),
+        QStringLiteral("NDB/DME"),
+        QStringLiteral("TACAN"),
+        QStringLiteral("SRA"),
+        QStringLiteral("PAR"),
+        QStringLiteral("OTHER")
+};
+
+namespace Date {
 
 enum DateFormat {Default, Text};
 
 } // namespace opl::date
 
-namespace time {
+namespace Time {
 
 enum FlightTimeFormat {Default, Decimal};
 
 } // namespace opl::time
 
-namespace datetime {
+namespace Datetime {
 
 enum DateTimeFormat {Default, Backup};
 
@@ -52,7 +77,7 @@ enum DateTimeFormat {Default, Backup};
  *  qstrings like ("dept"). See https://doc.qt.io/qt-5/qstring.html#QStringLiteral and ensures
  *  uniform use throughout the application.
  */
-namespace db {
+namespace Db {
 
 
 // Table names