Browse Source

changed slot name to avoid connect error

fiffty-50 4 years ago
parent
commit
e206d100b9

+ 14 - 7
src/gui/dialogues/newtail.cpp

@@ -22,13 +22,15 @@
 #define DEB(expr) \
     qDebug() << __PRETTY_FUNCTION__<< "\t" << expr
 
-const auto MAKE_VALID = QPair<QString, QRegularExpression> {
-    "makeLineEdit", QRegularExpression("[a-zA-Z]+")};
-const auto MODEL_VALID = QPair<QString, QRegularExpression> {
-    "modelLineEdit", QRegularExpression("\\w+")};
-const auto VARIANT_VALID = QPair<QString, QRegularExpression> {
-    "variantLineEdit", QRegularExpression("\\w+")};
-const auto LINE_EDIT_VALIDATORS = QVector({MAKE_VALID, MODEL_VALID, VARIANT_VALID});
+static const auto REG_VALID = QPair<QString, QRegularExpression> {
+    "registrationLineEdit", QRegularExpression("\\w+-\\w+")};
+static const auto MAKE_VALID = QPair<QString, QRegularExpression> {
+    "makeLineEdit", QRegularExpression("[-a-zA-Z\\s]+")};
+static const auto MODEL_VALID = QPair<QString, QRegularExpression> {
+    "modelLineEdit", QRegularExpression("[\\s\\w-]+")};
+static const auto VARIANT_VALID = QPair<QString, QRegularExpression> {
+    "variantLineEdit", QRegularExpression("[\\s\\w-]+")};
+static const auto LINE_EDIT_VALIDATORS = QVector({REG_VALID, MAKE_VALID, MODEL_VALID, VARIANT_VALID});
 
 
 //Dialog to be used to create a new tail
@@ -318,3 +320,8 @@ void NewTail::on_buttonBox_accepted()
         }
     }
 }
+
+void NewTail::on_registrationLineEdit_textChanged(const QString &arg1)
+{
+    ui->registrationLineEdit->setText(arg1.toUpper());
+}

+ 2 - 0
src/gui/dialogues/newtail.h

@@ -63,6 +63,8 @@ private slots:
 
     void on_weightComboBox_currentIndexChanged(int index);
 
+    void on_registrationLineEdit_textChanged(const QString &arg1);
+
 private:
 
     Ui::NewTail *ui;

+ 4 - 4
src/gui/widgets/aircraftwidget.cpp

@@ -46,8 +46,8 @@ void AircraftWidget::tableView_selectionChanged(const QItemSelection &index, con
     DEB("Selected aircraft with ID#: " << selectedAircraft);
 
     auto nt = new NewTail(Aircraft(selectedAircraft), Db::editExisting, this);
-    connect(nt, SIGNAL(accepted()), this, SLOT(on_widget_accepted()));
-    connect(nt, SIGNAL(rejected()), this, SLOT(on_widget_accepted()));
+    connect(nt, SIGNAL(accepted()), this, SLOT(acft_accepted()));
+    connect(nt, SIGNAL(rejected()), this, SLOT(acft_accepted()));
 
     nt->setWindowFlag(Qt::Widget);
     ui->stackedWidget->addWidget(nt);
@@ -74,11 +74,11 @@ void AircraftWidget::on_newButton_clicked()
     auto nt = new NewTail(QString(), Db::createNew, this);
     connect(nt,
             SIGNAL(accepted()), this,
-            SLOT(on_widget_accepted()));
+            SLOT(acft_accepted()));
     nt->show();
 }
 
-void AircraftWidget::on_widget_accepted()
+void AircraftWidget::acft_accepted()
 {
     DEB("Refreshing View...");
     refreshView();

+ 1 - 1
src/gui/widgets/aircraftwidget.h

@@ -51,7 +51,7 @@ private slots:
 
     void on_newButton_clicked();
 
-    void on_widget_accepted();
+    void acft_accepted();
 
 private:
     Ui::AircraftWidget *ui;

+ 4 - 4
src/gui/widgets/pilotswidget.cpp

@@ -41,8 +41,8 @@ void PilotsWidget::tableView_selectionChanged(const QItemSelection &index, const
     DEB("Selected Pilot with ID#: " << selectedPilot);
 
     auto np = new NewPilot(Pilot(selectedPilot), Db::editExisting, this);
-    connect(np, SIGNAL(accepted()), this, SLOT(on_widget_accepted()));
-    connect(np, SIGNAL(rejected()), this, SLOT(on_widget_accepted()));
+    connect(np, SIGNAL(accepted()), this, SLOT(widget_accepted()));
+    connect(np, SIGNAL(rejected()), this, SLOT(widget_accepted()));
 
     np->setWindowFlag(Qt::Widget);
     ui->stackedWidget->addWidget(np);
@@ -60,7 +60,7 @@ void PilotsWidget::on_newButton_clicked()
     auto np = new NewPilot(Db::createNew, this);
     connect(np,
             SIGNAL(accepted()), this,
-            SLOT(on_widget_accepted()));
+            SLOT(widget_accepted()));
     np->show();
 }
 
@@ -79,7 +79,7 @@ void PilotsWidget::on_deletePushButton_clicked()
     }
 }
 
-void PilotsWidget::on_widget_accepted()
+void PilotsWidget::widget_accepted()
 {
     DEB("Refreshing View...");
     refreshView();

+ 1 - 1
src/gui/widgets/pilotswidget.h

@@ -48,7 +48,7 @@ private slots:
 
     void on_deletePushButton_clicked();
 
-    void on_widget_accepted();
+    void widget_accepted();
 
 private:
     Ui::PilotsWidget *ui;

+ 1 - 1
src/gui/widgets/totalswidget.cpp

@@ -11,7 +11,7 @@ TotalsWidget::TotalsWidget(QWidget *parent) :
     ui->setupUi(this);
     auto data = Stat::totals();
     DEB("Filling Totals Line Edits...");
-    DEB("data: " << data);
+    //DEB("data: " << data);
     for (const auto &field : data) {
         auto line_edit = parent->findChild<QLineEdit *>(field.first + "LineEdit");
         line_edit->setText(field.second);