Browse Source

Take off and landing currency expiration

- TO/LDG currency now shows the expiration date on the home page.
- Fixes to sql for determining currency
- Disabled unused combobox in newflight dialog
- changed warning colour from yellow to orange for better visibility
Felix Turo 4 years ago
parent
commit
23a4d1e47c

+ 2 - 2
mainwindow.h

@@ -101,12 +101,12 @@ private:
 
 protected:
     /*!
-     * \brief Shows the debug widget by pressing <ctrl + Home>
+     * \brief Shows the debug widget by pressing <ctrl + t>
      */
     void keyPressEvent(QKeyEvent* keyEvent) override
     {
         if(keyEvent->type() == QKeyEvent::KeyPress) {
-            if(keyEvent->matches(QKeySequence::MoveToStartOfDocument)) {
+            if(keyEvent->matches(QKeySequence::AddTab)) {
                 on_actionDebug_triggered();
             }
         }

+ 5 - 5
src/database/adatabase.cpp

@@ -286,8 +286,8 @@ bool ADatabase::update(AEntry updated_entry)
     QSqlQuery query;
     query.prepare(statement);
     for (auto i = data.constBegin(); i != data.constEnd(); ++i) {
-        if (i.value() == QVariant(QString())) {
-            query.addBindValue(QVariant(QString()));
+        if (i.value() == QVariant(QString()) || i.value() == 0) {
+            query.addBindValue(QVariant(QVariant::String));
         } else {
             query.addBindValue(i.value());
         }
@@ -330,9 +330,9 @@ bool ADatabase::insert(AEntry new_entry)
     QSqlQuery query;
     query.prepare(statement);
 
-    for (i = data.begin(); i != data.end(); ++i) {
-        if (i.value() == QVariant(QString())) {
-            query.addBindValue(QVariant(QString()));
+    for (auto i = data.constBegin(); i != data.constEnd(); ++i) {
+        if (i.value() == QVariant(QString()) || i.value() == 0) {
+            query.addBindValue(QVariant(QVariant::String));
         } else {
             query.addBindValue(i.value());
         }

+ 45 - 11
src/functions/astat.cpp

@@ -31,24 +31,24 @@ int AStat::totalTime(TimeFrame time_frame)
     QString start_date;
 
     switch (time_frame) {
-    case AStat::AllTime:
+    case TimeFrame::AllTime:
         statement = QStringLiteral("SELECT SUM(tblk) FROM flights");
         break;
-    case AStat::CalendarYear:
+    case TimeFrame::CalendarYear:
         start.setDate(QDate::currentDate().year(), 1, 1);
         start_date = start.toString(Qt::ISODate);
         start_date.append(QLatin1Char('\''));
         start_date.prepend(QLatin1Char('\''));
         statement = QLatin1String("SELECT SUM(tblk) FROM flights WHERE doft >= ") + start_date;
         break;
-    case AStat::Rolling12Months:
+    case TimeFrame::Rolling12Months:
         start = QDate::fromJulianDay(QDate::currentDate().toJulianDay() - 365);
         start_date = start.toString(Qt::ISODate);
         start_date.append(QLatin1Char('\''));
         start_date.prepend(QLatin1Char('\''));
         statement = QLatin1String("SELECT SUM(tblk) FROM flights WHERE doft >= ") + start_date;
         break;
-    case AStat::Rolling28Days:
+    case TimeFrame::Rolling28Days:
         start = QDate::fromJulianDay(QDate::currentDate().toJulianDay() - 28);
         start_date = start.toString(Qt::ISODate);
         start_date.append(QLatin1Char('\''));
@@ -68,10 +68,10 @@ int AStat::totalTime(TimeFrame time_frame)
 /*!
  * \brief AStat::currencyTakeOffLanding Returns the amount of Take Offs and
  * Landings performed in the last x days. If no vallue for days is provided, 90 is used,
- * as per EASA FTL
+ * as per EASA regulations
  * \return QVector<QString>{#TO,#LDG}
  */
-QVector<QVariant> AStat::currencyTakeOffLanding(int days)
+QVector<QVariant> AStat::countTakeOffLanding(int days)
 {
     QDate start = QDate::fromJulianDay(QDate::currentDate().toJulianDay() - days);
     QString startdate = start.toString(Qt::ISODate);
@@ -79,14 +79,14 @@ QVector<QVariant> AStat::currencyTakeOffLanding(int days)
     startdate.prepend(QLatin1Char('\''));
 
     QString statement = QLatin1String("SELECT "
-            "CAST(SUM(flights.TOday) + SUM(flights.TOnight) AS INTEGER) AS 'TO', "
-            "CAST(SUM(flights.LDGday) + SUM(flights.LDGnight) AS INTEGER) AS 'LDG' "
-            "FROM flights "
-            "WHERE doft >=") + startdate;
+                                      " SUM(IFNULL(flights.toDay,0) + IFNULL(flights.toNight,0)) AS 'TO', "
+                                      " SUM(IFNULL(flights.ldgDay,0) + IFNULL(flights.ldgNight,0)) AS 'LDG' "
+                                      " FROM flights "
+                                      " WHERE doft >=") + startdate;
 
     QVector<QVariant> result = aDB->customQuery(statement, 2);
     // make sure a value is returned instead of NULL
-    for (const auto var : result) {
+    for (const auto &var : result) {
         if (var.isNull())
             result.replace(result.indexOf(var), 0);
     }
@@ -133,3 +133,37 @@ QVector<QPair<QString, QString>> AStat::totals()
     }
     return output;
 }
+
+/*!
+ * \brief Calculates the date of expiry for the take-off and landing currency.
+ *
+ * The default value for days is 90.
+ * \return
+ */
+QDate AStat::currencyTakeOffLandingExpiry(int expiration_days)
+{
+    int number_of_days = 0;
+    QVector<QVariant> takeoff_landings;
+
+    // Check if enough take-offs and landings exist within the expiration period, if that's not the case
+    // we are out of currency and we can stop right there.
+    takeoff_landings = countTakeOffLanding(expiration_days);
+    if (takeoff_landings[0].toInt() < 3 || takeoff_landings[1].toInt() < 3)
+        return QDate::currentDate();
+
+    // Go back in time to find a point at which number of Take-Offs and Landings >= 3
+    for (int i=0; i <= expiration_days; i++) {
+        takeoff_landings = countTakeOffLanding(i);
+        //DEB << takeoff_landings;
+        if (takeoff_landings[0].toInt() >= 3 && takeoff_landings[1].toInt() >= 3) {
+            number_of_days = i;
+            //DEB << "Loop position i =" << i;
+            break;
+        }
+    }
+    // The expiration date of currency is now currentDate - number of days + expiration_days (default 90)
+    QDate expiration_date = QDate::fromJulianDay(QDate::currentDate().toJulianDay() - number_of_days);
+    //DEB << expiration_date.addDays(expiration_days);
+
+    return expiration_date.addDays(expiration_days);;
+}

+ 6 - 2
src/functions/astat.h

@@ -30,11 +30,15 @@ namespace AStat {
  */
 
 
-    enum TimeFrame {AllTime, CalendarYear, Rolling12Months, Rolling28Days};
+    enum class TimeFrame {AllTime, CalendarYear, Rolling12Months, Rolling28Days};
+
+    enum class ToLdg {Takeoff, Landing};
 
     int totalTime(TimeFrame time_frame);
 
-    QVector<QVariant> currencyTakeOffLanding(int days = 90);
+    QVector<QVariant> countTakeOffLanding(int days = 90);
+
+    QDate currencyTakeOffLandingExpiry(int expiration_days = 90);
 
     QVector<QPair<QString, QString>> totals();
 

+ 5 - 5
src/gui/dialogues/newflight.ui

@@ -17,7 +17,7 @@
    <item row="0" column="0" colspan="2">
     <widget class="QTabWidget" name="flightDataTabWidget">
      <property name="currentIndex">
-      <number>1</number>
+      <number>0</number>
      </property>
      <widget class="QWidget" name="flightDataTab">
       <attribute name="title">
@@ -177,7 +177,7 @@
         </widget>
        </item>
        <item row="1" column="3">
-        <widget class="QComboBox" name="deptTZ">
+        <widget class="QComboBox" name="deptTZComboBox">
          <property name="focusPolicy">
           <enum>Qt::NoFocus</enum>
          </property>
@@ -379,7 +379,7 @@
         </widget>
        </item>
        <item row="3" column="3">
-        <widget class="QComboBox" name="destTZ">
+        <widget class="QComboBox" name="destTZComboBox">
          <property name="focusPolicy">
           <enum>Qt::NoFocus</enum>
          </property>
@@ -863,7 +863,7 @@
       <zorder>autoPicusLabel</zorder>
       <zorder>tSICLabel</zorder>
       <zorder>tIFRLabel</zorder>
-      <zorder>deptTZ</zorder>
+      <zorder>deptTZComboBox</zorder>
       <zorder>tSPSELabel</zorder>
       <zorder>RemarksLineEdit</zorder>
       <zorder>picLabel</zorder>
@@ -881,7 +881,7 @@
       <zorder>thirdPilotNameLineEdit</zorder>
       <zorder>autoMPLabel</zorder>
       <zorder>picNameLineEdit</zorder>
-      <zorder>destTZ</zorder>
+      <zorder>destTZComboBox</zorder>
       <zorder>RemarksLabel</zorder>
       <zorder>tPICUSLabel</zorder>
       <zorder>autoNightLabel</zorder>

+ 21 - 0
src/gui/dialogues/newflightdialog.cpp

@@ -1361,3 +1361,24 @@ void NewFlightDialog::on_FunctionComboBox_currentIndexChanged(int)
     if (updateEnabled)
         fillDeductibleData();
 }
+
+
+// [F]: Not a priority right now.
+void NewFlightDialog::on_deptTZComboBox_currentIndexChanged(int index)
+{
+    if (index > 0) {
+        QMessageBox message_box(this);
+        message_box.setText(tr("Currently only logging in UTC time is supported."));
+        message_box.exec();
+        ui->deptTZComboBox->setCurrentIndex(0);
+    }
+}
+
+void NewFlightDialog::on_destTZComboBox_currentIndexChanged(int index)
+{
+    if (index > 0) {
+        QMessageBox message_box(this);
+        message_box.setText(tr("Currently only logging in UTC time is supported."));
+        message_box.exec();
+        ui->destTZComboBox->setCurrentIndex(0);}
+}

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

@@ -28,6 +28,7 @@
 #include <QBitArray>
 #include <QLineEdit>
 #include <QCalendarWidget>
+#include <QComboBox>
 #include <QTabWidget>
 #include <QKeyEvent>
 #include "src/functions/atime.h"
@@ -80,6 +81,8 @@ private slots:
     void on_deptLocLineEdit_editingFinished();
     void on_destLocLineEdit_editingFinished();
     void on_acftLineEdit_editingFinished();
+    void on_deptTZComboBox_currentIndexChanged(int index);
+    void on_destTZComboBox_currentIndexChanged(int index);
 
 private:
     Ui::NewFlight *ui;

+ 2 - 0
src/gui/widgets/debugwidget.cpp

@@ -24,6 +24,7 @@
 #include "src/gui/dialogues/firstrundialog.h"
 #include <QtGlobal>
 #include "src/functions/atime.h"
+#include "src/functions/astat.h"
 
 DebugWidget::DebugWidget(QWidget *parent) :
     QWidget(parent),
@@ -184,6 +185,7 @@ void DebugWidget::on_importCsvPushButton_clicked()
 
 void DebugWidget::on_debugPushButton_clicked()
 {
+    DEB << "Expiration Date:" << AStat::currencyTakeOffLandingExpiry();
     // debug space
     //ASettings::write(ASettings::Setup::SetupComplete, false);
 }

+ 13 - 8
src/gui/widgets/homewidget.cpp

@@ -22,7 +22,7 @@
 #include "src/functions/atime.h"
 #include "src/classes/asettings.h"
 
-// EASA FTL Limitations
+// EASA FTL Limitations in minutes
 // 100 hours per 28 days
 static const int ROLLING_28_DAYS = 6000;
 // 900 hours per calendar year
@@ -74,7 +74,7 @@ void HomeWidget::fillTotals()
 
 void HomeWidget::fillCurrency()
 {
-    auto takeoff_landings = AStat::currencyTakeOffLanding();
+    auto takeoff_landings = AStat::countTakeOffLanding();
 
     ui->TakeOffDisplayLabel->setText(takeoff_landings[0].toString());
     if (takeoff_landings[0].toUInt() < 3)
@@ -82,32 +82,37 @@ void HomeWidget::fillCurrency()
     ui->LandingsDisplayLabel->setText(takeoff_landings[1].toString());
     if (takeoff_landings[1].toUInt() < 3)
         setLabelColour(ui->LandingsDisplayLabel, HomeWidget::Red);
+
+    QDate expiration_date = AStat::currencyTakeOffLandingExpiry();
+    if (expiration_date == QDate::currentDate())
+        setLabelColour(ui->currencyExpirationDisplayLabel, HomeWidget::Red);
+    ui->currencyExpirationDisplayLabel->setText(expiration_date.toString(Qt::TextDate));
 }
 
 void HomeWidget::fillLimitations()
 {
-    int minutes = AStat::totalTime(AStat::Rolling28Days);
+    int minutes = AStat::totalTime(AStat::TimeFrame::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);
+        setLabelColour(ui->FlightTime28dDisplayLabel, HomeWidget::Orange);
     }
 
-    minutes = AStat::totalTime(AStat::Rolling12Months);
+    minutes = AStat::totalTime(AStat::TimeFrame::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);
+        setLabelColour(ui->FlightTime12mDisplayLabel, HomeWidget::Orange);
     }
 
-    minutes = AStat::totalTime(AStat::CalendarYear);
+    minutes = AStat::totalTime(AStat::TimeFrame::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);
+        setLabelColour(ui->FlightTimeCalYearDisplayLabel, HomeWidget::Orange);
     }
 }
 

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

@@ -53,7 +53,7 @@ private:
      */
     const QString userName();
 
-    enum Colour {Red, Yellow};
+    enum Colour {Red, Orange};
 
     inline void setLabelColour(QLabel* label, Colour colour)
     {
@@ -61,8 +61,8 @@ private:
         case HomeWidget::Red:
             label->setStyleSheet(QStringLiteral("color: red"));
             break;
-        case HomeWidget::Yellow:
-            label->setStyleSheet(QStringLiteral("color: yellow"));
+        case HomeWidget::Orange:
+            label->setStyleSheet(QStringLiteral("color: orange"));
             break;
         default:
             label->setStyleSheet(QString());

+ 105 - 77
src/gui/widgets/homewidget.ui

@@ -14,6 +14,30 @@
    <string>Form</string>
   </property>
   <layout class="QGridLayout" name="gridLayout_4">
+   <item row="0" column="0">
+    <widget class="QLabel" name="welcomeLabel">
+     <property name="text">
+      <string>Welcome to openPilotLog!</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="Line" name="line_2">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="Line" name="line_7">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
    <item row="3" column="0">
     <widget class="QLabel" name="totalsLabel">
      <property name="font">
@@ -30,15 +54,8 @@
      </property>
     </widget>
    </item>
-   <item row="1" column="0">
-    <widget class="Line" name="line_2">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-    </widget>
-   </item>
-   <item row="10" column="0">
-    <widget class="Line" name="line_6">
+   <item row="4" column="0">
+    <widget class="Line" name="line">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
@@ -575,41 +592,53 @@
      </item>
     </layout>
    </item>
-   <item row="12" column="0">
-    <widget class="Line" name="line_3">
+   <item row="6" column="0">
+    <widget class="Line" name="line_5">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>
-   <item row="0" column="0">
-    <widget class="QLabel" name="welcomeLabel">
+   <item row="7" column="0">
+    <widget class="QLabel" name="currencyLabel">
+     <property name="font">
+      <font>
+       <weight>75</weight>
+       <bold>true</bold>
+      </font>
+     </property>
      <property name="text">
-      <string>Welcome to openPilotLog!</string>
+      <string>Currency</string>
      </property>
      <property name="alignment">
-      <set>Qt::AlignCenter</set>
+      <set>Qt::AlignBottom|Qt::AlignHCenter</set>
      </property>
     </widget>
    </item>
-   <item row="4" column="0">
-    <widget class="Line" name="line">
+   <item row="8" column="0">
+    <widget class="Line" name="line_4">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>
-   <item row="13" column="0">
-    <layout class="QGridLayout" name="gridLayout_2">
+   <item row="9" column="0">
+    <layout class="QGridLayout" name="gridLayout_3">
      <item row="0" column="0">
-      <widget class="QLabel" name="FlightTime28dLabel">
+      <widget class="QLabel" name="TakeOffLabel">
        <property name="text">
-        <string>Flight Time (last 28 days)</string>
+        <string>Take offs (last 90 days)</string>
        </property>
       </widget>
      </item>
      <item row="0" column="1">
-      <widget class="QLabel" name="FlightTime28dDisplayLabel">
+      <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>
@@ -622,14 +651,20 @@
       </widget>
      </item>
      <item row="1" column="0">
-      <widget class="QLabel" name="FlightTimeCalYearLabel">
+      <widget class="QLabel" name="LandingsLabel">
        <property name="text">
-        <string>Flight Time (this calendar year)</string>
+        <string>Landings (last 90 days)</string>
        </property>
       </widget>
      </item>
      <item row="1" column="1">
-      <widget class="QLabel" name="FlightTimeCalYearDisplayLabel">
+      <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>
@@ -642,19 +677,27 @@
       </widget>
      </item>
      <item row="2" column="0">
-      <widget class="QLabel" name="FlightTime12mLabel">
+      <widget class="QLabel" name="currencyExpirationLabel">
+       <property name="font">
+        <font>
+         <italic>false</italic>
+        </font>
+       </property>
        <property name="text">
-        <string>Flight Time (last 12 calendar months)</string>
+        <string>Expires</string>
        </property>
       </widget>
      </item>
      <item row="2" column="1">
-      <widget class="QLabel" name="FlightTime12mDisplayLabel">
-       <property name="layoutDirection">
-        <enum>Qt::LeftToRight</enum>
+      <widget class="QLabel" name="currencyExpirationDisplayLabel">
+       <property name="font">
+        <font>
+         <weight>75</weight>
+         <bold>true</bold>
+        </font>
        </property>
        <property name="text">
-        <string>0</string>
+        <string/>
        </property>
        <property name="alignment">
         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -663,8 +706,8 @@
      </item>
     </layout>
    </item>
-   <item row="6" column="0">
-    <widget class="Line" name="line_5">
+   <item row="10" column="0">
+    <widget class="Line" name="line_6">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
@@ -686,46 +729,24 @@
      </property>
     </widget>
    </item>
-   <item row="7" column="0">
-    <widget class="QLabel" name="currencyLabel">
-     <property name="font">
-      <font>
-       <weight>75</weight>
-       <bold>true</bold>
-      </font>
-     </property>
-     <property name="text">
-      <string>Currency</string>
-     </property>
-     <property name="alignment">
-      <set>Qt::AlignBottom|Qt::AlignHCenter</set>
-     </property>
-    </widget>
-   </item>
-   <item row="8" column="0">
-    <widget class="Line" name="line_4">
+   <item row="12" column="0">
+    <widget class="Line" name="line_3">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>
-   <item row="9" column="0">
-    <layout class="QGridLayout" name="gridLayout_3">
+   <item row="13" column="0">
+    <layout class="QGridLayout" name="gridLayout_2">
      <item row="0" column="0">
-      <widget class="QLabel" name="TakeOffLabel">
+      <widget class="QLabel" name="FlightTime28dLabel">
        <property name="text">
-        <string>Take offs (last 90 days)</string>
+        <string>Flight Time (last 28 days)</string>
        </property>
       </widget>
      </item>
      <item row="0" column="1">
-      <widget class="QLabel" name="TakeOffDisplayLabel">
-       <property name="font">
-        <font>
-         <weight>75</weight>
-         <bold>true</bold>
-        </font>
-       </property>
+      <widget class="QLabel" name="FlightTime28dDisplayLabel">
        <property name="layoutDirection">
         <enum>Qt::LeftToRight</enum>
        </property>
@@ -738,20 +759,34 @@
       </widget>
      </item>
      <item row="1" column="0">
-      <widget class="QLabel" name="LandingsLabel">
+      <widget class="QLabel" name="FlightTimeCalYearLabel">
        <property name="text">
-        <string>Landings (last 90 days)</string>
+        <string>Flight Time (this calendar year)</string>
        </property>
       </widget>
      </item>
      <item row="1" column="1">
-      <widget class="QLabel" name="LandingsDisplayLabel">
-       <property name="font">
-        <font>
-         <weight>75</weight>
-         <bold>true</bold>
-        </font>
+      <widget class="QLabel" name="FlightTimeCalYearDisplayLabel">
+       <property name="layoutDirection">
+        <enum>Qt::LeftToRight</enum>
+       </property>
+       <property name="text">
+        <string>0</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="0">
+      <widget class="QLabel" name="FlightTime12mLabel">
+       <property name="text">
+        <string>Flight Time (last 12 calendar months)</string>
        </property>
+      </widget>
+     </item>
+     <item row="2" column="1">
+      <widget class="QLabel" name="FlightTime12mDisplayLabel">
        <property name="layoutDirection">
         <enum>Qt::LeftToRight</enum>
        </property>
@@ -765,13 +800,6 @@
      </item>
     </layout>
    </item>
-   <item row="2" column="0">
-    <widget class="Line" name="line_7">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
  <resources/>

+ 389 - 1
src/gui/widgets/settingswidget.ui

@@ -14,7 +14,7 @@
    <string>Form</string>
   </property>
   <layout class="QGridLayout" name="gridLayout_2">
-   <item row="0" column="1">
+   <item row="0" column="0">
     <widget class="QTabWidget" name="tabWidget">
      <property name="currentIndex">
       <number>2</number>
@@ -357,6 +357,394 @@
        </item>
       </layout>
      </widget>
+     <widget class="QWidget" name="currenciesTab">
+      <attribute name="title">
+       <string>Currencies</string>
+      </attribute>
+      <layout class="QGridLayout" name="gridLayout_6">
+       <item row="0" column="1">
+        <spacer name="verticalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>35</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="headerCurrencyLabel">
+         <property name="minimumSize">
+          <size>
+           <width>280</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Currency</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="2">
+        <widget class="QLabel" name="headerExpirationLabel">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Expiration Date</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="3">
+        <widget class="QLabel" name="headerShowLabel">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Show on Home Page</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="0" colspan="4">
+        <widget class="Line" name="line">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="0" rowspan="3">
+        <widget class="QLabel" name="currToLdgLabel">
+         <property name="minimumSize">
+          <size>
+           <width>280</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Take-off / Landing (automatic)</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="2" rowspan="2">
+        <widget class="QDateEdit" name="currToLdgDateEdit">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="calendarPopup">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="5" column="3">
+        <widget class="QCheckBox" name="currToLdgCheckBox">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="layoutDirection">
+          <enum>Qt::LeftToRight</enum>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="6" column="0">
+        <widget class="QLabel" name="currLicLabel">
+         <property name="minimumSize">
+          <size>
+           <width>280</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Licence</string>
+         </property>
+        </widget>
+       </item>
+       <item row="6" column="2">
+        <widget class="QDateEdit" name="currLicDateEdit">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="calendarPopup">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="6" column="3">
+        <widget class="QCheckBox" name="currLicCheckBox">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="layoutDirection">
+          <enum>Qt::LeftToRight</enum>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="7" column="0">
+        <widget class="QLabel" name="currTRLabel">
+         <property name="minimumSize">
+          <size>
+           <width>280</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Type Rating</string>
+         </property>
+        </widget>
+       </item>
+       <item row="7" column="2">
+        <widget class="QDateEdit" name="currTRDateEdit">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="calendarPopup">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="7" column="3">
+        <widget class="QCheckBox" name="currTRCheckBox">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="layoutDirection">
+          <enum>Qt::LeftToRight</enum>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="8" column="0">
+        <widget class="QLabel" name="currLCKLabel">
+         <property name="minimumSize">
+          <size>
+           <width>280</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Line Check</string>
+         </property>
+        </widget>
+       </item>
+       <item row="8" column="2">
+        <widget class="QDateEdit" name="currLCKDateEdit">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="calendarPopup">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="8" column="3">
+        <widget class="QCheckBox" name="currLCKCheckBox">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="layoutDirection">
+          <enum>Qt::LeftToRight</enum>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="9" column="0">
+        <widget class="QLabel" name="currMedLabel">
+         <property name="minimumSize">
+          <size>
+           <width>280</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string>Medical</string>
+         </property>
+        </widget>
+       </item>
+       <item row="9" column="2">
+        <widget class="QDateEdit" name="currMedDateEdit">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="calendarPopup">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="9" column="3">
+        <widget class="QCheckBox" name="currMedCheckBox">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="layoutDirection">
+          <enum>Qt::LeftToRight</enum>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="10" column="0">
+        <widget class="QLineEdit" name="currCustom1LineEdit">
+         <property name="minimumSize">
+          <size>
+           <width>280</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+         <property name="placeholderText">
+          <string>custom currency</string>
+         </property>
+        </widget>
+       </item>
+       <item row="10" column="2">
+        <widget class="QDateEdit" name="currCustom1DateEdit">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="calendarPopup">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="10" column="3">
+        <widget class="QCheckBox" name="currCustom1CheckBox">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="layoutDirection">
+          <enum>Qt::LeftToRight</enum>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="11" column="0">
+        <widget class="QLineEdit" name="currCustom2LineEdit">
+         <property name="minimumSize">
+          <size>
+           <width>280</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="placeholderText">
+          <string>custom currency</string>
+         </property>
+        </widget>
+       </item>
+       <item row="11" column="2">
+        <widget class="QDateEdit" name="currCustom2DateEdit">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="calendarPopup">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item row="11" column="3">
+        <widget class="QCheckBox" name="currCustom2CheckBox">
+         <property name="minimumSize">
+          <size>
+           <width>140</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="layoutDirection">
+          <enum>Qt::LeftToRight</enum>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="12" column="1">
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>35</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
      <widget class="QWidget" name="miscTab">
       <attribute name="title">
        <string>Misc</string>