|
@@ -17,17 +17,21 @@
|
|
*/
|
|
*/
|
|
#include "newflightdialog.h"
|
|
#include "newflightdialog.h"
|
|
#include "ui_newflight.h"
|
|
#include "ui_newflight.h"
|
|
-#include "src/testing/adebug.h"
|
|
|
|
-#include "src/database/tablecolumnliterals.h"
|
|
|
|
|
|
+#include "src/gui/dialogues/newtaildialog.h"
|
|
|
|
+#include "src/gui/dialogues/newpilotdialog.h"
|
|
|
|
+#include "src/functions/acalc.h"
|
|
|
|
+#include "src/testing/atimer.h"
|
|
|
|
+#include "src/database/adatabase.h"
|
|
|
|
+
|
|
|
|
|
|
-using namespace experimental;
|
|
|
|
|
|
+#include "src/testing/adebug.h"
|
|
|
|
|
|
/////////////////////////////////////// DEBUG /////////////////////////////////////////////////////
|
|
/////////////////////////////////////// DEBUG /////////////////////////////////////////////////////
|
|
void NewFlightDialog::onInputRejected()
|
|
void NewFlightDialog::onInputRejected()
|
|
{
|
|
{
|
|
auto sender_object = sender();
|
|
auto sender_object = sender();
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
- DEB(line_edit->objectName() << "Input Rejected - " << line_edit->text());
|
|
|
|
|
|
+ DEB << line_edit->objectName() << "Input Rejected - " << line_edit->text();
|
|
}
|
|
}
|
|
/////////////////////////////////////// DEBUG /////////////////////////////////////////////////////
|
|
/////////////////////////////////////// DEBUG /////////////////////////////////////////////////////
|
|
|
|
|
|
@@ -154,7 +158,7 @@ void NewFlightDialog::setup()
|
|
}
|
|
}
|
|
void NewFlightDialog::readSettings()
|
|
void NewFlightDialog::readSettings()
|
|
{
|
|
{
|
|
- DEB("Reading Settings...");
|
|
|
|
|
|
+ DEB << "Reading Settings...";
|
|
QSettings settings;
|
|
QSettings settings;
|
|
ui->FunctionComboBox->setCurrentText(ASettings::read("flightlogging/function").toString());
|
|
ui->FunctionComboBox->setCurrentText(ASettings::read("flightlogging/function").toString());
|
|
ui->ApproachComboBox->setCurrentText(ASettings::read("flightlogging/approach").toString());
|
|
ui->ApproachComboBox->setCurrentText(ASettings::read("flightlogging/approach").toString());
|
|
@@ -181,7 +185,7 @@ void NewFlightDialog::readSettings()
|
|
|
|
|
|
void NewFlightDialog::writeSettings()
|
|
void NewFlightDialog::writeSettings()
|
|
{
|
|
{
|
|
- DEB("Writing Settings...");
|
|
|
|
|
|
+ DEB << "Writing Settings...";
|
|
|
|
|
|
ASettings::write("flightlogging/function", ui->FunctionComboBox->currentText());
|
|
ASettings::write("flightlogging/function", ui->FunctionComboBox->currentText());
|
|
ASettings::write("flightlogging/approach", ui->ApproachComboBox->currentText());
|
|
ASettings::write("flightlogging/approach", ui->ApproachComboBox->currentText());
|
|
@@ -237,7 +241,7 @@ void NewFlightDialog::setupRawInputValidation()
|
|
for (const auto &item : line_edit_settings) {
|
|
for (const auto &item : line_edit_settings) {
|
|
for (const auto &line_edit : line_edits) {
|
|
for (const auto &line_edit : line_edits) {
|
|
if(line_edit->objectName().contains(std::get<0>(item))) {
|
|
if(line_edit->objectName().contains(std::get<0>(item))) {
|
|
- DEB("Setting up: " << line_edit->objectName());
|
|
|
|
|
|
+ DEB << "Setting up: " << line_edit->objectName();
|
|
// Set Validator
|
|
// Set Validator
|
|
auto validator = new QRegularExpressionValidator(std::get<2>(item), line_edit);
|
|
auto validator = new QRegularExpressionValidator(std::get<2>(item), line_edit);
|
|
line_edit->setValidator(validator);
|
|
line_edit->setValidator(validator);
|
|
@@ -317,7 +321,7 @@ void NewFlightDialog::setPopUpCalendarEnabled(bool state)
|
|
ui->flightDataTabWidget->removeTab(2); // hide calendar widget
|
|
ui->flightDataTabWidget->removeTab(2); // hide calendar widget
|
|
|
|
|
|
if (state) {
|
|
if (state) {
|
|
- DEB("Enabling pop-up calendar widget...");
|
|
|
|
|
|
+ DEB << "Enabling pop-up calendar widget...";
|
|
ui->calendarWidget->installEventFilter(this);
|
|
ui->calendarWidget->installEventFilter(this);
|
|
ui->placeLabel1->installEventFilter(this);
|
|
ui->placeLabel1->installEventFilter(this);
|
|
ui->doftLineEdit->installEventFilter(this);
|
|
ui->doftLineEdit->installEventFilter(this);
|
|
@@ -327,7 +331,7 @@ void NewFlightDialog::setPopUpCalendarEnabled(bool state)
|
|
QObject::connect(ui->calendarWidget, &QCalendarWidget::activated,
|
|
QObject::connect(ui->calendarWidget, &QCalendarWidget::activated,
|
|
this, &NewFlightDialog::onCalendarWidget_selected);
|
|
this, &NewFlightDialog::onCalendarWidget_selected);
|
|
} else {
|
|
} else {
|
|
- DEB("Disabling pop-up calendar widget...");
|
|
|
|
|
|
+ DEB << "Disabling pop-up calendar widget...";
|
|
ui->calendarWidget->removeEventFilter(this);
|
|
ui->calendarWidget->removeEventFilter(this);
|
|
ui->placeLabel1->removeEventFilter(this);
|
|
ui->placeLabel1->removeEventFilter(this);
|
|
ui->doftLineEdit->removeEventFilter(this);
|
|
ui->doftLineEdit->removeEventFilter(this);
|
|
@@ -349,7 +353,7 @@ bool NewFlightDialog::eventFilter(QObject* object, QEvent* event)
|
|
if (line_edit != nullptr) {
|
|
if (line_edit != nullptr) {
|
|
if (mandatoryLineEdits.contains(line_edit) && event->type() == QEvent::FocusIn) {
|
|
if (mandatoryLineEdits.contains(line_edit) && event->type() == QEvent::FocusIn) {
|
|
mandatoryLineEditsGood.setBit(mandatoryLineEdits.indexOf(line_edit), false);
|
|
mandatoryLineEditsGood.setBit(mandatoryLineEdits.indexOf(line_edit), false);
|
|
- DEB("Editing " << line_edit->objectName());
|
|
|
|
|
|
+ DEB << "Editing " << line_edit->objectName();
|
|
// set verification bit to false when entering a mandatory line edit
|
|
// set verification bit to false when entering a mandatory line edit
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -357,7 +361,7 @@ bool NewFlightDialog::eventFilter(QObject* object, QEvent* event)
|
|
// show completion menu when pressing down arrow
|
|
// show completion menu when pressing down arrow
|
|
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
|
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
|
if (keyEvent->key() == Qt::Key_Down) {
|
|
if (keyEvent->key() == Qt::Key_Down) {
|
|
- DEB("Key down event.");
|
|
|
|
|
|
+ DEB << "Key down event.";
|
|
line_edit->completer()->complete();
|
|
line_edit->completer()->complete();
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
@@ -366,7 +370,7 @@ bool NewFlightDialog::eventFilter(QObject* object, QEvent* event)
|
|
// show completion menu when pressing down arrow
|
|
// show completion menu when pressing down arrow
|
|
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
|
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
|
if (keyEvent->key() == Qt::Key_Down) {
|
|
if (keyEvent->key() == Qt::Key_Down) {
|
|
- DEB("Key down event.");
|
|
|
|
|
|
+ DEB << "Key down event.";
|
|
line_edit->completer()->complete();
|
|
line_edit->completer()->complete();
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
@@ -404,7 +408,7 @@ void NewFlightDialog::fillDeductibleData()
|
|
// get acft data and fill deductible entries
|
|
// get acft data and fill deductible entries
|
|
auto acft = aDB()->getTailEntry(tailsIdMap.value(ui->acftLineEdit->text()));
|
|
auto acft = aDB()->getTailEntry(tailsIdMap.value(ui->acftLineEdit->text()));
|
|
if (acft.getData().isEmpty())
|
|
if (acft.getData().isEmpty())
|
|
- DEB("Error: No valid aircraft object available, unable to deterime auto times.");
|
|
|
|
|
|
+ DEB << "Error: No valid aircraft object available, unable to deterime auto times.";
|
|
|
|
|
|
|
|
|
|
// SP SE
|
|
// SP SE
|
|
@@ -481,10 +485,10 @@ void NewFlightDialog::fillDeductibleData()
|
|
* no input validation is done in this step and input data is assumed to be valid.
|
|
* no input validation is done in this step and input data is assumed to be valid.
|
|
* \return
|
|
* \return
|
|
*/
|
|
*/
|
|
-TableData NewFlightDialog::collectInput()
|
|
|
|
|
|
+RowData NewFlightDialog::collectInput()
|
|
{
|
|
{
|
|
- TableData newData;
|
|
|
|
- DEB("Collecting Input...");
|
|
|
|
|
|
+ RowData newData;
|
|
|
|
+ DEB << "Collecting Input...";
|
|
// Mandatory data
|
|
// Mandatory data
|
|
newData.insert(DB_FLIGHTS_DOFT, ui->doftLineEdit->text());
|
|
newData.insert(DB_FLIGHTS_DOFT, ui->doftLineEdit->text());
|
|
newData.insert(DB_FLIGHTS_DEPT, ui->deptLocLineEdit->text());
|
|
newData.insert(DB_FLIGHTS_DEPT, ui->deptLocLineEdit->text());
|
|
@@ -511,8 +515,8 @@ TableData NewFlightDialog::collectInput()
|
|
: newData.insert(DB_FLIGHTS_TSPSE, ACalc::stringToMinutes(ui->tSPSETimeLineEdit->text()));
|
|
: newData.insert(DB_FLIGHTS_TSPSE, ACalc::stringToMinutes(ui->tSPSETimeLineEdit->text()));
|
|
|
|
|
|
ui->tSPMETimeLineEdit->text().isEmpty() ?
|
|
ui->tSPMETimeLineEdit->text().isEmpty() ?
|
|
- newData.insert(DB_FLIGHTS_SPME, DB_NULL)
|
|
|
|
- : newData.insert(DB_FLIGHTS_SPME, ACalc::stringToMinutes(ui->tSPMETimeLineEdit->text()));
|
|
|
|
|
|
+ newData.insert(DB_FLIGHTS_TSPME, DB_NULL)
|
|
|
|
+ : newData.insert(DB_FLIGHTS_TSPME, ACalc::stringToMinutes(ui->tSPMETimeLineEdit->text()));
|
|
ui->tMPTimeLineEdit->text().isEmpty() ?
|
|
ui->tMPTimeLineEdit->text().isEmpty() ?
|
|
newData.insert(DB_FLIGHTS_TMP, DB_NULL)
|
|
newData.insert(DB_FLIGHTS_TMP, DB_NULL)
|
|
: newData.insert(DB_FLIGHTS_TMP, ACalc::stringToMinutes(ui->tMPTimeLineEdit->text()));
|
|
: newData.insert(DB_FLIGHTS_TMP, ACalc::stringToMinutes(ui->tMPTimeLineEdit->text()));
|
|
@@ -624,14 +628,14 @@ TableData NewFlightDialog::collectInput()
|
|
newData.insert(DB_FLIGHTS_FLIGHTNUMBER, ui->FlightNumberLineEdit->text());
|
|
newData.insert(DB_FLIGHTS_FLIGHTNUMBER, ui->FlightNumberLineEdit->text());
|
|
newData.insert(DB_FLIGHTS_REMARKS, ui->RemarksLineEdit->text());
|
|
newData.insert(DB_FLIGHTS_REMARKS, ui->RemarksLineEdit->text());
|
|
|
|
|
|
- DEB("New Flight Data: " << newData);
|
|
|
|
|
|
+ DEB << "New Flight Data: " << newData;
|
|
|
|
|
|
return newData;
|
|
return newData;
|
|
}
|
|
}
|
|
|
|
|
|
void NewFlightDialog::formFiller()
|
|
void NewFlightDialog::formFiller()
|
|
{
|
|
{
|
|
- DEB("Filling Line Edits...");
|
|
|
|
|
|
+ DEB << "Filling Line Edits...";
|
|
// get Line Edits
|
|
// get Line Edits
|
|
auto line_edits = this->findChildren<QLineEdit *>();
|
|
auto line_edits = this->findChildren<QLineEdit *>();
|
|
QStringList line_edits_names;
|
|
QStringList line_edits_names;
|
|
@@ -646,7 +650,7 @@ void NewFlightDialog::formFiller()
|
|
auto rx = QRegularExpression(data_key + "LineEdit");//acftLineEdit
|
|
auto rx = QRegularExpression(data_key + "LineEdit");//acftLineEdit
|
|
for(const auto& leName : line_edits_names){
|
|
for(const auto& leName : line_edits_names){
|
|
if(rx.match(leName).hasMatch()) {
|
|
if(rx.match(leName).hasMatch()) {
|
|
- //DEB("Loc Match found: " << key << " - " << leName);
|
|
|
|
|
|
+ //DEB << "Loc Match found: " << key << " - " << leName);
|
|
auto line_edit = this->findChild<QLineEdit *>(leName);
|
|
auto line_edit = this->findChild<QLineEdit *>(leName);
|
|
if(line_edit != nullptr){
|
|
if(line_edit != nullptr){
|
|
line_edit->setText(flightEntry.getData().value(data_key).toString());
|
|
line_edit->setText(flightEntry.getData().value(data_key).toString());
|
|
@@ -658,7 +662,7 @@ void NewFlightDialog::formFiller()
|
|
rx = QRegularExpression(data_key + "Loc\\w+?");
|
|
rx = QRegularExpression(data_key + "Loc\\w+?");
|
|
for(const auto& leName : line_edits_names){
|
|
for(const auto& leName : line_edits_names){
|
|
if(rx.match(leName).hasMatch()) {
|
|
if(rx.match(leName).hasMatch()) {
|
|
- //DEB("Loc Match found: " << key << " - " << leName);
|
|
|
|
|
|
+ //DEB << "Loc Match found: " << key << " - " << leName);
|
|
auto line_edit = this->findChild<QLineEdit *>(leName);
|
|
auto line_edit = this->findChild<QLineEdit *>(leName);
|
|
if(line_edit != nullptr){
|
|
if(line_edit != nullptr){
|
|
line_edit->setText(flightEntry.getData().value(data_key).toString());
|
|
line_edit->setText(flightEntry.getData().value(data_key).toString());
|
|
@@ -670,10 +674,10 @@ void NewFlightDialog::formFiller()
|
|
rx = QRegularExpression(data_key + "Time\\w+?");
|
|
rx = QRegularExpression(data_key + "Time\\w+?");
|
|
for(const auto& leName : line_edits_names){
|
|
for(const auto& leName : line_edits_names){
|
|
if(rx.match(leName).hasMatch()) {
|
|
if(rx.match(leName).hasMatch()) {
|
|
- //DEB("Time Match found: " << key << " - " << leName);
|
|
|
|
|
|
+ //DEB << "Time Match found: " << key << " - " << leName);
|
|
auto line_edits = this->findChild<QLineEdit *>(leName);
|
|
auto line_edits = this->findChild<QLineEdit *>(leName);
|
|
if(line_edits != nullptr){
|
|
if(line_edits != nullptr){
|
|
- DEB("Setting " << line_edits->objectName() << " to " << ACalc::minutesToString(flightEntry.getData().value(data_key).toInt()));
|
|
|
|
|
|
+ DEB << "Setting " << line_edits->objectName() << " to " << ACalc::minutesToString(flightEntry.getData().value(data_key).toInt());
|
|
line_edits->setText(ACalc::minutesToString(
|
|
line_edits->setText(ACalc::minutesToString(
|
|
flightEntry.getData().value(data_key).toInt()));
|
|
flightEntry.getData().value(data_key).toInt()));
|
|
line_edits_names.removeOne(leName);
|
|
line_edits_names.removeOne(leName);
|
|
@@ -686,7 +690,7 @@ void NewFlightDialog::formFiller()
|
|
if(rx.match(leName).hasMatch()) {
|
|
if(rx.match(leName).hasMatch()) {
|
|
auto line_edits = this->findChild<QLineEdit *>(leName);
|
|
auto line_edits = this->findChild<QLineEdit *>(leName);
|
|
if(line_edits != nullptr){
|
|
if(line_edits != nullptr){
|
|
- DEB(pilotsIdMap.key(1));
|
|
|
|
|
|
+ DEB << pilotsIdMap.key(1);
|
|
line_edits->setText(pilotsIdMap.key(flightEntry.getData().value(data_key).toInt()));
|
|
line_edits->setText(pilotsIdMap.key(flightEntry.getData().value(data_key).toInt()));
|
|
line_edits_names.removeOne(leName);
|
|
line_edits_names.removeOne(leName);
|
|
}
|
|
}
|
|
@@ -797,7 +801,7 @@ void NewFlightDialog::addNewTail(QLineEdit *parent_line_edit)
|
|
"add the registration to the database first.<br><br>Would you like to add a new aircraft to the database?",
|
|
"add the registration to the database first.<br><br>Would you like to add a new aircraft to the database?",
|
|
QMessageBox::Yes|QMessageBox::No);
|
|
QMessageBox::Yes|QMessageBox::No);
|
|
if (reply == QMessageBox::Yes) {
|
|
if (reply == QMessageBox::Yes) {
|
|
- DEB("Add new aircraft selected");
|
|
|
|
|
|
+ DEB << "Add new aircraft selected";
|
|
// create and open new aircraft dialog
|
|
// create and open new aircraft dialog
|
|
auto na = NewTailDialog(ui->acftLineEdit->text(), this);
|
|
auto na = NewTailDialog(ui->acftLineEdit->text(), this);
|
|
na.exec();
|
|
na.exec();
|
|
@@ -805,8 +809,8 @@ void NewFlightDialog::addNewTail(QLineEdit *parent_line_edit)
|
|
tailsIdMap = aDB()->getIdMap(ADatabaseTarget::tails);
|
|
tailsIdMap = aDB()->getIdMap(ADatabaseTarget::tails);
|
|
tailsList = aDB()->getCompletionList(ADatabaseTarget::registrations);
|
|
tailsList = aDB()->getCompletionList(ADatabaseTarget::registrations);
|
|
|
|
|
|
- DEB("New Entry added. Id:" << aDB()->getLastEntry(ADatabaseTarget::tails));
|
|
|
|
- DEB("AC Map: " << tailsIdMap);
|
|
|
|
|
|
+ DEB << "New Entry added. Id:" << aDB()->getLastEntry(ADatabaseTarget::tails);
|
|
|
|
+ DEB << "AC Map: " << tailsIdMap;
|
|
|
|
|
|
parent_line_edit->setText(tailsIdMap.key(aDB()->getLastEntry(ADatabaseTarget::tails)));
|
|
parent_line_edit->setText(tailsIdMap.key(aDB()->getLastEntry(ADatabaseTarget::tails)));
|
|
emit parent_line_edit->editingFinished();
|
|
emit parent_line_edit->editingFinished();
|
|
@@ -829,14 +833,14 @@ void NewFlightDialog::addNewPilot(QLineEdit *parent_line_edit)
|
|
"add the name to the database first.<br><br>Would you like to add a new pilot to the database?",
|
|
"add the name to the database first.<br><br>Would you like to add a new pilot to the database?",
|
|
QMessageBox::Yes|QMessageBox::No);
|
|
QMessageBox::Yes|QMessageBox::No);
|
|
if (reply == QMessageBox::Yes) {
|
|
if (reply == QMessageBox::Yes) {
|
|
- DEB("Add new pilot selected");
|
|
|
|
|
|
+ DEB << "Add new pilot selected";
|
|
// create and open new pilot dialog
|
|
// create and open new pilot dialog
|
|
auto np = NewPilotDialog(this);
|
|
auto np = NewPilotDialog(this);
|
|
np.exec();
|
|
np.exec();
|
|
// update map and list, set line edit
|
|
// update map and list, set line edit
|
|
pilotsIdMap = aDB()->getIdMap(ADatabaseTarget::pilots);
|
|
pilotsIdMap = aDB()->getIdMap(ADatabaseTarget::pilots);
|
|
pilotList = aDB()->getCompletionList(ADatabaseTarget::pilots);
|
|
pilotList = aDB()->getCompletionList(ADatabaseTarget::pilots);
|
|
- DEB("Setting new entry: " << pilotsIdMap.key(aDB()->getLastEntry(ADatabaseTarget::pilots)));
|
|
|
|
|
|
+ DEB << "Setting new entry: " << pilotsIdMap.key(aDB()->getLastEntry(ADatabaseTarget::pilots));
|
|
parent_line_edit->setText(pilotsIdMap.key(aDB()->getLastEntry(ADatabaseTarget::pilots)));
|
|
parent_line_edit->setText(pilotsIdMap.key(aDB()->getLastEntry(ADatabaseTarget::pilots)));
|
|
emit parent_line_edit->editingFinished();
|
|
emit parent_line_edit->editingFinished();
|
|
} else {
|
|
} else {
|
|
@@ -850,7 +854,7 @@ void NewFlightDialog::addNewPilot(QLineEdit *parent_line_edit)
|
|
|
|
|
|
void NewFlightDialog::on_cancelButton_clicked()
|
|
void NewFlightDialog::on_cancelButton_clicked()
|
|
{
|
|
{
|
|
- DEB("Cancel Button clicked.");
|
|
|
|
|
|
+ DEB << "Cancel Button clicked.";
|
|
reject();
|
|
reject();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -859,7 +863,7 @@ void NewFlightDialog::on_submitButton_clicked()
|
|
for (const auto &line_edit : mandatoryLineEdits) {
|
|
for (const auto &line_edit : mandatoryLineEdits) {
|
|
emit line_edit->editingFinished();
|
|
emit line_edit->editingFinished();
|
|
}
|
|
}
|
|
- DEB("editing finished emitted. good count: " << mandatoryLineEditsGood.count(true));
|
|
|
|
|
|
+ DEB << "editing finished emitted. good count: " << mandatoryLineEditsGood.count(true);
|
|
if (mandatoryLineEditsGood.count(true) != 7) {
|
|
if (mandatoryLineEditsGood.count(true) != 7) {
|
|
QString error_message = "Not all mandatory entries are valid.<br>The following"
|
|
QString error_message = "Not all mandatory entries are valid.<br>The following"
|
|
" item(s) are empty or missing:<br><br><center><b>";
|
|
" item(s) are empty or missing:<br><br><center><b>";
|
|
@@ -877,11 +881,11 @@ void NewFlightDialog::on_submitButton_clicked()
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- DEB("Submit Button clicked. Mandatory good (out of 7): " << mandatoryLineEditsGood.count(true));
|
|
|
|
|
|
+ DEB << "Submit Button clicked. Mandatory good (out of 7): " << mandatoryLineEditsGood.count(true);
|
|
auto newData = collectInput();
|
|
auto newData = collectInput();
|
|
- DEB("Setting Data for flightEntry...");
|
|
|
|
|
|
+ DEB << "Setting Data for flightEntry...";
|
|
flightEntry.setData(newData);
|
|
flightEntry.setData(newData);
|
|
- DEB("Committing...");
|
|
|
|
|
|
+ DEB << "Committing...";
|
|
if (!aDB()->commit(flightEntry)) {
|
|
if (!aDB()->commit(flightEntry)) {
|
|
auto message_box = QMessageBox(this);
|
|
auto message_box = QMessageBox(this);
|
|
message_box.setText("The following error has ocurred:\n\n"
|
|
message_box.setText("The following error has ocurred:\n\n"
|
|
@@ -903,7 +907,7 @@ void NewFlightDialog::on_submitButton_clicked()
|
|
|
|
|
|
void NewFlightDialog::onGoodInputReceived(QLineEdit *line_edit)
|
|
void NewFlightDialog::onGoodInputReceived(QLineEdit *line_edit)
|
|
{
|
|
{
|
|
- DEB(line_edit->objectName() << " - Good input received - " << line_edit->text());
|
|
|
|
|
|
+ DEB << line_edit->objectName() << " - Good input received - " << line_edit->text();
|
|
line_edit->setStyleSheet("");
|
|
line_edit->setStyleSheet("");
|
|
|
|
|
|
if (mandatoryLineEdits.contains(line_edit))
|
|
if (mandatoryLineEdits.contains(line_edit))
|
|
@@ -912,18 +916,18 @@ void NewFlightDialog::onGoodInputReceived(QLineEdit *line_edit)
|
|
if (mandatoryLineEditsGood.count(true) == 7)
|
|
if (mandatoryLineEditsGood.count(true) == 7)
|
|
onMandatoryLineEditsFilled();
|
|
onMandatoryLineEditsFilled();
|
|
|
|
|
|
- DEB("Mandatory good: " << mandatoryLineEditsGood.count(true)
|
|
|
|
- << " (out of 7) " << mandatoryLineEditsGood);
|
|
|
|
|
|
+ DEB << "Mandatory good: " << mandatoryLineEditsGood.count(true)
|
|
|
|
+ << " (out of 7) " << mandatoryLineEditsGood;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void NewFlightDialog::onBadInputReceived(QLineEdit *line_edit)
|
|
void NewFlightDialog::onBadInputReceived(QLineEdit *line_edit)
|
|
{
|
|
{
|
|
- DEB(line_edit->objectName() << " - Bad input received - " << line_edit->text());
|
|
|
|
|
|
+ DEB << line_edit->objectName() << " - Bad input received - " << line_edit->text();
|
|
line_edit->setStyleSheet("border: 1px solid red");
|
|
line_edit->setStyleSheet("border: 1px solid red");
|
|
|
|
|
|
- DEB("Mandatory Good: " << mandatoryLineEditsGood.count(true) << " out of "
|
|
|
|
- << mandatoryLineEditsGood.size() << ". Array: " << mandatoryLineEditsGood);
|
|
|
|
|
|
+ DEB << "Mandatory Good: " << mandatoryLineEditsGood.count(true) << " out of "
|
|
|
|
+ << mandatoryLineEditsGood.size() << ". Array: " << mandatoryLineEditsGood;
|
|
ui->submissonReadyLabel->setText("INCOMPLETE");
|
|
ui->submissonReadyLabel->setText("INCOMPLETE");
|
|
ui->submissonReadyLabel->setStyleSheet("color: rgb(237, 212, 0);");
|
|
ui->submissonReadyLabel->setStyleSheet("color: rgb(237, 212, 0);");
|
|
}
|
|
}
|
|
@@ -933,7 +937,7 @@ void NewFlightDialog::onToUpperTriggered_textChanged(const QString &text)
|
|
{
|
|
{
|
|
auto sender_object = sender();
|
|
auto sender_object = sender();
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
- DEB("Text changed - " << line_edit->objectName() << line_edit->text());
|
|
|
|
|
|
+ DEB << "Text changed - " << line_edit->objectName() << line_edit->text();
|
|
{
|
|
{
|
|
const QSignalBlocker blocker(line_edit);
|
|
const QSignalBlocker blocker(line_edit);
|
|
line_edit->setText(text.toUpper());
|
|
line_edit->setText(text.toUpper());
|
|
@@ -944,13 +948,13 @@ void NewFlightDialog::onToUpperTriggered_textChanged(const QString &text)
|
|
void NewFlightDialog::onMandatoryLineEditsFilled()
|
|
void NewFlightDialog::onMandatoryLineEditsFilled()
|
|
{
|
|
{
|
|
if (!(mandatoryLineEditsGood.count(true) == 7)) {
|
|
if (!(mandatoryLineEditsGood.count(true) == 7)) {
|
|
- DEB("erroneously called.");
|
|
|
|
|
|
+ DEB << "erroneously called.";
|
|
return;
|
|
return;
|
|
};
|
|
};
|
|
|
|
|
|
if (updateEnabled)
|
|
if (updateEnabled)
|
|
fillDeductibleData();
|
|
fillDeductibleData();
|
|
- DEB(mandatoryLineEditsGood);
|
|
|
|
|
|
+ DEB << mandatoryLineEditsGood;
|
|
}
|
|
}
|
|
|
|
|
|
// make sure that when using keyboard to scroll through completer sugggestions, line edit is up to date
|
|
// make sure that when using keyboard to scroll through completer sugggestions, line edit is up to date
|
|
@@ -958,7 +962,7 @@ void NewFlightDialog::onCompleter_highlighted(const QString &completion)
|
|
{
|
|
{
|
|
auto sender_object = sender();
|
|
auto sender_object = sender();
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
- DEB("Completer highlighted - " << line_edit->objectName() << completion);
|
|
|
|
|
|
+ DEB << "Completer highlighted - " << line_edit->objectName() << completion;
|
|
line_edit->setText(completion);
|
|
line_edit->setText(completion);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -966,7 +970,7 @@ void NewFlightDialog::onCompleter_activated(const QString &)
|
|
{
|
|
{
|
|
auto sender_object = sender();
|
|
auto sender_object = sender();
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
- DEB("Line edit " << line_edit->objectName() << "completer activated.");
|
|
|
|
|
|
+ DEB << "Line edit " << line_edit->objectName() << "completer activated.";
|
|
emit line_edit->editingFinished();
|
|
emit line_edit->editingFinished();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -979,7 +983,7 @@ void NewFlightDialog::on_doftLineEdit_editingFinished()
|
|
auto line_edit = ui->doftLineEdit;
|
|
auto line_edit = ui->doftLineEdit;
|
|
auto text = ui->doftLineEdit->text();
|
|
auto text = ui->doftLineEdit->text();
|
|
auto label = ui->doftDisplayLabel;
|
|
auto label = ui->doftDisplayLabel;
|
|
- DEB(line_edit->objectName() << "Editing finished - " << text);
|
|
|
|
|
|
+ DEB << line_edit->objectName() << "Editing finished - " << text;
|
|
|
|
|
|
auto date = QDate::fromString(text, Qt::ISODate);
|
|
auto date = QDate::fromString(text, Qt::ISODate);
|
|
if (date.isValid()) {
|
|
if (date.isValid()) {
|
|
@@ -990,7 +994,7 @@ void NewFlightDialog::on_doftLineEdit_editingFinished()
|
|
|
|
|
|
//try to correct input if only numbers are entered, eg 20200101
|
|
//try to correct input if only numbers are entered, eg 20200101
|
|
if(text.length() == 8) {
|
|
if(text.length() == 8) {
|
|
- DEB("Trying to fix input...");
|
|
|
|
|
|
+ DEB << "Trying to fix input...";
|
|
text.insert(4,'-');
|
|
text.insert(4,'-');
|
|
text.insert(7,'-');
|
|
text.insert(7,'-');
|
|
date = QDate::fromString(text, Qt::ISODate);
|
|
date = QDate::fromString(text, Qt::ISODate);
|
|
@@ -1060,7 +1064,7 @@ void NewFlightDialog::onDoftLineEdit_entered()
|
|
void NewFlightDialog::on_calendarCheckBox_stateChanged(int arg1)
|
|
void NewFlightDialog::on_calendarCheckBox_stateChanged(int arg1)
|
|
{
|
|
{
|
|
ASettings::write("NewFlight/calendarCheckBox", ui->calendarCheckBox->isChecked());
|
|
ASettings::write("NewFlight/calendarCheckBox", ui->calendarCheckBox->isChecked());
|
|
- DEB("Calendar check box state changed.");
|
|
|
|
|
|
+ DEB << "Calendar check box state changed.";
|
|
switch (arg1) {
|
|
switch (arg1) {
|
|
case 0: // unchecked
|
|
case 0: // unchecked
|
|
setPopUpCalendarEnabled(false);
|
|
setPopUpCalendarEnabled(false);
|
|
@@ -1090,7 +1094,7 @@ void NewFlightDialog::on_destLocLineEdit_editingFinished()
|
|
void NewFlightDialog::onLocationEditingFinished(QLineEdit *line_edit, QLabel *name_label)
|
|
void NewFlightDialog::onLocationEditingFinished(QLineEdit *line_edit, QLabel *name_label)
|
|
{
|
|
{
|
|
const auto &text = line_edit->text();
|
|
const auto &text = line_edit->text();
|
|
- //DEB(line_edit->objectName() << " Editing finished. " << text);
|
|
|
|
|
|
+ //DEB << line_edit->objectName() << " Editing finished. " << text);
|
|
int airport_id = 0;
|
|
int airport_id = 0;
|
|
|
|
|
|
// try to map iata or icao code to airport id;
|
|
// try to map iata or icao code to airport id;
|
|
@@ -1119,7 +1123,7 @@ void NewFlightDialog::onTimeLineEdit_editingFinished()
|
|
{
|
|
{
|
|
auto sender_object = sender();
|
|
auto sender_object = sender();
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
- DEB(line_edit->objectName() << "Editing Finished -" << line_edit->text());
|
|
|
|
|
|
+ DEB << line_edit->objectName() << "Editing Finished -" << line_edit->text();
|
|
|
|
|
|
line_edit->setText(ACalc::formatTimeInput(line_edit->text()));
|
|
line_edit->setText(ACalc::formatTimeInput(line_edit->text()));
|
|
const auto time = QTime::fromString(line_edit->text(),TIME_FORMAT);
|
|
const auto time = QTime::fromString(line_edit->text(),TIME_FORMAT);
|
|
@@ -1145,10 +1149,10 @@ void NewFlightDialog::onTimeLineEdit_editingFinished()
|
|
void NewFlightDialog::on_acftLineEdit_editingFinished()
|
|
void NewFlightDialog::on_acftLineEdit_editingFinished()
|
|
{
|
|
{
|
|
auto line_edit = ui->acftLineEdit;
|
|
auto line_edit = ui->acftLineEdit;
|
|
- //DEB(line_edit->objectName() << "Editing Finished!" << line_edit->text());
|
|
|
|
|
|
+ //DEB << line_edit->objectName() << "Editing Finished!" << line_edit->text());
|
|
|
|
|
|
if (tailsIdMap.value(line_edit->text()) != 0) {
|
|
if (tailsIdMap.value(line_edit->text()) != 0) {
|
|
- DEB("Mapped: " << line_edit->text() << tailsIdMap.value(line_edit->text()));
|
|
|
|
|
|
+ DEB << "Mapped: " << line_edit->text() << tailsIdMap.value(line_edit->text());
|
|
auto acft = aDB()->getTailEntry(tailsIdMap.value(line_edit->text()));
|
|
auto acft = aDB()->getTailEntry(tailsIdMap.value(line_edit->text()));
|
|
ui->acftTypeLabel->setText(acft.type());
|
|
ui->acftTypeLabel->setText(acft.type());
|
|
onGoodInputReceived(line_edit);
|
|
onGoodInputReceived(line_edit);
|
|
@@ -1158,7 +1162,7 @@ void NewFlightDialog::on_acftLineEdit_editingFinished()
|
|
// try to fix input
|
|
// try to fix input
|
|
if (!line_edit->completer()->currentCompletion().isEmpty()
|
|
if (!line_edit->completer()->currentCompletion().isEmpty()
|
|
&& !line_edit->text().isEmpty()) {
|
|
&& !line_edit->text().isEmpty()) {
|
|
- DEB("Trying to fix input...");
|
|
|
|
|
|
+ DEB << "Trying to fix input...";
|
|
line_edit->setText(line_edit->completer()->currentCompletion());
|
|
line_edit->setText(line_edit->completer()->currentCompletion());
|
|
emit line_edit->editingFinished();
|
|
emit line_edit->editingFinished();
|
|
return;
|
|
return;
|
|
@@ -1178,10 +1182,10 @@ void NewFlightDialog::onPilotNameLineEdit_editingFinished()
|
|
{
|
|
{
|
|
auto sender_object = sender();
|
|
auto sender_object = sender();
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
auto line_edit = this->findChild<QLineEdit*>(sender_object->objectName());
|
|
- //DEB(line_edit->objectName() << "Editing Finished -" << line_edit->text());
|
|
|
|
|
|
+ //DEB << line_edit->objectName() << "Editing Finished -" << line_edit->text());
|
|
|
|
|
|
if(line_edit->text().contains(SELF_RX)) {
|
|
if(line_edit->text().contains(SELF_RX)) {
|
|
- DEB("self recognized.");
|
|
|
|
|
|
+ DEB << "self recognized.";
|
|
line_edit->setText(pilotsIdMap.key(1));
|
|
line_edit->setText(pilotsIdMap.key(1));
|
|
auto pilot = aDB()->getPilotEntry(1);
|
|
auto pilot = aDB()->getPilotEntry(1);
|
|
ui->picCompanyLabel->setText(pilot.getData().value(DB_TAILS_COMPANY).toString());
|
|
ui->picCompanyLabel->setText(pilot.getData().value(DB_TAILS_COMPANY).toString());
|
|
@@ -1190,7 +1194,7 @@ void NewFlightDialog::onPilotNameLineEdit_editingFinished()
|
|
}
|
|
}
|
|
|
|
|
|
if(pilotsIdMap.value(line_edit->text()) != 0) {
|
|
if(pilotsIdMap.value(line_edit->text()) != 0) {
|
|
- DEB("Mapped: " << line_edit->text() << pilotsIdMap.value(line_edit->text()));
|
|
|
|
|
|
+ DEB << "Mapped: " << line_edit->text() << pilotsIdMap.value(line_edit->text());
|
|
auto pilot = aDB()->getPilotEntry(pilotsIdMap.value(line_edit->text()));
|
|
auto pilot = aDB()->getPilotEntry(pilotsIdMap.value(line_edit->text()));
|
|
ui->picCompanyLabel->setText(pilot.getData().value(DB_TAILS_COMPANY).toString());
|
|
ui->picCompanyLabel->setText(pilot.getData().value(DB_TAILS_COMPANY).toString());
|
|
onGoodInputReceived(line_edit);
|
|
onGoodInputReceived(line_edit);
|
|
@@ -1202,7 +1206,7 @@ void NewFlightDialog::onPilotNameLineEdit_editingFinished()
|
|
}
|
|
}
|
|
|
|
|
|
if (!line_edit->completer()->currentCompletion().isEmpty()) {
|
|
if (!line_edit->completer()->currentCompletion().isEmpty()) {
|
|
- DEB("Trying to fix input...");
|
|
|
|
|
|
+ DEB << "Trying to fix input...";
|
|
line_edit->setText(line_edit->completer()->currentCompletion());
|
|
line_edit->setText(line_edit->completer()->currentCompletion());
|
|
emit line_edit->editingFinished();
|
|
emit line_edit->editingFinished();
|
|
return;
|
|
return;
|
|
@@ -1229,7 +1233,7 @@ void NewFlightDialog::on_restoreDefaultButton_clicked()
|
|
|
|
|
|
void NewFlightDialog::on_PilotFlyingCheckBox_stateChanged(int)
|
|
void NewFlightDialog::on_PilotFlyingCheckBox_stateChanged(int)
|
|
{
|
|
{
|
|
- DEB("PF checkbox state changed.");
|
|
|
|
|
|
+ DEB << "PF checkbox state changed.";
|
|
if(ui->PilotFlyingCheckBox->isChecked()){
|
|
if(ui->PilotFlyingCheckBox->isChecked()){
|
|
ui->TakeoffSpinBox->setValue(1);
|
|
ui->TakeoffSpinBox->setValue(1);
|
|
ui->TakeoffCheckBox->setCheckState(Qt::Checked);
|
|
ui->TakeoffCheckBox->setCheckState(Qt::Checked);
|