Forráskód Böngészése

Adding Night Time Calculation and Input Verification

Felix Turo 3 éve
szülő
commit
4295f6def8

+ 175 - 26
src/gui/dialogues/newnewflightdialog.cpp

@@ -2,6 +2,9 @@
 #include "ui_newnewflightdialog.h"
 #include "src/opl.h"
 #include "src/functions/alog.h"
+#include "src/functions/adate.h"
+#include "src/classes/asettings.h"
+#include "src/functions/acalc.h"
 #include <QDateTime>
 #include <QCompleter>
 #include <QKeyEvent>
@@ -38,23 +41,7 @@ void NewNewFlightDialog::init()
     //readSettings();
 
     ui->doftLineEdit->setText(QDate::currentDate().toString(Qt::ISODate));
-}
-
-/*!
- * \brief NewNewFlightDialog::eventFilter the event filter is used to invalidate mandatory line edits on entering. This acts as a double-check against
- * false inputs for cases when the editingFinished() signal is not emitted due to the QValidators blocking it.
- */
-bool NewNewFlightDialog::eventFilter(QObject* object, QEvent* event)
-{
-    auto line_edit = qobject_cast<QLineEdit*>(object);
-    if (line_edit != nullptr) {
-        if (mandatoryLineEdits.contains(line_edit) && event->type() == QEvent::FocusIn) {
-            //DEB << "Invalidating " << line_edit->objectName() << "(Focus In Event)";
-            validationState.invalidate(mandatoryLineEdits.indexOf(line_edit));
-            return false;
-        }
-    }
-    return false;
+    emit ui->doftLineEdit->editingFinished();
 }
 
 /*!
@@ -112,11 +99,6 @@ void NewNewFlightDialog::setupSignalsAndSlots()
     for (const auto& line_edit : qAsConst(pilotNameLineEdits))
         QObject::connect(line_edit, &QLineEdit::editingFinished,
                          this, &NewNewFlightDialog::onPilotNameLineEdit_editingFinshed);
-
-    // install event filter for focus in vent
-    for (const auto& line_edit : qAsConst(mandatoryLineEdits)) {
-        line_edit->installEventFilter(this);
-    }
 }
 
 void NewNewFlightDialog::onGoodInputReceived(QLineEdit *line_edit)
@@ -126,10 +108,15 @@ void NewNewFlightDialog::onGoodInputReceived(QLineEdit *line_edit)
 
     if (mandatoryLineEdits.contains(line_edit))
         validationState.validate(mandatoryLineEdits.indexOf(line_edit));
-    if (validationState.allValid())
+    if (validationState.timesValid()) {
         DEB << "All mandatory Line Edits valid!";
-        // Go to onMandatoryLineEditsFilled?
-    else
+        // Update Block Time Label
+        QTime tblk = calculateBlockTime();
+        ui->tblkDisplayLabel->setText(ATime::toString(tblk));
+        if (validationState.allValid())
+            updateNightCheckBoxes();
+    }
+
         validationState.printValidationStatus();
 }
 
@@ -144,6 +131,66 @@ void NewNewFlightDialog::onBadInputReceived(QLineEdit *line_edit)
 
     validationState.printValidationStatus();
 }
+
+QTime NewNewFlightDialog::calculateBlockTime()
+{
+    if (!validationState.timesValid())
+        return {};
+    const auto tofb = ATime::fromString(ui->tofbTimeLineEdit->text());
+    const auto tonb = ATime::fromString(ui->tonbTimeLineEdit->text());
+    return ATime::blocktime(tofb, tonb);
+}
+
+/*!
+ * \brief NewNewFlightDialog::updateNightCheckBoxes updates the check boxes for take-off and landing
+ * at night. Returns the number of minutes of night time.
+ * \return
+ */
+int NewNewFlightDialog::updateNightCheckBoxes()
+{
+    if (!validationState.allValid())
+        return 0;
+
+    // Calculate Block Time
+    const auto tofb = ATime::fromString(ui->tofbTimeLineEdit->text());
+    const auto tonb = ATime::fromString(ui->tonbTimeLineEdit->text());
+    const auto tblk = ATime::blocktime(tofb, tonb);
+    const auto block_minutes = ATime::toMinutes(tblk);
+    // Calculate Night Time
+
+    const QString dept_date = ui->doftLineEdit->text() + 'T'
+            + ATime::toString(tofb);
+    const auto dept_date_time = QDateTime::fromString(dept_date, QStringLiteral("yyyy-MM-ddThh:mm"));
+    const int night_angle = ASettings::read(ASettings::FlightLogging::NightAngle).toInt();
+    const auto night_time = ATime::fromMinutes(ACalc::calculateNightTime(
+                                             ui->deptLocationLineEdit->text(),
+                                             ui->destLocationLineEdit->text(),
+                                             dept_date_time,
+                                             block_minutes,
+                                             night_angle));
+    const auto night_minutes = ATime::toMinutes(night_time);
+
+    // set check boxes
+    if (night_minutes == 0) {
+        ui->toNightCheckBox->setCheckState(Qt::Unchecked);
+        ui->ldgNightCheckBox->setCheckState(Qt::Unchecked);
+    }
+    else if (night_minutes == ATime::toMinutes(calculateBlockTime())) {
+        ui->toNightCheckBox->setCheckState(Qt::Checked);
+        ui->ldgNightCheckBox->setCheckState(Qt::Checked);
+    } else {
+        if(ACalc::isNight(ui->deptLocationLineEdit->text(), dept_date_time,  night_angle)) {
+            ui->toNightCheckBox->setCheckState(Qt::Checked);
+            ui->ldgNightCheckBox->setCheckState(Qt::Unchecked);
+        } else {
+            ui->toNightCheckBox->setCheckState(Qt::Unchecked);
+            ui->ldgNightCheckBox->setCheckState(Qt::Checked);
+        }
+    }
+
+    return ATime::toMinutes(night_time);
+}
+
 // # Slots
 void NewNewFlightDialog::toUpper(const QString &text)
 {
@@ -241,5 +288,107 @@ void NewNewFlightDialog::onLocationLineEdit_editingFinished()
 
 void NewNewFlightDialog::on_acftLineEdit_editingFinished()
 {
-    TODO << "Fix looking up and matching...";
+    const auto line_edit = ui->acftLineEdit;
+    int acft_id = completionData.tailsIdMap.key(line_edit->text());
+    DEB << "acft_id: " << acft_id;
+
+    if (acft_id != 0) { // Success
+        auto acft = aDB->getTailEntry(acft_id);
+        ui->acftDisplayLabel->setText(acft.type());
+        onGoodInputReceived(line_edit);
+        return;
+    }
+
+    // try to use a completion
+    if (!line_edit->completer()->currentCompletion().isEmpty() && !line_edit->text().isEmpty()) {
+        line_edit->setText(line_edit->completer()->currentCompletion().split(QLatin1Char(' ')).first());
+        emit line_edit->editingFinished();
+        return;
+    }
+
+    // Mark as bad input and prompt for adding new tail
+    onBadInputReceived(line_edit);
+    ui->acftDisplayLabel->setText(tr("Unknown Registration."));
+    WARN("Add new tail..");
+}
+
+void NewNewFlightDialog::on_doftLineEdit_editingFinished()
+{
+    const auto line_edit = ui->doftLineEdit;
+    auto text = ui->doftLineEdit->text();
+    auto label = ui->doftDisplayLabel;
+    //DEB << line_edit->objectName() << "Editing finished - " << text;
+
+    TODO << "Non-default Date formats not implemented yet.";
+    Opl::Date::ADateFormat date_format = Opl::Date::ADateFormat::ISODate;
+    auto date = ADate::parseInput(text, date_format);
+    if (date.isValid()) {
+        label->setText(date.toString(Qt::TextDate));
+        line_edit->setText(ADate::toString(date, date_format));
+        onGoodInputReceived(line_edit);
+        return;
+    }
+
+    label->setText(tr("Invalid Date."));
+    onBadInputReceived(line_edit);
+}
+
+void NewNewFlightDialog::on_pilotFlyingCheckBox_stateChanged(int arg1)
+{
+    if (arg1 == Qt::CheckState::Checked) {
+        ui->takeOffSpinBox->setValue(1);
+        ui->landingSpinBox->setValue(1);
+    } else {
+        ui->takeOffSpinBox->setValue(0);
+        ui->landingSpinBox->setValue(0);
+    }
+}
+
+void NewNewFlightDialog::on_buttonBox_accepted()
+{
+    // emit editing finished for all mandatory line edits to trigger input verification
+    for (const auto &line_edit : qAsConst(mandatoryLineEdits)) {
+        emit line_edit->editingFinished();
+    }
+
+    // If input verification is passed, continue, otherwise prompt user to correct
+    // enum ValidationItem {doft = 0, dept = 1, dest = 2, tofb = 3, tonb = 4, pic = 5, acft = 6};
+    if (!validationState.allValid()) {
+        const auto display_names = QMap<ValidationItem, QString> {
+            {ValidationItem::doft, QObject::tr("Date of Flight")},      {ValidationItem::dept, QObject::tr("Departure Airport")},
+            {ValidationItem::dest, QObject::tr("Destination Airport")}, {ValidationItem::tofb, QObject::tr("Time Off Blocks")},
+            {ValidationItem::tonb, QObject::tr("Time on Blocks")},      {ValidationItem::pic, QObject::tr("PIC Name")},
+            {ValidationItem::acft, QObject::tr("Aircraft Registration")}
+        };
+        QString missing_items;
+        for (int i=0; i < mandatoryLineEdits.size(); i++) {
+            if (!validationState.validAt(i)){
+                missing_items.append(display_names.value(static_cast<ValidationItem>(i)) + "<br>");
+                mandatoryLineEdits[i]->setStyleSheet(QStringLiteral("border: 1px solid red"));
+            }
+        }
+
+        INFO(tr("Not all mandatory entries are valid.<br>"
+                "The following item(s) are empty or missing:"
+                "<br><br><center><b>%1</b></center><br>"
+                "Please go back and fill in the required data."
+                ).arg(missing_items));
+        return;
+    }
+
+
+    // If input verification passed, collect input and submit to database
+    //auto newData = collectInput();
+    //DEB << "Setting Data for flightEntry...";
+    //flightEntry.setData(newData);
+    //DEB << "Committing...";
+    //if (!aDB->commit(flightEntry)) {
+    //    WARN(tr("The following error has ocurred:"
+    //                           "<br><br>%1<br><br>"
+    //                           "The entry has not been saved."
+    //                           ).arg(aDB->lastError.text()));
+    //    return;
+    //} else {
+    //    QDialog::accept();
+    //}
 }

+ 12 - 4
src/gui/dialogues/newnewflightdialog.h

@@ -29,14 +29,16 @@ class ValidationState {
 public:
     ValidationState() = default;
 
-    void validate(ValidationItem line_edit)   { validationArray[line_edit] = true;};
+    void validate(ValidationItem item)   { validationArray[item] = true;};
     void validate(int index)                  { validationArray[index] = true;};
-    void invalidate(ValidationItem line_edit) { validationArray[line_edit] = false;}
+    void invalidate(ValidationItem item) { validationArray[item] = false;}
     void invalidate(int index)                { validationArray[index] = false;}
-    bool allValid()                           { return validationArray.count(true) == 6;};
+    bool allValid()                           { return validationArray.count(true) == 7;};
     bool timesValid()                         { return validationArray[ValidationItem::tofb] && validationArray[ValidationItem::tonb];}
     bool locationsValid()                     { return validationArray[ValidationItem::dept] && validationArray[ValidationItem::dest];}
     bool acftValid()                          { return validationArray[ValidationItem::acft];}
+    bool validAt(int index)                   { return validationArray[index];}
+    bool validAt(ValidationItem item)         { return validationArray[item];}
 
     // Debug
     void printValidationStatus(){
@@ -97,7 +99,6 @@ private:
     QList<QLineEdit*> mandatoryLineEdits;
     static const inline QLatin1String self = QLatin1String("self");
 
-    bool eventFilter(QObject *object, QEvent *event) override;
     void init();
     void setupRawInputValidation();
     void setupSignalsAndSlots();
@@ -106,6 +107,10 @@ private:
     void onGoodInputReceived(QLineEdit *line_edit);
     void onBadInputReceived(QLineEdit *line_edit);
 
+    QTime calculateBlockTime();
+    int updateNightCheckBoxes();
+    void setNightCheckboxes();
+
 
 private slots:
     void toUpper(const QString& text);
@@ -113,6 +118,9 @@ private slots:
     void onPilotNameLineEdit_editingFinshed();
     void onLocationLineEdit_editingFinished();
     void on_acftLineEdit_editingFinished();
+    void on_doftLineEdit_editingFinished();
+    void on_buttonBox_accepted();
+    void on_pilotFlyingCheckBox_stateChanged(int arg1);
 };
 
 

+ 219 - 239
src/gui/dialogues/newnewflightdialog.ui

@@ -6,29 +6,33 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>943</width>
-    <height>288</height>
+    <width>960</width>
+    <height>252</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Dialog</string>
   </property>
   <layout class="QGridLayout" name="gridLayout_4">
-   <item row="0" column="0">
-    <spacer name="leftSpacer">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
+   <item row="1" column="2">
+    <widget class="QToolButton" name="toolButton">
+     <property name="text">
+      <string>?</string>
      </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>48</width>
-       <height>20</height>
-      </size>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QPushButton" name="pushButton_2">
+     <property name="text">
+      <string>Details</string>
      </property>
-    </spacer>
+    </widget>
    </item>
    <item row="1" column="5">
     <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="enabled">
+      <bool>true</bool>
+     </property>
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
@@ -37,73 +41,66 @@
      </property>
     </widget>
    </item>
+   <item row="0" column="6">
+    <spacer name="rightSpacer">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>48</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
    <item row="0" column="1" colspan="5">
     <layout class="QGridLayout" name="gridLayout_3">
      <item row="0" column="0">
       <layout class="QGridLayout" name="gridLayout">
-       <item row="1" column="0">
-        <widget class="QLabel" name="deptLabel">
-         <property name="text">
-          <string>Departure</string>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="0">
-        <widget class="QLabel" name="tofbLabel">
+       <item row="5" column="1">
+        <widget class="QLabel" name="tblkDisplayLabel">
          <property name="text">
-          <string>Off Blocks</string>
+          <string>00:00</string>
          </property>
         </widget>
        </item>
-       <item row="2" column="2">
-        <widget class="QLabel" name="destNameLabel">
-         <property name="enabled">
-          <bool>false</bool>
-         </property>
-         <property name="minimumSize">
+       <item row="2" column="4">
+        <widget class="QLineEdit" name="sicNameLineEdit">
+         <property name="maximumSize">
           <size>
            <width>120</width>
-           <height>0</height>
+           <height>16777215</height>
           </size>
          </property>
-         <property name="font">
-          <font>
-           <italic>true</italic>
-          </font>
-         </property>
+        </widget>
+       </item>
+       <item row="2" column="0">
+        <widget class="QLabel" name="destLabel">
          <property name="text">
-          <string/>
+          <string>Destination</string>
          </property>
         </widget>
        </item>
-       <item row="5" column="5">
-        <widget class="QLabel" name="remarksSpacerLabel">
-         <property name="enabled">
-          <bool>false</bool>
-         </property>
-         <property name="minimumSize">
+       <item row="1" column="4">
+        <widget class="QLineEdit" name="picNameLineEdit">
+         <property name="maximumSize">
           <size>
            <width>120</width>
-           <height>0</height>
+           <height>16777215</height>
           </size>
          </property>
-         <property name="text">
-          <string/>
-         </property>
         </widget>
        </item>
-       <item row="1" column="3">
-        <widget class="QLabel" name="picLabel">
+       <item row="0" column="0">
+        <widget class="QLabel" name="doftLabel">
          <property name="text">
-          <string>PIC</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+          <string>Date of flight</string>
          </property>
         </widget>
        </item>
-       <item row="0" column="1">
-        <widget class="QLineEdit" name="doftLineEdit">
+       <item row="0" column="4">
+        <widget class="QLineEdit" name="acftLineEdit">
          <property name="maximumSize">
           <size>
            <width>120</width>
@@ -112,18 +109,15 @@
          </property>
         </widget>
        </item>
-       <item row="3" column="4">
-        <widget class="QLineEdit" name="thirdPilotNameLineEdit">
-         <property name="maximumSize">
-          <size>
-           <width>120</width>
-           <height>16777215</height>
-          </size>
+       <item row="5" column="0">
+        <widget class="QLabel" name="tblkLabel">
+         <property name="text">
+          <string>Total Time</string>
          </property>
         </widget>
        </item>
-       <item row="2" column="5">
-        <widget class="QLabel" name="sicNameDisplayLabel">
+       <item row="4" column="2">
+        <widget class="QLabel" name="tonbSpacerLabel">
          <property name="enabled">
           <bool>false</bool>
          </property>
@@ -148,6 +142,22 @@
          </property>
         </widget>
        </item>
+       <item row="3" column="2">
+        <widget class="QLabel" name="tofbSpacerLabel">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>120</width>
+           <height>0</height>
+          </size>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
        <item row="1" column="2">
         <widget class="QLabel" name="deptNameLabel">
          <property name="enabled">
@@ -169,8 +179,11 @@
          </property>
         </widget>
        </item>
-       <item row="5" column="2">
-        <widget class="QLabel" name="submissionReadyLabel">
+       <item row="1" column="5">
+        <widget class="QLabel" name="picNameDisplayLabel">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
          <property name="minimumSize">
           <size>
            <width>120</width>
@@ -178,12 +191,19 @@
           </size>
          </property>
          <property name="text">
-          <string>Data Missing</string>
+          <string/>
          </property>
         </widget>
        </item>
-       <item row="1" column="5">
-        <widget class="QLabel" name="picNameDisplayLabel">
+       <item row="1" column="0">
+        <widget class="QLabel" name="deptLabel">
+         <property name="text">
+          <string>Departure</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="5">
+        <widget class="QLabel" name="sicNameDisplayLabel">
          <property name="enabled">
           <bool>false</bool>
          </property>
@@ -198,8 +218,15 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="1">
-        <widget class="QLineEdit" name="deptLocationLineEdit">
+       <item row="3" column="0">
+        <widget class="QLabel" name="tofbLabel">
+         <property name="text">
+          <string>Off Blocks</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="4">
+        <widget class="QLineEdit" name="flightNumberLineEdit">
          <property name="maximumSize">
           <size>
            <width>120</width>
@@ -208,8 +235,8 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="4">
-        <widget class="QLineEdit" name="picNameLineEdit">
+       <item row="0" column="1">
+        <widget class="QLineEdit" name="doftLineEdit">
          <property name="maximumSize">
           <size>
            <width>120</width>
@@ -218,31 +245,18 @@
          </property>
         </widget>
        </item>
-       <item row="0" column="2">
-        <widget class="QPushButton" name="calendarPushButton">
-         <property name="minimumSize">
-          <size>
-           <width>120</width>
-           <height>0</height>
-          </size>
-         </property>
+       <item row="4" column="3">
+        <widget class="QLabel" name="flightNumberLabel">
          <property name="text">
-          <string>Calendar</string>
+          <string>Flight Number</string>
          </property>
-        </widget>
-       </item>
-       <item row="4" column="1">
-        <widget class="QLineEdit" name="tonbTimeLineEdit">
-         <property name="maximumSize">
-          <size>
-           <width>120</width>
-           <height>16777215</height>
-          </size>
+         <property name="alignment">
+          <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
          </property>
         </widget>
        </item>
-       <item row="4" column="5">
-        <widget class="QLabel" name="flightNumberSpacerLabel">
+       <item row="5" column="5">
+        <widget class="QLabel" name="remarksSpacerLabel">
          <property name="enabled">
           <bool>false</bool>
          </property>
@@ -257,34 +271,56 @@
          </property>
         </widget>
        </item>
-       <item row="0" column="0">
-        <widget class="QLabel" name="doftLabel">
+       <item row="5" column="3">
+        <widget class="QLabel" name="remarksLabel">
          <property name="text">
-          <string>Date of flight</string>
+          <string>Remarks</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
          </property>
         </widget>
        </item>
-       <item row="0" column="3">
-        <widget class="QLabel" name="acftLabel">
+       <item row="3" column="3">
+        <widget class="QLabel" name="thirdPilotLabel">
          <property name="text">
-          <string>Aircraft</string>
+          <string>Third Pilot</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
          </property>
         </widget>
        </item>
-       <item row="2" column="0">
-        <widget class="QLabel" name="destLabel">
+       <item row="5" column="2">
+        <widget class="QLabel" name="submissionReadyLabel">
+         <property name="minimumSize">
+          <size>
+           <width>120</width>
+           <height>0</height>
+          </size>
+         </property>
          <property name="text">
-          <string>Destination</string>
+          <string/>
          </property>
         </widget>
        </item>
-       <item row="4" column="0">
-        <widget class="QLabel" name="tonbLabel">
+       <item row="3" column="4">
+        <widget class="QLineEdit" name="thirdPilotNameLineEdit">
+         <property name="maximumSize">
+          <size>
+           <width>120</width>
+           <height>16777215</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="3">
+        <widget class="QLabel" name="sicLabel">
          <property name="text">
-          <string>On Blocks</string>
+          <string>SIC</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
          </property>
         </widget>
        </item>
@@ -298,10 +334,26 @@
          </property>
         </widget>
        </item>
-       <item row="4" column="3">
-        <widget class="QLabel" name="flightNumberLabel">
+       <item row="4" column="5">
+        <widget class="QLabel" name="flightNumberSpacerLabel">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>120</width>
+           <height>0</height>
+          </size>
+         </property>
          <property name="text">
-          <string>Flight Number</string>
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="3">
+        <widget class="QLabel" name="picLabel">
+         <property name="text">
+          <string>PIC</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@@ -329,18 +381,8 @@
          </property>
         </widget>
        </item>
-       <item row="2" column="1">
-        <widget class="QLineEdit" name="destLocationLineEdit">
-         <property name="maximumSize">
-          <size>
-           <width>120</width>
-           <height>16777215</height>
-          </size>
-         </property>
-        </widget>
-       </item>
-       <item row="4" column="4">
-        <widget class="QLineEdit" name="flightNumberLineEdit">
+       <item row="4" column="1">
+        <widget class="QLineEdit" name="tonbTimeLineEdit">
          <property name="maximumSize">
           <size>
            <width>120</width>
@@ -349,8 +391,8 @@
          </property>
         </widget>
        </item>
-       <item row="4" column="2">
-        <widget class="QLabel" name="tonbSpacerLabel">
+       <item row="2" column="2">
+        <widget class="QLabel" name="destNameLabel">
          <property name="enabled">
           <bool>false</bool>
          </property>
@@ -360,30 +402,28 @@
            <height>0</height>
           </size>
          </property>
-         <property name="text">
-          <string/>
+         <property name="font">
+          <font>
+           <italic>true</italic>
+          </font>
          </property>
-        </widget>
-       </item>
-       <item row="5" column="0">
-        <widget class="QLabel" name="tblkLabel">
          <property name="text">
-          <string>Total Time</string>
+          <string/>
          </property>
         </widget>
        </item>
-       <item row="3" column="3">
-        <widget class="QLabel" name="thirdPilotLabel">
+       <item row="0" column="3">
+        <widget class="QLabel" name="acftLabel">
          <property name="text">
-          <string>Third Pilot</string>
+          <string>Aircraft</string>
          </property>
          <property name="alignment">
           <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
          </property>
         </widget>
        </item>
-       <item row="2" column="4">
-        <widget class="QLineEdit" name="sicNameLineEdit">
+       <item row="2" column="1">
+        <widget class="QLineEdit" name="destLocationLineEdit">
          <property name="maximumSize">
           <size>
            <width>120</width>
@@ -392,41 +432,8 @@
          </property>
         </widget>
        </item>
-       <item row="5" column="3">
-        <widget class="QLabel" name="remarksLabel">
-         <property name="text">
-          <string>Remarks</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-       </item>
-       <item row="5" column="1">
-        <widget class="QLabel" name="tblkDisplayLabel">
-         <property name="text">
-          <string>00:00</string>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="2">
-        <widget class="QLabel" name="tofbSpacerLabel">
-         <property name="enabled">
-          <bool>false</bool>
-         </property>
-         <property name="minimumSize">
-          <size>
-           <width>120</width>
-           <height>0</height>
-          </size>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-       </item>
-       <item row="0" column="4">
-        <widget class="QLineEdit" name="acftLineEdit">
+       <item row="1" column="1">
+        <widget class="QLineEdit" name="deptLocationLineEdit">
          <property name="maximumSize">
           <size>
            <width>120</width>
@@ -435,16 +442,6 @@
          </property>
         </widget>
        </item>
-       <item row="2" column="3">
-        <widget class="QLabel" name="sicLabel">
-         <property name="text">
-          <string>SIC</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
-         </property>
-        </widget>
-       </item>
        <item row="3" column="5">
         <widget class="QLabel" name="thirdPilotNameDisplayLabel">
          <property name="enabled">
@@ -461,41 +458,27 @@
          </property>
         </widget>
        </item>
-      </layout>
-     </item>
-     <item row="0" column="1">
-      <layout class="QGridLayout" name="gridLayout_2">
-       <item row="0" column="0" colspan="2">
-        <widget class="QCheckBox" name="pilotFlyingCheckBox">
+       <item row="4" column="0">
+        <widget class="QLabel" name="tonbLabel">
          <property name="text">
-          <string>Pilot Flying</string>
+          <string>On Blocks</string>
          </property>
         </widget>
        </item>
        <item row="0" column="2">
-        <widget class="QCheckBox" name="ifrCheckBox">
-         <property name="text">
-          <string>IFR</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0">
-        <widget class="QLabel" name="takeOffLabel">
+        <widget class="QLabel" name="doftDisplayLabel">
          <property name="text">
-          <string>Take Off</string>
+          <string/>
          </property>
         </widget>
        </item>
+      </layout>
+     </item>
+     <item row="0" column="1">
+      <layout class="QGridLayout" name="gridLayout_2">
        <item row="1" column="1">
         <widget class="QSpinBox" name="takeOffSpinBox"/>
        </item>
-       <item row="1" column="2">
-        <widget class="QCheckBox" name="toNightCheckBox">
-         <property name="text">
-          <string>Night</string>
-         </property>
-        </widget>
-       </item>
        <item row="2" column="0">
         <widget class="QLabel" name="landingLabel">
          <property name="text">
@@ -503,9 +486,6 @@
          </property>
         </widget>
        </item>
-       <item row="2" column="1">
-        <widget class="QSpinBox" name="landingSpinBox"/>
-       </item>
        <item row="2" column="2">
         <widget class="QCheckBox" name="ldgNightCheckBox">
          <property name="text">
@@ -513,6 +493,13 @@
          </property>
         </widget>
        </item>
+       <item row="0" column="0" colspan="2">
+        <widget class="QCheckBox" name="pilotFlyingCheckBox">
+         <property name="text">
+          <string>Pilot Flying</string>
+         </property>
+        </widget>
+       </item>
        <item row="3" column="0">
         <widget class="QLabel" name="functionLabel">
          <property name="text">
@@ -544,6 +531,30 @@
          </item>
         </widget>
        </item>
+       <item row="1" column="2">
+        <widget class="QCheckBox" name="toNightCheckBox">
+         <property name="text">
+          <string>Night</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="2">
+        <widget class="QCheckBox" name="ifrCheckBox">
+         <property name="text">
+          <string>IFR</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="takeOffLabel">
+         <property name="text">
+          <string>Take Off</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1">
+        <widget class="QSpinBox" name="landingSpinBox"/>
+       </item>
        <item row="4" column="0">
         <widget class="QLabel" name="approachLabel">
          <property name="text">
@@ -558,8 +569,8 @@
      </item>
     </layout>
    </item>
-   <item row="0" column="6">
-    <spacer name="rightSpacer">
+   <item row="0" column="0">
+    <spacer name="leftSpacer">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
@@ -571,20 +582,6 @@
      </property>
     </spacer>
    </item>
-   <item row="1" column="1">
-    <widget class="QPushButton" name="pushButton_2">
-     <property name="text">
-      <string>Details</string>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="2">
-    <widget class="QToolButton" name="toolButton">
-     <property name="text">
-      <string>?</string>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
  <tabstops>
@@ -609,26 +606,9 @@
   <tabstop>approachComboBox</tabstop>
   <tabstop>pushButton_2</tabstop>
   <tabstop>toolButton</tabstop>
-  <tabstop>calendarPushButton</tabstop>
  </tabstops>
  <resources/>
  <connections>
-  <connection>
-   <sender>buttonBox</sender>
-   <signal>accepted()</signal>
-   <receiver>NewNewFlightDialog</receiver>
-   <slot>accept()</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>157</x>
-     <y>274</y>
-    </hint>
-   </hints>
-  </connection>
   <connection>
    <sender>buttonBox</sender>
    <signal>rejected()</signal>
@@ -636,12 +616,12 @@
    <slot>reject()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
+     <x>490</x>
+     <y>242</y>
     </hint>
     <hint type="destinationlabel">
      <x>286</x>
-     <y>274</y>
+     <y>251</y>
     </hint>
    </hints>
   </connection>