Jelajahi Sumber

Expiry Warning Removed

Removed warning for impending currency expiry as the implementation was obnoxious. If desired at a later stage, should be redesigned from the ground up.
Felix Turo 3 tahun lalu
induk
melakukan
194a51cb46

+ 0 - 2
src/classes/asettings.cpp

@@ -35,7 +35,6 @@ QMap<ASettings::UserData, QString> ASettings::userDataMap = {
     {UserData::PilotSortColumn,         QStringLiteral("pilotSortColumn")},
     {UserData::AcftAllowIncomplete,     QStringLiteral("acftAllowIncomplete")},
     {UserData::FtlWarningThreshold,     QStringLiteral("ftlWarningThreshold")},
-    {UserData::CurrWarningEnabled,      QStringLiteral("currWarningEnabled")},
     {UserData::CurrWarningThreshold,    QStringLiteral("currWarningThreshold")},
     {UserData::ShowToLgdCurrency,       QStringLiteral("showToLdgCurrency")},
     {UserData::ShowLicCurrency,         QStringLiteral("showLicCurrency")},
@@ -81,7 +80,6 @@ void ASettings::resetToDefaults()
 
     write(UserData::DisplaySelfAs, 0);
     write(UserData::FtlWarningThreshold, 0.8); // To Do: UI Option
-    write(UserData::CurrWarningEnabled, true);
     write(UserData::CurrWarningThreshold, 30);
     write(UserData::ShowToLgdCurrency, true);
     write(UserData::ShowLicCurrency, false);

+ 0 - 1
src/classes/asettings.h

@@ -42,7 +42,6 @@ public:
         PilotSortColumn,
         AcftAllowIncomplete,
         FtlWarningThreshold,
-        CurrWarningEnabled,
         CurrWarningThreshold,
         ShowToLgdCurrency,
         ShowLicCurrency,

+ 0 - 31
src/gui/dialogues/firstrundialog.cpp

@@ -300,17 +300,6 @@ void FirstRunDialog::writeSettings()
     ASettings::write(ASettings::UserData::DisplaySelfAs, ui->aliasComboBox->currentIndex());
     ASettings::write(ASettings::Main::LogbookView, ui->logbookViewComboBox->currentIndex());
 
-    switch (ui->currWarningCheckBox->checkState()) {
-    case Qt::CheckState::Checked:
-        ASettings::write(ASettings::UserData::CurrWarningEnabled, true);
-        break;
-    case Qt::CheckState::Unchecked:
-        ASettings::write(ASettings::UserData::CurrWarningEnabled, false);
-        break;
-    default:
-        break;
-    }
-    ASettings::write(ASettings::UserData::CurrWarningThreshold, ui->currWarningThresholdSpinBox->value());
     ASettings::write(ASettings::Main::Style, ui->styleComboBox->currentText());
     QSettings settings;
     settings.sync();
@@ -442,26 +431,6 @@ void FirstRunDialog::on_styleComboBox_currentTextChanged(const QString &new_styl
     }
 }
 
-void FirstRunDialog::on_currWarningCheckBox_stateChanged(int arg1)
-{
-    switch (arg1) {
-    case Qt::CheckState::Checked:
-        ASettings::write(ASettings::UserData::CurrWarningEnabled, true);
-        break;
-    case Qt::CheckState::Unchecked:
-        ASettings::write(ASettings::UserData::CurrWarningEnabled, false);
-        break;
-    default:
-        break;
-    }
-    ASettings::write(ASettings::UserData::CurrWarningThreshold, arg1);
-}
-
-void FirstRunDialog::on_currWarningThresholdSpinBox_valueChanged(int arg1)
-{
-    ASettings::write(ASettings::UserData::CurrWarningThreshold, arg1);
-}
-
 void FirstRunDialog::on_currCustom1LineEdit_editingFinished()
 {
     ASettings::write(ASettings::UserData::Custom1CurrencyName, ui->currCustom1LineEdit->text());

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

@@ -44,10 +44,6 @@ private slots:
 
     void on_styleComboBox_currentTextChanged(const QString &new_style_setting);
 
-    void on_currWarningCheckBox_stateChanged(int arg1);
-
-    void on_currWarningThresholdSpinBox_valueChanged(int arg1);
-
     void on_currCustom1LineEdit_editingFinished();
 
     void on_currCustom2LineEdit_editingFinished();

+ 30 - 61
src/gui/dialogues/firstrundialog.ui

@@ -173,67 +173,6 @@
      </widget>
      <widget class="QWidget" name="currencyPage">
       <layout class="QGridLayout" name="gridLayout_6">
-       <item row="4" column="0" colspan="2">
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <item>
-          <widget class="QCheckBox" name="currWarningCheckBox">
-           <property name="text">
-            <string>Warn me about expiring currencies</string>
-           </property>
-           <property name="checked">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QSpinBox" name="currWarningThresholdSpinBox">
-           <property name="maximum">
-            <number>365</number>
-           </property>
-           <property name="value">
-            <number>30</number>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLabel" name="label_3">
-           <property name="text">
-            <string>days before expiry</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-       <item row="0" column="0" colspan="2">
-        <widget class="QLabel" name="label_6">
-         <property name="text">
-          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;Welcome to openPilotLog!&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;The Free and Open Source Logbook application&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;If you would like to keep track of your license and/or medical expiration dates, you can enter them here. By default, only Take-Off and Landing currency is shown on the home page, but any other currency can also be shown as well. This can be enabled in the settings.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-         </property>
-         <property name="textFormat">
-          <enum>Qt::RichText</enum>
-         </property>
-         <property name="wordWrap">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="1">
-        <widget class="QComboBox" name="dateFormatComboBox"/>
-       </item>
-       <item row="2" column="0" colspan="2">
-        <widget class="Line" name="line">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="dateFormatLabel">
-         <property name="text">
-          <string>Date Format</string>
-         </property>
-        </widget>
-       </item>
        <item row="3" column="0" colspan="2">
         <layout class="QGridLayout" name="gridLayout_5">
          <item row="0" column="1">
@@ -493,6 +432,36 @@
          </item>
         </layout>
        </item>
+       <item row="2" column="0" colspan="2">
+        <widget class="Line" name="line">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="dateFormatLabel">
+         <property name="text">
+          <string>Date Format</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="QComboBox" name="dateFormatComboBox"/>
+       </item>
+       <item row="0" column="0" colspan="2">
+        <widget class="QLabel" name="label_6">
+         <property name="text">
+          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:20pt;&quot;&gt;Welcome to openPilotLog!&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;The Free and Open Source Logbook application&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;If you would like to keep track of your license and/or medical expiration dates, you can enter them here. By default, only Take-Off and Landing currency is shown on the home page, but any other currency can also be shown as well. This can be enabled in the settings.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+         <property name="textFormat">
+          <enum>Qt::RichText</enum>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="flightLoggingPage">

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

@@ -38,6 +38,7 @@ HomeWidget::HomeWidget(QWidget *parent) :
     ui->setupUi(this);
     today = QDate::currentDate();
     ftlWarningThreshold = ASettings::read(ASettings::UserData::FtlWarningThreshold).toDouble();
+    currWarningThreshold = ASettings::read(ASettings::UserData::CurrWarningThreshold).toInt();
     auto logo = QPixmap(Opl::Assets::LOGO);
     ui->logoLabel->setPixmap(logo);
     ui->welcomeLabel->setText(tr("Welcome to openPilotLog, %1!").arg(userName()));

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

@@ -57,12 +57,12 @@ private:
      * \brief currWarningThreshold - Retreived from ASettings::UserData::CurrWarningThreshold, the number
      * of days before expiry that the user gets notified about impending expiries.
      */
-    int currWarningThreshold = 30;
+    int currWarningThreshold;
     /*!
      * \brief ftlWarningThreshold - Retreived from ASettings::UserData::FtlWarningThreshold, the percentage
      * of how close the user has to be to reaching a Flight Time Limitation before getting notified.
      */
-    double         ftlWarningThreshold;
+    double ftlWarningThreshold;
 
     void fillTotals();
     void fillSelectedCurrencies();