Explorar el Código

Cleaned up Settings and FirstRunDialog

- Got rid of unused settings and some deprecated functions.
- Polished the FirstRunDialog
- Added QSignalBlockers in Settingswidget where needed to prevent unwanted writes to settings during UI setup
- Deactivated custom styles for first run to ensure compatibility with all target systems
- Removed references and artifacts from features that are not implemented or discontinued
Felix hace 3 años
padre
commit
6d5cc35440

+ 1 - 1
assets/database/templates/aircraft.md5

@@ -1 +1 @@
-80ba2debfd085e21fcf7602a9f473471  aircraft.json
+ 169ebcc94b62d82f8d29e25e6a1b1518 aircraft.json

+ 1 - 1
assets/database/templates/airports.md5

@@ -1 +1 @@
-b9467aeeddc6d4bcaffdccd934008586  airports.json
+004aa1ade67b7765efe9b80eae803624 airports.json

+ 5 - 3
main.cpp

@@ -67,14 +67,15 @@ void init()
     //ATranslator::installTranslator(Opl::Translations::English);
 }
 
-void firstRun()
+bool firstRun()
 {
     if(FirstRunDialog().exec() == QDialog::Rejected){
         LOG << "Initial setup incomplete or unsuccessfull.";
-        return;
+        return false;
     }
     ASettings::write(ASettings::Main::SetupComplete, true);
     LOG << "Initial Setup Completed successfully";
+    return true;
 }
 } // namespace Main
 
@@ -97,7 +98,8 @@ int main(int argc, char *argv[])
 
     // Check for First Run and launch Setup Wizard
     if (!ASettings::read(ASettings::Main::SetupComplete).toBool())
-        Main::firstRun();
+        if(!Main::firstRun())
+            return 0;
 
     // Create Main Window and set Window Icon acc. to Platform
     MainWindow w;

+ 1 - 8
src/classes/asettings.cpp

@@ -33,7 +33,6 @@ QMap<ASettings::UserData, QString> ASettings::userDataMap = {
     {UserData::DisplaySelfAs,           QStringLiteral("displayselfas")},
     {UserData::TailSortColumn,          QStringLiteral("tailSortColumn")},
     {UserData::PilotSortColumn,         QStringLiteral("pilotSortColumn")},
-    {UserData::AcftAllowIncomplete,     QStringLiteral("acftAllowIncomplete")},
     {UserData::FtlWarningThreshold,     QStringLiteral("ftlWarningThreshold")},
     {UserData::CurrWarningThreshold,    QStringLiteral("currWarningThreshold")},
     {UserData::ShowToLgdCurrency,       QStringLiteral("showToLdgCurrency")},
@@ -53,13 +52,9 @@ QMap<ASettings::FlightLogging, QString> ASettings::flightLoggingMap = {
     {FlightLogging::NightLoggingEnabled,QStringLiteral("nightLoggingEnabled")},
     {FlightLogging::LogIFR,             QStringLiteral("logIfr")},
     {FlightLogging::FlightNumberPrefix, QStringLiteral("flightnumberPrefix")},
-    {FlightLogging::NumberTakeoffs,     QStringLiteral("numberTakeoffs")},
-    {FlightLogging::NumberLandings,     QStringLiteral("numberLandings")},
     {FlightLogging::PilotFlying,        QStringLiteral("pilotFlying")},
     {FlightLogging::NightAngle,         QStringLiteral("nightangle")},
-    {FlightLogging::Rules,              QStringLiteral("rules")},
-    {FlightLogging::FlightTimeFormat,   QStringLiteral("flightTimeFormat")},
-    {FlightLogging::FunctionComboBox,   QStringLiteral("functionComboBox")},
+    //{FlightLogging::FlightTimeFormat,   QStringLiteral("flightTimeFormat")},
 };
 
 void ASettings::setup()
@@ -89,8 +84,6 @@ void ASettings::resetToDefaults()
     write(UserData::ShowCustom1Currency, false);
     write(UserData::ShowCustom2Currency, false);
 
-    write(FlightLogging::NumberTakeoffs, 1);
-    write(FlightLogging::NumberLandings, 1);
     write(FlightLogging::PilotFlying, true);
     write(FlightLogging::NightAngle, -6);
 }

+ 2 - 6
src/classes/asettings.h

@@ -40,7 +40,6 @@ public:
         DisplaySelfAs,
         TailSortColumn,
         PilotSortColumn,
-        AcftAllowIncomplete,
         FtlWarningThreshold,
         CurrWarningThreshold,
         ShowToLgdCurrency,
@@ -60,13 +59,9 @@ public:
         NightLoggingEnabled,
         LogIFR,
         FlightNumberPrefix,
-        NumberTakeoffs,
-        NumberLandings,
         PilotFlying,
         NightAngle,
-        Rules,
-        FlightTimeFormat,
-        FunctionComboBox,
+        //FlightTimeFormat,
     };
 
     /*!
@@ -99,6 +94,7 @@ public:
     static QString stringOfKey(const UserData key);
 
     static QSettings settings();
+    static void sync() { QSettings().sync(); }
 
 private:
     static QMap<Main, QString> mainMap;

+ 2 - 0
src/classes/astyle.cpp

@@ -46,6 +46,8 @@ QString AStyle::currentStyle = defaultStyle;
  */
 void AStyle::setup()
 {
+    if (!ASettings::read(ASettings::Main::SetupComplete).toBool()) // Use system default for first run
+        return;
     // Set Font
     if (!ASettings::read(ASettings::Main::UseSystemFont).toBool()) {
         QFont font(ASettings::read(ASettings::Main::Font).toString());

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

@@ -43,10 +43,10 @@ FirstRunDialog::FirstRunDialog(QWidget *parent) :
     ui->previousPushButton->setEnabled(false);
     ui->logoLabel->setPixmap(QPixmap(Opl::Assets::LOGO));
 
-    // approach Combo Box
-    for (const auto &approach : Opl::ApproachTypes){
-        ui->approachComboBox->addItem(approach);
-    }
+    // Approach Combo Box and Function Combo Box
+    Opl::loadApproachTypes(ui->approachComboBox);
+    Opl::loadPilotFunctios(ui->functionComboBox);
+
     // Style combo box
     const QSignalBlocker blocker_style(ui->styleComboBox);
     ui->styleComboBox->addItems(AStyle::styles);
@@ -58,16 +58,11 @@ FirstRunDialog::FirstRunDialog(QWidget *parent) :
     ui->styleComboBox->setCurrentText(AStyle::defaultStyle);
     // Prepare Date Edits
     dateEdits = this->findChildren<QDateEdit *>();
-    for (const auto &date_format : ADate::getDisplayNames())
-        ui->dateFormatComboBox->addItem(date_format);
-    // Set Date Edits for currencies
     for (const auto &date_edit : qAsConst(dateEdits)) {
         date_edit->setDisplayFormat(
                     ADate::getFormatString(Opl::Date::ADateFormat::ISODate));
         date_edit->setDate(QDate::currentDate());
     }
-    // De-activate non-default date formats for now, implement in future version
-    ui->dateFormatComboBox->setVisible(false);
     // Debug - use ctrl + t to enable branchLineEdit to select from which git branch the templates are pulled
     ui->branchLineEdit->setVisible(false);
 }
@@ -102,7 +97,7 @@ void FirstRunDialog::on_nextPushButton_clicked()
         if(ui->firstnameLineEdit->text().isEmpty()
            || ui->lastnameLineEdit->text().isEmpty())
         {
-            QMessageBox(QMessageBox::Warning, tr("Error"),
+            QMessageBox(QMessageBox::Information, tr("No name entered"),
                         tr("Please enter first and last name")
                         ).exec();
             return;
@@ -217,10 +212,7 @@ bool FirstRunDialog::downloadTemplates(QString branch_name)
         QObject::connect(dl, &ADownload::done, &loop, &QEventLoop::quit );
         dl->setTarget(QUrl(template_url_string + table + QLatin1String(".json")));
         dl->setFileName(template_dir.absoluteFilePath(table + QLatin1String(".json")));
-
         DEB << "Downloading: " << template_url_string + table + QLatin1String(".json");
-        DEB << "To:" << AStandardPaths::directory(AStandardPaths::Templates);
-
         dl->download();
         dl->deleteLater();
         loop.exec(); // event loop waits for download done signal before allowing loop to continue
@@ -238,7 +230,6 @@ bool FirstRunDialog::downloadTemplates(QString branch_name)
         dl->setFileName(template_dir.absoluteFilePath(table + QLatin1String(".md5")));
 
         DEB << "Downloading: " << template_url_string + table + QLatin1String(".md5");
-        DEB << "To:" << AStandardPaths::directory(AStandardPaths::Templates);
 
         dl->download();
         dl->deleteLater();
@@ -271,19 +262,10 @@ bool FirstRunDialog::verifyTemplates()
 void FirstRunDialog::writeSettings()
 {
     ASettings::resetToDefaults();
-    ASettings::write(ASettings::FlightLogging::Function, ui->functionComboBox->currentText());
+
+    ASettings::write(ASettings::FlightLogging::Function, ui->functionComboBox->currentIndex());
     ASettings::write(ASettings::FlightLogging::Approach, ui->approachComboBox->currentIndex());
-    switch (ui->nightComboBox->currentIndex()) {
-    case 0:
-        ASettings::write(ASettings::FlightLogging::NightLoggingEnabled, true);
-        break;
-    case 1:
-        ASettings::write(ASettings::FlightLogging::NightLoggingEnabled, false);
-        break;
-    default:
-        ASettings::write(ASettings::FlightLogging::NightLoggingEnabled, true);
-        break;
-    }
+    ASettings::write(ASettings::FlightLogging::NightLoggingEnabled, ui->nightComboBox->currentIndex());
     switch (ui->nightRulesComboBox->currentIndex()) {
     case 0:
         ASettings::write(ASettings::FlightLogging::NightAngle, -6);
@@ -291,17 +273,13 @@ void FirstRunDialog::writeSettings()
     case 1:
         ASettings::write(ASettings::FlightLogging::NightAngle, 0);
         break;
-
     }
     ASettings::write(ASettings::FlightLogging::LogIFR, ui->rulesComboBox->currentIndex());
     ASettings::write(ASettings::FlightLogging::FlightNumberPrefix, ui->prefixLineEdit->text());
-    ASettings::write(ASettings::FlightLogging::FlightTimeFormat, Opl::Time::Default);
     ASettings::write(ASettings::UserData::DisplaySelfAs, ui->aliasComboBox->currentIndex());
     ASettings::write(ASettings::Main::LogbookView, ui->logbookViewComboBox->currentIndex());
-
     ASettings::write(ASettings::Main::Style, ui->styleComboBox->currentText());
-    QSettings settings;
-    settings.sync();
+    ASettings::sync();
 }
 
 bool FirstRunDialog::setupDatabase()
@@ -391,7 +369,6 @@ void FirstRunDialog::reject()
     confirm.setDefaultButton(QMessageBox::No);
 
     if (confirm.exec() == QMessageBox::Yes) {
-        DEB << "rejected.";
         QDialog::reject();
     }
 }
@@ -410,7 +387,6 @@ void FirstRunDialog::on_styleComboBox_currentTextChanged(const QString &new_styl
 {
     DEB << "style selected:"<<new_style_setting;
     if (new_style_setting == QLatin1String("Dark-Palette")) {
-        //DEB << "Palette";
         AStyle::setStyle(AStyle::darkPalette());
         return;
     }
@@ -440,17 +416,6 @@ void FirstRunDialog::on_currCustom2LineEdit_editingFinished()
     ASettings::write(ASettings::UserData::Custom2CurrencyName, ui->currCustom2LineEdit->text());
 }
 
-void FirstRunDialog::on_dateFormatComboBox_currentIndexChanged(int index)
-{
-    Opl::Date::ADateFormat format = (Opl::Date::ADateFormat)index;
-
-    for (const auto &date_edit : qAsConst(dateEdits)) {
-        date_edit->setDisplayFormat(
-                    ADate::getFormatString(format));
-    }
-    ASettings::write(ASettings::Main::DateFormat, index);
-}
-
 void FirstRunDialog::on_importPushButton_clicked()
 {
     QString filename = QFileDialog::getOpenFileName(

+ 0 - 6
src/gui/dialogues/firstrundialog.h

@@ -39,17 +39,11 @@ public:
 private slots:
 
     void on_previousPushButton_clicked();
-
     void on_nextPushButton_clicked();
-
     void on_styleComboBox_currentTextChanged(const QString &new_style_setting);
-
     void on_currCustom1LineEdit_editingFinished();
-
     void on_currCustom2LineEdit_editingFinished();
 
-    void on_dateFormatComboBox_currentIndexChanged(int index);
-
     /*!
      * \brief Import an existing database instead of creating a new one
      */

+ 60 - 80
src/gui/dialogues/firstrundialog.ui

@@ -11,27 +11,20 @@
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Welcome to openPilotLog</string>
   </property>
   <layout class="QGridLayout" name="gridLayout">
-   <item row="2" column="0">
+   <item row="3" column="0">
     <widget class="QPushButton" name="previousPushButton">
      <property name="text">
       <string>Previous</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="1">
-    <widget class="QPushButton" name="nextPushButton">
-     <property name="text">
-      <string>Next</string>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="0" colspan="2">
+   <item row="2" column="0" colspan="2">
     <widget class="QStackedWidget" name="stackedWidget">
      <property name="currentIndex">
-      <number>2</number>
+      <number>0</number>
      </property>
      <widget class="QWidget" name="personalDataPage">
       <layout class="QGridLayout" name="gridLayout_9">
@@ -140,7 +133,7 @@
        <item row="0" column="0">
         <widget class="QLabel" name="label">
          <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;Welcome to openPilotLog!&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;The Free and Open Source Logbook application&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Before getting started, we need to quickly run through this initial set-up process. Please note that none of the data you put in will be stored in any place other than your own personal computer and will only be used to fill out information in your logbook.&lt;/p&gt;&lt;p&gt;OpenPilotLog does not collect, sell or use your private data for any commercial purpose.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:16pt; font-weight:700;&quot;&gt;The Free and Open Source Logbook application&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Before getting started, we need to quickly run through this initial set-up process. Please note that none of the data you put in will be stored in any place other than your own personal computer and will only be used to fill out information in your logbook.&lt;/p&gt;&lt;p&gt;OpenPilotLog does not collect, sell or use your private data for any commercial purpose.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <property name="textFormat">
           <enum>Qt::RichText</enum>
@@ -161,7 +154,7 @@
           <string>If you already have been using openPilotLog before and wish to continue your logbook, skip this initial setup process and import your database instead.</string>
          </property>
          <property name="text">
-          <string>Already have a logbook database?</string>
+          <string>Already have a openPilotLog database?</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignBottom|Qt::AlignHCenter</set>
@@ -172,7 +165,27 @@
      </widget>
      <widget class="QWidget" name="currencyPage">
       <layout class="QGridLayout" name="gridLayout_6">
-       <item row="3" column="0" colspan="2">
+       <item row="1" column="0" colspan="2">
+        <widget class="Line" name="line">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="0" colspan="2">
+        <widget class="QLabel" name="label_6">
+         <property name="text">
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;Welcome to openPilotLog!&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;The Free and Open Source Logbook application&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;If you would like to keep track of your license and/or medical expiration dates, you can enter them here. By default, only Take-Off and Landing currency is shown on the home page, but any other currency can also be shown as well. This can be enabled in the settings menu.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <property name="textFormat">
+          <enum>Qt::RichText</enum>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="0" colspan="2">
         <layout class="QGridLayout" name="gridLayout_5">
          <item row="0" column="1">
           <widget class="QDateEdit" name="currLicDateEdit">
@@ -183,10 +196,10 @@
             </size>
            </property>
            <property name="currentSection">
-            <enum>QDateTimeEdit::MonthSection</enum>
+            <enum>QDateTimeEdit::YearSection</enum>
            </property>
            <property name="displayFormat">
-            <string>MM/dd/yyyy</string>
+            <string>yyyy-MM-dd</string>
            </property>
            <property name="calendarPopup">
             <bool>true</bool>
@@ -228,10 +241,10 @@
             </size>
            </property>
            <property name="currentSection">
-            <enum>QDateTimeEdit::MonthSection</enum>
+            <enum>QDateTimeEdit::YearSection</enum>
            </property>
            <property name="displayFormat">
-            <string>MM/dd/yyyy</string>
+            <string>yyyy-MM-dd</string>
            </property>
            <property name="calendarPopup">
             <bool>true</bool>
@@ -257,10 +270,10 @@
             </size>
            </property>
            <property name="currentSection">
-            <enum>QDateTimeEdit::MonthSection</enum>
+            <enum>QDateTimeEdit::YearSection</enum>
            </property>
            <property name="displayFormat">
-            <string>MM/dd/yyyy</string>
+            <string>yyyy-MM-dd</string>
            </property>
            <property name="calendarPopup">
             <bool>true</bool>
@@ -338,10 +351,10 @@
             </size>
            </property>
            <property name="currentSection">
-            <enum>QDateTimeEdit::MonthSection</enum>
+            <enum>QDateTimeEdit::YearSection</enum>
            </property>
            <property name="displayFormat">
-            <string>MM/dd/yyyy</string>
+            <string>yyyy-MM-dd</string>
            </property>
            <property name="calendarPopup">
             <bool>true</bool>
@@ -367,10 +380,10 @@
             </size>
            </property>
            <property name="currentSection">
-            <enum>QDateTimeEdit::MonthSection</enum>
+            <enum>QDateTimeEdit::YearSection</enum>
            </property>
            <property name="displayFormat">
-            <string>MM/dd/yyyy</string>
+            <string>yyyy-MM-dd</string>
            </property>
            <property name="calendarPopup">
             <bool>true</bool>
@@ -396,10 +409,10 @@
             </size>
            </property>
            <property name="currentSection">
-            <enum>QDateTimeEdit::MonthSection</enum>
+            <enum>QDateTimeEdit::YearSection</enum>
            </property>
            <property name="displayFormat">
-            <string>MM/dd/yyyy</string>
+            <string>yyyy-MM-dd</string>
            </property>
            <property name="calendarPopup">
             <bool>true</bool>
@@ -431,36 +444,6 @@
          </item>
         </layout>
        </item>
-       <item row="2" column="0" colspan="2">
-        <widget class="Line" name="line">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="dateFormatLabel">
-         <property name="text">
-          <string>Date Format</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1">
-        <widget class="QComboBox" name="dateFormatComboBox"/>
-       </item>
-       <item row="0" column="0" colspan="2">
-        <widget class="QLabel" name="label_6">
-         <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;Welcome to openPilotLog!&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;The Free and Open Source Logbook application&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;If you would like to keep track of your license and/or medical expiration dates, you can enter them here. By default, only Take-Off and Landing currency is shown on the home page, but any other currency can also be shown as well. This can be enabled in the settings.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="textFormat">
-          <enum>Qt::RichText</enum>
-         </property>
-         <property name="wordWrap">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="flightLoggingPage">
@@ -501,26 +484,6 @@
              <height>0</height>
             </size>
            </property>
-           <item>
-            <property name="text">
-             <string>PIC</string>
-            </property>
-           </item>
-           <item>
-            <property name="text">
-             <string>SIC</string>
-            </property>
-           </item>
-           <item>
-            <property name="text">
-             <string>DUAL</string>
-            </property>
-           </item>
-           <item>
-            <property name="text">
-             <string>INSTRUCTOR</string>
-            </property>
-           </item>
           </widget>
          </item>
          <item row="1" column="0">
@@ -600,14 +563,17 @@
              <height>0</height>
             </size>
            </property>
+           <property name="currentIndex">
+            <number>1</number>
+           </property>
            <item>
             <property name="text">
-             <string>Yes</string>
+             <string>No</string>
             </property>
            </item>
            <item>
             <property name="text">
-             <string>No</string>
+             <string>Yes</string>
             </property>
            </item>
           </widget>
@@ -683,7 +649,7 @@
        <item row="0" column="0">
         <widget class="QLabel" name="label_8">
          <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;Welcome to openPilotLog!&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;The Free and Open Source Logbook application&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Here you can customize the appearance of your logbook, like how your name should be displayed in the logbook or the theme of the app.&lt;/p&gt;&lt;p&gt;The logbook views determine how your logbook is displayed. The default view is a compact overview with all the essential information displayed, whereas the EASA view is modelled after the EASA guidelines for logbooks and contains more fields. Please note that these only affects how your logbook is displayed. In both views, you have the possibility to log all the details of a specific flight. You can change the view at any time from the settings page.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;Welcome to openPilotLog!&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;The Free and Open Source Logbook application&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;Here you can customize the appearance of your logbook, like how your name should be displayed in the logbook or the theme of the app. For the best cross-platform experience, we recommend the Fusion theme.&lt;/p&gt;&lt;p&gt;The logbook views determine how your logbook is displayed. The default view is a compact overview with all the essential information displayed, optimised for viewing on a comptuter screen. The EASA view is modelled after the EASA guidelines for logbooks and contains more fields. Please note that these only affects how your logbook is displayed. In both views, you have the possibility to log all the details of a specific flight. You can change the view at any time from the settings page.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <property name="textFormat">
           <enum>Qt::RichText</enum>
@@ -818,7 +784,14 @@
      </widget>
     </widget>
    </item>
-   <item row="0" column="0" colspan="2">
+   <item row="3" column="1">
+    <widget class="QPushButton" name="nextPushButton">
+     <property name="text">
+      <string>Next</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" colspan="2">
     <widget class="QLabel" name="logoLabel">
      <property name="text">
       <string/>
@@ -828,6 +801,13 @@
      </property>
     </widget>
    </item>
+   <item row="0" column="0" colspan="2">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:20pt; font-weight:700;&quot;&gt;Welcome to&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <tabstops>

+ 7 - 8
src/gui/dialogues/newflightdialog.cpp

@@ -39,12 +39,12 @@ NewFlightDialog::NewFlightDialog(ACompletionData &completion_data,
     flightEntry = AFlightEntry();
     // Set up UI (New Flight)
     LOG << ASettings::read(ASettings::FlightLogging::Function);
-    if(ASettings::read(ASettings::FlightLogging::Function).toString() == QLatin1String("PIC")){
+    if(ASettings::read(ASettings::FlightLogging::Function).toInt() == Opl::PIC){
         ui->picNameLineEdit->setText(self);
         ui->functionComboBox->setCurrentIndex(0);
         emit ui->picNameLineEdit->editingFinished();
     }
-    if (ASettings::read(ASettings::FlightLogging::Function).toString() == QLatin1String("SIC")) {
+    if (ASettings::read(ASettings::FlightLogging::Function).toInt() == Opl::SIC) {
         ui->sicNameLineEdit->setText(self);
         ui->functionComboBox->setCurrentIndex(2);
         emit ui->sicNameLineEdit->editingFinished();
@@ -88,10 +88,9 @@ void NewFlightDialog::init()
 
     for (const auto& line_edit : *mandatoryLineEdits)
         line_edit->installEventFilter(this);
-
-    for (const auto & approach : Opl::ApproachTypes){
-        ui->approachComboBox->addItem(approach);
-    }
+    // Approach Combo Box and Function Combo Box
+    Opl::loadApproachTypes(ui->approachComboBox);
+    Opl::loadPilotFunctios(ui->functionComboBox);
 
     setupRawInputValidation();
     setupSignalsAndSlots();
@@ -172,7 +171,7 @@ bool NewFlightDialog::eventFilter(QObject *object, QEvent *event)
 void NewFlightDialog::readSettings()
 {
     ASettings settings;
-    ui->functionComboBox->setCurrentText(ASettings::read(ASettings::FlightLogging::Function).toString());
+    ui->functionComboBox->setCurrentIndex(ASettings::read(ASettings::FlightLogging::Function).toInt());
     ui->approachComboBox->setCurrentIndex(ASettings::read(ASettings::FlightLogging::Approach).toInt());
     ui->pilotFlyingCheckBox->setChecked(ASettings::read(ASettings::FlightLogging::PilotFlying).toBool());
     ui->ifrCheckBox->setChecked(ASettings::read(ASettings::FlightLogging::LogIFR).toBool());
@@ -441,7 +440,7 @@ RowData_T NewFlightDialog::prepareFlightEntryData()
         new_data.insert(Opl::Db::FLIGHTS_LDGNIGHT, 0);
         new_data.insert(Opl::Db::FLIGHTS_LDGDAY, ui->landingSpinBox->value());
     }
-    if (ui->approachComboBox->currentText() == Opl::ApproachTypes[3]) // ILS CAT III
+    if (ui->approachComboBox->currentText() == Opl::APPROACH_TYPES[3]) // ILS CAT III
         new_data.insert(Opl::Db::FLIGHTS_AUTOLAND, ui->landingSpinBox->value());
 
     // Additional Data

+ 57 - 110
src/gui/widgets/settingswidget.cpp

@@ -25,26 +25,6 @@
 #include "src/opl.h"
 #include "src/functions/adate.h"
 
-static const auto FIRSTNAME_VALID = QPair<QString, QRegularExpression> {
-    QStringLiteral("firstnameLineEdit"), QRegularExpression("[a-zA-Z]+")};
-static const auto LASTNAME_VALID = QPair<QString, QRegularExpression> {
-    QStringLiteral("lastnameLineEdit"), QRegularExpression("\\w+")};
-static const auto PHONE_VALID = QPair<QString, QRegularExpression> {
-    QStringLiteral("phoneLineEdit"), QRegularExpression("^[+]{0,1}[0-9\\-\\s]+")};
-static const auto EMAIL_VALID = QPair<QString, QRegularExpression> {
-    QStringLiteral("emailLineEdit"), QRegularExpression("\\A[a-z0-9!#$%&'*+/=?^_‘{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_‘{|}~-]+)*@"
-                                        "(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\z")};
-static const auto COMPANY_VALID = QPair<QString, QRegularExpression> {
-    QStringLiteral("companyLineEdit"), QRegularExpression("\\w+")};
-static const auto EMPLOYEENR_VALID = QPair<QString, QRegularExpression> {
-    QStringLiteral("employeeidLineEdit"), QRegularExpression("\\w+")};
-static const auto PREFIX_VALID = QPair<QString, QRegularExpression> {
-    QStringLiteral("prefixLineEdit"), QRegularExpression("[a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]")};
-
-static const auto LINE_EDIT_VALIDATORS = QVector<QPair<QString, QRegularExpression>>{
-    FIRSTNAME_VALID, LASTNAME_VALID, PHONE_VALID, EMAIL_VALID,
-    COMPANY_VALID, EMPLOYEENR_VALID, PREFIX_VALID};
-
 SettingsWidget::SettingsWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::SettingsWidget)
@@ -52,9 +32,6 @@ SettingsWidget::SettingsWidget(QWidget *parent) :
     ui->setupUi(this);
     ui->tabWidget->setCurrentIndex(0);
 
-    ui->acAllowIncompleteComboBox->hide(); // [F]: Hidden for now, thinking of removing that option
-    ui->acAllowIncompleteLabel->hide();
-
     setupComboBoxes();
     setupDateEdits();
     setupValidators();
@@ -77,7 +54,7 @@ void SettingsWidget::changeEvent(QEvent *event)
 void SettingsWidget::setupComboBoxes(){
     {
         // Style combo box
-        const QSignalBlocker blocker_style(ui->styleComboBox);
+        const QSignalBlocker style_blocker(ui->styleComboBox);
         ui->styleComboBox->addItems(AStyle::styles);
         for (const auto &style_sheet : AStyle::styleSheets) {
             ui->styleComboBox->addItem(style_sheet.styleSheetName);
@@ -85,12 +62,13 @@ void SettingsWidget::setupComboBoxes(){
         ui->styleComboBox->addItem(QStringLiteral("Dark-Palette"));
         ui->styleComboBox->model()->sort(0);
 
-        // Approach Combo Box
-        const QSignalBlocker blocker_approach(ui->approachComboBox);
-        for (const auto &approach : Opl::ApproachTypes)
-            ui->approachComboBox->addItem(approach);
+        // Approach Combo Box and Function Combo Box
+        const QSignalBlocker approach_blocker(ui->approachComboBox);
+        Opl::loadApproachTypes(ui->approachComboBox);
+        const QSignalBlocker function_blocker(ui->functionComboBox);
+        Opl::loadPilotFunctios(ui->functionComboBox);
+
         // Language Combo Box
-        const QSignalBlocker blocker_language(ui->languageComboBox);
         for (const auto &lang : Opl::L10N_NAMES)
             ui->languageComboBox->addItem(lang);
     }
@@ -143,34 +121,28 @@ void SettingsWidget::setupDateEdits()
  */
 void SettingsWidget::readSettings()
 {
-    /*
-     * Personal Tab
-     */
-    {
-        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());
-    }
-
-    /*
-     * Flight Logging Tab
-     */
-    ui->aliasComboBox->setCurrentIndex(ASettings::read(ASettings::UserData::DisplaySelfAs).toInt());
-    ui->functionComboBox->setCurrentText(ASettings::read(ASettings::FlightLogging::Function).toString());
-    ui->rulesComboBox->setCurrentText(ASettings::read(ASettings::FlightLogging::Rules).toString());
-    ui->approachComboBox->setCurrentText(ASettings::read(ASettings::FlightLogging::Approach).toString());
+    //const QSignalBlocker blocker(this); // don't emit editing finished for setting these values
+
+    // Personal Data Tab
+    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());
+
+    // FLight Logging Tab
+    ui->functionComboBox->setCurrentIndex(ASettings::read(ASettings::FlightLogging::Function).toInt());
+    ui->rulesComboBox->setCurrentIndex(ASettings::read(ASettings::FlightLogging::LogIFR).toInt());
+    ui->approachComboBox->setCurrentIndex(ASettings::read(ASettings::FlightLogging::Approach).toInt());
     ui->nightComboBox->setCurrentIndex(ASettings::read(ASettings::FlightLogging::NightLoggingEnabled).toInt());
     ui->prefixLineEdit->setText(ASettings::read(ASettings::FlightLogging::FlightNumberPrefix).toString());
+
     ui->logbookViewComboBox->setCurrentIndex(ASettings::read(ASettings::Main::LogbookView).toInt());
+    ui->aliasComboBox->setCurrentIndex(ASettings::read(ASettings::UserData::DisplaySelfAs).toInt());
 
-    /*
-     * Currencies Tab
-     */
+    // Currencies Tab
     ui->currToLdgCheckBox->setChecked(ASettings::read(ASettings::UserData::ShowToLgdCurrency).toBool());
     ui->currLicCheckBox->setChecked(ASettings::read(ASettings::UserData::ShowLicCurrency).toBool());
     ui->currTrCheckBox->setChecked(ASettings::read(ASettings::UserData::ShowTrCurrency).toBool());
@@ -181,41 +153,44 @@ void SettingsWidget::readSettings()
     ui->currCustom1LineEdit->setText(ASettings::read(ASettings::UserData::Custom1CurrencyName).toString());
     ui->currCustom2LineEdit->setText(ASettings::read(ASettings::UserData::Custom2CurrencyName).toString());
 
-    /*
-     * Misc Tab
-     */
+    // Misc Tab
     ui->acftSortComboBox->setCurrentIndex(ASettings::read(ASettings::UserData::TailSortColumn).toInt());
     ui->pilotSortComboBox->setCurrentIndex(ASettings::read(ASettings::UserData::PilotSortColumn).toInt());
-    //ui->acAllowIncompleteComboBox->setCurrentIndex(ASettings::read(ASettings::UserData::AcftAllowIncomplete).toInt());
-    {
-        // Block style widgets signals to not trigger style changes during UI setup
-        const QSignalBlocker style_blocker(ui->styleComboBox);
-        const QSignalBlocker font_blocker1(ui->fontSpinBox);
-        const QSignalBlocker font_blocker2(ui->fontComboBox);
-        const QSignalBlocker font_blocker3(ui->fontCheckBox);
-        ui->styleComboBox->setCurrentText(ASettings::read(ASettings::Main::Style).toString());
-        ui->fontSpinBox->setValue(ASettings::read(ASettings::Main::FontSize).toUInt());
-        ui->fontComboBox->setCurrentFont(QFont(ASettings::read(ASettings::Main::Font).toString()));
-        bool use_system_font = ASettings::read(ASettings::Main::UseSystemFont).toBool();
-        ui->fontCheckBox->setChecked(use_system_font);
-        if (!use_system_font) {
-            ui->fontComboBox->setEnabled(true);
-            ui->fontSpinBox->setEnabled(true);
-        }
+
+    // Don't emit signals for style changes during setup
+    const QSignalBlocker style_blocker(ui->styleComboBox);
+    const QSignalBlocker font_blocker_1(ui->fontSpinBox);
+    const QSignalBlocker font_blocker_2(ui->fontComboBox);
+    const QSignalBlocker font_blocker_3(ui->fontCheckBox);
+
+    ui->styleComboBox->setCurrentText(ASettings::read(ASettings::Main::Style).toString());
+    ui->fontSpinBox->setValue(ASettings::read(ASettings::Main::FontSize).toUInt());
+    ui->fontComboBox->setCurrentFont(QFont(ASettings::read(ASettings::Main::Font).toString()));
+    bool use_system_font = ASettings::read(ASettings::Main::UseSystemFont).toBool();
+    ui->fontCheckBox->setChecked(use_system_font);
+    if (!use_system_font) {
+        ui->fontComboBox->setEnabled(true);
+        ui->fontSpinBox->setEnabled(true);
     }
 }
 
 void SettingsWidget::setupValidators()
 {
-    // DEB << "Setting up Validators...";
-    for(const auto& pair : LINE_EDIT_VALIDATORS){
-        auto line_edit = parent()->findChild<QLineEdit*>(pair.first);
-        if(line_edit != nullptr){
-            auto validator = new QRegularExpressionValidator(pair.second,line_edit);
-            line_edit->setValidator(validator);
-        }else{
-            DEB << "Error: Line Edit not found: "<< pair.first << " - skipping.";
-        }
+    const QHash<QLineEdit*, QRegularExpression> validator_map = {
+        {ui->firstnameLineEdit, QRegularExpression(QLatin1String("\\w+"))},
+        {ui->lastnameLineEdit, QRegularExpression(QLatin1String("\\w+"))},
+        {ui->phoneLineEdit, QRegularExpression(QLatin1String("^[+]{0,1}[0-9\\-\\s]+"))},
+        {ui->emailLineEdit, QRegularExpression(QLatin1String("\\A[a-z0-9!#$%&'*+/=?^_‘{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_‘{|}~-]+)*@"
+         "(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\z"))},
+        {ui->companyLineEdit, QRegularExpression(QLatin1String("\\w+"))},
+        {ui->employeeidLineEdit, QRegularExpression(QLatin1String("\\w+"))},
+        {ui->prefixLineEdit, QRegularExpression(QLatin1String("\\w+"))},
+    };
+
+    QHash<QLineEdit*, QRegularExpression>::const_iterator i;
+    for (i = validator_map.constBegin(); i != validator_map.constEnd(); ++i) {
+        auto validator = new QRegularExpressionValidator(i.value(),i.key());
+        i.key()->setValidator(validator);
     }
 }
 
@@ -257,11 +232,6 @@ void SettingsWidget::updatePersonalDetails()
     aDB->commit(user);
 }
 
-/*
- * Slots
- */
-
-
 /*
  * Personal Tab
  */
@@ -313,7 +283,6 @@ void SettingsWidget::on_functionComboBox_currentIndexChanged(int arg1)
 
 void SettingsWidget::on_rulesComboBox_currentIndexChanged(int arg1)
 {
-    ASettings::write(ASettings::FlightLogging::Rules, arg1);
     ASettings::write(ASettings::FlightLogging::LogIFR, ui->rulesComboBox->currentIndex());
 }
 
@@ -364,28 +333,6 @@ void SettingsWidget::on_acftSortComboBox_currentIndexChanged(int index)
     emit settingChanged(AircraftWidget);
 }
 
-QT_DEPRECATED
-void SettingsWidget::on_acAllowIncompleteComboBox_currentIndexChanged(int index)
-{
-    ASettings::write(ASettings::UserData::AcftAllowIncomplete, index);
-    if (index) {
-        QMessageBox::StandardButton reply;
-        reply = QMessageBox::warning(this, tr("Warning"),
-                                      tr("Enabling incomplete logging will enable you to add aircraft with incomplete data.<br><br>"
-                                      "If you do not fill out the aircraft details, "
-                                      "it will be impossible to automatically determine Single/Multi Pilot Times or Single/Multi Engine Time. "
-                                      "This will also impact statistics and auto-logging capabilites as well as jeopardise database integrity.<br><br>"
-                                      "It is highly recommended to keep this option off unless you have a specific reason not to.<br><br>"
-                                      "Are you sure you want to proceed?"),
-                                      QMessageBox::Yes | QMessageBox::No);
-        if (reply == QMessageBox::Yes) {
-            ASettings::write(ASettings::UserData::AcftAllowIncomplete, index);
-        } else {
-            ui->acAllowIncompleteComboBox->setCurrentIndex(0);
-        }
-    }
-}
-
 /*
  * About Tab
  */
@@ -403,7 +350,7 @@ void SettingsWidget::on_aboutPushButton_clicked()
 
                        "<h3><center>About openPilotLog</center></h3>"
                        "<br>"
-                       "&#169; 2020-2021 Felix Turowsky"
+                       "&#169; 2020 - 2022 Felix Turowsky"
                        "<br>"
                        "<p>This is a collaboratively developed Free and Open Source Application. "
                        "Visit us <a href=\"https://%1/\">here</a> for more information.</p>"

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

@@ -54,7 +54,6 @@ private slots:
 
     void on_aboutPushButton_clicked();
     void on_acftSortComboBox_currentIndexChanged(int index);
-    void on_acAllowIncompleteComboBox_currentIndexChanged(int index);
     void on_prefixLineEdit_textChanged(const QString &arg1);
     void on_lastnameLineEdit_editingFinished();
     void on_firstnameLineEdit_editingFinished();
@@ -70,47 +69,26 @@ private slots:
     void on_logbookViewComboBox_currentIndexChanged(int index);
     void on_companyLineEdit_editingFinished();
     void on_styleComboBox_currentTextChanged(const QString& new_style_setting);
-
     void on_fontComboBox_currentFontChanged(const QFont &f);
-
     void on_fontSpinBox_valueChanged(int arg1);
-
     void on_fontCheckBox_stateChanged(int arg1);
-
     void on_resetStylePushButton_clicked();
-
     void on_currLicDateEdit_userDateChanged(const QDate &date);
-
     void on_currTrDateEdit_userDateChanged(const QDate &date);
-
     void on_currLckDateEdit_userDateChanged(const QDate &date);
-
     void on_currMedDateEdit_userDateChanged(const QDate &date);
-
     void on_currCustom1DateEdit_userDateChanged(const QDate &date);
-
     void on_currCustom2DateEdit_userDateChanged(const QDate &date);
-
     void on_currToLdgCheckBox_stateChanged(int arg1);
-
     void on_currLicCheckBox_stateChanged(int arg1);
-
     void on_currTrCheckBox_stateChanged(int arg1);
-
     void on_currLckCheckBox_stateChanged(int arg1);
-
     void on_currMedCheckBox_stateChanged(int arg1);
-
     void on_currCustom1CheckBox_stateChanged(int arg1);
-
     void on_currCustom2CheckBox_stateChanged(int arg1);
-
     void on_currCustom1LineEdit_editingFinished();
-
     void on_currCustom2LineEdit_editingFinished();
-
     void on_dateFormatComboBox_currentIndexChanged(int index);
-
     void on_languageComboBox_activated(int arg1);
 
 private:

+ 83 - 137
src/gui/widgets/settingswidget.ui

@@ -221,28 +221,7 @@
         </widget>
        </item>
        <item row="2" column="2">
-        <widget class="QComboBox" name="functionComboBox">
-         <item>
-          <property name="text">
-           <string>PIC</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>SIC</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>DUAL</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>INSTRUCTOR</string>
-          </property>
-         </item>
-        </widget>
+        <widget class="QComboBox" name="functionComboBox"/>
        </item>
        <item row="3" column="1">
         <widget class="QLabel" name="rulesLabel">
@@ -811,11 +790,8 @@
        <string>Appearance</string>
       </attribute>
       <layout class="QGridLayout" name="gridLayout_5">
-       <item row="0" column="2">
-        <widget class="QComboBox" name="styleComboBox"/>
-       </item>
-       <item row="2" column="0">
-        <widget class="QLabel" name="pilotSortLabel">
+       <item row="4" column="0">
+        <widget class="QLabel" name="logbookViewLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
            <horstretch>0</horstretch>
@@ -823,29 +799,29 @@
           </sizepolicy>
          </property>
          <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Pilots in the Pilots Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines how your logbook is displayed in the logbook tab. This has no influence on what details are logged, just on what is displayed by default.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <property name="whatsThis">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Pilots in the Pilots Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines how your logbook is displayed in the logbook tab. This has no influence on what details are logged, just on what is displayed by default.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <property name="text">
-          <string>Sort Pilots by</string>
+          <string>Logbook Dispay</string>
          </property>
         </widget>
        </item>
-       <item row="2" column="2">
-        <widget class="QComboBox" name="pilotSortComboBox">
+       <item row="3" column="2">
+        <widget class="QComboBox" name="acftSortComboBox">
          <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Pilots in the Pilots Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Aircaft in the Aircraft Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <item>
           <property name="text">
-           <string>Last Name</string>
+           <string>Registration</string>
           </property>
          </item>
          <item>
           <property name="text">
-           <string>First Name</string>
+           <string>Type</string>
           </property>
          </item>
          <item>
@@ -855,6 +831,36 @@
          </item>
         </widget>
        </item>
+       <item row="0" column="0">
+        <widget class="QLabel" name="styleLabel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text">
+          <string>Style</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="2">
+        <widget class="QComboBox" name="logbookViewComboBox">
+         <property name="toolTip">
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines how your logbook is displayed in the logbook tab. This has no influence on what details are logged, just on what is displayed by default.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <item>
+          <property name="text">
+           <string>Default</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>EASA Part-FCL</string>
+          </property>
+         </item>
+        </widget>
+       </item>
        <item row="1" column="3">
         <widget class="QSpinBox" name="fontSpinBox">
          <property name="enabled">
@@ -877,21 +883,8 @@
          </property>
         </widget>
        </item>
-       <item row="4" column="0">
-        <widget class="QLabel" name="acAllowIncompleteLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines whether incomplete database entries are permitted. It is highly recommended to keep this option off.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="text">
-          <string>Allow incomplete Entries </string>
-         </property>
-        </widget>
+       <item row="0" column="2">
+        <widget class="QComboBox" name="styleComboBox"/>
        </item>
        <item row="1" column="1">
         <widget class="QCheckBox" name="fontCheckBox">
@@ -903,37 +896,32 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="fontLabel">
+       <item row="5" column="0">
+        <widget class="QLabel" name="languageLabel">
          <property name="text">
-          <string>Font</string>
+          <string>Language</string>
          </property>
         </widget>
        </item>
-       <item row="3" column="2">
-        <widget class="QComboBox" name="acftSortComboBox">
-         <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Aircaft in the Aircraft Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+       <item row="1" column="2">
+        <widget class="QFontComboBox" name="fontComboBox">
+         <property name="enabled">
+          <bool>false</bool>
          </property>
-         <item>
-          <property name="text">
-           <string>Registration</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>Type</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>Company</string>
-          </property>
-         </item>
         </widget>
        </item>
-       <item row="3" column="0">
-        <widget class="QLabel" name="acftSortLabel">
+       <item row="0" column="1">
+        <widget class="QPushButton" name="resetStylePushButton">
+         <property name="text">
+          <string>Reset to Default</string>
+         </property>
+        </widget>
+       </item>
+       <item row="5" column="2">
+        <widget class="QComboBox" name="languageComboBox"/>
+       </item>
+       <item row="2" column="0">
+        <widget class="QLabel" name="pilotSortLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
            <horstretch>0</horstretch>
@@ -941,35 +929,18 @@
           </sizepolicy>
          </property>
          <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Aircaft in the Aircraft Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Pilots in the Pilots Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <property name="whatsThis">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Aircaft in the Aircraft Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Pilots in the Pilots Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <property name="text">
-          <string>Sort Aircraft by</string>
-         </property>
-        </widget>
-       </item>
-       <item row="4" column="2">
-        <widget class="QComboBox" name="acAllowIncompleteComboBox">
-         <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines whether incomplete database entries are permitted. It is highly recommended to keep this option off.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>Sort Pilots by</string>
          </property>
-         <item>
-          <property name="text">
-           <string>No</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>Yes</string>
-          </property>
-         </item>
         </widget>
        </item>
-       <item row="5" column="0">
-        <widget class="QLabel" name="logbookViewLabel">
+       <item row="3" column="0">
+        <widget class="QLabel" name="acftSortLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
            <horstretch>0</horstretch>
@@ -977,67 +948,42 @@
           </sizepolicy>
          </property>
          <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines how your logbook is displayed in the logbook tab. This has no influence on what details are logged, just on what is displayed by default.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Aircaft in the Aircraft Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <property name="whatsThis">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines how your logbook is displayed in the logbook tab. This has no influence on what details are logged, just on what is displayed by default.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="text">
-          <string>Logbook Dispay</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Aircaft in the Aircraft Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
-        </widget>
-       </item>
-       <item row="0" column="1">
-        <widget class="QPushButton" name="resetStylePushButton">
          <property name="text">
-          <string>Reset to Default</string>
+          <string>Sort Aircraft by</string>
          </property>
         </widget>
        </item>
-       <item row="5" column="2">
-        <widget class="QComboBox" name="logbookViewComboBox">
+       <item row="2" column="2">
+        <widget class="QComboBox" name="pilotSortComboBox">
          <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines how your logbook is displayed in the logbook tab. This has no influence on what details are logged, just on what is displayed by default.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines by which column to sort the display of Pilots in the Pilots Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
          <item>
           <property name="text">
-           <string>Default</string>
+           <string>Last Name</string>
           </property>
          </item>
          <item>
           <property name="text">
-           <string>EASA Part-FCL</string>
+           <string>First Name</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Company</string>
           </property>
          </item>
         </widget>
        </item>
-       <item row="0" column="0">
-        <widget class="QLabel" name="styleLabel">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string>Style</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="2">
-        <widget class="QFontComboBox" name="fontComboBox">
-         <property name="enabled">
-          <bool>false</bool>
-         </property>
-        </widget>
-       </item>
-       <item row="6" column="2">
-        <widget class="QComboBox" name="languageComboBox"/>
-       </item>
-       <item row="6" column="0">
-        <widget class="QLabel" name="languageLabel">
+       <item row="1" column="0">
+        <widget class="QLabel" name="fontLabel">
          <property name="text">
-          <string>Language</string>
+          <string>Font</string>
          </property>
         </widget>
        </item>

+ 28 - 1
src/opl.h

@@ -20,6 +20,7 @@
 
 #include <QtCore>
 #include <QMessageBox>
+#include <QComboBox>
 #include "src/database/adatabasetypes.h"
 
 /*!
@@ -97,7 +98,27 @@ static const QMap<Translations, QString> L10N_NAMES {
     {Opl::Translations::Spanish, QStringLiteral("Español")},
 };
 
-static const auto ApproachTypes = QStringList{
+/*!
+ * \brief PilotFunction
+ * Pilot in Command, Pilot in Command under Supervision, Second in Command (Co-Pilot), Dual, Flight Instructor
+ */
+enum PilotFunction {PIC = 0, PICUS = 1, SIC = 2, DUAL = 3, FI = 4};
+
+static const QHash<PilotFunction, QLatin1String> PILOT_FUNCTIONS = {
+    {PilotFunction::PIC, QLatin1String("PIC")},
+    {PilotFunction::PICUS, QLatin1String("PICUS")},
+    {PilotFunction::SIC, QLatin1String("SIC")},
+    {PilotFunction::DUAL, QLatin1String("DUAL")},
+    {PilotFunction::FI, QLatin1String("FI")},
+};
+
+static inline void loadPilotFunctios(QComboBox *combo_box)
+{
+    for (int i = 0; i < Opl::PILOT_FUNCTIONS.size(); i++)
+        combo_box->addItem(Opl::PILOT_FUNCTIONS.value(Opl::PilotFunction(i)));
+};
+
+static const QList<QLatin1String> APPROACH_TYPES = {
         QLatin1String("VISUAL"),
         QLatin1String("ILS CAT I"),
         QLatin1String("ILS CAT II"),
@@ -122,6 +143,12 @@ static const auto ApproachTypes = QStringList{
         QLatin1String("OTHER")
 };
 
+static inline void loadApproachTypes(QComboBox *combo_box)
+{
+    for (const auto & approach : Opl::APPROACH_TYPES)
+        combo_box->addItem(approach);
+};
+
 namespace Date {
 
 /*!