Przeglądaj źródła

Cleaned up UI

- Unified and harmonised layout of PilotWidget and Aircraftwidget
- Cleaned up variable and function naming, slot connections
- Removed option for logging incomplete tails. Mandatory fields are now enforced.
Felix Turo 4 lat temu
rodzic
commit
94f47db9b4

+ 2 - 0
assets/icons.qrc

@@ -16,6 +16,7 @@
         <file>opl-icons/appicon_round_transparent.svg</file>
         <file>opl-icons/appicon_round_gradient.svg</file>
         <file>opl-icons/pilot.png</file>
+        <file>opl-icons/pilot_dark.png</file>
         <file>opl-icons/aircraft.png</file>
         <file>opl-icons/new_flight.png</file>
 	    <file>opl-icons/icon_main.svg</file>
@@ -24,5 +25,6 @@
 	    <file>opl-icons/icon_linux_light.svg</file>
 	    <file>opl-icons/icon_about.png</file>
 	    <file>opl-icons/icon_backup.svg</file>
+	    <file>opl-icons/icon_home.svg</file>
     </qresource>
 </RCC>

+ 1 - 0
assets/opl-icons/icon_home.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 318 318"><defs><style>.cls-1,.cls-2{fill:none;}.cls-1{stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:23px;}</style></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_9" data-name="Layer 9"><path class="cls-1" d="M299.39,174.94h-35.3V261c0,12.63-9.9,22.86-22.12,22.86H197.5V198.64a12,12,0,0,0-12-12h-53a12,12,0,0,0-12,12V283.9H76c-12.22,0-22.12-10.23-22.12-22.86v-86.1H18.61l35.31-35.42,0,0L154,39.12l5-5,5,5L264.06,139.5l0,0Z"/><rect class="cls-2" width="318" height="318"/></g></g></svg>

+ 14 - 9
mainwindow.cpp

@@ -28,7 +28,7 @@ MainWindow::MainWindow(QWidget *parent)
     ui->setupUi(this);
 
     // Set up Toolbar
-    ui->actionHome->setIcon(QIcon(":/icons/ionicon-icons/home-outline.png"));
+    ui->actionHome->setIcon(QIcon(Opl::Assets::ICON_HOME));
     ui->actionNewFlight->setIcon(QIcon(Opl::Assets::ICON_NEW_FLIGHT));
     ui->actionLogbook->setIcon(QIcon(":/icons/ionicon-icons/book-outline.png"));
     ui->actionAircraft->setIcon(QIcon(Opl::Assets::ICON_AIRCRAFT));
@@ -124,19 +124,24 @@ void MainWindow::on_actionDebug_triggered()
 void MainWindow::connectWidgets()
 {
     QObject::connect(aDB, &ADatabase::dataBaseUpdated,
-                     logbookWidget, &LogbookWidget::onDisplayModel_dataBaseUpdated);
-    QObject::connect(aDB, &ADatabase::dataBaseUpdated,
-                     pilotsWidget, &PilotsWidget::onDisplayModel_dataBaseUpdated);
-    QObject::connect(aDB, &ADatabase::dataBaseUpdated,
-                     aircraftWidget, &AircraftWidget::onDisplayModel_dataBaseUpdated);
+                     logbookWidget, &LogbookWidget::refresh);
+    QObject::connect(settingsWidget, &SettingsWidget::settingChanged,
+                     logbookWidget, &LogbookWidget::onLogbookWidget_viewSelectionChanged);
+
     QObject::connect(aDB, &ADatabase::dataBaseUpdated,
-                     homeWidget, &HomeWidget::onHomeWidget_dataBaseUpdated);
+                     pilotsWidget, &PilotsWidget::onPilotsWidget_databaseUpdated);
     QObject::connect(settingsWidget, &SettingsWidget::settingChanged,
-                     homeWidget, &HomeWidget::onHomeWidget_dataBaseUpdated);
+                     pilotsWidget, &PilotsWidget::onPilotsWidget_settingChanged);
 
+    QObject::connect(aDB,            &ADatabase::dataBaseUpdated,
+                     aircraftWidget, &AircraftWidget::onAircraftWidget_dataBaseUpdated);
     QObject::connect(settingsWidget, &SettingsWidget::settingChanged,
-                     logbookWidget, &LogbookWidget::onLogbookWidget_viewSelectionChanged);
+                     aircraftWidget, &AircraftWidget::onAircraftWidget_settingChanged);
 
+    QObject::connect(aDB, &ADatabase::dataBaseUpdated,
+                     homeWidget, &HomeWidget::refresh);
+    QObject::connect(settingsWidget, &SettingsWidget::settingChanged,
+                     homeWidget, &HomeWidget::refresh);
 }
 
 void MainWindow::on_actionSettings_triggered()

+ 12 - 28
src/gui/dialogues/newtaildialog.cpp

@@ -234,25 +234,25 @@ void NewTailDialog::submitForm()
 void NewTailDialog::on_operationComboBox_currentIndexChanged(int index)
 {
     if (index != 0)
-        ui->operationComboBox->setStyleSheet("");
+        ui->operationComboBox->setStyleSheet(QString());
 }
 
 void NewTailDialog::on_ppTypeComboBox_currentIndexChanged(int index)
 {
     if (index != 0)
-        ui->ppTypeComboBox->setStyleSheet("");
+        ui->ppTypeComboBox->setStyleSheet(QString());
 }
 
 void NewTailDialog::on_ppNumberComboBox_currentIndexChanged(int index)
 {
     if (index != 0)
-        ui->ppNumberComboBox->setStyleSheet("");
+        ui->ppNumberComboBox->setStyleSheet(QString());
 }
 
 void NewTailDialog::on_weightComboBox_currentIndexChanged(int index)
 {
     if (index != 0)
-        ui->weightComboBox->setStyleSheet("");
+        ui->weightComboBox->setStyleSheet(QString());
 }
 
 void NewTailDialog::on_buttonBox_accepted()
@@ -266,30 +266,14 @@ void NewTailDialog::on_buttonBox_accepted()
     }
 
     if (!verify()) {
-        if (!ASettings::read(ASettings::UserData::AcftAllowIncomplete).toInt()) {
-            QMessageBox message_box(this);
-            message_box.setIcon(QMessageBox::Warning);
-            message_box.setText(tr("Some or all recommended fields are empty.<br>"
-                                   "Please go back and complete the form.<br><br>"
-                                   "You can allow logging incomplete tail entries "
-                                   "on the settings page."));
-            message_box.exec();
-            return;
-        } else {
-            QMessageBox::StandardButton reply;
-            reply = QMessageBox::question(this, tr("Warning"),
-                                          tr("Some recommended fields are empty.<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.<br><br>"
-                                          "It is highly recommended to fill in all the details.<br><br>"
-                                          "Are you sure you want to proceed?"),
-                                          QMessageBox::Yes | QMessageBox::No);
-            if (reply == QMessageBox::Yes) {
-                submitForm();
-            }
-        }
+        QMessageBox message_box(this);
+        message_box.setIcon(QMessageBox::Warning);
+        message_box.setText(tr("Some or all recommended fields are empty.<br>"
+                               "Please fill out the mandatory fields. You can use "
+                               "the search function to automatically fill out all "
+                               "the required fields for a known aircraft type."));
+        message_box.exec();
+        return;
     }
     DEB << "Form verified";
     submitForm();

+ 99 - 84
src/gui/widgets/aircraftwidget.cpp

@@ -29,8 +29,9 @@ AircraftWidget::AircraftWidget(QWidget *parent) :
     ui(new Ui::AircraftWidget)
 {
     ui->setupUi(this);
-    ui->stackedWidget->addWidget(this->findChild<QWidget*>("welcomePageTails"));
-    ui->stackedWidget->setCurrentWidget(this->findChild<QWidget*>("welcomePageTails"));
+
+    ui->tableView->setMinimumWidth(this->width()/2);
+    ui->stackedWidget->setMinimumWidth(this->width()/2);
 
     setupModelAndView();
 }
@@ -40,46 +41,118 @@ AircraftWidget::~AircraftWidget()
     delete ui;
 }
 
-/*
- * Functions
- */
-
 void AircraftWidget::setupModelAndView()
 {
-    sortColumn = ASettings::read(ASettings::UserData::TailSortColumn).toInt();
-
     model = new QSqlTableModel(this);
-    model->setTable("viewTails");
+    model->setTable(QStringLiteral("viewTails"));
     model->select();
 
     view = ui->tableView;
     view->setModel(model);
 
     view->setSelectionBehavior(QAbstractItemView::SelectRows);
-    view->setSelectionMode(QAbstractItemView::SingleSelection);
+    view->setSelectionMode(QAbstractItemView::SingleSelection); // For now, editing multiple entries is not supported.
     view->setEditTriggers(QAbstractItemView::NoEditTriggers);
     view->horizontalHeader()->setStretchLastSection(QHeaderView::Stretch);
     view->hideColumn(0);
-    view->setColumnWidth(1, 180);
-    view->setColumnWidth(2, 180);
+    view->resizeColumnsToContents();
     view->verticalHeader()->hide();
     view->setAlternatingRowColors(true);
+
+    sortColumn = ASettings::read(ASettings::UserData::TailSortColumn).toInt();
     view->setSortingEnabled(true);
     view->sortByColumn(sortColumn, Qt::DescendingOrder);
 
     view->show();
     selection = view->selectionModel();
 
-    QObject::connect(ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged,
-                     this, &AircraftWidget::tableView_selectionChanged);
+    QObject::connect(ui->tableView->selectionModel(),   &QItemSelectionModel::selectionChanged,
+                     this,                              &AircraftWidget::tableView_selectionChanged);
     QObject::connect(ui->tableView->horizontalHeader(), &QHeaderView::sectionClicked,
-                     this, &AircraftWidget::tableView_headerClicked);
+                     this,                              &AircraftWidget::tableView_headerClicked);
 }
 
 /*
  * Slots
  */
-void AircraftWidget::on_deleteButton_clicked()
+
+void AircraftWidget::onAircraftWidget_settingChanged(SettingsWidget::SettingSignal signal)
+{
+    if (signal != SettingsWidget::AircraftWidget)
+        return;
+
+    setupModelAndView();
+}
+
+void AircraftWidget::onAircraftWidget_dataBaseUpdated()
+{
+    refreshView();
+}
+
+void AircraftWidget::onNewTailDialog_editingFinished()
+{
+    refreshView();
+}
+
+void AircraftWidget::on_newAircraftButton_clicked()
+{
+    NewTailDialog nt(QString(), this);
+    QObject::connect(&nt,  &QDialog::accepted,
+                     this, &AircraftWidget::onNewTailDialog_editingFinished);
+    QObject::connect(&nt,  &QDialog::rejected,
+                     this, &AircraftWidget::onNewTailDialog_editingFinished);
+    nt.exec();
+}
+
+/*!
+ * \brief Displays a dialog in which the Tail can be edited
+ */
+void AircraftWidget::tableView_selectionChanged()
+{
+    if (this->findChild<NewTailDialog*>() != nullptr)
+        delete this->findChild<NewTailDialog*>();
+
+    selectedTails.clear();
+
+    for (const auto& row : selection->selectedRows()) {
+        selectedTails << row.data().toInt();
+        DEB << "Selected Tails(s) with ID: " << selectedTails;
+    }
+
+    if(selectedTails.length() == 1) {
+        auto* nt = new NewTailDialog(selectedTails.first(), this);
+        QObject::connect(nt,   &QDialog::accepted,
+                         this, &AircraftWidget::onNewTailDialog_editingFinished);
+        QObject::connect(nt,   &QDialog::rejected,
+                         this, &AircraftWidget::onNewTailDialog_editingFinished);
+        ui->stackedWidget->addWidget(nt);
+        ui->stackedWidget->setCurrentWidget(nt);
+        nt->setWindowFlag(Qt::Widget);
+        nt->setAttribute(Qt::WA_DeleteOnClose);
+        nt->exec();
+    }
+}
+
+/*!
+ * \brief Acts as a filter on the display model
+ */
+void AircraftWidget::on_aircraftSearchLineEdit_textChanged(const QString &arg1)
+{
+    if(ui->aircraftSearchComboBox->currentIndex() == 0){
+        ui->aircraftSearchLineEdit->setText(arg1.toUpper());
+    }
+    model->setFilter(ui->aircraftSearchComboBox->currentText()
+                     + QLatin1String(" LIKE \"%")
+                     + arg1 + QLatin1String("%\""));
+}
+
+void AircraftWidget::tableView_headerClicked(int column)
+{
+    sortColumn = column;
+    ASettings::write(ASettings::UserData::TailSortColumn, column);
+}
+
+void AircraftWidget::on_deleteAircraftButton_clicked()
 {
     if (selectedTails.length() == 0) {
         QMessageBox message_box(this);
@@ -116,10 +189,18 @@ void AircraftWidget::on_deleteButton_clicked()
                 onDeleteUnsuccessful();
         }
     }
-
-    model->select();
+    refreshView();
 }
 
+/*!
+ * \brief Informs the user that deleting a database entry has been unsuccessful
+ *
+ * \abstract Normally, when one of these entries can not be deleted, it is because of
+ * a [foreign key constraint](https://sqlite.org/foreignkeys.html), meaning that a flight
+ * is associated with the aircraft that was supposed to be deleted.
+ *
+ * This function is used to inform the user and give hints on how to solve the problem.
+ */
 void AircraftWidget::onDeleteUnsuccessful()
 {
     QList<int> foreign_key_constraints = aDB->getForeignKeyConstraints(selectedTails.first(),
@@ -156,69 +237,3 @@ void AircraftWidget::onDeleteUnsuccessful()
         message_box.exec();
     }
 }
-
-void AircraftWidget::on_newAircraftButton_clicked()
-{
-    NewTailDialog nt(QString(), this);
-    connect(&nt, SIGNAL(accepted()), this, SLOT(acft_editing_finished()));
-    connect(&nt, SIGNAL(rejected()), this, SLOT(acft_editing_finished()));
-    nt.exec();
-}
-
-void AircraftWidget::on_aircraftSearchLineEdit_textChanged(const QString &arg1)
-{
-    if(ui->aircraftSearchComboBox->currentIndex() == 0){
-        ui->aircraftSearchLineEdit->setText(arg1.toUpper());
-    }
-    model->setFilter(ui->aircraftSearchComboBox->currentText()
-                     + QStringLiteral(" LIKE \"%")
-                     + arg1 + QStringLiteral("%\""));
-}
-
-void AircraftWidget::onDisplayModel_dataBaseUpdated()
-{
-    //refresh view to reflect changes the user has made via a dialog.
-    model->select();
-}
-
-void AircraftWidget::tableView_selectionChanged()
-{
-    if (this->findChild<NewTailDialog*>() != nullptr) {
-        delete this->findChild<NewTailDialog*>();
-        /// [F] if the user changes the selection without making any changes,
-        /// if(selectedTails.length() == 1) spawns a new dialog without the
-        /// old one being deleted, since neither accept() nor reject() was emitted.
-        /// Is this a reasonable way of avoiding pollution? Creating the widgets on the
-        /// stack does not seem to solve the problem since the Dialog does not get destroyed
-        /// until either accept() or reject() is emitted so I went for this solution.
-    }
-    selectedTails.clear();
-
-    for (const auto& row : selection->selectedRows()) {
-        selectedTails << row.data().toInt();
-        DEB << "Selected Tails(s) with ID: " << selectedTails;
-    }
-    if(selectedTails.length() == 1) {
-        auto* nt = new NewTailDialog(selectedTails.first(), this);
-        QObject::connect(nt,   &QDialog::accepted,
-                         this, &AircraftWidget::acft_editing_finished);
-        QObject::connect(nt,   &QDialog::rejected,
-                         this, &AircraftWidget::acft_editing_finished);
-        ui->stackedWidget->addWidget(nt);
-        ui->stackedWidget->setCurrentWidget(nt);
-        nt->setWindowFlag(Qt::Widget);
-        nt->setAttribute(Qt::WA_DeleteOnClose);
-        nt->exec();
-    }
-}
-
-void AircraftWidget::tableView_headerClicked(int column)
-{
-    sortColumn = column;
-    ASettings::write(ASettings::UserData::TailSortColumn, column);
-}
-
-void AircraftWidget::acft_editing_finished()
-{
-    model->select();
-}

+ 33 - 5
src/gui/widgets/aircraftwidget.h

@@ -21,14 +21,30 @@
 #include <QWidget>
 #include <QItemSelection>
 #include <QSqlTableModel>
-#include <QDebug>
 #include <QTableView>
+#include "src/gui/widgets/settingswidget.h"
 
 
 namespace Ui {
 class AircraftWidget;
 }
-
+/*!
+ * \class AircraftWidget
+ * \brief The AircraftWidget is used to view, edit, delete or add new tails.
+ * \abstract The widget consists of two main parts, a *QTableView* on the left side and a *QStackedWidget* on the right side.
+ *
+ * In the QTableView, a QSqlTableModel is used to access a view from the database, which holds a tails' Registration, Type and
+ * Company.
+ *
+ * The welcome page shown on the QStackedWidget on the right side has a QLineEdit that functions as a search box and a QCombobox
+ * holding the possible columns that can be used to filter what is displayed. The text of the QLineEdit is used as a filter for the
+ * QSqlTableModel, so the view is updated in real time.
+ *
+ * The *NewTailDialog* is used for creating a new entry as well as for editing an existing entry. If the user selects a row
+ * in the QTableView, the NewTailDilog is displayed on the right side of the Widget, inside the QStackedWidget.
+ * In order to avoid leaks from any previously made selections, existing Dialogs are deleted before a new one is created.
+ * The NewTailDialog's `accepted` and `rejected` signals are connected to refresh the view as required.
+ */
 class AircraftWidget : public QWidget
 {
     Q_OBJECT
@@ -42,16 +58,23 @@ private slots:
 
     void tableView_headerClicked(int column);
 
-    void on_deleteButton_clicked();
+    void on_deleteAircraftButton_clicked();
 
     void on_newAircraftButton_clicked();
 
-    void acft_editing_finished();
+    void onNewTailDialog_editingFinished();
 
     void on_aircraftSearchLineEdit_textChanged(const QString &arg1);
 
 public slots:
-    void onDisplayModel_dataBaseUpdated();
+    /*!
+     * \brief invokes setupModelAndView() to account for changes the user has made in the SettingsWidget
+     */
+    void onAircraftWidget_settingChanged(SettingsWidget::SettingSignal signal);
+    /*!
+     * \brief Refreshes the view if the Database has been altered from outside the AircraftWidget
+     */
+    void onAircraftWidget_dataBaseUpdated();
 
 private:
     Ui::AircraftWidget *ui;
@@ -64,11 +87,16 @@ private:
 
     qint32 sortColumn;
 
+    /*!
+     * \brief selectedTails Holds a list of the entries the user has selected
+     */
     QVector<qint32> selectedTails;
 
     void setupModelAndView();
 
     void onDeleteUnsuccessful();
+
+    inline void refreshView(){model->select();}
 };
 
 #endif // AIRCRAFTWIDGET_H

+ 169 - 132
src/gui/widgets/aircraftwidget.ui

@@ -6,151 +6,181 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1920</width>
-    <height>1080</height>
+    <width>1318</width>
+    <height>706</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout">
+  <layout class="QGridLayout" name="gridLayout_2">
    <item row="0" column="0">
     <widget class="QTableView" name="tableView">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
      </property>
     </widget>
    </item>
-   <item row="2" column="0">
-    <widget class="QPushButton" name="deleteButton">
-     <property name="text">
-      <string>Delete Aircraft</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="1">
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <spacer name="horizontalSpacer">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QStackedWidget" name="stackedWidget">
-       <property name="currentIndex">
-        <number>0</number>
-       </property>
-       <widget class="QWidget" name="welcomePageTails">
-        <layout class="QGridLayout" name="gridLayout_2">
-         <item row="0" column="1">
-          <spacer name="verticalSpacer">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>436</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item row="1" column="0">
-          <layout class="QFormLayout" name="formLayout">
-           <item row="0" column="0">
-            <widget class="QLabel" name="searchLabel">
-             <property name="text">
-              <string>Search:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="1">
-            <widget class="QLineEdit" name="aircraftSearchLineEdit"/>
-           </item>
-           <item row="1" column="0">
-            <widget class="QLabel" name="label_2">
-             <property name="text">
-              <string>Search in:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="1">
-            <widget class="QComboBox" name="aircraftSearchComboBox">
-             <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>
-          </layout>
-         </item>
-         <item row="2" column="0">
-          <widget class="QLabel" name="spacerLabel">
-           <property name="text">
-            <string/>
-           </property>
-          </widget>
+   <item row="0" column="1" rowspan="3">
+    <widget class="QStackedWidget" name="stackedWidget">
+     <widget class="QWidget" name="welcomePageTails">
+      <layout class="QGridLayout" name="gridLayout">
+       <item row="1" column="1">
+        <widget class="QLabel" name="searchLabel">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Search:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="2">
+        <widget class="QLineEdit" name="aircraftSearchLineEdit">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1">
+        <widget class="QLabel" name="label_2">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Search in:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="2">
+        <widget class="QComboBox" name="aircraftSearchComboBox">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <item>
+          <property name="text">
+           <string>Registration</string>
+          </property>
          </item>
-         <item row="3" column="0" colspan="2">
-          <widget class="QLabel" name="welcomeLabel">
-           <property name="text">
-            <string>Select an Aircraft from the List to show or edit details.</string>
-           </property>
-          </widget>
+         <item>
+          <property name="text">
+           <string>Type</string>
+          </property>
          </item>
-         <item row="4" column="1">
-          <spacer name="verticalSpacer_2">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>410</height>
-            </size>
-           </property>
-          </spacer>
+         <item>
+          <property name="text">
+           <string>Company</string>
+          </property>
          </item>
-        </layout>
-       </widget>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_2">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
+        </widget>
+       </item>
+       <item row="3" column="0">
+        <spacer name="horizontalSpacer">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>130</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="3" column="1" colspan="2">
+        <widget class="QLabel" name="welcomeLabel">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Select an Aircraft from the List to show or edit details.</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="3">
+        <spacer name="horizontalSpacer_2">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>129</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="4" column="3">
+        <spacer name="verticalSpacer_2">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>286</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="0" column="3">
+        <spacer name="verticalSpacer">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>287</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+    </widget>
    </item>
    <item row="1" column="0">
     <widget class="QPushButton" name="newAircraftButton">
@@ -159,6 +189,13 @@
      </property>
     </widget>
    </item>
+   <item row="2" column="0">
+    <widget class="QPushButton" name="deleteAircraftButton">
+     <property name="text">
+      <string>Delete Aircraft</string>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <resources/>

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

@@ -61,7 +61,7 @@ HomeWidget::~HomeWidget()
     delete ui;
 }
 
-void HomeWidget::onHomeWidget_dataBaseUpdated()
+void HomeWidget::refresh()
 {
     DEB << "Updating HomeWidget...";
     for (const auto label : this->findChildren<QLabel *>())

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

@@ -83,7 +83,7 @@ private:
      */
     const QString userName();
 public slots:
-    void onHomeWidget_dataBaseUpdated();
+    void refresh();
 };
 
 #endif // HOMEWIDGET_H

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

@@ -52,7 +52,7 @@ LogbookWidget::LogbookWidget(QWidget *parent) :
     displayModel = new QSqlTableModel(this);
     view = ui->tableView;
 
-    prepareModelAndView(ASettings::read(ASettings::Main::LogbookView).toInt());
+    setupModelAndView(ASettings::read(ASettings::Main::LogbookView).toInt());
     connectSignalsAndSlots();
 
 }
@@ -66,7 +66,7 @@ LogbookWidget::~LogbookWidget()
  * Functions
  */
 
-void LogbookWidget::prepareModelAndView(int view_id)
+void LogbookWidget::setupModelAndView(int view_id)
 {
     switch (view_id) {
     case 0:
@@ -243,7 +243,7 @@ void LogbookWidget::on_flightSearchComboBox_currentIndexChanged(int)
     emit ui->showAllButton->clicked();
 }
 
-void LogbookWidget::onDisplayModel_dataBaseUpdated()
+void LogbookWidget::refresh()
 {
     //refresh view to reflect changes the user has made via a dialog.
     displayModel->select();
@@ -253,7 +253,7 @@ void LogbookWidget::onDisplayModel_dataBaseUpdated()
 void LogbookWidget::onLogbookWidget_viewSelectionChanged(SettingsWidget::SettingSignal signal)
 {
     if (signal == SettingsWidget::SettingSignal::LogbookWidget)
-        prepareModelAndView(ASettings::read(ASettings::Main::LogbookView).toInt());
+        setupModelAndView(ASettings::read(ASettings::Main::LogbookView).toInt());
 }
 
 void LogbookWidget::on_showAllButton_clicked()

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

@@ -53,7 +53,7 @@ private slots:
     void on_flightSearchComboBox_currentIndexChanged(int);
 
 public slots:
-    void onDisplayModel_dataBaseUpdated();
+    void refresh();
     void onLogbookWidget_viewSelectionChanged(SettingsWidget::SettingSignal signal);
 
 private:
@@ -71,7 +71,7 @@ private:
 
     QVector<qint32> selectedFlights;
 
-    void prepareModelAndView(int view_id);
+    void setupModelAndView(int view_id);
     void connectSignalsAndSlots();
 };
 

+ 46 - 36
src/gui/widgets/pilotswidget.cpp

@@ -27,6 +27,9 @@ PilotsWidget::PilotsWidget(QWidget *parent) :
 {
     ui->setupUi(this);
 
+    ui->tableView->setMinimumWidth(this->width()/2);
+    ui->stackedWidget->setMinimumWidth(this->width()/2);
+
     setupModelAndView();
 }
 
@@ -37,59 +40,64 @@ PilotsWidget::~PilotsWidget()
 
 void PilotsWidget::setupModelAndView()
 {
-    sortColumn = ASettings::read(ASettings::UserData::PilotSortColumn).toInt();
-
     model = new QSqlTableModel(this);
     model->setTable(QStringLiteral("viewPilots"));
     model->setFilter(QStringLiteral("ID > 1")); // Don't show self
     model->select();
 
-    view = ui->pilotsTableView;
+    view = ui->tableView;
     view->setModel(model);
     view->setSelectionBehavior(QAbstractItemView::SelectRows);
     view->setSelectionMode(QAbstractItemView::SingleSelection);
     view->setEditTriggers(QAbstractItemView::NoEditTriggers);
     view->horizontalHeader()->setStretchLastSection(QHeaderView::Stretch);
     view->hideColumn(0);
-    view->setColumnWidth(1, 180);
-    view->setColumnWidth(2, 180);
+    view->resizeColumnsToContents();
     view->verticalHeader()->hide();
     view->setAlternatingRowColors(true);
     view->setSortingEnabled(true);
+    sortColumn = ASettings::read(ASettings::UserData::PilotSortColumn).toInt();
     view->sortByColumn(sortColumn, Qt::AscendingOrder);
 
     view->show();
     selectionModel = view->selectionModel();
 
-    QObject::connect(ui->pilotsTableView->selectionModel(), &QItemSelectionModel::selectionChanged,
-                     this, &PilotsWidget::tableView_selectionChanged);
-    QObject::connect(ui->pilotsTableView->horizontalHeader(), &QHeaderView::sectionClicked,
-                     this, &PilotsWidget::tableView_headerClicked);
+    QObject::connect(ui->tableView->selectionModel(),   &QItemSelectionModel::selectionChanged,
+                     this,                                    &PilotsWidget::tableView_selectionChanged);
+    QObject::connect(ui->tableView->horizontalHeader(), &QHeaderView::sectionClicked,
+                     this,                                    &PilotsWidget::tableView_headerClicked);
 }
 
-void PilotsWidget::on_pilotSearchLineEdit_textChanged(const QString &arg1)
+void PilotsWidget::onPilotsWidget_settingChanged(SettingsWidget::SettingSignal signal)
 {
-    model->setFilter("\"" + ui->pilotsSearchComboBox->currentText() + "\" LIKE \"%" + arg1 + "%\" AND ID > 1");
+    if (signal == SettingsWidget::PilotsWidget)
+        setupModelAndView();
 }
 
-void PilotsWidget::onDisplayModel_dataBaseUpdated()
+void PilotsWidget::onPilotsWidget_databaseUpdated()
 {
-    //refresh view to reflect changes the user has made via a dialog.
-    model->select();
+    refreshView();
+}
+
+void PilotsWidget::onNewPilotDialog_editingFinished()
+{
+    refreshView();
+}
+
+void PilotsWidget::on_pilotSearchLineEdit_textChanged(const QString &arg1)
+{
+    model->setFilter(QLatin1Char('\"') + ui->pilotsSearchComboBox->currentText()
+                     + QLatin1String("\" LIKE '%") + arg1
+                     + QLatin1String("%' AND ID > 1"));
 }
 
-void PilotsWidget::tableView_selectionChanged()//const QItemSelection &index, const QItemSelection &
+void PilotsWidget::tableView_selectionChanged()
 {
     if (this->findChild<NewPilotDialog*>() != nullptr) {
         delete this->findChild<NewPilotDialog*>();
-        /// [F] if the user changes the selection without making any changes,
-        /// if(selectedPilots.length() == 1) spawns a new dialog without the
-        /// old one being deleted, since neither accept() nor reject() was emitted.
-        /// Is this a reasonable way of avoiding pollution? Creating the widgets on the
-        /// stack does not seem to solve the problem since the Dialog does not get deleted
-        /// until either accept() or reject() is emitted so I went for this solution.
     }
-    auto *selection = ui->pilotsTableView->selectionModel();
+
+    auto *selection = ui->tableView->selectionModel();
     selectedPilots.clear();
 
     for (const auto& row : selection->selectedRows()) {
@@ -99,10 +107,10 @@ void PilotsWidget::tableView_selectionChanged()//const QItemSelection &index, co
     if(selectedPilots.length() == 1) {
 
         NewPilotDialog* np = new NewPilotDialog(selectedPilots.first(), this);
-        QObject::connect(np, &QDialog::accepted,
-                         this, &PilotsWidget::pilot_editing_finished);
-        QObject::connect(np, &QDialog::rejected,
-                         this, &PilotsWidget::pilot_editing_finished);
+        QObject::connect(np,   &QDialog::accepted,
+                         this, &PilotsWidget::onNewPilotDialog_editingFinished);
+        QObject::connect(np,   &QDialog::rejected,
+                         this, &PilotsWidget::onNewPilotDialog_editingFinished);
         np->setWindowFlag(Qt::Widget);
         np->setAttribute(Qt::WA_DeleteOnClose);
         ui->stackedWidget->addWidget(np);
@@ -121,9 +129,9 @@ void PilotsWidget::on_newPilotButton_clicked()
 {
     NewPilotDialog* np = new NewPilotDialog(this);
     QObject::connect(np,   &QDialog::accepted,
-                     this, &PilotsWidget::pilot_editing_finished);
+                     this, &PilotsWidget::onNewPilotDialog_editingFinished);
     QObject::connect(np,   &QDialog::rejected,
-                     this, &PilotsWidget::pilot_editing_finished);
+                     this, &PilotsWidget::onNewPilotDialog_editingFinished);
     np->setAttribute(Qt::WA_DeleteOnClose);
     np->exec();
 }
@@ -163,13 +171,20 @@ void PilotsWidget::on_deletePilotButton_clicked()
                 onDeleteUnsuccessful();
         }
     }
-    model->select();
+    refreshView();
 }
 
+/*!
+ * \brief Informs the user that deleting a database entry has been unsuccessful
+ *
+ * \abstract Normally, when one of these entries can not be deleted, it is because of
+ * a [foreign key constraint](https://sqlite.org/foreignkeys.html), meaning that a flight
+ * is associated with the Pilot that was supposed to be deleted as Pilot-in-command.
+ *
+ * This function is used to inform the user and give hints on how to solve the problem.
+ */
 void PilotsWidget::onDeleteUnsuccessful()
 {
-    /// [F]: To do: Some logic to display a warning if too many entries exists, so that
-    /// the messagebox doesn't grow too tall.
     QList<int> foreign_key_constraints = aDB->getForeignKeyConstraints(selectedPilots.first(),
                                                                        ADatabaseTarget::pilots);
     QList<AFlightEntry> constrained_flights;
@@ -205,8 +220,3 @@ void PilotsWidget::onDeleteUnsuccessful()
         message_box.exec();
     }
 }
-
-void PilotsWidget::pilot_editing_finished()
-{
-    model->select();
-}

+ 33 - 4
src/gui/widgets/pilotswidget.h

@@ -21,15 +21,35 @@
 #include <QWidget>
 #include <QItemSelection>
 #include <QSqlTableModel>
-#include <QDebug>
 #include <QTableView>
 #include "src/classes/asettings.h"
 #include "src/gui/dialogues/newpilotdialog.h"
+#include "src/gui/widgets/settingswidget.h"
 
 namespace Ui {
 class PilotsWidget;
 }
-
+/*!
+ * \class PilotsWidget
+ * \brief The PilotsWidget is used to view, edit, delete or add new pilots.
+ * \abstract The widget consists of two main parts, a *QTableView* on the left side and a *QStackedWidget* on the right side.
+ *
+ * In the QTableView, a QSqlTableModel is used to access a view from the database, which holds a Pilots' Last Name,
+ * First name and Company.
+ *
+ * The welcome page shown on the QStackedWidget on the right side has a QLineEdit that functions as a search box and a QCombobox
+ * holding the possible columns that can be used to filter what is displayed. The text of the QLineEdit is used as a filter for the
+ * QSqlTableModel, so the view is updated in real time.
+ *
+ * The *NewPilotDialog* is used for creating a new entry as well as for editing an existing entry. If the user selects a row
+ * in the QTableView, the NewPilotDialog is displayed on the right side of the Widget, inside the QStackedWidget.
+ * In order to avoid leaks from any previously made selections, existing Dialogs are deleted before a new one is created.
+ * The NewPilotDialog's `accepted` and `rejected` signals are connected to refresh the view as required.
+ *
+ * The logbook owner is not shown in the QTableView as an editable Pilot since `self` is a special reserved alias for the
+ * pilot with ROWID #1 as a way to identify and adequately display the logbook owner in the logbook. Editing personal details
+ * is done via the *SettingsWidget*
+ */
 class PilotsWidget : public QWidget
 {
     Q_OBJECT
@@ -44,11 +64,18 @@ private slots:
     void on_newPilotButton_clicked();
     void on_deletePilotButton_clicked();
     void onDeleteUnsuccessful();
-    void pilot_editing_finished();
+    void onNewPilotDialog_editingFinished();
     void on_pilotSearchLineEdit_textChanged(const QString &arg1);
 
 public slots:
-    void onDisplayModel_dataBaseUpdated();
+    /*!
+     * \brief invokes setupModelAndView() to account for changes the user has made in the SettingsWidget
+     */
+    void onPilotsWidget_settingChanged(SettingsWidget::SettingSignal signal);
+    /*!
+     * \brief Refreshes the view if the Database has been altered from outside the AircraftWidget
+     */
+    void onPilotsWidget_databaseUpdated();
 
 private:
     Ui::PilotsWidget *ui;
@@ -64,6 +91,8 @@ private:
     QVector<qint32> selectedPilots;
 
     void setupModelAndView();
+
+    inline void refreshView(){model->select();}
 };
 
 #endif // PILOTSWIDGET_H

+ 184 - 118
src/gui/widgets/pilotswidget.ui

@@ -13,130 +13,196 @@
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout">
+  <layout class="QGridLayout" name="gridLayout_2">
    <item row="0" column="0">
-    <widget class="QTableView" name="pilotsTableView"/>
+    <widget class="QTableView" name="tableView">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+    </widget>
    </item>
    <item row="0" column="1" rowspan="3">
-    <layout class="QHBoxLayout" name="horizontalLayout">
-     <item>
-      <spacer name="horizontalSpacer">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QStackedWidget" name="stackedWidget">
-       <property name="currentIndex">
-        <number>0</number>
-       </property>
-       <widget class="QWidget" name="welcomePage">
-        <layout class="QGridLayout" name="gridLayout_3">
-         <item row="0" column="0">
-          <spacer name="verticalSpacer">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>424</height>
-            </size>
-           </property>
-          </spacer>
+    <widget class="QStackedWidget" name="stackedWidget">
+     <property name="currentIndex">
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="welcomePage">
+      <layout class="QGridLayout" name="gridLayout">
+       <item row="0" column="3">
+        <spacer name="verticalSpacer">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>292</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="1" column="1">
+        <widget class="QLabel" name="searchLabel">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Search:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="2">
+        <widget class="QLineEdit" name="pilotSearchLineEdit">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="0">
+        <widget class="QLabel" name="spacerLabel">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1">
+        <widget class="QLabel" name="searchInLabel">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Search in:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="2">
+        <widget class="QComboBox" name="pilotsSearchComboBox">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <item>
+          <property name="text">
+           <string>Last Name</string>
+          </property>
          </item>
-         <item row="1" column="0">
-          <layout class="QGridLayout" name="pilotsDiasogGridLayout">
-           <item row="0" column="0">
-            <widget class="QLabel" name="searchLabel">
-             <property name="text">
-              <string>Search:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="0" column="1">
-            <widget class="QLineEdit" name="pilotSearchLineEdit"/>
-           </item>
-           <item row="1" column="0">
-            <widget class="QLabel" name="searchInLabel">
-             <property name="text">
-              <string>Search in:</string>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="1">
-            <widget class="QComboBox" name="pilotsSearchComboBox">
-             <item>
-              <property name="text">
-               <string>Last Name</string>
-              </property>
-             </item>
-             <item>
-              <property name="text">
-               <string>First Name</string>
-              </property>
-             </item>
-             <item>
-              <property name="text">
-               <string>Company</string>
-              </property>
-             </item>
-            </widget>
-           </item>
-           <item row="2" column="0" colspan="2">
-            <widget class="QLabel" name="spacerLabel">
-             <property name="text">
-              <string/>
-             </property>
-            </widget>
-           </item>
-           <item row="3" column="0" colspan="2">
-            <widget class="QLabel" name="welcomeLabel">
-             <property name="text">
-              <string>Select a Pilot from the List to show or edit details.</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
+         <item>
+          <property name="text">
+           <string>First Name</string>
+          </property>
          </item>
-         <item row="2" column="0">
-          <spacer name="verticalSpacer_2">
-           <property name="orientation">
-            <enum>Qt::Vertical</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>20</width>
-             <height>423</height>
-            </size>
-           </property>
-          </spacer>
+         <item>
+          <property name="text">
+           <string>Company</string>
+          </property>
          </item>
-        </layout>
-       </widget>
-      </widget>
-     </item>
-     <item>
-      <spacer name="horizontalSpacer_2">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-    </layout>
+        </widget>
+       </item>
+       <item row="3" column="0">
+        <spacer name="horizontalSpacer">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>134</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="4" column="3">
+        <spacer name="verticalSpacer_2">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>292</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="3" column="1" colspan="2">
+        <widget class="QLabel" name="welcomeLabel">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Select a Pilot from the List to show or edit details.</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="3" colspan="2">
+        <spacer name="horizontalSpacer_2">
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>134</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+    </widget>
    </item>
    <item row="1" column="0">
     <widget class="QPushButton" name="newPilotButton">

+ 9 - 3
src/gui/widgets/settingswidget.cpp

@@ -51,6 +51,9 @@ 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();
@@ -152,9 +155,9 @@ void SettingsWidget::readSettings()
     /*
      * Misc Tab
      */
-    ui->acSortComboBox->setCurrentIndex(ASettings::read(ASettings::UserData::TailSortColumn).toInt());
+    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());
+    //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);
@@ -319,13 +322,16 @@ void SettingsWidget::on_logbookViewComboBox_currentIndexChanged(int index)
 void SettingsWidget::on_pilotSortComboBox_currentIndexChanged(int index)
 {
     ASettings::write(ASettings::UserData::PilotSortColumn, index);
+    emit settingChanged(PilotsWidget);
 }
 
-void SettingsWidget::on_acSortComboBox_currentIndexChanged(int index)
+void SettingsWidget::on_acftSortComboBox_currentIndexChanged(int index)
 {
     ASettings::write(ASettings::UserData::TailSortColumn, index);
+    emit settingChanged(AircraftWidget);
 }
 
+QT_DEPRECATED
 void SettingsWidget::on_acAllowIncompleteComboBox_currentIndexChanged(int index)
 {
     ASettings::write(ASettings::UserData::AcftAllowIncomplete, index);

+ 2 - 2
src/gui/widgets/settingswidget.h

@@ -41,13 +41,13 @@ public:
     /*!
      * \brief Widgets that need to receive a signal when a setting is updated.
      */
-    enum SettingSignal {LogbookWidget, HomeWidget};
+    enum SettingSignal {LogbookWidget, HomeWidget, AircraftWidget, PilotsWidget};
 
 private slots:
 
 //    void onThemeGroup_buttonClicked(int theme_id);
     void on_aboutPushButton_clicked();
-    void on_acSortComboBox_currentIndexChanged(int index);
+    void on_acftSortComboBox_currentIndexChanged(int index);
     void on_acAllowIncompleteComboBox_currentIndexChanged(int index);
     void on_prefixLineEdit_textChanged(const QString &arg1);
     void on_lastnameLineEdit_editingFinished();

+ 3 - 3
src/gui/widgets/settingswidget.ui

@@ -17,7 +17,7 @@
    <item row="0" column="0">
     <widget class="QTabWidget" name="tabWidget">
      <property name="currentIndex">
-      <number>2</number>
+      <number>3</number>
      </property>
      <widget class="QWidget" name="personalTab">
       <attribute name="title">
@@ -998,7 +998,7 @@
         </widget>
        </item>
        <item row="3" column="0">
-        <widget class="QLabel" name="acSortLabel">
+        <widget class="QLabel" name="acftSortLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
            <horstretch>0</horstretch>
@@ -1017,7 +1017,7 @@
         </widget>
        </item>
        <item row="3" column="2">
-        <widget class="QComboBox" name="acSortComboBox">
+        <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>
          </property>

+ 2 - 0
src/oplconstants.h

@@ -178,8 +178,10 @@ namespace Assets {
 
 static const auto LOGO                  = QLatin1String(":/icons/opl-icons/opl_logo.svg");
 static const auto ICON_APPICON          = QLatin1String(":/icons/opl-icons/icon_main.svg");
+static const auto ICON_HOME             = QLatin1String(":/icons/opl-icons/icon_home.svg");
 static const auto ICON_ABOUT            = QLatin1String(":/icons/opl-icons/icon_about.png");
 static const auto ICON_PILOT            = QLatin1String(":/icons/opl-icons/pilot.png");
+static const auto ICON_PILOT_DARK       = QLatin1String(":/icons/opl-icons/pilot_dark.png");
 static const auto ICON_NEW_FLIGHT       = QLatin1String(":/icons/opl-icons/new_flight.png");
 static const auto ICON_AIRCRAFT         = QLatin1String(":/icons/opl-icons/aircraft.png");
 static const auto ICON_BACKUP           = QLatin1String(":/icons/opl-icons/icon_backup.svg");