Sfoglia il codice sorgente

Tweaks to UI and Settings

- Added colour-coded advisories for approaching or exceeding Flight Time Limitations or Currencies on HomeWidget
- Logbookwidget Tableview headers now automatically resize the columns according to their content instead of manual hardcoded values
- Unified settings in ASettings
Felix Turo 4 anni fa
parent
commit
bf6f68dee5

+ 1 - 1
assets/database/templates/changelog.csv

@@ -5,7 +5,7 @@ revision,comment,date
 4,Added viewEASA for EASA logbook like display,2020-11-02
 5,Added Diamond Aircraft to aircraft table,2020-11-19
 6,Added icao/iata codes for Boeing in aircraft table,2020-11-19
-7,"Added autoincrement for flights, pilots and tails tables",2020-11-20
+7,Added autoincrement for flights pilots and tails tables,2020-11-20
 8,changed column tDual to tDUAL in table flights for consistency in naming,2020-11-23
 9,changed column id to flight_id in table flights for consistency in naming,2020-11-23
 10,added viewDefault as a copy of Logbook (deprecated),2020-11-23

+ 2 - 2
main.cpp

@@ -55,12 +55,12 @@ int main(int argc, char *argv[])
         return 2;
     }
 
-    if (!ASettings::read(ASettings::Setup::SetupComplete).toBool()) {
+    if (!ASettings::read(ASettings::Main::SetupComplete).toBool()) {
         if(FirstRunDialog().exec() == QDialog::Rejected){
             DEB << "First run not accepted. Exiting.";
             return 3;
         }
-        ASettings::write(ASettings::Setup::SetupComplete, true);
+        ASettings::write(ASettings::Main::SetupComplete, true);
         DEB << "Wrote setup_commplete?";
     }
 

+ 6 - 50
src/classes/asettings.cpp

@@ -20,14 +20,12 @@
 
 
 QMap<ASettings::Main, QString> ASettings::mainMap = {
+    {Main::SetupComplete,               QStringLiteral("setupComplete")},
     {Main::Style,                       QStringLiteral("style")},
     {Main::Font,                        QStringLiteral("font")},
     {Main::FontSize,                    QStringLiteral("fontSize")},
     {Main::UseSystemFont,               QStringLiteral("useSystemFont")},
-};
-
-QMap<ASettings::LogBook, QString> ASettings::logBookMap = {
-    {LogBook::View,                     QStringLiteral("view")},
+    {Main::LogbookView,                 QStringLiteral("logbookView")},
 };
 
 QMap<ASettings::UserData, QString> ASettings::userDataMap = {
@@ -35,6 +33,7 @@ QMap<ASettings::UserData, QString> ASettings::userDataMap = {
     {UserData::AcftSortColumn,          QStringLiteral("acSortColumn")},  // [G]: inconsistent naming
     {UserData::PilSortColumn,           QStringLiteral("pilSortColumn")},
     {UserData::AcAllowIncomplete,       QStringLiteral("acAllowIncomplete")},
+    {UserData::FtlWarningThreshold,     QStringLiteral("ftlWarningThreshold")},
 };
 
 QMap<ASettings::FlightLogging, QString> ASettings::flightLoggingMap = {
@@ -49,16 +48,9 @@ QMap<ASettings::FlightLogging, QString> ASettings::flightLoggingMap = {
     {FlightLogging::PilotFlying,        QStringLiteral("pilotFlying")},
     {FlightLogging::NightAngle,         QStringLiteral("nightangle")},
     {FlightLogging::Rules,              QStringLiteral("rules")},
-    {FlightLogging::FlightTimeFormat,   QStringLiteral("flightTimeFormat")}
-};
-
-QMap<ASettings::Setup, QString> ASettings::setupMap = {
-    {Setup::SetupComplete,              QStringLiteral("setupComplete")}
-};
-
-QMap<ASettings::NewFlight, QString> ASettings::newFlightMap = {
-    {NewFlight::FunctionComboBox,       QStringLiteral("FunctionComboBox")},  // inconsistent naming
-    {NewFlight::CalendarCheckBox,       QStringLiteral("calendarCheckBox")},
+    {FlightLogging::FlightTimeFormat,   QStringLiteral("flightTimeFormat")},
+    {FlightLogging::FunctionComboBox,   QStringLiteral("functionComboBox")},
+    {FlightLogging::CalendarCheckBox,   QStringLiteral("calendarCheckBox")},
 };
 
 void ASettings::setup()
@@ -77,30 +69,12 @@ QVariant ASettings::read(const FlightLogging key)
 void ASettings::write(const FlightLogging key, const QVariant &val)
 { QSettings().setValue(groupOfKey(key), val); }
 
-QVariant ASettings::read(const LogBook key)
-{ return QSettings().value(groupOfKey(key)); }
-
-void ASettings::write(const LogBook key, const QVariant &val)
-{ QSettings().setValue(groupOfKey(key), val); }
-
 QVariant ASettings::read(const Main key)
 { return QSettings().value(groupOfKey(key)); }
 
 void ASettings::write(const Main key, const QVariant &val)
 { QSettings().setValue(groupOfKey(key), val); }
 
-QVariant ASettings::read(const Setup key)
-{ return QSettings().value(groupOfKey(key)); }
-
-void ASettings::write(const Setup key, const QVariant &val)
-{ QSettings().setValue(groupOfKey(key), val); }
-
-QVariant ASettings::read(const NewFlight key)
-{ return QSettings().value(groupOfKey(key)); }
-
-void ASettings::write(const NewFlight key, const QVariant &val)
-{ QSettings().setValue(groupOfKey(key), val); }
-
 QVariant ASettings::read(const UserData key)
 { return QSettings().value(groupOfKey(key)); }
 
@@ -113,18 +87,9 @@ void ASettings::write(const UserData key, const QVariant &val)
 QString ASettings::groupOfKey (const ASettings::FlightLogging key)
 { return QStringLiteral("flightlogging/") + flightLoggingMap[key]; }
 
-QString ASettings::groupOfKey (const ASettings::LogBook key)
-{ return QStringLiteral("logbook/") + logBookMap[key]; }
-
 QString ASettings::groupOfKey (const ASettings::Main key)
 { return QStringLiteral("main/") + mainMap[key]; }
 
-QString ASettings::groupOfKey (const ASettings::NewFlight key)
-{ return QStringLiteral("NewFlight/") + newFlightMap[key]; }
-
-QString ASettings::groupOfKey (const ASettings::Setup key)
-{ return QStringLiteral("setup/") + setupMap[key]; }
-
 QString ASettings::groupOfKey (const ASettings::UserData key)
 { return QStringLiteral("userdata/") + userDataMap[key]; }
 
@@ -134,17 +99,8 @@ QString ASettings::groupOfKey (const ASettings::UserData key)
 QString ASettings::stringOfKey (const ASettings::FlightLogging key)
 { return  flightLoggingMap[key]; }
 
-QString ASettings::stringOfKey (const ASettings::LogBook key)
-{ return  logBookMap[key]; }
-
 QString ASettings::stringOfKey (const ASettings::Main key)
 { return  mainMap[key]; }
 
-QString ASettings::stringOfKey (const ASettings::NewFlight key)
-{ return  newFlightMap[key]; }
-
-QString ASettings::stringOfKey (const ASettings::Setup key)
-{ return  setupMap[key]; }
-
 QString ASettings::stringOfKey (const ASettings::UserData key)
 { return  userDataMap[key]; }

+ 4 - 31
src/classes/asettings.h

@@ -26,19 +26,13 @@
  */
 class ASettings {
 public:
-    enum class Setup {
-        SetupComplete,
-    };
-
     enum class Main {
+        SetupComplete,
         Style,
         Font,
         FontSize,
         UseSystemFont,
-    };
-
-    enum class LogBook {
-        View,
+        LogbookView,
     };
 
     enum class UserData {
@@ -46,6 +40,7 @@ public:
         AcftSortColumn,
         PilSortColumn,
         AcAllowIncomplete,
+        FtlWarningThreshold,
     };
 
     enum class FlightLogging {
@@ -60,10 +55,7 @@ public:
         PilotFlying,
         NightAngle,
         Rules,
-        FlightTimeFormat
-    };
-
-    enum class NewFlight {
+        FlightTimeFormat,
         FunctionComboBox,
         CalendarCheckBox,
     };
@@ -73,12 +65,6 @@ public:
      */
     static void setup();
 
-    static QVariant read(const Setup key);
-    static void write(const Setup key, const QVariant &val);
-
-    static QVariant read(const LogBook key);
-    static void write(const LogBook key, const QVariant &val);
-
     static QVariant read(const Main key);
     static void write(const Main key, const QVariant &val);
 
@@ -88,39 +74,26 @@ public:
     static QVariant read(const UserData key);
     static void write(const FlightLogging key, const QVariant &val);
 
-    static QVariant read(const NewFlight key);
-    static void write(const NewFlight key, const QVariant &val);
-
     /*!
      * \brief Return string representation of group of key: "ini_header/key"
      */
     static QString groupOfKey(const Main key);
-    static QString groupOfKey(const LogBook key);
-    static QString groupOfKey(const NewFlight key);
     static QString groupOfKey(const FlightLogging key);
-    static QString groupOfKey(const Setup key);
     static QString groupOfKey(const UserData key);
 
     /*!
      * \brief Return string representation of key
      */
     static QString stringOfKey(const Main key);
-    static QString stringOfKey(const LogBook key);
-    static QString stringOfKey(const NewFlight key);
     static QString stringOfKey(const FlightLogging key);
-    static QString stringOfKey(const Setup key);
     static QString stringOfKey(const UserData key);
 
     static QSettings settings();
 
 private:
     static QMap<Main, QString> mainMap;
-    static QMap<LogBook, QString> logBookMap;
     static QMap<UserData, QString> userDataMap;
     static QMap<FlightLogging, QString> flightLoggingMap;
-    static QMap<Setup, QString> setupMap;
-    static QMap<NewFlight, QString> newFlightMap;
-
 };
 
 #endif // ASETTINGS_H

+ 0 - 1
src/database/adatabasesetup.cpp

@@ -297,7 +297,6 @@ bool ADataBaseSetup::downloadTemplates()
         QFileInfo downloaded_file(template_dir.filePath(table % QStringLiteral(".csv")));
         if (downloaded_file.size() == 0)
             return false; // ssl/network error
-
     }
     return true;
 }

+ 1 - 1
src/functions/astat.cpp

@@ -41,7 +41,7 @@ int AStat::totalTime(TimeFrame time_frame)
         start_date.prepend(QLatin1Char('\''));
         statement = QLatin1String("SELECT SUM(tblk) FROM flights WHERE doft >= ") + start_date;
         break;
-    case AStat::RollingYear:
+    case AStat::Rolling12Months:
         start = QDate::fromJulianDay(QDate::currentDate().toJulianDay() - 365);
         start_date = start.toString(Qt::ISODate);
         start_date.append(QLatin1Char('\''));

+ 1 - 1
src/functions/astat.h

@@ -30,7 +30,7 @@ namespace AStat {
  */
 
 
-    enum TimeFrame {AllTime, CalendarYear, RollingYear, Rolling28Days};
+    enum TimeFrame {AllTime, CalendarYear, Rolling12Months, Rolling28Days};
 
     int totalTime(TimeFrame time_frame);
 

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

@@ -118,6 +118,8 @@ bool FirstRunDialog::finishSetup()
 
 void FirstRunDialog::writeSettings()
 {
+    ASettings::write(ASettings::Main::UseSystemFont, true);
+    ASettings::write(ASettings::Main::LogbookView, 0);
     ASettings::write(ASettings::FlightLogging::Function, ui->functionComboBox->currentText());
     ASettings::write(ASettings::FlightLogging::Approach, ui->approachComboBox->currentIndex());
     ASettings::write(ASettings::FlightLogging::NightLogging, ui->nightComboBox->currentIndex());
@@ -128,8 +130,9 @@ void FirstRunDialog::writeSettings()
     ASettings::write(ASettings::FlightLogging::PopupCalendar, true);
     ASettings::write(ASettings::FlightLogging::PilotFlying, true);
     ASettings::write(ASettings::FlightLogging::FlightTimeFormat, Opl::Time::Default);
-    ASettings::write(ASettings::Main::UseSystemFont, true);
     ASettings::write(ASettings::UserData::DisplaySelfAs, ui->aliasComboBox->currentIndex());
+    // To Do: UI option
+    ASettings::write(ASettings::UserData::FtlWarningThreshold, 0.8);
 }
 
 bool FirstRunDialog::setupDatabase()
@@ -143,7 +146,7 @@ bool FirstRunDialog::setupDatabase()
 
     if (confirm.exec() == QMessageBox::Yes) {
         useLocalTemplates = false;
-        if (!ADataBaseSetup::downloadTemplates()) { // To do: return true only if size of dl != 0
+        if (!ADataBaseSetup::downloadTemplates()) {
             QMessageBox message_box(this);
             message_box.setText(tr("Downloading latest data has failed.<br><br>Using local data instead."));
             message_box.exec();

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

@@ -137,11 +137,11 @@ NewFlightDialog::NewFlightDialog(QWidget *parent) :
     ui->setupUi(this);
     flightEntry = AFlightEntry();
     setup();
-    if (ASettings::read(ASettings::NewFlight::FunctionComboBox).toString() == QLatin1String("SIC")) {
+    if (ASettings::read(ASettings::FlightLogging::FunctionComboBox).toString() == QLatin1String("SIC")) {
         ui->picNameLineEdit->setText(QString());
         ui->secondPilotNameLineEdit->setText("self");
     }
-    if(ASettings::read(ASettings::NewFlight::FunctionComboBox).toString() == QLatin1String("PIC")){
+    if(ASettings::read(ASettings::FlightLogging::FunctionComboBox).toString() == QLatin1String("PIC")){
         ui->picNameLineEdit->setText(QStringLiteral("self"));
         emit ui->picNameLineEdit->editingFinished();
     }
@@ -1110,7 +1110,7 @@ void NewFlightDialog::onDoftLineEdit_entered()
 
 void NewFlightDialog::on_calendarCheckBox_stateChanged(int arg1)
 {
-    ASettings::write(ASettings::NewFlight::CalendarCheckBox, ui->calendarCheckBox->isChecked());
+    ASettings::write(ASettings::FlightLogging::CalendarCheckBox, ui->calendarCheckBox->isChecked());
     DEB << "Calendar check box state changed.";
     switch (arg1) {
     case 0: // unchecked

+ 45 - 6
src/gui/widgets/homewidget.cpp

@@ -20,6 +20,15 @@
 #include "src/testing/adebug.h"
 #include "src/database/adatabase.h"
 #include "src/functions/atime.h"
+#include "src/classes/asettings.h"
+
+// EASA FTL Limitations
+// 100 hours per 28 days
+static const int ROLLING_28_DAYS = 6000;
+// 900 hours per calendar year
+static const int CALENDAR_YEAR = 54000;
+// 1000 hours per rolling 12 months
+static const int ROLLING_12_MONTHS = 60000;
 
 HomeWidget::HomeWidget(QWidget *parent) :
     QWidget(parent),
@@ -28,6 +37,12 @@ HomeWidget::HomeWidget(QWidget *parent) :
     ui->setupUi(this);
     ui->welcomeLabel->setText(tr("Welcome to openPilotLog, %1!").arg(userName()));
 
+
+    displayLabels = {ui->TakeOffDisplayLabel, ui->LandingsDisplayLabel,
+                     ui->FlightTime28dDisplayLabel, ui->FlightTimeCalYearDisplayLabel,
+                     ui->FlightTime12mDisplayLabel};
+    warningThreshold = ASettings::read(ASettings::UserData::FtlWarningThreshold).toDouble();
+    DEB << "Filling Home Widget...";
     fillTotals();
     fillCurrency();
     fillLimitations();
@@ -40,6 +55,9 @@ HomeWidget::~HomeWidget()
 
 void HomeWidget::onHomeWidget_dataBaseUpdated()
 {
+    for (const auto &label : displayLabels)
+        label->setStyleSheet(QString());
+
     fillTotals();
     fillCurrency();
     fillLimitations();
@@ -48,7 +66,6 @@ void HomeWidget::onHomeWidget_dataBaseUpdated()
 void HomeWidget::fillTotals()
 {
     auto data = AStat::totals();
-    DEB << "Filling Totals Line Edits...";
     for (const auto &field : data) {
         auto line_edit = this->findChild<QLineEdit *>(field.first + QLatin1String("LineEdit"));
         line_edit->setText(field.second);
@@ -57,19 +74,41 @@ void HomeWidget::fillTotals()
 
 void HomeWidget::fillCurrency()
 {
-    DEB << "Filling currency labels...";
     auto takeoff_landings = AStat::currencyTakeOffLanding();
 
     ui->TakeOffDisplayLabel->setText(takeoff_landings[0].toString());
+    if (takeoff_landings[0].toUInt() < 3)
+        setLabelColour(ui->TakeOffDisplayLabel, HomeWidget::Red);
     ui->LandingsDisplayLabel->setText(takeoff_landings[1].toString());
+    if (takeoff_landings[1].toUInt() < 3)
+        setLabelColour(ui->LandingsDisplayLabel, HomeWidget::Red);
 }
 
 void HomeWidget::fillLimitations()
 {
-    DEB << "Filling limitations labels...";
-    ui->FlightTime28dDisplayLabel->setText(ATime::toString(AStat::totalTime(AStat::Rolling28Days)));
-    ui->FlightTime12mDisplayLabel->setText(ATime::toString(AStat::totalTime(AStat::RollingYear)));
-    ui->FlightTimeCalYearDisplayLabel->setText(ATime::toString(AStat::totalTime(AStat::CalendarYear)));
+    int minutes = AStat::totalTime(AStat::Rolling28Days);
+    ui->FlightTime28dDisplayLabel->setText(ATime::toString(minutes));
+    if (minutes >= ROLLING_28_DAYS) {
+        setLabelColour(ui->FlightTime28dDisplayLabel, HomeWidget::Red);
+    } else if (minutes >= ROLLING_28_DAYS * warningThreshold) {
+        setLabelColour(ui->FlightTime28dDisplayLabel, HomeWidget::Yellow);
+    }
+
+    minutes = AStat::totalTime(AStat::Rolling12Months);
+    ui->FlightTime12mDisplayLabel->setText(ATime::toString(minutes));
+    if (minutes >= ROLLING_12_MONTHS) {
+        setLabelColour(ui->FlightTime12mDisplayLabel, HomeWidget::Red);
+    } else if (minutes >= ROLLING_12_MONTHS * warningThreshold) {
+        setLabelColour(ui->FlightTime12mDisplayLabel, HomeWidget::Yellow);
+    }
+
+    minutes = AStat::totalTime(AStat::CalendarYear);
+    ui->FlightTimeCalYearDisplayLabel->setText(ATime::toString(minutes));
+    if (minutes >= CALENDAR_YEAR) {
+        setLabelColour(ui->FlightTimeCalYearDisplayLabel, HomeWidget::Red);
+    } else if (minutes >= CALENDAR_YEAR * warningThreshold) {
+        setLabelColour(ui->FlightTimeCalYearDisplayLabel, HomeWidget::Yellow);
+    }
 }
 
 const QString HomeWidget::userName()

+ 20 - 0
src/gui/widgets/homewidget.h

@@ -45,10 +45,30 @@ private:
     void fillCurrency();
     void fillLimitations();
 
+    double warningThreshold;
+
+    QList<QLabel*> displayLabels;
     /*!
      * \brief Retreives the users first name from the database.
      */
     const QString userName();
+
+    enum Colour {Red, Yellow};
+
+    inline void setLabelColour(QLabel* label, Colour colour)
+    {
+        switch (colour) {
+        case HomeWidget::Red:
+            label->setStyleSheet(QStringLiteral("color: red"));
+            break;
+        case HomeWidget::Yellow:
+            label->setStyleSheet(QStringLiteral("color: yellow"));
+            break;
+        default:
+            label->setStyleSheet(QString());
+            break;
+        }
+    }
 public slots:
     void onHomeWidget_dataBaseUpdated();
 };

+ 12 - 0
src/gui/widgets/homewidget.ui

@@ -720,6 +720,12 @@
      </item>
      <item row="0" column="1">
       <widget class="QLabel" name="TakeOffDisplayLabel">
+       <property name="font">
+        <font>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
        <property name="layoutDirection">
         <enum>Qt::LeftToRight</enum>
        </property>
@@ -740,6 +746,12 @@
      </item>
      <item row="1" column="1">
       <widget class="QLabel" name="LandingsDisplayLabel">
+       <property name="font">
+        <font>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
+       </property>
        <property name="layoutDirection">
         <enum>Qt::LeftToRight</enum>
        </property>

+ 31 - 7
src/gui/widgets/logbookwidget.cpp

@@ -47,9 +47,13 @@ LogbookWidget::LogbookWidget(QWidget *parent) :
 
     //Initialise message Box
     messageBox = new QMessageBox(this);
+    // Initalise the display Model and view
+    displayModel = new QSqlTableModel(this);
+    view = ui->tableView;
 
-    prepareModelAndView(ASettings::read(ASettings::LogBook::View).toInt());
+    prepareModelAndView(ASettings::read(ASettings::Main::LogbookView).toInt());
     connectSignalsAndSlots();
+
 }
 
 LogbookWidget::~LogbookWidget()
@@ -65,14 +69,32 @@ void LogbookWidget::prepareModelAndView(int view_id)
 {
     switch (view_id) {
     case 0:
-        setupDefaultView();
+        DEB << "Loading Default View...";
+        displayModel->setTable(QStringLiteral("viewDefault"));
+        displayModel->select();
         break;
     case 1:
-        setupEasaView();
+        DEB << "Loading Default View...";
+        displayModel->setTable(QStringLiteral("viewEASA"));
+        displayModel->select();
         break;
     default:
-        setupDefaultView();
+        DEB << "Loading Default View...";
+        displayModel->setTable(QStringLiteral("viewDefault"));
+        displayModel->select();
     }
+
+    view->setModel(displayModel);
+    view->setSelectionBehavior(QAbstractItemView::SelectRows);
+    view->setSelectionMode(QAbstractItemView::ExtendedSelection);
+    view->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    view->setContextMenuPolicy(Qt::CustomContextMenu);
+    view->horizontalHeader()->setStretchLastSection(QHeaderView::Stretch);
+    view->verticalHeader()->hide();
+    view->setAlternatingRowColors(true);
+    view->hideColumn(0);
+    view->resizeColumnsToContents();
+    view->show();
 }
 
 void LogbookWidget::connectSignalsAndSlots()
@@ -82,7 +104,8 @@ void LogbookWidget::connectSignalsAndSlots()
                      this, &LogbookWidget::flightsTableView_selectionChanged);
 }
 
-void LogbookWidget::setupDefaultView()
+// not manually set at the moment
+/*void LogbookWidget::setupDefaultView()
 {
     DEB << "Loading Default View...";
     displayModel = new QSqlTableModel(this);
@@ -157,13 +180,13 @@ void LogbookWidget::setupEasaView()
     view->hideColumn(0);
 
     view->show();
-}
+}*/
 
 /*
  * Slots
  */
 
-void LogbookWidget::flightsTableView_selectionChanged()//
+void LogbookWidget::flightsTableView_selectionChanged()
 {
     selectedFlights.clear();
     for (const auto& row : selectionModel->selectedRows()) {
@@ -302,6 +325,7 @@ void LogbookWidget::onDisplayModel_dataBaseUpdated()
 {
     //refresh view to reflect changes the user has made via a dialog.
     displayModel->select();
+    view->resizeColumnsToContents();
 }
 
 void LogbookWidget::onLogbookWidget_viewSelectionChanged(int view_id)

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

@@ -72,8 +72,8 @@ private:
 
     void prepareModelAndView(int view_id);
     void connectSignalsAndSlots();
-    void setupDefaultView();
-    void setupEasaView();
+    //void setupDefaultView();
+    //void setupEasaView();
 };
 
 #endif // LOGBOOKWIDGET_H

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

@@ -107,7 +107,7 @@ void SettingsWidget::readSettings()
     ui->nightComboBox->setCurrentIndex(ASettings::read(ASettings::FlightLogging::NightLogging).toInt());
     ui->prefixLineEdit->setText(ASettings::read(ASettings::FlightLogging::FlightNumberPrefix).toString());
 
-    ui->logbookViewComboBox->setCurrentIndex(ASettings::read(ASettings::LogBook::View).toInt());
+    ui->logbookViewComboBox->setCurrentIndex(ASettings::read(ASettings::Main::LogbookView).toInt());
     /*
      * Misc Tab
      */
@@ -265,7 +265,7 @@ void SettingsWidget::on_prefixLineEdit_textChanged(const QString &arg1)
 
 void SettingsWidget::on_logbookViewComboBox_currentIndexChanged(int index)
 {
-    ASettings::write(ASettings::LogBook::View, index);
+    ASettings::write(ASettings::Main::LogbookView, index);
     emit viewSelectionChanged(index);
 }
 void SettingsWidget::on_pilotSortComboBox_currentIndexChanged(int index)