Browse Source

Rework of NewFlight Dialog

fiffty-50 4 years ago
parent
commit
cdc638f61f
4 changed files with 14 additions and 12 deletions
  1. 2 2
      logbookwidget.cpp
  2. 2 1
      mainwindow.cpp
  3. 7 6
      newflight.cpp
  4. 3 3
      newflight.h

+ 2 - 2
logbookwidget.cpp

@@ -87,8 +87,8 @@ logbookWidget::~logbookWidget()
 
 void logbookWidget::on_newFlightButton_clicked()
 {
-    NewFlight nf(this);
-    nf.exec();
+    //NewFlight nf(this);
+    //nf.exec();
 }
 
 void logbookWidget::on_editFlightButton_clicked() // To Do: Fix! - use new flight, pre-filled with entry loaded from DB

+ 2 - 1
mainwindow.cpp

@@ -119,6 +119,7 @@ void MainWindow::on_actionSettings_triggered()
 
 void MainWindow::on_actionNewFlight_triggered()
 {
-    NewFlight nf(this);
+    QStringList locationList = dbAirport::retreiveIataIcaoList();
+    NewFlight nf(this, locationList);
     nf.exec();
 }

+ 7 - 6
newflight.cpp

@@ -28,7 +28,9 @@
 
 void NewFlight::on_verifyButton_clicked()//debug button
 {
-    fillExtrasLineEdits();
+    //fillExtrasLineEdits();
+    //qDebug() << testlist;
+    qDebug() << parent();
 }
 /*!
  * \brief NewFlight::nope for features that are not yet implemented
@@ -173,7 +175,7 @@ void NewFlight::restoreSettings()
  * Window Construction
  */
 
-NewFlight::NewFlight(QWidget *parent) :
+NewFlight::NewFlight(QWidget *parent, QStringList locationList) :
     QDialog(parent),
     ui(new Ui::NewFlight)
 {
@@ -187,7 +189,6 @@ NewFlight::NewFlight(QWidget *parent) :
     }
 
     // Airport Line Edits Auto Completion
-    QStringList locationList = dbAirport::retreiveIataIcaoList(); //To be moved outside of dialog eventually
     QCompleter *locationCompleter = new QCompleter(locationList);
     locationCompleter->setCaseSensitivity(Qt::CaseInsensitive);
     locationCompleter->setCompletionMode(QCompleter::PopupCompletion);
@@ -289,7 +290,7 @@ void NewFlight::on_newDeptLocLineEdit_textEdited(const QString &arg1)
 void NewFlight::on_newDeptLocLineEdit_editingFinished()
 {
     QStringList locationList = dbAirport::retreiveIataIcaoList(); //To be moved outside of dialog eventually
-
+    //DEBUG(locationList);
     auto line_edit = ui->newDeptLocLineEdit;
     onEditingFinished(line_edit); //reset style sheet
     dept = line_edit->text();
@@ -882,8 +883,8 @@ void NewFlight::on_buttonBox_accepted()
             QMessageBox msgBox(this);
             msgBox.setText("Invalid entries detected. Please check your input.");
             msgBox.exec();
-            NewFlight nf(this);
-            nf.exec();
+            //NewFlight nf(this);
+            //nf.exec();
         }
 }
 

+ 3 - 3
newflight.h

@@ -46,12 +46,14 @@ class NewFlight : public QDialog
     Q_OBJECT
 
 public:
-    explicit NewFlight(QWidget *parent = nullptr);
+    explicit NewFlight(QWidget *parent, QStringList locationList);
     ~NewFlight();
 
 private slots:
     void nope();//error box
 
+    void on_verifyButton_clicked(); //debug button
+
     QVector<QString> collectInput();
 
     void fillExtrasLineEdits();
@@ -92,8 +94,6 @@ private slots:
 
     void on_newPicNameLineEdit_editingFinished();
 
-    void on_verifyButton_clicked();
-
     void on_setAsDefaultButton_clicked();
 
     void on_restoreDefaultButton_clicked();