Browse Source

Merge pull request #42 from fiffty-50/develop-styles

Application style encapsulation in AStyle
Felix Turowsky 4 years ago
parent
commit
3abe8ffc46

+ 9 - 30
main.cpp

@@ -22,6 +22,7 @@
 #include "src/classes/asettings.h"
 #include "src/classes/astandardpaths.h"
 #include "src/classes/asettings.h"
+#include "src/classes/astyle.h"
 #include <QApplication>
 #include <QProcess>
 #include <QSettings>
@@ -49,47 +50,25 @@ int main(int argc, char *argv[])
 
     ASettings::setup();
 
+    AStyle::setup();
+
     aDB()->connect();
     if (!ASettings::read(ASettings::Setup::SetupComplete).toBool()) {
-        FirstRunDialog dialog;
-        if(dialog.exec() == QDialog::Rejected){
+        if(FirstRunDialog().exec() == QDialog::Rejected){
             DEB "First run not accepted. Exiting.";
             return 1;
         }
         ASettings::write(ASettings::Setup::SetupComplete, true);
         DEB << "Wrote setup_commplete?";
-        qApp->quit();
-        QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
-    }
-
-    //Theming
-    switch (ASettings::read(ASettings::Main::Theme).toInt()) {
-    case 1:{
-        DEB << "main :: Loading light theme";
-        QFile file(":light.qss");
-        file.open(QFile::ReadOnly | QFile::Text);
-        QTextStream stream(&file);
-        openPilotLog.setStyleSheet(stream.readAll());
-        break;
-    }
-    case 2:{
-        DEB << "Loading dark theme";
-        QFile file(":dark.qss");
-        file.open(QFile::ReadOnly | QFile::Text);
-        QTextStream stream(&file);
-        openPilotLog.setStyleSheet(stream.readAll());
-        break;
-    }
-    default:
-        break;
     }
 
     //sqlite does not deal well with multiple connections, ensure only one instance is running
     ARunGuard guard(QStringLiteral("opl_single_key"));
-        if ( !guard.tryToRun() ){
-            DEB << "Another Instance is already running. Exiting.";
-            return 2;
-        }
+    if ( !guard.tryToRun() ){
+        DEB << "Another Instance is already running. Exiting.";
+        return 2;
+    }
+
 
     MainWindow w;
     //w.showMaximized();

+ 3 - 0
openPilotLog.pro

@@ -15,9 +15,11 @@ DEFINES += QT_DEPRECATED_WARNINGS
 # You can also select to disable deprecated APIs only up to a certain version of Qt.
 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
 
+# [G]: need to fix this. There must be a src/* command or smth
 SOURCES += \
     main.cpp \
     mainwindow.cpp \
+    src/classes/astyle.cpp \
     src/classes/astandardpaths.cpp \
     src/classes/aaircraftentry.cpp \
     src/classes/adownload.cpp \
@@ -48,6 +50,7 @@ SOURCES += \
 
 HEADERS += \
     mainwindow.h \
+    src/classes/astyle.h \
     src/classes/astandardpaths.h \
     src/classes/aaircraftentry.h \
     src/classes/adownload.h \

+ 2 - 1
src/classes/asettings.cpp

@@ -21,7 +21,8 @@
 
 
 QMap<ASettings::Main, QString> ASettings::mainMap = {
-    {Main::Theme,   QStringLiteral("theme")},
+    {Main::Style,      QStringLiteral("style")},
+    {Main::StyleSheet, QStringLiteral("stylesheet")},
 };
 
 QMap<ASettings::LogBook, QString> ASettings::logBookMap = {

+ 2 - 1
src/classes/asettings.h

@@ -31,7 +31,8 @@ public:
     };
 
     enum class Main {
-        Theme,
+        Style,
+        StyleSheet,
     };
 
     enum class LogBook {

+ 90 - 0
src/classes/astyle.cpp

@@ -0,0 +1,90 @@
+#include "astyle.h"
+#include <QStyle>
+#include <QStyleFactory>
+#include <QApplication>
+#include "src/testing/adebug.h"
+#include "src/classes/asettings.h"
+
+#ifdef __linux__
+const QString AStyle::defaultStyle = QStringLiteral("fusion");
+#elif defined(_WIN32) || defined(_WIN64)
+const QString AStyle::defaultStyle = QStringLiteral("Windows");
+#endif
+const QString AStyle::defaultStyleSheet = QStringLiteral("");
+
+const QStringList AStyle::styles = QStyleFactory::keys();
+
+const QMap<AStyle::StyleSheet, QFileInfo> AStyle::defaultStyleSheets = {
+    {Dark, QFileInfo(QStringLiteral("dark.qss"))},
+    {Light, QFileInfo(QStringLiteral("light.qss"))},
+    {Default, QFileInfo(defaultStyleSheet)},
+};
+
+QString AStyle::currentStyle = defaultStyle;
+QString AStyle::currentStyleSheet = defaultStyleSheet;
+
+
+static inline
+QString read_stylesheet(const AStyle::StyleSheet stylesheet)
+{
+    QFileInfo qss_file_info = AStyle::defaultStyleSheets[stylesheet];
+    DEB << "reading:" << ":" + qss_file_info.fileName();
+
+    QFile file(":" + qss_file_info.fileName());
+    file.open(QFile::ReadOnly | QFile::Text);
+    QTextStream stream(&file);
+    return stream.readAll();
+}
+
+/*!
+ * \brief Setup style and stylesheet by reading from openPilotLog.ini
+ */
+void AStyle::setup()
+{
+    // [G]: Are there leaks when style changes?
+    QVariant app_style = ASettings::read(ASettings::Main::Style);
+    if(!app_style.toBool()){
+        DEB << "Setting style to default:" << defaultStyle;
+        app_style = defaultStyle;
+        ASettings::write(ASettings::Main::Style, app_style);
+    }
+    DEB << "Style set to:" << app_style;
+    QApplication::setStyle(QStyleFactory::create(app_style.toString()));
+    currentStyle = app_style.toString();
+
+    auto app_stylesheet = ASettings::read(ASettings::Main::StyleSheet);
+    if(!app_stylesheet.toBool()){
+        DEB << "Setting stylesheet to default:" << defaultStyleSheet;
+        app_stylesheet = defaultStyleSheet;
+        ASettings::write(ASettings::Main::StyleSheet, app_stylesheet);
+    }
+    DEB << "Stylesheet set to:" << app_stylesheet;
+    qApp->setStyleSheet(read_stylesheet(static_cast<StyleSheet>(app_stylesheet.toUInt())));
+    currentStyleSheet = app_stylesheet.toString();
+}
+
+void AStyle::setStyle(const QString style)
+{
+    DEB << "Setting style to:" << style;
+    QApplication::setStyle(QStyleFactory::create(style));
+    ASettings::write(ASettings::Main::Style, style);
+    currentStyle = style;
+}
+
+void AStyle::setStyleSheet(const StyleSheet stylesheet)
+{
+    DEB << "Setting stylesheet to:" << defaultStyleSheets[stylesheet];
+    qApp->setStyleSheet(read_stylesheet(stylesheet));
+    ASettings::write(ASettings::Main::StyleSheet, stylesheet);
+    currentStyleSheet = defaultStyleSheets[stylesheet].fileName();
+}
+
+const QString& AStyle::style()
+{
+    return currentStyle;
+}
+
+const QString& AStyle::styleSheet()
+{
+    return currentStyleSheet;
+}

+ 36 - 0
src/classes/astyle.h

@@ -0,0 +1,36 @@
+#ifndef ASTYLE_H
+#define ASTYLE_H
+#include <QString>
+#include <QFileInfo>
+#include <QMap>
+
+/*!
+ * \brief The AStyle class encapsulates style and stylesheet logic.
+ * \todo Agree upon the file naming of the assets that will be read.
+ * for now it is assumed that dark means "dark.qss"
+ */
+class AStyle
+{
+public:
+    enum StyleSheet{
+        Dark = 0,
+        Light,
+        Default,
+    };
+private:
+    static QString currentStyle;
+    static QString currentStyleSheet;
+public:
+    static const QStringList styles;
+    static const QString defaultStyle;
+    static const QString defaultStyleSheet;
+    static const QMap<StyleSheet, QFileInfo> defaultStyleSheets;
+
+    static void setup();
+    static void setStyle(const QString style);
+    static void setStyleSheet(const StyleSheet stylesheet);
+    static const QString& style();
+    static const QString& styleSheet();
+};
+
+#endif // ASTYLE_H

+ 1 - 1
src/database/adatabasesetup.cpp

@@ -305,7 +305,7 @@ bool ADataBaseSetup::backupOldData()
 
     auto date_string = QDateTime::currentDateTime().toString(Qt::ISODate);
     auto backup_dir = QDir(AStandardPaths::absPathOf(AStandardPaths::DatabaseBackup));
-    auto backup_name = database_file.baseName() + "-backup-" + date_string + ".bak";
+    auto backup_name = database_file.baseName() + "_bak_" + date_string + ".db";
     auto file = QFile(aDB()->databaseFile.absoluteFilePath());
 
     if (!file.rename(backup_dir.absolutePath() + '/' + backup_name)) {

+ 10 - 10
src/gui/dialogues/firstrundialog.cpp

@@ -19,13 +19,13 @@ FirstRunDialog::FirstRunDialog(QWidget *parent) :
     ui->previousPushButton->setEnabled(false);
     ui->nightComboBox->setCurrentIndex(1);
 
-    auto *themeGroup = new QButtonGroup;
-    themeGroup->addButton(ui->systemThemeCheckBox, 0);
-    themeGroup->addButton(ui->lightThemeCheckBox, 1);
-    themeGroup->addButton(ui->darkThemeCheckBox, 2);
+//    auto *themeGroup = new QButtonGroup;
+//    themeGroup->addButton(ui->systemThemeCheckBox, 0);
+//    themeGroup->addButton(ui->lightThemeCheckBox, 1);
+//    themeGroup->addButton(ui->darkThemeCheckBox, 2);
 
-    QObject::connect(themeGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
-                     this, &FirstRunDialog::on_themeGroup_toggled);
+//    QObject::connect(themeGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
+//                     this, &FirstRunDialog::on_themeGroup_toggled);
 }
 
 FirstRunDialog::~FirstRunDialog()
@@ -79,10 +79,10 @@ void FirstRunDialog::on_nextPushButton_clicked()
     ui->stackedWidget->setCurrentIndex(current_idx + 1);
 }
 
-void FirstRunDialog::on_themeGroup_toggled(int id)
-{
-    ASettings::write(ASettings::Main::Theme, id);
-}
+//void FirstRunDialog::on_themeGroup_toggled(int id)
+//{
+//    ASettings::write(ASettings::Main::Theme, id);
+//}
 
 bool FirstRunDialog::finish()
 {

+ 1 - 1
src/gui/dialogues/firstrundialog.h

@@ -24,7 +24,7 @@ private slots:
 
     void on_nextPushButton_clicked();
 
-    void on_themeGroup_toggled(int id);
+//    void on_themeGroup_toggled(int id);
 
 private:
     Ui::FirstRunDialog *ui;

+ 0 - 34
src/gui/dialogues/firstrundialog.ui

@@ -394,20 +394,6 @@
      </widget>
      <widget class="QWidget" name="stackedWidgetPage3">
       <layout class="QGridLayout" name="gridLayout_4">
-       <item row="2" column="1">
-        <widget class="QCheckBox" name="lightThemeCheckBox">
-         <property name="text">
-          <string>Light Theme</string>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="1">
-        <widget class="QCheckBox" name="darkThemeCheckBox">
-         <property name="text">
-          <string>Dark Theme</string>
-         </property>
-        </widget>
-       </item>
        <item row="0" column="0" colspan="2">
         <widget class="QLabel" name="label_4">
          <property name="text">
@@ -421,23 +407,6 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="themeLabel">
-         <property name="text">
-          <string>Theme</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1">
-        <widget class="QCheckBox" name="systemThemeCheckBox">
-         <property name="text">
-          <string>System Theme</string>
-         </property>
-         <property name="checked">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
       </layout>
      </widget>
     </widget>
@@ -458,9 +427,6 @@
   <tabstop>approachComboBox</tabstop>
   <tabstop>nightComboBox</tabstop>
   <tabstop>prefixLineEdit</tabstop>
-  <tabstop>systemThemeCheckBox</tabstop>
-  <tabstop>lightThemeCheckBox</tabstop>
-  <tabstop>darkThemeCheckBox</tabstop>
   <tabstop>stackedWidget</tabstop>
  </tabstops>
  <resources/>

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

@@ -85,7 +85,7 @@ void LogbookWidget::connectSignalsAndSlots()
 void LogbookWidget::setupDefaultView()
 {
     DEB << "Loading Default View...";
-    displayModel = new QSqlTableModel;
+    displayModel = new QSqlTableModel(this);
     displayModel->setTable("viewDefault");
     displayModel->select();
 

+ 30 - 38
src/gui/widgets/settingswidget.cpp

@@ -18,11 +18,13 @@
 #include "settingswidget.h"
 #include "ui_settingswidget.h"
 #include "src/testing/adebug.h"
-
+#include "src/classes/astyle.h"
 #include "src/classes/asettings.h"
 #include "src/database/adatabase.h"
 #include "src/classes/apilotentry.h"
 
+#include <QStyleFactory>
+
 static const auto FIRSTNAME_VALID = QPair<QString, QRegularExpression> {
     "firstnameLineEdit", QRegularExpression("[a-zA-Z]+")};
 static const auto LASTNAME_VALID = QPair<QString, QRegularExpression> {
@@ -51,18 +53,23 @@ SettingsWidget::SettingsWidget(QWidget *parent) :
     ui->setupUi(this);
     ui->tabWidget->setCurrentIndex(0);
 
-    auto *themeGroup = new QButtonGroup;
-    themeGroup->addButton(ui->systemThemeCheckBox, 0);
-    themeGroup->addButton(ui->lightThemeCheckBox, 1);
-    themeGroup->addButton(ui->darkThemeCheckBox, 2);
+    auto styles = AStyle::styles;
+    auto current_style = AStyle::style();
+    ui->styleComboBox->addItem(current_style);
+    styles.removeOne(current_style);
+
+    ui->styleComboBox->addItems(styles);
+    ui->styleComboBox->model()->sort(0);
+    ui->styleComboBox->setCurrentText(current_style);
+
+    if(ASettings::read(ASettings::Main::StyleSheet).toUInt() == AStyle::Dark)
+        ui->darkStyleCheckBox->setCheckState(Qt::Checked);
 
     readSettings();
     setupValidators();
-
-    QObject::connect(themeGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
-                     this, &SettingsWidget::onThemeGroup_buttonClicked);
 }
 
+
 SettingsWidget::~SettingsWidget()
 {
     delete ui;
@@ -89,19 +96,6 @@ void SettingsWidget::readSettings()
     ui->nightComboBox->setCurrentIndex(ASettings::read(ASettings::FlightLogging::NightLogging).toInt());
     ui->prefixLineEdit->setText(ASettings::read(ASettings::FlightLogging::FlightNumberPrefix).toString());
 
-    /*
-     * Misc Tab
-     */
-    switch (ASettings::read(ASettings::Main::Theme).toInt()) {
-    case 0:
-        ui->systemThemeCheckBox->setChecked(true);
-        break;
-    case 1:
-        ui->lightThemeCheckBox->setChecked(true);
-        break;
-    case 2:
-        ui->darkThemeCheckBox->setChecked(true);
-    }
     ui->logbookViewComboBox->setCurrentIndex(ASettings::read(ASettings::LogBook::View).toInt());
     /*
      * Aircraft Tab
@@ -265,24 +259,7 @@ void SettingsWidget::on_prefixLineEdit_textChanged(const QString &arg1)
 /*
  * Misc Tab
  */
-void SettingsWidget::onThemeGroup_buttonClicked(int theme_id)
-{
-    ASettings::write(ASettings::Main::Theme, theme_id);
-
-    QMessageBox::StandardButton reply;
-    reply = QMessageBox::question(this, "Changing Themes",
-                                  "Changing the theme requires restarting the Application.\n\nWould you like to restart now?",
-                                  QMessageBox::Yes | QMessageBox::No);
-    if (reply == QMessageBox::Yes) {
-        qApp->quit();
-        QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
 
-    } else {
-        QMessageBox *info = new QMessageBox(this);
-        info->setText("Theme change will take effect the next time you start the application.");
-        info->exec();
-    }
-}
 void SettingsWidget::on_logbookViewComboBox_currentIndexChanged(int index)
 {
     ASettings::write(ASettings::LogBook::View, index);
@@ -362,3 +339,18 @@ void SettingsWidget::on_aboutPushButton_clicked()
     message_box.setText(text);
     message_box.exec();
 }
+
+void SettingsWidget::on_styleComboBox_currentTextChanged(const QString& text)
+{
+    DEB << text;
+    AStyle::setStyle(text);
+}
+
+void SettingsWidget::on_darkStyleCheckBox_stateChanged(int state)
+{
+    DEB << "Setting to:" << (state ? "dark" : "default");
+    if(state == Qt::Checked)
+        AStyle::setStyleSheet(AStyle::Dark);
+    else
+        AStyle::setStyleSheet(AStyle::Default);
+}

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

@@ -39,7 +39,7 @@ public:
 
 private slots:
 
-    void onThemeGroup_buttonClicked(int theme_id);
+//    void onThemeGroup_buttonClicked(int theme_id);
     void on_aboutPushButton_clicked();
     void on_acSortComboBox_currentIndexChanged(int index);
     void on_acAllowIncompleteComboBox_currentIndexChanged(int index);
@@ -57,6 +57,8 @@ private slots:
     void on_pilotSortComboBox_currentIndexChanged(int index);
     void on_logbookViewComboBox_currentIndexChanged(int index);
     void on_companyLineEdit_editingFinished();
+    void on_darkStyleCheckBox_stateChanged(int state);
+    void on_styleComboBox_currentTextChanged(const QString& index);
 
 private:
     Ui::SettingsWidget *ui;

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

@@ -468,61 +468,14 @@
        <string>Misc</string>
       </attribute>
       <layout class="QGridLayout" name="gridLayout_5">
-       <item row="0" column="1">
-        <widget class="QLabel" name="themeLabel">
-         <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Changes the theme of the application.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="text">
-          <string>Theme</string>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="2">
-        <widget class="QCheckBox" name="systemThemeCheckBox">
-         <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Uses your default system theme.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="text">
-          <string>System</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="2">
-        <widget class="QCheckBox" name="lightThemeCheckBox">
-         <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Uses the Breeze light theme.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="text">
-          <string>Light</string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="2">
-        <widget class="QCheckBox" name="darkThemeCheckBox">
-         <property name="toolTip">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Uses the breeze dark theme (night mode)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="text">
-          <string>Dark</string>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="0">
-        <spacer name="horizontalSpacer">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>173</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item row="3" column="1">
+       <item row="5" column="1">
         <widget class="QLabel" name="logbookViewLabel">
+         <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 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>
@@ -535,72 +488,75 @@
         </widget>
        </item>
        <item row="3" column="2">
-        <widget class="QComboBox" name="logbookViewComboBox">
+        <widget class="QComboBox" name="acSortComboBox">
          <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>
          <item>
           <property name="text">
-           <string>Default</string>
+           <string>Registration</string>
           </property>
          </item>
          <item>
           <property name="text">
-           <string>EASA Part-FCL</string>
+           <string>Type</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Company</string>
           </property>
          </item>
         </widget>
        </item>
-       <item row="3" column="3">
-        <spacer name="horizontalSpacer_2">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>173</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
        <item row="4" column="1">
-        <widget class="QLabel" name="pilotSortLabel">
-         <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>
+        <widget class="QLabel" name="acAllowIncompleteLabel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
          </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>
+         <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>Sort Pilots by</string>
+          <string>Allow incomplete Entries </string>
          </property>
         </widget>
        </item>
        <item row="4" column="2">
-        <widget class="QComboBox" name="pilotSortComboBox">
+        <widget class="QComboBox" name="acAllowIncompleteComboBox">
          <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 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>
          <item>
           <property name="text">
-           <string>Last Name</string>
-          </property>
-         </item>
-         <item>
-          <property name="text">
-           <string>First Name</string>
+           <string>No</string>
           </property>
          </item>
          <item>
           <property name="text">
-           <string>Company</string>
+           <string>Yes</string>
           </property>
          </item>
         </widget>
        </item>
-       <item row="5" column="1">
+       <item row="0" column="3">
+        <widget class="QCheckBox" name="darkStyleCheckBox">
+         <property name="text">
+          <string>Dark</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="1">
         <widget class="QLabel" name="acSortLabel">
+         <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 by which column to sort the display of Aircaft in the Aircraft Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
@@ -612,19 +568,19 @@
          </property>
         </widget>
        </item>
-       <item row="5" column="2">
-        <widget class="QComboBox" name="acSortComboBox">
+       <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 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>
          <item>
           <property name="text">
-           <string>Registration</string>
+           <string>Last Name</string>
           </property>
          </item>
          <item>
           <property name="text">
-           <string>Type</string>
+           <string>First Name</string>
           </property>
          </item>
          <item>
@@ -634,33 +590,58 @@
          </item>
         </widget>
        </item>
-       <item row="6" column="1">
-        <widget class="QLabel" name="acAllowIncompleteLabel">
-         <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>
+       <item row="0" column="2">
+        <widget class="QComboBox" name="styleComboBox"/>
+       </item>
+       <item row="0" column="1">
+        <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>Allow incomplete Entries </string>
+          <string>Style</string>
          </property>
         </widget>
        </item>
-       <item row="6" column="2">
-        <widget class="QComboBox" name="acAllowIncompleteComboBox">
+       <item row="5" column="2">
+        <widget class="QComboBox" name="logbookViewComboBox">
          <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>&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>No</string>
+           <string>Default</string>
           </property>
          </item>
          <item>
           <property name="text">
-           <string>Yes</string>
+           <string>EASA Part-FCL</string>
           </property>
          </item>
         </widget>
        </item>
+       <item row="2" column="1">
+        <widget class="QLabel" name="pilotSortLabel">
+         <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 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 Pilots in the Pilots Tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <property name="text">
+          <string>Sort Pilots by</string>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="aboutTab">